Skip to content

Commit

Permalink
🐛 (LekaApp): End update alert spamming
Browse files Browse the repository at this point in the history
  • Loading branch information
HPezz authored and ladislas committed Dec 2, 2024
1 parent 4b1f02a commit 8a48da1
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Apps/LekaApp/Sources/Views/MainView/MainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,15 @@ struct MainView: View {
.logEventScreenView(screenName: "caregiver_picker", context: .sheet)
.navigationBarTitleDisplayMode(.inline)
.onDisappear {
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
if case .appUpdateAvailable = UpdateManager.shared.appUpdateStatus {
self.showingAppUpdateAlert = true
} else if case .osUpdateAvailable = UpdateManager.shared.osUpdateStatus {
self.showingOSUpdateAlert = true
if !self.updateAlertHasBeenShown {
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
if case .appUpdateAvailable = UpdateManager.shared.appUpdateStatus {
self.showingAppUpdateAlert = true
self.updateAlertHasBeenShown = true
} else if case .osUpdateAvailable = UpdateManager.shared.osUpdateStatus {
self.showingOSUpdateAlert = true
self.updateAlertHasBeenShown = true
}
}
}
}
Expand Down Expand Up @@ -392,6 +396,7 @@ struct MainView: View {

@State private var showingAppUpdateAlert: Bool = false
@State private var showingOSUpdateAlert: Bool = false
@State private var updateAlertHasBeenShown: Bool = false

private var persistentDataManager: PersistentDataManager = .shared
private var caregiverManager: CaregiverManager = .shared
Expand Down

0 comments on commit 8a48da1

Please sign in to comment.