RCNUserDefaultsManager.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 successful fetch.
  22. @property(nonatomic, assign) NSTimeInterval lastFetchTime;
  23. /// The time of the last successful fetch.
  24. @property(nonatomic, assign) NSString *lastFetchStatus;
  25. /// Boolean indicating if the last (one or more) fetch(es) was/were unsuccessful, in which case we
  26. /// are in an exponential backoff mode.
  27. @property(nonatomic, assign) BOOL isClientThrottledWithExponentialBackoff;
  28. /// Time when the next request can be made while being throttled.
  29. @property(nonatomic, assign) NSTimeInterval throttleEndTime;
  30. /// The retry interval increases exponentially for cumulative fetch failures. Refer to
  31. /// go/rc-client-throttling for details.
  32. @property(nonatomic, assign) NSTimeInterval currentThrottlingRetryIntervalSeconds;
  33. /// Designated initializer.
  34. - (instancetype)initWithAppName:(NSString *)appName
  35. bundleID:(NSString *)bundleIdentifier
  36. namespace:(NSString *)firebaseNamespace NS_DESIGNATED_INITIALIZER;
  37. // NOLINTBEGIN
  38. /// Use `initWithAppName:bundleID:namespace:` instead.
  39. - (instancetype)init
  40. __attribute__((unavailable("Use `initWithAppName:bundleID:namespace:` instead.")));
  41. // NOLINTEND
  42. @end
  43. NS_ASSUME_NONNULL_END