Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rc-swift] ConfigRealtime #14299

Merged
merged 6 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions FirebaseRemoteConfig/Sources/FIRRemoteConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#import "FirebaseCore/Extension/FirebaseCoreInternal.h"
#import "FirebaseRemoteConfig/Sources/Private/FIRRemoteConfig_Private.h"
#import "FirebaseRemoteConfig/Sources/RCNConfigConstants.h"
#import "FirebaseRemoteConfig/Sources/RCNConfigRealtime.h"

#import "FirebaseRemoteConfig/FirebaseRemoteConfig-Swift.h"

Expand Down Expand Up @@ -136,7 +135,8 @@
configContent:(RCNConfigContent *)configContent
userDefaults:(nullable NSUserDefaults *)userDefaults
analytics:(nullable id<FIRAnalyticsInterop>)analytics
configFetch:(nullable RCNConfigFetch *)configFetch {
configFetch:(nullable RCNConfigFetch *)configFetch
configRealtime:(nullable RCNConfigRealtime *)configRealtime {
self = [super init];
if (self) {
_appName = appName;
Expand Down Expand Up @@ -166,24 +166,28 @@
_configFetch = [[RCNConfigFetch alloc] initWithContent:_configContent
DBManager:_DBManager
settings:_settings
analytics:analytics

Check warning on line 169 in FirebaseRemoteConfig/Sources/FIRRemoteConfig.m

View workflow job for this annotation

GitHub Actions / remoteconfig (iOS)

sending 'id<FIRAnalyticsInterop> _Nullable __strong' to parameter of incompatible type 'id<AnalyticsInterop> _Nullable'

Check warning on line 169 in FirebaseRemoteConfig/Sources/FIRRemoteConfig.m

View workflow job for this annotation

GitHub Actions / sample-build-test

sending 'id<FIRAnalyticsInterop> _Nullable __strong' to parameter of incompatible type 'id<AnalyticsInterop> _Nullable'
experiment:_configExperiment
queue:_queue
namespace:_FIRNamespace
options:options];
}

_configRealtime = [[RCNConfigRealtime alloc] init:_configFetch
settings:_settings
namespace:_FIRNamespace
options:options];
if (configRealtime) {
_configRealtime = configRealtime;
} else {
_configRealtime = [[RCNConfigRealtime alloc] initWithConfigFetch:_configFetch
settings:_settings
namespace:_FIRNamespace
options:options
installations:nil];
}

[_settings loadConfigFromMetadataTable];

if (analytics) {
_listeners = [[NSMutableArray alloc] init];
RCNPersonalization *personalization =
[[RCNPersonalization alloc] initWithAnalytics:analytics];

Check warning on line 190 in FirebaseRemoteConfig/Sources/FIRRemoteConfig.m

View workflow job for this annotation

GitHub Actions / remoteconfig (iOS)

sending 'id<FIRAnalyticsInterop> _Nullable __strong' to parameter of incompatible type 'id<AnalyticsInterop> _Nullable'

Check warning on line 190 in FirebaseRemoteConfig/Sources/FIRRemoteConfig.m

View workflow job for this annotation

GitHub Actions / sample-build-test

sending 'id<FIRAnalyticsInterop> _Nullable __strong' to parameter of incompatible type 'id<AnalyticsInterop> _Nullable'
[self addListener:^(NSString *key, NSDictionary *config) {
[personalization logArmActiveWithRcParameter:key config:config];
}];
Expand All @@ -205,7 +209,8 @@
configContent:configContent
userDefaults:nil
analytics:analytics
configFetch:nil];
configFetch:nil
configRealtime:nil];
}

// Initialize with default config settings.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
@class RCNConfigContent;
@class RCNConfigDBManager;
@class RCNConfigFetch;
@class RCNConfigRealtime;
@protocol FIRAnalyticsInterop;

NS_ASSUME_NONNULL_BEGIN
Expand All @@ -34,8 +33,6 @@ NS_ASSUME_NONNULL_BEGIN
/// Config settings are custom settings.
@property(nonatomic, readwrite, strong, nonnull) RCNConfigFetch *configFetch;

@property(nonatomic, readwrite, strong, nonnull) RCNConfigRealtime *configRealtime;

/// Returns the FIRRemoteConfig instance for your namespace and for the default Firebase App.
/// This singleton object contains the complete set of Remote Config parameter values available to
/// the app, including the Active Config and Default Config.. This object also caches values fetched
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
@class RCNConfigSettings;
@class FIRRemoteConfigValue;
@class RCNConfigFetch;
@class RCNConfigRealtime;
@class FIRConfigUpdateListenerRegistration;
@protocol FIRAnalyticsInterop;

@protocol FIRRolloutsStateSubscriber;
Expand All @@ -42,24 +44,6 @@ extern NSString *const _Nonnull FIRNamespaceGoogleMobilePlatform NS_SWIFT_NAME(
extern NSString *const _Nonnull FIRRemoteConfigThrottledEndTimeInSecondsKey NS_SWIFT_NAME(
RemoteConfigThrottledEndTimeInSecondsKey);

/**
* Listener registration returned by `addOnConfigUpdateListener`. Calling its method `remove` stops
* the associated listener from receiving config updates and unregisters itself.
*
* If remove is called and no other listener registrations remain, the connection to the real-time
* RC backend is closed. Subsequently calling `addOnConfigUpdateListener` will re-open the
* connection.
*/
NS_SWIFT_SENDABLE
NS_SWIFT_NAME(ConfigUpdateListenerRegistration)
@interface FIRConfigUpdateListenerRegistration : NSObject
/**
* Removes the listener associated with this `ConfigUpdateListenerRegistration`. After the
* initial call, subsequent calls have no effect.
*/
- (void)remove;
@end

/// Indicates whether updated data was successfully fetched.
typedef NS_ENUM(NSInteger, FIRRemoteConfigFetchStatus) {
/// Config has never been fetched.
Expand Down Expand Up @@ -340,6 +324,7 @@ typedef void (^FIRRemoteConfigUpdateCompletion)(FIRRemoteConfigUpdate *_Nullable

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

@property(nonatomic, readwrite, strong, nonnull) RCNConfigRealtime *configRealtime;
@property(nonatomic, readonly, strong) RCNConfigSettings *settings;

/// Initialize a FIRRemoteConfig instance with all the required parameters directly. This exists so
Expand All @@ -358,7 +343,8 @@ typedef void (^FIRRemoteConfigUpdateCompletion)(FIRRemoteConfigUpdate *_Nullable
configContent:(RCNConfigContent *)configContent
userDefaults:(nullable NSUserDefaults *)userDefaults
analytics:(nullable id<FIRAnalyticsInterop>)analytics
configFetch:(nullable RCNConfigFetch *)configFetch;
configFetch:(nullable RCNConfigFetch *)configFetch
configRealtime:(nullable RCNConfigRealtime *)configRealtime;

/// Register `FIRRolloutsStateSubscriber` to `FIRRemoteConfig` instance
- (void)addRemoteConfigInteropSubscriber:(id<FIRRolloutsStateSubscriber> _Nonnull)subscriber;
Expand Down
40 changes: 0 additions & 40 deletions FirebaseRemoteConfig/Sources/RCNConfigRealtime.h

This file was deleted.

Loading
Loading