diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 67c9fd09..ee34bd27 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -36,7 +36,7 @@ jobs: # See #400 (https://github.com/google/GoogleSignIn-iOS/issues/400) run: | pod lib lint ${{ matrix.podspec }} --verbose \ - ${{ matrix.includePodspecFlag }} ${{ matrix.flag }} + ${{ matrix.includePodspecFlag }} ${{ matrix.flag }} --sources=https://github.com/firebase/SpecsDev.git,https://github.com/firebase/SpecsStaging.git,https://cdn.cocoapods.org/ spm-build-test: runs-on: ${{ matrix.os }} strategy: diff --git a/GoogleSignIn.podspec b/GoogleSignIn.podspec index 742534cd..5ebd148b 100644 --- a/GoogleSignIn.podspec +++ b/GoogleSignIn.podspec @@ -33,7 +33,7 @@ The Google Sign-In SDK allows users to sign in with their Google account from th ] s.ios.framework = 'UIKit' s.osx.framework = 'AppKit' - s.dependency 'AppCheckCore', '~> 11.0' + s.dependency 'AppCheckCore', '~> 12.0' s.dependency 'AppAuth', '~> 3.0' s.dependency 'GTMAppAuth', '~> 6.0' s.dependency 'GTMSessionFetcher/Core', '>= 3.3', '< 6.0' diff --git a/GoogleSignIn/Sources/GIDAppCheck/Implementations/Fake/GIDAppCheckProviderFake.h b/GoogleSignIn/Sources/GIDAppCheck/Implementations/Fake/GIDAppCheckProviderFake.h index e294273f..5a862c16 100644 --- a/GoogleSignIn/Sources/GIDAppCheck/Implementations/Fake/GIDAppCheckProviderFake.h +++ b/GoogleSignIn/Sources/GIDAppCheck/Implementations/Fake/GIDAppCheckProviderFake.h @@ -16,7 +16,7 @@ #import #if TARGET_OS_IOS && !TARGET_OS_MACCATALYST -#import +@import AppCheckCore; @class GACAppCheckToken; diff --git a/GoogleSignIn/Sources/GIDAppCheck/Implementations/Fake/GIDAppCheckProviderFake.m b/GoogleSignIn/Sources/GIDAppCheck/Implementations/Fake/GIDAppCheckProviderFake.m index 903fc3ff..44e54692 100644 --- a/GoogleSignIn/Sources/GIDAppCheck/Implementations/Fake/GIDAppCheckProviderFake.m +++ b/GoogleSignIn/Sources/GIDAppCheck/Implementations/Fake/GIDAppCheckProviderFake.m @@ -16,7 +16,7 @@ #if TARGET_OS_IOS && !TARGET_OS_MACCATALYST -#import +@import AppCheckCore; NSUInteger const kGIDAppCheckProviderFakeError = 1; diff --git a/GoogleSignIn/Sources/GIDAppCheck/Implementations/GIDAppCheck.m b/GoogleSignIn/Sources/GIDAppCheck/Implementations/GIDAppCheck.m index a886eec4..58296beb 100644 --- a/GoogleSignIn/Sources/GIDAppCheck/Implementations/GIDAppCheck.m +++ b/GoogleSignIn/Sources/GIDAppCheck/Implementations/GIDAppCheck.m @@ -18,11 +18,7 @@ #if TARGET_OS_IOS && !TARGET_OS_MACCATALYST -#import -#import -#import -#import -#import +@import AppCheckCore; #import "GoogleSignIn/Sources/GIDAppCheck/Implementations/GIDAppCheck.h" #import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDAppCheckError.h" @@ -117,13 +113,7 @@ - (void)prepareForAppCheckWithCompletion:(nullable GIDAppCheckPrepareCompletion) [self.appCheck limitedUseTokenWithCompletion:^(GACAppCheckTokenResult * _Nonnull result) { NSError * __block maybeError = result.error; @synchronized (self) { - if (!result.token && !result.error) { - maybeError = [NSError errorWithDomain:kGIDAppCheckErrorDomain - code:kGIDAppCheckUnexpectedError - userInfo:nil]; - } - - if (result.token) { + if (!result.error) { [self.userDefaults setBool:YES forKey:kGIDAppCheckPreparedKey]; } @@ -143,7 +133,7 @@ - (void)prepareForAppCheckWithCompletion:(nullable GIDAppCheckPrepareCompletion) - (void)getLimitedUseTokenWithCompletion:(nullable GIDAppCheckTokenCompletion)completion { dispatch_async(self.workerQueue, ^{ [self.appCheck limitedUseTokenWithCompletion:^(GACAppCheckTokenResult * _Nonnull result) { - if (result.token) { + if (!result.error) { [self.userDefaults setBool:YES forKey:kGIDAppCheckPreparedKey]; } if (completion) { diff --git a/GoogleSignIn/Sources/GIDSignIn.m b/GoogleSignIn/Sources/GIDSignIn.m index abbb803e..f3ca57da 100644 --- a/GoogleSignIn/Sources/GIDSignIn.m +++ b/GoogleSignIn/Sources/GIDSignIn.m @@ -30,7 +30,7 @@ #import "GoogleSignIn/Sources/GIDSignInCallbackSchemes.h" #import "GoogleSignIn/Sources/GIDClaimsInternalOptions.h" #if TARGET_OS_IOS && !TARGET_OS_MACCATALYST -#import +@import AppCheckCore; #import "GoogleSignIn/Sources/GIDAppCheck/Implementations/GIDAppCheck.h" #import "GoogleSignIn/Sources/GIDAppCheck/UI/GIDActivityIndicatorViewController.h" #import "GoogleSignIn/Sources/GIDEMMErrorHandler.h" diff --git a/GoogleSignIn/Tests/Unit/GIDAppCheckTest.m b/GoogleSignIn/Tests/Unit/GIDAppCheckTest.m index 7c0610ae..61e0624e 100644 --- a/GoogleSignIn/Tests/Unit/GIDAppCheckTest.m +++ b/GoogleSignIn/Tests/Unit/GIDAppCheckTest.m @@ -17,7 +17,7 @@ #if TARGET_OS_IOS && !TARGET_OS_MACCATALYST #import -#import +@import AppCheckCore; #import "GoogleSignIn/Sources/GIDAppCheck/Implementations/GIDAppCheck.h" #import "GoogleSignIn/Sources/GIDAppCheck/Implementations/Fake/GIDAppCheckProviderFake.h" #import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDAppCheckError.h" diff --git a/GoogleSignIn/Tests/Unit/GIDSignInTest.m b/GoogleSignIn/Tests/Unit/GIDSignInTest.m index ed959f12..658311a2 100644 --- a/GoogleSignIn/Tests/Unit/GIDSignInTest.m +++ b/GoogleSignIn/Tests/Unit/GIDSignInTest.m @@ -35,7 +35,7 @@ #import "GoogleSignIn/Sources/GIDClaimsInternalOptions.h" #if TARGET_OS_IOS && !TARGET_OS_MACCATALYST -#import +@import AppCheckCore; #import "GoogleSignIn/Sources/GIDAppCheck/Implementations/GIDAppCheck.h" #import "GoogleSignIn/Sources/GIDAppCheck/Implementations/Fake/GIDAppCheckProviderFake.h" #import "GoogleSignIn/Sources/GIDEMMErrorHandler.h" @@ -426,8 +426,11 @@ - (void)testConfigureFailsNoTokenOrError { XCTestExpectation *configureFailsExpecation = [self expectationWithDescription:@"Configure fails expectation"]; + NSError *expectedError = [NSError errorWithDomain:kGIDAppCheckErrorDomain + code:kGIDAppCheckUnexpectedError + userInfo:nil]; GIDAppCheckProviderFake *fakeProvider = - [[GIDAppCheckProviderFake alloc] initWithAppCheckToken:nil error:nil]; + [[GIDAppCheckProviderFake alloc] initWithAppCheckToken:nil error:expectedError]; GIDAppCheck *appCheck = [[GIDAppCheck alloc] initWithAppCheckProvider:fakeProvider userDefaults:_testUserDefaults]; diff --git a/Package.swift b/Package.swift index bad348a0..119f7842 100644 --- a/Package.swift +++ b/Package.swift @@ -44,9 +44,10 @@ let package = Package( .package( url: "https://github.com/openid/AppAuth-iOS.git", from: "3.0.0"), - .package( - url: "https://github.com/google/app-check.git", - from: "11.0.0"), +// .package( +// url: "https://github.com/google/app-check.git", +// from: "11.0.0"), + .package(url: "https://github.com/google/app-check.git", branch: "pb-swift"), .package( url: "https://github.com/google/GTMAppAuth.git", from: "6.0.0"),