Skip to content

Commit

Permalink
renamings and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
caldrian committed Jan 14, 2025
1 parent 9ad9934 commit 727bc20
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand All @@ -54,21 +51,16 @@ struct BackupActionsView: View {
.presentationDetents([.medium])
}
}
.listRowBackground(Color(ColorTheme.Backgrounds.surface))

Section(footer: Text(L10n.Localizable.Settings.RestoreFromBackup.description)) {
Button {
viewModel.confirmBackupRestore {
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
Expand All @@ -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()
}
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 727bc20

Please sign in to comment.