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

[Database] Migrate to GoogleUtilities's storage container #12753

Merged
merged 2 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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.8'
ncooke3 marked this conversation as resolved.
Show resolved Hide resolved
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
Loading