Skip to content

Commit

Permalink
Document Verification (#12)
Browse files Browse the repository at this point in the history
* UI WIP

Bump Kotlin to 1.9.10
Bump Gradle to 8.1.1
Modularize Main Screen
Switch to FlutterFragmentActivity
Add SmileIDDocumentVerification PlatformView

* Update dependencies

* Roughly working

* Independent widget properties

* iOS integration

* onSuccess and onError callbacks

* Clean up

* Fix camera bug, support global docv

* remove onFlutterViewAttached override

* Convert SwiftUI to UIKit view

* Update CHANGELOG

* Review comment

* proper iOS interface

* update android sdk version

* Fix callback not being invoked

* bumped up ios version

* fixed document verification on flutter ios

* Updates

* Updates

* Fix pbxproj

* updated flutter to match ios

* Feat : Smart Selfie Enrollment (#13)

* refactored document verification flow

* adding SmartSelfieEnrollment

* adding SmartSelfieEnrollment

* adding SmartSelfieEnrollment on iOS

* Update example/lib/main.dart

Co-authored-by: Vansh Gandhi <[email protected]>

* setting up flutter lint

* setting up lint actions

* setting up lint actions

* fixed broken action file

* renamed response models

* added ktlint to android code

* fixed ci

* fixed ci

* added linter to sample android app

* fixing smart selfie enrollment on flutter iOS

* Feat : Smart Selfie Authentication (#14)

* adding SmartSelfieAuthentication

* adding SmartSelfieAuthentication on iOS

* fixed show SmileIDSmartSelfieAuthentication

* fixed wrong naming

* added smartSelfieAuthentication on sample app

* added trailing commas

* added trailing commas

* fixed trailing commas

* fixed trailing commas

* fixed ktlint

* fixed swift parameters

* ktlint config

* split flutter lint into a separate job

---------

Co-authored-by: Vansh Gandhi <[email protected]>

* Formatting and fixes

* small fix

* Allow parallel build

* Update CHANGELOG.md

* Allow Gallery Upload in sample app

---------

Co-authored-by: Juma Allan <[email protected]>
  • Loading branch information
vanshg and jumaallan authored Oct 5, 2023
1 parent 325464c commit 84922a3
Show file tree
Hide file tree
Showing 39 changed files with 1,772 additions and 592 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
[*]
max_line_length=100

[{*.kt,*.kts}]
ij_kotlin_allow_trailing_comma_on_call_site=true
ij_kotlin_allow_trailing_comma=true
22 changes: 21 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ concurrency:
cancel-in-progress: true

jobs:
Flutter:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.10.6' # Set the desired Flutter version here
channel: 'stable'
- name: Install Dependencies
run: flutter pub get && cd example && flutter pub get && cd ..
- name: Lint Flutter
run: flutter analyze
Android:
runs-on: ubuntu-latest
timeout-minutes: 10
Expand All @@ -24,6 +37,13 @@ jobs:
channel: 'stable'
- name: Install Dependencies
run: flutter pub get && cd example && flutter pub get && cd ..
- name: Lint Android
uses: musichin/ktlint-check@v2
with:
ktlint-version: "0.49.1"
patterns: |
**/**.kt
!**/generated/**
- name: Test
run: flutter test && cd example && flutter test && cd ..
- name: Build Android Sample App
Expand All @@ -41,4 +61,4 @@ jobs:
- name: Install Dependencies
run: flutter pub get && cd example && flutter pub get && cd ..
- name: Build iOS Sample App
run: cd example && flutter build ios --no-codesign && cd ..
run: cd example && flutter build ios --no-codesign && cd ..
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

# 10.0.0-beta02
- Support for Document Verification, exposed as a `SmileIDDocumentVerification` Widget
- Support for SmartSelfie Authentication, exposed as a `SmileIDSmartSelfieAuthentication` Widget

# 10.0.0-beta01
- Initial release
- Support for Enhanced KYC (Async)
39 changes: 39 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,42 @@ include: package:flutter_lints/flutter.yaml

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

#Official linting recommendations by the Flutter and Dart team.
# It has 2 sets of linters:
# Core (around 30 rules) - https://github.com/dart-lang/lints/blob/main/lib/core.yaml
# Recommended (around 55 rules) - https://github.com/dart-lang/lints/blob/main/lib/recommended.yaml

linter:
rules:
- avoid_empty_else
- avoid_relative_lib_imports
- avoid_shadowing_type_parameters
- avoid_types_as_parameter_names
- await_only_futures
- camel_case_extensions
- camel_case_types
- collection_methods_unrelated_type
- curly_braces_in_flow_control_structures
- depend_on_referenced_packages
- empty_catches
- file_names
- hash_and_equals
- implicit_call_tearoffs
- no_duplicate_case_values
- non_constant_identifier_names
- null_check_on_nullable_type_parameter
- package_prefixed_library_names
- prefer_generic_function_type_aliases
- prefer_is_empty
- prefer_is_not_empty
- prefer_iterable_whereType
- prefer_typing_uninitialized_variables
- provide_deprecation_message
- secure_pubspec_urls
- type_literal_in_constant_pattern
- unnecessary_overrides
- unrelated_type_equality_checks
- use_string_in_part_of_directives
- valid_regexps
- void_checks
31 changes: 22 additions & 9 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
group "com.smileidentity.flutter"
version findProperty("SDK_VERSION") ?: "10.0.0-beta06-SNAPSHOT"
version findProperty("SDK_VERSION") ?: "10.0.0-beta08"

buildscript {
ext.kotlin_version = "1.9.0"
ext.kotlin_version = "1.9.10"
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
google()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}

dependencies {
classpath "com.android.tools.build:gradle:8.1.0"
classpath "com.android.tools.build:gradle:8.1.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jlleitschuh.gradle:ktlint-gradle:11.6.0"
}
}

allprojects {
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
google()
mavenCentral()
}
}

apply plugin: "com.android.library"
apply plugin: "kotlin-android"
apply plugin: "org.jlleitschuh.gradle.ktlint"

android {
namespace group
Expand All @@ -51,15 +52,27 @@ android {
}
}

buildFeatures.compose = true
composeOptions {
kotlinCompilerExtensionVersion = "1.5.3"
}

dependencies {
implementation "com.smileidentity:android-sdk:${version}"

implementation "com.squareup.okhttp3:okhttp"
implementation "androidx.core:core-ktx"
implementation "androidx.compose.ui:ui"
implementation "androidx.compose.material3:material3"
implementation "androidx.fragment:fragment-ktx"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core"
implementation "com.jakewharton.timber:timber"

testImplementation "org.jetbrains.kotlin:kotlin-test"
testImplementation "io.mockk:mockk:1.13.5"
testImplementation "io.mockk:mockk:1.13.8"
}
}

ktlint {
android = true
filter {
exclude { it.file.path.contains(".g.kt") }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ fun convertNonNullMapToNullable(map: Map<String, String>): Map<String?, String?>
map.mapKeys { it.key }
.mapValues { it.value }

fun FlutterJobType.toRequest() = when(this) {
fun FlutterJobType.toRequest() = when (this) {
FlutterJobType.ENHANCEDKYC -> JobType.EnhancedKyc
FlutterJobType.DOCUMENTVERIFICATION -> JobType.DocumentVerification
}

fun JobType.toResponse() = when (this) {
JobType.EnhancedKyc -> FlutterJobType.ENHANCEDKYC
JobType.DocumentVerification -> FlutterJobType.DOCUMENTVERIFICATION
else -> TODO("Not yet implemented")
}

Expand All @@ -57,19 +59,19 @@ fun PartnerParams.toResponse() = FlutterPartnerParams(
jobType = jobType?.toResponse(),
jobId = jobId,
userId = userId,
extras = convertNonNullMapToNullable(extras)
extras = convertNonNullMapToNullable(extras),
)

fun FlutterPartnerParams.toRequest() = PartnerParams(
jobType = jobType?.toRequest(),
jobId = jobId,
userId = userId,
extras = convertNullableMapToNonNull(extras)
extras = convertNullableMapToNonNull(extras),
)

fun ConsentInfo.toRequest() = FlutterConsentInfo(
canAccess = canAccess,
consentRequired = consentRequired
consentRequired = consentRequired,
)

fun AuthenticationResponse.toResponse() = FlutterAuthenticationResponse(
Expand All @@ -96,13 +98,13 @@ fun FlutterEnhancedKycRequest.toRequest() = EnhancedKycRequest(
jobType = partnerParams.jobType?.toRequest(),
jobId = partnerParams.jobId,
userId = partnerParams.userId,
extras = convertNullableMapToNonNull(partnerParams.extras)
extras = convertNullableMapToNonNull(partnerParams.extras),
),
sourceSdk = "android (flutter)",
timestamp = timestamp,
signature = signature,
)

fun EnhancedKycAsyncResponse.toResponse() = FlutterEnhancedKycAsyncResponse(
success = success
success = success,
)
Loading

0 comments on commit 84922a3

Please sign in to comment.