Skip to content

Commit

Permalink
[Database] Migrate to GoogleUtilities's storage container (#12753)
Browse files Browse the repository at this point in the history
  • Loading branch information
ncooke3 authored Apr 11, 2024
1 parent ae3ed09 commit 0978222
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions FirebaseDatabase.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Simplify your iOS development, grow your user base, and monetize more effectivel
s.dependency 'FirebaseCore', '~> 10.0'
s.dependency 'FirebaseAppCheckInterop', '~> 10.17'
s.dependency 'FirebaseSharedSwift', '~> 10.0'
s.dependency 'GoogleUtilities/UserDefaults', '~> 7.13'
s.pod_target_xcconfig = {
'GCC_C_LANGUAGE_STANDARD' => 'c99',
'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}"'
Expand Down
10 changes: 6 additions & 4 deletions FirebaseDatabase/Sources/Core/FRepoInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
* limitations under the License.
*/

#import "FirebaseDatabase/Sources/Core/FRepoInfo.h"
#import <GoogleUtilities/GULUserDefaults.h>

#import "FirebaseDatabase/Sources/Constants/FConstants.h"
#import "FirebaseDatabase/Sources/Core/FRepoInfo.h"

@interface FRepoInfo ()

Expand Down Expand Up @@ -52,7 +54,7 @@ - (instancetype)initWithHost:(NSString *)aHost
// Get cached internal host if it exists
NSString *internalHostKey =
[NSString stringWithFormat:@"firebase:host:%@", _host];
NSString *cachedInternalHost = [[NSUserDefaults standardUserDefaults]
NSString *cachedInternalHost = [[GULUserDefaults standardUserDefaults]
stringForKey:internalHostKey];
if (cachedInternalHost != nil) {
internalHost = cachedInternalHost;
Expand Down Expand Up @@ -81,7 +83,7 @@ - (void)setInternalHost:(NSString *)newHost {
// Cache the internal host so we don't need to redirect later on
NSString *internalHostKey =
[NSString stringWithFormat:@"firebase:host:%@", self.host];
NSUserDefaults *cache = [NSUserDefaults standardUserDefaults];
GULUserDefaults *cache = [GULUserDefaults standardUserDefaults];
[cache setObject:internalHost forKey:internalHostKey];
[cache synchronize];
}
Expand All @@ -93,7 +95,7 @@ - (void)clearInternalHostCache {
// Remove the cached entry
NSString *internalHostKey =
[NSString stringWithFormat:@"firebase:host:%@", self.host];
NSUserDefaults *cache = [NSUserDefaults standardUserDefaults];
GULUserDefaults *cache = [GULUserDefaults standardUserDefaults];
[cache removeObjectForKey:internalHostKey];
[cache synchronize];
}
Expand Down
1 change: 1 addition & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ let package = Package(
"FirebaseAppCheckInterop",
"FirebaseCore",
"leveldb",
.product(name: "GULUserDefaults", package: "GoogleUtilities"),
],
path: "FirebaseDatabase/Sources",
exclude: [
Expand Down

0 comments on commit 0978222

Please sign in to comment.