No Description

FIRInstanceIDAPNSInfo.h 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright 2019 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. NS_ASSUME_NONNULL_BEGIN
  18. /**
  19. * Represents an APNS device token and whether its environment is for sandbox.
  20. * It can read from and write to an NSDictionary for simple serialization.
  21. */
  22. @interface FIRInstanceIDAPNSInfo : NSObject <NSCoding>
  23. /// The APNs device token, provided by the OS to the application delegate
  24. @property(nonatomic, readonly, strong) NSData *deviceToken;
  25. /// Represents whether or not this is deviceToken is for the sandbox
  26. /// environment, or production.
  27. @property(nonatomic, readonly, getter=isSandbox) BOOL sandbox;
  28. /**
  29. * Initializes the receiver with an APNs device token, and boolean
  30. * representing whether that token is for the sandbox environment.
  31. *
  32. * @param deviceToken The APNs device token typically provided by the
  33. * operating system.
  34. * @param isSandbox YES if the APNs device token is for the sandbox
  35. * environment, or NO if it is for production.
  36. * @return An instance of FIRInstanceIDAPNSInfo.
  37. */
  38. - (instancetype)initWithDeviceToken:(NSData *)deviceToken isSandbox:(BOOL)isSandbox;
  39. /**
  40. * Initializes the receiver from a token options dictionary containing data
  41. * within the `kFIRInstanceIDTokenOptionsAPNSKey` and
  42. * `kFIRInstanceIDTokenOptionsAPNSIsSandboxKey` keys. The token should be an
  43. * NSData blob, and the sandbox value should be an NSNumber
  44. * representing a boolean value.
  45. *
  46. * @param dictionary A dictionary containing values under the keys
  47. * `kFIRInstanceIDTokenOptionsAPNSKey` and
  48. * `kFIRInstanceIDTokenOptionsAPNSIsSandboxKey`.
  49. * @return An instance of FIRInstanceIDAPNSInfo, or nil if the
  50. * dictionary data was invalid or missing.
  51. */
  52. - (nullable instancetype)initWithTokenOptionsDictionary:(NSDictionary *)dictionary;
  53. - (BOOL)isEqualToAPNSInfo:(FIRInstanceIDAPNSInfo *)otherInfo;
  54. @end
  55. NS_ASSUME_NONNULL_END