mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 13:37:11 +00:00
Tweak the flow for setting up a recovery key. (#3463)
* Remove unwanted title. * Update SecureBackupScreen strings. * Update SecureBackupRecoveryKeyScreen. * Show the recovery banner when recovery needs setting up. * Fix SecureBackupScreen title. * Fix timeout on MP4 encoding tests
This commit is contained in:
parent
076ef3e914
commit
c11e49f962
@ -115,9 +115,9 @@
|
||||
"banner_migrate_to_native_sliding_sync_description" = "Your server now supports a new, faster protocol. Log out and log back in to upgrade now. Doing this now will help you avoid a forced logout when the old protocol is removed later.";
|
||||
"banner_migrate_to_native_sliding_sync_force_logout_title" = "Your homeserver no longer supports the old protocol. Please log out and log back in to continue using the app.";
|
||||
"banner_migrate_to_native_sliding_sync_title" = "Upgrade available";
|
||||
"banner_set_up_recovery_content" = "Recover your cryptographic identity and message history with a recovery key if you have lost all your existing devices.";
|
||||
"banner_set_up_recovery_submit" = "Set up recovery";
|
||||
"banner.set_up_recovery.content" = "Recover your cryptographic identity and message history with a recovery key if you have lost all your existing devices.";
|
||||
"banner.set_up_recovery.title" = "Set up recovery to protect your account";
|
||||
"banner_set_up_recovery_title" = "Set up recovery to protect your account";
|
||||
"common_about" = "About";
|
||||
"common_acceptable_use_policy" = "Acceptable use policy";
|
||||
"common_advanced_settings" = "Advanced settings";
|
||||
@ -459,6 +459,7 @@
|
||||
"screen_chat_backup_key_backup_action_enable" = "Turn on backup";
|
||||
"screen_chat_backup_key_backup_description" = "Store your cryptographic identity and message keys securely on the server. This will allow you to view your message history on any new devices. %1$@.";
|
||||
"screen_chat_backup_key_backup_title" = "Key storage";
|
||||
"screen_chat_backup_key_storage_disabled_error" = "Key storage must be turned on to set up recovery.";
|
||||
"screen_chat_backup_key_storage_toggle_description" = "Upload keys from this device";
|
||||
"screen_chat_backup_key_storage_toggle_title" = "Allow key storage";
|
||||
"screen_chat_backup_recovery_action_change" = "Change recovery key";
|
||||
|
@ -266,8 +266,12 @@ internal enum L10n {
|
||||
internal static var bannerMigrateToNativeSlidingSyncForceLogoutTitle: String { return L10n.tr("Localizable", "banner_migrate_to_native_sliding_sync_force_logout_title") }
|
||||
/// Upgrade available
|
||||
internal static var bannerMigrateToNativeSlidingSyncTitle: String { return L10n.tr("Localizable", "banner_migrate_to_native_sliding_sync_title") }
|
||||
/// Recover your cryptographic identity and message history with a recovery key if you have lost all your existing devices.
|
||||
internal static var bannerSetUpRecoveryContent: String { return L10n.tr("Localizable", "banner_set_up_recovery_content") }
|
||||
/// Set up recovery
|
||||
internal static var bannerSetUpRecoverySubmit: String { return L10n.tr("Localizable", "banner_set_up_recovery_submit") }
|
||||
/// Set up recovery to protect your account
|
||||
internal static var bannerSetUpRecoveryTitle: String { return L10n.tr("Localizable", "banner_set_up_recovery_title") }
|
||||
/// About
|
||||
internal static var commonAbout: String { return L10n.tr("Localizable", "common_about") }
|
||||
/// Acceptable use policy
|
||||
@ -1021,6 +1025,8 @@ internal enum L10n {
|
||||
}
|
||||
/// Key storage
|
||||
internal static var screenChatBackupKeyBackupTitle: String { return L10n.tr("Localizable", "screen_chat_backup_key_backup_title") }
|
||||
/// Key storage must be turned on to set up recovery.
|
||||
internal static var screenChatBackupKeyStorageDisabledError: String { return L10n.tr("Localizable", "screen_chat_backup_key_storage_disabled_error") }
|
||||
/// Upload keys from this device
|
||||
internal static var screenChatBackupKeyStorageToggleDescription: String { return L10n.tr("Localizable", "screen_chat_backup_key_storage_toggle_description") }
|
||||
/// Allow key storage
|
||||
@ -2499,15 +2505,6 @@ internal enum L10n {
|
||||
/// Check UnifiedPush
|
||||
internal static var troubleshootNotificationsTestUnifiedPushTitle: String { return L10n.tr("Localizable", "troubleshoot_notifications_test_unified_push_title") }
|
||||
|
||||
internal enum Banner {
|
||||
internal enum SetUpRecovery {
|
||||
/// Recover your cryptographic identity and message history with a recovery key if you have lost all your existing devices.
|
||||
internal static var content: String { return L10n.tr("Localizable", "banner.set_up_recovery.content") }
|
||||
/// Set up recovery to protect your account
|
||||
internal static var title: String { return L10n.tr("Localizable", "banner.set_up_recovery.title") }
|
||||
}
|
||||
}
|
||||
|
||||
internal enum Common {
|
||||
/// Copied to clipboard
|
||||
internal static var copiedToClipboard: String { return L10n.tr("Localizable", "common.copied_to_clipboard") }
|
||||
|
@ -58,7 +58,7 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
switch (securityState.verificationState, securityState.recoveryState) {
|
||||
case (.verified, .disabled):
|
||||
state.requiresExtraAccountSetup = true
|
||||
state.securityBannerMode = .none
|
||||
state.securityBannerMode = .show
|
||||
case (.verified, .incomplete):
|
||||
state.requiresExtraAccountSetup = true
|
||||
|
||||
|
@ -130,7 +130,7 @@ struct HomeScreenContent: View {
|
||||
if context.viewState.slidingSyncMigrationBannerMode == .show {
|
||||
HomeScreenSlidingSyncMigrationBanner(context: context)
|
||||
} else if context.viewState.securityBannerMode == .show {
|
||||
HomeScreenRecoveryKeyConfirmationBanner(context: context)
|
||||
HomeScreenRecoveryKeyConfirmationBanner(requiresExtraAccountSetup: context.viewState.requiresExtraAccountSetup, context: context)
|
||||
}
|
||||
}
|
||||
.background(Color.compound.bgCanvasDefault)
|
||||
|
@ -9,13 +9,18 @@ import Combine
|
||||
import SwiftUI
|
||||
|
||||
struct HomeScreenRecoveryKeyConfirmationBanner: View {
|
||||
let requiresExtraAccountSetup: Bool
|
||||
var context: HomeScreenViewModel.Context
|
||||
|
||||
var title: String { requiresExtraAccountSetup ? L10n.bannerSetUpRecoveryTitle : L10n.confirmRecoveryKeyBannerTitle }
|
||||
var message: String { requiresExtraAccountSetup ? L10n.bannerSetUpRecoveryContent : L10n.confirmRecoveryKeyBannerMessage }
|
||||
var actionTitle: String { requiresExtraAccountSetup ? L10n.bannerSetUpRecoverySubmit : L10n.actionContinue }
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 16) {
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
HStack(spacing: 16) {
|
||||
Text(L10n.confirmRecoveryKeyBannerTitle)
|
||||
Text(title)
|
||||
.font(.compound.bodyLGSemibold)
|
||||
.foregroundColor(.compound.textPrimary)
|
||||
|
||||
@ -29,12 +34,12 @@ struct HomeScreenRecoveryKeyConfirmationBanner: View {
|
||||
.frame(width: 12, height: 12)
|
||||
}
|
||||
}
|
||||
Text(L10n.confirmRecoveryKeyBannerMessage)
|
||||
Text(message)
|
||||
.font(.compound.bodyMD)
|
||||
.foregroundColor(.compound.textSecondary)
|
||||
}
|
||||
|
||||
Button(L10n.actionContinue) {
|
||||
Button(actionTitle) {
|
||||
context.send(viewAction: .confirmRecoveryKey)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
@ -52,7 +57,12 @@ struct HomeScreenRecoveryKeyConfirmationBanner_Previews: PreviewProvider, Testab
|
||||
static let viewModel = buildViewModel()
|
||||
|
||||
static var previews: some View {
|
||||
HomeScreenRecoveryKeyConfirmationBanner(context: viewModel.context)
|
||||
HomeScreenRecoveryKeyConfirmationBanner(requiresExtraAccountSetup: true,
|
||||
context: viewModel.context)
|
||||
.previewDisplayName("Set up recovery")
|
||||
HomeScreenRecoveryKeyConfirmationBanner(requiresExtraAccountSetup: false,
|
||||
context: viewModel.context)
|
||||
.previewDisplayName("Out of sync")
|
||||
}
|
||||
|
||||
static func buildViewModel() -> HomeScreenViewModel {
|
||||
|
@ -28,18 +28,6 @@ class SecureBackupRecoveryKeyScreenViewModel: SecureBackupRecoveryKeyScreenViewM
|
||||
super.init(initialViewState: .init(isModallyPresented: isModallyPresented,
|
||||
mode: secureBackupController.recoveryState.value.viewMode,
|
||||
bindings: .init()))
|
||||
|
||||
secureBackupController.recoveryState
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink(receiveValue: { [weak self] state in
|
||||
switch state {
|
||||
case .settingUp:
|
||||
self?.showLoadingIndicator()
|
||||
default:
|
||||
self?.hideLoadingIndicator()
|
||||
}
|
||||
})
|
||||
.store(in: &cancellables)
|
||||
}
|
||||
|
||||
// MARK: - Public
|
||||
|
@ -28,7 +28,7 @@ struct SecureBackupScreen: View {
|
||||
}
|
||||
}
|
||||
.compoundList()
|
||||
.navigationTitle(L10n.commonChatBackup)
|
||||
.navigationTitle(L10n.commonEncryption)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.alert(item: $context.alertInfo)
|
||||
}
|
||||
@ -68,8 +68,7 @@ struct SecureBackupScreen: View {
|
||||
}
|
||||
|
||||
private var keyStorageToggle: some View {
|
||||
ListRow(label: .plain(title: L10n.screenChatBackupKeyStorageToggleTitle,
|
||||
description: L10n.screenChatBackupKeyStorageToggleDescription),
|
||||
ListRow(label: .plain(title: L10n.screenChatBackupKeyStorageToggleTitle),
|
||||
kind: .toggle($context.keyStorageEnabled))
|
||||
.onChange(of: context.keyStorageEnabled) { _, newValue in
|
||||
context.send(viewAction: .keyStorageToggled(newValue))
|
||||
@ -86,7 +85,10 @@ struct SecureBackupScreen: View {
|
||||
iconAlignment: .top),
|
||||
kind: .navigationLink { context.send(viewAction: .recoveryKey) })
|
||||
case .disabled:
|
||||
ListRow(label: .plain(title: L10n.screenChatBackupRecoveryActionSetup),
|
||||
ListRow(label: .default(title: L10n.screenChatBackupRecoveryActionSetup,
|
||||
description: L10n.screenChatBackupRecoveryActionChangeDescription,
|
||||
icon: \.key,
|
||||
iconAlignment: .top),
|
||||
details: .icon(BadgeView(size: 10)),
|
||||
kind: .navigationLink { context.send(viewAction: .recoveryKey) })
|
||||
case .incomplete:
|
||||
@ -105,8 +107,6 @@ struct SecureBackupScreen: View {
|
||||
@ViewBuilder
|
||||
private var recoveryKeySectionFooter: some View {
|
||||
switch context.viewState.recoveryState {
|
||||
case .disabled:
|
||||
Text(L10n.screenChatBackupRecoveryActionSetupDescription(InfoPlistReader.main.bundleDisplayName))
|
||||
case .incomplete:
|
||||
Text(L10n.screenChatBackupRecoveryActionConfirmDescription)
|
||||
default:
|
||||
|
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreenRecoveryKeyConfirmationBanner-iPad-en-GB.Out-of-sync.png
(Stored with Git LFS)
Normal file
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreenRecoveryKeyConfirmationBanner-iPad-en-GB.Out-of-sync.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreenRecoveryKeyConfirmationBanner-iPad-en-GB.Set-up-recovery.png
(Stored with Git LFS)
Normal file
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreenRecoveryKeyConfirmationBanner-iPad-en-GB.Set-up-recovery.png
(Stored with Git LFS)
Normal file
Binary file not shown.
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreenRecoveryKeyConfirmationBanner-iPad-pseudo.Out-of-sync.png
(Stored with Git LFS)
Normal file
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreenRecoveryKeyConfirmationBanner-iPad-pseudo.Out-of-sync.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreenRecoveryKeyConfirmationBanner-iPad-pseudo.Set-up-recovery.png
(Stored with Git LFS)
Normal file
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreenRecoveryKeyConfirmationBanner-iPad-pseudo.Set-up-recovery.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreenRecoveryKeyConfirmationBanner-iPhone-16-en-GB.Set-up-recovery.png
(Stored with Git LFS)
Normal file
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreenRecoveryKeyConfirmationBanner-iPhone-16-en-GB.Set-up-recovery.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreenRecoveryKeyConfirmationBanner-iPhone-16-pseudo.Set-up-recovery.png
(Stored with Git LFS)
Normal file
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreenRecoveryKeyConfirmationBanner-iPhone-16-pseudo.Set-up-recovery.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_secureBackupScreen-iPad-en-GB.Both-setup.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_secureBackupScreen-iPad-en-GB.Both-setup.png
(Stored with Git LFS)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_secureBackupScreen-iPad-pseudo.Both-setup.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_secureBackupScreen-iPad-pseudo.Both-setup.png
(Stored with Git LFS)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_secureBackupScreen-iPhone-16-en-GB.Both-setup.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_secureBackupScreen-iPhone-16-en-GB.Both-setup.png
(Stored with Git LFS)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_secureBackupScreen-iPhone-16-pseudo.Both-setup.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_secureBackupScreen-iPhone-16-pseudo.Both-setup.png
(Stored with Git LFS)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -46,8 +46,8 @@ final class MediaUploadingPreprocessorTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testLandscapeMovVideoProcessing() async {
|
||||
// Allow double the default execution time as we encode the video twice now.
|
||||
executionTimeAllowance = 120
|
||||
// Allow an increased execution time as we encode the video twice now.
|
||||
executionTimeAllowance = 180
|
||||
|
||||
guard let url = Bundle(for: Self.self).url(forResource: "landscape_test_video.mov", withExtension: nil) else {
|
||||
XCTFail("Failed retrieving test asset")
|
||||
@ -109,8 +109,8 @@ final class MediaUploadingPreprocessorTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testPortraitMp4VideoProcessing() async {
|
||||
// Allow double the default execution time as we encode the video twice now.
|
||||
executionTimeAllowance = 120
|
||||
// Allow an increased execution time as we encode the video twice now.
|
||||
executionTimeAllowance = 180
|
||||
|
||||
guard let url = Bundle(for: Self.self).url(forResource: "portrait_test_video.mp4", withExtension: nil) else {
|
||||
XCTFail("Failed retrieving test asset")
|
||||
|
Loading…
x
Reference in New Issue
Block a user