[MWA-5012] MetaPlugin-Integration-Demo aktualisieren
This commit is contained in:
parent
183eb583eb
commit
2f66be046b
@ -4,14 +4,14 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdk 34
|
compileSdk 35
|
||||||
|
|
||||||
namespace "de.webidsolutions.metaplugindemo"
|
namespace "de.webidsolutions.metaplugindemo"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "de.webidsolutions.metaplugindemo"
|
applicationId "de.webidsolutions.metaplugindemo"
|
||||||
minSdkVersion 28
|
minSdkVersion 28
|
||||||
targetSdkVersion 34
|
targetSdkVersion 35
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0.0"
|
versionName "1.0.0"
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ import androidx.activity.result.contract.ActivityResultContracts
|
|||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import de.webidsolutions.auto_ident_on_server_product_plugin.AutoIdentOnServerProductPlugin
|
import de.webidsolutions.auto_ident_on_server_product_plugin.AutoIdentOnServerProductPlugin
|
||||||
import de.webidsolutions.eid_on_server_product_plugin.EIdOnServerProductPlugin
|
import de.webidsolutions.eid_on_server_product_plugin.EIdOnServerProductPlugin
|
||||||
|
import de.webidsolutions.meta_plugin.EMetaPluginFailReason
|
||||||
import de.webidsolutions.meta_plugin.WebIdMetaPlugin
|
import de.webidsolutions.meta_plugin.WebIdMetaPlugin
|
||||||
import de.webidsolutions.metaplugindemo.tasks.EApiResult
|
import de.webidsolutions.metaplugindemo.tasks.EApiResult
|
||||||
import de.webidsolutions.metaplugindemo.tasks.MetaPluginVerifyTask
|
import de.webidsolutions.metaplugindemo.tasks.MetaPluginVerifyTask
|
||||||
@ -23,12 +24,15 @@ import de.webidsolutions.mobile_app.sdk.WebIdSdkEnvironment
|
|||||||
import de.webidsolutions.mobile_app.sdk.domain.VerifyActionIdResult
|
import de.webidsolutions.mobile_app.sdk.domain.VerifyActionIdResult
|
||||||
import de.webidsolutions.mobile_app.sdk.impl.AsyncTaskResultGeneric
|
import de.webidsolutions.mobile_app.sdk.impl.AsyncTaskResultGeneric
|
||||||
import de.webidsolutions.pay_on_server_product_plugin.PayOnServerProductPlugin
|
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.IEPluginError
|
||||||
import de.webidsolutions.plugin_core.IProductPluginWebId
|
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.ProductPluginErrorResult
|
||||||
import de.webidsolutions.plugin_core.ProductPluginResult
|
import de.webidsolutions.plugin_core.ProductPluginResult
|
||||||
import de.webidsolutions.plugin_core.WebIdPluginInterruptedException
|
import de.webidsolutions.plugin_core.WebIdPluginInterruptedException
|
||||||
import de.webidsolutions.video_ident.plugin.videocall.VideoOptionsConfig
|
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 de.webidsolutions.video_ident_product_plugin.VideoIdentProductPlugin
|
||||||
import java.lang.Integer.parseInt
|
import java.lang.Integer.parseInt
|
||||||
import java.net.URI
|
import java.net.URI
|
||||||
@ -41,7 +45,7 @@ private val config = VideoOptionsConfig(
|
|||||||
)
|
)
|
||||||
|
|
||||||
// TODO insert your Action id
|
// TODO insert your Action id
|
||||||
private const val actionId = "304914809"
|
private const val actionId = "<9_digit_webid_transaction_id>"
|
||||||
|
|
||||||
// TODO choose your environment
|
// TODO choose your environment
|
||||||
private val chosenEnvironment: EWebIDEnv = EWebIDEnv.TEST
|
private val chosenEnvironment: EWebIDEnv = EWebIDEnv.TEST
|
||||||
@ -171,35 +175,59 @@ internal class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun onPluginResultCallback(activityResult: ActivityResult) {
|
private fun onPluginResultCallback(activityResult: ActivityResult) {
|
||||||
var result = ""
|
var metaPluginActivityResult = activityResult
|
||||||
|
var result: String?
|
||||||
try {
|
try {
|
||||||
|
// Get data and handle potential null case
|
||||||
|
// If data is null, plugin was interrupted
|
||||||
val data: Intent = activityResult.data ?: throw WebIdPluginInterruptedException()
|
val data: Intent = activityResult.data ?: throw WebIdPluginInterruptedException()
|
||||||
val pluginResult: ProductPluginResult<*> =
|
// Retrieve the plugin result and handle any errors
|
||||||
IProductPluginWebId.getProductPluginResult<IEPluginError>(
|
val pluginResult: ProductPluginResult<*> = getProductPluginResult<IEPluginError>(
|
||||||
data, activityResult.resultCode
|
data, activityResult.resultCode
|
||||||
)
|
)
|
||||||
val resultInfo: String? = pluginResult.info
|
val resultInfo: String? = pluginResult.info
|
||||||
val failReason: ProductPluginErrorResult<*>? = pluginResult.error
|
val failReason: ProductPluginErrorResult<*>? = pluginResult.error
|
||||||
// success
|
// Successful plugin execution
|
||||||
if (failReason == null) {
|
if (failReason == null) {
|
||||||
result = "Success"
|
result = "Success"
|
||||||
if (resultInfo != null) {
|
if (resultInfo != null) {
|
||||||
result += " $resultInfo"
|
result += " $resultInfo"
|
||||||
|
// your code to handle the successful plugin execution
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// failure case
|
// failure case
|
||||||
if (failReason.specificResult != null) {
|
if (failReason.specificResult != null) {
|
||||||
val specificResult: IEPluginError? =
|
val specificResult: IEPluginError? =
|
||||||
failReason.specificResult as IEPluginError?
|
failReason.specificResult as IEPluginError?
|
||||||
result = specificResult.toString()
|
// handle EMetaPluginFailReason
|
||||||
} else if (failReason.genericResult != null) {
|
if (specificResult is EMetaPluginFailReason) {
|
||||||
result = failReason.genericResult.toString()
|
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) {
|
} catch (e: WebIdPluginInterruptedException) {
|
||||||
|
// Handle interruption in your preferred way
|
||||||
writeLog(e.toString())
|
writeLog(e.toString())
|
||||||
}
|
}
|
||||||
writeLog(result)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* MISC */
|
/* MISC */
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
tools:context=".MainActivity">
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
Loading…
x
Reference in New Issue
Block a user