Skip to content

Commit

Permalink
Merge pull request #150 from theLee3/fix-game-center-sign-in-hanging
Browse files Browse the repository at this point in the history
Add signInFailed check to prevent hanging on hot reload.
  • Loading branch information
theLee3 authored Jan 26, 2024
2 parents 5e59c2d + 7eba968 commit 0e842cb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 16 additions & 1 deletion games_services/darwin/Classes/Auth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,26 @@ import FlutterMacOS
#endif

class Auth: BaseGamesServices {

// track if previous sign in was cancelled (failed) for debugging
// this prevents hanging on `signIn` when hot reloading
#if DEBUG
var debugSignInFailed = false
#endif

func authenticateUser(result: @escaping FlutterResult) {
#if DEBUG
if (self.debugSignInFailed) {
result(PluginError.failedToAuthenticate.flutterError())
return
}
#endif
currentPlayer.authenticateHandler = { vc, error in
guard error == nil else {
result(error?.flutterError(code: .failedToAuthenticate))
#if DEBUG
self.debugSignInFailed = true
#endif
result(error!.flutterError(code: .failedToAuthenticate))
return
}
if let vc = vc {
Expand Down
2 changes: 1 addition & 1 deletion games_services/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: games_services
description: A new Flutter plugin to support game center and google play games services.
version: 4.0.0
version: 4.0.1
homepage: https://github.com/Abedalkareem/games_services
repository: https://github.com/Abedalkareem/games_services
issue_tracker: https://github.com/Abedalkareem/games_services/issues
Expand Down

0 comments on commit 0e842cb

Please sign in to comment.