-
Notifications
You must be signed in to change notification settings - Fork 3
added requestIdToken #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
9ab1689
c5cafe2
5ca8c87
dda4b55
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -11,16 +11,32 @@ import com.izikode.izilib.roguin.helper.RoguinException | |||
| import com.izikode.izilib.roguin.helper.UserNotSignedInException | ||||
| import com.izikode.izilib.roguin.model.RoguinProfile | ||||
| import com.izikode.izilib.roguin.model.RoguinToken | ||||
| import android.content.pm.PackageManager | ||||
| import android.util.Log | ||||
|
|
||||
| class GoogleEndpoint( | ||||
|
|
||||
| private val roguinActivity: RoguinActivity | ||||
|
|
||||
| ) : RoguinEndpoint { | ||||
|
|
||||
| private var myApiKey: String? = null | ||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should remove this as it is only used internally in the initialization of the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. coz the local variable not accessibleout site try-catch block. thats y i declared that in globally |
||||
| private val googleClient by lazy { | ||||
|
|
||||
| try { | ||||
| val ai = nsSocialActivity.packageManager.getApplicationInfo(nsSocialActivity.packageName, PackageManager.GET_META_DATA) | ||||
| val bundle = ai.metaData | ||||
| myApiKey = bundle.getString("google_server_client_id") | ||||
| } catch (e: Exception) { | ||||
| Log.e( | ||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should wrap this log around a safe block for debug builds, like it is done on the Roguin/roguin/src/main/java/com/izikode/izilib/roguin/endpoint/TwitterEndpoint.kt Line 108 in c7619ff
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yep.will follow the same method as your code |
||||
| "RoguinActivity", | ||||
| "Dear developer. Don't forget to configure <meta-data android:name=\"google_server_client_id\" android:value=\"testValue\"/> in your AndroidManifest.xml file." | ||||
| ) | ||||
| } | ||||
|
|
||||
| val options = GoogleSignInOptions | ||||
| .Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) | ||||
| .requestIdToken(myApiKey) | ||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will this cause a problem on NULL apiKeys? |
||||
| .requestProfile() | ||||
| .requestEmail() | ||||
| .build() | ||||
|
|
||||
|
|
@@ -84,4 +100,4 @@ class GoogleEndpoint( | |||
|
|
||||
| } | ||||
|
|
||||
| } | ||||
| } | ||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right above this line, you can see the manifest placeholders I have created for any values that need to be in the manifest. With this
google_server_client_id, we should take the same approach, both for ease of use and consistency.Roguin/roguin/src/main/AndroidManifest.xml
Line 28 in c7619ff
See the above placeholder and follow the same approach. After that, the end user would just need to add another placeholder in their build file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep. thats nice