-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial version for Attestr Kotlin Sample App
- Loading branch information
1 parent
efe6fb5
commit 032300c
Showing
85 changed files
with
2,142 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,89 @@ | ||
# Compiled class file | ||
# Built application files | ||
*.apk | ||
*.aar | ||
*.ap_ | ||
*.aab | ||
.idea/ | ||
# Files for the ART/Dalvik VM | ||
*.dex | ||
|
||
# Java class files | ||
*.class | ||
|
||
# Log file | ||
# Generated files | ||
bin/ | ||
gen/ | ||
out/ | ||
# Uncomment the following line in case you need and you don't have the release build type files in your app | ||
# release/ | ||
|
||
# Gradle files | ||
.gradle/ | ||
build/ | ||
|
||
# Local configuration file (sdk path, etc) | ||
local.properties | ||
|
||
# Proguard folder generated by Eclipse | ||
proguard/ | ||
|
||
# Log Files | ||
*.log | ||
|
||
# BlueJ files | ||
*.ctxt | ||
# Android Studio Navigation editor temp files | ||
.navigation/ | ||
|
||
# Android Studio captures folder | ||
captures/ | ||
|
||
# IntelliJ | ||
*.iml | ||
.idea/workspace.xml | ||
.idea/tasks.xml | ||
.idea/gradle.xml | ||
.idea/assetWizardSettings.xml | ||
.idea/dictionaries | ||
.idea/libraries | ||
.idea/jarRepositories.xml | ||
# Android Studio 3 in .gitignore file. | ||
.idea/caches | ||
.idea/modules.xml | ||
# Comment next line if keeping position of elements in Navigation Editor is relevant for you | ||
.idea/navEditor.xml | ||
|
||
# Keystore files | ||
# Uncomment the following lines if you do not want to check your keystore files in. | ||
#*.jks | ||
#*.keystore | ||
|
||
# External native build folder generated in Android Studio 2.2 and later | ||
.externalNativeBuild | ||
.cxx/ | ||
|
||
# Google Services (e.g. APIs or Firebase) | ||
# google-services.json | ||
|
||
# Freeline | ||
freeline.py | ||
freeline/ | ||
freeline_project_description.json | ||
|
||
# fastlane | ||
fastlane/report.xml | ||
fastlane/Preview.html | ||
fastlane/screenshots | ||
fastlane/test_output | ||
fastlane/readme.md | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
# Version control | ||
vcs.xml | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.nar | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
# lint | ||
lint/intermediates/ | ||
lint/generated/ | ||
lint/outputs/ | ||
lint/tmp/ | ||
# lint/reports/ | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
# Android Profiling | ||
*.hprof |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,91 @@ | ||
# kotlin-sample-app | ||
Attestr Kotlin Sample App For EKYC Flows | ||
# Attestr Android SDK | ||
|
||
![Platform](https://img.shields.io/badge/Android-3DDC84?style=for-the-badge&logo=android&logoColor=white) | ||
![GitHub](https://img.shields.io/github/license/attestr/kotlin-sample-app) | ||
![GitHub release (latest SemVer including pre-releases)](https://img.shields.io/github/v/release/attestr/kotlin-sample-app?include_prereleases) | ||
|
||
## Installation | ||
|
||
### Maven users | ||
|
||
Add this dependency to your project: | ||
|
||
```xml | ||
<dependency> | ||
<groupId>com.attestr</groupId> | ||
<artifactId>attestr-flowx</artifactId> | ||
<version>0.2.1</version> | ||
</dependency> | ||
``` | ||
|
||
### Gradle users | ||
|
||
Add this dependency to your project's build file: | ||
|
||
```groovy | ||
implementation "com.attestr:attestr-flowx:0.2.1" | ||
``` | ||
|
||
## Usage | ||
|
||
Create new object of AttestrFlowx | ||
|
||
```kotlin | ||
private var attestrFlowx: AttestrFlowx? = AttestrFlowx() | ||
``` | ||
|
||
Initialize AttestrFlowx with client_key, handshake_id & activity | ||
|
||
```kotlin | ||
/** | ||
* Initialises an instance of AttestrFlowx | ||
* @param cl Mandatory client key | ||
* @param hs Mandatory handshake key | ||
* @param activity Activity on which flow is to be rendered | ||
*/ | ||
attestrFlowx?.init(clientKey, handShakeID, this); | ||
``` | ||
|
||
Launch AttestrFlowx with locale, retry and queryParameters | ||
|
||
```kotlin | ||
/** | ||
* This function launches the flow with the following specifications | ||
* @param lc Mandatory language code eg. 'en' for English. | ||
* @param retry Mandatory parameter to set retry as true if re-running the flow for a previously used handshake. | ||
* @param qr Optional query parameters. | ||
*/ | ||
attestrFlowx?.launch(locale, retry, qr); | ||
``` | ||
|
||
Implement AttestrFlowXEventListener and define success, error and skip handlers | ||
|
||
```kotlin | ||
// Implement AttestrFlowXEventListener | ||
|
||
class MainActivity : AppCompatActivity(), AttestrFlowXListener { | ||
|
||
// Replace following with your own implementations | ||
override fun onFlowXComplete(map: Map<String?, Any>) { | ||
Toast.makeText(this, "Signature: " + map["signature"], Toast.LENGTH_SHORT).show() | ||
} | ||
|
||
override fun onFlowXSkip(map: Map<String?, Any?>?) { | ||
Toast.makeText(this, "Flow skipped", Toast.LENGTH_SHORT).show() | ||
} | ||
|
||
override fun onFlowXError(map: Map<String?, Any?>) { | ||
val errorMessage = map["message"] as String? | ||
Toast.makeText(this, "Error : $errorMessage", Toast.LENGTH_SHORT).show() | ||
} | ||
} | ||
``` | ||
|
||
## Version Compatibility | ||
Built for Android API 21+ (Lollipop onwards) | ||
|
||
## License | ||
attestr-android-sdk is distributed under MIT license. Read more in the [LICENSE](LICENSE) file. | ||
|
||
## Contact Us | ||
Write to us at [[email protected]](mailto:[email protected]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
plugins { | ||
id 'com.android.application' | ||
id 'kotlin-android' | ||
} | ||
|
||
android { | ||
compileSdk 31 | ||
|
||
defaultConfig { | ||
applicationId "com.example.attestrapp" | ||
minSdk 21 | ||
targetSdk 31 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
kotlinOptions { | ||
jvmTarget = '1.8' | ||
} | ||
buildFeatures { | ||
viewBinding = true | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation 'androidx.appcompat:appcompat:1.3.1' | ||
implementation 'com.google.android.material:material:1.4.0' | ||
implementation 'androidx.constraintlayout:constraintlayout:2.1.0' | ||
implementation "com.attestr:attestr-flowx:0.2.1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
24 changes: 24 additions & 0 deletions
24
app/src/androidTest/java/com/example/attestrapp/ExampleInstrumentedTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.example.attestrapp | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
import org.junit.Assert.* | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* See [testing documentation](http://d.android.com/tools/testing). | ||
*/ | ||
@RunWith(AndroidJUnit4::class) | ||
class ExampleInstrumentedTest { | ||
@Test | ||
fun useAppContext() { | ||
// Context of the app under test. | ||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext | ||
assertEquals("com.example.attestrapp", appContext.packageName) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
package="com.example.attestrapp"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.AttestrSampleApp" | ||
tools:replace="android:theme"> | ||
<activity | ||
android:name=".SplashActivity" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity | ||
android:name=".MainActivity" | ||
android:exported="true"/> | ||
</application> | ||
|
||
</manifest> |
Oops, something went wrong.