Skip to content
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
146 changes: 71 additions & 75 deletions .github/workflows/remoteconfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,15 @@ jobs:

strategy:
matrix:
# TODO: macos tests are blocked by https://github.com/erikdoe/ocmock/pull/532
target: [ios, tvos, macos --skip-tests, watchos]
# TODO: add watchos back
target: [ios, tvos, macos --skip-tests]
podspec: [FirebaseRemoteConfig.podspec]
os: [macos-14]
include:
- os: macos-14
xcode: Xcode_15.3
# TODO(#13078): Fix testing infra to enforce warnings again.
tests: --allow-warnings
# Flaky tests on CI
- os: macos-14
xcode: Xcode_16
tests: --skip-tests
tests: --test-specs=unit
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand All @@ -85,75 +81,75 @@ jobs:
scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb ${{ matrix.podspec }} --platforms=${{ matrix.target }} \
${{ matrix.tests }}

spm-package-resolved:
env:
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
runs-on: macos-14
outputs:
cache_key: ${{ steps.generate_cache_key.outputs.cache_key }}
steps:
- uses: actions/checkout@v4
- name: Generate Swift Package.resolved
id: swift_package_resolve
run: |
swift package resolve
- name: Generate cache key
id: generate_cache_key
run: |
cache_key="${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}"
echo "cache_key=${cache_key}" >> "$GITHUB_OUTPUT"
- uses: actions/cache/save@v4
id: cache
with:
path: .build
key: ${{ steps.generate_cache_key.outputs.cache_key }}
# spm-package-resolved:
# env:
# FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
# runs-on: macos-14
# outputs:
# cache_key: ${{ steps.generate_cache_key.outputs.cache_key }}
# steps:
# - uses: actions/checkout@v4
# - name: Generate Swift Package.resolved
# id: swift_package_resolve
# run: |
# swift package resolve
# - name: Generate cache key
# id: generate_cache_key
# run: |
# cache_key="${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}"
# echo "cache_key=${cache_key}" >> "$GITHUB_OUTPUT"
# - uses: actions/cache/save@v4
# id: cache
# with:
# path: .build
# key: ${{ steps.generate_cache_key.outputs.cache_key }}

spm:
# Don't run on private repo unless it is a PR.
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
needs: [spm-package-resolved]
strategy:
matrix:
include:
- os: macos-13
xcode: Xcode_15.2
target: iOS
- os: macos-14
xcode: Xcode_15.4
target: iOS
- os: macos-15
xcode: Xcode_16
target: iOS
- os: macos-15
xcode: Xcode_16
target: tvOS
- os: macos-15
xcode: Xcode_16
target: macOS
- os: macos-15
xcode: Xcode_16
target: watchOS
- os: macos-15
xcode: Xcode_16
target: catalyst
- os: macos-15
xcode: Xcode_16
target: visionOS
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/cache/restore@v4
with:
path: .build
key: ${{needs.spm-package-resolved.outputs.cache_key}}
- name: Xcode
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
- name: Initialize xcodebuild
run: scripts/setup_spm_tests.sh
- name: Unit Tests
run: scripts/third_party/travis/retry.sh ./scripts/build.sh RemoteConfigUnit ${{ matrix.target }} spm
- name: Fake Console tests
run: scripts/third_party/travis/retry.sh ./scripts/build.sh RemoteConfigFakeConsole ${{ matrix.target }} spm
# spm:
# # Don't run on private repo unless it is a PR.
# if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
# needs: [spm-package-resolved]
# strategy:
# matrix:
# include:
# - os: macos-13
# xcode: Xcode_15.2
# target: iOS
# - os: macos-14
# xcode: Xcode_15.4
# target: iOS
# - os: macos-15
# xcode: Xcode_16
# target: iOS
# - os: macos-15
# xcode: Xcode_16
# target: tvOS
# - os: macos-15
# xcode: Xcode_16
# target: macOS
# - os: macos-15
# xcode: Xcode_16
# target: watchOS
# - os: macos-15
# xcode: Xcode_16
# target: catalyst
# - os: macos-15
# xcode: Xcode_16
# target: visionOS
# runs-on: ${{ matrix.os }}
# steps:
# - uses: actions/checkout@v4
# - uses: actions/cache/restore@v4
# with:
# path: .build
# key: ${{needs.spm-package-resolved.outputs.cache_key}}
# - name: Xcode
# run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
# - name: Initialize xcodebuild
# run: scripts/setup_spm_tests.sh
# - name: Unit Tests
# run: scripts/third_party/travis/retry.sh ./scripts/build.sh RemoteConfigUnit ${{ matrix.target }} spm
# - name: Fake Console tests
# run: scripts/third_party/travis/retry.sh ./scripts/build.sh RemoteConfigFakeConsole ${{ matrix.target }} spm

