Skip to content

Commit 0978222

Browse files
authored
[Database] Migrate to GoogleUtilities's storage container (#12753)
1 parent ae3ed09 commit 0978222

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

FirebaseDatabase.podspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Simplify your iOS development, grow your user base, and monetize more effectivel
5151
s.dependency 'FirebaseCore', '~> 10.0'
5252
s.dependency 'FirebaseAppCheckInterop', '~> 10.17'
5353
s.dependency 'FirebaseSharedSwift', '~> 10.0'
54+
s.dependency 'GoogleUtilities/UserDefaults', '~> 7.13'
5455
s.pod_target_xcconfig = {
5556
'GCC_C_LANGUAGE_STANDARD' => 'c99',
5657
'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}"'

FirebaseDatabase/Sources/Core/FRepoInfo.m

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
* limitations under the License.
1515
*/
1616

17-
#import "FirebaseDatabase/Sources/Core/FRepoInfo.h"
17+
#import <GoogleUtilities/GULUserDefaults.h>
18+
1819
#import "FirebaseDatabase/Sources/Constants/FConstants.h"
20+
#import "FirebaseDatabase/Sources/Core/FRepoInfo.h"
1921

2022
@interface FRepoInfo ()
2123

@@ -52,7 +54,7 @@ - (instancetype)initWithHost:(NSString *)aHost
5254
// Get cached internal host if it exists
5355
NSString *internalHostKey =
5456
[NSString stringWithFormat:@"firebase:host:%@", _host];
55-
NSString *cachedInternalHost = [[NSUserDefaults standardUserDefaults]
57+
NSString *cachedInternalHost = [[GULUserDefaults standardUserDefaults]
5658
stringForKey:internalHostKey];
5759
if (cachedInternalHost != nil) {
5860
internalHost = cachedInternalHost;
@@ -81,7 +83,7 @@ - (void)setInternalHost:(NSString *)newHost {
8183
// Cache the internal host so we don't need to redirect later on
8284
NSString *internalHostKey =
8385
[NSString stringWithFormat:@"firebase:host:%@", self.host];
84-
NSUserDefaults *cache = [NSUserDefaults standardUserDefaults];
86+
GULUserDefaults *cache = [GULUserDefaults standardUserDefaults];
8587
[cache setObject:internalHost forKey:internalHostKey];
8688
[cache synchronize];
8789
}
@@ -93,7 +95,7 @@ - (void)clearInternalHostCache {
9395
// Remove the cached entry
9496
NSString *internalHostKey =
9597
[NSString stringWithFormat:@"firebase:host:%@", self.host];
96-
NSUserDefaults *cache = [NSUserDefaults standardUserDefaults];
98+
GULUserDefaults *cache = [GULUserDefaults standardUserDefaults];
9799
[cache removeObjectForKey:internalHostKey];
98100
[cache synchronize];
99101
}

Package.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,7 @@ let package = Package(
590590
"FirebaseAppCheckInterop",
591591
"FirebaseCore",
592592
"leveldb",
593+
.product(name: "GULUserDefaults", package: "GoogleUtilities"),
593594
],
594595
path: "FirebaseDatabase/Sources",
595596
exclude: [

0 commit comments

Comments
 (0)