Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
MYID Public Code
MyID Sample Android
Commits
7e4c8eae
Commit
7e4c8eae
authored
Jan 30, 2023
by
Javohir Savriy
Browse files
Merge branch '2.1.3' into '2.1.2'
Published 2.1.3 version See merge request
!4
parents
cb054ff2
7c9fe85b
Changes
105
Hide whitespace changes
Inline
Side-by-side
flutter-sample/android/.gitignore
0 → 100644
View file @
7e4c8eae
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
**/*.keystore
**/*.jks
flutter-sample/android/app/build.gradle
0 → 100644
View file @
7e4c8eae
def
localProperties
=
new
Properties
()
def
localPropertiesFile
=
rootProject
.
file
(
"local.properties"
)
if
(
localPropertiesFile
.
exists
())
{
localPropertiesFile
.
withReader
(
"UTF-8"
)
{
reader
->
localProperties
.
load
(
reader
)
}
}
def
flutterRoot
=
localProperties
.
getProperty
(
"flutter.sdk"
)
if
(
flutterRoot
==
null
)
{
throw
new
GradleException
(
"Flutter SDK not found. Define location with flutter.sdk in the local.properties file."
)
}
def
flutterVersionCode
=
localProperties
.
getProperty
(
"flutter.versionCode"
)
if
(
flutterVersionCode
==
null
)
{
flutterVersionCode
=
"1"
}
def
flutterVersionName
=
localProperties
.
getProperty
(
"flutter.versionName"
)
if
(
flutterVersionName
==
null
)
{
flutterVersionName
=
"1.0"
}
apply
plugin:
"com.android.application"
apply
plugin:
"kotlin-android"
apply
from:
"$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android
{
compileSdkVersion
33
compileOptions
{
sourceCompatibility
JavaVersion
.
VERSION_1_8
targetCompatibility
JavaVersion
.
VERSION_1_8
}
kotlinOptions
{
jvmTarget
=
"1.8"
}
sourceSets
{
main
.
java
.
srcDirs
+=
"src/main/kotlin"
}
defaultConfig
{
applicationId
"com.example.example"
minSdkVersion
21
targetSdkVersion
33
versionCode
flutterVersionCode
.
toInteger
()
versionName
flutterVersionName
}
buildTypes
{
release
{
signingConfig
signingConfigs
.
debug
}
}
}
flutter
{
source
"../.."
}
dependencies
{
implementation
(
files
(
"libs/myid-sdk-2.1.3-release.aar"
))
implementation
(
"org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"
)
implementation
(
"androidx.core:core-ktx:1.9.0"
)
implementation
(
"androidx.appcompat:appcompat:1.5.1"
)
implementation
(
"androidx.constraintlayout:constraintlayout:2.1.4"
)
implementation
(
"androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1"
)
implementation
(
"androidx.lifecycle:lifecycle-runtime-ktx:2.5.1"
)
def
cameraVersion
=
"1.3.0-alpha01"
implementation
(
"androidx.camera:camera-camera2:$cameraVersion"
)
implementation
(
"androidx.camera:camera-lifecycle:$cameraVersion"
)
implementation
(
"androidx.camera:camera-view:$cameraVersion"
)
implementation
(
"io.ktor:ktor-client-android:2.1.2"
)
implementation
(
"io.sentry:sentry-android:6.7.0-alpha.1"
)
implementation
(
"com.google.android.gms:play-services-mlkit-face-detection:17.1.0"
)
implementation
(
"com.google.android.gms:play-services-mlkit-text-recognition:18.0.2"
)
implementation
(
"com.google.android.gms:play-services-mlkit-barcode-scanning:18.1.0"
)
implementation
(
"com.google.android.material:material:1.8.0"
)
implementation
(
"com.google.code.gson:gson:2.10"
)
}
flutter-sample/android/app/libs/myid-sdk-2.1.3-release.aar
0 → 100644
View file @
7e4c8eae
File added
flutter-sample/android/app/src/main/AndroidManifest.xml
0 → 100644
View file @
7e4c8eae
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"com.example.example"
>
<application
android:name=
"${applicationName}"
android:icon=
"@mipmap/ic_launcher"
android:label=
"example"
android:theme=
"@style/Theme.MaterialComponents.Light.NoActionBar"
>
<activity
android:name=
".MainActivity"
android:configChanges=
"orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:exported=
"true"
android:hardwareAccelerated=
"true"
android:launchMode=
"singleTop"
android:windowSoftInputMode=
"adjustResize"
>
<meta-data
android:name=
"io.flutter.embedding.android.NormalTheme"
android:resource=
"@style/NormalTheme"
/>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<meta-data
android:name=
"flutterEmbedding"
android:value=
"2"
/>
</application>
</manifest>
\ No newline at end of file
flutter-sample/android/app/src/main/kotlin/com/example/example/Keys.kt
0 → 100644
View file @
7e4c8eae
package
com.example.example
object
Keys
{
const
val
PHONE_NUMBER
=
"KEY_PHONE_NUMBER"
const
val
CLIENT_ID
=
"KEY_CLIENT_ID"
const
val
PASSPORT_DATA
=
"KEY_PASSPORT_DATA"
const
val
DATE_OF_BIRTH
=
"KEY_DATE_OF_BIRTH"
const
val
SDK_HASH
=
"KEY_SDK_HASH"
const
val
EXTERNAL_ID
=
"KEY_EXTERNAL_ID"
const
val
THRESHOLD
=
"KEY_THRESHOLD"
const
val
BUILD_MODE
=
"KEY_BUILD_MODE"
const
val
ENTRY_TYPE
=
"KEY_ENTRY_TYPE"
const
val
LOCALE
=
"KEY_LOCALE"
const
val
CAMERA_SHAPE
=
"KEY_CAMERA_SHAPE"
const
val
WITH_PHOTO
=
"KEY_WITH_PHOTO"
}
\ No newline at end of file
flutter-sample/android/app/src/main/kotlin/com/example/example/MainActivity.kt
0 → 100644
View file @
7e4c8eae
package
com.example.example
import
android.content.Intent
import
com.google.gson.Gson
import
io.flutter.embedding.android.FlutterActivity
import
io.flutter.embedding.engine.FlutterEngine
import
io.flutter.plugin.common.MethodCall
import
io.flutter.plugin.common.MethodChannel
import
uz.myid.android.sdk.capture.*
import
uz.myid.android.sdk.capture.model.OrganizationDetails
import
java.util.*
class
MainActivity
:
FlutterActivity
(),
MyIdResultListener
{
private
lateinit
var
flutterResult
:
MethodChannel
.
Result
private
val
myIdClient
=
MyIdClient
()
override
fun
configureFlutterEngine
(
flutterEngine
:
FlutterEngine
)
{
super
.
configureFlutterEngine
(
flutterEngine
)
MethodChannel
(
flutterEngine
.
dartExecutor
.
binaryMessenger
,
CHANNEL
)
.
setMethodCallHandler
{
call
,
result
->
if
(
call
.
method
==
"runSDK"
)
{
flutterResult
=
result
startMyId
(
call
)
}
}
}
override
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
)
if
(
requestCode
==
MYID_REQUEST_CODE
)
{
myIdClient
.
handleActivityResult
(
resultCode
,
this
)
}
}
override
fun
onSuccess
(
result
:
MyIdResult
)
{
val
resultData
=
ResultData
(
resultCode
=
result
.
code
,
comparison
=
result
.
comparison
)
flutterResult
.
success
(
Gson
().
toJson
(
resultData
))
}
override
fun
onError
(
e
:
MyIdException
)
{
val
resultData
=
ResultData
(
errorMessage
=
e
.
message
,
errorCode
=
e
.
code
)
flutterResult
.
success
(
Gson
().
toJson
(
resultData
))
}
override
fun
onUserExited
()
{
val
resultData
=
ResultData
(
errorMessage
=
"User exited"
,
errorCode
=
400
)
flutterResult
.
success
(
Gson
().
toJson
(
resultData
))
}
private
fun
startMyId
(
call
:
MethodCall
)
{
val
phoneNumber
=
call
.
argument
<
String
>(
Keys
.
PHONE_NUMBER
).
orEmpty
()
val
clientId
=
call
.
argument
<
String
>(
Keys
.
CLIENT_ID
).
orEmpty
()
val
passportData
=
call
.
argument
<
String
>(
Keys
.
PASSPORT_DATA
).
orEmpty
()
val
dateOfBirth
=
call
.
argument
<
String
>(
Keys
.
DATE_OF_BIRTH
).
orEmpty
()
val
sdkHash
=
call
.
argument
<
String
>(
Keys
.
SDK_HASH
).
orEmpty
()
val
externalId
=
call
.
argument
<
String
>(
Keys
.
EXTERNAL_ID
).
orEmpty
()
val
threshold
=
call
.
argument
<
Double
>(
Keys
.
THRESHOLD
)
?:
0.5f
val
buildMode
=
when
(
call
.
argument
<
String
>(
Keys
.
BUILD_MODE
)
?.
uppercase
())
{
MyIdBuildMode
.
DEBUG
.
name
->
MyIdBuildMode
.
DEBUG
else
->
MyIdBuildMode
.
PRODUCTION
}
val
entryType
=
when
(
call
.
argument
<
String
>(
Keys
.
ENTRY_TYPE
)
?.
uppercase
())
{
MyIdEntryType
.
FACE
.
name
->
MyIdEntryType
.
FACE
else
->
MyIdEntryType
.
AUTH
}
val
cameraShape
=
when
(
call
.
argument
<
String
>(
Keys
.
CAMERA_SHAPE
)
?.
uppercase
())
{
MyIdCameraShape
.
ELLIPSE
.
name
->
MyIdCameraShape
.
ELLIPSE
else
->
MyIdCameraShape
.
CIRCLE
}
val
locale
=
call
.
argument
<
String
>(
Keys
.
LOCALE
)
?:
"en"
val
withPhoto
=
call
.
argument
<
Boolean
>(
Keys
.
WITH_PHOTO
)
?:
false
val
organizationDetails
=
OrganizationDetails
(
phoneNumber
=
phoneNumber
)
val
myIdConfig
=
MyIdConfig
.
builder
(
clientId
=
clientId
)
.
withPassportData
(
passportData
)
.
withBirthDate
(
dateOfBirth
)
.
withSdkHash
(
sdkHash
)
.
withExternalId
(
externalId
)
.
withThreshold
(
threshold
.
toFloat
())
.
withBuildMode
(
buildMode
)
.
withEntryType
(
entryType
)
.
withLocale
(
Locale
(
locale
))
.
withCameraShape
(
cameraShape
)
.
withOrganizationDetails
(
organizationDetails
)
.
withPhoto
(
withPhoto
)
.
build
()
myIdClient
.
startActivityForResult
(
this
,
MYID_REQUEST_CODE
,
myIdConfig
)
}
companion
object
{
private
const
val
CHANNEL
=
"flutter.native/myid"
private
const
val
MYID_REQUEST_CODE
=
999
}
}
flutter-sample/android/app/src/main/kotlin/com/example/example/ResultData.kt
0 → 100644
View file @
7e4c8eae
package
com.example.example
import
androidx.annotation.Keep
import
com.google.gson.annotations.SerializedName
@Keep
data class
ResultData
(
@SerializedName
(
"result_code"
)
val
resultCode
:
String
?
=
null
,
@SerializedName
(
"comparison"
)
val
comparison
:
Double
?
=
null
,
@SerializedName
(
"error_message"
)
val
errorMessage
:
String
?
=
null
,
@SerializedName
(
"error_code"
)
val
errorCode
:
Int
?
=
null
)
flutter-sample/android/app/src/main/res/drawable-v21/launch_background.xml
0 → 100644
View file @
7e4c8eae
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"?android:colorBackground"
/>
</layer-list>
flutter-sample/android/app/src/main/res/drawable/launch_background.xml
0 → 100644
View file @
7e4c8eae
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@android:color/white"
/>
</layer-list>
flutter-sample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
0 → 100644
View file @
7e4c8eae
544 Bytes
flutter-sample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
0 → 100644
View file @
7e4c8eae
442 Bytes
flutter-sample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
0 → 100644
View file @
7e4c8eae
721 Bytes
flutter-sample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
0 → 100644
View file @
7e4c8eae
1.01 KB
flutter-sample/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
0 → 100644
View file @
7e4c8eae
1.41 KB
flutter-sample/android/app/src/main/res/values-night/styles.xml
0 → 100644
View file @
7e4c8eae
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style
name=
"LaunchTheme"
parent=
"@android:style/Theme.Black.NoTitleBar"
>
<item
name=
"android:windowBackground"
>
@drawable/launch_background
</item>
</style>
<style
name=
"NormalTheme"
parent=
"@android:style/Theme.Black.NoTitleBar"
>
<item
name=
"android:windowBackground"
>
?android:colorBackground
</item>
</style>
</resources>
flutter-sample/android/app/src/main/res/values/strings.xml
0 → 100644
View file @
7e4c8eae
<resources></resources>
\ No newline at end of file
flutter-sample/android/app/src/main/res/values/styles.xml
0 → 100644
View file @
7e4c8eae
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style
name=
"LaunchTheme"
parent=
"@android:style/Theme.Light.NoTitleBar"
>
<item
name=
"android:windowBackground"
>
@drawable/launch_background
</item>
</style>
<style
name=
"NormalTheme"
parent=
"@android:style/Theme.Light.NoTitleBar"
>
<item
name=
"android:windowBackground"
>
?android:colorBackground
</item>
</style>
</resources>
flutter-sample/android/build.gradle
0 → 100644
View file @
7e4c8eae
buildscript
{
repositories
{
google
()
mavenCentral
()
}
dependencies
{
classpath
"com.android.tools.build:gradle:7.3.1"
classpath
"org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.21"
}
}
allprojects
{
repositories
{
google
()
mavenCentral
()
}
}
rootProject
.
buildDir
=
"../build"
subprojects
{
project
.
buildDir
=
"${rootProject.buildDir}/${project.name}"
}
subprojects
{
project
.
evaluationDependsOn
(
":app"
)
}
task
clean
(
type:
Delete
)
{
delete
rootProject
.
buildDir
}
flutter-sample/android/gradle.properties
0 → 100644
View file @
7e4c8eae
org.gradle.jvmargs
=
-Xmx1536M
android.useAndroidX
=
true
android.enableJetifier
=
true
flutter-sample/android/gradle/wrapper/gradle-wrapper.properties
0 → 100644
View file @
7e4c8eae
#Fri Jun 23 08:50:38 CEST 2017
distributionBase
=
GRADLE_USER_HOME
distributionPath
=
wrapper/dists
zipStoreBase
=
GRADLE_USER_HOME
zipStorePath
=
wrapper/dists
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-7.4-bin.zip
Prev
1
2
3
4
5
6
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment