FIRInstanceID_Private.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 "Firebase/InstanceID/Public/FIRInstanceID.h"
  17. NS_ASSUME_NONNULL_BEGIN
  18. @class FIRInstanceIDCheckinPreferences;
  19. @class FIRInstallations;
  20. /**
  21. * Private API used by other Firebase SDKs.
  22. */
  23. @interface FIRInstanceID ()
  24. @property(nonatomic, readonly, strong) NSString *deviceAuthID;
  25. @property(nonatomic, readonly, strong) NSString *secretToken;
  26. @property(nonatomic, readonly, strong) NSString *versionInfo;
  27. @property(nonatomic, readonly, strong) FIRInstallations *installations;
  28. /**
  29. * Private initializer.
  30. */
  31. - (instancetype)initPrivately;
  32. /**
  33. * Returns a Firebase Messaging scoped token for the firebase app.
  34. *
  35. * @return Returns the stored token if the device has registered with Firebase Messaging, otherwise
  36. * returns nil.
  37. */
  38. - (nullable NSString *)token;
  39. /**
  40. * Verify if valid checkin preferences have been loaded in memory.
  41. *
  42. * @return YES if valid checkin preferences exist in memory else NO.
  43. */
  44. - (BOOL)hasValidCheckinInfo;
  45. /**
  46. * Try to load prefetched checkin preferences from the cache. This supports the use case where
  47. * InstanceID library has already obtained a valid checkin and we should be using that.
  48. *
  49. * This should be used as a last gasp effort to retreive any cached checkin preferences before
  50. * hitting the FIRMessaging backend to retrieve new preferences.
  51. *
  52. * Note this is only required because InstanceID and FIRMessaging both require checkin preferences
  53. * which need to be synced with each other.
  54. *
  55. * @return YES if successfully loaded cached checkin preferences into memory else NO.
  56. */
  57. - (BOOL)tryToLoadValidCheckinInfo;
  58. /**
  59. * Deletes the checkin info for the app.
  60. *
  61. * @param handler The completion handler to invoke once the request has completed.
  62. */
  63. - (void)deleteCheckinWithHandler:(void (^)(NSError *_Nullable error))handler;
  64. @end
  65. NS_ASSUME_NONNULL_END