An Android SDK that provides a simple way to launch a web view in Android applications.
implementation("com.github.Luna-Exchange:icc-wrapped-android:x.x.x")
implementation 'com.github.Luna-Exchange:icc-wrapped-android:x.x.x'
Replace x.x.x
with the latest version (1.0.11
).
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Run a Gradle sync in your Android project.
IccRecappedActivity.launch(context = this, user = user, env = Env.DEVELOPMENT, onStayInGame = {})
When a user is not authenticated, where onAuthenticate is a callback where ICC can login and relaunch the SDK again.
IccRecappedActivity.launch(context = this, env = Env.DEVELOPMENT, onStayInGame = {}, onAuthenticate = onAuthenticate)
If sign-in is required after clicking a enter recapped
button in the SDK, implement the OnAuthenticate
interface:
val onAuthenticate = object : OnAuthenticate {
override fun signIn() {
val user = User(email, authToken, name)
IccRecappedActivity.launch(this@MainActivity, user, onStayInGame = {})
}
}
onStayInGame
is a function passed into the sdk during initialization it gets invoked when the ICC recapped is completed and the user clicks on the ICC CRICKET
button as shown below.
The SDK launch function accepts arguments:
val userData = User(
token = "user_token",
name = "Your Name",
email = "[email protected]"
)
When the name or email of the user is not available, pass Your Name
in place of name
and [email protected]
in place of email
.
The Env
enum is used to specify the SDK environment:
enum class Env {
DEVELOPMENT,
PRODUCTION
}
PS : Default envionment is DEVELOPMENT
This callback when invoked closes the SDK and provides a callback that allows the SDK caller to navigate to another section of the ICC app after the recapped experience is completed.
This callback when invoked notifies the caller that onDestroy has been called in the sdk and the sdk is about to close
This interface helps with sign-in delegation when the user attempts to sign in via IccRecapped.
This applies to users who clicked the enter recapped
button on the WebView IccRecapped without being authenticated via the ICC app.
When calling the SDK, pass an authentication interface as an argument, handle sign in the document and launch the sdk again:
val onAuthenticate = object : OnAuthenticate {
override fun signIn() {
// call the sdk again with the user data as referenced above
IccRecappedActivity.launch(this@MainActivity, user, onStayInGame = {})
}
override fun onNavigateBack() {
// when on back pressed is called
}
}
In this interface,
- The
signIn()
function handles authentication and then launches the SDK with the user object. - The
onNavigateBack()
function is triggered when the user presses back on the SDK.
Permissions