Skip to content

Commit f922738

Browse files
authored
[rc-swift] RemoteConfigValue (#14245)
1 parent 0f9af07 commit f922738

File tree

19 files changed

+112
-177
lines changed

19 files changed

+112
-177
lines changed

.github/workflows/performance.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ jobs:
5555
matrix:
5656
target: [ios, tvos]
5757
build-env:
58-
- os: macos-14
59-
xcode: Xcode_15.2
6058
- os: macos-15
6159
xcode: Xcode_16.1
6260
runs-on: ${{ matrix.build-env.os }}

FirebasePerformance/Sources/Configurations/FPRRemoteConfigFlags+Private.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,23 @@
1414

1515
#import "FirebasePerformance/Sources/Configurations/FPRRemoteConfigFlags.h"
1616

17-
#import "FirebaseRemoteConfig/Sources/Private/FIRRemoteConfig_Private.h"
17+
@import FirebaseRemoteConfig;
1818

1919
NS_ASSUME_NONNULL_BEGIN
2020

21+
@interface FIRRemoteConfig ()
22+
+ (FIRRemoteConfig *)remoteConfigWithFIRNamespace:(NSString *)remoteConfigNamespace
23+
app:(FIRApp *)app;
24+
@end
25+
26+
@interface FIRRemoteConfigValue ()
27+
@property(nonatomic, readwrite, assign) FIRRemoteConfigSource source;
28+
29+
/// Designated initializer.
30+
- (instancetype)initWithData:(nullable NSData *)data
31+
source:(FIRRemoteConfigSource)source NS_DESIGNATED_INITIALIZER;
32+
@end
33+
2134
@class GULUserDefaults;
2235

2336
static NSString *const kFPRConfigPrefix = @"com.fireperf";

FirebasePerformance/Sources/Configurations/FPRRemoteConfigFlags.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
#import "FirebaseCore/Extension/FirebaseCoreInternal.h"
2525

26+
@import FirebaseRemoteConfig;
27+
2628
#define ONE_DAY_SECONDS 24 * 60 * 60
2729

2830
static NSDate *FPRAppStartTime = nil;

FirebasePerformance/Tests/Unit/Configurations/FPRFakeRemoteConfig.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414

1515
#import <Foundation/Foundation.h>
1616

17-
#import "FirebaseRemoteConfig/Sources/Private/FIRRemoteConfig_Private.h"
18-
#import "FirebaseRemoteConfig/Sources/RCNConfigValue_Internal.h"
17+
@import FirebaseRemoteConfig;
18+
19+
@import FirebaseRemoteConfig;
1920

2021
NS_ASSUME_NONNULL_BEGIN
2122

@@ -37,6 +38,8 @@ NS_ASSUME_NONNULL_BEGIN
3738
/** @brief Different configurations values that needs to be stored and returned. */
3839
@property(nonatomic) NSMutableDictionary<NSString *, FIRRemoteConfigValue *> *configValues;
3940

41+
- (instancetype)init;
42+
4043
/**
4144
* Fake fetch call for fetching configs. Calling this method will just call the completionHandler.
4245
*

FirebasePerformance/Tests/Unit/Configurations/FPRRemoteConfigFlagsTest.m

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
#import "FirebasePerformance/Tests/Unit/Configurations/FPRFakeRemoteConfig.h"
2424

25+
@import FirebaseRemoteConfig;
26+
2527
static NSInteger const kLogSource = 462; // LogRequest_LogSource_Fireperf
2628

2729
@interface FPRRemoteConfigFlagsTest : XCTestCase
@@ -65,7 +67,7 @@ - (void)testCacheResetAfterEverySuccessfulFetch {
6567
forKey:@"fpr_vc_session_sampling_rate"];
6668

6769
// Trigger the RC config fetch
68-
remoteConfig.fetchStatus = FIRRemoteConfigFetchStatusSuccess;
70+
remoteConfig.fetchStatus = FIRRemoteConfigFetchAndActivateStatusSuccessUsingPreFetchedData;
6971
remoteConfig.lastFetchTime = nil;
7072
configFlags.appStartConfigFetchDelayInSeconds = 0.0;
7173
[configFlags update];
@@ -92,7 +94,7 @@ - (void)testCacheResetAfterEverySuccessfulFetch {
9294
forKey:@"fpr_vc_session_sampling_rate"];
9395

9496
// Retrigger the RC config fetch
95-
remoteConfig.fetchStatus = FIRRemoteConfigFetchStatusSuccess;
97+
remoteConfig.fetchStatus = FIRRemoteConfigFetchAndActivateStatusSuccessUsingPreFetchedData;
9698
remoteConfig.lastFetchTime = nil;
9799
[configFlags update];
98100

@@ -112,7 +114,7 @@ - (void)testConfigUpdate {
112114

113115
FPRRemoteConfigFlags *configFlags =
114116
[[FPRRemoteConfigFlags alloc] initWithRemoteConfig:(FIRRemoteConfig *)remoteConfig];
115-
remoteConfig.fetchStatus = FIRRemoteConfigFetchStatusSuccess;
117+
remoteConfig.fetchStatus = FIRRemoteConfigFetchAndActivateStatusSuccessUsingPreFetchedData;
116118
configFlags.appStartConfigFetchDelayInSeconds = 0.0;
117119
[configFlags update];
118120
XCTAssertNotNil(configFlags.lastFetchedTime);
@@ -179,7 +181,7 @@ - (void)testConfigUpdateDoesNotHappenImmediately {
179181
FPRRemoteConfigFlags *configFlags =
180182
[[FPRRemoteConfigFlags alloc] initWithRemoteConfig:(FIRRemoteConfig *)remoteConfig];
181183

182-
remoteConfig.fetchStatus = FIRRemoteConfigFetchStatusSuccess;
184+
remoteConfig.fetchStatus = FIRRemoteConfigFetchAndActivateStatusSuccessUsingPreFetchedData;
183185
configFlags.appStartConfigFetchDelayInSeconds = 0.0;
184186
[configFlags update];
185187
XCTAssertNotNil(configFlags.lastFetchedTime);
@@ -203,7 +205,7 @@ - (void)testConfigUpdateHappensIfInitialFetchHasNotHappened {
203205
FPRRemoteConfigFlags *configFlags =
204206
[[FPRRemoteConfigFlags alloc] initWithRemoteConfig:(FIRRemoteConfig *)remoteConfig];
205207

206-
remoteConfig.fetchStatus = FIRRemoteConfigFetchStatusSuccess;
208+
remoteConfig.fetchStatus = FIRRemoteConfigFetchAndActivateStatusSuccessUsingPreFetchedData;
207209
configFlags.appStartConfigFetchDelayInSeconds = 0.0;
208210
[configFlags update];
209211
XCTAssertNotNil(configFlags.lastFetchedTime);
@@ -224,7 +226,7 @@ - (void)testConfigFetchHappensDoesNotHappenImmediately {
224226
[[FPRRemoteConfigFlags alloc] initWithRemoteConfig:(FIRRemoteConfig *)remoteConfig];
225227
// Setting the status to success. Calling update on the config flags should trigger updation of
226228
// fetch time. Fetch would trigger activation.
227-
remoteConfig.fetchStatus = FIRRemoteConfigFetchStatusSuccess;
229+
remoteConfig.fetchStatus = FIRRemoteConfigFetchAndActivateStatusSuccessUsingPreFetchedData;
228230
NSDate *lastActivatedTime = configFlags.lastFetchedTime;
229231
[configFlags update];
230232
XCTAssert([configFlags.lastFetchedTime timeIntervalSinceDate:lastActivatedTime] == 0);
@@ -240,7 +242,7 @@ - (void)testConfigFetchHappensAfterDelay {
240242
[[FPRRemoteConfigFlags alloc] initWithRemoteConfig:(FIRRemoteConfig *)remoteConfig];
241243
configFlags.appStartConfigFetchDelayInSeconds = 0.0;
242244

243-
remoteConfig.fetchStatus = FIRRemoteConfigFetchStatusSuccess;
245+
remoteConfig.fetchStatus = FIRRemoteConfigFetchAndActivateStatusSuccessUsingPreFetchedData;
244246
XCTestExpectation *expectation =
245247
[self expectationWithDescription:@"Dummy expectation to wait for the fetch delay."];
246248
dispatch_after(

FirebasePerformance/Tests/Unit/Timer/FIRTraceTest.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#import "FirebasePerformance/Tests/Unit/Configurations/FPRFakeRemoteConfig.h"
3333
#import "FirebasePerformance/Tests/Unit/FPRTestCase.h"
3434

35-
#import "FirebaseRemoteConfig/Sources/RCNConfigValue_Internal.h"
35+
@import FirebaseRemoteConfig;
3636

3737
#import <OCMock/OCMock.h>
3838

FirebaseRemoteConfig/Sources/FIRConfigValue.m

Lines changed: 0 additions & 91 deletions
This file was deleted.

FirebaseRemoteConfig/Sources/FIRRemoteConfig.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#import "FirebaseRemoteConfig/Sources/Private/RCNConfigSettings.h"
2525
#import "FirebaseRemoteConfig/Sources/RCNConfigConstants.h"
2626
#import "FirebaseRemoteConfig/Sources/RCNConfigRealtime.h"
27-
#import "FirebaseRemoteConfig/Sources/RCNConfigValue_Internal.h"
2827
#import "FirebaseRemoteConfig/Sources/RCNPersonalization.h"
2928

3029
#import "FirebaseRemoteConfig/FirebaseRemoteConfig-Swift.h"

FirebaseRemoteConfig/Sources/Private/FIRRemoteConfig_Private.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,6 @@ NS_ASSUME_NONNULL_BEGIN
4949
+ (FIRRemoteConfig *)remoteConfigWithFIRNamespace:(NSString *)remoteConfigNamespace
5050
NS_SWIFT_NAME(remoteConfig(FIRNamespace:));
5151

52-
/// Returns the FIRRemoteConfig instance for your namespace and for the default 3P developer's app.
53-
/// This singleton object contains the complete set of Remote Config parameter values available to
54-
/// the app, including the Active Config and Default Config. This object also caches values fetched
55-
/// from the Remote Config Server until they are copied to the Active Config by calling
56-
/// activateFetched. When you fetch values from the Remote Config Server using the default Firebase
57-
/// namespace service, you should use this class method to create a shared instance of the
58-
/// FIRRemoteConfig object to ensure that your app will function properly with the Remote Config
59-
/// Server and the Firebase service.
60-
+ (FIRRemoteConfig *)remoteConfigWithFIRNamespace:(NSString *)remoteConfigNamespace
61-
app:(FIRApp *)app
62-
NS_SWIFT_NAME(remoteConfig(FIRNamespace:app:));
63-
6452
/// Register RolloutsStateSubcriber to FIRRemoteConfig instance
6553
- (void)addRemoteConfigInteropSubscriber:(id<FIRRolloutsStateSubscriber> _Nonnull)subscriber;
6654

FirebaseRemoteConfig/Sources/Public/FirebaseRemoteConfig/FIRRemoteConfig.h

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
@class RCNConfigContent;
2323
@class FIROptions;
2424
@class RCNConfigSettings;
25+
@class FIRRemoteConfigValue;
2526
@protocol FIRAnalyticsInterop;
2627

2728
/// The Firebase Remote Config service default namespace, to be used if the API method does not
@@ -139,31 +140,6 @@ typedef void (^FIRRemoteConfigFetchAndActivateCompletion)(
139140
FIRRemoteConfigFetchAndActivateStatus status, NSError *_Nullable error)
140141
NS_SWIFT_UNAVAILABLE("Use Swift's closure syntax instead.");
141142

142-
#pragma mark - FIRRemoteConfigValue
143-
/// This class provides a wrapper for Remote Config parameter values, with methods to get parameter
144-
/// values as different data types.
145-
NS_SWIFT_NAME(RemoteConfigValue)
146-
@interface FIRRemoteConfigValue : NSObject <NSCopying>
147-
/// Gets the value as a string.
148-
@property(nonatomic, readonly, nonnull) NSString *stringValue;
149-
/// Gets the value as a number value.
150-
@property(nonatomic, readonly, nonnull) NSNumber *numberValue;
151-
/// Gets the value as a NSData object.
152-
@property(nonatomic, readonly, nonnull) NSData *dataValue;
153-
/// Gets the value as a boolean.
154-
@property(nonatomic, readonly) BOOL boolValue;
155-
/// Gets a foundation object (NSDictionary / NSArray) by parsing the value as JSON. This method uses
156-
/// NSJSONSerialization's JSONObjectWithData method with an options value of 0.
157-
@property(nonatomic, readonly, nullable) id JSONValue NS_SWIFT_NAME(jsonValue);
158-
/// Identifies the source of the fetched value.
159-
@property(nonatomic, readonly) FIRRemoteConfigSource source;
160-
161-
/// TODO: internal API for temporary bridging
162-
/// Designated initializer.
163-
- (instancetype _Nonnull)initWithData:(nullable NSData *)data
164-
source:(FIRRemoteConfigSource)source NS_DESIGNATED_INITIALIZER;
165-
@end
166-
167143
#pragma mark - FIRRemoteConfigSettings
168144
/// Firebase Remote Config settings.
169145
NS_SWIFT_NAME(RemoteConfigSettings)

0 commit comments

Comments
 (0)