Add a view with instructions for enabling backups in Element Classic. (#5359)

No presentation logic yet.
This commit is contained in:
Doug
2026-04-08 11:03:30 +01:00
committed by GitHub
parent ac14265869
commit 6978f96f91
11 changed files with 107 additions and 0 deletions
@@ -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,
@@ -55,6 +55,7 @@ struct AuthenticationStartScreenViewState: BindableState {
struct AuthenticationStartScreenViewStateBindings {
var alertInfo: AlertInfo<AuthenticationStartScreenAlertType>?
var showClassicAppBackupInstructions = false
}
enum AuthenticationStartScreenAlertType {
@@ -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())
}
}
@@ -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))
}