RNPermissionsManager.h 928B

12345678910111213141516171819202122232425262728293031323334353637
  1. #import <React/RCTBridgeModule.h>
  2. typedef enum {
  3. RNPermissionStatusNotAvailable = 0,
  4. RNPermissionStatusNotDetermined = 1,
  5. RNPermissionStatusRestricted = 2,
  6. RNPermissionStatusDenied = 3,
  7. RNPermissionStatusAuthorized = 4,
  8. } RNPermissionStatus;
  9. @protocol RNPermissionHandler <NSObject>
  10. @optional
  11. + (NSArray<NSString *> *)usageDescriptionKeys;
  12. @required
  13. - (void)checkWithResolver:(void (^)(RNPermissionStatus status))resolve
  14. withRejecter:(void (^)(NSError *error))reject;
  15. - (void)requestWithOptions:(NSDictionary * _Nullable)options
  16. withResolver:(void (^)(RNPermissionStatus status))resolve
  17. withRejecter:(void (^)(NSError *error))reject;
  18. @end
  19. @interface RNPermissionsManager : NSObject <RCTBridgeModule>
  20. + (bool)hasBackgroundModeEnabled:(NSString *)mode;
  21. + (void)logErrorMessage:(NSString *)message;
  22. + (bool)hasBeenRequestedOnce:(id<RNPermissionHandler>)handler;
  23. @end