2022-03-01 06:30:32 -08:00
|
|
|
//
|
2022-05-13 09:29:57 -07:00
|
|
|
// RecoveryPhraseValidationFlowView.swift
|
2022-03-01 06:30:32 -08:00
|
|
|
// secant-testnet
|
|
|
|
//
|
|
|
|
// Created by Lukáš Korba on 03/01/22.
|
|
|
|
//
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
import ComposableArchitecture
|
|
|
|
|
2022-05-13 09:29:57 -07:00
|
|
|
struct RecoveryPhraseValidationFlowView: View {
|
|
|
|
var store: RecoveryPhraseValidationFlowStore
|
2022-03-01 06:30:32 -08:00
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
WithViewStore(store) { viewStore in
|
|
|
|
GeometryReader { proxy in
|
|
|
|
VStack {
|
|
|
|
VStack(alignment: .center, spacing: 20) {
|
|
|
|
Text("recoveryPhraseTestPreamble.title")
|
|
|
|
.titleText()
|
|
|
|
.multilineTextAlignment(.center)
|
|
|
|
|
|
|
|
Text("recoveryPhraseTestPreamble.paragraph1")
|
|
|
|
.paragraphText()
|
|
|
|
.multilineTextAlignment(.center)
|
|
|
|
.padding(.horizontal, 44)
|
|
|
|
.opacity(0.53)
|
|
|
|
}
|
2022-10-26 14:24:49 -07:00
|
|
|
.padding(.bottom, 40)
|
2022-03-01 06:30:32 -08:00
|
|
|
|
2022-10-26 14:24:49 -07:00
|
|
|
Asset.Assets.Backgrounds.calloutBackupFlow1.image
|
2022-03-01 06:30:32 -08:00
|
|
|
.frame(
|
2022-03-02 01:20:12 -08:00
|
|
|
width: circularFrameUniformSize(width: proxy.size.width, height: proxy.size.height),
|
|
|
|
height: circularFrameUniformSize(width: proxy.size.width, height: proxy.size.height)
|
2022-03-01 06:30:32 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
Spacer()
|
|
|
|
|
|
|
|
VStack(alignment: .center, spacing: 40) {
|
|
|
|
VStack(alignment: .center, spacing: 20) {
|
|
|
|
Text("recoveryPhraseTestPreamble.paragraph2")
|
|
|
|
.paragraphText()
|
|
|
|
.multilineTextAlignment(.center)
|
|
|
|
.opacity(0.53)
|
|
|
|
|
|
|
|
Text("recoveryPhraseTestPreamble.paragraph3")
|
|
|
|
.paragraphText()
|
|
|
|
.multilineTextAlignment(.center)
|
|
|
|
.padding(.horizontal, 10)
|
|
|
|
.opacity(0.53)
|
|
|
|
}
|
|
|
|
|
|
|
|
Button(
|
2022-12-01 06:31:30 -08:00
|
|
|
action: { viewStore.send(.updateDestination(.validation)) },
|
2022-03-01 06:30:32 -08:00
|
|
|
label: { Text("recoveryPhraseTestPreamble.button.goNext") }
|
|
|
|
)
|
|
|
|
.activeButtonStyle
|
2022-03-02 01:20:12 -08:00
|
|
|
.frame(
|
|
|
|
minWidth: 0,
|
|
|
|
maxWidth: .infinity,
|
|
|
|
minHeight: 64,
|
|
|
|
maxHeight: .infinity,
|
|
|
|
alignment: .center
|
|
|
|
)
|
2022-03-01 06:30:32 -08:00
|
|
|
.fixedSize(horizontal: false, vertical: true)
|
|
|
|
}
|
|
|
|
.padding()
|
|
|
|
|
|
|
|
Spacer()
|
|
|
|
}
|
|
|
|
.frame(width: proxy.size.width)
|
|
|
|
.scrollableWhenScaledUp()
|
|
|
|
.navigationLinkEmpty(
|
2022-03-02 08:33:58 -08:00
|
|
|
isActive: viewStore.bindingForValidation,
|
|
|
|
destination: {
|
2022-05-13 09:29:57 -07:00
|
|
|
RecoveryPhraseBackupView(store: store)
|
2022-03-02 08:33:58 -08:00
|
|
|
}
|
2022-03-01 06:30:32 -08:00
|
|
|
)
|
|
|
|
}
|
|
|
|
.padding()
|
2022-03-02 01:20:12 -08:00
|
|
|
.navigationBarHidden(true)
|
2022-03-01 06:30:32 -08:00
|
|
|
.applyScreenBackground()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-02 01:20:12 -08:00
|
|
|
/// Following computations are necessary to handle properly sizing and positioning of elements
|
2023-01-02 07:18:58 -08:00
|
|
|
/// on different devices (aspects). iPhone SE and iPhone 8 are similar aspect family devices
|
2022-03-02 01:20:12 -08:00
|
|
|
/// while iPhone X, 11, etc are different family devices, capable to use more of the space.
|
2022-05-13 09:29:57 -07:00
|
|
|
extension RecoveryPhraseValidationFlowView {
|
2022-03-02 01:20:12 -08:00
|
|
|
func circularFrameUniformSize(width: CGFloat, height: CGFloat) -> CGFloat {
|
|
|
|
var deviceMultiplier = 1.0
|
|
|
|
|
|
|
|
if width > 0.0 {
|
|
|
|
let aspect = height / width
|
|
|
|
deviceMultiplier = 1.0 + (((aspect / 1.51) - 1.0) * 2.8)
|
|
|
|
}
|
|
|
|
|
|
|
|
return width * 0.4 * deviceMultiplier
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-01 06:30:32 -08:00
|
|
|
struct RecoveryPhraseTestPreambleView_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
|
|
|
Group {
|
2022-03-02 08:33:58 -08:00
|
|
|
NavigationView {
|
2022-05-13 09:29:57 -07:00
|
|
|
RecoveryPhraseValidationFlowView(store: .demo)
|
2022-03-02 08:33:58 -08:00
|
|
|
}
|
2022-03-01 06:30:32 -08:00
|
|
|
|
2022-05-13 09:29:57 -07:00
|
|
|
RecoveryPhraseValidationFlowView(store: .demo)
|
2022-03-01 06:30:32 -08:00
|
|
|
.previewDevice(PreviewDevice(rawValue: "iPhone SE (2nd generation)"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|