Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overview page: unlock to resume restoration feature #577

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// license that can be found in the LICENSE file.

import UIKit
import Dcrlibwallet

class NavigationMenuTabBarController: UITabBarController {
private var isNewWallet: Bool = false
Expand All @@ -20,7 +21,7 @@ class NavigationMenuTabBarController: UITabBarController {

override func viewDidLoad() {
super.viewDidLoad()
self.loadTabBar()
self.setupCustomTabMenu(NavigationMenuTabBarController.tabItems)
}

override func viewDidAppear(_ animated: Bool) {
Expand All @@ -30,12 +31,6 @@ class NavigationMenuTabBarController: UITabBarController {
}
}

func loadTabBar() {
self.setupCustomTabMenu(NavigationMenuTabBarController.tabItems)
self.selectedIndex = 0
self.showFloatingButtons() // show floating buttons since selected index is 0 by default
}

// Create our custom menu bar and display it right where the tab bar should be.
func setupCustomTabMenu(_ menuItems: [MenuItem]) {
tabBar.isHidden = true
Expand Down Expand Up @@ -77,6 +72,7 @@ class NavigationMenuTabBarController: UITabBarController {
}

self.viewControllers = menuItems.map({ $0.viewController })
self.selectedIndex = 0

self.view.bringSubviewToFront(self.customTabBar) // Keep nav menu in front of any subviews
self.view.layoutIfNeeded()
Expand Down Expand Up @@ -123,7 +119,7 @@ class NavigationMenuTabBarController: UITabBarController {
AppDelegate.shared.setAndDisplayRootViewController(startView.wrapInNavigationcontroller())

// start sync
SyncManager.shared.startOrRestartSync(allowSyncOnCellular: Settings.syncOnCellular)
SyncManager.shared.startSync(allowSyncOnCellular: Settings.syncOnCellular)

// Start notification listener if notifications are enabled by user.
if Settings.incomingNotificationEnabled {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ class OverviewViewController: UIViewController {
if SyncManager.shared.isSynced || SyncManager.shared.isSyncing {
WalletLoader.shared.multiWallet.cancelSync()
} else {
SyncManager.shared.startOrRestartSync(allowSyncOnCellular: Settings.syncOnCellular)
SyncManager.shared.startSync(allowSyncOnCellular: Settings.syncOnCellular)
}

self.updateSyncConnectionButtonTextAndIcon()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import UIKit

class RequestPasswordViewController: SecurityCodeRequestBaseViewController, UITextFieldDelegate {
@IBOutlet weak var headerLabel: UILabel!

@IBOutlet weak var subtextLabel: UILabel!

@IBOutlet weak var passwordInput: FloatingPlaceholderTextField!
@IBOutlet weak var passwordErrorLabel: UILabel!
@IBOutlet weak var passwordCountLabel: UILabel?
Expand All @@ -33,6 +34,18 @@ class RequestPasswordViewController: SecurityCodeRequestBaseViewController, UITe
}

private func setupInterface() {
if let prompt = self.request.prompt {
self.headerLabel?.text = prompt
} else {
self.headerLabel?.removeFromSuperview()
}

if let subtext = self.request.subtext {
self.subtextLabel?.text = subtext
} else {
self.subtextLabel?.removeFromSuperview()
}

self.passwordInput.placeholder = String(format: LocalizedStrings.passwordPlaceholder,
self.request.for.localizedString)
self.passwordInput.isSecureTextEntry = true
Expand All @@ -55,12 +68,6 @@ class RequestPasswordViewController: SecurityCodeRequestBaseViewController, UITe
self.passwordCountLabel?.removeFromSuperview()
}

if let prompt = self.request.prompt {
self.headerLabel?.text = prompt
} else {
self.headerLabel?.removeFromSuperview()
}

if !self.request.showCancelButton {
self.btnCancel?.removeFromSuperview()
}
Expand Down Expand Up @@ -163,7 +170,7 @@ class RequestPasswordViewController: SecurityCodeRequestBaseViewController, UITe
}

// `onCurrentAndNewCodesEntered` callback is set, request new code and notify callback.
Security(for: self.request.for).requestNewCode(sender: self) {
Security(for: self.request.for, initialSecurityType: .password).requestNewCode(sender: self) {
newCode, newCodeType, newCodeRequestCompletion in
currentAndNewCodesEnteredCallback(password, self, newCode, newCodeRequestCompletion, newCodeType)
}
Expand Down
11 changes: 9 additions & 2 deletions Decred Wallet/Features/Security/RequestPinViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import Dcrlibwallet

class RequestPinViewController: SecurityCodeRequestBaseViewController {
@IBOutlet weak var headerLabel: UILabel!

@IBOutlet weak var subtextLabel: UILabel!

@IBOutlet weak var pinCollectionView: UICollectionView!
@IBOutlet weak var pinCollectionViewHeightContraint: NSLayoutConstraint!
@IBOutlet weak var enterPinLabel: UILabel!
Expand Down Expand Up @@ -62,6 +63,12 @@ class RequestPinViewController: SecurityCodeRequestBaseViewController {
self.headerLabel?.removeFromSuperview()
}

if let subtext = self.request.subtext {
self.subtextLabel?.text = subtext
} else {
self.subtextLabel?.removeFromSuperview()
}

if !self.request.showCancelButton {
self.btnCancel?.removeFromSuperview()
}
Expand Down Expand Up @@ -150,7 +157,7 @@ class RequestPinViewController: SecurityCodeRequestBaseViewController {
}

// `onCurrentAndNewCodesEntered` callback is set, request new code and notify callback.
Security(for: self.request.for).requestNewCode(sender: self) {
Security(for: self.request.for, initialSecurityType: .pin).requestNewCode(sender: self) {
newCode, newCodeType, newCodeRequestCompletion in
currentAndNewCodesEnteredCallback(pinText, self, newCode, newCodeRequestCompletion, newCodeType)
}
Expand Down
Loading