-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added flutter enhanced biometric views * added kotlin enhanced biometric views * use new enhanced views * bump up version and added changelog * added todos * setting up swift views v2 * updated swift interfaces * updated deps * fixed imports * updated snapshot release on android * added missing swift bindings * updated the enhanced swift plugins * updated the enhanced kotlin plugins * updated to enhanced screens * added response mapping * updated gradle config to gradle plugins * updated changelog * migrate to kotlin 2.0 * updated changelog * updated to android version 10.4.0 * updated changelog * setting up ios * disable swift plugin * updated changelog
- Loading branch information
Showing
26 changed files
with
762 additions
and
143 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
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
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 +1 @@ | ||
<manifest package="com.smileidentity.flutter" /> | ||
<manifest /> |
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
82 changes: 82 additions & 0 deletions
82
...ain/kotlin/com/smileidentity/flutter/enhanced/SmileIDSmartSelfieAuthenticationEnhanced.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,82 @@ | ||
package com.smileidentity.flutter.enhanced | ||
|
||
import android.content.Context | ||
import androidx.compose.runtime.Composable | ||
import com.smileidentity.SmileID | ||
import com.smileidentity.SmileID.moshi | ||
import com.smileidentity.compose.SmartSelfieAuthenticationEnhanced | ||
import com.smileidentity.flutter.SmileComposablePlatformView | ||
import com.smileidentity.results.SmartSelfieResult | ||
import com.smileidentity.results.SmileIDResult | ||
import com.smileidentity.util.randomUserId | ||
import io.flutter.plugin.common.BinaryMessenger | ||
import io.flutter.plugin.common.StandardMessageCodec | ||
import io.flutter.plugin.platform.PlatformView | ||
import io.flutter.plugin.platform.PlatformViewFactory | ||
import kotlinx.collections.immutable.toImmutableMap | ||
|
||
internal class SmileIDSmartSelfieAuthenticationEnhanced private constructor( | ||
context: Context, | ||
viewId: Int, | ||
messenger: BinaryMessenger, | ||
args: Map<String, Any?>, | ||
) : SmileComposablePlatformView(context, VIEW_TYPE_ID, viewId, messenger, args) { | ||
companion object { | ||
const val VIEW_TYPE_ID = "SmileIDSmartSelfieAuthenticationEnhanced" | ||
} | ||
|
||
@Composable | ||
override fun Content(args: Map<String, Any?>) { | ||
val extraPartnerParams = args["extraPartnerParams"] as? Map<String, String> ?: emptyMap() | ||
SmileID.SmartSelfieAuthenticationEnhanced( | ||
userId = args["userId"] as? String ?: randomUserId(), | ||
allowNewEnroll = args["allowNewEnroll"] as? Boolean ?: false, | ||
showAttribution = args["showAttribution"] as? Boolean ?: true, | ||
showInstructions = args["showInstructions"] as? Boolean ?: true, | ||
extraPartnerParams = extraPartnerParams.toImmutableMap(), | ||
) { | ||
when (it) { | ||
is SmileIDResult.Success -> { | ||
val result = | ||
SmartSelfieResult( | ||
selfieFile = it.data.selfieFile, | ||
livenessFiles = it.data.livenessFiles, | ||
apiResponse = it.data.apiResponse, | ||
) | ||
val json = | ||
try { | ||
moshi | ||
.adapter(SmartSelfieResult::class.java) | ||
.toJson(result) | ||
} catch (e: Exception) { | ||
onError(e) | ||
return@SmartSelfieAuthenticationEnhanced | ||
} | ||
json?.let { response -> | ||
onSuccessJson(response) | ||
} | ||
} | ||
|
||
is SmileIDResult.Error -> onError(it.throwable) | ||
} | ||
} | ||
} | ||
|
||
class Factory( | ||
private val messenger: BinaryMessenger, | ||
) : PlatformViewFactory(StandardMessageCodec.INSTANCE) { | ||
override fun create( | ||
context: Context, | ||
viewId: Int, | ||
args: Any?, | ||
): PlatformView { | ||
@Suppress("UNCHECKED_CAST") | ||
return SmileIDSmartSelfieAuthenticationEnhanced( | ||
context, | ||
viewId, | ||
messenger, | ||
args as Map<String, Any?>, | ||
) | ||
} | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
...rc/main/kotlin/com/smileidentity/flutter/enhanced/SmileIDSmartSelfieEnrollmentEnhanced.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,82 @@ | ||
package com.smileidentity.flutter.enhanced | ||
|
||
import android.content.Context | ||
import androidx.compose.runtime.Composable | ||
import com.smileidentity.SmileID | ||
import com.smileidentity.SmileID.moshi | ||
import com.smileidentity.compose.SmartSelfieEnrollmentEnhanced | ||
import com.smileidentity.flutter.SmileComposablePlatformView | ||
import com.smileidentity.results.SmartSelfieResult | ||
import com.smileidentity.results.SmileIDResult | ||
import com.smileidentity.util.randomUserId | ||
import io.flutter.plugin.common.BinaryMessenger | ||
import io.flutter.plugin.common.StandardMessageCodec | ||
import io.flutter.plugin.platform.PlatformView | ||
import io.flutter.plugin.platform.PlatformViewFactory | ||
import kotlinx.collections.immutable.toImmutableMap | ||
|
||
internal class SmileIDSmartSelfieEnrollmentEnhanced private constructor( | ||
context: Context, | ||
viewId: Int, | ||
messenger: BinaryMessenger, | ||
args: Map<String, Any?>, | ||
) : SmileComposablePlatformView(context, VIEW_TYPE_ID, viewId, messenger, args) { | ||
companion object { | ||
const val VIEW_TYPE_ID = "SmileIDSmartSelfieEnrollmentEnhanced" | ||
} | ||
|
||
@Composable | ||
override fun Content(args: Map<String, Any?>) { | ||
val extraPartnerParams = args["extraPartnerParams"] as? Map<String, String> ?: emptyMap() | ||
SmileID.SmartSelfieEnrollmentEnhanced( | ||
userId = args["userId"] as? String ?: randomUserId(), | ||
allowNewEnroll = args["allowNewEnroll"] as? Boolean ?: false, | ||
showAttribution = args["showAttribution"] as? Boolean ?: true, | ||
showInstructions = args["showInstructions"] as? Boolean ?: true, | ||
extraPartnerParams = extraPartnerParams.toImmutableMap(), | ||
) { | ||
when (it) { | ||
is SmileIDResult.Success -> { | ||
val result = | ||
SmartSelfieResult( | ||
selfieFile = it.data.selfieFile, | ||
livenessFiles = it.data.livenessFiles, | ||
apiResponse = it.data.apiResponse, | ||
) | ||
val json = | ||
try { | ||
moshi | ||
.adapter(SmartSelfieResult::class.java) | ||
.toJson(result) | ||
} catch (e: Exception) { | ||
onError(e) | ||
return@SmartSelfieEnrollmentEnhanced | ||
} | ||
json?.let { response -> | ||
onSuccessJson(response) | ||
} | ||
} | ||
|
||
is SmileIDResult.Error -> onError(it.throwable) | ||
} | ||
} | ||
} | ||
|
||
class Factory( | ||
private val messenger: BinaryMessenger, | ||
) : PlatformViewFactory(StandardMessageCodec.INSTANCE) { | ||
override fun create( | ||
context: Context, | ||
viewId: Int, | ||
args: Any?, | ||
): PlatformView { | ||
@Suppress("UNCHECKED_CAST") | ||
return SmileIDSmartSelfieEnrollmentEnhanced( | ||
context, | ||
viewId, | ||
messenger, | ||
args as Map<String, Any?>, | ||
) | ||
} | ||
} | ||
} |
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
Oops, something went wrong.