Skip to content

Commit b595302

Browse files
committed
Revert "Alternative approach"
This reverts commit 354f90b.
1 parent 6e01068 commit b595302

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

FirebaseRemoteConfig/SwiftNew/ConfigFetch.swift

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,7 @@ extension Installations: InstallationsProtocol {}
107107

108108
/// Provide fetchSession for tests to override.
109109
/// - Note: Managed internally by the fetch instance.
110-
private var fetchSession: any RCNConfigFetchSession
111-
112-
public var configuredFetchSessionProvider: (ConfigSettings) -> RCNConfigFetchSession {
113-
didSet {
114-
fetchSession = configuredFetchSessionProvider(settings)
115-
}
116-
}
110+
public var fetchSession: any RCNConfigFetchSession
117111

118112
private let namespace: String
119113

@@ -144,6 +138,8 @@ extension Installations: InstallationsProtocol {}
144138
)
145139
}
146140

141+
private let configuredFetchSessionProvider: (ConfigSettings) -> RCNConfigFetchSession
142+
147143
/// Designated initializer
148144
@objc public init(content: ConfigContent,
149145
DBManager: ConfigDBManager,
@@ -184,8 +180,13 @@ extension Installations: InstallationsProtocol {}
184180
super.init()
185181
}
186182

183+
public var disableNetworkSessionRecreation: Bool = false
184+
187185
/// Add the ability to update NSURLSession's timeout after a session has already been created.
188186
@objc public func recreateNetworkSession() {
187+
if disableNetworkSessionRecreation {
188+
return
189+
}
189190
fetchSession.invalidateAndCancel()
190191
fetchSession = configuredFetchSessionProvider(settings)
191192
}

FirebaseRemoteConfig/Tests/Swift/SwiftAPI/APITestBase.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,8 @@ class APITestBase: XCTestCase {
9898
config.configRealtime = RealtimeMocks.mockRealtime(config.configRealtime)
9999
}
100100
fakeConsole = FakeConsole()
101-
config.configFetch.configuredFetchSessionProvider = { _ in
102-
URLSessionMock(with: self.fakeConsole)
103-
}
101+
config.configFetch.fetchSession = URLSessionMock(with: fakeConsole)
102+
config.configFetch.disableNetworkSessionRecreation = true
104103

105104
fakeConsole.config = [Constants.key1: Constants.value1,
106105
Constants.jsonKey: jsonValue,

0 commit comments

Comments
 (0)