[MWA-5012] MetaPlugin-Integration-Demo aktualisieren
This commit is contained in:
parent
5bbcb07a23
commit
84b52bef47
@ -4,14 +4,14 @@ plugins {
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk 34
|
||||
compileSdk 35
|
||||
|
||||
namespace "de.webidsolutions.metaplugindemo"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "de.webidsolutions.metaplugindemo"
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 34
|
||||
minSdkVersion 28
|
||||
targetSdkVersion 35
|
||||
versionCode 1
|
||||
versionName "1.0.0"
|
||||
|
||||
@ -62,7 +62,7 @@ dependencies {
|
||||
// webid product-plugin
|
||||
//noinspection GradleDependency
|
||||
|
||||
def product_catalog_version = "13.4.3"
|
||||
def product_catalog_version = "15.0.0"
|
||||
implementation ("de.webid-solutions:android_meta_plugin:$product_catalog_version") {
|
||||
changing = true
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
package de.webidsolutions.metaplugindemo
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.widget.Button
|
||||
import android.widget.CheckBox
|
||||
@ -14,6 +15,7 @@ import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import de.webidsolutions.auto_ident_on_server_product_plugin.AutoIdentOnServerProductPlugin
|
||||
import de.webidsolutions.eid_on_server_product_plugin.EIdOnServerProductPlugin
|
||||
import de.webidsolutions.meta_plugin.EMetaPluginFailReason
|
||||
import de.webidsolutions.meta_plugin.WebIdMetaPlugin
|
||||
import de.webidsolutions.metaplugindemo.tasks.EApiResult
|
||||
import de.webidsolutions.metaplugindemo.tasks.MetaPluginVerifyTask
|
||||
@ -22,8 +24,16 @@ import de.webidsolutions.mobile_app.sdk.WebIdSdkEnvironment
|
||||
import de.webidsolutions.mobile_app.sdk.domain.VerifyActionIdResult
|
||||
import de.webidsolutions.mobile_app.sdk.impl.AsyncTaskResultGeneric
|
||||
import de.webidsolutions.pay_on_server_product_plugin.PayOnServerProductPlugin
|
||||
import de.webidsolutions.plugin_core.EProductPluginErrors
|
||||
import de.webidsolutions.plugin_core.IEPluginError
|
||||
import de.webidsolutions.plugin_core.IProductPluginWebId
|
||||
import de.webidsolutions.plugin_core.IProductPluginWebId.Companion.getProductPluginResult
|
||||
import de.webidsolutions.plugin_core.ProductPluginErrorResult
|
||||
import de.webidsolutions.plugin_core.ProductPluginResult
|
||||
import de.webidsolutions.plugin_core.WebIdPluginInterruptedException
|
||||
import de.webidsolutions.video_ident.plugin.videocall.VideoOptionsConfig
|
||||
import de.webidsolutions.video_ident_product_plugin.EVideoIdentProductPluginFailReasons
|
||||
import de.webidsolutions.video_ident_product_plugin.VideoIdentProductPlugin
|
||||
import java.lang.Integer.parseInt
|
||||
import java.net.URI
|
||||
|
||||
@ -35,7 +45,7 @@ private val config = VideoOptionsConfig(
|
||||
)
|
||||
|
||||
// TODO insert your Action id
|
||||
private const val actionId = "279945707"
|
||||
private const val actionId = "<9_digit_webid_transaction_id>"
|
||||
|
||||
// TODO choose your environment
|
||||
private val chosenEnvironment: EWebIDEnv = EWebIDEnv.TEST
|
||||
@ -49,6 +59,7 @@ internal class MainActivity : AppCompatActivity() {
|
||||
private lateinit var eidOnServerPluginCb: CheckBox
|
||||
private lateinit var payOnServerPluginCb: CheckBox
|
||||
private lateinit var autoIdOnServerPluginCb: CheckBox
|
||||
private lateinit var videoPluginCb: CheckBox
|
||||
private lateinit var textLog: TextView
|
||||
private lateinit var startButton: Button
|
||||
|
||||
@ -63,6 +74,7 @@ internal class MainActivity : AppCompatActivity() {
|
||||
autoIdOnServerPluginCb = findViewById(R.id.cb_plugin_auto_id_on_server)
|
||||
payOnServerPluginCb = findViewById(R.id.cb_plugin_pay_on_server)
|
||||
eidOnServerPluginCb = findViewById(R.id.cb_plugin_eid_on_server)
|
||||
videoPluginCb = findViewById(R.id.cb_plugin_video)
|
||||
|
||||
startButton = findViewById(R.id.startButton)
|
||||
startButton.setOnClickListener {
|
||||
@ -101,8 +113,7 @@ internal class MainActivity : AppCompatActivity() {
|
||||
username,
|
||||
apiKey,
|
||||
this.applicationContext,
|
||||
selectProductPlugins,
|
||||
config
|
||||
selectProductPlugins
|
||||
)
|
||||
MetaPluginVerifyTask(metaPlugin)
|
||||
.setOnPostExecuteCallback(metaPluginVerifyCallback(metaPlugin))
|
||||
@ -137,6 +148,7 @@ internal class MainActivity : AppCompatActivity() {
|
||||
if (autoIdOnServerPluginCb.isChecked) AutoIdentOnServerProductPlugin() else null,
|
||||
if (payOnServerPluginCb.isChecked) PayOnServerProductPlugin() else null,
|
||||
if (eidOnServerPluginCb.isChecked) EIdOnServerProductPlugin() else null,
|
||||
if (videoPluginCb.isChecked) VideoIdentProductPlugin(config) else null,
|
||||
)
|
||||
)
|
||||
}
|
||||
@ -162,14 +174,62 @@ internal class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun onPluginResultCallback(result: ActivityResult?) {
|
||||
var metaPluginActivityResult = result
|
||||
|
||||
private fun onPluginResultCallback(activityResult: ActivityResult) {
|
||||
var metaPluginActivityResult = activityResult
|
||||
var result: String?
|
||||
try {
|
||||
// Get data and handle potential null case
|
||||
// If data is null, plugin was interrupted
|
||||
val data: Intent = activityResult.data ?: throw WebIdPluginInterruptedException()
|
||||
// Retrieve the plugin result and handle any errors
|
||||
val pluginResult: ProductPluginResult<*> = getProductPluginResult<IEPluginError>(
|
||||
data, activityResult.resultCode
|
||||
)
|
||||
val resultInfo: String? = pluginResult.info
|
||||
val failReason: ProductPluginErrorResult<*>? = pluginResult.error
|
||||
// Successful plugin execution
|
||||
if (failReason == null) {
|
||||
result = "Success"
|
||||
if (resultInfo != null) {
|
||||
result += " $resultInfo"
|
||||
// your code to handle the successful plugin execution
|
||||
}
|
||||
} else {
|
||||
// failure case
|
||||
if (failReason.specificResult != null) {
|
||||
val specificResult: IEPluginError? =
|
||||
failReason.specificResult as IEPluginError?
|
||||
// handle EMetaPluginFailReason
|
||||
if (specificResult is EMetaPluginFailReason) {
|
||||
if (specificResult == EMetaPluginFailReason.EID_PENDING_AUTHADA) {
|
||||
// handle EID_PENDING_AUTHADA as described in code documentation
|
||||
} else {
|
||||
// handle all other EMetaPluginFailReason as described in code documentation
|
||||
}
|
||||
} else {
|
||||
// handle EVideoIdentProductPluginFailReasons
|
||||
if (specificResult is EVideoIdentProductPluginFailReasons) {
|
||||
if (specificResult == EVideoIdentProductPluginFailReasons.CALL_CENTER_CLOSED) {
|
||||
// handle CALL_CENTER_CLOSED as described in code documentation
|
||||
} else {
|
||||
// handle all other EVideoIdentProductPluginFailReasons errors as described in the code documentation
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (failReason.genericResult == EProductPluginErrors.UNKNOWN) {
|
||||
// handle UNKNOWN as described in code documentation
|
||||
} else {
|
||||
// handle all other EProductPluginErrors errors as described in the code documentation
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e: WebIdPluginInterruptedException) {
|
||||
// Handle interruption in your preferred way
|
||||
writeLog(e.toString())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* MISC */
|
||||
|
||||
/**
|
||||
|
@ -4,6 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<TextView
|
||||
@ -51,8 +52,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:text="VideoId"
|
||||
android:checked="true"
|
||||
android:clickable="false"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/cb_plugin_eid_on_server" />
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user