2021-12-13 12:50:04 -08:00
|
|
|
//
|
|
|
|
// ValidationFailed.swift
|
|
|
|
// secant-testnet
|
|
|
|
//
|
|
|
|
// Created by Francisco Gindre on 12/22/21.
|
|
|
|
//
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
import ComposableArchitecture
|
|
|
|
|
|
|
|
struct ValidationFailedView: View {
|
|
|
|
var store: RecoveryPhraseValidationStore
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
WithViewStore(store) { viewStore in
|
|
|
|
GeometryReader { proxy in
|
|
|
|
VStack {
|
|
|
|
VStack(alignment: .center, spacing: 20) {
|
2022-02-25 04:27:50 -08:00
|
|
|
Text("validationFailed.title")
|
2022-03-03 04:53:03 -08:00
|
|
|
.titleText()
|
|
|
|
.multilineTextAlignment(.center)
|
2021-12-13 12:50:04 -08:00
|
|
|
}
|
2022-03-03 04:53:03 -08:00
|
|
|
.padding(.bottom, 40)
|
2021-12-13 12:50:04 -08:00
|
|
|
|
|
|
|
CircularFrame()
|
|
|
|
.backgroundImage(
|
2022-03-03 04:53:03 -08:00
|
|
|
Asset.Assets.Backgrounds.calloutBackupFailed.image
|
2021-12-13 12:50:04 -08:00
|
|
|
)
|
|
|
|
.frame(
|
2022-03-03 04:53:03 -08:00
|
|
|
width: circularFrameUniformSize(width: proxy.size.width, height: proxy.size.height),
|
|
|
|
height: circularFrameUniformSize(width: proxy.size.width, height: proxy.size.height)
|
2021-12-13 12:50:04 -08:00
|
|
|
)
|
|
|
|
.badgeIcon(.error)
|
|
|
|
|
|
|
|
Spacer()
|
|
|
|
|
|
|
|
VStack(alignment: .center, spacing: 40) {
|
|
|
|
VStack(alignment: .center, spacing: 20) {
|
2022-02-25 04:27:50 -08:00
|
|
|
Text("validationFailed.description")
|
2022-03-03 04:53:03 -08:00
|
|
|
.paragraphText()
|
|
|
|
.multilineTextAlignment(.center)
|
|
|
|
.padding(.horizontal, 30)
|
2021-12-13 12:50:04 -08:00
|
|
|
|
2022-02-25 04:27:50 -08:00
|
|
|
Text("validationFailed.incorrectBackupDescription")
|
2022-03-03 04:53:03 -08:00
|
|
|
.paragraphText()
|
|
|
|
.multilineTextAlignment(.center)
|
|
|
|
.padding(.horizontal, 20)
|
2021-12-13 12:50:04 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
Button(
|
|
|
|
action: { viewStore.send(.reset) },
|
2022-02-25 04:27:50 -08:00
|
|
|
label: { Text("validationFailed.button.tryAgain") }
|
2021-12-13 12:50:04 -08:00
|
|
|
)
|
|
|
|
.activeButtonStyle
|
2022-03-03 04:53:03 -08:00
|
|
|
.frame(
|
|
|
|
minWidth: 0,
|
|
|
|
maxWidth: .infinity,
|
|
|
|
minHeight: 64,
|
|
|
|
maxHeight: .infinity,
|
|
|
|
alignment: .center
|
|
|
|
)
|
|
|
|
.fixedSize(horizontal: false, vertical: true)
|
|
|
|
.padding(.horizontal, 28)
|
2021-12-13 12:50:04 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
Spacer()
|
|
|
|
}
|
|
|
|
.scrollableWhenScaledUp()
|
|
|
|
}
|
|
|
|
.padding()
|
2022-03-03 04:53:03 -08:00
|
|
|
.navigationBarHidden(true)
|
2021-12-13 12:50:04 -08:00
|
|
|
.applyErredScreenBackground()
|
|
|
|
}
|
2022-03-03 04:53:03 -08:00
|
|
|
.preferredColorScheme(.light)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Following computations are necessary to handle properly sizing and positioning of elements
|
|
|
|
/// on different devices (apects). iPhone SE and iPhone 8 are similar aspect family devices
|
|
|
|
/// while iPhone X, 11, etc are different family devices, capable to use more of the space.
|
|
|
|
extension ValidationFailedView {
|
|
|
|
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.0)
|
|
|
|
}
|
|
|
|
|
|
|
|
return width * 0.48 * deviceMultiplier
|
2021-12-13 12:50:04 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ValidationFailed_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
|
|
|
Group {
|
2022-03-03 04:53:03 -08:00
|
|
|
NavigationView {
|
|
|
|
ValidationFailedView(store: .demo)
|
|
|
|
}
|
|
|
|
|
|
|
|
ValidationFailedView(store: .demo)
|
|
|
|
.preferredColorScheme(.dark)
|
|
|
|
|
2021-12-13 12:50:04 -08:00
|
|
|
ValidationFailedView(store: .demo)
|
2022-03-03 04:53:03 -08:00
|
|
|
.previewDevice(PreviewDevice(rawValue: "iPhone SE (2nd generation)"))
|
|
|
|
|
|
|
|
ValidationFailedView(store: .demo)
|
|
|
|
.environment(\.sizeCategory, .accessibilityLarge)
|
2021-12-13 12:50:04 -08:00
|
|
|
|
|
|
|
ValidationFailedView(store: .demo)
|
|
|
|
.environment(\.sizeCategory, .accessibilityLarge)
|
2022-03-03 04:53:03 -08:00
|
|
|
.previewDevice(PreviewDevice(rawValue: "iPhone SE (2nd generation)"))
|
2021-12-13 12:50:04 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|