marinofaggiana 4 ani în urmă
părinte
comite
754d12f2ed

+ 0 - 26
Libraries external/BKPasscodeView/BKPasscodeDummyViewController.h

@@ -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

+ 0 - 41
Libraries external/BKPasscodeView/BKPasscodeDummyViewController.m

@@ -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

+ 0 - 63
Libraries external/BKPasscodeView/BKPasscodeField.h

@@ -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

+ 0 - 271
Libraries external/BKPasscodeView/BKPasscodeField.m

@@ -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

+ 0 - 53
Libraries external/BKPasscodeView/BKPasscodeInputView.h

@@ -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

+ 0 - 434
Libraries external/BKPasscodeView/BKPasscodeInputView.m

@@ -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

+ 0 - 53
Libraries external/BKPasscodeView/BKPasscodeLockScreenManager.h

@@ -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

+ 0 - 120
Libraries external/BKPasscodeView/BKPasscodeLockScreenManager.m

@@ -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

+ 0 - 17
Libraries external/BKPasscodeView/BKPasscodeUtils.h

@@ -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)

+ 0 - 98
Libraries external/BKPasscodeView/BKPasscodeViewController.h

@@ -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

+ 0 - 583
Libraries external/BKPasscodeView/BKPasscodeViewController.m

@@ -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

+ 0 - 22
Libraries external/BKPasscodeView/BKShiftingView.h

@@ -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

+ 0 - 80
Libraries external/BKPasscodeView/BKShiftingView.m

@@ -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

+ 0 - 27
Libraries external/BKPasscodeView/BKTouchIDManager.h

@@ -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

+ 0 - 236
Libraries external/BKPasscodeView/BKTouchIDManager.m

@@ -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

+ 0 - 31
Libraries external/BKPasscodeView/BKTouchIDSwitchView.h

@@ -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

+ 0 - 125
Libraries external/BKPasscodeView/BKTouchIDSwitchView.m

@@ -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

+ 0 - 44
Nextcloud.xcodeproj/project.pbxproj

@@ -152,7 +152,6 @@
 		F711CD73246AC9B80009B204 /* nsEscCharsetProber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F711CD43246AC9B80009B204 /* nsEscCharsetProber.cpp */; };
 		F711CD74246AC9B80009B204 /* nsUTF8Prober.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F711CD45246AC9B80009B204 /* nsUTF8Prober.cpp */; };
 		F711CD75246AC9B80009B204 /* nsEscSM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F711CD48246AC9B80009B204 /* nsEscSM.cpp */; };
-		F711CD97246AD0970009B204 /* BKTouchIDManager.m in Sources */ = {isa = PBXBuildFile; fileRef = F711CD7E246ACF430009B204 /* BKTouchIDManager.m */; };
 		F71459B81D12E3B700CAFEEC /* CCError.m in Sources */ = {isa = PBXBuildFile; fileRef = F76C3B881C638A4C00DC4301 /* CCError.m */; };
 		F71459BA1D12E3B700CAFEEC /* NSString+TruncateToWidth.m in Sources */ = {isa = PBXBuildFile; fileRef = F73049B91CB567F000C7C320 /* NSString+TruncateToWidth.m */; };
 		F71459BC1D12E3B700CAFEEC /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = F70F05261C889184008DAB36 /* Reachability.m */; };
