Skip to content

Luna-Exchange/icc-wrapped-android

Repository files navigation

ICC Recapped Android SDK

An Android SDK that provides a simple way to launch a web view in Android applications.


📜 Contents


🚀 Installation

1️⃣ Add the Dependency

Kotlin DSL

implementation("com.github.Luna-Exchange:icc-wrapped-android:x.x.x")

Groovy DSL

implementation 'com.github.Luna-Exchange:icc-wrapped-android:x.x.x'

Replace x.x.x with the latest version (1.0.11).

2️⃣ Configure settings.gradle

Kotlin DSL

dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven { url = uri("https://jitpack.io") }
    }
}

Groovy DSL

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
}

3️⃣ Sync the project

Run a Gradle sync in your Android project.


📲 Launching the SDK

When a user is authenticated

     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)

Delegate Sign-in to ICC

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 = {})
    }
}

Delegate Sign-in to ICC

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.

PHOTO-2025-02-27-16-03-15


🏗️ Launch Arguments

The SDK launch function accepts arguments:

User Data

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.

Environment

The Env enum is used to specify the SDK environment:

enum class Env {
    DEVELOPMENT,
    PRODUCTION
}

PS : Default envionment is DEVELOPMENT

**Stay in Game callback (onStayInGame) **

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.

**on Destroy called callback (onDestroyCalled) **

This callback when invoked notifies the caller that onDestroy has been called in the sdk and the sdk is about to close


Authentication Delegation

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,

  1. The signIn() function handles authentication and then launches the SDK with the user object.
  2. The onNavigateBack() function is triggered when the user presses back on the SDK.

Permissions

The SDK automatically requests for permissions if enabled it loads the ICC wrapped experience if it is not enabled it's forces the user to enable before launching the webview

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages