Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ android {
}
}
```
add google_cerver_client meta-data in application tag on your manifest file to get idToken for backend authentication
Copy link
Copy Markdown
Owner

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.

android:value="${twitter_api_secret}" />

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep. thats nice

<meta-data
android:name="google_server_client_id"
android:value="paste your google oAuth client clientID" />

#### 3. Extend RoguinActivity
Every social network SDK uses the ```startActivityForResult``` in one way or another. In the spirit of making stuff as easy as possible, Roguin provides a Base Activity class, ```RoguinActivity``` which handles registering, unregistering, request codes and the lot. Just extend in your Activities and you are done.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The 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 googleClient. A local variable is sufficient.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The 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(
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The 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 TwitterEndpoint.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The 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)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this cause a problem on NULL apiKeys?

.requestProfile()
.requestEmail()
.build()

Expand Down Expand Up @@ -84,4 +100,4 @@ class GoogleEndpoint(

}

}
}