Skip to content

Commit

Permalink
updated loafwallet-core version
Browse files Browse the repository at this point in the history
-Updated to loafwallet-core v1.6.1
-update urls
-Signup sheet is working!!!!!
-polished the signup
- Re added some callbacks that were updating the recall big bug was fixed

Signed-off-by: kcw-grunt <mrkerrywashington@icloud.com>
  • Loading branch information
kcw-grunt committed Jan 12, 2024
1 parent 16a58d8 commit d255c7a
Show file tree
Hide file tree
Showing 17 changed files with 288 additions and 134 deletions.
2 changes: 1 addition & 1 deletion Modules/loafwallet-core
Submodule loafwallet-core updated 4 files
+1 −2 BRKey.c
+34 −12 BRWallet.c
+4 −0 BRWallet.h
+0 −51 test.c
19 changes: 2 additions & 17 deletions litewallet/CheckboxesStepView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,8 @@ struct CheckboxesStepView: View {
.checkboxes
.backgroundColor
.edgesIgnoringSafeArea(.all)
VStack {
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)
VStack {}
.frame(width: width * 0.9)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion litewallet/Color+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ extension Color {
return Color(UIColor.liteWalletBlue)
}

static var liteWalletDarkBlue: Color { // 163e7f
static var liteWalletDarkBlue: Color { // 0C3475
return Color(UIColor.liteWalletDarkBlue)
}

Expand Down
19 changes: 10 additions & 9 deletions litewallet/LockScreenViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,18 @@ class LockScreenViewModel: ObservableObject, Subscriber {

// MARK: - Public Variables

var store: Store
var walletManager: WalletManager?
var isPresentedForLock: Bool
var store: Store?

init(store: Store, isPresentedForLock: Bool, walletManager: WalletManager?) {
init(store: Store) {
self.store = store
self.walletManager = walletManager
self.isPresentedForLock = isPresentedForLock

addSubscriptions()
fetchCurrentPrice()
}

private func fetchCurrentPrice() {
guard let currentRate = store.state.currentRate
guard let currentRate = store?.state.currentRate
else {
print("Error: Rate not fetched")
print("Error: Rate not fetched ")
return
}

Expand All @@ -45,6 +40,12 @@ class LockScreenViewModel: ObservableObject, Subscriber {
// MARK: - Add Subscriptions

private func addSubscriptions() {
guard let store = store
else {
NSLog("ERROR: Store not initialized")
return
}

store.subscribe(self, selector: { $0.currentRate != $1.currentRate },
callback: { _ in
self.fetchCurrentPrice()
Expand Down
116 changes: 31 additions & 85 deletions litewallet/src/AnnounceUpdatesView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ struct AnnounceUpdatesView: View {
@State
private var emailAddress = ""

@State
private var didComplete = false

@State
private var isEmailValid = false

Expand All @@ -25,6 +28,8 @@ struct AnnounceUpdatesView: View {
@Binding
var didTapContinue: Bool

private var signupViewModel = SignupWebViewModel()

let navigateStart: NavigateStart

let paragraphFont: Font = .barlowSemiBold(size: 22.0)
Expand All @@ -33,6 +38,7 @@ struct AnnounceUpdatesView: View {
let genericPad = 20.0
let smallLabelPad = 15.0
let buttonHeight = 44.0
let pageHeight = 145.0
let hugeFont = Font.barlowBold(size: 30.0)
let smallerFont = Font.barlowLight(size: 15.0)
let buttonLightFont: Font = .barlowLight(size: 20.0)
Expand All @@ -54,13 +60,14 @@ struct AnnounceUpdatesView: View {
ZStack {
Color.liteWalletDarkBlue.edgesIgnoringSafeArea(.all)
VStack {
Text("Don't a miss a thing!")
Text(S.Notifications.emailTitle.localize())
.font(hugeFont)
.multilineTextAlignment(.leading)
.frame(maxWidth: .infinity, alignment: .leading)
.frame(height: buttonHeight)
.frame(idealHeight: buttonHeight)
.foregroundColor(.white)
.padding(.all, genericPad)
.padding(.top, height * 0.08)

Text(S.Notifications.pitchMessage.localize())
.font(buttonLightFont)
Expand All @@ -72,92 +79,27 @@ struct AnnounceUpdatesView: View {
.onTapGesture {
isEmailFieldFocused.toggle()
}

HStack {
VStack(alignment: .leading) {
Text(S.Notifications.emailLabel.localize())
.frame(height: smallLabelPad)
.font(smallerFont)
.multilineTextAlignment(.leading)
.frame(maxWidth: .infinity, alignment: .leading)
.foregroundColor(.white)

TextField(S.Notifications.emailPlaceholder.localize(), text: $emailAddress)
.focused($isEmailFieldFocused)
.frame(height: buttonHeight)
.frame(maxWidth: .infinity, alignment: .leading)
.textFieldStyle(.roundedBorder)
.foregroundColor(isEmailValid ? .litewalletDarkBlue : .litewalletOrange)
.font(smallerFont)
}
VStack(alignment: .leading) {
Text(S.Notifications.languagePreference.localize())
.frame(height: smallLabelPad)
.font(smallerFont)
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity, alignment: .leading)
.foregroundColor(.white)
.offset(x: 10.0)

Picker("", selection: $languagePref) {
ForEach(LanguageSelection.allCases) { pref in
Text(pref.nativeName)
.frame(width: height * 0.3)
.font(smallerFont)
.foregroundColor(.white)
.tag(pref.rawValue)
SignupWebView(viewModel: signupViewModel,
url: URL(string: C.signupURL)!,
userAction: $didComplete)
.frame(width: width)
.frame(height: pageHeight)
.edgesIgnoringSafeArea(.all)
.padding(.bottom, smallLabelPad)
.onChange(of: didComplete) { updateValue in
print("::: updateValue \(updateValue)")

if updateValue {
switch navigateStart {
case .create:
viewModel.didTapCreate!()
case .recover:
viewModel.didTapRecover!()
}
}
.pickerStyle(.wheel)
.frame(width: height * 0.3)
.frame(height: buttonHeight)
.clipped()
}
}
.frame(height: 80.0)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.all, genericPad)
Spacer()

Button {
viewModel.didAddToMailingList(email: emailAddress, preference: languagePref)
/// Reuse this struct for Create or Recover
switch navigateStart {
case .create:
viewModel.didTapCreate!()
case .recover:
viewModel.didTapRecover!()
}

} label: {
ZStack {
RoundedRectangle(cornerRadius: bigButtonCornerRadius)
.frame(width: width * 0.9, height: 45, alignment: .center)
.foregroundColor(.white)
.shadow(radius: 3, x: 3.0, y: 3.0)

Text(S.Button.submit.localize())
.frame(width: width * 0.9, height: 45, alignment: .center)
.font(buttonFont)
.foregroundColor(isEmailValid ? .litewalletBlue :
.litewalletBlue.opacity(0.4))
.overlay(
RoundedRectangle(cornerRadius: bigButtonCornerRadius)
.stroke(.white, lineWidth: 2.0)
)
}
}
.disabled(!isEmailValid)
.padding(.bottom, smallLabelPad)
.onAppear {
delay(4.0) {
appDelegate.pushNotifications.registerForRemoteNotifications()
}
}
.onChange(of: $emailAddress.wrappedValue) { _ in
isEmailValid = EmailValidation.isEmailValid(emailString: emailAddress)
}

Spacer()
Button {
/// Reuse this struct for Create or Recover
switch navigateStart {
Expand All @@ -173,7 +115,7 @@ struct AnnounceUpdatesView: View {
.frame(width: width * 0.9, height: 45, alignment: .center)
.foregroundColor(.litewalletDarkBlue)

Text(S.Button.cancel.localize())
Text(S.Notifications.signupCancel.localize())
.frame(width: width * 0.9, height: 45, alignment: .center)
.font(buttonLightFont)
.foregroundColor(.white)
Expand All @@ -184,9 +126,13 @@ struct AnnounceUpdatesView: View {
}
}
.padding(.bottom, genericPad)
.onAppear {
print("::: height \(height)")
}
}
}
}
.edgesIgnoringSafeArea(.top)
}
}

Expand Down
14 changes: 13 additions & 1 deletion litewallet/src/ApplicationController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ let LITEWALLET_APP_STORE_ID = 1_119_332_592
class ApplicationController: Subscriber, Trackable {
// Ideally the window would be private, but is unfortunately required
// by the UIApplicationDelegate Protocol

var window: UIWindow?
fileprivate let store = Store()
private var startFlowController: StartFlowPresenter?
private var modalPresenter: ModalPresenter?

fileprivate var walletManager: WalletManager?
private var walletCoordinator: WalletCoordinator?
private var exchangeUpdater: ExchangeUpdater?
Expand Down Expand Up @@ -149,6 +149,10 @@ class ApplicationController: Subscriber, Trackable {
walletManager?.apiClient?.kv?.syncAllKeys { print("KV finished syncing. err: \(String(describing: $0))") }
}

func performFetch(_ completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
fetchCompletionHandler = completionHandler
}

func open(url: URL) -> Bool {
if let urlController = urlController {
return urlController.handleUrl(url)
Expand Down Expand Up @@ -198,6 +202,10 @@ class ApplicationController: Subscriber, Trackable {
self?.performBackgroundFetch()
}
}

exchangeUpdater?.refresh(completion: {
NSLog("Rates were updated")
})
}
}

Expand All @@ -219,6 +227,10 @@ class ApplicationController: Subscriber, Trackable {
feeUpdater?.refresh()
defaultsUpdater?.refresh()
walletManager?.apiClient?.events?.up()

exchangeUpdater?.refresh(completion: {
NSLog("::: Refreshed fiat rates")
})
}

private func addWalletCreationListener() {
Expand Down
1 change: 1 addition & 0 deletions litewallet/src/Constants/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ struct C {

static let reviewLink = "https://itunes.apple.com/app/loafwallet-litecoin-wallet/id1119332592?action=write-review"
static let signupURL = "https://litewallet.io/mobile-signup/signup.html"
static let stagingSignupURL = "https://staging-litewallet-io.webflow.io/mobile-signup/signup"

static var standardPort: Int {
return E.isTestnet ? 19335 : 9333
Expand Down
2 changes: 2 additions & 0 deletions litewallet/src/Constants/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -407,10 +407,12 @@ enum S {
}

enum Notifications {
static let emailTitle = Localization(key: "Notifications.emailTitle", value: "Don't a miss a thing!", comment: "Email title")
static let pitchMessage = Localization(key: "Notifications.pitchMessage", value: "Sign up to hear about updates & contests from the Litewallet team!\nAccept notifications to get live news, price & market information!", comment: "Pitch to get user to sign up")
static let emailLabel = Localization(key: "Notifications.emailLabel", value: "Email address", comment: "Email address label")
static let emailPlaceholder = Localization(key: "Notifications.emailPlaceholder", value: "Enter here", comment: "Email address placeholder")
static let languagePreference = Localization(key: "Notifications.languagePreference", value: "Preferred language:", comment: "Language preference label")
static let signupCancel = Localization(key: "Notifications.signupCancel", value: "No, thanks", comment: "Signup cancel")
}

enum DefaultCurrency {
Expand Down
6 changes: 2 additions & 4 deletions litewallet/src/LoginViewHostingController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ class LoginViewHostingController: UIHostingController<LoginView> {

var viewModel: LockScreenViewModel

init(store: Store, isPresentedForLock: Bool, walletManager: WalletManager? = nil) {
viewModel = LockScreenViewModel(store: store,
isPresentedForLock: isPresentedForLock,
walletManager: walletManager)
init(store: Store, isPresentedForLock _: Bool, walletManager _: WalletManager? = nil) {
viewModel = LockScreenViewModel(store: store)

super.init(rootView: LoginView(viewModel: viewModel))
}
Expand Down
Loading

0 comments on commit d255c7a

Please sign in to comment.