TOPasscodeViewControllerConstants.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. //
  2. // TOPasscodeViewControllerConstants.h
  3. //
  4. // Copyright 2017 Timothy Oliver. All rights reserved.
  5. //
  6. // Permission is hereby granted, free of charge, to any person obtaining a copy
  7. // of this software and associated documentation files (the "Software"), to
  8. // deal in the Software without restriction, including without limitation the
  9. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  10. // sell copies of the Software, and to permit persons to whom the Software is
  11. // furnished to do so, subject to the following conditions:
  12. //
  13. // The above copyright notice and this permission notice shall be included in
  14. // all copies or substantial portions of the Software.
  15. //
  16. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  17. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  20. // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
  21. // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22. /* The visual style of the asscode view controller */
  23. typedef NS_ENUM(NSInteger, TOPasscodeViewStyle) {
  24. TOPasscodeViewStyleTranslucentDark,
  25. TOPasscodeViewStyleTranslucentLight,
  26. TOPasscodeViewStyleOpaqueDark,
  27. TOPasscodeViewStyleOpaqueLight
  28. };
  29. /* The visual style of the passcode settings view controller. */
  30. typedef NS_ENUM(NSInteger, TOPasscodeSettingsViewStyle) {
  31. TOPasscodeSettingsViewStyleLight,
  32. TOPasscodeSettingsViewStyleDark
  33. };
  34. /* Depending on the amount of horizontal space, the sizing of the elements */
  35. typedef NS_ENUM(NSInteger, TOPasscodeViewContentSize) {
  36. TOPasscodeViewContentSizeDefault = 414, // Default, 414 points and above (6 Plus, all remaining iPad sizes)
  37. TOPasscodeViewContentSizeMedium = 375, // Greater or equal to 375 points: iPhone 6 / iPad Pro 1/4 split mode
  38. TOPasscodeViewContentSizeSmall = 320 // Greater or equal to 320 points: iPhone SE / iPad 1/4 split mode
  39. };
  40. /* The types of passcodes that may be used. */
  41. typedef NS_ENUM(NSInteger, TOPasscodeType) {
  42. TOPasscodeTypeFourDigits, // 4 Numbers
  43. TOPasscodeTypeSixDigits, // 6 Numbers
  44. TOPasscodeTypeCustomNumeric, // Any length of numbers
  45. TOPasscodeTypeCustomAlphanumeric // Any length of characters
  46. };
  47. /* The type of biometrics this controller can handle */
  48. typedef NS_ENUM(NSInteger, TOPasscodeBiometryType) {
  49. TOPasscodeBiometryTypeTouchID,
  50. TOPasscodeBiometryTypeFaceID
  51. };
  52. static inline BOOL TOPasscodeViewStyleIsTranslucent(TOPasscodeViewStyle style) {
  53. return style <= TOPasscodeViewStyleTranslucentLight;
  54. }
  55. static inline BOOL TOPasscodeViewStyleIsDark(TOPasscodeViewStyle style) {
  56. return style < TOPasscodeViewStyleTranslucentLight || style == TOPasscodeViewStyleOpaqueDark;
  57. }
  58. static inline NSString *TOPasscodeBiometryTitleForType(TOPasscodeBiometryType type) {
  59. switch (type) {
  60. case TOPasscodeBiometryTypeFaceID: return NSLocalizedString(@"Face ID", @"");
  61. default: return NSLocalizedString(@"Touch ID", @"");
  62. }
  63. }