Remove redundant versions.contains(.native) check

This commit is contained in:
Stefan Ceriu 2024-09-13 14:26:41 +03:00 committed by Stefan Ceriu
parent d53e185d81
commit feaaeb5090

View File

@ -316,21 +316,18 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
return return
} }
if versions.contains(.native) { if versions.contains(where: \.isProxy) { // Both available, prompt for migration
// Both available, prompt for migration state.slidingSyncMigrationBannerMode = .show
if versions.contains(where: \.isProxy) { } else { // The proxy has been removed and logout is needed
state.slidingSyncMigrationBannerMode = .show // Delay setting the alert otherwise it automatically gets dismissed. Same as the crashed last run one
} else { // The proxy has been removed and logout is needed DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
// Delay setting the alert otherwise it automatically gets dismissed. Same as the crashed last run one self.state.bindings.alertInfo = AlertInfo(id: UUID(),
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { title: L10n.bannerMigrateToNativeSlidingSyncForceLogoutTitle,
self.state.bindings.alertInfo = AlertInfo(id: UUID(), primaryButton: .init(title: L10n.bannerMigrateToNativeSlidingSyncAction,
title: L10n.bannerMigrateToNativeSlidingSyncForceLogoutTitle, action: { [weak self] in
primaryButton: .init(title: L10n.bannerMigrateToNativeSlidingSyncAction, self?.appSettings.slidingSyncDiscovery = .native
action: { [weak self] in self?.actionsSubject.send(.logoutWithoutConfirmation)
self?.appSettings.slidingSyncDiscovery = .native }))
self?.actionsSubject.send(.logoutWithoutConfirmation)
}))
}
} }
} }
} }