diff --git a/staging/native/src/android/google_signin.cc b/staging/native/src/android/google_signin.cc index bf54f4b3..f266d402 100644 --- a/staging/native/src/android/google_signin.cc +++ b/staging/native/src/android/google_signin.cc @@ -223,10 +223,6 @@ void GoogleSignIn::GoogleSignInImpl::Configure( delete current_configuration_; current_configuration_ = new Configuration(configuration); - if (configuration.web_client_id) { - current_configuration_->web_client_id = strdup(configuration.web_client_id); - } - delete current_result_; current_result_ = new GoogleSignInFuture(); @@ -241,26 +237,24 @@ void GoogleSignIn::GoogleSignInImpl::CallConfigure() { return; } jstring j_web_client_id = - current_configuration_->web_client_id - ? env->NewStringUTF(current_configuration_->web_client_id) - : nullptr; + current_configuration_->web_client_id.empty() ? nullptr + : env->NewStringUTF(current_configuration_->web_client_id.c_str()); jstring j_account_name = - current_configuration_->account_name - ? env->NewStringUTF(current_configuration_->account_name) - : nullptr; + current_configuration_->account_name.empty() ? nullptr + : env->NewStringUTF(current_configuration_->account_name.c_str()); jobjectArray j_auth_scopes = nullptr; - if (current_configuration_->additional_scope_count > 0) { + if (current_configuration_->additional_scopes.size() > 0) { jclass string_clazz = jni_.FindClass("java/lang/String"); j_auth_scopes = env->NewObjectArray( - current_configuration_->additional_scope_count, string_clazz, nullptr); + current_configuration_->additional_scopes.size(), string_clazz, nullptr); - for (int i = 0; i < current_configuration_->additional_scope_count; i++) { + for (int i = 0; i < current_configuration_->additional_scopes.size(); i++) { env->SetObjectArrayElement( j_auth_scopes, i, - env->NewStringUTF(current_configuration_->additional_scopes[i])); + env->NewStringUTF(current_configuration_->additional_scopes[i].c_str())); } env->DeleteLocalRef(string_clazz); } diff --git a/staging/native/src/include/google_signin.h b/staging/native/src/include/google_signin.h index 9b97edf0..abd45072 100644 --- a/staging/native/src/include/google_signin.h +++ b/staging/native/src/include/google_signin.h @@ -15,6 +15,9 @@ #ifndef GOOGLE_SIGNIN_GOOGLESIGNIN_H // NOLINT #define GOOGLE_SIGNIN_GOOGLESIGNIN_H +#include +#include + #include "future.h" // NOLINT #include "google_signin_user.h" // NOLINT @@ -91,7 +94,7 @@ class GoogleSignIn { /// games signing only works on Android. bool use_game_signin; /// Web client id associated with this app. - const char *web_client_id; + std::string web_client_id; /// true for getting an auth code when authenticating. /// Note: This may trigger re-consent on iOS. Ideally, this /// is set to true once, and the result sent to the server where the @@ -108,9 +111,9 @@ class GoogleSignIn { /// recommended for VR applications. bool hide_ui_popups; /// account name to use when authenticating, null indicates use default. - const char *account_name; + std::string account_name; /// additional scopes to request, requires consent. - const char **additional_scopes; + std::vector additional_scopes; int additional_scope_count; Configuration(Configuration const ©) = default;