Skip to content

Commit

Permalink
Added pusher and paths for devices
Browse files Browse the repository at this point in the history
- Re-add the partner plist
- Fixes the iPad idiom by giving those users a legacy UIKit path
- refactor unused code
- auto linting
- updated the pusher option

Signed-off-by: kcw-grunt <[email protected]>
  • Loading branch information
kcw-grunt committed Jan 7, 2024
1 parent 2b62aa5 commit 5d52fab
Show file tree
Hide file tree
Showing 74 changed files with 1,245 additions and 19,290 deletions.
8 changes: 3 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Litewallet related
loafwallet/partner-keys.plist
loafwallet/GoogleService-Info.plist
litewallet/partner-keys.plist
litewallet/GoogleService-Info.plist

## Build generated
build/
Expand Down Expand Up @@ -40,6 +40,4 @@ BuildTools/.swiftpm
# Sensitive Partner API
Modules/litewallet-partner-api-ios
litewallet-partner-api-ios

/partner-keys.plist
partner-keys.plist

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.
4 changes: 2 additions & 2 deletions litewallet/Base.lproj/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" red="0.20539733769999999" green="0.36322331429999999" blue="0.61663442850000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="tintColor" red="0.20539733769999999" green="0.36322331429999999" blue="0.61663442850000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="backgroundColor" red="0.086274509799999996" green="0.24313725489999999" blue="0.49803921569999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="tintColor" red="0.086274509799999996" green="0.24313725489999999" blue="0.49803921569999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="4Uy-2W-2oq" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="e7w-QI-2ig"/>
<constraint firstItem="4Uy-2W-2oq" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="g5u-1h-SRX"/>
Expand Down
26 changes: 0 additions & 26 deletions litewallet/CardWebViewController.swift

This file was deleted.

71 changes: 23 additions & 48 deletions litewallet/CheckboxesStepView.swift
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import SafariServices
import SwiftUI

struct CheckboxesStepView: View {
@ObservedObject
var createViewModel: CreateWalletViewModel
@EnvironmentObject
var viewModel: StartViewModel

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

let genericPad = 5.0

@State private var scroll = false

let appDelegate = UIApplication.shared.delegate as! AppDelegate
@State
private var didAcceptPush: Bool = false
var body: some View {
GeometryReader { geometry in

Expand All @@ -21,48 +24,20 @@ struct CheckboxesStepView: View {
.backgroundColor
.edgesIgnoringSafeArea(.all)
VStack {
Text(S.CreateStep.MainTitle.checkboxes.localize())
.font(.barlowBold(size: 24.0))
.foregroundColor(.litewalletDarkBlue)
.padding([.bottom, .top], 20.0)
HStack {
Text(S.CreateStep.DetailedMessage.checkboxes.localize())
.font(paragraphFont)
.foregroundColor(.litewalletDarkBlue)
.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()
if didAcceptPush {
appDelegate.pushNotifications.registerForRemoteNotifications()
}
}
.padding(.bottom, 20.0)

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

Text(S.CreateStep.Bullet1.checkboxes.localize())
.font(paragraphFont)
.foregroundColor(.litewalletDarkBlue)
.frame(width: width * 0.8, alignment: .leading)
.padding([.leading, .trailing], 20.0)
.padding(.bottom, 20.0)
Spacer()
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
}
}.mask(
RoundedRectangle(cornerRadius: 12.0)
.frame(width: width * 0.9,
height: height * 0.9)
)
}
.frame(width: width * 0.9)
}
Expand All @@ -71,5 +46,5 @@ struct CheckboxesStepView: View {
}

#Preview {
CheckboxesStepView(createViewModel: CreateWalletViewModel())
CheckboxesStepView()
}
4 changes: 4 additions & 0 deletions litewallet/Color+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ extension Color {
return Color(UIColor.liteWalletDarkBlue)
}

static var litewalletLime: Color { // D9E76C
return Color(UIColor.litewalletLime)
}

