Skip to content

Commit

Permalink
Fixed the rescan localization problem
Browse files Browse the repository at this point in the history
Shortened the sync steps

Signed-off-by: kcw-grunt <mrkerrywashington@icloud.com>
  • Loading branch information
kcw-grunt committed May 11, 2024
1 parent 4a31e90 commit 6f738fc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
12 changes: 11 additions & 1 deletion litewallet/ModalPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,17 @@ class ModalPresenter: Subscriber, Trackable {
settingsNav.pushViewController(localeView, animated: true)
}),
Setting(title: S.Settings.sync.localize(), callback: {
settingsNav.pushViewController(ReScanViewController(store: self.store), animated: true)
let alert = UIAlertController(title: S.ReScan.alertTitle.localize(), message: S.ReScan.alertMessage.localize(), preferredStyle: .alert)
alert.addAction(UIAlertAction(title: S.Button.cancel.localize(), style: .default, handler: { _ in
alert.dismiss(animated: true)
}))
alert.addAction(UIAlertAction(title: S.ReScan.alertAction.localize(), style: .default, handler: { _ in
self.store.trigger(name: .rescan)
LWAnalytics.logEventWithParameters(itemName: ._20200112_DSR)
alert.dismiss(animated: true)
self.topViewController?.dismiss(animated: true)
}))
self.topViewController?.present(alert, animated: true)
}),
Setting(title: S.UpdatePin.updateTitle.localize(), callback: strongify(self) { myself in
let updatePin = UpdatePinViewController(store: myself.store, walletManager: walletManager, type: .update)
Expand Down
22 changes: 7 additions & 15 deletions litewallet/ViewControllers/ReScanViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import UIKit
class ReScanViewController: UIViewController, Subscriber {
init(store: Store) {
self.store = store
faq = .buildFaqButton(store: store, articleId: ArticleIds.nothing)
super.init(nibName: nil, bundle: nil)
}

Expand All @@ -12,7 +11,6 @@ class ReScanViewController: UIViewController, Subscriber {
private let button = ShadowButton(title: S.ReScan.buttonTitle.localize(), type: .primary)
private let footer = UILabel.wrapping(font: .customBody(size: 16.0), color: .secondaryGrayText)
private let store: Store
private let faq: UIButton

deinit {
store.unsubscribe(self)
Expand All @@ -26,7 +24,6 @@ class ReScanViewController: UIViewController, Subscriber {

private func addSubviews() {
view.addSubview(header)
view.addSubview(faq)
view.addSubview(body)
view.addSubview(button)
view.addSubview(footer)
Expand All @@ -36,21 +33,16 @@ class ReScanViewController: UIViewController, Subscriber {
header.constrain([
header.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: C.padding[2]),
header.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: C.padding[2]),
])
faq.constrain([
faq.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -C.padding[2]),
faq.centerYAnchor.constraint(equalTo: header.centerYAnchor),
faq.widthAnchor.constraint(equalToConstant: 44.0),
faq.heightAnchor.constraint(equalToConstant: 44.0),
header.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: C.padding[-2]),
])
body.constrain([
body.leadingAnchor.constraint(equalTo: header.leadingAnchor),
body.topAnchor.constraint(equalTo: header.bottomAnchor, constant: C.padding[2]),
body.trailingAnchor.constraint(equalTo: faq.trailingAnchor),
body.trailingAnchor.constraint(equalTo: header.trailingAnchor),
])
footer.constrain([
footer.leadingAnchor.constraint(equalTo: header.leadingAnchor),
footer.trailingAnchor.constraint(equalTo: faq.trailingAnchor),
footer.trailingAnchor.constraint(equalTo: header.trailingAnchor),
footer.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -C.padding[3]),
])
button.constrain([
Expand Down Expand Up @@ -90,10 +82,10 @@ class ReScanViewController: UIViewController, Subscriber {
let bodyAttributes = [NSAttributedString.Key.font: UIFont.customBody(size: 16.0),
NSAttributedString.Key.foregroundColor: UIColor.darkText]

body.append(NSAttributedString(string: "\(S.ReScan.subheader1)\n", attributes: headerAttributes))
body.append(NSAttributedString(string: "\(S.ReScan.body1)\n\n", attributes: bodyAttributes))
body.append(NSAttributedString(string: "\(S.ReScan.subheader2)\n", attributes: headerAttributes))
body.append(NSAttributedString(string: "\(S.ReScan.body2)\n\n\(S.ReScan.body3)", attributes: bodyAttributes))
body.append(NSAttributedString(string: "\(S.ReScan.subheader1.localize())\n", attributes: headerAttributes))
body.append(NSAttributedString(string: "\(S.ReScan.body1.localize())\n\n", attributes: bodyAttributes))
body.append(NSAttributedString(string: "\(S.ReScan.subheader2.localize())\n", attributes: headerAttributes))
body.append(NSAttributedString(string: "\(S.ReScan.body2.localize())\n\n\(S.ReScan.body3.localize())", attributes: bodyAttributes))
return body
}

Expand Down

0 comments on commit 6f738fc

Please sign in to comment.