Skip to content

Commit

Permalink
Experimental rework Start Sequence
Browse files Browse the repository at this point in the history
Signed-off-by: kcw-grunt <[email protected]>
  • Loading branch information
kcw-grunt committed Dec 22, 2023
1 parent d532614 commit 983e94a
Show file tree
Hide file tree
Showing 14 changed files with 217 additions and 176 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Screenshot 2023-12-12 at 12.16.04 PM.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
109 changes: 16 additions & 93 deletions litewallet/CheckboxesStepView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,11 @@ struct CheckboxesStepView: View {
var viewModel: StartViewModel

let paragraphFont: Font = .barlowSemiBold(size: 22.0)
let calloutFont: Font = .barlowLight(size: 12.0)

let appDelegate = UIApplication.shared.delegate as! AppDelegate
let genericPad = 5.0

@State
private var didAcceptPush: Bool = false

@State
private var didTapEmailSignUp: Bool = false

@State
private var urlString = "https://litewallet.io"

@State var showSafari = false
@State private var scroll = false

var body: some View {
GeometryReader { geometry in
Expand All @@ -32,89 +24,20 @@ struct CheckboxesStepView: View {
.backgroundColor
.edgesIgnoringSafeArea(.all)
VStack {
Text(S.CreateStep.MainTitle.checkboxes.localize())
.font(.headline)
.foregroundColor(.white)
.padding([.bottom, .top], 20.0)
HStack {
Text(S.CreateStep.DetailedMessage.checkboxes.localize())
.font(paragraphFont)
.foregroundColor(.white)
.frame(width: width * 0.6, alignment: .leading)
.padding([.leading, .trailing], 20.0)

Spacer()

Image(systemName: didAcceptPush ? "checkmark.circle.fill" : "checkmark.circle")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 30, height: 30, alignment: .leading)
.foregroundColor(didAcceptPush ? .litewalletGreen : .litecoinSilver)
.padding()
}
.onTapGesture {
didAcceptPush.toggle()
let pushOptions: UNAuthorizationOptions = [.alert, .sound, .badge]
UNUserNotificationCenter.current().requestAuthorization(options: pushOptions) { granted, error in
if granted {
DispatchQueue.main.async {
UIApplication.shared.registerForRemoteNotifications()
}
}
if let error = error {
print("[PushNotifications] - \(error.localizedDescription)")
WebView(url: URL(string: C.signupURL)!,
scrollToSignup: $scroll)
.frame(width: width * 0.9)
.padding([.leading, .trailing], genericPad)
.edgesIgnoringSafeArea(.all)
.onAppear {
delay(2.0) {
scroll = true
}
}
}
.padding(.bottom, 20.0)
HStack {
Text(S.CreateStep.ExtendedMessage.checkboxes.localize())
.font(paragraphFont)
.foregroundColor(.white)
.frame(width: width * 0.6, alignment: .leading)
.padding([.leading, .trailing], 20.0)
.padding(.bottom, 20.0)

Spacer()

Image(systemName: didTapEmailSignUp ? "checkmark.circle.fill" : "checkmark.circle")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 30, height: 30, alignment: .leading)
.foregroundColor(didTapEmailSignUp ? .litewalletGreen : .litecoinSilver)
.padding()
}
.onTapGesture {
self.showSafari = true
}
.sheet(isPresented: $showSafari) {
SafariView(url: URL(string: self.urlString)!)
}
.padding(.bottom, 20.0)

Spacer()

Button(action: {
//
viewModel.didTapIndex = 2
}) {
ZStack {
RoundedRectangle(cornerRadius: bigButtonCornerRadius)
.frame(width: width * 0.6, height: 60, alignment: .center)
.foregroundColor(.litewalletLightGray)
.shadow(radius: 3, x: 3.0, y: 3.0)

Text(S.WritePaperPhrase.next.localize())
.frame(width: width * 0.6, height: 60, alignment: .center)
.font(paragraphFont)
.foregroundColor(.litewalletBlue)
.overlay(
RoundedRectangle(cornerRadius: bigButtonCornerRadius)
.stroke(.white, lineWidth: 2.0)
)
}
}
.padding(.all, 8.0)
}.mask(
RoundedRectangle(cornerRadius: 12.0)
.frame(width: width * 0.9,
height: height * 0.9)
)
}
.frame(width: width * 0.9)
}
Expand Down
8 changes: 4 additions & 4 deletions litewallet/CreateStepConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ enum CreateStepConfig {
var backgroundColor: Color {
switch self {
case .intro:
return .litewalletLightGray
return .white
case .checkboxes:
return .litewalletOrange
return .white
case .seedPhrase:
return .litewalletGreen
return .white
case .finished:
return .liteWalletDarkBlue
return .white
}
}

Expand Down
41 changes: 26 additions & 15 deletions litewallet/CreateStepTabView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,34 @@ struct CreateStepTabView: View {
let height = geometry.size.height

VStack {
HStack {
Image(systemName: "triangle.inset.filled")
.resizable()
.foregroundColor(.white)
.aspectRatio(contentMode: .fit)
.frame(width: 25.0,
height: 25.0)
.rotationEffect(.degrees(30))
.onTapGesture {
presentationMode.wrappedValue.dismiss()
}
.padding(.leading, 10.0)
Spacer()
ZStack {
HStack {
Image(systemName: "chevron.left")
.resizable()
.foregroundColor(.white)
.aspectRatio(contentMode: .fit)
.frame(width: 25.0,
height: 25.0)
.onTapGesture {
presentationMode
.wrappedValue
.dismiss()
viewModel.tappedIndex = 0
}
.padding(.leading, 10.0)
Spacer()
}

HStack {
Text(viewModel.headerTitle)
.font(.barlowBold(size: 30.0))
.foregroundColor(.litecoinGray)
.padding([.bottom, .top], 10.00)
}
.frame(height: 25.0)
}
.frame(height: 25.0)

TabView(selection: $viewModel.didTapIndex) {
TabView(selection: $viewModel.tappedIndex) {
ForEach(0 ..< stepViews.count, id: \.self) { index in
ZStack {
let currentStepView = stepViews[index]
Expand Down
127 changes: 81 additions & 46 deletions litewallet/IntroStepView.swift
Original file line number Diff line number Diff line change
@@ -1,74 +1,54 @@
import PushNotifications
import SwiftUI

struct IntroStepView: View {
@EnvironmentObject
var viewModel: StartViewModel

let paragraphFont: Font = .barlowSemiBold(size: 22.0)
let paragraphFont: Font = .barlowBold(size: 35.0)

let genericPad = 5.0

let appDelegate = UIApplication.shared.delegate as! AppDelegate

var body: some View {
GeometryReader { geometry in

let width = geometry.size.width
let height = geometry.size.height

ZStack {
CreateStepConfig
.intro
.backgroundColor
.edgesIgnoringSafeArea(.all)
VStack {
Text(S.CreateStep.MainTitle.intro.localize())
.font(.barlowBold(size: 24.0))
.foregroundColor(.litewalletDarkBlue)
.padding([.bottom, .top], 20.0)

Text(S.CreateStep.DetailedMessage.intro.localize())
.font(paragraphFont)
.foregroundColor(.litewalletDarkBlue)
.frame(width: width * 0.8, alignment: .leading)
.padding([.leading, .trailing], 20.0)
.padding(.bottom, 20.0)
.foregroundColor(.liteWalletBlue)
.frame(width: width * 0.9, alignment: .leading)
.padding([.leading, .trailing], genericPad)
.padding([.bottom], genericPad)

Text(S.CreateStep.ExtendedMessage.intro.localize())
.font(paragraphFont)
.foregroundColor(.litewalletDarkBlue)
.frame(width: width * 0.8, alignment: .leading)
.padding([.leading, .trailing], 20.0)
.padding(.bottom, 20.0)
Image("lofigirl")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: width * 0.9, alignment: .center)
.mask {
RoundedRectangle(cornerRadius: 12.0)
}.padding()

Text(S.CreateStep.Bullet1.intro.localize())
Text(S.CreateStep.ExtendedMessage.intro.localize())
.font(paragraphFont)
.foregroundColor(.litewalletDarkBlue)
.frame(width: width * 0.8, alignment: .leading)
.padding([.leading, .trailing], 20.0)
.padding(.bottom, 20.0)
Spacer()

Button(action: {
//
viewModel.didTapIndex = 1
}) {
ZStack {
RoundedRectangle(cornerRadius: bigButtonCornerRadius)
.frame(width: width * 0.6, height: 60, alignment: .center)
.foregroundColor(.litewalletLightGray)
.shadow(radius: 3, x: 3.0, y: 3.0)

Text(S.Button.ok.localize())
.frame(width: width * 0.6, height: 60, alignment: .center)
.font(paragraphFont)
.foregroundColor(.litewalletBlue)
.overlay(
RoundedRectangle(cornerRadius: bigButtonCornerRadius)
.stroke(.white, lineWidth: 2.0)
)
}
}
.padding(.all, 8.0)
Spacer()
.foregroundColor(.liteWalletBlue)
.frame(width: width * 0.9, alignment: .leading)
.padding([.leading, .trailing], genericPad)
.padding([.bottom], genericPad)
}
.frame(width: width * 0.9)
}.onAppear {
delay(2.0) {
appDelegate.pushNotifications.registerForRemoteNotifications()
}
}
}
}
Expand All @@ -77,3 +57,58 @@ struct IntroStepView: View {
#Preview {
IntroStepView()
}

// let pushOptions: UNAuthorizationOptions = [.alert, .sound, .badge]
// UNUserNotificationCenter.current().requestAuthorization(options: pushOptions) { granted, error in
// if granted {
// DispatchQueue.main.async {
// UIApplication.shared.registerForRemoteNotifications()
// }
// }
// if let error = error {
// print("[PushNotifications] - \(error.localizedDescription)")
// }
// }

//
// func registerPushNotification(_ application: UIApplication){
//
// UNUserNotificationCenter.current().requestAuthorization(options:[.badge, .alert, .sound]){ (granted, error) in
//
// if granted {
// print("Notification: Granted")
//
// } else {
// print("Notification: not granted")
//
// }
// }
//
// application.registerForRemoteNotifications()
// }
//
// }

// Button(action: {
// //
// viewModel.didTapIndex = 1
// }) {
// ZStack {
// RoundedRectangle(cornerRadius: bigButtonCornerRadius)
// .frame(width: width * 0.6, height: 60, alignment: .center)
// .foregroundColor(.litewalletLightGray)
// .shadow(radius: 3, x: 3.0, y: 3.0)
//
// Text(S.Button.ok.localize())
// .frame(width: width * 0.6, height: 60, alignment: .center)
// .font(paragraphFont)
// .foregroundColor(.litewalletBlue)
// .overlay(
// RoundedRectangle(cornerRadius: bigButtonCornerRadius)
// .stroke(.white, lineWidth: 2.0)
// )
// }
// }
// .padding(.all, 8.0)

// viewModel.updatePushPreference(didAcceptPush: didAcceptPush)
Loading

0 comments on commit 983e94a

Please sign in to comment.