Tweak the session verification icons and copy.

This commit is contained in:
Stefan Ceriu 2024-11-07 16:20:52 +02:00
parent 814eff28dd
commit b9409e5310
50 changed files with 121 additions and 125 deletions

View File

@ -5,7 +5,8 @@
// Please see LICENSE in the repository root for full details. // Please see LICENSE in the repository root for full details.
// //
import Foundation import Compound
import SwiftUI
enum SessionVerificationScreenViewModelAction { enum SessionVerificationScreenViewModelAction {
case finished case finished
@ -26,32 +27,32 @@ struct SessionVerificationScreenViewState: BindableState {
let flow: SessionVerificationScreenFlow let flow: SessionVerificationScreenFlow
var verificationState: SessionVerificationScreenStateMachine.State var verificationState: SessionVerificationScreenStateMachine.State
var headerImageName: String { var headerIcon: (keyPath: KeyPath<CompoundIcons, Image>, style: BigIcon.Style) {
switch verificationState { switch verificationState {
case .initial: case .initial:
return "lock" return (\.devices, .defaultSolid)
case .acceptingVerificationRequest: case .acceptingVerificationRequest:
return "hourglass" return (\.devices, .defaultSolid)
case .requestingVerification: case .requestingVerification:
return "hourglass" return (\.devices, .defaultSolid)
case .verificationRequestAccepted: case .verificationRequestAccepted:
return "face.smiling" return (\.reaction, .defaultSolid)
case .startingSasVerification: case .startingSasVerification:
return "hourglass" return (\.devices, .defaultSolid)
case .sasVerificationStarted: case .sasVerificationStarted:
return "hourglass" return (\.devices, .defaultSolid)
case .cancelling: case .cancelling:
return "hourglass" return (\.lockSolid, .defaultSolid)
case .acceptingChallenge:
return "hourglass"
case .decliningChallenge:
return "hourglass"
case .showingChallenge: case .showingChallenge:
return "face.smiling" return (\.reaction, .defaultSolid)
case .acceptingChallenge:
return (\.reaction, .defaultSolid)
case .decliningChallenge:
return (\.reaction, .defaultSolid)
case .verified: case .verified:
return "checkmark.shield" return (\.checkCircleSolid, .successSolid)
case .cancelled: case .cancelled:
return "exclamationmark.shield" return (\.infoSolid, .alertSolid)
} }
} }
@ -60,12 +61,12 @@ struct SessionVerificationScreenViewState: BindableState {
case .initial: case .initial:
switch flow { switch flow {
case .initiator: case .initiator:
return L10n.screenSessionVerificationOpenExistingSessionTitle return L10n.screenSessionVerificationUseAnotherDeviceTitle
case .responder: case .responder:
return L10n.screenSessionVerificationRequestTitle return L10n.screenSessionVerificationRequestTitle
} }
case .acceptingVerificationRequest: case .acceptingVerificationRequest:
return L10n.screenSessionVerificationRequestTitle return L10n.screenSessionVerificationWaitingAnotherDeviceTitle
case .requestingVerification: case .requestingVerification:
return L10n.screenSessionVerificationWaitingToAcceptTitle return L10n.screenSessionVerificationWaitingToAcceptTitle
case .verificationRequestAccepted: case .verificationRequestAccepted:
@ -98,12 +99,12 @@ struct SessionVerificationScreenViewState: BindableState {
case .initial: case .initial:
switch flow { switch flow {
case .initiator: case .initiator:
return L10n.screenSessionVerificationOpenExistingSessionSubtitle return L10n.screenSessionVerificationUseAnotherDeviceSubtitle
case .responder: case .responder:
return L10n.screenSessionVerificationRequestSubtitle return L10n.screenSessionVerificationRequestSubtitle
} }
case .acceptingVerificationRequest: case .acceptingVerificationRequest:
return L10n.screenSessionVerificationRequestSubtitle return L10n.screenSessionVerificationWaitingAnotherDeviceSubtitle
case .requestingVerification: case .requestingVerification:
return L10n.screenSessionVerificationWaitingToAcceptSubtitle return L10n.screenSessionVerificationWaitingToAcceptSubtitle
case .verificationRequestAccepted: case .verificationRequestAccepted:

View File

@ -31,14 +31,9 @@ struct SessionVerificationScreen: View {
@ViewBuilder @ViewBuilder
private var screenHeader: some View { private var screenHeader: some View {
VStack(spacing: 0) { VStack(spacing: 0) {
if context.viewState.verificationState == .initial { BigIcon(icon: context.viewState.headerIcon.keyPath,
BigIcon(icon: \.lockSolid) style: context.viewState.headerIcon.style)
.padding(.bottom, 16) .padding(.bottom, 16)
} else {
Image(systemName: context.viewState.headerImageName)
.bigIcon()
.padding(.bottom, 16)
}
Text(context.viewState.title ?? "") Text(context.viewState.title ?? "")
.font(.compound.headingMDBold) .font(.compound.headingMDBold)