mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2025-06-28 12:19:54 +00:00
check active token on start
This commit is contained in:
parent
cb77cdd534
commit
c7b6e51f94
2 changed files with 9 additions and 4 deletions
|
@ -542,9 +542,14 @@ func registerToken(token: DeviceToken) {
|
|||
Task {
|
||||
do {
|
||||
let status = try await apiRegisterToken(token: token, notificationMode: mode)
|
||||
await MainActor.run { m.tokenStatus = status }
|
||||
if status == .active {
|
||||
let checkedStatus = try await apiCheckToken(token: token)
|
||||
await MainActor.run { m.tokenStatus = checkedStatus }
|
||||
} else {
|
||||
await MainActor.run { m.tokenStatus = status }
|
||||
}
|
||||
} catch let error {
|
||||
logger.error("registerToken apiRegisterToken error: \(responseError(error))")
|
||||
logger.error("registerToken apiRegisterToken or apiCheckToken error: \(responseError(error))")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -479,7 +479,7 @@ struct SettingsView: View {
|
|||
color = theme.colors.secondary
|
||||
case .invalid:
|
||||
icon = "bolt.slash"
|
||||
color = theme.colors.secondary
|
||||
color = .red
|
||||
case .confirmed:
|
||||
icon = "bolt.fill"
|
||||
color = .yellow
|
||||
|
@ -488,7 +488,7 @@ struct SettingsView: View {
|
|||
color = .green
|
||||
case .expired:
|
||||
icon = "bolt.slash.fill"
|
||||
color = theme.colors.secondary
|
||||
color = .red
|
||||
case .none:
|
||||
icon = "bolt"
|
||||
color = theme.colors.secondary
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue