Skip to content

Commit 13a171b

Browse files
committed
review
1 parent 1b0b876 commit 13a171b

File tree

7 files changed

+110
-63
lines changed

7 files changed

+110
-63
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright 2019 Google
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#import "FirebaseRemoteConfig/Sources/Public/FirebaseRemoteConfig/FIRRemoteConfig.h"
18+
19+
/// Remote Config Error Info End Time Seconds;
20+
NSString *const FIRRemoteConfigThrottledEndTimeInSecondsKey = @"error_throttled_end_time_seconds";
21+
22+
/// Firebase Remote Config service default namespace.
23+
/// TODO(doudounan): Change to use this namespace defined in RemoteConfigInterop.
24+
NSString *const FIRNamespaceGoogleMobilePlatform = @"firebase";

FirebaseRemoteConfig/SwiftNew/ConfigConstants.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ enum ConfigConstants {
2424
static let remoteConfigQueueLabel = "com.google.GoogleConfigService.FIRRemoteConfig"
2525

2626
/// Remote Config Error Domain.
27-
static let RemoteConfigErrorDomain = "com.google.remoteconfig.ErrorDomain"
27+
static let remoteConfigErrorDomain = "com.google.remoteconfig.ErrorDomain"
2828
// Remote Config Realtime Error Domain
29-
static let RemoteConfigUpdateErrorDomain = "com.google.remoteconfig.update.ErrorDomain"
29+
static let remoteConfigUpdateErrorDomain = "com.google.remoteconfig.update.ErrorDomain"
3030

3131
// MARK: - Fetch Response Keys
3232

FirebaseRemoteConfig/SwiftNew/ConfigFetch.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ extension URLSession: RCNConfigFetchSession {
245245
let throttledEndTime = strongSelf.settings.exponentialBackoffThrottleEndTime
246246

247247
let error = NSError(
248-
domain: ConfigConstants.RemoteConfigErrorDomain,
248+
domain: ConfigConstants.remoteConfigErrorDomain,
249249
code: RemoteConfigError.throttled.rawValue,
250250
userInfo: [throttledEndTimeInSecondsKey: throttledEndTime]
251251
)
@@ -295,7 +295,7 @@ extension URLSession: RCNConfigFetchSession {
295295
let throttledEndTime = strongSelf.settings.exponentialBackoffThrottleEndTime
296296

297297
let error = NSError(
298-
domain: ConfigConstants.RemoteConfigErrorDomain,
298+
domain: ConfigConstants.remoteConfigErrorDomain,
299299
code: RemoteConfigError.throttled.rawValue,
300300
userInfo: [throttledEndTimeInSecondsKey: throttledEndTime]
301301
)
@@ -339,7 +339,7 @@ extension URLSession: RCNConfigFetchSession {
339339
on: completionHandler,
340340
status: .failure,
341341
error: NSError(
342-
domain: ConfigConstants.RemoteConfigErrorDomain,
342+
domain: ConfigConstants.remoteConfigErrorDomain,
343343
code: RemoteConfigError.internalError.rawValue,
344344
userInfo: [NSLocalizedDescriptionKey: errorDescription]
345345
)
@@ -366,7 +366,7 @@ extension URLSession: RCNConfigFetchSession {
366366
on: completionHandler,
367367
status: .failure,
368368
error: NSError(
369-
domain: ConfigConstants.RemoteConfigErrorDomain,
369+
domain: ConfigConstants.remoteConfigErrorDomain,
370370
code: RemoteConfigError.internalError.rawValue,
371371
userInfo: userInfo
372372
)
@@ -400,7 +400,7 @@ extension URLSession: RCNConfigFetchSession {
400400
on: completionHandler,
401401
status: .failure,
402402
error: NSError(
403-
domain: ConfigConstants.RemoteConfigErrorDomain,
403+
domain: ConfigConstants.remoteConfigErrorDomain,
404404
code: RemoteConfigError.internalError.rawValue,
405405
userInfo: userInfo
406406
)
@@ -502,7 +502,7 @@ extension URLSession: RCNConfigFetchSession {
502502
let errorString = "Failed to compress the config request."
503503
RCLog.warning("I-RCN000033", errorString)
504504
let error = NSError(
505-
domain: ConfigConstants.RemoteConfigErrorDomain,
505+
domain: ConfigConstants.remoteConfigErrorDomain,
506506
code: RemoteConfigError.internalError.rawValue,
507507
userInfo: [NSLocalizedDescriptionKey: errorString]
508508
)
@@ -570,7 +570,7 @@ extension URLSession: RCNConfigFetchSession {
570570
let throttledEndTime = strongSelf.settings.exponentialBackoffThrottleEndTime
571571

572572
let error = NSError(
573-
domain: ConfigConstants.RemoteConfigErrorDomain,
573+
domain: ConfigConstants.remoteConfigErrorDomain,
574574
code: RemoteConfigError.throttled.rawValue,
575575
userInfo: [throttledEndTimeInSecondsKey: throttledEndTime]
576576
)
@@ -600,7 +600,7 @@ extension URLSession: RCNConfigFetchSession {
600600
status: .failure,
601601
update: nil,
602602
error: NSError(
603-
domain: ConfigConstants.RemoteConfigErrorDomain,
603+
domain: ConfigConstants.remoteConfigErrorDomain,
604604
code: RemoteConfigError.internalError.rawValue,
605605
userInfo: userInfo
606606
),
@@ -651,7 +651,7 @@ extension URLSession: RCNConfigFetchSession {
651651
}
652652
RCLog.error("I-RCN000044", errStr + ".")
653653
let error = NSError(
654-
domain: ConfigConstants.RemoteConfigErrorDomain,
654+
domain: ConfigConstants.remoteConfigErrorDomain,
655655
code: RemoteConfigError.internalError.rawValue,
656656
userInfo: [NSLocalizedDescriptionKey: errStr]
657657
)

FirebaseRemoteConfig/SwiftNew/ConfigRealtime.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ class ConfigRealtime: NSObject, URLSessionDataDelegate {
214214
onHandler: completionHandler,
215215
withStatus: .failure,
216216
withError: NSError(
217-
domain: ConfigConstants.RemoteConfigErrorDomain,
217+
domain: ConfigConstants.remoteConfigErrorDomain,
218218
code: RemoteConfigError.internalError.rawValue,
219219
userInfo: [NSLocalizedDescriptionKey: errorDescription]
220220
)
@@ -236,7 +236,7 @@ class ConfigRealtime: NSObject, URLSessionDataDelegate {
236236
self.reportCompletion(
237237
onHandler: completionHandler,
238238
withStatus: .failure,
239-
withError: NSError(domain: ConfigConstants.RemoteConfigErrorDomain,
239+
withError: NSError(domain: ConfigConstants.remoteConfigErrorDomain,
240240
code: RemoteConfigError.internalError.rawValue,
241241
userInfo: userInfo)
242242
)
@@ -248,7 +248,7 @@ class ConfigRealtime: NSObject, URLSessionDataDelegate {
248248
self.isRequestInProgress = false
249249
reportCompletion(onHandler: completionHandler,
250250
withStatus: .failure,
251-
withError: NSError(domain: ConfigConstants.RemoteConfigErrorDomain,
251+
withError: NSError(domain: ConfigConstants.remoteConfigErrorDomain,
252252
code: RemoteConfigError.internalError.rawValue,
253253
userInfo: [
254254
NSLocalizedDescriptionKey: errorDescription,
@@ -273,7 +273,7 @@ class ConfigRealtime: NSObject, URLSessionDataDelegate {
273273
self.reportCompletion(
274274
onHandler: completionHandler,
275275
withStatus: .failure,
276-
withError: NSError(domain: ConfigConstants.RemoteConfigErrorDomain,
276+
withError: NSError(domain: ConfigConstants.remoteConfigErrorDomain,
277277
code: RemoteConfigError.internalError.rawValue,
278278
userInfo: userInfo)
279279
)
@@ -341,7 +341,7 @@ class ConfigRealtime: NSObject, URLSessionDataDelegate {
341341
realtimeLockQueue.async { [weak self] in
342342
guard let self, !self.isInBackground else { return }
343343
guard self.remainingRetryCount > 0 else {
344-
let error = NSError(domain: ConfigConstants.RemoteConfigUpdateErrorDomain,
344+
let error = NSError(domain: ConfigConstants.remoteConfigUpdateErrorDomain,
345345
code: RemoteConfigUpdateError.streamError.rawValue,
346346
userInfo: [
347347
NSLocalizedDescriptionKey: "Unable to connect to the server. Check your connection and try again.",
@@ -458,7 +458,7 @@ class ConfigRealtime: NSObject, URLSessionDataDelegate {
458458
realtimeLockQueue.async { [weak self] in
459459
guard let self else { return }
460460
guard attempts > 0 else {
461-
let error = NSError(domain: ConfigConstants.RemoteConfigUpdateErrorDomain,
461+
let error = NSError(domain: ConfigConstants.remoteConfigUpdateErrorDomain,
462462
code: RemoteConfigUpdateError.notFetched.rawValue,
463463
userInfo: [
464464
NSLocalizedDescriptionKey: "Unable to fetch the latest version of the template.",
@@ -481,7 +481,7 @@ class ConfigRealtime: NSObject, URLSessionDataDelegate {
481481
// If response data contains the API enablement link, return the entire
482482
// message to the user in the form of a error.
483483
if strData.contains(serverForbiddenStatusCode) {
484-
let error = NSError(domain: ConfigConstants.RemoteConfigUpdateErrorDomain,
484+
let error = NSError(domain: ConfigConstants.remoteConfigUpdateErrorDomain,
485485
code: RemoteConfigUpdateError.streamError.rawValue,
486486
userInfo: [NSLocalizedDescriptionKey: strData])
487487
RCLog.error("I-RCN000021", "Cannot establish connection. \(error)")
@@ -502,7 +502,7 @@ class ConfigRealtime: NSObject, URLSessionDataDelegate {
502502
}
503503
} catch {
504504
let wrappedError =
505-
NSError(domain: ConfigConstants.RemoteConfigUpdateErrorDomain,
505+
NSError(domain: ConfigConstants.remoteConfigUpdateErrorDomain,
506506
code: RemoteConfigUpdateError.messageInvalid.rawValue,
507507
userInfo: [
508508
NSLocalizedDescriptionKey: "Unable to parse ConfigUpdate. \(strData)",
@@ -526,7 +526,7 @@ class ConfigRealtime: NSObject, URLSessionDataDelegate {
526526
if isRealtimeDisabled {
527527
pauseRealtimeStream()
528528
let error =
529-
NSError(domain: ConfigConstants.RemoteConfigUpdateErrorDomain,
529+
NSError(domain: ConfigConstants.remoteConfigUpdateErrorDomain,
530530
code: RemoteConfigUpdateError.unavailable.rawValue,
531531
userInfo: [
532532
NSLocalizedDescriptionKey: "The server is temporarily unavailable. Try again in a few minutes.",
@@ -567,7 +567,7 @@ class ConfigRealtime: NSObject, URLSessionDataDelegate {
567567
retryHTTPConnection()
568568
} else {
569569
let error = NSError(
570-
domain: ConfigConstants.RemoteConfigUpdateErrorDomain,
570+
domain: ConfigConstants.remoteConfigUpdateErrorDomain,
571571
code: RemoteConfigUpdateError.streamError.rawValue,
572572
userInfo: [
573573
NSLocalizedDescriptionKey:

0 commit comments

Comments
 (0)