mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Onboarding flow coordinator and FTUE changes (#2578)
Fixes #2595, fixes #2594, fixes #2593, fixes #2592, fixes #2591
This commit is contained in:
@@ -31,7 +31,6 @@ enum HomeScreenCoordinatorAction {
|
||||
case roomLeft(roomIdentifier: String)
|
||||
case presentSettingsScreen
|
||||
case presentFeedbackScreen
|
||||
case presentSessionVerificationScreen
|
||||
case presentSecureBackupSettings
|
||||
case presentStartChatScreen
|
||||
case presentInvitesScreen
|
||||
@@ -74,8 +73,6 @@ final class HomeScreenCoordinator: CoordinatorProtocol {
|
||||
actionsSubject.send(.presentFeedbackScreen)
|
||||
case .presentSettingsScreen:
|
||||
actionsSubject.send(.presentSettingsScreen)
|
||||
case .presentSessionVerificationScreen:
|
||||
actionsSubject.send(.presentSessionVerificationScreen)
|
||||
case .presentSecureBackupSettings:
|
||||
actionsSubject.send(.presentSecureBackupSettings)
|
||||
case .logout:
|
||||
|
||||
@@ -22,7 +22,6 @@ enum HomeScreenViewModelAction {
|
||||
case presentRoom(roomIdentifier: String)
|
||||
case presentRoomDetails(roomIdentifier: String)
|
||||
case roomLeft(roomIdentifier: String)
|
||||
case presentSessionVerificationScreen
|
||||
case presentSecureBackupSettings
|
||||
case presentSettingsScreen
|
||||
case presentFeedbackScreen
|
||||
@@ -39,9 +38,7 @@ enum HomeScreenViewAction {
|
||||
case confirmLeaveRoom(roomIdentifier: String)
|
||||
case showSettings
|
||||
case startChat
|
||||
case verifySession
|
||||
case confirmRecoveryKey
|
||||
case skipSessionVerification
|
||||
case skipRecoveryKeyConfirmation
|
||||
case updateVisibleItemRange(range: Range<Int>, isScrolling: Bool)
|
||||
case selectInvites
|
||||
@@ -74,7 +71,6 @@ enum HomeScreenRoomListMode: CustomStringConvertible {
|
||||
enum SecurityBannerMode {
|
||||
case none
|
||||
case dismissed
|
||||
case sessionVerification
|
||||
case recoveryKeyConfirmation
|
||||
}
|
||||
|
||||
|
||||
@@ -70,11 +70,6 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
guard let self else { return }
|
||||
|
||||
switch (securityState.verificationState, securityState.recoveryState) {
|
||||
case (.unverified, _):
|
||||
state.requiresExtraAccountSetup = true
|
||||
if state.securityBannerMode != .dismissed {
|
||||
state.securityBannerMode = .sessionVerification
|
||||
}
|
||||
case (.verified, .disabled):
|
||||
state.requiresExtraAccountSetup = true
|
||||
state.securityBannerMode = .none
|
||||
@@ -134,12 +129,8 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
leaveRoom(roomId: roomIdentifier)
|
||||
case .showSettings:
|
||||
actionsSubject.send(.presentSettingsScreen)
|
||||
case .verifySession:
|
||||
actionsSubject.send(.presentSessionVerificationScreen)
|
||||
case .confirmRecoveryKey:
|
||||
actionsSubject.send(.presentSecureBackupSettings)
|
||||
case .skipSessionVerification:
|
||||
state.securityBannerMode = .dismissed
|
||||
case .skipRecoveryKeyConfirmation:
|
||||
state.securityBannerMode = .dismissed
|
||||
case .updateVisibleItemRange(let range, let isScrolling):
|
||||
|
||||
@@ -103,16 +103,13 @@ struct HomeScreenContent: View {
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
/// The session verification banner and invites button if either are needed.
|
||||
private var topSection: some View {
|
||||
VStack(spacing: 0) {
|
||||
if !context.isSearchFieldFocused {
|
||||
RoomListFiltersView(state: $context.filtersState)
|
||||
}
|
||||
|
||||
if context.viewState.securityBannerMode == .sessionVerification {
|
||||
HomeScreenSessionVerificationBanner(context: context)
|
||||
} else if context.viewState.securityBannerMode == .recoveryKeyConfirmation {
|
||||
if context.viewState.securityBannerMode == .recoveryKeyConfirmation {
|
||||
HomeScreenRecoveryKeyConfirmationBanner(context: context)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
//
|
||||
// Copyright 2023 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
struct HomeScreenSessionVerificationBanner: View {
|
||||
@ObservedObject var context: HomeScreenViewModel.Context
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 16) {
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
HStack(spacing: 16) {
|
||||
Text(L10n.sessionVerificationBannerTitle)
|
||||
.font(.compound.bodyLGSemibold)
|
||||
.foregroundColor(.compound.textPrimary)
|
||||
|
||||
Spacer()
|
||||
|
||||
Button {
|
||||
context.send(viewAction: .skipSessionVerification)
|
||||
} label: {
|
||||
Image(systemName: "xmark")
|
||||
.foregroundColor(.compound.iconSecondary)
|
||||
.frame(width: 12, height: 12)
|
||||
}
|
||||
}
|
||||
Text(L10n.sessionVerificationBannerMessage)
|
||||
.font(.compound.bodyMD)
|
||||
.foregroundColor(.compound.textSecondary)
|
||||
}
|
||||
|
||||
Button(L10n.actionContinue) {
|
||||
context.send(viewAction: .verifySession)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.buttonStyle(.compound(.primary, size: .medium))
|
||||
.accessibilityIdentifier(A11yIdentifiers.homeScreen.verificationBannerContinue)
|
||||
}
|
||||
.padding(16)
|
||||
.background(Color.compound.bgSubtleSecondary)
|
||||
.cornerRadius(14)
|
||||
.padding(.horizontal, 16)
|
||||
}
|
||||
}
|
||||
|
||||
struct HomeScreenSessionVerificationBanner_Previews: PreviewProvider, TestablePreview {
|
||||
static let viewModel = buildViewModel()
|
||||
|
||||
static var previews: some View {
|
||||
HomeScreenSessionVerificationBanner(context: viewModel.context)
|
||||
}
|
||||
|
||||
static func buildViewModel() -> HomeScreenViewModel {
|
||||
let clientProxy = ClientProxyMock(.init(userID: "@alice:example.com",
|
||||
roomSummaryProvider: RoomSummaryProviderMock(.init(state: .loading))))
|
||||
|
||||
let userSession = MockUserSession(clientProxy: clientProxy,
|
||||
mediaProvider: MockMediaProvider(),
|
||||
voiceMessageMediaManager: VoiceMessageMediaManagerMock())
|
||||
|
||||
return HomeScreenViewModel(userSession: userSession,
|
||||
analyticsService: ServiceLocator.shared.analytics,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
selectedRoomPublisher: CurrentValueSubject<String?, Never>(nil).asCurrentValuePublisher(),
|
||||
userIndicatorController: ServiceLocator.shared.userIndicatorController)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user