FIRMessagingCheckinService.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. #import "FirebaseMessaging/Sources/FIRMessagingUtilities.h"
  18. NS_ASSUME_NONNULL_BEGIN
  19. // keys in Checkin preferences
  20. FOUNDATION_EXPORT NSString *const kFIRMessagingDeviceAuthIdKey;
  21. FOUNDATION_EXPORT NSString *const kFIRMessagingSecretTokenKey;
  22. FOUNDATION_EXPORT NSString *const kFIRMessagingDigestStringKey;
  23. FOUNDATION_EXPORT NSString *const kFIRMessagingLastCheckinTimeKey;
  24. FOUNDATION_EXPORT NSString *const kFIRMessagingVersionInfoStringKey;
  25. FOUNDATION_EXPORT NSString *const kFIRMessagingGServicesDictionaryKey;
  26. FOUNDATION_EXPORT NSString *const kFIRMessagingDeviceDataVersionKey;
  27. @class FIRMessagingCheckinPreferences;
  28. /**
  29. * Register the device with Checkin Service and get back the `authID`, `secret
  30. * token` etc. for the client. Checkin results are cached in the
  31. * `FIRMessagingCache` and periodically refreshed to prevent them from being stale.
  32. * Each client needs to register with checkin before registering with InstanceID.
  33. */
  34. @interface FIRMessagingCheckinService : NSObject
  35. /**
  36. * Execute a device checkin request to obtain an deviceID, secret token,
  37. * gService data.
  38. *
  39. * @param existingCheckin An existing checkin preference object, if available.
  40. * @param completion Completion hander called on success or failure of device checkin.
  41. */
  42. - (void)checkinWithExistingCheckin:(nullable FIRMessagingCheckinPreferences *)existingCheckin
  43. completion:
  44. (void (^)(FIRMessagingCheckinPreferences *_Nullable checkinPreferences,
  45. NSError *_Nullable error))completion;
  46. /**
  47. * This would stop any request that the service made to the checkin backend and also
  48. * release any callback handlers that it holds.
  49. */
  50. - (void)stopFetching;
  51. @end
  52. NS_ASSUME_NONNULL_END