catalyst:
# Don't run on private repo unless it is a PR.
Expand Down
1 change: 1 addition & 0 deletions FirebaseRemoteConfig.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ app update.
'FirebaseCore/Extension/*.h',
'FirebaseInstallations/Source/Library/Private/*.h',
'FirebaseRemoteConfig/Swift/**/*.swift',
'FirebaseRemoteConfig/SwiftNew/**/*.swift',
]
s.public_header_files = base_dir + 'Public/FirebaseRemoteConfig/*.h'
s.resource_bundles = {
Expand Down
3 changes: 2 additions & 1 deletion FirebaseRemoteConfig/Sources/FIRRemoteConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@
#import "FirebaseRemoteConfig/Sources/RCNConfigExperiment.h"
#import "FirebaseRemoteConfig/Sources/RCNConfigRealtime.h"
#import "FirebaseRemoteConfig/Sources/RCNConfigValue_Internal.h"
#import "FirebaseRemoteConfig/Sources/RCNDevice.h"
#import "FirebaseRemoteConfig/Sources/RCNPersonalization.h"

#import "FirebaseRemoteConfig/FirebaseRemoteConfig-Swift.h"

/// Remote Config Error Domain.
/// TODO: Rename according to obj-c style for constants.
NSString *const FIRRemoteConfigErrorDomain = @"com.google.remoteconfig.ErrorDomain";
Expand Down
33 changes: 0 additions & 33 deletions FirebaseRemoteConfig/Sources/FIRRemoteConfigUpdate.m

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ NS_ASSUME_NONNULL_BEGIN

@class RCNConfigSettings;

@interface FIRRemoteConfigUpdate ()

/// Designated initializer.
- (instancetype)initWithUpdatedKeys:(NSSet<NSString *> *)updatedKeys;
@end

@interface FIRRemoteConfig () {
NSString *_FIRNamespace;
}
Expand Down
2 changes: 1 addition & 1 deletion FirebaseRemoteConfig/Sources/Private/RCNConfigSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
/// for the Realtime service.
@property(nonatomic, readonly, assign) NSTimeInterval realtimeExponentialBackoffThrottleEndTime;
/// Realtime connection attempts.
@property(nonatomic, readwrite, assign) int realtimeRetryCount;
@property(nonatomic, readwrite, assign) NSInteger realtimeRetryCount;

#pragma mark Throttling Methods

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#import <Foundation/Foundation.h>

@class FIRApp;
@class FIRRemoteConfigUpdate;

/// 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 @@ -170,19 +171,6 @@ NS_SWIFT_NAME(RemoteConfigSettings)
@property(nonatomic, assign) NSTimeInterval fetchTimeout;
@end

#pragma mark - FIRRemoteConfigUpdate
/// Used by Remote Config real-time config update service, this class represents changes between the
/// newly fetched config and the current one. An instance of this class is passed to
/// `FIRRemoteConfigUpdateCompletion` when a new config version has been automatically fetched.
NS_SWIFT_NAME(RemoteConfigUpdate)
@interface FIRRemoteConfigUpdate : NSObject

/// Parameter keys whose values have been updated from the currently activated values. Includes
/// keys that are added, deleted, and whose value, value source, or metadata has changed.
@property(nonatomic, readonly, nonnull) NSSet<NSString *> *updatedKeys;

@end

#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
2 changes: 2 additions & 0 deletions FirebaseRemoteConfig/Sources/RCNConfigContent.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

#import "FirebaseRemoteConfig/Sources/RCNConfigContent.h"

#import "FirebaseRemoteConfig/FirebaseRemoteConfig-Swift.h"

#import "FirebaseRemoteConfig/Sources/Private/FIRRemoteConfig_Private.h"
#import "FirebaseRemoteConfig/Sources/Public/FirebaseRemoteConfig/FIRRemoteConfig.h"
#import "FirebaseRemoteConfig/Sources/RCNConfigConstants.h"
Expand Down
12 changes: 7 additions & 5 deletions FirebaseRemoteConfig/Sources/RCNConfigFetch.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
#import "FirebaseRemoteConfig/Sources/RCNConfigConstants.h"
#import "FirebaseRemoteConfig/Sources/RCNConfigContent.h"
#import "FirebaseRemoteConfig/Sources/RCNConfigExperiment.h"
#import "FirebaseRemoteConfig/Sources/RCNDevice.h"

#import "FirebaseRemoteConfig/FirebaseRemoteConfig-Swift.h"

@import FirebaseRemoteConfigInterop;

#ifdef RCN_STAGING_SERVER
Expand Down Expand Up @@ -134,8 +136,8 @@ - (void)fetchConfigWithExpirationDuration:(NSTimeInterval)expirationDuration
completionHandler:
(_Nullable FIRRemoteConfigFetchCompletion)completionHandler {
// Note: We expect the googleAppID to always be available.
BOOL hasDeviceContextChanged =
FIRRemoteConfigHasDeviceContextChanged(_settings.deviceContext, _options.googleAppID);
BOOL hasDeviceContextChanged = [Device remoteConfigHasDeviceContextChanged:_settings.deviceContext
projectIdentifier:_options.googleAppID];

__weak RCNConfigFetch *weakSelf = self;
dispatch_async(_lockQueue, ^{
Expand Down Expand Up @@ -201,8 +203,8 @@ - (void)fetchConfigWithExpirationDuration:(NSTimeInterval)expirationDuration
- (void)realtimeFetchConfigWithNoExpirationDuration:(NSInteger)fetchAttemptNumber
completionHandler:(RCNConfigFetchCompletion)completionHandler {
// Note: We expect the googleAppID to always be available.
BOOL hasDeviceContextChanged =
FIRRemoteConfigHasDeviceContextChanged(_settings.deviceContext, _options.googleAppID);
BOOL hasDeviceContextChanged = [Device remoteConfigHasDeviceContextChanged:_settings.deviceContext
projectIdentifier:_options.googleAppID];

__weak RCNConfigFetch *weakSelf = self;
dispatch_async(_lockQueue, ^{
Expand Down
6 changes: 3 additions & 3 deletions FirebaseRemoteConfig/Sources/RCNConfigRealtime.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
#import <GoogleUtilities/GULNSData+zlib.h>
#import "FirebaseCore/Extension/FirebaseCoreInternal.h"
#import "FirebaseInstallations/Source/Library/Private/FirebaseInstallationsInternal.h"
#import "FirebaseRemoteConfig/FirebaseRemoteConfig-Swift.h"
#import "FirebaseRemoteConfig/Sources/Private/RCNConfigFetch.h"
#import "FirebaseRemoteConfig/Sources/Private/RCNConfigSettings.h"
#import "FirebaseRemoteConfig/Sources/RCNConfigConstants.h"
#import "FirebaseRemoteConfig/Sources/RCNDevice.h"

/// URL params
static NSString *const kServerURLDomain = @"https://firebaseremoteconfigrealtime.googleapis.com";
Expand Down Expand Up @@ -167,7 +167,7 @@ - (void)propagateErrors:(NSError *)error {
// TESTING ONLY
- (void)triggerListenerForTesting:(void (^_Nonnull)(FIRRemoteConfigUpdate *configUpdate,
NSError *_Nullable error))listener {
listener([[FIRRemoteConfigUpdate alloc] init], nil);
listener([[FIRRemoteConfigUpdate alloc] initWithUpdatedKeys:[[NSSet alloc] init]], nil);
}

#pragma mark - Http Helpers
Expand Down Expand Up @@ -328,7 +328,7 @@ - (void)createRequestBodyWithCompletion:(void (^)(NSData *_Nonnull requestBody))
@"sdkVersion:'%@', appInstanceId:'%@'}",
[strongSelf->_options GCMSenderID], namespace,
strongSelf->_configFetch.templateVersionNumber,
strongSelf->_options.googleAppID, FIRRemoteConfigPodVersion(),
strongSelf->_options.googleAppID, Device.remoteConfigPodVersion,
strongSelf->_settings.configInstallationsIdentifier];
NSData *postData = [postBody dataUsingEncoding:NSUTF8StringEncoding];
NSError *compressionError;
Expand Down
Loading
Loading