diff --git a/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md b/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md index 6a0cd9dc4ff..fa290a057d8 100644 --- a/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md @@ -1,3 +1,8 @@ +## 6.0.1 + +* Returns configuration errors as `PlatformException`s in Dart instead of + crashing the app. + ## 6.0.0 * **BREAKING CHANGE**: Switches to implementing version 3.0 of the platform diff --git a/packages/google_sign_in/google_sign_in_ios/darwin/Tests/GoogleSignInTests.m b/packages/google_sign_in/google_sign_in_ios/darwin/Tests/GoogleSignInTests.m index fa33c254ca6..d80c161d1c4 100644 --- a/packages/google_sign_in/google_sign_in_ios/darwin/Tests/GoogleSignInTests.m +++ b/packages/google_sign_in/google_sign_in_ios/darwin/Tests/GoogleSignInTests.m @@ -371,26 +371,26 @@ - (void)testSignInError { [self waitForExpectationsWithTimeout:5.0 handler:nil]; } -- (void)testSignInException { +- (void)testSignInExceptionReturnsError { OCMExpect([self configureMock:self.mockSignIn forSignInWithHint:OCMOCK_ANY additionalScopes:OCMOCK_ANY completion:OCMOCK_ANY]) .andThrow([NSException exceptionWithName:@"MockName" reason:@"MockReason" userInfo:nil]); - __block FlutterError *error; - XCTAssertThrows([self.plugin - signInWithScopeHint:@[] - nonce:nil - completion:^(FSISignInResult *result, FlutterError *signInError) { - // Unexpected errors, such as runtime exceptions, are returned as FlutterError. - XCTAssertNil(result); - error = signInError; - }]); - - XCTAssertEqualObjects(error.code, @"google_sign_in"); - XCTAssertEqualObjects(error.message, @"MockReason"); - XCTAssertEqualObjects(error.details, @"MockName"); + XCTestExpectation *expectation = [self expectationWithDescription:@"completion called"]; + [self.plugin signInWithScopeHint:@[] + nonce:nil + completion:^(FSISignInResult *result, FlutterError *error) { + // Unexpected errors, such as runtime exceptions, are returned as + // FlutterError. + XCTAssertNil(result); + XCTAssertEqualObjects(error.code, @"google_sign_in"); + XCTAssertEqualObjects(error.message, @"MockReason"); + XCTAssertEqualObjects(error.details, @"MockName"); + [expectation fulfill]; + }]; + [self waitForExpectationsWithTimeout:5.0 handler:nil]; } #pragma mark - refreshedAuthorizationTokens diff --git a/packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios/Sources/google_sign_in_ios/FLTGoogleSignInPlugin.m b/packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios/Sources/google_sign_in_ios/FLTGoogleSignInPlugin.m index 5412429662c..07c392e0771 100644 --- a/packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios/Sources/google_sign_in_ios/FLTGoogleSignInPlugin.m +++ b/packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios/Sources/google_sign_in_ios/FLTGoogleSignInPlugin.m @@ -196,7 +196,6 @@ - (void)signInWithScopeHint:(NSArray *)scopeHint }]; } @catch (NSException *e) { completion(nil, [FlutterError errorWithCode:@"google_sign_in" message:e.reason details:e.name]); - [e raise]; } } diff --git a/packages/google_sign_in/google_sign_in_ios/pubspec.yaml b/packages/google_sign_in/google_sign_in_ios/pubspec.yaml index 6e5cb025024..f38a2eb2c77 100644 --- a/packages/google_sign_in/google_sign_in_ios/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_ios/pubspec.yaml @@ -2,7 +2,7 @@ name: google_sign_in_ios description: iOS implementation of the google_sign_in plugin. repository: https://github.com/flutter/packages/tree/main/packages/google_sign_in/google_sign_in_ios issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22 -version: 6.0.0 +version: 6.0.1 environment: sdk: ^3.6.0