static var litewalletLightGray: Color { // F8F8F8
return Color(UIColor.litewalletLightGray)
}
Expand Down
3 changes: 3 additions & 0 deletions litewallet/Constant+Events.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,7 @@ enum CustomEvent: String {

/// User registered Pusher interest
case _20231202_RIGI = "registered_ios_general_interest"

/// User accepted pushes
case _20231225_UAP = "user_accepted_push"
}
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
60 changes: 36 additions & 24 deletions litewallet/CreateStepTabView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import SwiftUI

struct CreateStepTabView: View {
@EnvironmentObject
var createViewModel: CreateWalletViewModel
var viewModel: StartViewModel

let stepViews: [CreateStepView]

Expand All @@ -19,46 +19,58 @@ 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: 30)

Spacer()
TabView(selection: $createViewModel.didTapIndex) {
TabView(selection: $viewModel.tappedIndex) {
ForEach(0 ..< stepViews.count, id: \.self) { index in
ZStack {
let currentStepView = stepViews[index]
currentStepView
.onAppear(perform: {})
.environmentObject(createViewModel)
.environmentObject(viewModel)
}
.clipShape(RoundedRectangle(cornerRadius: 20.0,
style: .continuous))
.padding(.bottom, 40.0)
}
.padding(.all, 10)
}
.frame(width: UIScreen.main.bounds.width, height: height * 0.9)
.frame(width: UIScreen.main.bounds.width)
.tabViewStyle(PageTabViewStyle())
}
}
}
}

#Preview {
CreateStepTabView(stepViews: [CreateStepView(createConfig: .intro),
CreateStepView(createConfig: .checkboxes)])
.environmentObject(CreateWalletViewModel())
}
// #Preview {
// let store = Store()
// let wallet = WalletManager(store: Store())
//
// CreateStepTabView(stepViews: [CreateStepView(createConfig: .intro),
// CreateStepView(createConfig: .checkboxes)])
// }
9 changes: 6 additions & 3 deletions litewallet/CreateStepView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import SwiftUI

struct CreateStepView: View {
@EnvironmentObject
var createViewModel: CreateWalletViewModel
var viewModel: StartViewModel

var backgroundColor: Color = .litewalletDarkBlue
var createStepConfig: CreateStepConfig = .intro
Expand All @@ -24,11 +24,14 @@ struct CreateStepView: View {

VStack {
if createStepConfig == .intro {
IntroStepView(createViewModel: createViewModel)
IntroStepView()
.environmentObject(viewModel)
} else if createStepConfig == .checkboxes {
CheckboxesStepView(createViewModel: createViewModel)
CheckboxesStepView()
.environmentObject(viewModel)
} else if createStepConfig == .seedPhrase {
SeedPhraseStepView()
.environmentObject(viewModel)
} else {
FinishedStepView()
}
Expand Down
12 changes: 5 additions & 7 deletions litewallet/CreateWalletView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ import SwiftUI
import UIKit

struct CreateWalletView: View {
@ObservedObject
var createViewModel: CreateWalletViewModel
@EnvironmentObject
var viewModel: StartViewModel

private let createStepsArray = [CreateStepView(createConfig: .intro),
CreateStepView(createConfig: .checkboxes),
CreateStepView(createConfig: .seedPhrase),
CreateStepView(createConfig: .finished)]
init(viewModel: CreateWalletViewModel) {
createViewModel = viewModel
}
init() {}

var body: some View {
GeometryReader { geometry in
Expand All @@ -22,13 +20,13 @@ struct CreateWalletView: View {
Color.litewalletBlue.edgesIgnoringSafeArea(.all)
HStack {
CreateStepTabView(stepViews: createStepsArray)
.environmentObject(viewModel)
}
}
}
.environmentObject(createViewModel)
}
}

#Preview {
CreateWalletView(viewModel: CreateWalletViewModel())
CreateWalletView()
}
17 changes: 0 additions & 17 deletions litewallet/CreateWalletViewModel.swift

This file was deleted.

Loading

0 comments on commit 5d52fab

Please sign in to comment.