Fixes #3146 - Remove the account migration screen

This commit is contained in:
Stefan Ceriu
2024-08-12 11:58:22 +03:00
committed by Stefan Ceriu
parent cce42a7126
commit 6759a66533
13 changed files with 6 additions and 146 deletions
@@ -188,17 +188,11 @@ struct HomeScreen: View {
// MARK: - Previews
struct HomeScreen_Previews: PreviewProvider, TestablePreview {
static let migratingViewModel = viewModel(.migration)
static let loadingViewModel = viewModel(.skeletons)
static let emptyViewModel = viewModel(.empty)
static let loadedViewModel = viewModel(.rooms)
static var previews: some View {
NavigationStack {
HomeScreen(context: migratingViewModel.context)
}
.previewDisplayName("Migrating")
NavigationStack {
HomeScreen(context: loadingViewModel.context)
}
@@ -218,14 +212,9 @@ struct HomeScreen_Previews: PreviewProvider, TestablePreview {
}
static func viewModel(_ mode: HomeScreenRoomListMode) -> HomeScreenViewModel {
let userID = mode == .migration ? "@unmigrated_alice:example.com" : "@alice:example.com"
let appSettings = AppSettings() // This uses shared storage under the hood
appSettings.migratedAccounts[userID] = mode != .migration
let userID = "@alice:example.com"
let roomSummaryProviderState: RoomSummaryProviderMockConfigurationState = switch mode {
case .migration:
.loading
case .skeletons:
.loading
case .empty:
@@ -241,7 +230,7 @@ struct HomeScreen_Previews: PreviewProvider, TestablePreview {
return HomeScreenViewModel(userSession: userSession,
analyticsService: ServiceLocator.shared.analytics,
appSettings: appSettings,
appSettings: ServiceLocator.shared.settings,
selectedRoomPublisher: CurrentValueSubject<String?, Never>(nil).asCurrentValuePublisher(),
userIndicatorController: ServiceLocator.shared.userIndicatorController)
}
@@ -16,13 +16,8 @@ struct HomeScreenContent: View {
let scrollViewAdapter: ScrollViewAdapter
var body: some View {
switch context.viewState.roomListMode {
case .migration:
migrationView
default:
roomList
.sentryTrace("\(Self.self)")
}
roomList
.sentryTrace("\(Self.self)")
}
private var roomList: some View {
@@ -59,8 +54,6 @@ struct HomeScreenContent: View {
.searchable(text: $context.searchQuery, placement: .navigationBarDrawer(displayMode: .always))
.compoundSearchField()
.disableAutocorrection(true)
case .migration:
EmptyView()
}
}
.introspect(.scrollView, on: .supportedVersions) { scrollView in
@@ -141,47 +134,6 @@ struct HomeScreenContent: View {
}
}
@ViewBuilder
private var migrationView: some View {
if UIDevice.current.isPhone {
if verticalSizeClass == .compact {
migrationViewContent
.frame(maxWidth: .infinity, maxHeight: .infinity)
} else {
WaitingDialog {
migrationViewContent
} bottomContent: {
EmptyView()
}
}
} else {
migrationViewContent
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}
private var migrationViewContent: some View {
VStack(spacing: 16) {
ProgressView()
.tint(.compound.iconPrimary)
.padding(.bottom, 4)
Text(L10n.screenMigrationTitle.tinting(".", color: Asset.Colors.brandColor.swiftUIColor))
.minimumScaleFactor(0.01)
.font(.compound.headingXLBold)
.multilineTextAlignment(.center)
.foregroundColor(.compound.textPrimary)
Text(L10n.screenMigrationMessage)
.minimumScaleFactor(0.01)
.font(.compound.bodyLG)
.multilineTextAlignment(.center)
.foregroundColor(.compound.textPrimary)
.accessibilityIdentifier(A11yIdentifiers.migrationScreen.message)
}
.padding(.horizontal)
}
/// Often times the scroll view's content size isn't correct yet when this method is called e.g. when cancelling a search
/// Dispatch it with a delay to allow the UI to update and the computations to be correct
/// Once we move to iOS 17 we should remove all of this and use scroll anchors instead