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] RemoteConfig.swift #14309

Merged
merged 11 commits into from
Jan 16, 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
4 changes: 0 additions & 4 deletions FirebaseRemoteConfig.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,13 @@ app update.
}
swift_api.source_files = ['FirebaseRemoteConfig/Tests/Swift/SwiftAPI/*.swift',
'FirebaseRemoteConfig/Tests/Swift/FakeUtils/*.swift',
'FirebaseRemoteConfig/Tests/Swift/ObjC/*.[hm]',
]
# Excludes tests that cannot be include in API tests because it requires fetch remote values from
# a real console but only one test can be run without polluting other tests' remote values.
swift_api.exclude_files = ['FirebaseRemoteConfig/Tests/Swift/SwiftAPI/PropertyWrapperTests.swift']
swift_api.resources = 'FirebaseRemoteConfig/Tests/Swift/Defaults-testInfo.plist'
swift_api.requires_app_host = true
swift_api.pod_target_xcconfig = {
'SWIFT_OBJC_BRIDGING_HEADER' => '$(PODS_TARGET_SRCROOT)/FirebaseRemoteConfig/Tests/Swift/ObjC/Bridging-Header.h',
'OTHER_SWIFT_FLAGS' => "$(inherited) #{ENV.key?('USE_REAL_CONSOLE') ? '-D USE_REAL_CONSOLE' : ''}",
'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}"'
}
Expand All @@ -131,12 +129,10 @@ app update.
fake_console.source_files = ['FirebaseRemoteConfig/Tests/Swift/SwiftAPI/*.swift',
'FirebaseRemoteConfig/Tests/Swift/FakeUtils/*.swift',
'FirebaseRemoteConfig/Tests/Swift/FakeConsole/*.swift',
'FirebaseRemoteConfig/Tests/Swift/ObjC/*.[hm]',
]
fake_console.resources = 'FirebaseRemoteConfig/Tests/Swift/Defaults-testInfo.plist'
fake_console.requires_app_host = true
fake_console.pod_target_xcconfig = {
'SWIFT_OBJC_BRIDGING_HEADER' => '$(PODS_TARGET_SRCROOT)/FirebaseRemoteConfig/Tests/Swift/ObjC/Bridging-Header.h',
'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}"'
}
fake_console.dependency 'OCMock'
Expand Down
703 changes: 3 additions & 700 deletions FirebaseRemoteConfig/Sources/FIRRemoteConfig.m

Large diffs are not rendered by default.

49 changes: 0 additions & 49 deletions FirebaseRemoteConfig/Sources/Private/FIRRemoteConfig_Private.h

This file was deleted.

Large diffs are not rendered by default.

72 changes: 0 additions & 72 deletions FirebaseRemoteConfig/Sources/RCNConfigConstants.h

This file was deleted.

37 changes: 0 additions & 37 deletions FirebaseRemoteConfig/Sources/RCNConfigDefines.h

This file was deleted.

21 changes: 0 additions & 21 deletions FirebaseRemoteConfig/Sources/RCNConstants3P.m

This file was deleted.

