Skip to content

Commit

Permalink
Handle offline issue in UserSessionsDataProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
alfogrillo committed May 29, 2023
1 parent 94d19d4 commit 7275a49
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,17 @@ class UserSessionsDataProvider: UserSessionsDataProviderProtocol {
guard let deviceInfo = deviceInfo else {
return .permanentlyUnverified
}

guard session.crypto?.crossSigning.canCrossSign == true else {

// When the app is launched offline the cross signing state is "notBootstrapped"
// In this edge case the verification state returned is `.unknown` since we cannot say more even for the current session.
guard
let crossSigning = session.crypto?.crossSigning,
crossSigning.state.rawValue > MXCrossSigningState.notBootstrapped.rawValue
else {
return .unknown
}

guard crossSigning.canCrossSign else {
return deviceInfo.deviceId == session.myDeviceId ? .unverified : .unknown
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ struct UserSessionsOverview: View {
otherSessionsSection
}
}
.disabled(viewModel.viewState.showLoadingIndicator)
.background(theme.colors.system.ignoresSafeArea())
.frame(maxWidth: .infinity, maxHeight: .infinity)
.navigationTitle(VectorL10n.userSessionsOverviewTitle)
Expand Down

0 comments on commit 7275a49

Please sign in to comment.