diff --git a/App/Views/Modifiers/OpenURLModifier.swift b/App/Views/Modifiers/OpenURLModifier.swift index 80cdfd1..7dfe14c 100644 --- a/App/Views/Modifiers/OpenURLModifier.swift +++ b/App/Views/Modifiers/OpenURLModifier.swift @@ -155,7 +155,6 @@ struct OpenURLModifier: ViewModifier { switch url.pathComponents[safe: 2] { case "images": if let id = url.pathComponents[safe: 3] { - print(id) Task { do { let image = try await self.globalViewModel.getImagePublicMetadata(id: id) diff --git a/App/Views/Settings/MaintainanceSettingsView.swift b/App/Views/Settings/MaintainanceSettingsView.swift index 116a662..7f075ed 100644 --- a/App/Views/Settings/MaintainanceSettingsView.swift +++ b/App/Views/Settings/MaintainanceSettingsView.swift @@ -3,27 +3,46 @@ import WidgetKit import Nuke struct MaintainanceSettingsView: View { + @EnvironmentObject private var globalViewModel: GlobalViewModel + @AppStorage("hasPresentedWelcome") private var hasPresentedWelcome: Bool = false + @State private var isForgetAlertPresented = false + private func clearNukeCache() { ImagePipeline.shared.cache.removeAll() } private func forgetEverything() { self.clearNukeCache() + UserDefaults.standard.removePersistentDomain(forName: "me.jkelol111.Iamages") + UserDefaults.standard.removePersistentDomain(forName: "group.me.jkelol111.Iamages") + UserDefaults.standard.synchronize() + try? self.globalViewModel.logout() } var body: some View { - Section { + Section("Non-destructive") { Button("Force widget refresh") { WidgetCenter.shared.reloadAllTimelines() } - Button("Clear image cache", action: self.clearNukeCache) Button("Show welcome sheet on next launch") { self.hasPresentedWelcome = false } .disabled(!self.hasPresentedWelcome) + } + Section { + Button("Clear image cache", role: .destructive, action: self.clearNukeCache) + Button("Forget everything", role: .destructive) { + self.isForgetAlertPresented = true + } + .confirmationDialog("Forget everything?", isPresented: self.$isForgetAlertPresented, titleVisibility: .visible) { + Button("Forget", role: .destructive, action: self.forgetEverything) + } message: { + Text("Everything will be reset to defaults!\nYou will have to log in again.") + } } header: { + Text("Destructive") } footer: { Text("Use these options only if something seems off, Iamages can take care of itself!") } diff --git a/Iamages.xcodeproj/project.pbxproj b/Iamages.xcodeproj/project.pbxproj index 5cb5667..8666100 100644 --- a/Iamages.xcodeproj/project.pbxproj +++ b/Iamages.xcodeproj/project.pbxproj @@ -1005,7 +1005,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 29; + CURRENT_PROJECT_VERSION = 31; DEVELOPMENT_TEAM = 2VZNUT7D2E; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = Widgets/Info.plist; @@ -1017,7 +1017,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 4.1.1; + MARKETING_VERSION = 4.1.2; PRODUCT_BUNDLE_IDENTIFIER = me.jkelol111.Iamages.Widgets; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; @@ -1039,7 +1039,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 29; + CURRENT_PROJECT_VERSION = 31; DEVELOPMENT_TEAM = 2VZNUT7D2E; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = Widgets/Info.plist; @@ -1051,7 +1051,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 4.1.1; + MARKETING_VERSION = 4.1.2; PRODUCT_BUNDLE_IDENTIFIER = me.jkelol111.Iamages.Widgets; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; @@ -1072,7 +1072,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 29; + CURRENT_PROJECT_VERSION = 31; DEVELOPMENT_TEAM = 2VZNUT7D2E; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = ShareExtension/Info.plist; @@ -1084,7 +1084,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 4.1.1; + MARKETING_VERSION = 4.1.2; PRODUCT_BUNDLE_IDENTIFIER = me.jkelol111.Iamages.ShareExtension; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; @@ -1104,7 +1104,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 29; + CURRENT_PROJECT_VERSION = 31; DEVELOPMENT_TEAM = 2VZNUT7D2E; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = ShareExtension/Info.plist; @@ -1116,7 +1116,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 4.1.1; + MARKETING_VERSION = 4.1.2; PRODUCT_BUNDLE_IDENTIFIER = me.jkelol111.Iamages.ShareExtension; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; @@ -1251,7 +1251,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 29; + CURRENT_PROJECT_VERSION = 31; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"App/Preview Content\""; DEVELOPMENT_TEAM = 2VZNUT7D2E; @@ -1277,7 +1277,7 @@ LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 13.0; - MARKETING_VERSION = 4.1.1; + MARKETING_VERSION = 4.1.2; PRODUCT_BUNDLE_IDENTIFIER = me.jkelol111.Iamages; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; @@ -1301,7 +1301,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 29; + CURRENT_PROJECT_VERSION = 31; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"App/Preview Content\""; DEVELOPMENT_TEAM = 2VZNUT7D2E; @@ -1327,7 +1327,7 @@ LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 13.0; - MARKETING_VERSION = 4.1.1; + MARKETING_VERSION = 4.1.2; PRODUCT_BUNDLE_IDENTIFIER = me.jkelol111.Iamages; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; diff --git a/ShareExtension/ShareView.swift b/ShareExtension/ShareView.swift index 8490a9c..34208a7 100644 --- a/ShareExtension/ShareView.swift +++ b/ShareExtension/ShareView.swift @@ -29,6 +29,7 @@ struct ShareView: View { } private func upload() async { + self.focusedField = nil await self.uploadModel.upload() if self.uploadModel.error == nil { self.dismiss() @@ -97,7 +98,7 @@ struct ShareView: View { self.dismiss() } } message: { - Text("This image will not be uploaded") + Text("This image will not be uploaded.") } } ToolbarItem(placement: .primaryAction) { diff --git a/Widgets/Views/ImageWidgetEntryView.swift b/Widgets/Views/ImageWidgetEntryView.swift index 4518e11..6d20e87 100644 --- a/Widgets/Views/ImageWidgetEntryView.swift +++ b/Widgets/Views/ImageWidgetEntryView.swift @@ -50,7 +50,7 @@ struct ImageWidgetEntryView : View { .fill(.orange.gradient) } } - .widgetURL(URL(string: "iamages://api/images/\(self.entry.id ?? "")/embed")) + .widgetURL(URL(string: "iamages://open/api/images/\(self.entry.id ?? "")/embed")) } }