CCBKPasscode.m 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. //
  2. // CCBKPasscode.m
  3. // Nextcloud iOS
  4. //
  5. // Created by Marino Faggiana on 07/11/14.
  6. // Copyright (c) 2017 Marino Faggiana. All rights reserved.
  7. //
  8. // Author Marino Faggiana <marino.faggiana@nextcloud.com>
  9. //
  10. // This program is free software: you can redistribute it and/or modify
  11. // it under the terms of the GNU General Public License as published by
  12. // the Free Software Foundation, either version 3 of the License, or
  13. // (at your option) any later version.
  14. //
  15. // This program is distributed in the hope that it will be useful,
  16. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. // GNU General Public License for more details.
  19. //
  20. // You should have received a copy of the GNU General Public License
  21. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. //
  23. #import "CCBKPasscode.h"
  24. @implementation CCBKPasscode
  25. - (id)init
  26. {
  27. self =[super init];
  28. if (self) {
  29. self.numberInstance = 0;
  30. }
  31. return self;
  32. }
  33. +(id)sharedInstance
  34. {
  35. static dispatch_once_t onceToken = 0;
  36. __strong static id _sharedManager = nil;
  37. dispatch_once(&onceToken, ^{
  38. _sharedManager = [[self alloc] init];
  39. });
  40. ((CCBKPasscode*)_sharedManager).numberInstance++;
  41. return _sharedManager;
  42. }
  43. - (void) viewDidAppear:(BOOL)animated {
  44. [super viewDidAppear:animated];
  45. [super viewWillAppear:animated];
  46. }
  47. - (void)customizePasscodeInputView:(BKPasscodeInputView *)aPasscodeInputView
  48. {
  49. [super customizePasscodeInputView:aPasscodeInputView];
  50. if ([aPasscodeInputView.passcodeField isKindOfClass:[BKPasscodeField class]]) {
  51. BKPasscodeField *passcodeField = (BKPasscodeField *)aPasscodeInputView.passcodeField;
  52. passcodeField.imageSource = self;
  53. passcodeField.dotSize = CGSizeMake(32, 32);
  54. }
  55. }
  56. - (UIImage *)passcodeField:(BKPasscodeField *)aPasscodeField dotImageAtIndex:(NSInteger)aIndex filled:(BOOL)aFilled
  57. {
  58. if (aFilled) {
  59. return [UIImage imageNamed:@"bkfull"];
  60. } else {
  61. return [UIImage imageNamed:@"bkempty"];
  62. }
  63. }
  64. @end