2727
2828// These values are in the Unity plugin code. The iOS specific
2929// codes are mapped to these.
30- static const int kStatusCodeSuccessCached = -1 ;
31- static const int kStatusCodeSuccess = 0 ;
32- static const int kStatusCodeApiNotConnected = 1 ;
33- static const int kStatusCodeCanceled = 2 ;
34- static const int kStatusCodeInterrupted = 3 ;
35- static const int kStatusCodeInvalidAccount = 4 ;
36- static const int kStatusCodeTimeout = 5 ;
37- static const int kStatusCodeDeveloperError = 6 ;
38- static const int kStatusCodeInternalError = 7 ;
39- static const int kStatusCodeNetworkError = 8 ;
40- static const int kStatusCodeError = 9 ;
30+ static const int g_StatusCode_SUCCESS_CACHE = -1 ;
31+ static const int g_StatusCode_SUCCESS = 0 ;
32+ static const int g_StatusCode_SIGN_IN_REQUIRED = 4 ;
33+ static const int g_StatusCode_INVALID_ACCOUNT = 5 ;
34+ static const int g_StatusCode_RESOLUTION_REQUIRED = 6 ;
35+ static const int g_StatusCode_NETWORK_ERROR = 7 ;
36+ static const int g_StatusCode_INTERNAL_ERROR = 8 ;
37+ static const int g_StatusCode_SERVICE_INVALID = 9 ;
38+ static const int g_StatusCode_DEVELOPER_ERROR = 10 ;
39+ static const int g_StatusCode_LICENSE_CHECK_FAILED = 11 ;
40+ static const int g_StatusCode_ERROR = 13 ;
41+ static const int g_StatusCode_INTERRUPTED = 14 ;
42+ static const int g_StatusCode_TIMEOUT = 15 ;
43+ static const int g_StatusCode_CANCELED = 16 ;
44+ static const int g_StatusCode_API_NOT_CONNECTED = 17 ;
45+ static const int g_StatusCode_DEAD_CLIENT = 18 ;
46+ static const int g_StatusCode_REMOTE_EXCEPTION = 19 ;
47+ static const int g_StatusCode_CONNECTION_SUSPENDED_DURING_CALL = 20 ;
48+ static const int g_StatusCode_RECONNECTION_TIMED_OUT_DURING_UPDATE = 21 ;
49+ static const int g_StatusCode_RECONNECTION_TIMED_OUT = 22 ;
4150
4251/* *
4352 * Helper method to pause the Unity player. This is done when showing any UI.
@@ -107,7 +116,7 @@ - (void)signIn:(GIDSignIn *)signIn
107116 withError : (NSError *)_error {
108117 if (_error == nil ) {
109118 if (currentResult_) {
110- currentResult_->result_code = kStatusCodeSuccess ;
119+ currentResult_->result_code = g_StatusCode_SUCCESS ;
111120 currentResult_->finished = true ;
112121 } else {
113122 NSLog (@" No currentResult to set status on!" );
@@ -118,21 +127,30 @@ - (void)signIn:(GIDSignIn *)signIn
118127 if (currentResult_) {
119128 switch (_error.code ) {
120129 case kGIDSignInErrorCodeUnknown :
121- currentResult_->result_code = kStatusCodeError ;
130+ currentResult_->result_code = g_StatusCode_INTERNAL_ERROR ;
122131 break ;
123132 case kGIDSignInErrorCodeKeychain :
124- currentResult_->result_code = kStatusCodeInternalError ;
133+ currentResult_->result_code = g_StatusCode_SERVICE_INVALID ;
125134 break ;
126135 case kGIDSignInErrorCodeHasNoAuthInKeychain :
127- currentResult_->result_code = kStatusCodeError ;
136+ currentResult_->result_code = g_StatusCode_SIGN_IN_REQUIRED ;
128137 break ;
129138 case kGIDSignInErrorCodeCanceled :
130- currentResult_->result_code = kStatusCodeCanceled ;
139+ currentResult_->result_code = g_StatusCode_CANCELED;
140+ break ;
141+ case kGIDSignInErrorCodeEMM :
142+ currentResult_->result_code = g_StatusCode_API_NOT_CONNECTED;
143+ break ;
144+ case kGIDSignInErrorCodeScopesAlreadyGranted :
145+ currentResult_->result_code = g_StatusCode_RESOLUTION_REQUIRED;
146+ break ;
147+ case kGIDSignInErrorCodeMismatchWithCurrentUser :
148+ currentResult_->result_code = g_StatusCode_INVALID_ACCOUNT;
131149 break ;
132150 default :
133151 NSLog (@" Unmapped error code: %ld , returning Error" ,
134152 static_cast <long >(_error.code));
135- currentResult_->result_code = kStatusCodeError ;
153+ currentResult_->result_code = g_StatusCode_ERROR ;
136154 }
137155
138156 currentResult_->finished = true ;
@@ -217,7 +235,7 @@ bool GoogleSignIn_Configure(void *unused, bool useGameSignIn,
217235 [resultLock lock ];
218236 if (!currentResult_ || currentResult_->finished ) {
219237 currentResult_.reset (new SignInResult ());
220- currentResult_->result_code = 0 ;
238+ currentResult_->result_code = g_StatusCode_NETWORK_ERROR ;
221239 currentResult_->finished = false ;
222240 } else {
223241 busy = true ;
@@ -228,7 +246,7 @@ bool GoogleSignIn_Configure(void *unused, bool useGameSignIn,
228246 NSLog (@" ERROR: There is already a pending sign-in operation." );
229247 // Returned to the caller, should be deleted by calling
230248 // GoogleSignIn_DisposeFuture().
231- return new SignInResult{.result_code = kStatusCodeDeveloperError ,
249+ return new SignInResult{.result_code = g_StatusCode_DEVELOPER_ERROR ,
232250 .finished = true };
233251 }
234252 return nullptr ;
@@ -299,7 +317,7 @@ int GoogleSignIn_Status(SignInResult *result) {
299317 if (result) {
300318 return result->result_code ;
301319 }
302- return kStatusCodeDeveloperError ;
320+ return g_StatusCode_DEAD_CLIENT ;
303321}
304322
305323void GoogleSignIn_DisposeFuture (SignInResult *result) {
0 commit comments