QR Code Login Initial view state (#2667)

This commit is contained in:
Mauro
2024-04-09 12:21:14 +02:00
committed by GitHub
parent bc75fe1cf8
commit c61135f88c
27 changed files with 623 additions and 93 deletions
@@ -21,7 +21,7 @@ enum ResetRecoveryKeyScreenViewModelAction {
}
struct ResetRecoveryKeyScreenViewState: BindableState {
let listItem3AttributedText = {
private let listItem3AttributedText = {
let boldPlaceholder = "{bold}"
var finalString = AttributedString(L10n.screenCreateNewRecoveryKeyListItem3(boldPlaceholder))
var boldString = AttributedString(L10n.screenCreateNewRecoveryKeyListItem3ResetAll)
@@ -29,6 +29,16 @@ struct ResetRecoveryKeyScreenViewState: BindableState {
finalString.replace(boldPlaceholder, with: boldString)
return finalString
}()
var listItems: [AttributedString] {
[
AttributedString(L10n.screenCreateNewRecoveryKeyListItem1),
AttributedString(L10n.screenCreateNewRecoveryKeyListItem2),
listItem3AttributedText,
AttributedString(L10n.screenCreateNewRecoveryKeyListItem4),
AttributedString(L10n.screenCreateNewRecoveryKeyListItem5)
]
}
}
enum ResetRecoveryKeyScreenViewAction {
@@ -34,6 +34,7 @@ class ResetRecoveryKeyScreenViewModel: ResetRecoveryKeyScreenViewModelType, Rese
override func process(viewAction: ResetRecoveryKeyScreenViewAction) {
switch viewAction {
case .cancel:
// We might also need to display first an alert and do a logOut API call in some cases
actionsSubject.send(.cancel)
}
}
@@ -38,7 +38,7 @@ struct ResetRecoveryKeyScreen: View {
private var mainContent: some View {
VStack(spacing: 40) {
header
list
SFNumberedListView(items: context.viewState.listItems)
}
}
@@ -53,65 +53,6 @@ struct ResetRecoveryKeyScreen: View {
}
}
private var list: some View {
VStack(alignment: .leading, spacing: 24) {
Label {
Text(L10n.screenCreateNewRecoveryKeyListItem1)
} icon: {
Image(systemSymbol: ._1Circle)
.imageScale(.large)
.fontWeight(.light)
.foregroundColor(.compound.textPlaceholder)
}
.foregroundColor(.compound.textPrimary)
.font(.compound.bodyMD)
Label {
Text(L10n.screenCreateNewRecoveryKeyListItem2)
} icon: {
Image(systemSymbol: ._2Circle)
.imageScale(.large)
.fontWeight(.light)
.foregroundColor(.compound.textPlaceholder)
}
.foregroundColor(.compound.textPrimary)
.font(.compound.bodyMD)
Label {
Text(context.viewState.listItem3AttributedText)
} icon: {
Image(systemSymbol: ._3Circle)
.imageScale(.large)
.fontWeight(.light)
.foregroundColor(.compound.textPlaceholder)
}
.foregroundColor(.compound.textPrimary)
.font(.compound.bodyMD)
Label {
Text(L10n.screenCreateNewRecoveryKeyListItem4)
} icon: {
Image(systemSymbol: ._4Circle)
.imageScale(.large)
.fontWeight(.light)
.foregroundColor(.compound.textPlaceholder)
}
.foregroundColor(.compound.textPrimary)
.font(.compound.bodyMD)
Label {
Text(L10n.screenCreateNewRecoveryKeyListItem5)
} icon: {
Image(systemSymbol: ._5Circle)
.imageScale(.large)
.fontWeight(.light)
.foregroundColor(.compound.textPlaceholder)
}
.foregroundColor(.compound.textPrimary)
.font(.compound.bodyMD)
}
}
@ToolbarContentBuilder
private var toolbar: some ToolbarContent {
ToolbarItem(placement: .cancellationAction) {