Skip to content
This repository has been archived by the owner on Jun 2, 2019. It is now read-only.

Add generic passwork checker before sending transaction #867

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
55c1d9e
Add generic passwork checker before sending transaction
taraspasichnyk Jul 30, 2018
644a594
Use AuthenticateUserCoordinator
taraspasichnyk Jul 31, 2018
a323fef
Add properly in user defaults. Implemented functionality of checking …
taraspasichnyk Jul 31, 2018
863d444
Add protocol for view model in LockEnterPasscodeViewController
taraspasichnyk Jul 31, 2018
3f990bc
Add new files in folder hierarchy
taraspasichnyk Jul 31, 2018
ea7bf52
Add localized string for lock.authenticate.enter.passcode.view.model.…
taraspasichnyk Jul 31, 2018
947a158
Add localized strings for settings.lockTransactions.label.title
taraspasichnyk Jul 31, 2018
4263885
Merge branch 'master' into feature/830-require-password-on-sending-tr…
taraspasichnyk Aug 2, 2018
86c17c3
Check if user needs to confirm with a password on Coordinator level
taraspasichnyk Aug 2, 2018
15f678b
Use R.string.localizable. Fix issue with Localizable files
taraspasichnyk Aug 2, 2018
ef83945
Change LockCreatePasscodeViewModel to use R.string.localizable
taraspasichnyk Aug 2, 2018
f1d62af
Remove duplication
taraspasichnyk Aug 2, 2018
bef4c80
Passcode protect transaction option only visible if passcode lock is set
taraspasichnyk Aug 2, 2018
9faf26b
Fix localizable string. Remove 'self'. Add general reference to passc…
taraspasichnyk Aug 2, 2018
18dbc31
Merge branch 'master' into feature/830-require-password-on-sending-tr…
taraspasichnyk Aug 3, 2018
d453f52
Change user defaults to keychain
taraspasichnyk Aug 3, 2018
14121c6
Removed localized strings
taraspasichnyk Aug 3, 2018
ee2dc8a
Updated fake lock protocol
taraspasichnyk Aug 3, 2018
b5c6cde
Merge branch 'master' into feature/830-require-password-on-sending-tr…
taraspasichnyk Aug 6, 2018
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
12 changes: 10 additions & 2 deletions Trust.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@
61FC5ECF1FCFBAE500CCB12A /* EtherNumberFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61FC5ECE1FCFBAE500CCB12A /* EtherNumberFormatter.swift */; };
61FC5ED11FCFBDEB00CCB12A /* EtherNumberFormatterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61FC5ED01FCFBDEB00CCB12A /* EtherNumberFormatterTests.swift */; };
664D11A12007D59F0041A0B0 /* EstimateGasRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 664D11A02007D59F0041A0B0 /* EstimateGasRequest.swift */; };
71684E5521105E4200D8FD4B /* AuthenticateEnterPasscodeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71684E5421105E4200D8FD4B /* AuthenticateEnterPasscodeViewModel.swift */; };
71684E5721105F3E00D8FD4B /* EnterPasscodeViewModelInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71684E5621105F3E00D8FD4B /* EnterPasscodeViewModelInterface.swift */; };
7301BA9220A3117000E1AFE5 /* AutoLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7301BA9120A3117000E1AFE5 /* AutoLock.swift */; };
7301BA9620AB1E5600E1AFE5 /* CookiesStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7301BA9520AB1E5600E1AFE5 /* CookiesStore.swift */; };
7302405C204C65DF00B327DF /* NonFungibleTokenCategory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7302405B204C65DF00B327DF /* NonFungibleTokenCategory.swift */; };
Expand Down Expand Up @@ -746,6 +748,8 @@
61FC5ED01FCFBDEB00CCB12A /* EtherNumberFormatterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EtherNumberFormatterTests.swift; sourceTree = "<group>"; };
646C8C822C986358D7388602 /* Pods_Trust.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Trust.framework; sourceTree = BUILT_PRODUCTS_DIR; };
664D11A02007D59F0041A0B0 /* EstimateGasRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EstimateGasRequest.swift; sourceTree = "<group>"; };
71684E5421105E4200D8FD4B /* AuthenticateEnterPasscodeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticateEnterPasscodeViewModel.swift; sourceTree = "<group>"; };
71684E5621105F3E00D8FD4B /* EnterPasscodeViewModelInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnterPasscodeViewModelInterface.swift; sourceTree = "<group>"; };
7301BA9120A3117000E1AFE5 /* AutoLock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutoLock.swift; sourceTree = "<group>"; };
7301BA9520AB1E5600E1AFE5 /* CookiesStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CookiesStore.swift; sourceTree = "<group>"; };
7302405B204C65DF00B327DF /* NonFungibleTokenCategory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NonFungibleTokenCategory.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2099,8 +2103,8 @@
73ACEEF720163B4E003DD71D /* Coordinators */ = {
isa = PBXGroup;
children = (
73ACEF0420163F46003DD71D /* LockEnterPasscodeCoordinator.swift */,
73C41C74201B65AD00243C6C /* LockCreatePasscodeCoordinator.swift */,
73ACEF0420163F46003DD71D /* LockEnterPasscodeCoordinator.swift */,
772C6DBA210A842200FCE4F1 /* AuthenticateUserCoordinator.swift */,
);
path = Coordinators;
Expand All @@ -2120,8 +2124,10 @@
isa = PBXGroup;
children = (
73ACEF0020163ED4003DD71D /* LockViewModel.swift */,
73C41C70201B46AD00243C6C /* LockEnterPasscodeViewModel.swift */,
73C41C72201B5EFF00243C6C /* LockCreatePasscodeViewModel.swift */,
73C41C70201B46AD00243C6C /* LockEnterPasscodeViewModel.swift */,
71684E5421105E4200D8FD4B /* AuthenticateEnterPasscodeViewModel.swift */,
71684E5621105F3E00D8FD4B /* EnterPasscodeViewModelInterface.swift */,
);
path = ViewModels;
sourceTree = "<group>";
Expand Down Expand Up @@ -2919,6 +2925,7 @@
29E14FDB1F7F4F3D00185568 /* Transaction.swift in Sources */,
7712437A20FD97730097296E /* WalletAccountViewModel.swift in Sources */,
BBF4F9B72029D0B3009E04C0 /* GasViewModel.swift in Sources */,
71684E5721105F3E00D8FD4B /* EnterPasscodeViewModelInterface.swift in Sources */,
73C41C75201B65AD00243C6C /* LockCreatePasscodeCoordinator.swift in Sources */,
7301BA9220A3117000E1AFE5 /* AutoLock.swift in Sources */,
296106C81F7646590006164B /* TokensViewModel.swift in Sources */,
Expand Down Expand Up @@ -3015,6 +3022,7 @@
90DDF48520518AE50016E6D4 /* BookmarkViewModel.swift in Sources */,
BBB61E122050993A00428BBD /* BrowserErrorView.swift in Sources */,
29C80D4B1FB51C460037B1E0 /* Decimal.swift in Sources */,
71684E5521105E4200D8FD4B /* AuthenticateEnterPasscodeViewModel.swift in Sources */,
297800521F71FDCF003185C1 /* FormAppearance.swift in Sources */,
77B3BF3C201908ED00EEC15A /* ConfirmCoordinator.swift in Sources */,
7704837020FFD2F700837735 /* TransactionsViewController.swift in Sources */,
Expand Down
1 change: 1 addition & 0 deletions Trust/Localization/ar.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"settings.feedback.email.title" = "ردود الفعل موثوقة";
"settings.navigation.title" = "الإعدادات";
"settings.network.button.title" = "شبكة";
"settings.lockTransactions.label.title" = "توثيق المعاملات";
"settings.openSourceDevelopment.label.title" = "تطوير المصادر المفتوحة";
"settings.privacyPolicy.button.title" = "سياسة الخصوصية";
"settings.pushNotifications.button.title" = "دفع الإخطارات";
Expand Down
2 changes: 2 additions & 0 deletions Trust/Localization/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"settings.feedback.email.title" = "Trust Feedback";
"settings.navigation.title" = "Einstellungen";
"settings.network.button.title" = "Netzwerk";
"settings.lockTransactions.label.title" = "Transaktionen authentifizieren";
"settings.openSourceDevelopment.label.title" = "Open-Source-Entwicklung";
"settings.privacyPolicy.button.title" = "Datenschutzbestimmungen";
"settings.pushNotifications.button.title" = "Push-Benachrichtigungen";
Expand Down Expand Up @@ -142,6 +143,7 @@
"lock.enter.passcode.view.model.incorrect.passcode" = "Falsche PIN. Sie haben %d Versuche.";
"lock.enter.passcode.view.model.initial" = "Geben Sie Ihre PIN ein";
"lock.enter.passcode.view.model.touch.id" = "Mit Touch ID anmelden";
"lock.authenticate.enter.passcode.view.model.touch.id" = "Authentifizieren mit Touch ID"
"lock.enter.passcode.view.model.try.after.one.minute" = "Versuchen Sie es in 1 Minute erneut";
"Name" = "Name";
"send.action.copy.transaction.title" = "Transaktions-ID kopieren";
Expand Down
2 changes: 2 additions & 0 deletions Trust/Localization/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"settings.feedback.email.title" = "Trust Feedback";
"settings.navigation.title" = "Settings";
"settings.network.button.title" = "Network";
"settings.lockTransactions.label.title" = "Authenticate Transactions";
"settings.openSourceDevelopment.label.title" = "Open Source Development";
"settings.privacyPolicy.button.title" = "Privacy Policy";
"settings.pushNotifications.button.title" = "Push Notifications";
Expand Down Expand Up @@ -142,6 +143,7 @@
"lock.enter.passcode.view.model.incorrect.passcode" = "Incorrect passcode. You have %li attempts left.";
"lock.enter.passcode.view.model.initial" = "Enter your passcode.";
"lock.enter.passcode.view.model.touch.id" = "Logging in with Touch ID";
"lock.authenticate.enter.passcode.view.model.touch.id" = "Authenticating with Touch ID"
"lock.enter.passcode.view.model.try.after.one.minute" = "Try after 1 minute.";
"Name" = "Name";
"send.action.copy.transaction.title" = "Copy Transaction ID";
Expand Down
1 change: 1 addition & 0 deletions Trust/Localization/es.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"settings.feedback.email.title" = "Comentarios sobre Trust";
"settings.navigation.title" = "Configuración";
"settings.network.button.title" = "Red";
"settings.lockTransactions.label.title" = "Autenticar transacciones";
"settings.openSourceDevelopment.label.title" = "Desarrollo en abierto";
"settings.privacyPolicy.button.title" = "Política de privacidad";
"settings.pushNotifications.button.title" = "Notificaciones Push";
Expand Down
2 changes: 2 additions & 0 deletions Trust/Localization/fr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"settings.feedback.email.title" = "Commentaires sur la confiance";
"settings.navigation.title" = "Paramètres";
"settings.network.button.title" = "Réseau";
"settings.lockTransactions.label.title" = "Authentifier les transactions";
"settings.openSourceDevelopment.label.title" = "Développement Open Source";
"settings.privacyPolicy.button.title" = "Politique de confidentialité";
"settings.pushNotifications.button.title" = "Notifications push";
Expand Down Expand Up @@ -142,6 +143,7 @@
"lock.enter.passcode.view.model.incorrect.passcode" = "Code d'accès incorrect. Il vous reste %li tentatives.";
"lock.enter.passcode.view.model.initial" = "Entrez votre code d'accès.";
"lock.enter.passcode.view.model.touch.id" = "Se connecter avec Touch ID";
"lock.authenticate.enter.passcode.view.model.touch.id" = "Authentification avec Touch ID"
"lock.enter.passcode.view.model.try.after.one.minute" = "Essayez après 1 minute.";
"Name" = "Nom";
"send.action.copy.transaction.title" = "Copier l'ID de transaction";
Expand Down
1 change: 1 addition & 0 deletions Trust/Localization/it.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"settings.feedback.email.title" = "Trust Feedback";
"settings.navigation.title" = "Impostazioni";
"settings.network.button.title" = "Rete";
"settings.lockTransactions.label.title" = "Autenticare le transazioni";
"settings.openSourceDevelopment.label.title" = "Sviluppo open source";
"settings.privacyPolicy.button.title" = "Politica sulla privacy";
"settings.pushNotifications.button.title" = "Notifiche push";
Expand Down
2 changes: 2 additions & 0 deletions Trust/Localization/ja.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"settings.feedback.email.title" = "Trust フィードバック";
"settings.navigation.title" = "設定";
"settings.network.button.title" = "ネットワーク";
"settings.lockTransactions.label.title" = "トランザクションの認証";
"settings.openSourceDevelopment.label.title" = "オープンソース開発";
"settings.privacyPolicy.button.title" = "個人情報保護方針";
"settings.pushNotifications.button.title" = "プッシュ通知";
Expand Down Expand Up @@ -142,6 +143,7 @@
"lock.enter.passcode.view.model.incorrect.passcode" = "パスコードが間違っています。残り%li回試行できます。";
"lock.enter.passcode.view.model.initial" = "パスコードを入力してください。";
"lock.enter.passcode.view.model.touch.id" = "Touch IDでログイン";
"lock.authenticate.enter.passcode.view.model.touch.id" = "タッチIDによる認証"
"lock.enter.passcode.view.model.try.after.one.minute" = "1分後に試してください。";
"Name" = "名称";
"send.action.copy.transaction.title" = "トランザクション ID をコピー";
Expand Down
1 change: 1 addition & 0 deletions Trust/Localization/ru.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"settings.feedback.email.title" = "Обратная связь ";
"settings.navigation.title" = "Настройки";
"settings.network.button.title" = "Сеть";
"settings.lockTransactions.label.title" = "Аутентификация транзакций";
"settings.openSourceDevelopment.label.title" = "Разработка с открытым исходным кодом";
"settings.privacyPolicy.button.title" = "Политика Конфиденциальности";
"settings.pushNotifications.button.title" = "Push-Уведомления";
Expand Down
2 changes: 2 additions & 0 deletions Trust/Localization/vi.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"settings.feedback.email.title" = "Phản hồi tới Trust";
"settings.navigation.title" = "Cài đặt";
"settings.network.button.title" = "Mạng lưới";
"settings.lockTransactions.label.title" = "Xác thực giao dịch";
"settings.openSourceDevelopment.label.title" = "Phát triển nguồn mở";
"settings.privacyPolicy.button.title" = "Chính sách bảo mật";
"settings.pushNotifications.button.title" = "Các thông báo đẩy";
Expand Down Expand Up @@ -142,6 +143,7 @@
"lock.enter.passcode.view.model.incorrect.passcode" = "Mật mã không chính xác. Bạn còn %d lần thử.";
"lock.enter.passcode.view.model.initial" = "Nhập mã khóa của bạn.";
"lock.enter.passcode.view.model.touch.id" = "Đăng nhập bằng Vân tay";
"lock.authenticate.enter.passcode.view.model.touch.id" = "Xác thực bằng ID cảm ứng"
"lock.enter.passcode.view.model.try.after.one.minute" = "Thử lại sau 1 phút.";
"Name" = "Tên";
"send.action.copy.transaction.title" = "Sao chép ID giao dịch";
Expand Down
2 changes: 2 additions & 0 deletions Trust/Localization/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"settings.feedback.email.title" = "Trust 反馈";
"settings.navigation.title" = "设置";
"settings.network.button.title" = "网络";
"settings.lockTransactions.label.title" = "验证交易";
"settings.openSourceDevelopment.label.title" = "开源式开发";
"settings.privacyPolicy.button.title" = "隐私政策";
"settings.pushNotifications.button.title" = "推送通知";
Expand Down Expand Up @@ -142,6 +143,7 @@
"lock.enter.passcode.view.model.incorrect.passcode" = "密码不正确。你还有 %d 次尝试机会。";
"lock.enter.passcode.view.model.initial" = "请输入密码。";
"lock.enter.passcode.view.model.touch.id" = "使用 Touch ID 登录";
"lock.authenticate.enter.passcode.view.model.touch.id" = "使用Touch ID进行身份验证"
"lock.enter.passcode.view.model.try.after.one.minute" = "请1分钟后再试。";
"Name" = "名称";
"send.action.copy.transaction.title" = "复制交易 ID";
Expand Down
2 changes: 2 additions & 0 deletions Trust/Localization/zh-Hant.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"settings.feedback.email.title" = "Trust 反饋";
"settings.navigation.title" = "設置";
"settings.network.button.title" = "網絡";
"settings.lockTransactions.label.title" = "驗證交易";
"settings.openSourceDevelopment.label.title" = "開源式開發";
"settings.privacyPolicy.button.title" = "隱私政策";
"settings.pushNotifications.button.title" = "推送通知";
Expand Down Expand Up @@ -143,6 +144,7 @@
"lock.enter.passcode.view.model.incorrect.passcode" = "密碼不正確。你還有 %d 次嘗試機會。";
"lock.enter.passcode.view.model.initial" = "請輸入密碼。";
"lock.enter.passcode.view.model.touch.id" = "使用 Touch ID 登錄";
"lock.authenticate.enter.passcode.view.model.touch.id" = "使用Touch ID進行身份驗證"
"lock.enter.passcode.view.model.try.after.one.minute" = "請1分鐘後再試。";
"Name" = "名稱";
"send.action.copy.transaction.title" = "複製交易 ID";
Expand Down
16 changes: 11 additions & 5 deletions Trust/Lock/Coordinators/AuthenticateUserCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,39 @@ import Foundation
final class AuthenticateUserCoordinator: Coordinator {

var coordinators: [Coordinator] = []
private var waitForUnlockResult: UnlockResult?
let navigationController: NavigationController
private let model: LockEnterPasscodeViewModel
private let model: AuthenticateEnterPasscodeViewModel
private let lock: LockInterface
private lazy var lockEnterPasscodeViewController: LockEnterPasscodeViewController = {
return LockEnterPasscodeViewController(model: model)
}()

init(
navigationController: NavigationController,
model: LockEnterPasscodeViewModel = LockEnterPasscodeViewModel(),
model: AuthenticateEnterPasscodeViewModel = AuthenticateEnterPasscodeViewModel(),
lock: LockInterface = Lock()
) {
self.navigationController = navigationController
self.model = model
self.lock = lock

lockEnterPasscodeViewController.unlockWithResult = { [weak self] (state, bioUnlock) in
if state {
lockEnterPasscodeViewController.unlockWithResult = { [weak self] (success, bioUnlock) in
self?.waitForUnlockResult?(success, bioUnlock)
if success {
self?.stop()
}
}
}

func start() {
func start(unlockResult: UnlockResult? = nil) {
guard lock.shouldShowProtection() else { return }

navigationController.present(lockEnterPasscodeViewController, animated: true)

if let unlockResult = unlockResult {
lockEnterPasscodeViewController.unlockWithResult = unlockResult
}
}

func showAuthentication() {
Expand Down
5 changes: 3 additions & 2 deletions Trust/Lock/Coordinators/LockEnterPasscodeCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ final class LockEnterPasscodeCoordinator: Coordinator {
self.window.windowLevel = UIWindowLevelStatusBar + 1.0
self.model = model
self.lock = lock
lockEnterPasscodeViewController.unlockWithResult = { [weak self] (state, bioUnlock) in
if state {
lockEnterPasscodeViewController.unlockWithResult = { [weak self] (success, bioUnlock) in
if success {
self?.stop()
}
}
Expand All @@ -27,6 +27,7 @@ final class LockEnterPasscodeCoordinator: Coordinator {
window.rootViewController = lockEnterPasscodeViewController
window.makeKeyAndVisible()
}

//This method should be refactored!!!
func showAuthentication() {
guard window.isKeyWindow, lock.isPasscodeSet() else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
import UIKit
import LocalAuthentication

typealias UnlockResult = ((_ success: Bool, _ bioUnlock: Bool) -> Void)

final class LockEnterPasscodeViewController: LockPasscodeViewController {
private lazy var lockEnterPasscodeViewModel: LockEnterPasscodeViewModel = {
return self.model as! LockEnterPasscodeViewModel
private lazy var lockEnterPasscodeViewModel: EnterPasscodeViewModelInterface = {
return self.model as! EnterPasscodeViewModelInterface
}()
var unlockWithResult: ((_ success: Bool, _ bioUnlock: Bool) -> Void)?
var unlockWithResult: UnlockResult?
private var context: LAContext!
override func viewDidLoad() {
super.viewDidLoad()
Expand Down
15 changes: 15 additions & 0 deletions Trust/Lock/ViewModels/AuthenticateEnterPasscodeViewModel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright DApps Platform Inc. All rights reserved.

import Foundation

final class AuthenticateEnterPasscodeViewModel: LockViewModel, EnterPasscodeViewModelInterface {
var initialLabelText: String {
return NSLocalizedString("lock.enter.passcode.view.model.initial", value: "Enter your passcode.", comment: "")
}
var tryAfterOneMinute: String {
return NSLocalizedString("lock.enter.passcode.view.model.try.after.one.minute", value: "Try after 1 minute.", comment: "")
}
var loginReason: String {
return NSLocalizedString("lock.authenticate.enter.passcode.view.model.touch.id", value: "Authenticating with Touch ID", comment: "")
}
}
9 changes: 9 additions & 0 deletions Trust/Lock/ViewModels/EnterPasscodeViewModelInterface.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright DApps Platform Inc. All rights reserved.

import Foundation

protocol EnterPasscodeViewModelInterface: class {
var initialLabelText: String { get }
var tryAfterOneMinute: String { get }
var loginReason: String { get }
}
14 changes: 10 additions & 4 deletions Trust/Lock/ViewModels/LockEnterPasscodeViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@

import UIKit

final class LockEnterPasscodeViewModel: LockViewModel {
let initialLabelText = NSLocalizedString("lock.enter.passcode.view.model.initial", value: "Enter your passcode.", comment: "")
let tryAfterOneMinute = NSLocalizedString("lock.enter.passcode.view.model.try.after.one.minute", value: "Try after 1 minute.", comment: "")
let loginReason = NSLocalizedString("lock.enter.passcode.view.model.touch.id", value: "Logging in with Touch ID", comment: "")
final class LockEnterPasscodeViewModel: LockViewModel, EnterPasscodeViewModelInterface {
baophucct marked this conversation as resolved.
Show resolved Hide resolved
var initialLabelText: String {
return NSLocalizedString("lock.enter.passcode.view.model.initial", value: "Enter your passcode.", comment: "")
}
var tryAfterOneMinute: String {
return NSLocalizedString("lock.enter.passcode.view.model.try.after.one.minute", value: "Try after 1 minute.", comment: "")
}
var loginReason: String {
return NSLocalizedString("lock.enter.passcode.view.model.touch.id", value: "Logging in with Touch ID", comment: "")
}
}
2 changes: 2 additions & 0 deletions Trust/Settings/Types/PreferenceOption.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ enum PreferenceOption {
case airdropNotifications
case browserSearchEngine
case testNetworks
case isPasscodeTransactionLockEnabled

var key: String {
switch self {
case .airdropNotifications: return "airdropNotifications"
case .browserSearchEngine: return "browserSearchEngine"
case .testNetworks: return "browserSearchEngine"
case .isPasscodeTransactionLockEnabled: return "isPasscodeTransactionLockEnabled"
}
}
}
Loading