BTUIKViewUtil.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #import <UIKit/UIKit.h>
  2. #import "BTUIKCardType.h"
  3. #import "BTUIKPaymentOptionType.h"
  4. #import "BTUIKVisualAssetType.h"
  5. @class BTUIKVectorArtView;
  6. /// Size for vector art
  7. typedef NS_ENUM(NSInteger, BTUIKVectorArtSize) {
  8. /// Small
  9. BTUIKVectorArtSizeRegular,
  10. /// Large
  11. BTUIKVectorArtSizeLarge,
  12. };
  13. /// @class Utilities used by other views to get localized strings, a BTUIKPaymentOptionType or artwork
  14. @interface BTUIKViewUtil : NSObject
  15. #pragma mark BTUIKPaymentOptionType Utilities
  16. /// Get a BTUIKPaymentOptionType from a string
  17. ///
  18. /// @param typeString string representing a payment option type (e.g `Visa` or `PayPal`)
  19. /// @return The BTUIKPaymentOptionType associated with the string if it can be found. Otherwise, BTUIKPaymentOptionTypeUnknown.
  20. + (BTUIKPaymentOptionType)paymentOptionTypeForPaymentInfoType:(NSString *)typeString;
  21. /// Get a BTUIKPaymentOptionType from a BTUIKCardType
  22. ///
  23. /// @param cardType A BTUIKCardType that represents a card
  24. /// @return The BTUIKPaymentOptionType associated with the BTUIKCardType if it can be found. Otherwise, BTUIKPaymentOptionTypeUnknown.
  25. + (BTUIKPaymentOptionType)paymentMethodTypeForCardType:(BTUIKCardType *)cardType;
  26. /// Determine if the payment option is a credit card type.
  27. ///
  28. /// @param paymentOptionType A BTUIKPaymentOptionType
  29. /// @return true if the payment option is a credit card type, false otherwise
  30. + (BOOL)isPaymentOptionTypeACreditCard:(BTUIKPaymentOptionType)paymentOptionType;
  31. /// Get a localized string for a payment option.
  32. ///
  33. /// @param paymentMethodType BTUIKPaymentOptionType
  34. /// @return The localized string for the BTUIKPaymentOptionType if one can be found. `Card` will be returned in the case of BTUIKPaymentOptionTypeUnknown.
  35. + (NSString *)nameForPaymentMethodType:(BTUIKPaymentOptionType)paymentMethodType;
  36. #pragma mark Helper Utilities
  37. /// Cause the device to vibrate
  38. + (void)vibrate;
  39. #pragma mark Art Utilities
  40. /// Get a BTUIKVectorArtView from a string
  41. ///
  42. /// @param typeString string representing a payment option type (e.g `Visa` or `PayPal`)
  43. /// @return The BTUIKVectorArtView for the string if one can be found. Otherwise the art for a generic card.
  44. + (BTUIKVectorArtView *)vectorArtViewForPaymentInfoType:(NSString *)typeString;
  45. /// Get a BTUIKVectorArtView for a payment option of BTUIKVectorArtIconSizeRegular.
  46. ///
  47. /// @param type BTUIKPaymentOptionType
  48. /// @return The BTUIKVectorArtView for the BTUIKPaymentOptionType if one can be found. Otherwise the art for a generic card.
  49. + (BTUIKVectorArtView *)vectorArtViewForPaymentOptionType:(BTUIKPaymentOptionType)type;
  50. /// Get a BTUIKVectorArtView for a payment option.
  51. ///
  52. /// @param type BTUIKPaymentOptionType
  53. /// @param size The BTUIKVectorArtSize (Regular or Large)
  54. /// @return The BTUIKVectorArtView for the BTUIKPaymentOptionType if one can be found. Otherwise the art for a generic card.
  55. + (BTUIKVectorArtView *)vectorArtViewForPaymentOptionType:(BTUIKPaymentOptionType)type size:(BTUIKVectorArtSize)size;
  56. /*!
  57. @brief Get a BTUIKVectorArtView for a visual asset.
  58. @param type A BTUIKVisualAssetType
  59. @return The BTUIKVectorArtView for the BTUIKVisualAssetType if one can be found. Otherwise an empty BTUIKVectorArtView.
  60. */
  61. + (BTUIKVectorArtView *)vectorArtViewForVisualAssetType:(BTUIKVisualAssetType)type;
  62. #pragma mark Right to Left Utilities
  63. /// @return true if the language is right to left
  64. + (BOOL)isLanguageLayoutDirectionRightToLeft;
  65. /// @return NSTextAlignmentRight if isLanguageLayoutDirectionRightToLeft is true. Ohterwise NSTextAlignmentLeft.
  66. + (NSTextAlignment)naturalTextAlignment;
  67. /// @return NSTextAlignmentLeft if isLanguageLayoutDirectionRightToLeft is true. Ohterwise NSTextAlignmentRight.
  68. + (NSTextAlignment)naturalTextAlignmentInverse;
  69. #pragma mark Orientation Utilities
  70. /// @return true if the device is in landscape
  71. + (BOOL)isOrientationLandscape;
  72. /// @return height of the status bar
  73. + (CGFloat)statusBarHeight;
  74. @end