Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/ios.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarinofaggiana <marino@marinofaggiana.com>2020-05-12 15:49:12 +0300
committermarinofaggiana <marino@marinofaggiana.com>2020-05-12 15:49:12 +0300
commit754d12f2ed242da5e0cd8af2bb8540aaff195124 (patch)
tree196c950f6bdb06219dd94e9533cba8f5107f1457 /Libraries external
parentf748af5991de0e9c9b3833fd2a05a8af843dfa93 (diff)
dev
Diffstat (limited to 'Libraries external')
-rwxr-xr-xLibraries external/BKPasscodeView/BKPasscodeDummyViewController.h26
-rwxr-xr-xLibraries external/BKPasscodeView/BKPasscodeDummyViewController.m41
-rwxr-xr-xLibraries external/BKPasscodeView/BKPasscodeField.h63
-rwxr-xr-xLibraries external/BKPasscodeView/BKPasscodeField.m271
-rwxr-xr-xLibraries external/BKPasscodeView/BKPasscodeInputView.h53
-rwxr-xr-xLibraries external/BKPasscodeView/BKPasscodeInputView.m434
-rwxr-xr-xLibraries external/BKPasscodeView/BKPasscodeLockScreenManager.h53
-rwxr-xr-xLibraries external/BKPasscodeView/BKPasscodeLockScreenManager.m120
-rwxr-xr-xLibraries external/BKPasscodeView/BKPasscodeUtils.h17
-rwxr-xr-xLibraries external/BKPasscodeView/BKPasscodeViewController.h98
-rwxr-xr-xLibraries external/BKPasscodeView/BKPasscodeViewController.m583
-rwxr-xr-xLibraries external/BKPasscodeView/BKShiftingView.h22
-rwxr-xr-xLibraries external/BKPasscodeView/BKShiftingView.m80
-rwxr-xr-xLibraries external/BKPasscodeView/BKTouchIDManager.h27
-rwxr-xr-xLibraries external/BKPasscodeView/BKTouchIDManager.m236
-rwxr-xr-xLibraries external/BKPasscodeView/BKTouchIDSwitchView.h31
-rwxr-xr-xLibraries external/BKPasscodeView/BKTouchIDSwitchView.m125
17 files changed, 0 insertions, 2280 deletions
diff --git a/Libraries external/BKPasscodeView/BKPasscodeDummyViewController.h b/Libraries external/BKPasscodeView/BKPasscodeDummyViewController.h
deleted file mode 100755
index ac79d7898..000000000
--- a/Libraries external/BKPasscodeView/BKPasscodeDummyViewController.h
+++ /dev/null
@@ -1,26 +0,0 @@
-//
-// BKPasscodeDummyViewController.h
-// BKPasscodeViewDemo
-//
-// Created by Byungkook Jang on 2014. 8. 3..
-// Copyright (c) 2014년 Byungkook Jang. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-@protocol BKPasscodeDummyViewControllerDelegate;
-
-
-@interface BKPasscodeDummyViewController : UIViewController
-
-@property (nonatomic, weak) id<BKPasscodeDummyViewControllerDelegate> delegate;
-
-@end
-
-
-@protocol BKPasscodeDummyViewControllerDelegate <NSObject>
-
-- (void)dummyViewControllerWillAppear:(BKPasscodeDummyViewController *)aViewController;
-- (void)dummyViewControllerDidAppear:(BKPasscodeDummyViewController *)aViewController;
-
-@end \ No newline at end of file
diff --git a/Libraries external/BKPasscodeView/BKPasscodeDummyViewController.m b/Libraries external/BKPasscodeView/BKPasscodeDummyViewController.m
deleted file mode 100755
index 28e558e4c..000000000
--- a/Libraries external/BKPasscodeView/BKPasscodeDummyViewController.m
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// BKPasscodeDummyViewController.m
-// BKPasscodeViewDemo
-//
-// Created by Byungkook Jang on 2014. 8. 3..
-// Copyright (c) 2014년 Byungkook Jang. All rights reserved.
-//
-
-#import "BKPasscodeDummyViewController.h"
-
-@interface BKPasscodeDummyViewController ()
-
-@end
-
-@implementation BKPasscodeDummyViewController
-
-- (void)viewDidLoad
-{
- [super viewDidLoad];
-
- self.view.backgroundColor = [UIColor clearColor];
-}
-
-- (void)viewWillAppear:(BOOL)animated
-{
- [super viewWillAppear:animated];
-
- [self.delegate dummyViewControllerWillAppear:self];
-}
-
-- (void)viewDidAppear:(BOOL)animated
-{
- [super viewDidAppear:animated];
-
- if (self.presentedViewController == nil) {
- // only calls delegate when presented view controller(modal view controller) does not exists.
- [self.delegate dummyViewControllerDidAppear:self];
- }
-}
-
-@end
diff --git a/Libraries external/BKPasscodeView/BKPasscodeField.h b/Libraries external/BKPasscodeView/BKPasscodeField.h
deleted file mode 100755
index 8fa1fe516..000000000
--- a/Libraries external/BKPasscodeView/BKPasscodeField.h
+++ /dev/null
@@ -1,63 +0,0 @@
-//
-// BKPasscodeField.h
-// BKPasscodeViewDemo
-//
-// Created by Byungkook Jang on 2014. 4. 20..
-// Copyright (c) 2014년 Byungkook Jang. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-@protocol BKPasscodeFieldDelegate;
-@protocol BKPasscodeFieldImageSource;
-
-@interface BKPasscodeField : UIControl <UIKeyInput>
-
-// delegate
-@property (nonatomic, weak) id<BKPasscodeFieldDelegate> delegate;
-@property (nonatomic, weak) id<BKPasscodeFieldImageSource> imageSource;
-
-// passcode
-@property (nonatomic, strong) NSString *passcode;
-
-// configurations
-@property (nonatomic) NSUInteger maximumLength;
-@property (nonatomic) CGSize dotSize;
-@property (nonatomic) CGFloat lineHeight;
-@property (nonatomic) CGFloat dotSpacing;
-@property (nonatomic, strong) UIColor *dotColor;
-
-@property (nonatomic) UIKeyboardType keyboardType;
-
-@end
-
-
-@protocol BKPasscodeFieldDelegate <NSObject>
-
-@optional
-/**
- * Ask the delegate that whether passcode field accepts text.
- * If you want to accept entering text, return YES.
- */
-- (BOOL)passcodeField:(BKPasscodeField *)aPasscodeField shouldInsertText:(NSString *)aText;
-
-/**
- * Ask the delegate that whether passcode can be deleted.
- * If you want to accept deleting passcode, return YES.
- */
-- (BOOL)passcodeFieldShouldDeleteBackward:(BKPasscodeField *)aPasscodeField;
-
-@end
-
-
-@protocol BKPasscodeFieldImageSource <NSObject>
-
-@optional
-
-/**
- * Ask the image source for a image to display passcode digit at index.
- * If you don't implement this, default shape (line for blank digit and circule for filled digit) will be displayed.
- */
-- (UIImage *)passcodeField:(BKPasscodeField *)aPasscodeField dotImageAtIndex:(NSInteger)aIndex filled:(BOOL)aFilled;
-
-@end \ No newline at end of file
diff --git a/Libraries external/BKPasscodeView/BKPasscodeField.m b/Libraries external/BKPasscodeView/BKPasscodeField.m
deleted file mode 100755
index 2713bbb03..000000000
--- a/Libraries external/BKPasscodeView/BKPasscodeField.m
+++ /dev/null
@@ -1,271 +0,0 @@
-//
-// BKPasscodeField.m
-// BKPasscodeViewDemo
-//
-// Created by Byungkook Jang on 2014. 4. 20..
-// Copyright (c) 2014년 Byungkook Jang. All rights reserved.
-//
-
-#import "BKPasscodeField.h"
-
-@interface BKPasscodeField ()
-
-@property (strong, nonatomic) NSMutableString *mutablePasscode;
-@property (strong, nonatomic) NSRegularExpression *nonDigitRegularExpression;
-
-@end
-
-@implementation BKPasscodeField
-
-- (id)initWithFrame:(CGRect)frame
-{
- self = [super initWithFrame:frame];
- if (self) {
- [self _initialize];
- }
- return self;
-}
-
-- (id)initWithCoder:(NSCoder *)aDecoder
-{
- self = [super initWithCoder:aDecoder];
- if (self) {
- [self _initialize];
- }
- return self;
-}
-
-- (id)init
-{
- self = [super init];
- if (self) {
- [self _initialize];
- }
- return self;
-}
-
-- (void)_initialize
-{
- _maximumLength = 4;
- _dotSize = CGSizeMake(18.0f, 19.0f);
- _dotSpacing = 25.0f;
- _lineHeight = 3.0f;
- _dotColor = [UIColor blackColor];
-
- self.backgroundColor = [UIColor clearColor];
-
- _mutablePasscode = [[NSMutableString alloc] initWithCapacity:4];
-
- [self addTarget:self action:@selector(didTouchUpInside:) forControlEvents:UIControlEventTouchUpInside];
-}
-
-- (NSRegularExpression *)nonDigitRegularExpression
-{
- if (nil == _nonDigitRegularExpression) {
- _nonDigitRegularExpression = [[NSRegularExpression alloc] initWithPattern:@"[^0-9]+" options:0 error:nil];
- }
- return _nonDigitRegularExpression;
-}
-
-- (NSString *)passcode
-{
- return self.mutablePasscode;
-}
-
-- (void)setPasscode:(NSString *)passcode
-{
- if (passcode) {
- if (passcode.length > self.maximumLength) {
- passcode = [passcode substringWithRange:NSMakeRange(0, self.maximumLength)];
- }
- self.mutablePasscode = [NSMutableString stringWithString:passcode];
- } else {
- self.mutablePasscode = [NSMutableString string];
- }
-
- [self setNeedsDisplay];
-}
-
-#pragma mark - UIKeyInput
-
-- (BOOL)hasText
-{
- return (self.mutablePasscode.length > 0);
-}
-
-- (void)insertText:(NSString *)text
-{
- if (self.enabled == NO) {
- return;
- }
-
- if (self.keyboardType == UIKeyboardTypeNumberPad) {
- text = [self.nonDigitRegularExpression stringByReplacingMatchesInString:text options:0 range:NSMakeRange(0, text.length) withTemplate:@""];
- }
-
- if (text.length == 0) {
- return;
- }
-
- NSInteger newLength = self.mutablePasscode.length + text.length;
- if (newLength > self.maximumLength) {
- return;
- }
-
- if ([self.delegate respondsToSelector:@selector(passcodeField:shouldInsertText:)]) {
- if (NO == [self.delegate passcodeField:self shouldInsertText:text]) {
- return;
- }
- }
-
- [self.mutablePasscode appendString:text];
-
- [self setNeedsDisplay];
-
- [self sendActionsForControlEvents:UIControlEventEditingChanged];
-}
-
-- (void)deleteBackward
-{
- if (self.enabled == NO) {
- return;
- }
-
- if ([self.delegate respondsToSelector:@selector(passcodeFieldShouldDeleteBackward:)]) {
- if (NO == [self.delegate passcodeFieldShouldDeleteBackward:self]) {
- return;
- }
- }
-
- if (self.mutablePasscode.length == 0) {
- return;
- }
-
- [self.mutablePasscode deleteCharactersInRange:NSMakeRange(self.mutablePasscode.length - 1, 1)];
-
- [self setNeedsDisplay];
-
- [self sendActionsForControlEvents:UIControlEventEditingChanged];
-}
-
-- (UITextAutocapitalizationType)autocapitalizationType
-{
- return UITextAutocapitalizationTypeNone;
-}
-
-- (UITextAutocorrectionType)autocorrectionType
-{
- return UITextAutocorrectionTypeNo;
-}
-
-- (UITextSpellCheckingType)spellCheckingType
-{
- return UITextSpellCheckingTypeNo;
-}
-
-- (BOOL)enablesReturnKeyAutomatically
-{
- return YES;
-}
-
-- (UIKeyboardAppearance)keyboardAppearance
-{
- return UIKeyboardAppearanceDefault;
-}
-
-- (UIReturnKeyType)returnKeyType
-{
- return UIReturnKeyDone;
-}
-
-- (BOOL)isSecureTextEntry
-{
- return YES;
-}
-
-#pragma mark - UIView
-
-- (CGSize)contentSize
-{
- return CGSizeMake(self.maximumLength * _dotSize.width + (self.maximumLength - 1) * _dotSpacing,
- _dotSize.height);
-}
-
-- (void)setFrame:(CGRect)frame
-{
- [super setFrame:frame];
- [self setNeedsDisplay];
-}
-
-- (void)drawRect:(CGRect)rect
-{
- CGSize contentSize = [self contentSize];
-
- CGPoint origin = CGPointMake(floorf((self.frame.size.width - contentSize.width) * 0.5f),
- floorf((self.frame.size.height - contentSize.height) * 0.5f));
-
- if ([self.imageSource respondsToSelector:@selector(passcodeField:dotImageAtIndex:filled:)]) {
-
- for (NSUInteger i = 0; i < self.maximumLength; i++) {
-
- UIImage *image = nil;
-
- if (i < self.mutablePasscode.length) {
- // draw filled image
- image = [self.imageSource passcodeField:self dotImageAtIndex:i filled:YES];
- } else {
- // draw blank image
- image = [self.imageSource passcodeField:self dotImageAtIndex:i filled:NO];
- }
-
- if (image) {
- CGRect imageFrame = CGRectMake(origin.x, origin.y, self.dotSize.width, self.dotSize.height);
- [image drawInRect:imageFrame];
- }
-
- origin.x += (self.dotSize.width + self.dotSpacing);
- }
-
- } else {
-
- CGContextRef context = UIGraphicsGetCurrentContext();
- CGContextSetFillColorWithColor(context, self.dotColor.CGColor);
-
- for (NSUInteger i = 0; i < self.maximumLength; i++) {
-
- if (i < self.mutablePasscode.length) {
- // draw circle
- CGRect circleFrame = CGRectMake(origin.x, origin.y, self.dotSize.width, self.dotSize.height);
- CGContextFillEllipseInRect(context, circleFrame);
- } else {
- // draw line
- CGRect lineFrame = CGRectMake(origin.x, origin.y + floorf((self.dotSize.height - self.lineHeight) * 0.5f),
- self.dotSize.width, self.lineHeight);
- CGContextFillRect(context, lineFrame);
- }
-
- origin.x += (self.dotSize.width + self.dotSpacing);
- }
- }
-}
-
-- (CGSize)sizeThatFits:(CGSize)size
-{
- return [self contentSize];
-}
-
-#pragma mark - UIResponder
-
-- (BOOL)canBecomeFirstResponder
-{
- return YES;
-}
-
-#pragma mark - Actions
-
-- (void)didTouchUpInside:(id)sender
-{
- [self becomeFirstResponder];
-}
-
-@end
diff --git a/Libraries external/BKPasscodeView/BKPasscodeInputView.h b/Libraries external/BKPasscodeView/BKPasscodeInputView.h
deleted file mode 100755
index 9b201e96e..000000000
--- a/Libraries external/BKPasscodeView/BKPasscodeInputView.h
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// BKPasscodeInputView.h
-// BKPasscodeViewDemo
-//
-// Created by Byungkook Jang on 2014. 4. 20..
-// Copyright (c) 2014년 Byungkook Jang. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-#import "BKPasscodeField.h"
-
-typedef enum : NSUInteger {
- BKPasscodeInputViewNumericPasscodeStyle,
- BKPasscodeInputViewNormalPasscodeStyle,
-} BKPasscodeInputViewPasscodeStyle;
-
-
-@protocol BKPasscodeInputViewDelegate;
-
-
-@interface BKPasscodeInputView : UIView <UITextFieldDelegate, BKPasscodeFieldDelegate, NSCopying>
-
-@property (nonatomic, weak) id<BKPasscodeInputViewDelegate> delegate;
-
-@property (nonatomic) BKPasscodeInputViewPasscodeStyle passcodeStyle;
-@property (nonatomic) UIKeyboardType keyboardType;
-@property (nonatomic) NSUInteger maximumLength;
-
-@property (nonatomic, strong) NSString *title;
-@property (nonatomic, strong) NSString *message;
-@property (nonatomic, strong) NSString *errorMessage;
-@property (nonatomic, getter = isEnabled) BOOL enabled;
-@property (nonatomic, strong) NSString *passcode;
-
-@property (nonatomic, strong, readonly) UIControl *passcodeField;
-
-// You can override these methods to customize message label appearance.
-+ (void)configureTitleLabel:(UILabel *)aLabel;
-+ (void)configureMessageLabel:(UILabel *)aLabel;
-+ (void)configureErrorMessageLabel:(UILabel *)aLabel;
-
-@end
-
-
-@protocol BKPasscodeInputViewDelegate <NSObject>
-
-/**
- * Tells the delegate that maximum length of passcode is entered or user tapped Done button in the keyboard (in case of BKPasscodeInputViewNormalPasscodeStyle).
- */
-- (void)passcodeInputViewDidFinish:(BKPasscodeInputView *)aInputView;
-
-@end \ No newline at end of file
diff --git a/Libraries external/BKPasscodeView/BKPasscodeInputView.m b/Libraries external/BKPasscodeView/BKPasscodeInputView.m
deleted file mode 100755
index 3d1d2691f..000000000
--- a/Libraries external/BKPasscodeView/BKPasscodeInputView.m
+++ /dev/null
@@ -1,434 +0,0 @@
-//
-// BKPasscodeInputView.m
-// BKPasscodeViewDemo
-//
-// Created by Byungkook Jang on 2014. 4. 20..
-// Copyright (c) 2014년 Byungkook Jang. All rights reserved.
-//
-
-#import "BKPasscodeInputView.h"
-
-#define kLabelPasscodeSpacePortrait (30.0f)
-#define kLabelPasscodeSpaceLandscape (10.0f)
-
-#define kTextLeftRightSpace (20.0f)
-
-#define kErrorMessageLeftRightPadding (10.0f)
-#define kErrorMessageTopBottomPadding (5.0f)
-
-#define kDefaultNumericPasscodeMaximumLength (4)
-#define kDefaultNormalPasscodeMaximumLength (20)
-
-@interface BKPasscodeInputView () {
- BOOL _isKeyboardTypeSet;
-}
-
-@property (nonatomic, strong) UILabel *titleLabel;
-@property (nonatomic, strong) UILabel *messageLabel;
-@property (nonatomic, strong) UILabel *errorMessageLabel;
-@property (nonatomic, strong) UIControl *passcodeField;
-
-@end
-
-@implementation BKPasscodeInputView
-
-@synthesize maximumLength = _maximumLength;
-@synthesize keyboardType = _keyboardType;
-@synthesize passcodeField = _passcodeField;
-
-- (instancetype)initWithFrame:(CGRect)frame
-{
- self = [super initWithFrame:frame];
- if (self) {
- [self _initialize];
- }
- return self;
-}
-
-- (instancetype)initWithCoder:(NSCoder *)coder
-{
- self = [super initWithCoder:coder];
- if (self) {
- [self _initialize];
- }
- return self;
-}
-
-- (void)_initialize
-{
- self.backgroundColor = [UIColor clearColor];
-
- _enabled = YES;
- _passcodeStyle = BKPasscodeInputViewNumericPasscodeStyle;
- _keyboardType = UIKeyboardTypeNumberPad;
- _maximumLength = 0;
-
- _titleLabel = [[UILabel alloc] init];
- [[self class] configureTitleLabel:_titleLabel];
- [self addSubview:_titleLabel];
-
- _messageLabel = [[UILabel alloc] init];
- [[self class] configureMessageLabel:_messageLabel];
- [self addSubview:_messageLabel];
-
- _errorMessageLabel = [[UILabel alloc] init];
- [[self class] configureErrorMessageLabel:_errorMessageLabel];
- _errorMessageLabel.hidden = YES;
- [self addSubview:_errorMessageLabel];
-}
-
-+ (void)configureTitleLabel:(UILabel *)aLabel
-{
- aLabel.backgroundColor = [UIColor clearColor];
- aLabel.numberOfLines = 1;
- aLabel.textAlignment = NSTextAlignmentCenter;
- aLabel.lineBreakMode = NSLineBreakByTruncatingTail;
- aLabel.font = [UIFont boldSystemFontOfSize:15.0f];
-}
-
-+ (void)configureMessageLabel:(UILabel *)aLabel
-{
- aLabel.backgroundColor = [UIColor clearColor];
- aLabel.numberOfLines = 0;
- aLabel.textAlignment = NSTextAlignmentCenter;
- aLabel.lineBreakMode = NSLineBreakByWordWrapping;
- aLabel.font = [UIFont systemFontOfSize:15.0f];
-}
-
-+ (void)configureErrorMessageLabel:(UILabel *)aLabel
-{
- aLabel.backgroundColor = [UIColor clearColor];
- aLabel.numberOfLines = 0;
- aLabel.textAlignment = NSTextAlignmentCenter;
- aLabel.lineBreakMode = NSLineBreakByWordWrapping;
- aLabel.backgroundColor = [UIColor colorWithRed:0.63 green:0.2 blue:0.13 alpha:1];
- aLabel.textColor = [UIColor whiteColor];
- aLabel.font = [UIFont systemFontOfSize:15.0f];
-
- aLabel.layer.cornerRadius = 10.0f;
- aLabel.layer.masksToBounds = YES;
-}
-
-- (void)setPasscodeStyle:(BKPasscodeInputViewPasscodeStyle)passcodeStyle
-{
- if (_passcodeStyle != passcodeStyle) {
- _passcodeStyle = passcodeStyle;
-
- if (_passcodeField) {
- _passcodeField = nil;
- [self passcodeField]; // load passcode field immediately if already exists before.
- }
- }
-}
-
-- (UIControl *)passcodeField
-{
- if (nil == _passcodeField) {
-
- switch (_passcodeStyle) {
- case BKPasscodeInputViewNumericPasscodeStyle:
- {
- if (_maximumLength == 0) {
- _maximumLength = kDefaultNumericPasscodeMaximumLength;
- }
-
- if (NO == _isKeyboardTypeSet) {
- _keyboardType = UIKeyboardTypeNumberPad;
- }
-
- BKPasscodeField *passcodeField = [[BKPasscodeField alloc] init];
- passcodeField.delegate = self;
- passcodeField.keyboardType = _keyboardType;
- passcodeField.maximumLength = _maximumLength;
- [passcodeField addTarget:self action:@selector(passcodeControlEditingChanged:) forControlEvents:UIControlEventEditingChanged];
-
- [self setPasscodeField:passcodeField];
- break;
- }
-
- case BKPasscodeInputViewNormalPasscodeStyle:
- {
- if (_maximumLength == 0) {
- _maximumLength = kDefaultNormalPasscodeMaximumLength;
- }
-
- if (NO == _isKeyboardTypeSet) {
- _keyboardType = UIKeyboardTypeASCIICapable;
- }
-
- UITextField *textField = [[UITextField alloc] init];
- textField.delegate = self;
- textField.borderStyle = UITextBorderStyleRoundedRect;
- textField.autocapitalizationType = UITextAutocapitalizationTypeNone;
- textField.autocorrectionType = UITextAutocorrectionTypeNo;
- textField.spellCheckingType = UITextSpellCheckingTypeNo;
- textField.enablesReturnKeyAutomatically = YES;
- textField.keyboardType = _keyboardType;
- textField.secureTextEntry = YES;
- textField.font = [UIFont systemFontOfSize:25.0f];
- textField.clearButtonMode = UITextFieldViewModeWhileEditing;
- textField.returnKeyType = UIReturnKeyDone;
-
- [self setPasscodeField:textField];
- break;
- }
- }
- }
-
- return _passcodeField;
-}
-
-- (void)setPasscodeField:(UIControl *)passcodeField
-{
- if (_passcodeField != passcodeField) {
-
- [_passcodeField removeFromSuperview];
- _passcodeField = passcodeField;
- if (_passcodeField) {
- [self addSubview:_passcodeField];
- }
- [self setNeedsLayout];
- }
-}
-
-- (void)setMaximumLength:(NSUInteger)maximumLength
-{
- _maximumLength = maximumLength;
-
- if ([_passcodeField isKindOfClass:[BKPasscodeField class]]) {
- [(BKPasscodeField *)_passcodeField setMaximumLength:maximumLength];
- }
-}
-
-- (void)setKeyboardType:(UIKeyboardType)keyboardType
-{
- _isKeyboardTypeSet = YES;
- _keyboardType = keyboardType;
- [(id<UITextInputTraits>)_passcodeField setKeyboardType:keyboardType];
-}
-
-- (void)setTitle:(NSString *)title
-{
- self.titleLabel.text = title;
- [self setNeedsLayout];
-}
-
-- (NSString *)title
-{
- return self.titleLabel.text;
-}
-
-- (void)setMessage:(NSString *)message
-{
- self.messageLabel.text = message;
- self.messageLabel.hidden = NO;
-
- self.errorMessageLabel.text = nil;
- self.errorMessageLabel.hidden = YES;
-
- [self setNeedsLayout];
-}
-
-- (NSString *)message
-{
- return self.messageLabel.text;
-}
-
-- (void)setErrorMessage:(NSString *)errorMessage
-{
- self.errorMessageLabel.text = errorMessage;
- self.errorMessageLabel.hidden = NO;
-
- self.messageLabel.text = nil;
- self.messageLabel.hidden = YES;
-
- [self setNeedsLayout];
-}
-
-- (NSString *)errorMessage
-{
- return self.errorMessageLabel.text;
-}
-
-- (NSString *)passcode
-{
- switch (self.passcodeStyle) {
- case BKPasscodeInputViewNumericPasscodeStyle:
- return [(BKPasscodeField *)self.passcodeField passcode];
- case BKPasscodeInputViewNormalPasscodeStyle:
- return [(UITextField *)self.passcodeField text];
- }
-}
-
-- (void)setPasscode:(NSString *)passcode
-{
- switch (self.passcodeStyle) {
- case BKPasscodeInputViewNumericPasscodeStyle:
- [(BKPasscodeField *)self.passcodeField setPasscode:passcode];
- break;
- case BKPasscodeInputViewNormalPasscodeStyle:
- [(UITextField *)self.passcodeField setText:passcode];
- break;
- }
-}
-
-#pragma mark - UIView
-
-- (CGFloat)labelPasscodeSpace
-{
-#ifdef EXTENSION
- return (self.frame.size.width < self.frame.size.height) ? kLabelPasscodeSpacePortrait : kLabelPasscodeSpaceLandscape;
-#else
- return UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]) ? kLabelPasscodeSpacePortrait : kLabelPasscodeSpaceLandscape;
-#endif
-}
-
-- (void)layoutSubviews
-{
- [super layoutSubviews];
-
- // layout passcode control to center
- [self.passcodeField sizeToFit];
-
- if ([self.passcodeField isKindOfClass:[UITextField class]]) {
- self.passcodeField.frame = CGRectMake(0, 0, self.frame.size.width - kTextLeftRightSpace * 2.0f, CGRectGetHeight(self.passcodeField.frame) + 10.0f);
- }
-
- self.passcodeField.center = CGPointMake(CGRectGetWidth(self.frame) * 0.5f, CGRectGetHeight(self.frame) * 0.5f);
-
- CGFloat maxTextWidth = self.frame.size.width - (kTextLeftRightSpace * 2.0f);
- CGFloat labelPasscodeSpace = [self labelPasscodeSpace];
-
- // layout title label
- _titleLabel.frame = CGRectMake(kTextLeftRightSpace, 0, maxTextWidth, self.frame.size.height);
- [_titleLabel sizeToFit];
-
- CGRect rect = _titleLabel.frame;
- rect.origin.x = floorf((self.frame.size.width - CGRectGetWidth(rect)) * 0.5f);
- rect.origin.y = CGRectGetMinY(self.passcodeField.frame) - labelPasscodeSpace - CGRectGetHeight(_titleLabel.frame);
-
- _titleLabel.frame = rect;
-
- // layout message label
- if (!_messageLabel.hidden) {
- _messageLabel.frame = CGRectMake(kTextLeftRightSpace, CGRectGetMaxY(self.passcodeField.frame) + labelPasscodeSpace, maxTextWidth, self.frame.size.height);
- [_messageLabel sizeToFit];
-
- rect = _messageLabel.frame;
- rect.origin.x = floorf((self.frame.size.width - CGRectGetWidth(rect)) * 0.5f);
- _messageLabel.frame = rect;
- }
-
- // layout error message label
- if (!_errorMessageLabel.hidden) {
- _errorMessageLabel.frame = CGRectMake(0, CGRectGetMaxY(self.passcodeField.frame) + labelPasscodeSpace,
- maxTextWidth - kErrorMessageLeftRightPadding * 2.0f,
- self.frame.size.height);
- [_errorMessageLabel sizeToFit];
-
- rect = _errorMessageLabel.frame;
- rect.size.width += (kErrorMessageLeftRightPadding * 2.0f);
- rect.size.height += (kErrorMessageTopBottomPadding * 2.0f);
- rect.origin.x = floorf((self.frame.size.width - rect.size.width) * 0.5f);
-
- _errorMessageLabel.frame = rect;
- }
-}
-
-#pragma mark - UIResponder
-
-- (BOOL)canBecomeFirstResponder
-{
- return [self.passcodeField canBecomeFirstResponder];
-}
-
-- (BOOL)becomeFirstResponder
-{
- return [self.passcodeField becomeFirstResponder];
-}
-
-- (BOOL)canResignFirstResponder
-{
- return [self.passcodeField canResignFirstResponder];
-}
-
-- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
-{
- [super touchesBegan:touches withEvent:event];
- [self.passcodeField becomeFirstResponder];
-}
-
-#pragma mark - Actions
-
-- (void)passcodeControlEditingChanged:(id)sender
-{
- if (![self.passcodeField isKindOfClass:[BKPasscodeField class]]) {
- return;
- }
-
- BKPasscodeField *passcodeField = (BKPasscodeField *)self.passcodeField;
-
- if (passcodeField.passcode.length == passcodeField.maximumLength) {
- if ([self.delegate respondsToSelector:@selector(passcodeInputViewDidFinish:)]) {
- [self.delegate passcodeInputViewDidFinish:self];
- }
- }
-}
-
-#pragma mark - BKPasscodeFieldDelegate
-
-- (BOOL)passcodeField:(BKPasscodeField *)aPasscodeField shouldInsertText:(NSString *)aText
-{
- return self.isEnabled;
-}
-
-- (BOOL)passcodeFieldShouldDeleteBackward:(BKPasscodeField *)aPasscodeField
-{
- return self.isEnabled;
-}
-
-#pragma mark - UITextFieldDelegate
-
-- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
-{
- if (self.isEnabled == NO) {
- return NO;
- }
-
- NSUInteger length = textField.text.length - range.length + string.length;
- if (length > self.maximumLength) {
- return NO;
- }
-
- return YES;
-}
-
-- (BOOL)textFieldShouldReturn:(UITextField *)textField
-{
- if (self.isEnabled == NO) {
- return NO;
- }
-
- if ([self.delegate respondsToSelector:@selector(passcodeInputViewDidFinish:)]) {
- [self.delegate passcodeInputViewDidFinish:self];
- return NO;
- } else {
- return YES; // default behavior
- }
-}
-
-#pragma mark - NSCopying
-
-- (id)copyWithZone:(NSZone *)zone
-{
- BKPasscodeInputView *view = [[[self class] alloc] initWithFrame:self.bounds];
- view.delegate = self.delegate;
- view.autoresizingMask = self.autoresizingMask;
- view.passcodeStyle = self.passcodeStyle;
- view.keyboardType = self.keyboardType;
- view.maximumLength = self.maximumLength;
-
- return view;
-}
-
-@end
diff --git a/Libraries external/BKPasscodeView/BKPasscodeLockScreenManager.h b/Libraries external/BKPasscodeView/BKPasscodeLockScreenManager.h
deleted file mode 100755
index 2fce5bc48..000000000
--- a/Libraries external/BKPasscodeView/BKPasscodeLockScreenManager.h
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// BKPasscodeLockScreenManager.h
-// BKPasscodeViewDemo
-//
-// Created by Byungkook Jang on 2014. 8. 2..
-// Copyright (c) 2014년 Byungkook Jang. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "BKPasscodeViewController.h"
-#import "BKPasscodeDummyViewController.h"
-
-@protocol BKPasscodeLockScreenManagerDelegate;
-
-
-@interface BKPasscodeLockScreenManager : NSObject <BKPasscodeDummyViewControllerDelegate>
-
-@property (weak, nonatomic) id<BKPasscodeLockScreenManagerDelegate> delegate;
-
-/**
- * Shared(singleton) instance.
- */
-+ (BKPasscodeLockScreenManager *)sharedManager;
-
-/**
- * Shows lock screen. You should call this method at applicationDidEnterBackground: in app delegate.
- */
-- (void)showLockScreen:(BOOL)animated;
-
-@end
-
-
-@protocol BKPasscodeLockScreenManagerDelegate <NSObject>
-
-/**
- * Ask the delegate a view controller that should be displayed as lock screen.
- */
-- (UIViewController *)lockScreenManagerPasscodeViewController:(BKPasscodeLockScreenManager *)aManager;
-
-@optional
-/**
- * Ask the delegate that lock screen should be displayed or not.
- * If you prevent displaying lock screen, return NO.
- * If delegate does not implement this method, the lock screen will be shown everytime when application did enter background.
- */
-- (BOOL)lockScreenManagerShouldShowLockScreen:(BKPasscodeLockScreenManager *)aManager;
-
-/**
- * Ask the delegate for the view that will be used as snapshot.
- */
-- (UIView *)lockScreenManagerBlindView:(BKPasscodeLockScreenManager *)aManager;
-
-@end \ No newline at end of file
diff --git a/Libraries external/BKPasscodeView/BKPasscodeLockScreenManager.m b/Libraries external/BKPasscodeView/BKPasscodeLockScreenManager.m
deleted file mode 100755
index 5223bcdaf..000000000
--- a/Libraries external/BKPasscodeView/BKPasscodeLockScreenManager.m
+++ /dev/null
@@ -1,120 +0,0 @@
-//
-// BKPasscodeLockScreenManager.m
-// BKPasscodeViewDemo
-//
-// Created by Byungkook Jang on 2014. 8. 2..
-// Copyright (c) 2014년 Byungkook Jang. All rights reserved.
-//
-
-#import "BKPasscodeLockScreenManager.h"
-#import "BKPasscodeViewController.h"
-
-static BKPasscodeLockScreenManager *_sharedManager;
-
-@interface BKPasscodeLockScreenManager ()
-
-@property (strong, nonatomic) UIWindow *mainWindow;
-@property (strong, nonatomic) UIWindow *lockScreenWindow;
-@property (strong, nonatomic) UIView *blindView;
-
-@end
-
-@implementation BKPasscodeLockScreenManager
-
-+ (BKPasscodeLockScreenManager *)sharedManager
-{
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- _sharedManager = [[BKPasscodeLockScreenManager alloc] init];
- });
- return _sharedManager;
-}
-
-- (void)showLockScreen:(BOOL)animated
-{
- NSAssert(self.delegate, @"delegate is not assigned.");
-
- if (self.lockScreenWindow && self.lockScreenWindow.rootViewController) {
- return;
- }
-
- if ([self.delegate respondsToSelector:@selector(lockScreenManagerShouldShowLockScreen:)]) {
- if (NO == [self.delegate lockScreenManagerShouldShowLockScreen:self]) {
- return;
- }
- }
-
- // get the main window
-#ifndef EXTENSION
- self.mainWindow = [[UIApplication sharedApplication] keyWindow];
-
- // dismiss keyboard before showing lock screen
- [self.mainWindow.rootViewController.view endEditing:YES];
-#endif
-
- // add blind view
- UIView *blindView;
-
- if ([self.delegate respondsToSelector:@selector(lockScreenManagerBlindView:)]) {
- blindView = [self.delegate lockScreenManagerBlindView:self];
- }
-
- if (nil == blindView) {
- blindView = [[UIView alloc] init];
- blindView.backgroundColor = [UIColor whiteColor];
- }
-
- blindView.frame = self.mainWindow.bounds;
- blindView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
-
- [self.mainWindow addSubview:blindView];
-
- self.blindView = blindView;
-
- // set dummy view controller as root view controller
- BKPasscodeDummyViewController *dummyViewController = [[BKPasscodeDummyViewController alloc] init];
-
- UIWindow *lockScreenWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
- lockScreenWindow.windowLevel = self.mainWindow.windowLevel + 1;
- lockScreenWindow.rootViewController = dummyViewController;
- lockScreenWindow.backgroundColor = [UIColor clearColor];
- [lockScreenWindow makeKeyAndVisible];
-
- // present lock screen
- UIViewController *lockScreenViewController = [self.delegate lockScreenManagerPasscodeViewController:self];
-
- if (animated) {
- blindView.hidden = YES;
- }
-
- [lockScreenWindow.rootViewController presentViewController:lockScreenViewController animated:animated completion:^{
- blindView.hidden = NO;
- }];
-
- self.lockScreenWindow = lockScreenWindow;
-
- [lockScreenViewController.view.superview bringSubviewToFront:lockScreenViewController.view];
-
- dummyViewController.delegate = self;
-}
-
-- (void)dummyViewControllerWillAppear:(BKPasscodeDummyViewController *)aViewController
-{
- // remove blind view
- [self.blindView removeFromSuperview];
- self.blindView = nil;
-}
-
-- (void)dummyViewControllerDidAppear:(BKPasscodeDummyViewController *)aViewController
-{
- if ([UIView instancesRespondToSelector:@selector(tintColor)]) {
- self.lockScreenWindow = nil;
- } else {
- [self performSelector:@selector(setLockScreenWindow:) withObject:nil afterDelay:0.1f]; // workaround for wired dealloc on iOS 6
- }
-
- [self.mainWindow makeKeyAndVisible];
- self.mainWindow = nil;
-}
-
-@end
diff --git a/Libraries external/BKPasscodeView/BKPasscodeUtils.h b/Libraries external/BKPasscodeView/BKPasscodeUtils.h
deleted file mode 100755
index 6fde50415..000000000
--- a/Libraries external/BKPasscodeView/BKPasscodeUtils.h
+++ /dev/null
@@ -1,17 +0,0 @@
-//
-// BKPasscodeUtils.h
-// BKPasscodeViewDemo
-//
-// Created by Byungkook Jang on 2014. 10. 4..
-// Copyright (c) 2014년 Byungkook Jang. All rights reserved.
-//
-
-/*
- * System Versioning Preprocessor Macros
- */
-
-#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
-#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
-#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
-#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
-#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
diff --git a/Libraries external/BKPasscodeView/BKPasscodeViewController.h b/Libraries external/BKPasscodeView/BKPasscodeViewController.h
deleted file mode 100755
index 804f6f282..000000000
--- a/Libraries external/BKPasscodeView/BKPasscodeViewController.h
+++ /dev/null
@@ -1,98 +0,0 @@
-//
-// BKPasscodeViewController.h
-// BKPasscodeViewDemo
-//
-// Created by Byungkook Jang on 2014. 4. 20..
-// Copyright (c) 2014년 Byungkook Jang. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-#import "BKPasscodeInputView.h"
-#import "BKTouchIDSwitchView.h"
-#import "BKTouchIDManager.h"
-
-
-typedef enum : NSUInteger {
- BKPasscodeViewControllerNewPasscodeType,
- BKPasscodeViewControllerChangePasscodeType,
- BKPasscodeViewControllerCheckPasscodeType
-} BKPasscodeViewControllerType;
-
-@protocol BKPasscodeViewControllerDelegate;
-
-@interface BKPasscodeViewController : UIViewController <BKPasscodeInputViewDelegate, BKTouchIDSwitchViewDelegate>
-
-@property (nonatomic, weak) id<BKPasscodeViewControllerDelegate> delegate;
-
-@property (nonatomic) BKPasscodeViewControllerType type;
-@property (nonatomic) BKPasscodeInputViewPasscodeStyle passcodeStyle;
-@property (nonatomic) UIKeyboardType keyboardType;
-@property (nonatomic, strong, readonly) BKPasscodeInputView *passcodeInputView;
-@property (nonatomic, strong) BKTouchIDManager *touchIDManager;
-
-@property BOOL inputViewTitlePassword;
-
-/**
- * Customize passcode input view
- * You may override to customize passcode input view appearance.
- */
-- (void)customizePasscodeInputView:(BKPasscodeInputView *)aPasscodeInputView;
-
-/**
- * Instantiate passcode input view.
- * You may override to use custom passcode input view.
- */
-- (BKPasscodeInputView *)instantiatePasscodeInputView;
-
-/**
- * Prompts Touch ID view to scan fingerprint.
- */
-- (void)startTouchIDAuthenticationIfPossible;
-
-/**
- * Prompts Touch ID view to scan fingerprint.
- * If Touch ID is disabled or unavailable, value of 'prompted' will be NO.
- */
-- (void)startTouchIDAuthenticationIfPossible:(void(^)(BOOL prompted))aCompletionBlock;
-
-@end
-
-@protocol BKPasscodeViewControllerDelegate <NSObject>
-
-/**
- * Tells the delegate that passcode is created or authenticated successfully.
- */
-- (void)passcodeViewController:(BKPasscodeViewController *)aViewController didFinishWithPasscode:(NSString *)aPasscode;
-
-@optional
-
-/**
- * Tells the delegate that Touch ID error occured.
- */
-- (void)passcodeViewControllerDidFailTouchIDKeychainOperation:(BKPasscodeViewController *)aViewController;
-
-/**
- * Ask the delegate to verify that a passcode is correct. You must call the resultHandler with result.
- * You can check passcode asynchronously and show progress view (e.g. UIActivityIndicator) in the view controller if authentication takes too long.
- * You must call result handler in main thread.
- */
-- (void)passcodeViewController:(BKPasscodeViewController *)aViewController authenticatePasscode:(NSString *)aPasscode resultHandler:(void(^)(BOOL succeed))aResultHandler;
-
-/**
- * Tells the delegate that user entered incorrect passcode.
- * You should manage failed attempts yourself and it should be returned by -[BKPasscodeViewControllerDelegate passcodeViewControllerNumberOfFailedAttempts:] method.
- */
-- (void)passcodeViewControllerDidFailAttempt:(BKPasscodeViewController *)aViewController;
-
-/**
- * Ask the delegate that how many times incorrect passcode entered to display failed attempt count.
- */
-- (NSUInteger)passcodeViewControllerNumberOfFailedAttempts:(BKPasscodeViewController *)aViewController;
-
-/**
- * Ask the delegate that whether passcode view should lock or unlock.
- * If you return nil, passcode view will unlock otherwise it will lock until the date.
- */
-- (NSDate *)passcodeViewControllerLockUntilDate:(BKPasscodeViewController *)aViewController;
-
-@end \ No newline at end of file
diff --git a/Libraries external/BKPasscodeView/BKPasscodeViewController.m b/Libraries external/BKPasscodeView/BKPasscodeViewController.m
deleted file mode 100755
index 69d49e981..000000000
--- a/Libraries external/BKPasscodeView/BKPasscodeViewController.m
+++ /dev/null
@@ -1,583 +0,0 @@
-//
-// BKPasscodeViewController.m
-// BKPasscodeViewDemo
-//
-// Created by Byungkook Jang on 2014. 4. 20..
-// Copyright (c) 2014년 Byungkook Jang. All rights reserved.
-//
-
-#import "BKPasscodeViewController.h"
-#import "BKShiftingView.h"
-#import "AFViewShaker.h"
-#import "BKPasscodeUtils.h"
-
-typedef enum : NSUInteger {
- BKPasscodeViewControllerStateUnknown,
- BKPasscodeViewControllerStateCheckPassword,
- BKPasscodeViewControllerStateInputPassword,
- BKPasscodeViewControllerStateReinputPassword
-} BKPasscodeViewControllerState;
-
-#define kBKPasscodeOneMinuteInSeconds (60)
-#define kBKPasscodeDefaultKeyboardHeight (216)
-
-@interface BKPasscodeViewController ()
-
-@property (nonatomic, strong) BKShiftingView *shiftingView;
-
-@property (nonatomic) BKPasscodeViewControllerState currentState;
-@property (nonatomic, strong) NSString *oldPasscode;
-@property (nonatomic, strong) NSString *theNewPasscode;
-@property (nonatomic, strong) NSTimer *lockStateUpdateTimer;
-@property (nonatomic) CGFloat keyboardHeight;
-@property (nonatomic, strong) AFViewShaker *viewShaker;
-
-@property (nonatomic) BOOL promptingTouchID;
-
-@end
-
-@implementation BKPasscodeViewController
-
-- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
-{
- self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
- if (self) {
- // init state
- _type = BKPasscodeViewControllerNewPasscodeType;
- _currentState = BKPasscodeViewControllerStateInputPassword;
-
- // create shifting view
- self.shiftingView = [[BKShiftingView alloc] init];
- self.shiftingView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
- self.shiftingView.currentView = [self instantiatePasscodeInputView];
-
- // keyboard notifications
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveKeyboardWillShowHideNotification:) name:UIKeyboardWillShowNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveKeyboardWillShowHideNotification:) name:UIKeyboardWillHideNotification object:nil];
-
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveApplicationWillEnterForegroundNotification:)
- name:UIApplicationWillEnterForegroundNotification
- object:nil];
-
- self.keyboardHeight = kBKPasscodeDefaultKeyboardHeight; // sometimes keyboard notification is not posted at all. so setting default value.
- }
- return self;
-}
-
-- (void)dealloc
-{
- [self.lockStateUpdateTimer invalidate];
- self.lockStateUpdateTimer = nil;
-
- [[NSNotificationCenter defaultCenter] removeObserver:self];
-}
-
-- (void)setType:(BKPasscodeViewControllerType)type
-{
- if (_type == type) {
- return;
- }
-
- _type = type;
-
- switch (type) {
- case BKPasscodeViewControllerNewPasscodeType:
- self.currentState = BKPasscodeViewControllerStateInputPassword;
- break;
- default:
- self.currentState = BKPasscodeViewControllerStateCheckPassword;
- break;
- }
-}
-
-- (BKPasscodeInputView *)passcodeInputView
-{
- if (NO == [self.shiftingView.currentView isKindOfClass:[BKPasscodeInputView class]]) {
- return nil;
- }
-
- return (BKPasscodeInputView *)self.shiftingView.currentView;
-}
-
-- (BKPasscodeInputView *)instantiatePasscodeInputView
-{
- BKPasscodeInputView *view = [[BKPasscodeInputView alloc] init];
- view.delegate = self;
- view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
-
- return view;
-}
-
-- (void)customizePasscodeInputView:(BKPasscodeInputView *)aPasscodeInputView
-{
-}
-
-
-- (void)viewDidLoad
-{
- [super viewDidLoad];
-
- [self.view setBackgroundColor:[UIColor colorWithRed:0.94 green:0.94 blue:0.96 alpha:1]];
-
- [self updatePasscodeInputViewTitle:self.passcodeInputView];
-
- [self customizePasscodeInputView:self.passcodeInputView];
-
- [self.view addSubview:self.shiftingView];
-
- [self lockIfNeeded];
-}
-
-- (void)viewWillAppear:(BOOL)animated
-{
- [super viewWillAppear:animated];
-
- if (self.passcodeInputView.isEnabled) {
-
- //TWS
- [self performSelector:@selector(startTouchIDAuthenticationIfPossible) withObject:nil afterDelay:0.2];
- }
-
- [self.passcodeInputView becomeFirstResponder];
-}
-
-- (void)viewWillDisappear:(BOOL)animated
-{
- [super viewWillDisappear:animated];
-
- [self.view endEditing:YES];
-}
-
-- (void)viewDidLayoutSubviews
-{
- [super viewDidLayoutSubviews];
-
- CGRect frame = self.view.bounds;
-
- CGFloat topBarOffset = 0;
- if ([self respondsToSelector:@selector(topLayoutGuide)]) {
- topBarOffset = [self.topLayoutGuide length];
- }
-
- frame.origin.y += topBarOffset;
- frame.size.height -= (topBarOffset + self.keyboardHeight);
-
- self.shiftingView.frame = frame;
-}
-
-#pragma mark - Public methods
-
-- (void)setPasscodeStyle:(BKPasscodeInputViewPasscodeStyle)passcodeStyle
-{
- self.passcodeInputView.passcodeStyle = passcodeStyle;
-}
-
-- (BKPasscodeInputViewPasscodeStyle)passcodeStyle
-{
- return self.passcodeInputView.passcodeStyle;
-}
-
-- (void)setKeyboardType:(UIKeyboardType)keyboardType
-{
- self.passcodeInputView.keyboardType = keyboardType;
-}
-
-- (UIKeyboardType)keyboardType
-{
- return self.passcodeInputView.keyboardType;
-}
-
-- (void)showLockMessageWithLockUntilDate:(NSDate *)lockUntil
-{
- NSTimeInterval timeInterval = [lockUntil timeIntervalSinceNow];
- NSUInteger minutes = ceilf(timeInterval / 60.0f);
-
- BKPasscodeInputView *inputView = self.passcodeInputView;
- inputView.enabled = NO;
-
- if (minutes == 1) {
- inputView.title = NSLocalizedString(@"Try again in 1 minute", nil);
- } else {
- inputView.title = [NSString stringWithFormat:NSLocalizedString(@"Try again in %d minutes", nil), minutes];
- }
-
- NSUInteger numberOfFailedAttempts = [self.delegate passcodeViewControllerNumberOfFailedAttempts:self];
-
- [self showFailedAttemptsCount:numberOfFailedAttempts inputView:inputView];
-
- if (self.lockStateUpdateTimer == nil) {
-
- NSTimeInterval delay = timeInterval + kBKPasscodeOneMinuteInSeconds - (kBKPasscodeOneMinuteInSeconds * (NSTimeInterval)minutes);
-
- self.lockStateUpdateTimer = [[NSTimer alloc] initWithFireDate:[NSDate dateWithTimeIntervalSinceNow:delay]
- interval:60.f
- target:self
- selector:@selector(lockStateUpdateTimerFired:)
- userInfo:nil
- repeats:YES];
-
- [[NSRunLoop currentRunLoop] addTimer:self.lockStateUpdateTimer forMode:NSDefaultRunLoopMode];
- }
-}
-
-- (BOOL)lockIfNeeded
-{
- if (self.currentState != BKPasscodeViewControllerStateCheckPassword) {
- return NO;
- }
-
- if (NO == [self.delegate respondsToSelector:@selector(passcodeViewControllerLockUntilDate:)]) {
- return NO;
- }
-
- NSDate *lockUntil = [self.delegate passcodeViewControllerLockUntilDate:self];
- if (lockUntil == nil || [lockUntil timeIntervalSinceNow] < 0) {
- return NO;
- }
-
- [self showLockMessageWithLockUntilDate:lockUntil];
-
- return YES;
-}
-
-- (void)updateLockMessageOrUnlockIfNeeded
-{
- if (self.currentState != BKPasscodeViewControllerStateCheckPassword) {
- return;
- }
-
- if (NO == [self.delegate respondsToSelector:@selector(passcodeViewControllerLockUntilDate:)]) {
- return;
- }
-
- BKPasscodeInputView *inputView = self.passcodeInputView;
-
- NSDate *lockUntil = [self.delegate passcodeViewControllerLockUntilDate:self];
-
- if (lockUntil == nil || [lockUntil timeIntervalSinceNow] < 0) {
-
- // invalidate timer
- [self.lockStateUpdateTimer invalidate];
- self.lockStateUpdateTimer = nil;
-
- [self updatePasscodeInputViewTitle:inputView];
-
- inputView.enabled = YES;
-
- } else {
- [self showLockMessageWithLockUntilDate:lockUntil];
- }
-}
-
-- (void)lockStateUpdateTimerFired:(NSTimer *)timer
-{
- [self updateLockMessageOrUnlockIfNeeded];
-}
-
-- (void)startTouchIDAuthenticationIfPossible
-{
- [self startTouchIDAuthenticationIfPossible:nil];
-}
-
-- (void)startTouchIDAuthenticationIfPossible:(void (^)(BOOL))aCompletionBlock
-{
- if (NO == [self canAuthenticateWithTouchID]) {
- if (aCompletionBlock) {
- aCompletionBlock(NO);
- }
- return;
- }
-
- self.promptingTouchID = YES;
-
- [self.touchIDManager loadPasscodeWithCompletionBlock:^(NSString *passcode) {
-
- self.promptingTouchID = NO;
-
- if (passcode) {
-
- self.passcodeInputView.passcode = passcode;
-
- [self passcodeInputViewDidFinish:self.passcodeInputView];
- }
-
- if (aCompletionBlock) {
- aCompletionBlock(YES);
- }
- }];
-}
-
-#pragma mark - Private methods
-
-- (void)updatePasscodeInputViewTitle:(BKPasscodeInputView *)passcodeInputView
-{
- switch (self.currentState) {
- case BKPasscodeViewControllerStateCheckPassword:
- if (self.type == BKPasscodeViewControllerChangePasscodeType) {
- if (self.inputViewTitlePassword) passcodeInputView.title = NSLocalizedString(@"Enter your old password", nil);
- else passcodeInputView.title = NSLocalizedString(@"Enter your old passcode", nil);
- } else {
- if (self.inputViewTitlePassword) passcodeInputView.title = NSLocalizedString(@"Enter your password", nil);
- else passcodeInputView.title = NSLocalizedString(@"Enter your passcode", nil);
- }
- break;
-
- case BKPasscodeViewControllerStateInputPassword:
- if (self.type == BKPasscodeViewControllerChangePasscodeType) {
- if (self.inputViewTitlePassword) passcodeInputView.title = NSLocalizedString(@"Enter your new password", nil);
- else passcodeInputView.title = NSLocalizedString(@"Enter your new passcode", nil);
- } else {
- if (self.inputViewTitlePassword) passcodeInputView.title = NSLocalizedString(@"Enter a password", nil);
- else passcodeInputView.title = NSLocalizedString(@"Enter a passcode", nil);
- }
- break;
-
- case BKPasscodeViewControllerStateReinputPassword:
- if (self.inputViewTitlePassword) passcodeInputView.title = NSLocalizedString(@"Re-enter your password", nil);
- else passcodeInputView.title = NSLocalizedString(@"Re-enter your passcode", nil);
- break;
-
- default:
- break;
- }
-}
-
-- (void)showFailedAttemptsCount:(NSUInteger)failCount inputView:(BKPasscodeInputView *)aInputView
-{
- if (failCount == 0) {
- if (self.inputViewTitlePassword) aInputView.errorMessage = NSLocalizedString(@"Invalid Password", nil);
- else aInputView.errorMessage = NSLocalizedString(@"Invalid Passcode", nil);
- } else if (failCount == 1) {
- if (self.inputViewTitlePassword) aInputView.errorMessage = NSLocalizedString(@"1 Failed Password Attempt", nil);
- else aInputView.errorMessage = NSLocalizedString(@"1 Failed Passcode Attempt", nil);
- } else {
- if (self.inputViewTitlePassword) aInputView.errorMessage = [NSString stringWithFormat:NSLocalizedString(@"%d Failed Password Attempts", nil), failCount];
- else aInputView.errorMessage = [NSString stringWithFormat:NSLocalizedString(@"%d Failed Passcode Attempts", nil), failCount];
- }
-}
-
-- (void)showTouchIDSwitchView
-{
- BKTouchIDSwitchView *view = [[BKTouchIDSwitchView alloc] init];
- view.delegate = self;
- view.touchIDSwitch.on = self.touchIDManager.isTouchIDEnabled;
-
- [self.shiftingView showView:view withDirection:BKShiftingDirectionForward];
-}
-
-- (BOOL)canAuthenticateWithTouchID
-{
- if (NO == [BKTouchIDManager canUseTouchID]) {
- return NO;
- }
-
- if (self.type != BKPasscodeViewControllerCheckPasscodeType) {
- return NO;
- }
-
- if (nil == self.touchIDManager || NO == self.touchIDManager.isTouchIDEnabled) {
- return NO;
- }
-
- if (self.promptingTouchID) {
- return NO;
- }
-
-#ifndef EXTENSION
- if ([UIApplication sharedApplication].applicationState == UIApplicationStateInactive) {
- return NO;
- }
-#endif
-
- return YES;
-}
-
-#pragma mark - BKPasscodeInputViewDelegate
-
-- (void)passcodeInputViewDidFinish:(BKPasscodeInputView *)aInputView
-{
- NSString *passcode = aInputView.passcode;
-
- switch (self.currentState) {
- case BKPasscodeViewControllerStateCheckPassword:
- {
- NSAssert([self.delegate respondsToSelector:@selector(passcodeViewController:authenticatePasscode:resultHandler:)],
- @"delegate must implement passcodeViewController:authenticatePasscode:resultHandler:");
-
- [self.delegate passcodeViewController:self authenticatePasscode:passcode resultHandler:^(BOOL succeed) {
-
- NSAssert([NSThread isMainThread], @"you must invoke result handler in main thread.");
-
- if (succeed) {
-
- if (self.type == BKPasscodeViewControllerChangePasscodeType) {
-
- self.oldPasscode = passcode;
- self.currentState = BKPasscodeViewControllerStateInputPassword;
-
- BKPasscodeInputView *newPasscodeInputView = [self.passcodeInputView copy];
-
- [self customizePasscodeInputView:newPasscodeInputView];
-
- [self updatePasscodeInputViewTitle:newPasscodeInputView];
- [self.shiftingView showView:newPasscodeInputView withDirection:BKShiftingDirectionForward];
-
- [self.passcodeInputView becomeFirstResponder];
-
- } else {
-
- [self.delegate passcodeViewController:self didFinishWithPasscode:passcode];
-
- }
-
- } else {
-
- if ([self.delegate respondsToSelector:@selector(passcodeViewControllerDidFailAttempt:)]) {
- [self.delegate passcodeViewControllerDidFailAttempt:self];
- }
-
- NSUInteger failCount = 0;
-
- if ([self.delegate respondsToSelector:@selector(passcodeViewControllerNumberOfFailedAttempts:)]) {
- failCount = [self.delegate passcodeViewControllerNumberOfFailedAttempts:self];
- }
-
- [self showFailedAttemptsCount:failCount inputView:aInputView];
-
- // reset entered passcode
- aInputView.passcode = nil;
-
- // shake
- self.viewShaker = [[AFViewShaker alloc] initWithView:aInputView.passcodeField];
- [self.viewShaker shakeWithDuration:0.5f completion:nil];
-
- // lock if needed
- if ([self.delegate respondsToSelector:@selector(passcodeViewControllerLockUntilDate:)]) {
- NSDate *lockUntilDate = [self.delegate passcodeViewControllerLockUntilDate:self];
- if (lockUntilDate != nil) {
- [self showLockMessageWithLockUntilDate:lockUntilDate];
- }
- }
-
- }
- }];
-
- break;
- }
- case BKPasscodeViewControllerStateInputPassword:
- {
- if (self.type == BKPasscodeViewControllerChangePasscodeType && [self.oldPasscode isEqualToString:passcode]) {
-
- aInputView.passcode = nil;
-
- if (self.inputViewTitlePassword) aInputView.message = NSLocalizedString(@"Enter a different password. Cannot re-use the same password.", nil);
- else aInputView.message = NSLocalizedString(@"Enter a different passcode. Cannot re-use the same passcode.", nil);
-
- } else {
-
- self.theNewPasscode = passcode;
- self.currentState = BKPasscodeViewControllerStateReinputPassword;
-
- BKPasscodeInputView *newPasscodeInputView = [self.passcodeInputView copy];
-
- [self customizePasscodeInputView:newPasscodeInputView];
-
- [self updatePasscodeInputViewTitle:newPasscodeInputView];
- [self.shiftingView showView:newPasscodeInputView withDirection:BKShiftingDirectionForward];
-
- [self.passcodeInputView becomeFirstResponder];
- }
-
- break;
- }
- case BKPasscodeViewControllerStateReinputPassword:
- {
- if ([passcode isEqualToString:self.theNewPasscode]) {
-
- if (self.touchIDManager && [BKTouchIDManager canUseTouchID]) {
- [self showTouchIDSwitchView];
- } else {
- [self.delegate passcodeViewController:self didFinishWithPasscode:passcode];
- }
-
- } else {
-
- self.currentState = BKPasscodeViewControllerStateInputPassword;
-
- BKPasscodeInputView *newPasscodeInputView = [self.passcodeInputView copy];
-
- [self customizePasscodeInputView:newPasscodeInputView];
-
- [self updatePasscodeInputViewTitle:newPasscodeInputView];
-
- if (self.inputViewTitlePassword) newPasscodeInputView.message = NSLocalizedString(@"Password did not match.\nTry again.", nil);
- else newPasscodeInputView.message = NSLocalizedString(@"Passcodes did not match.\nTry again.", nil);
-
- [self.shiftingView showView:newPasscodeInputView withDirection:BKShiftingDirectionBackward];
-
- [self.passcodeInputView becomeFirstResponder];
- }
- break;
- }
- default:
- break;
- }
-}
-
-#pragma mark - BKTouchIDSwitchViewDelegate
-
-- (void)touchIDSwitchViewDidPressDoneButton:(BKTouchIDSwitchView *)view
-{
- BOOL enabled = view.touchIDSwitch.isOn;
-
- if (enabled) {
-
- [self.touchIDManager savePasscode:self.theNewPasscode completionBlock:^(BOOL success) {
- if (success) {
- [self.delegate passcodeViewController:self didFinishWithPasscode:self.theNewPasscode];
- } else {
- if ([self.delegate respondsToSelector:@selector(passcodeViewControllerDidFailTouchIDKeychainOperation:)]) {
- [self.delegate passcodeViewControllerDidFailTouchIDKeychainOperation:self];
- }
- }
- }];
-
- } else {
-
- [self.touchIDManager deletePasscodeWithCompletionBlock:^(BOOL success) {
- if (success) {
- [self.delegate passcodeViewController:self didFinishWithPasscode:self.theNewPasscode];
- } else {
- if ([self.delegate respondsToSelector:@selector(passcodeViewControllerDidFailTouchIDKeychainOperation:)]) {
- [self.delegate passcodeViewControllerDidFailTouchIDKeychainOperation:self];
- }
- }
- }];
- }
-}
-
-#pragma mark - Notifications
-
-- (void)didReceiveKeyboardWillShowHideNotification:(NSNotification *)notification
-{
- CGRect keyboardRect = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
-
-/*
-#ifdef EXTENSION
- self.keyboardHeight = CGRectGetHeight(keyboardRect);
-#else
- UIInterfaceOrientation statusBarOrientation = [[UIApplication sharedApplication] statusBarOrientation];
- self.keyboardHeight = UIInterfaceOrientationIsPortrait(statusBarOrientation) ? CGRectGetWidth(keyboardRect) : CGRectGetHeight(keyboardRect);
-#endif
-*/
- self.keyboardHeight = CGRectGetHeight(keyboardRect);
-
- [self.view setNeedsLayout];
-}
-
-- (void)didReceiveApplicationWillEnterForegroundNotification:(NSNotification *)notification
-{
- [self startTouchIDAuthenticationIfPossible];
-}
-
-@end
diff --git a/Libraries external/BKPasscodeView/BKShiftingView.h b/Libraries external/BKPasscodeView/BKShiftingView.h
deleted file mode 100755
index 859239e5f..000000000
--- a/Libraries external/BKPasscodeView/BKShiftingView.h
+++ /dev/null
@@ -1,22 +0,0 @@
-//
-// BKShiftingView.h
-// BKPasscodeViewDemo
-//
-// Created by Byungkook Jang on 2014. 10. 11..
-// Copyright (c) 2014년 Byungkook Jang. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-typedef NS_ENUM(NSUInteger, BKShiftingDirection) {
- BKShiftingDirectionForward,
- BKShiftingDirectionBackward,
-};
-
-@interface BKShiftingView : UIView
-
-@property (nonatomic, strong) UIView *currentView;
-
-- (void)showView:(UIView *)view withDirection:(BKShiftingDirection)direction;
-
-@end
diff --git a/Libraries external/BKPasscodeView/BKShiftingView.m b/Libraries external/BKPasscodeView/BKShiftingView.m
deleted file mode 100755
index 439b40758..000000000
--- a/Libraries external/BKPasscodeView/BKShiftingView.m
+++ /dev/null
@@ -1,80 +0,0 @@
-//
-// BKShiftingView.m
-// BKPasscodeViewDemo
-//
-// Created by Byungkook Jang on 2014. 10. 11..
-// Copyright (c) 2014년 Byungkook Jang. All rights reserved.
-//
-
-#import "BKShiftingView.h"
-
-@implementation BKShiftingView
-
-- (void)layoutSubviews
-{
- [super layoutSubviews];
-
- self.currentView.frame = self.bounds;
-}
-
-- (void)setCurrentView:(UIView *)currentView
-{
- if (_currentView == currentView) {
- return;
- }
-
- [_currentView removeFromSuperview];
-
- _currentView = currentView;
-
- if (currentView) {
- [self addSubview:currentView];
- }
-
- [self setNeedsLayout];
-}
-
-- (void)showView:(UIView *)view withDirection:(BKShiftingDirection)direction
-{
- UIView *oldView = self.currentView;
- oldView.userInteractionEnabled = NO;
-
- CGRect nextFrame = self.bounds;
-
- switch (direction) {
- case BKShiftingDirectionForward:
- nextFrame.origin.x = CGRectGetWidth(self.bounds);
- break;
- case BKShiftingDirectionBackward:
- nextFrame.origin.x = -CGRectGetWidth(self.bounds);
- break;
- }
-
- view.frame = nextFrame;
-
- [self addSubview:view];
-
- // start animation
- [UIView animateWithDuration:0.3f delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
-
- switch (direction) {
- case BKShiftingDirectionForward:
- oldView.frame = CGRectOffset(oldView.frame, -CGRectGetWidth(self.bounds), 0);
- view.frame = CGRectOffset(view.frame, -CGRectGetWidth(self.bounds), 0);
- break;
- case BKShiftingDirectionBackward:
- oldView.frame = CGRectOffset(oldView.frame, CGRectGetWidth(self.bounds), 0);
- view.frame = CGRectOffset(view.frame, CGRectGetWidth(self.bounds), 0);
- break;
- }
-
- } completion:^(BOOL finished) {
-
- [oldView removeFromSuperview];
-
- }];
-
- _currentView = view;
-}
-
-@end
diff --git a/Libraries external/BKPasscodeView/BKTouchIDManager.h b/Libraries external/BKPasscodeView/BKTouchIDManager.h
deleted file mode 100755
index 225c39e01..000000000
--- a/Libraries external/BKPasscodeView/BKTouchIDManager.h
+++ /dev/null
@@ -1,27 +0,0 @@
-//
-// BKTouchIDManager.h
-// BKPasscodeViewDemo
-//
-// Created by Byungkook Jang on 2014. 10. 12..
-// Copyright (c) 2014년 Byungkook Jang. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-@interface BKTouchIDManager : NSObject
-
-@property (nonatomic, strong, readonly) NSString *keychainServiceName;
-@property (nonatomic, strong) NSString *promptText;
-@property (nonatomic, readonly, getter=isTouchIDEnabled) BOOL touchIDEnabled;
-
-+ (BOOL)canUseTouchID;
-
-- (instancetype)initWithKeychainServiceName:(NSString *)serviceName;
-
-- (void)savePasscode:(NSString *)passcode completionBlock:(void(^)(BOOL success))completionBlock;
-
-- (void)loadPasscodeWithCompletionBlock:(void(^)(NSString *passcode))completionBlock;
-
-- (void)deletePasscodeWithCompletionBlock:(void(^)(BOOL success))completionBlock;
-
-@end
diff --git a/Libraries external/BKPasscodeView/BKTouchIDManager.m b/Libraries external/BKPasscodeView/BKTouchIDManager.m
deleted file mode 100755
index fb3753f87..000000000
--- a/Libraries external/BKPasscodeView/BKTouchIDManager.m
+++ /dev/null
@@ -1,236 +0,0 @@
-//
-// BKTouchIDManager.m
-// BKPasscodeViewDemo
-//
-// Created by Byungkook Jang on 2014. 10. 12..
-// Copyright (c) 2014년 Byungkook Jang. All rights reserved.
-//
-
-#import "BKTouchIDManager.h"
-#import <LocalAuthentication/LocalAuthentication.h>
-
-static NSString *const BKTouchIDManagerPasscodeAccountName = @"passcode";
-static NSString *const BKTouchIDManagerTouchIDEnabledAccountName = @"enabled";
-
-@interface BKTouchIDManager () {
- dispatch_queue_t _queue;
-}
-
-@property (nonatomic, strong) NSString *keychainServiceName;
-
-@end
-
-@implementation BKTouchIDManager
-
-- (instancetype)initWithKeychainServiceName:(NSString *)serviceName
-{
- self = [super init];
- if (self) {
-
- _queue = dispatch_queue_create("BKTouchIDManagerQueue", DISPATCH_QUEUE_SERIAL);
-
- NSParameterAssert(serviceName);
-
- self.keychainServiceName = serviceName;
- }
- return self;
-}
-
-+ (BOOL)canUseTouchID
-{
- if (![LAContext class]) {
- return NO;
- }
-
- LAContext *context = [[LAContext alloc] init];
-
- NSError *error = nil;
- BOOL result = [context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error];
-
- return result;
-}
-
-- (void)savePasscode:(NSString *)passcode completionBlock:(void(^)(BOOL success))completionBlock
-{
- NSParameterAssert(passcode);
-
- if (NO == [[self class] canUseTouchID]) {
- if (completionBlock) {
- completionBlock(NO);
- }
- return;
- }
-
- NSString *serviceName = self.keychainServiceName;
- NSData *passcodeData = [passcode dataUsingEncoding:NSUTF8StringEncoding];
-
- dispatch_async(_queue, ^{
-
- BOOL success = [[self class] saveKeychainItemWithServiceName:serviceName
- accountName:BKTouchIDManagerPasscodeAccountName
- data:passcodeData
- sacFlags:kSecAccessControlUserPresence];
-
- if (success) {
-
- BOOL enabled = YES;
-
- success = [[self class] saveKeychainItemWithServiceName:serviceName
- accountName:BKTouchIDManagerTouchIDEnabledAccountName
- data:[NSData dataWithBytes:&enabled length:sizeof(BOOL)]
- sacFlags:0];
- }
-
- if (completionBlock) {
- dispatch_async(dispatch_get_main_queue(), ^{
- completionBlock(success);
- });
- }
- });
-}
-
-- (void)loadPasscodeWithCompletionBlock:(void (^)(NSString *))completionBlock
-{
- if (NO == [[self class] canUseTouchID]) {
- if (completionBlock) {
- completionBlock(nil);
- }
- return;
- }
-
- NSMutableDictionary *query = [NSMutableDictionary dictionaryWithDictionary:@{ (__bridge id)kSecClass: (__bridge id)kSecClassGenericPassword,
- (__bridge id)kSecAttrService: self.keychainServiceName,
- (__bridge id)kSecAttrAccount: BKTouchIDManagerPasscodeAccountName,
- (__bridge id)kSecReturnData: @YES }];
-
- if (self.promptText) {
- query[(__bridge id)kSecUseOperationPrompt] = self.promptText;
- }
-
- dispatch_async(_queue, ^{
-
- CFTypeRef dataTypeRef = NULL;
-
- OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)(query), &dataTypeRef);
-
- NSString *result = nil;
-
- if (status == errSecSuccess) {
-
- NSData *resultData = ( __bridge_transfer NSData *)dataTypeRef;
- result = [[NSString alloc] initWithData:resultData encoding:NSUTF8StringEncoding];
- }
-
- if (completionBlock) {
- dispatch_async(dispatch_get_main_queue(), ^{
- completionBlock(result);
- });
- }
- });
-}
-
-- (void)deletePasscodeWithCompletionBlock:(void (^)(BOOL))completionBlock
-{
- dispatch_async(_queue, ^{
-
- BOOL success = ([[self class] deleteKeychainItemWithServiceName:self.keychainServiceName accountName:BKTouchIDManagerPasscodeAccountName] &&
- [[self class] deleteKeychainItemWithServiceName:self.keychainServiceName accountName:BKTouchIDManagerTouchIDEnabledAccountName]);
-
- if (completionBlock) {
- dispatch_async(dispatch_get_main_queue(), ^{
- completionBlock(success);
- });
- }
- });
-}
-
-- (BOOL)isTouchIDEnabled
-{
- NSDictionary *query = @{ (__bridge id)kSecClass: (__bridge id)kSecClassGenericPassword,
- (__bridge id)kSecAttrService: self.keychainServiceName,
- (__bridge id)kSecAttrAccount: BKTouchIDManagerTouchIDEnabledAccountName,
- (__bridge id)kSecReturnData: @YES };
-
- CFTypeRef dataTypeRef = NULL;
-
- OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)(query), &dataTypeRef);
-
- if (status == errSecSuccess) {
-
- NSData *resultData = ( __bridge_transfer NSData *)dataTypeRef;
- BOOL result;
- [resultData getBytes:&result length:sizeof(BOOL)];
-
- return result;
-
- } else {
- return NO;
- }
-}
-
-#pragma mark - Static Methods
-
-+ (BOOL)saveKeychainItemWithServiceName:(NSString *)serviceName accountName:(NSString *)accountName data:(NSData *)data sacFlags:(SecAccessControlCreateFlags)sacFlags
-{
- // try to update first
- BOOL success = [self updateKeychainItemWithServiceName:serviceName accountName:accountName data:data];
-
- if (success) {
- return YES;
- }
-
- // try deleting when update failed (workaround for iOS 8 bug)
- [self deleteKeychainItemWithServiceName:serviceName accountName:accountName];
-
- // try add
- return [self addKeychainItemWithServiceName:serviceName accountName:accountName data:data sacFlags:sacFlags];
-}
-
-+ (BOOL)addKeychainItemWithServiceName:(NSString *)serviceName accountName:(NSString *)accountName data:(NSData *)data sacFlags:(SecAccessControlCreateFlags)sacFlags
-{
- CFErrorRef error = NULL;
- SecAccessControlRef sacObject = SecAccessControlCreateWithFlags(kCFAllocatorDefault,
- kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly,
- sacFlags, &error);
-
- if (sacObject == NULL || error != NULL) {
- return NO;
- }
-
- NSDictionary *attributes = @{ (__bridge id)kSecClass: (__bridge id)kSecClassGenericPassword,
- (__bridge id)kSecAttrService: serviceName,
- (__bridge id)kSecAttrAccount: accountName,
- (__bridge id)kSecValueData: data,
- (__bridge id)kSecUseAuthenticationUI: @YES,
- (__bridge id)kSecAttrAccessControl: (__bridge_transfer id)sacObject };
-
- OSStatus status = SecItemAdd((__bridge CFDictionaryRef)attributes, nil);
-
- return (status == errSecSuccess);
-}
-
-+ (BOOL)updateKeychainItemWithServiceName:(NSString *)serviceName accountName:(NSString *)accountName data:(NSData *)data
-{
- NSDictionary *query = @{ (__bridge id)kSecClass: (__bridge id)kSecClassGenericPassword,
- (__bridge id)kSecAttrService: serviceName,
- (__bridge id)kSecAttrAccount: accountName };
-
- NSDictionary *changes = @{ (__bridge id)kSecValueData: data };
-
- OSStatus status = SecItemUpdate((__bridge CFDictionaryRef)query, (__bridge CFDictionaryRef)changes);
-
- return (status == errSecSuccess);
-}
-
-+ (BOOL)deleteKeychainItemWithServiceName:(NSString *)serviceName accountName:(NSString *)accountName
-{
- NSDictionary *query = @{ (__bridge id)kSecClass: (__bridge id)kSecClassGenericPassword,
- (__bridge id)kSecAttrService: serviceName,
- (__bridge id)kSecAttrAccount: accountName };
-
- OSStatus status = SecItemDelete((__bridge CFDictionaryRef)(query));
-
- return (status == errSecSuccess || status == errSecItemNotFound);
-}
-
-@end
diff --git a/Libraries external/BKPasscodeView/BKTouchIDSwitchView.h b/Libraries external/BKPasscodeView/BKTouchIDSwitchView.h
deleted file mode 100755
index 9b9716a2b..000000000
--- a/Libraries external/BKPasscodeView/BKTouchIDSwitchView.h
+++ /dev/null
@@ -1,31 +0,0 @@
-//
-// BKTouchIDSwitchView.h
-// BKPasscodeViewDemo
-//
-// Created by Byungkook Jang on 2014. 10. 11..
-// Copyright (c) 2014년 Byungkook Jang. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-@protocol BKTouchIDSwitchViewDelegate;
-
-
-@interface BKTouchIDSwitchView : UIView
-
-@property (nonatomic, weak) id<BKTouchIDSwitchViewDelegate> delegate;
-
-@property (nonatomic, strong) UIView *switchBackgroundView;
-@property (nonatomic, strong) UILabel *messageLabel;
-@property (nonatomic, strong) UILabel *titleLabel;
-@property (nonatomic, strong) UISwitch *touchIDSwitch;
-@property (nonatomic, strong) UIButton *doneButton;
-
-@end
-
-
-@protocol BKTouchIDSwitchViewDelegate <NSObject>
-
-- (void)touchIDSwitchViewDidPressDoneButton:(BKTouchIDSwitchView *)view;
-
-@end \ No newline at end of file
diff --git a/Libraries external/BKPasscodeView/BKTouchIDSwitchView.m b/Libraries external/BKPasscodeView/BKTouchIDSwitchView.m
deleted file mode 100755
index 00eb5fc0f..000000000
--- a/Libraries external/BKPasscodeView/BKTouchIDSwitchView.m
+++ /dev/null
@@ -1,125 +0,0 @@
-//
-// BKTouchIDSwitchView.m
-// BKPasscodeViewDemo
-//
-// Created by Byungkook Jang on 2014. 10. 11..
-// Copyright (c) 2014년 Byungkook Jang. All rights reserved.
-//
-
-#import "BKTouchIDSwitchView.h"
-
-@implementation BKTouchIDSwitchView
-
-- (instancetype)initWithFrame:(CGRect)frame
-{
- self = [super initWithFrame:frame];
- if (self) {
- [self _initialize];
- }
- return self;
-}
-
-- (id)initWithCoder:(NSCoder *)aDecoder
-{
- self = [super initWithCoder:aDecoder];
- if (self) {
- [self _initialize];
- }
- return self;
-}
-
-- (void)_initialize
-{
- self.switchBackgroundView = [[UIView alloc] init];
- self.switchBackgroundView.backgroundColor = [UIColor whiteColor];
- self.switchBackgroundView.layer.borderColor = [UIColor lightGrayColor].CGColor;
- self.switchBackgroundView.layer.borderWidth = .5f;
- [self addSubview:self.switchBackgroundView];
-
- self.messageLabel = [[UILabel alloc] init];
- self.messageLabel.numberOfLines = 0;
- self.messageLabel.lineBreakMode = NSLineBreakByWordWrapping;
- self.messageLabel.textAlignment = NSTextAlignmentCenter;
- self.messageLabel.text = NSLocalizedString(@"Do you want to use Touch ID for authentication?", nil);
- self.messageLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline];
- [self addSubview:self.messageLabel];
-
- self.titleLabel = [[UILabel alloc] init];
- self.titleLabel.text = NSLocalizedString(@"Enable Touch ID", nil);
- self.titleLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
- [self addSubview:self.titleLabel];
-
- self.touchIDSwitch = [[UISwitch alloc] init];
- [self addSubview:self.touchIDSwitch];
-
- self.doneButton = [UIButton buttonWithType:UIButtonTypeSystem];
- [self.doneButton.titleLabel setFont:[UIFont systemFontOfSize:20.f]];
- [self.doneButton setTitle:NSLocalizedString(@"Done", nil) forState:UIControlStateNormal];
- [self.doneButton addTarget:self action:@selector(doneButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
- [self addSubview:self.doneButton];
-}
-
-- (void)layoutSubviews
-{
- [super layoutSubviews];
-
- UIEdgeInsets contentInset = UIEdgeInsetsMake(20, 20, 20, 20);
- static CGFloat verticalSpaces[] = { 40, 30 };
-
- CGRect contentBounds = UIEdgeInsetsInsetRect(self.bounds, contentInset);
-
- self.messageLabel.frame = CGRectMake(0, 0, CGRectGetWidth(contentBounds), 0);
- [self.messageLabel sizeToFit];
-
- [self.titleLabel sizeToFit];
-
- [self.doneButton sizeToFit];
-
- CGFloat contentHeight = (CGRectGetHeight(self.messageLabel.frame) + verticalSpaces[0] +
- CGRectGetHeight(self.touchIDSwitch.frame) + verticalSpaces[1] +
- CGRectGetHeight(self.doneButton.frame));
-
- CGFloat offsetY = floorf((CGRectGetHeight(self.frame) - contentHeight) * 0.5f);
-
- CGRect rect;
-
- rect = self.messageLabel.frame;
- rect.origin = CGPointMake(contentInset.left, offsetY);
- rect.size.width = CGRectGetWidth(contentBounds);
- self.messageLabel.frame = rect;
-
- offsetY += CGRectGetHeight(rect) + verticalSpaces[0];
-
- rect = self.touchIDSwitch.frame;
- rect.origin = CGPointMake(CGRectGetMaxX(contentBounds) - CGRectGetWidth(self.touchIDSwitch.frame), offsetY);
- self.touchIDSwitch.frame = rect;
-
- rect = self.titleLabel.frame;
- rect.origin = CGPointMake(contentInset.left, offsetY);
- rect.size.height = CGRectGetHeight(self.touchIDSwitch.frame);
- self.titleLabel.frame = rect;
-
- offsetY += CGRectGetHeight(rect) + verticalSpaces[1];
-
- rect = self.doneButton.frame;
- rect.size.width += 10;
- rect.size.height += 10;
- rect.origin.x = floorf((CGRectGetWidth(self.frame) - CGRectGetWidth(rect)) * 0.5f);
- rect.origin.y = offsetY;
- self.doneButton.frame = rect;
-
- self.switchBackgroundView.frame = CGRectMake(-1,
- CGRectGetMinY(self.touchIDSwitch.frame) - 12,
- CGRectGetWidth(self.frame) + 2,
- CGRectGetHeight(self.touchIDSwitch.frame) + 24);
-
-}
-
-- (void)doneButtonPressed:(id)sender
-{
- if ([self.delegate respondsToSelector:@selector(touchIDSwitchViewDidPressDoneButton:)]) {
- [self.delegate touchIDSwitchViewDidPressDoneButton:self];
- }
-}
-
-@end