Fix settings screen session verification crash

This commit is contained in:
Stefan Ceriu
2023-02-28 12:43:03 +02:00
committed by Stefan Ceriu
parent 9bba378c2d
commit a0de1ef226
2 changed files with 8 additions and 1 deletions
@@ -27,10 +27,16 @@ class SettingsScreenViewModel: SettingsScreenViewModelType, SettingsScreenViewMo
init(withUserSession userSession: UserSessionProtocol) {
self.userSession = userSession
let bindings = SettingsScreenViewStateBindings(timelineStyle: ServiceLocator.shared.settings.timelineStyle)
var showSessionVerificationSection = false
if let sessionVerificationController = userSession.sessionVerificationController {
showSessionVerificationSection = !sessionVerificationController.isVerified
}
super.init(initialViewState: .init(bindings: bindings,
deviceID: userSession.deviceID,
userID: userSession.userID,
showSessionVerificationSection: !(userSession.sessionVerificationController?.isVerified ?? false),
showSessionVerificationSection: showSessionVerificationSection,
showDeveloperOptions: ServiceLocator.shared.settings.canShowDeveloperOptions),
imageProvider: userSession.mediaProvider)