Skip to content

Commit

Permalink
[rc-swift] ConfigContent.swift (#14175)
Browse files Browse the repository at this point in the history
Co-authored-by: Nick Cooke <[email protected]>
  • Loading branch information
paulb777 and ncooke3 authored Nov 27, 2024
1 parent 0f7fd3f commit 4c1ca6d
Show file tree
Hide file tree
Showing 14 changed files with 557 additions and 647 deletions.
5 changes: 2 additions & 3 deletions FirebaseRemoteConfig/Sources/FIRRemoteConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#import "FirebaseRemoteConfig/Sources/Private/RCNConfigFetch.h"
#import "FirebaseRemoteConfig/Sources/Private/RCNConfigSettings.h"
#import "FirebaseRemoteConfig/Sources/RCNConfigConstants.h"
#import "FirebaseRemoteConfig/Sources/RCNConfigContent.h"
#import "FirebaseRemoteConfig/Sources/RCNConfigExperiment.h"
#import "FirebaseRemoteConfig/Sources/RCNConfigRealtime.h"
#import "FirebaseRemoteConfig/Sources/RCNConfigValue_Internal.h"
Expand Down Expand Up @@ -343,9 +342,9 @@ - (void)activateWithCompletion:(FIRRemoteConfigActivateChangeCompletion)completi
}
return;
}
[strongSelf->_configContent copyFromDictionary:self->_configContent.fetchedConfig
[strongSelf->_configContent copyFromDictionary:strongSelf->_configContent.fetchedConfig
toSource:RCNDBSourceActive
forNamespace:self->_FIRNamespace];
forNamespace:strongSelf->_FIRNamespace];
strongSelf->_settings.lastApplyTimeInterval = [[NSDate date] timeIntervalSince1970];
// New config has been activated at this point
FIRLogDebug(kFIRLoggerRemoteConfig, @"I-RCN000069", @"Config activated.");
Expand Down
1 change: 0 additions & 1 deletion FirebaseRemoteConfig/Sources/FIRRemoteConfigComponent.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

#import "FirebaseCore/Extension/FirebaseCoreInternal.h"
#import "FirebaseRemoteConfig/Sources/Private/FIRRemoteConfig_Private.h"
#import "FirebaseRemoteConfig/Sources/RCNConfigContent.h"
#import "Interop/Analytics/Public/FIRAnalyticsInterop.h"

#import "FirebaseRemoteConfig/FirebaseRemoteConfig-Swift.h"
Expand Down
20 changes: 0 additions & 20 deletions FirebaseRemoteConfig/Sources/Private/FIRRemoteConfig_Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ NS_ASSUME_NONNULL_BEGIN
NSString *_FIRNamespace;
}

/// Internal settings
@property(nonatomic, readonly, strong) RCNConfigSettings *settings;

/// Config settings are custom settings.
@property(nonatomic, readwrite, strong, nonnull) RCNConfigFetch *configFetch;

Expand Down Expand Up @@ -64,23 +61,6 @@ NS_ASSUME_NONNULL_BEGIN
app:(FIRApp *)app
NS_SWIFT_NAME(remoteConfig(FIRNamespace:app:));

/// Initialize a FIRRemoteConfig instance with all the required parameters directly. This exists so
/// tests can create FIRRemoteConfig objects without needing FIRApp.
- (instancetype)initWithAppName:(NSString *)appName
FIROptions:(FIROptions *)options
namespace:(NSString *)FIRNamespace
DBManager:(RCNConfigDBManager *)DBManager
configContent:(RCNConfigContent *)configContent
analytics:(nullable id<FIRAnalyticsInterop>)analytics;

- (instancetype)initWithAppName:(NSString *)appName
FIROptions:(FIROptions *)options
namespace:(NSString *)FIRNamespace
DBManager:(RCNConfigDBManager *)DBManager
configContent:(RCNConfigContent *)configContent
userDefaults:(nullable NSUserDefaults *)userDefaults
analytics:(nullable id<FIRAnalyticsInterop>)analytics;

/// Register RolloutsStateSubcriber to FIRRemoteConfig instance
- (void)addRemoteConfigInteropSubscriber:(id<FIRRolloutsStateSubscriber> _Nonnull)subscriber;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@

@class FIRApp;
@class FIRRemoteConfigUpdate;
@class RCNConfigDBManager;
@class RCNConfigContent;
@class FIROptions;
@class RCNConfigSettings;
@protocol FIRAnalyticsInterop;

/// The Firebase Remote Config service default namespace, to be used if the API method does not
/// specify a different namespace. Use the default namespace if configuring from the Google Firebase
Expand Down Expand Up @@ -176,6 +181,7 @@ NS_SWIFT_NAME(RemoteConfigSettings)
@property(nonatomic, assign) NSTimeInterval fetchTimeout;
@end

NS_ASSUME_NONNULL_BEGIN
#pragma mark - FIRRemoteConfig
/// Firebase Remote Config class. The class method `remoteConfig()` can be used
/// to fetch, activate and read config results and set default config results on the default
Expand Down Expand Up @@ -350,4 +356,26 @@ typedef void (^FIRRemoteConfigUpdateCompletion)(FIRRemoteConfigUpdate *_Nullable
(FIRRemoteConfigUpdateCompletion _Nonnull)listener
NS_SWIFT_NAME(addOnConfigUpdateListener(remoteConfigUpdateCompletion:));

// TODO: Below here is temporary public for Swift port

@property(nonatomic, readonly, strong) RCNConfigSettings *settings;

/// Initialize a FIRRemoteConfig instance with all the required parameters directly. This exists so
/// tests can create FIRRemoteConfig objects without needing FIRApp.
- (instancetype)initWithAppName:(NSString *)appName
FIROptions:(FIROptions *)options
namespace:(NSString *)FIRNamespace
DBManager:(RCNConfigDBManager *)DBManager
configContent:(RCNConfigContent *)configContent
analytics:(nullable id<FIRAnalyticsInterop>)analytics;

- (instancetype)initWithAppName:(NSString *)appName
FIROptions:(FIROptions *)options
namespace:(NSString *)FIRNamespace
DBManager:(RCNConfigDBManager *)DBManager
configContent:(RCNConfigContent *)configContent
userDefaults:(nullable NSUserDefaults *)userDefaults
analytics:(nullable id<FIRAnalyticsInterop>)analytics;

@end
NS_ASSUME_NONNULL_END
71 changes: 0 additions & 71 deletions FirebaseRemoteConfig/Sources/RCNConfigContent.h

This file was deleted.

Loading

0 comments on commit 4c1ca6d

Please sign in to comment.