mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
show alert after deleting account
This commit is contained in:
parent
e6e954c7ad
commit
fbb2565d11
3 changed files with 14 additions and 2 deletions
|
|
@ -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."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue