An Android SDK that provides a simple way to launch a web view in Android applications.
Contents
- Steps to Install
- Wallet Creation Flow
- Authentication Flow
Steps to Install
- Add the dependency to your build.gradle.
Kotlin
implementation("com.github.Luna-Exchange:icc-fan-passport-android:x.x.x")
Groovy
implementation 'com.github.Luna-Exchange:icc-fan-passport-android:x.x.x
where x.x.x
is the latest version 1.0.16
- In settings.gradle
Kotlin
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Groovy
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
- Sync the project.
**Launch this SDK **
- When a user is authenticated.
IccFanPassportActivity.launch(this, user, onAuthenticate)
- When a user is not authenticated.
IccFanPassportActivity.launch(context = this, onAuthenticate = onAuthenticate)
To Delegate Sign in to ICC after Signin has been clicked on the SDK
val onAuthenticate = object : OnAuthenticate {
override fun signIn() {
val user = User(email, authToken, name)
IccFanPassportActivity.launch(this@MainActivity, user, onAuthenticate)
}
}
To Logout
IccFanPassportActivity.logOut(this)
Launch Arguments
This is a function that helps launch the SDK. It accepts optional arguments that include;
- context.
- user of type User.
- entryPoint of type Stringcan be obtained from the enum EntryPoint.
- environment of enum type Environment: To declare the environment.
- fantasyUri: URI to deep link into fantasy games. in the form
scheme:\\url
- predictorUri: URI to deep link into predictor games. in the form
scheme:\\url
- an interface helps with sign-in delegation when the user attempts to sign in to fanpassport.
EntryPoint
DEFAULT -> default web URL
CREATE_AVATAR -> Create avatar page
ONBOARDING -> Onboarding page
PROFILE -> Profile page
CHALLENGES -> Challenges page
REWARDS -> Rewards page
Environment DEVELOPMENT, PRODUCTION
Wallet Creation Flow
To create a wallet on a fan passport, click Create Wallet in the fan passport module, and an in-app browser is launched. After creating, when connect is clicked, it deep links back to the SDK, where the wallet creation flow IS complete.
- Add this to the host app's manifest.
<activity
android:name="com.insomnia.fanpassport.IccFanPassportActivity"
android:launchMode="singleTask"
android:exported="true">
</activity>
- Click on Create Wallet in the fan passport module, and an in-app browser is launched.
- after creating, when connect is clicked, the browser deep links into the SDK and the flow is completed.
Authentication Flow
This flow caters to users who use fan passports without getting authenticated via the ICC app. The expectation is that when calling the Sdk, an interface should be passed as an argument. e.g
val onAuthenticate = object : OnAuthenticate {
override fun signIn() {
//handles authentication
val param = SdkParam(user)
IccFanPassportActivity.launch(this@MainActivity, param, null)
}
}
In this interface, a signIn() function handles authentication and then calls the SDK with the user object, as shown above. Therefore, this flow is executed when sign-in is clicked on the WebView, and the user is authenticated on a fan passport.
Log Out
When log out is clicked on the ICC App, the function below is called, which ensures that the user will be logged out when the fan passport is opened.
IccFanPassportActivity.logOut(this)