FIRRemoteConfigComponent.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 "FirebaseCore/Extension/FirebaseCoreInternal.h"
  18. @import FirebaseRemoteConfigInterop;
  19. @class FIRApp;
  20. @class FIRRemoteConfig;
  21. NS_ASSUME_NONNULL_BEGIN
  22. /// Provides and creates instances of Remote Config based on the namespace provided. Used in the
  23. /// interop registration process to keep track of RC instances for each `FIRApp` instance.
  24. @protocol FIRRemoteConfigProvider
  25. /// Cached instances of Remote Config objects.
  26. @property(nonatomic, strong) NSMutableDictionary<NSString *, FIRRemoteConfig *> *instances;
  27. /// Default method for retrieving a Remote Config instance, or creating one if it doesn't exist.
  28. - (FIRRemoteConfig *)remoteConfigForNamespace:(NSString *)remoteConfigNamespace;
  29. @end
  30. /// A concrete implementation for FIRRemoteConfigInterop to create Remote Config instances and
  31. /// register with Core's component system.
  32. @interface FIRRemoteConfigComponent
  33. : NSObject <FIRRemoteConfigProvider, FIRLibrary, FIRRemoteConfigInterop>
  34. /// The FIRApp that instances will be set up with.
  35. @property(nonatomic, weak, readonly) FIRApp *app;
  36. /// Cached instances of Remote Config objects.
  37. @property(nonatomic, strong) NSMutableDictionary<NSString *, FIRRemoteConfig *> *instances;
  38. /// Clear all the component instances from the singleton which created previously, this is for
  39. /// testing only
  40. + (void)clearAllComponentInstances;
  41. /// Default method for retrieving a Remote Config instance, or creating one if it doesn't exist.
  42. - (FIRRemoteConfig *)remoteConfigForNamespace:(NSString *)remoteConfigNamespace;
  43. /// Default initializer.
  44. - (instancetype)initWithApp:(FIRApp *)app NS_DESIGNATED_INITIALIZER;
  45. - (instancetype)init __attribute__((unavailable("Use `initWithApp:`.")));
  46. @end
  47. NS_ASSUME_NONNULL_END