Skip to content

Commit

Permalink
Changed google plus login to use the ios.gplus.clientId display prope…
Browse files Browse the repository at this point in the history
…rty for the client id instead of the value returned from GoogleConnect.getClientId so as not to conflict with web oauth settings. This change corresponds to a change on the build server that adds support for the ios.gplus.clientId build hint.
  • Loading branch information
shannah authored and codenameone committed Jul 22, 2015
1 parent a9d75c9 commit ecc9ce1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Ports/iOSPort/nativeSources/GoogleConnectImpl.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,14 @@ void com_codename1_impl_ios_IOSNative_googleLogin___java_lang_Object(CN1_THREAD_
if (googleLoginCallback == NULL) {
googleLoginCallback = instance;
GPPSignIn *signIn = [GPPSignIn sharedInstance];
signIn.clientID = toNSString(CN1_THREAD_STATE_PASS_ARG get_field_com_codename1_social_GoogleConnect_clientId(googleLoginCallback));
JAVA_OBJECT d = com_codename1_ui_Display_getInstance__(CN1_THREAD_GET_STATE_PASS_SINGLE_ARG);
JAVA_OBJECT jClientID = virtual_com_codename1_ui_Display_getProperty___java_lang_String_java_lang_String_R_java_lang_String(CN1_THREAD_STATE_PASS_ARG d, fromNSString(CN1_THREAD_STATE_PASS_ARG @"ios.gplus.clientId"), JAVA_NULL);
if (jClientID == JAVA_NULL) {
googleLoginCallback = NULL;
NSLog(@"Could not login to Google Plus because 'ios.gplus.clientId' property is not set. Ensure that the ios.gplus.clientId build hint is set");
return;
}
signIn.clientID = toNSString(CN1_THREAD_STATE_PASS_ARG jClientID);
NSString *scope = toNSString(CN1_THREAD_STATE_PASS_ARG get_field_com_codename1_social_GoogleConnect_scope(googleLoginCallback));

if (scope != nil) {
Expand Down Expand Up @@ -86,6 +93,7 @@ void com_codename1_impl_ios_GoogleConnectImpl_finishedWithAuth(GTMOAuth2Authenti
set_field_com_codename1_social_GoogleImpl_loginMessage(CN1_THREAD_GET_STATE_PASS_ARG JAVA_NULL, googleLoginCallback);
}
set_field_com_codename1_social_GoogleImpl_loginCompleted(CN1_THREAD_GET_STATE_PASS_ARG JAVA_TRUE, googleLoginCallback);
googleLoginCallback = NULL;
}


Expand Down

0 comments on commit ecc9ce1

Please sign in to comment.