5 changes: 5 additions & 0 deletions FirebaseRemoteConfig/SwiftNew/ConfigConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ enum ConfigConstants {

static let remoteConfigQueueLabel = "com.google.GoogleConfigService.FIRRemoteConfig"

/// Remote Config Error Domain.
static let remoteConfigErrorDomain = "com.google.remoteconfig.ErrorDomain"
// Remote Config Realtime Error Domain
static let remoteConfigUpdateErrorDomain = "com.google.remoteconfig.update.ErrorDomain"

// MARK: - Fetch Response Keys

static let fetchResponseKeyEntries = "entries"
Expand Down
4 changes: 2 additions & 2 deletions FirebaseRemoteConfig/SwiftNew/ConfigExperiment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import Foundation
private let experimentStartTimeDateFormatter: DateFormatter

/// Designated initializer;
@objc public init(DBManager: ConfigDBManager,
@objc public init(dbManager: ConfigDBManager,
experimentController controller: ExperimentController?) {
experimentPayloads = []
experimentMetadata = [:]
Expand All @@ -48,7 +48,7 @@ import Foundation
dateFormatter.timeZone = TimeZone(abbreviation: "UTC")
return dateFormatter
}()
dbManager = DBManager
self.dbManager = dbManager
experimentController = controller
super.init()
loadExperimentFromTable()
Expand Down
26 changes: 13 additions & 13 deletions FirebaseRemoteConfig/SwiftNew/ConfigFetch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ extension URLSession: RCNConfigFetchSession {
@objc(RCNConfigFetch) public class ConfigFetch: NSObject {
private let content: ConfigContent

private let settings: ConfigSettings
let settings: ConfigSettings

private let analytics: (any FIRAnalyticsInterop)?

Expand Down Expand Up @@ -241,11 +241,11 @@ extension URLSession: RCNConfigFetchSession {
if strongSelf.settings.shouldThrottle() && !hasDeviceContextChanged {
// Must set lastFetchStatus before FailReason.
strongSelf.settings.lastFetchStatus = .throttled
strongSelf.settings.lastFetchError = .throttled
strongSelf.settings.lastFetchError = RemoteConfigError.throttled
let throttledEndTime = strongSelf.settings.exponentialBackoffThrottleEndTime

let error = NSError(
domain: RemoteConfigErrorDomain,
domain: ConfigConstants.remoteConfigErrorDomain,
code: RemoteConfigError.throttled.rawValue,
userInfo: [throttledEndTimeInSecondsKey: throttledEndTime]
)
Expand Down Expand Up @@ -291,11 +291,11 @@ extension URLSession: RCNConfigFetchSession {
if strongSelf.settings.shouldThrottle() && !hasDeviceContextChanged {
// Must set lastFetchStatus before FailReason.
strongSelf.settings.lastFetchStatus = .throttled
strongSelf.settings.lastFetchError = .throttled
strongSelf.settings.lastFetchError = RemoteConfigError.throttled
let throttledEndTime = strongSelf.settings.exponentialBackoffThrottleEndTime

let error = NSError(
domain: RemoteConfigErrorDomain,
domain: ConfigConstants.remoteConfigErrorDomain,
code: RemoteConfigError.throttled.rawValue,
userInfo: [throttledEndTimeInSecondsKey: throttledEndTime]
)
Expand Down Expand Up @@ -339,7 +339,7 @@ extension URLSession: RCNConfigFetchSession {
on: completionHandler,
status: .failure,
error: NSError(
domain: RemoteConfigErrorDomain,
domain: ConfigConstants.remoteConfigErrorDomain,
code: RemoteConfigError.internalError.rawValue,
userInfo: [NSLocalizedDescriptionKey: errorDescription]
)
Expand All @@ -366,7 +366,7 @@ extension URLSession: RCNConfigFetchSession {
on: completionHandler,
status: .failure,
error: NSError(
domain: RemoteConfigErrorDomain,
domain: ConfigConstants.remoteConfigErrorDomain,
code: RemoteConfigError.internalError.rawValue,
userInfo: userInfo
)
Expand Down Expand Up @@ -400,7 +400,7 @@ extension URLSession: RCNConfigFetchSession {
on: completionHandler,
status: .failure,
error: NSError(
domain: RemoteConfigErrorDomain,
domain: ConfigConstants.remoteConfigErrorDomain,
code: RemoteConfigError.internalError.rawValue,
userInfo: userInfo
)
Expand Down Expand Up @@ -502,7 +502,7 @@ extension URLSession: RCNConfigFetchSession {
let errorString = "Failed to compress the config request."
RCLog.warning("I-RCN000033", errorString)
let error = NSError(
domain: RemoteConfigErrorDomain,
domain: ConfigConstants.remoteConfigErrorDomain,
code: RemoteConfigError.internalError.rawValue,
userInfo: [NSLocalizedDescriptionKey: errorString]
)
Expand Down Expand Up @@ -566,11 +566,11 @@ extension URLSession: RCNConfigFetchSession {
if strongSelf.settings.shouldThrottle() {
// Must set lastFetchStatus before FailReason.
strongSelf.settings.lastFetchStatus = .throttled
strongSelf.settings.lastFetchError = .throttled
strongSelf.settings.lastFetchError = RemoteConfigError.throttled
let throttledEndTime = strongSelf.settings.exponentialBackoffThrottleEndTime

let error = NSError(
domain: RemoteConfigErrorDomain,
domain: ConfigConstants.remoteConfigErrorDomain,
code: RemoteConfigError.throttled.rawValue,
userInfo: [throttledEndTimeInSecondsKey: throttledEndTime]
)
Expand Down Expand Up @@ -600,7 +600,7 @@ extension URLSession: RCNConfigFetchSession {
status: .failure,
update: nil,
error: NSError(
domain: RemoteConfigErrorDomain,
domain: ConfigConstants.remoteConfigErrorDomain,
code: RemoteConfigError.internalError.rawValue,
userInfo: userInfo
),
Expand Down Expand Up @@ -651,7 +651,7 @@ extension URLSession: RCNConfigFetchSession {
}
RCLog.error("I-RCN000044", errStr + ".")
let error = NSError(
domain: RemoteConfigErrorDomain,
domain: ConfigConstants.remoteConfigErrorDomain,
code: RemoteConfigError.internalError.rawValue,
userInfo: [NSLocalizedDescriptionKey: errStr]
)
Expand Down
Loading
Loading