Skip to content

Commit

Permalink
[AppCheck] Migrate to GoogleUtilities's storage container (#12773)
Browse files Browse the repository at this point in the history
  • Loading branch information
ncooke3 authored Apr 12, 2024
1 parent 3211a7f commit b6e5270
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 6 deletions.
3 changes: 2 additions & 1 deletion FirebaseAppCheck.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ Pod::Spec.new do |s|
s.dependency 'FirebaseAppCheckInterop', '~> 10.17'
s.dependency 'FirebaseCore', '~> 10.0'
s.dependency 'PromisesObjC', '~> 2.1'
s.dependency 'GoogleUtilities/Environment', '~> 7.8'
s.dependency 'GoogleUtilities/Environment', '~> 7.13'
s.dependency 'GoogleUtilities/UserDefaults', '~> 7.13'

s.pod_target_xcconfig = {
'GCC_C_LANGUAGE_STANDARD' => 'c99',
Expand Down
3 changes: 2 additions & 1 deletion FirebaseAppCheck/Sources/Core/FIRAppCheck.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#import <AppCheckCore/AppCheckCore.h>
#import <FirebaseAppCheckInterop/FirebaseAppCheckInterop.h>
#import <GoogleUtilities/GULUserDefaults.h>

#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheckErrors.h"
#import "FirebaseAppCheck/Sources/Public/FirebaseAppCheck/FIRAppCheckProvider.h"
Expand Down Expand Up @@ -92,7 +93,7 @@ - (nullable instancetype)initWithApp:(FIRApp *)app {
[[FIRInternalAppCheckProvider alloc] initWithAppCheckProvider:appCheckProvider];
FIRAppCheckSettings *settings =
[[FIRAppCheckSettings alloc] initWithApp:app
userDefault:[NSUserDefaults standardUserDefaults]
userDefault:[GULUserDefaults standardUserDefaults]
mainBundle:[NSBundle mainBundle]];

GACAppCheck *appCheckCore = [[GACAppCheck alloc] initWithServiceName:serviceName
Expand Down
3 changes: 2 additions & 1 deletion FirebaseAppCheck/Sources/Core/FIRAppCheckSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#import <AppCheckCore/AppCheckCore.h>

@class FIRApp;
@class GULUserDefaults;

NS_ASSUME_NONNULL_BEGIN

Expand All @@ -32,7 +33,7 @@ FOUNDATION_EXPORT NSString *const kFIRAppCheckTokenAutoRefreshEnabledInfoPlistKe
@property(nonatomic, assign) BOOL isTokenAutoRefreshEnabled;

- (instancetype)initWithApp:(FIRApp *)firebaseApp
userDefault:(NSUserDefaults *)userDefaults
userDefault:(GULUserDefaults *)userDefaults
mainBundle:(NSBundle *)mainBundle NS_DESIGNATED_INITIALIZER;

- (instancetype)init NS_UNAVAILABLE;
Expand Down
6 changes: 4 additions & 2 deletions FirebaseAppCheck/Sources/Core/FIRAppCheckSettings.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

#import "FirebaseAppCheck/Sources/Core/FIRAppCheckSettings.h"

#import <GoogleUtilities/GULUserDefaults.h>

#import "FirebaseCore/Extension/FirebaseCoreInternal.h"

NS_ASSUME_NONNULL_BEGIN
Expand All @@ -28,7 +30,7 @@
@interface FIRAppCheckSettings ()

@property(nonatomic, weak, readonly) FIRApp *firebaseApp;
@property(nonatomic, readonly) NSUserDefaults *userDefaults;
@property(nonatomic, readonly) GULUserDefaults *userDefaults;
@property(nonatomic, readonly) NSBundle *mainBundle;
@property(nonatomic, readonly) NSString *userDefaultKey;
@property(nonatomic, assign) BOOL isTokenAutoRefreshConfigured;
Expand All @@ -38,7 +40,7 @@ @interface FIRAppCheckSettings ()
@implementation FIRAppCheckSettings

- (instancetype)initWithApp:(FIRApp *)firebaseApp
userDefault:(NSUserDefaults *)userDefaults
userDefault:(GULUserDefaults *)userDefaults
mainBundle:(NSBundle *)mainBundle {
self = [super init];
if (self) {
Expand Down
3 changes: 2 additions & 1 deletion FirebaseAppCheck/Tests/Unit/Core/FIRAppCheckSettingsTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#import <XCTest/XCTest.h>

#import <GoogleUtilities/GULUserDefaults.h>
#import <OCMock/OCMock.h>

#import "FirebaseAppCheck/Sources/Core/FIRAppCheckSettings.h"
Expand Down Expand Up @@ -46,7 +47,7 @@ - (void)setUp {

self.mockApp = OCMClassMock([FIRApp class]);
OCMStub([self.mockApp name]).andReturn(self.appName);
self.mockUserDefaults = OCMClassMock([NSUserDefaults class]);
self.mockUserDefaults = OCMClassMock([GULUserDefaults class]);
self.bundleMock = OCMClassMock([NSBundle class]);

self.settings = [[FIRAppCheckSettings alloc] initWithApp:self.mockApp
Expand Down
1 change: 1 addition & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1290,6 +1290,7 @@ let package = Package(
.product(name: "AppCheckCore", package: "app-check"),
.product(name: "FBLPromises", package: "Promises"),
.product(name: "GULEnvironment", package: "GoogleUtilities"),
.product(name: "GULUserDefaults", package: "GoogleUtilities"),
],
path: "FirebaseAppCheck/Sources",
publicHeadersPath: "Public",
Expand Down

0 comments on commit b6e5270

Please sign in to comment.