From 727bc20dd21b4bc042b825e6c83368942e0ed3fb Mon Sep 17 00:00:00 2001 From: Christoph Aldrian Date: Tue, 14 Jan 2025 15:33:49 +0100 Subject: [PATCH] renamings and fixes --- ... => BackupPasswordValidatorProtocol.swift} | 0 .../BackupRestoreViewController.swift | 2 +- ...ionsView.swift => BackupRestoreView.swift} | 30 +++++++------------ ...w.swift => BackupRestoreViewPreview.swift} | 4 +-- ...t => BackupRestoreViewSnapshotTests.swift} | 2 +- 5 files changed, 15 insertions(+), 23 deletions(-) rename WireUI/Sources/WireSettingsUI/Account/Backup/Protocols/{BackupPasswordValidator.swift => BackupPasswordValidatorProtocol.swift} (100%) rename WireUI/Sources/WireSettingsUI/Account/Backup/Views/{BackupActionsView.swift => BackupRestoreView.swift} (76%) rename WireUI/Sources/WireSettingsUI/Account/Backup/Views/Preview/{BackupActionsPreview.swift => BackupRestoreViewPreview.swift} (95%) rename WireUI/Tests/WireSettingsUITests/Account/Backup/{BackupActionsViewSnapshotTests.swift => BackupRestoreViewSnapshotTests.swift} (97%) diff --git a/WireUI/Sources/WireSettingsUI/Account/Backup/Protocols/BackupPasswordValidator.swift b/WireUI/Sources/WireSettingsUI/Account/Backup/Protocols/BackupPasswordValidatorProtocol.swift similarity index 100% rename from WireUI/Sources/WireSettingsUI/Account/Backup/Protocols/BackupPasswordValidator.swift rename to WireUI/Sources/WireSettingsUI/Account/Backup/Protocols/BackupPasswordValidatorProtocol.swift diff --git a/WireUI/Sources/WireSettingsUI/Account/Backup/ViewControllers/BackupRestoreViewController.swift b/WireUI/Sources/WireSettingsUI/Account/Backup/ViewControllers/BackupRestoreViewController.swift index b3c8b33f7c..90d55ecb22 100644 --- a/WireUI/Sources/WireSettingsUI/Account/Backup/ViewControllers/BackupRestoreViewController.swift +++ b/WireUI/Sources/WireSettingsUI/Account/Backup/ViewControllers/BackupRestoreViewController.swift @@ -38,7 +38,7 @@ public final class BackupRestoreViewController: UIViewController { } private func setupView() { - let hostingController = UIHostingController(rootView: BackupActionsView(viewModel: viewModel)) + let hostingController = UIHostingController(rootView: BackupRestoreView(viewModel: viewModel)) addChild(hostingController) hostingController.view.translatesAutoresizingMaskIntoConstraints = false view.addSubview(hostingController.view) diff --git a/WireUI/Sources/WireSettingsUI/Account/Backup/Views/BackupActionsView.swift b/WireUI/Sources/WireSettingsUI/Account/Backup/Views/BackupRestoreView.swift similarity index 76% rename from WireUI/Sources/WireSettingsUI/Account/Backup/Views/BackupActionsView.swift rename to WireUI/Sources/WireSettingsUI/Account/Backup/Views/BackupRestoreView.swift index 637af465cc..a9d102e558 100644 --- a/WireUI/Sources/WireSettingsUI/Account/Backup/Views/BackupActionsView.swift +++ b/WireUI/Sources/WireSettingsUI/Account/Backup/Views/BackupRestoreView.swift @@ -20,9 +20,10 @@ import SwiftUI import WireDesign import WireReusableUIComponents -struct BackupActionsView: View { +struct BackupRestoreView: View { + + @ObservedObject private(set) var viewModel: BackupRestoreViewModel - @ObservedObject private var viewModel: BackupRestoreViewModel @State private var isExportBackupSheetPresented: Bool = false @State private var isBackupPickerPresented: Bool = false @State private var isRestoreBackupSheetPresented: Bool = false @@ -34,13 +35,9 @@ struct BackupActionsView: View { Button { isExportBackupSheetPresented.toggle() } label: { - HStack { - Text(L10n.Localizable.Settings.ExportBackup.action) - .wireTextStyle(.body2) - .foregroundStyle(Color.primaryText) - Spacer() - Image(systemName: "chevron.right").foregroundStyle(Color.primary) - } + Text(L10n.Localizable.Settings.ExportBackup.action) + .wireTextStyle(.body2) + .foregroundStyle(Color.primaryText) } .sheet(isPresented: $isExportBackupSheetPresented) { NavigationStack { @@ -54,7 +51,6 @@ struct BackupActionsView: View { .presentationDetents([.medium]) } } - .listRowBackground(Color(ColorTheme.Backgrounds.surface)) Section(footer: Text(L10n.Localizable.Settings.RestoreFromBackup.description)) { Button { @@ -62,13 +58,9 @@ struct BackupActionsView: View { isBackupPickerPresented.toggle() } } label: { - HStack { - Text(L10n.Localizable.Settings.RestoreFromBackup.action) - .font(.textStyle(.body2)) - .foregroundStyle(Color.primaryText) - Spacer() - Image(systemName: "chevron.right").foregroundStyle(Color.primary) - } + Text(L10n.Localizable.Settings.RestoreFromBackup.action) + .font(.textStyle(.body2)) + .foregroundStyle(Color.primaryText) } .fullScreenCover(isPresented: $isBackupPickerPresented) { BackupPicker { url in @@ -93,13 +85,13 @@ struct BackupActionsView: View { .presentationDetents([.medium]) } } - .listRowBackground(Color(ColorTheme.Backgrounds.surface)) } .listStyle(.grouped) + .background(Color(ColorTheme.Backgrounds.background)) .scrollContentBackground(.hidden) } } #Preview { - BackupActionsPreview() + BackupRestoreViewPreview() } diff --git a/WireUI/Sources/WireSettingsUI/Account/Backup/Views/Preview/BackupActionsPreview.swift b/WireUI/Sources/WireSettingsUI/Account/Backup/Views/Preview/BackupRestoreViewPreview.swift similarity index 95% rename from WireUI/Sources/WireSettingsUI/Account/Backup/Views/Preview/BackupActionsPreview.swift rename to WireUI/Sources/WireSettingsUI/Account/Backup/Views/Preview/BackupRestoreViewPreview.swift index cfd563ca91..4d016fbcd1 100644 --- a/WireUI/Sources/WireSettingsUI/Account/Backup/Views/Preview/BackupActionsPreview.swift +++ b/WireUI/Sources/WireSettingsUI/Account/Backup/Views/Preview/BackupRestoreViewPreview.swift @@ -20,8 +20,8 @@ import WireFoundation import SwiftUI @ViewBuilder @MainActor -func BackupActionsPreview() -> some View { - BackupActionsView(viewModel: BackupRestoreViewModel( +func BackupRestoreViewPreview() -> some View { + BackupRestoreView(viewModel: BackupRestoreViewModel( backupSource: MockBackupSource(), restoreSource: MockRestoreSource(), backupResultHandler: BackupResultHandler( diff --git a/WireUI/Tests/WireSettingsUITests/Account/Backup/BackupActionsViewSnapshotTests.swift b/WireUI/Tests/WireSettingsUITests/Account/Backup/BackupRestoreViewSnapshotTests.swift similarity index 97% rename from WireUI/Tests/WireSettingsUITests/Account/Backup/BackupActionsViewSnapshotTests.swift rename to WireUI/Tests/WireSettingsUITests/Account/Backup/BackupRestoreViewSnapshotTests.swift index a9e056b038..c15b7b79d1 100644 --- a/WireUI/Tests/WireSettingsUITests/Account/Backup/BackupActionsViewSnapshotTests.swift +++ b/WireUI/Tests/WireSettingsUITests/Account/Backup/BackupRestoreViewSnapshotTests.swift @@ -38,7 +38,7 @@ final class BackupActionsViewSnapshotTests: XCTestCase { @MainActor func testBackupActions() { let screenBounds = UIScreen.main.bounds - let sut = BackupActionsPreview() + let sut = BackupRestoreViewPreview() .frame(width: screenBounds.width, height: screenBounds.height) snapshotHelper