diff --git a/apple/OmnivoreKit/Sources/App/Views/Profile/ProfileView.swift b/apple/OmnivoreKit/Sources/App/Views/Profile/ProfileView.swift index 8a5c1688c..cabea0942 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Profile/ProfileView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Profile/ProfileView.swift @@ -40,7 +40,7 @@ import Views do { try await dataService.deleteAccount(userID: currentViewer.unwrappedUserID) - authenticator.logout(dataService: dataService) + authenticator.logout(dataService: dataService, showAppleRevokeTokenAlert: true) } catch { deleteAccountErrorMessage = "We were unable to delete your account." } diff --git a/apple/OmnivoreKit/Sources/App/Views/WelcomeView.swift b/apple/OmnivoreKit/Sources/App/Views/WelcomeView.swift index 3f9009c04..f7361e714 100644 --- a/apple/OmnivoreKit/Sources/App/Views/WelcomeView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/WelcomeView.swift @@ -8,6 +8,7 @@ struct WelcomeView: View { @EnvironmentObject var dataService: DataService @EnvironmentObject var authenticator: Authenticator @Environment(\.horizontalSizeClass) var horizontalSizeClass + @Environment(\.openURL) var openURL @StateObject private var viewModel = RegistrationViewModel() @@ -20,6 +21,9 @@ struct WelcomeView: View { @State private var selectedEnvironment = AppEnvironment.initialAppEnvironment @State private var containerSize: CGSize = .zero + // swiftlint:disable:next line_length + let deletedAccountConfirmationMessage = "Your account has been deleted. Additional steps may be needed if Sign in with Apple was used to register." + func handleHiddenGestureAction() { if !Bundle.main.isAppStoreBuild { showDebugModal = true @@ -205,6 +209,12 @@ struct WelcomeView: View { .sheet(isPresented: $showDebugModal) { DebugMenuView(selectedEnvironment: $selectedEnvironment) } + .alert(deletedAccountConfirmationMessage, isPresented: $authenticator.showAppleRevokeTokenAlert) { + Button("View Details") { + openURL(URL(string: "https://support.apple.com/en-us/HT210426")!) + } + Button("Dismiss") { self.authenticator.showAppleRevokeTokenAlert = false } + } } } .preferredColorScheme(.light) diff --git a/apple/OmnivoreKit/Sources/Services/Authentication/Authenticator.swift b/apple/OmnivoreKit/Sources/Services/Authentication/Authenticator.swift index 432508e68..2d5a5dc6b 100644 --- a/apple/OmnivoreKit/Sources/Services/Authentication/Authenticator.swift +++ b/apple/OmnivoreKit/Sources/Services/Authentication/Authenticator.swift @@ -18,6 +18,7 @@ public final class Authenticator: ObservableObject { } @Published public internal(set) var isLoggedIn: Bool + @Published public var showAppleRevokeTokenAlert = false let networker: Networker @@ -36,11 +37,12 @@ public final class Authenticator: ObservableObject { ValetKey.authToken.value() } - public func logout(dataService: DataService) { + public func logout(dataService: DataService, showAppleRevokeTokenAlert _: Bool = false) { dataService.resetCoreData() clearCreds() Authenticator.unregisterIntercomUser?() isLoggedIn = false + showAppleRevokeTokenAlert = true } public func clearCreds() {