mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Add a view with instructions for enabling backups in Element Classic. (#5359)
No presentation logic yet.
This commit is contained in:
@@ -18,6 +18,7 @@ enum TestablePreviewsDictionary {
|
||||
"AppLockSetupSettingsScreen_Previews" : AppLockSetupSettingsScreen_Previews.self,
|
||||
"AudioMediaEventsTimelineView_Previews" : AudioMediaEventsTimelineView_Previews.self,
|
||||
"AudioRoomTimelineView_Previews" : AudioRoomTimelineView_Previews.self,
|
||||
"AuthenticationClassicAppBackupInstructionsView_Previews" : AuthenticationClassicAppBackupInstructionsView_Previews.self,
|
||||
"AuthenticationStartScreen_Previews" : AuthenticationStartScreen_Previews.self,
|
||||
"AvatarHeaderView_Previews" : AvatarHeaderView_Previews.self,
|
||||
"BadgeLabel_Previews" : BadgeLabel_Previews.self,
|
||||
|
||||
+1
@@ -55,6 +55,7 @@ struct AuthenticationStartScreenViewState: BindableState {
|
||||
|
||||
struct AuthenticationStartScreenViewStateBindings {
|
||||
var alertInfo: AlertInfo<AuthenticationStartScreenAlertType>?
|
||||
var showClassicAppBackupInstructions = false
|
||||
}
|
||||
|
||||
enum AuthenticationStartScreenAlertType {
|
||||
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
//
|
||||
// Copyright 2026 Element Creations Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import Compound
|
||||
import SwiftUI
|
||||
|
||||
struct AuthenticationClassicAppBackupInstructionsView: View {
|
||||
let context: AuthenticationStartScreenViewModel.Context
|
||||
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
|
||||
var body: some View {
|
||||
ElementNavigationStack {
|
||||
FullscreenDialog(topPadding: 24, horizontalPadding: 24) {
|
||||
content
|
||||
} bottomContent: {
|
||||
buttons
|
||||
}
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar { toolbar }
|
||||
.background()
|
||||
.backgroundStyle(.compound.bgSubtleSecondary)
|
||||
}
|
||||
}
|
||||
|
||||
var content: some View {
|
||||
VStack(alignment: .leading, spacing: 40) {
|
||||
TitleAndIcon(title: L10n.screenMissingKeyBackupTitle(InfoPlistReader.main.bundleDisplayName),
|
||||
icon: \.keySolid,
|
||||
iconStyle: .default)
|
||||
|
||||
SFNumberedListView(items: [
|
||||
AttributedString(L10n.screenMissingKeyBackupStep1),
|
||||
AttributedString(L10n.screenMissingKeyBackupStep2Ios),
|
||||
AttributedString(L10n.screenMissingKeyBackupStep3Ios),
|
||||
AttributedString(L10n.screenMissingKeyBackupStep4),
|
||||
AttributedString(L10n.screenMissingKeyBackupStep5(InfoPlistReader.main.bundleDisplayName))
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
var buttons: some View {
|
||||
Button(L10n.screenMissingKeyBackupOpenElementClassic) {
|
||||
UIApplication.shared.open("element://open")
|
||||
}
|
||||
.buttonStyle(.compound(.primary))
|
||||
}
|
||||
|
||||
var toolbar: some ToolbarContent {
|
||||
ToolbarItem(placement: .primaryAction) {
|
||||
ToolbarButton(role: .close, action: dismiss.callAsFunction)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct AuthenticationClassicAppBackupInstructionsView_Previews: PreviewProvider, TestablePreview {
|
||||
static let viewModel = makeViewModel()
|
||||
|
||||
static var previews: some View {
|
||||
AuthenticationClassicAppBackupInstructionsView(context: viewModel.context)
|
||||
}
|
||||
|
||||
static func makeViewModel() -> AuthenticationStartScreenViewModel {
|
||||
AuthenticationStartScreenViewModel(authenticationService: AuthenticationService.mock,
|
||||
provisioningParameters: nil,
|
||||
isBugReportServiceEnabled: false,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
}
|
||||
}
|
||||
+3
@@ -46,6 +46,9 @@ struct AuthenticationStartScreen: View {
|
||||
AuthenticationStartScreenBackgroundImage()
|
||||
}
|
||||
.alert(item: $context.alertInfo)
|
||||
.sheet(isPresented: $context.showClassicAppBackupInstructions) {
|
||||
AuthenticationClassicAppBackupInstructionsView(context: context)
|
||||
}
|
||||
.introspect(.window, on: .supportedVersions) { window in
|
||||
context.send(viewAction: .updateWindow(window))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user