FIRMessagingInstanceIDProxy.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright 2017 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. typedef void(^FIRMessagingInstanceIDProxyTokenHandler)(NSString * __nullable token,
  18. NSError * __nullable error);
  19. typedef void(^FIRMessagingInstanceIDProxyDeleteTokenHandler)(NSError * __nullable error);
  20. typedef NS_ENUM(NSInteger, FIRMessagingInstanceIDProxyAPNSTokenType) {
  21. /// Unknown token type.
  22. FIRMessagingInstanceIDProxyAPNSTokenTypeUnknown,
  23. /// Sandbox token type.
  24. FIRMessagingInstanceIDProxyAPNSTokenTypeSandbox,
  25. /// Production token type.
  26. FIRMessagingInstanceIDProxyAPNSTokenTypeProd,
  27. };
  28. /**
  29. * FIRMessaging cannot always depend on FIRInstanceID directly, due to how FIRMessaging is
  30. * packaged. To make it easier to make calls to FIRInstanceID, this proxy class, will provide
  31. * method names duplicated from FIRInstanceID, while using reflection-based called to proxy
  32. * the requests.
  33. */
  34. @interface FIRMessagingInstanceIDProxy : NSObject
  35. - (void)setAPNSToken:(nonnull NSData *)token type:(FIRMessagingInstanceIDProxyAPNSTokenType)type;
  36. #pragma mark - Tokens
  37. - (nullable NSString *)token;
  38. - (void)tokenWithAuthorizedEntity:(nonnull NSString *)authorizedEntity
  39. scope:(nonnull NSString *)scope
  40. options:(nullable NSDictionary *)options
  41. handler:(nonnull FIRMessagingInstanceIDProxyTokenHandler)handler;
  42. - (void)deleteTokenWithAuthorizedEntity:(nonnull NSString *)authorizedEntity
  43. scope:(nonnull NSString *)scope
  44. handler:
  45. (nonnull FIRMessagingInstanceIDProxyDeleteTokenHandler)handler;
  46. @end