Nenhuma descrição

FIRInstanceIDCheckinService.h 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 <FirebaseInstanceID/FIRInstanceID+Private.h>
  18. #import "FIRInstanceIDUtilities.h"
  19. NS_ASSUME_NONNULL_BEGIN
  20. // keys in Checkin preferences
  21. FOUNDATION_EXPORT NSString *const kFIRInstanceIDDeviceAuthIdKey;
  22. FOUNDATION_EXPORT NSString *const kFIRInstanceIDSecretTokenKey;
  23. FOUNDATION_EXPORT NSString *const kFIRInstanceIDDigestStringKey;
  24. FOUNDATION_EXPORT NSString *const kFIRInstanceIDLastCheckinTimeKey;
  25. FOUNDATION_EXPORT NSString *const kFIRInstanceIDVersionInfoStringKey;
  26. FOUNDATION_EXPORT NSString *const kFIRInstanceIDGServicesDictionaryKey;
  27. FOUNDATION_EXPORT NSString *const kFIRInstanceIDDeviceDataVersionKey;
  28. @class FIRInstanceIDCheckinPreferences;
  29. /**
  30. * Register the device with Checkin Service and get back the `authID`, `secret
  31. * token` etc. for the client. Checkin results are cached in the
  32. * `FIRInstanceIDCache` and periodically refreshed to prevent them from being stale.
  33. * Each client needs to register with checkin before registering with InstanceID.
  34. */
  35. @interface FIRInstanceIDCheckinService : NSObject
  36. /**
  37. * Execute a device checkin request to obtain an deviceID, secret token,
  38. * gService data.
  39. *
  40. * @param existingCheckin An existing checkin preference object, if available.
  41. * @param completion Completion hander called on success or failure of device checkin.
  42. */
  43. - (void)checkinWithExistingCheckin:(nullable FIRInstanceIDCheckinPreferences *)existingCheckin
  44. completion:(FIRInstanceIDDeviceCheckinCompletion)completion;
  45. /**
  46. * This would stop any request that the service made to the checkin backend and also
  47. * release any callback handlers that it holds.
  48. */
  49. - (void)stopFetching;
  50. /**
  51. * Set test block for mock testing network requests.
  52. *
  53. * @param block The block to invoke as a mock response from the network.
  54. */
  55. + (void)setCheckinTestBlock:(nullable FIRInstanceIDURLRequestTestBlock)block;
  56. @end
  57. NS_ASSUME_NONNULL_END