Skip to content

Commit 7f885a5

Browse files
committed
Replaced passcode view with own implementation (DMPasscode), now supports touch id
1 parent 3fe1551 commit 7f885a5

10 files changed

Lines changed: 33 additions & 2133 deletions

File tree

BitStore.xcodeproj/project.pbxproj

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
03CC546A197007F7000196ED /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 03CC5459197007F7000196ED /* InfoPlist.strings */; };
2828
03F2E9B1194F0FD7007BE9A6 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 03F2E9B0194F0FD7007BE9A6 /* Security.framework */; };
2929
3362B7A08C86427D8B01F912 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DBA31FE505D94F7097170EA0 /* libPods.a */; };
30-
9A05962D196202C60060739D /* LTHKeychainUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A05962A196202C60060739D /* LTHKeychainUtils.m */; };
31-
9A05962E196202C60060739D /* LTHPasscodeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A05962C196202C60060739D /* LTHPasscodeViewController.m */; };
3230
9A073F3F1996EDCD007E0D0F /* Order.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A073F3E1996EDCD007E0D0F /* Order.m */; };
3331
9A073F421996F044007E0D0F /* PhoneInputViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A073F411996F044007E0D0F /* PhoneInputViewController.m */; };
3432
9A073F4819978042007E0D0F /* PhoneVerificationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A073F4719978042007E0D0F /* PhoneVerificationViewController.m */; };
@@ -152,10 +150,6 @@
152150
03CC5464197007F7000196ED /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/LTHPasscodeViewController.strings; sourceTree = "<group>"; };
153151
03CC5466197007F7000196ED /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/LTHPasscodeViewController.strings"; sourceTree = "<group>"; };
154152
03F2E9B0194F0FD7007BE9A6 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
155-
9A059629196202C60060739D /* LTHKeychainUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LTHKeychainUtils.h; sourceTree = "<group>"; };
156-
9A05962A196202C60060739D /* LTHKeychainUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LTHKeychainUtils.m; sourceTree = "<group>"; };
157-
9A05962B196202C60060739D /* LTHPasscodeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LTHPasscodeViewController.h; sourceTree = "<group>"; };
158-
9A05962C196202C60060739D /* LTHPasscodeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LTHPasscodeViewController.m; sourceTree = "<group>"; };
159153
9A073F3D1996EDCD007E0D0F /* Order.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Order.h; sourceTree = "<group>"; };
160154
9A073F3E1996EDCD007E0D0F /* Order.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Order.m; sourceTree = "<group>"; };
161155
9A073F401996F044007E0D0F /* PhoneInputViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhoneInputViewController.h; sourceTree = "<group>"; };
@@ -431,17 +425,6 @@
431425
path = Localizable;
432426
sourceTree = "<group>";
433427
};
434-
9A059628196202C60060739D /* LTHPasscodeViewController */ = {
435-
isa = PBXGroup;
436-
children = (
437-
9A059629196202C60060739D /* LTHKeychainUtils.h */,
438-
9A05962A196202C60060739D /* LTHKeychainUtils.m */,
439-
9A05962B196202C60060739D /* LTHPasscodeViewController.h */,
440-
9A05962C196202C60060739D /* LTHPasscodeViewController.m */,
441-
);
442-
path = LTHPasscodeViewController;
443-
sourceTree = "<group>";
444-
};
445428
9A265ED71965EE03005BE50A /* Utils */ = {
446429
isa = PBXGroup;
447430
children = (
@@ -618,7 +601,6 @@
618601
children = (
619602
9AA6C4491986FAFA0035A430 /* HTAutocompleteTextField */,
620603
9A67A72D1950D70A001FCE32 /* Lockbox */,
621-
9A059628196202C60060739D /* LTHPasscodeViewController */,
622604
9A67A7301950D70A001FCE32 /* QR */,
623605
03101B51198FCE6600E7FC5A /* Ringcaptcha */,
624606
9A70263C195F3AB70033026C /* UIBAlertView */,
@@ -978,7 +960,6 @@
978960
9A67A7841950D70A001FCE32 /* Receiver.m in Sources */,
979961
9A702653196098BF0033026C /* MessageHelper.m in Sources */,
980962
9A65236F196F630C00AD5EFB /* AddressHelper.m in Sources */,
981-
9A05962D196202C60060739D /* LTHKeychainUtils.m in Sources */,
982963
9A289CD819843C2C002B9C11 /* CreditCardInputViewController.m in Sources */,
983964
9A67A75B1950D70A001FCE32 /* TransactionDetailViewController.m in Sources */,
984965
9AB7EAF019903DEA00B9A1BA /* API.m in Sources */,
@@ -1041,7 +1022,6 @@
10411022
9A67A75F1950D70A001FCE32 /* ContactsViewController.m in Sources */,
10421023
9A67A76A1950D70A001FCE32 /* RequestHelper.m in Sources */,
10431024
9A67A7561950D70A001FCE32 /* AppDelegate.m in Sources */,
1044-
9A05962E196202C60060739D /* LTHPasscodeViewController.m in Sources */,
10451025
9ABC071619830FB800EC87A3 /* Listeners.m in Sources */,
10461026
);
10471027
runOnlyForDeploymentPostprocessing = 0;

BitStore/Controller/Account/Send/SendViewController.m

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#import "AddressListener.h"
1616
#import "Address.h"
1717
#import "Lockbox.h"
18-
#import "LTHPasscodeViewController.h"
18+
#import <DMPasscode/DMPasscode.h>
1919
#import "UIBAlertView.h"
2020
#import "ContactList.h"
2121
#import "ContactHelper.h"
@@ -28,7 +28,7 @@
2828
#import "AmountViewDelegate.h"
2929
#import "HTAutocompleteTextField.h"
3030

31-
@interface SendViewController () <ScanDelegate, ExchangeListener, AddressListener, LTHPasscodeViewControllerDelegate, AmountViewDelegate, UITextFieldDelegate, HTAutocompleteDataSource, HTAutocompleteTextFieldDelegate>
31+
@interface SendViewController () <ScanDelegate, ExchangeListener, AddressListener, AmountViewDelegate, UITextFieldDelegate, HTAutocompleteDataSource, HTAutocompleteTextFieldDelegate>
3232
@end
3333

3434
static double FEE = 10000;
@@ -269,10 +269,14 @@ - (void)addressChanged:(Address *)address {
269269
}
270270

271271
- (void)send:(id)sender {
272-
[LTHPasscodeViewController sharedUser].delegate = self;
273-
[LTHPasscodeViewController sharedUser].maxNumberOfAllowedFailedAttempts = 3;
274-
if ([LTHPasscodeViewController doesPasscodeExist]) {
275-
[[LTHPasscodeViewController sharedUser] showLockScreen:self animated:NO];
272+
if ([DMPasscode isPasscodeSet]) {
273+
[DMPasscode showPasscodeInViewController:self completion:^(BOOL success) {
274+
if (success) {
275+
[self startSend];
276+
} else {
277+
[self cancel:self];
278+
}
279+
}];
276280
} else {
277281
[self startSend];
278282
}
@@ -294,18 +298,6 @@ - (void)scannedAddress:(NSString *)address amount:(NSString *)amount {
294298
[self setAddress:address amount:amount];
295299
}
296300

297-
#pragma mark - LTHPasscodeViewControllerDelegate
298-
- (void)maxNumberOfFailedAttemptsReached {
299-
[[LTHPasscodeViewController sharedUser] dismissViewControllerAnimated:YES completion:^() {
300-
[[LTHPasscodeViewController sharedUser] reset];
301-
}];
302-
[self cancel:self];
303-
}
304-
305-
- (void)passcodeWasEnteredSuccessfully {
306-
[self startSend];
307-
}
308-
309301
#pragma mark - Send TX
310302
- (void)startSend {
311303
_loadingAlert = [[UIAlertView alloc] init];

BitStore/Controller/Settings/KeyExportViewController.m

Lines changed: 11 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,18 @@
88

99
#import "KeyExportViewController.h"
1010
#import "QRHelper.h"
11-
#import "LTHPasscodeViewController.h"
11+
#import <DMPasscode/DMPasscode.h>
1212
#import "FXBlurView.h"
1313
#import "UserDefaults.h"
1414
#import "UIBAlertView.h"
1515
#import "Lockbox.h"
1616
#import "PushHelper.h"
1717
#import "AddressHelper.h"
1818

19-
@interface KeyExportViewController () <LTHPasscodeViewControllerDelegate>
20-
@end
21-
2219
@implementation KeyExportViewController {
2320
NSString* _privateKey;
2421
NSInteger _index;
2522
BOOL _showTrash;
26-
BOOL _correct;
2723
FXBlurView* _blur1, *_blur2;
2824
}
2925

@@ -40,16 +36,17 @@ - (id)initWithPrivateKey:(NSString *)privateKey index:(NSInteger)index showTrash
4036

4137
- (void)viewDidLoad {
4238
[super viewDidLoad];
43-
44-
_correct = NO;
4539
self.view.backgroundColor = [UIColor whiteColor];
46-
47-
[LTHPasscodeViewController sharedUser].delegate = self;
48-
[LTHPasscodeViewController sharedUser].maxNumberOfAllowedFailedAttempts = 3;
49-
if ([LTHPasscodeViewController doesPasscodeExist]) {
50-
[[LTHPasscodeViewController sharedUser] showLockScreen:self animated:NO];
40+
if ([DMPasscode isPasscodeSet]) {
41+
[DMPasscode showPasscodeInViewController:self completion:^(BOOL success) {
42+
if (success) {
43+
[self showView];
44+
} else {
45+
[self.navigationController popViewControllerAnimated:YES];
46+
}
47+
}];
5148
} else {
52-
[self showView:NO];
49+
[self showView];
5350
}
5451
}
5552

@@ -58,26 +55,7 @@ - (void)viewWillAppear:(BOOL)animated {
5855
[[PiwikTracker sharedInstance] sendViews:@"PrivKeyExport", nil];
5956
}
6057

61-
- (void)maxNumberOfFailedAttemptsReached {
62-
[[LTHPasscodeViewController sharedUser] dismissViewControllerAnimated:YES completion:^() {
63-
[[LTHPasscodeViewController sharedUser] reset];
64-
}];
65-
[self.navigationController popViewControllerAnimated:YES];
66-
}
67-
68-
- (void)passcodeWasEnteredSuccessfully {
69-
_correct = YES;
70-
[self showView:YES];
71-
}
72-
73-
- (void)passcodeViewControllerWillClose {
74-
if (!_correct) {
75-
[self.navigationController popViewControllerAnimated:YES];
76-
}
77-
}
78-
79-
- (void)showView:(BOOL)fromLockScreen {
80-
58+
- (void)showView {
8159
UITapGestureRecognizer* tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)];
8260
[self.view addGestureRecognizer:tap];
8361

@@ -86,7 +64,6 @@ - (void)showView:(BOOL)fromLockScreen {
8664
showFav = NO;
8765
}
8866

89-
9067
UIBarButtonItem* trashItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemTrash target:self action:@selector(trash:)];
9168
UIBarButtonItem* favItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"fav"] style:UIBarButtonItemStyleBordered target:self action:@selector(fav:)];
9269

BitStore/Controller/Settings/SettingsViewController.m

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
#import "ChangeCurrencyViewController.h"
1414
#import "KeysViewController.h"
1515
#import "SwipeViewController.h"
16-
#import "LTHPasscodeViewController.h"
16+
#import <DMPasscode/DMPasscode.h>
1717
#import "UserDefaults.h"
1818
#import "PushHelper.h"
1919
#import "Unit.h"
2020
#import "ChangeUnitViewController.h"
2121

22-
@interface SettingsViewController () <ExchangeListener, LTHPasscodeViewControllerDelegate>
22+
@interface SettingsViewController () <ExchangeListener>
2323
@end
2424

2525
@implementation SettingsViewController {
@@ -101,7 +101,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
101101
[_passcodeToggle addTarget:self action:@selector(passcodeToggle) forControlEvents:UIControlEventTouchUpInside];
102102
[cell.contentView addSubview:_passcodeToggle];
103103
cell.selectionStyle = UITableViewCellSelectionStyleNone;
104-
if ([LTHPasscodeViewController doesPasscodeExist]) {
104+
if ([DMPasscode isPasscodeSet]) {
105105
[_passcodeToggle setOn:YES];
106106
}
107107
} else if (indexPath.section == 1 && indexPath.row == 0) {
@@ -134,12 +134,12 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
134134
}
135135

136136
- (void)passcodeToggle {
137-
[LTHPasscodeViewController sharedUser].delegate = self;
138-
[LTHPasscodeViewController sharedUser].maxNumberOfAllowedFailedAttempts = 3;
139137
if (_passcodeToggle.isOn) {
140-
[[LTHPasscodeViewController sharedUser] showForEnablingPasscodeInViewController:self asModal:YES];
138+
[DMPasscode setupPasscodeInViewController:self completion:^(BOOL success) {
139+
[_passcodeToggle setOn:success];
140+
}];
141141
} else {
142-
[[LTHPasscodeViewController sharedUser] showForDisablingPasscodeInViewController:self asModal:YES];
142+
[DMPasscode removePasscode];
143143
}
144144
}
145145

@@ -153,24 +153,4 @@ - (void)pushToggle {
153153
}
154154
}
155155

156-
157-
- (void)passcodeViewControllerWillClose {
158-
if ([LTHPasscodeViewController doesPasscodeExist]) {
159-
[_passcodeToggle setOn:YES];
160-
} else {
161-
[_passcodeToggle setOn:NO];
162-
}
163-
}
164-
165-
- (void)maxNumberOfFailedAttemptsReached {
166-
[[LTHPasscodeViewController sharedUser] dismissViewControllerAnimated:YES completion:^() {
167-
[[LTHPasscodeViewController sharedUser] reset];
168-
}];
169-
if ([LTHPasscodeViewController doesPasscodeExist]) {
170-
[_passcodeToggle setOn:YES];
171-
} else {
172-
[_passcodeToggle setOn:NO];
173-
}
174-
}
175-
176156
@end

BitStore/Libs/LTHPasscodeViewController/LTHKeychainUtils.h

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)