fix: address all PR review comments
- HTTPClient: replace isRefreshing bool with shared Task to safely coalesce concurrent 401 refresh attempts; surface JSON serialization error instead of silently dropping request body - AuthService.logout: always clear Keychain tokens via defer, even when refresh token is absent, preventing stale access token - NotificationsAPIService: remove updateAppBadge (UIKit call moved to @MainActor NotificationsViewModel); drop unused UIKit import - NotificationsViewModel: guard startPolling() against duplicate tasks; update badge directly on @MainActor instead of hopping to actor - VerifyEmailView: replace Timer (never invalidated) with async Task cancelled in .onDisappear - NotificationsView: use Text(date, style: .relative) — auto-updates without custom formatter; remove duplicate Date extension - SettingsView: handle logoutAll errors explicitly with alert instead of silently proceeding with local logout - MaydayLiveActivity/Info.plist: add NSExtensionPrincipalClass so the widget extension is discoverable by the system - Live Activity widget: replace frozen duration(from:) with Text(date, style: .timer); replace frozen relativeFormatted with Text(date, style: .relative); localize status badge to Russian Co-authored-by: robonen <26167508+robonen@users.noreply.github.com>
This commit is contained in:
@@ -7,6 +7,7 @@ struct SettingsView: View {
|
||||
@State private var showChangePassword = false
|
||||
@State private var showSessions = false
|
||||
@State private var showLogoutAllConfirm = false
|
||||
@State private var logoutAllError: String?
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
@@ -81,12 +82,27 @@ struct SettingsView: View {
|
||||
) {
|
||||
Button("Выйти везде", role: .destructive) {
|
||||
Task {
|
||||
_ = try? await NotificationsAPIService.shared.logoutAll()
|
||||
await authViewModel.logout()
|
||||
do {
|
||||
_ = try await NotificationsAPIService.shared.logoutAll()
|
||||
await authViewModel.logout()
|
||||
} catch {
|
||||
logoutAllError = error.localizedDescription
|
||||
}
|
||||
}
|
||||
}
|
||||
Button("Отмена", role: .cancel) {}
|
||||
}
|
||||
.alert(
|
||||
"Ошибка",
|
||||
isPresented: Binding(
|
||||
get: { logoutAllError != nil },
|
||||
set: { if !$0 { logoutAllError = nil } }
|
||||
)
|
||||
) {
|
||||
Button("OK") { logoutAllError = nil }
|
||||
} message: {
|
||||
Text(logoutAllError ?? "")
|
||||
}
|
||||
.task {
|
||||
await viewModel.loadSessions()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user