You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
2.0 KiB

6 years ago
  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. /**
  18. * Register the device with Checkin Service and get back the `authID`, `secret token` etc. for the
  19. * client. Checkin results are cached in the `FIRMessagingDefaultsManager` and periodically refreshed to
  20. * prevent them from being stale. Each client needs to register with checkin before registering
  21. * with FIRMessaging.
  22. */
  23. @interface FIRMessagingCheckinService : NSObject
  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, assign) BOOL hasValidCheckinInfo;
  28. /**
  29. * Verify if valid checkin preferences have been loaded in memory.
  30. *
  31. * @return YES if valid checkin preferences exist in memory else NO.
  32. */
  33. - (BOOL)hasValidCheckinInfo;
  34. /**
  35. * Try to load prefetched checkin preferences from the cache. This supports the use case where
  36. * InstanceID library has already obtained a valid checkin and we should be using that.
  37. *
  38. * This should be used as a last gasp effort to retreive any cached checkin preferences before
  39. * hitting the FIRMessaging backend to retrieve new preferences.
  40. *
  41. * Note this is only required because InstanceID and FIRMessaging both require checkin preferences which
  42. * need to be synced with each other.
  43. *
  44. * @return YES if successfully loaded cached checkin preferences into memory else NO.
  45. */
  46. - (BOOL)tryToLoadPrefetchedCheckinPreferences;
  47. @end