RCNUserDefaultsManager.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. @interface RCNUserDefaultsManager : NSObject
  19. /// The last eTag received from the backend.
  20. @property(nonatomic, assign) NSString *lastETag;
  21. /// The time of the last eTag update.
  22. @property(nonatomic, assign) NSTimeInterval lastETagUpdateTime;
  23. /// The time of the last successful fetch.
  24. @property(nonatomic, assign) NSTimeInterval lastFetchTime;
  25. /// The time of the last successful fetch.
  26. @property(nonatomic, assign) NSString *lastFetchStatus;
  27. /// Boolean indicating if the last (one or more) fetch(es) was/were unsuccessful, in which case we
  28. /// are in an exponential backoff mode.
  29. @property(nonatomic, assign) BOOL isClientThrottledWithExponentialBackoff;
  30. /// Time when the next request can be made while being throttled.
  31. @property(nonatomic, assign) NSTimeInterval throttleEndTime;
  32. /// The retry interval increases exponentially for cumulative fetch failures. Refer to
  33. /// go/rc-client-throttling for details.
  34. @property(nonatomic, assign) NSTimeInterval currentThrottlingRetryIntervalSeconds;
  35. // Last fetched template version.
  36. @property(nonatomic, assign) NSString *lastTemplateVersion;
  37. /// Designated initializer.
  38. - (instancetype)initWithAppName:(NSString *)appName
  39. bundleID:(NSString *)bundleIdentifier
  40. namespace:(NSString *)firebaseNamespace NS_DESIGNATED_INITIALIZER;
  41. // NOLINTBEGIN
  42. /// Use `initWithAppName:bundleID:namespace:` instead.
  43. - (instancetype)init
  44. __attribute__((unavailable("Use `initWithAppName:bundleID:namespace:` instead.")));
  45. // NOLINTEND
  46. /// Delete all saved userdefaults for this instance.
  47. - (void)resetUserDefaults;
  48. @end
  49. NS_ASSUME_NONNULL_END