@@ -644,23 +643,6 @@
 		F711CD49246AC9B80009B204 /* nsLatin1Prober.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nsLatin1Prober.h; sourceTree = "<group>"; };
 		F711CD4A246AC9B80009B204 /* nsEUCTWProber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nsEUCTWProber.h; sourceTree = "<group>"; };
 		F711CD4B246AC9B80009B204 /* uchardet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = uchardet.h; sourceTree = "<group>"; };
-		F711CD77246ACF430009B204 /* BKPasscodeLockScreenManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BKPasscodeLockScreenManager.h; sourceTree = "<group>"; };
-		F711CD78246ACF430009B204 /* BKPasscodeDummyViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BKPasscodeDummyViewController.m; sourceTree = "<group>"; };
-		F711CD79246ACF430009B204 /* BKPasscodeInputView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BKPasscodeInputView.m; sourceTree = "<group>"; };
-		F711CD7A246ACF430009B204 /* BKTouchIDSwitchView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BKTouchIDSwitchView.h; sourceTree = "<group>"; };
-		F711CD7B246ACF430009B204 /* BKPasscodeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BKPasscodeViewController.h; sourceTree = "<group>"; };
-		F711CD7C246ACF430009B204 /* BKShiftingView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BKShiftingView.m; sourceTree = "<group>"; };
-		F711CD7D246ACF430009B204 /* BKPasscodeField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BKPasscodeField.m; sourceTree = "<group>"; };
-		F711CD7E246ACF430009B204 /* BKTouchIDManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BKTouchIDManager.m; sourceTree = "<group>"; };
-		F711CD7F246ACF430009B204 /* BKPasscodeInputView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BKPasscodeInputView.h; sourceTree = "<group>"; };
-		F711CD80246ACF430009B204 /* BKPasscodeDummyViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BKPasscodeDummyViewController.h; sourceTree = "<group>"; };
-		F711CD81246ACF430009B204 /* BKPasscodeLockScreenManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BKPasscodeLockScreenManager.m; sourceTree = "<group>"; };
-		F711CD82246ACF430009B204 /* BKPasscodeUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BKPasscodeUtils.h; sourceTree = "<group>"; };
-		F711CD83246ACF430009B204 /* BKShiftingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BKShiftingView.h; sourceTree = "<group>"; };
-		F711CD84246ACF430009B204 /* BKPasscodeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BKPasscodeViewController.m; sourceTree = "<group>"; };
-		F711CD85246ACF430009B204 /* BKTouchIDSwitchView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BKTouchIDSwitchView.m; sourceTree = "<group>"; };
-		F711CD86246ACF430009B204 /* BKTouchIDManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BKTouchIDManager.h; sourceTree = "<group>"; };
-		F711CD87246ACF430009B204 /* BKPasscodeField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BKPasscodeField.h; sourceTree = "<group>"; };
 		F7151A811D477A4B00E6AF45 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
 		F7169A171EE590930086BD69 /* NCShares.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NCShares.h; sourceTree = "<group>"; };
 		F7169A181EE590930086BD69 /* NCShares.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NCShares.m; sourceTree = "<group>"; };
@@ -1163,7 +1145,6 @@
 		F70F02A81C889183008DAB36 /* Libraries external */ = {
 			isa = PBXGroup;
 			children = (
-				F711CD76246ACF430009B204 /* BKPasscodeView */,
 				F711CC75246AC99E0009B204 /* OCCommunicationLib */,
 				F711CD08246AC9B70009B204 /* NCUchardet */,
 				F711CCFE246AC9B10009B204 /* DropdownMenu */,
@@ -1405,30 +1386,6 @@
 			path = LangModels;
 			sourceTree = "<group>";
 		};
-		F711CD76246ACF430009B204 /* BKPasscodeView */ = {
-			isa = PBXGroup;
-			children = (
-				F711CD77246ACF430009B204 /* BKPasscodeLockScreenManager.h */,
-				F711CD78246ACF430009B204 /* BKPasscodeDummyViewController.m */,
-				F711CD79246ACF430009B204 /* BKPasscodeInputView.m */,
-				F711CD7A246ACF430009B204 /* BKTouchIDSwitchView.h */,
-				F711CD7B246ACF430009B204 /* BKPasscodeViewController.h */,
-				F711CD7C246ACF430009B204 /* BKShiftingView.m */,
-				F711CD7D246ACF430009B204 /* BKPasscodeField.m */,
-				F711CD7E246ACF430009B204 /* BKTouchIDManager.m */,
-				F711CD7F246ACF430009B204 /* BKPasscodeInputView.h */,
-				F711CD80246ACF430009B204 /* BKPasscodeDummyViewController.h */,
-				F711CD81246ACF430009B204 /* BKPasscodeLockScreenManager.m */,
-				F711CD82246ACF430009B204 /* BKPasscodeUtils.h */,
-				F711CD83246ACF430009B204 /* BKShiftingView.h */,
-				F711CD84246ACF430009B204 /* BKPasscodeViewController.m */,
-				F711CD85246ACF430009B204 /* BKTouchIDSwitchView.m */,
-				F711CD86246ACF430009B204 /* BKTouchIDManager.h */,
-				F711CD87246ACF430009B204 /* BKPasscodeField.h */,
-			);
-			path = BKPasscodeView;
-			sourceTree = "<group>";
-		};
 		F7169A161EE590930086BD69 /* Shares */ = {
 			isa = PBXGroup;
 			children = (
@@ -2669,7 +2626,6 @@
 				37ECC83B23D0C7410082EFA2 /* NCMenuAction.swift in Sources */,
 				F75B0ABD244C4DBB00E58DCA /* NCNetworkingNotificationCenter.swift in Sources */,
 				F79018B8240962C7007C9B6D /* NCViewerImageViewController.swift in Sources */,
-				F711CD97246AD0970009B204 /* BKTouchIDManager.m in Sources */,
 				F769454022E9F077000A798A /* NCSharePaging.swift in Sources */,
 				F711CCDC246AC99E0009B204 /* OCSharedDto.m in Sources */,
 				F732BA061D76CE1500E9878B /* CCNetworking.m in Sources */,

+ 1 - 0
iOSClient/AppDelegate.h

@@ -25,6 +25,7 @@
 #import <UserNotifications/UserNotifications.h>
 #import <PushKit/PushKit.h>
 #import <AVKit/AVKit.h>
+#import <LocalAuthentication/LocalAuthentication.h>
 
 #import "Reachability.h"
 #import "CCUtility.h"