Skip to content

Commit

Permalink
Prepare for 10.0.0-beta06 release (#187)
Browse files Browse the repository at this point in the history
* Remove Polling (#169)

* Add Async Enhanced KYC endpoint (#168)

* Add Async Enhanced KYC endpoint

* Fix URL

* Setting up loading button (#170)

* setting up loading button

* fixed pr comments

* loading button tests

* Include ID Info in Document Verification network request (#173)

* Include ID Info in network request

* Update CHANGELOG

* Fix test

* Update CHANGELOG

* Actions updates (#178)

* Support Merge Queue

* Bump snapshot version

* switch from Java 17 to 11 for the lib module (#179)

* Setup Smile Config during Runtime (#160)

* Remove polling (#145)

* Remove polling

* Update CHANGELOG

* Rename getJobStatus to getSmartSelfieJobStatus to align with other job status names

* Update error message to be actionable

* Update error message to be actionable

* Fix range

* Add test

* Add comment

* Rename ImageType enums (#144)

* Use `channelFlow` instead of `flow`

* Update comment

* Jobs List Screen (#148)

* Jobs List Screen

* Constraint trailingContent size

* Review comments

* Update Previews

* Add DataStoreRepository

* Persist Jobs (#158)

* Orchestrated Jobs Screen

* Remove unused test

* Environment as a parameter

* Fleshing out viewmodel

* Expand JobStatusResponse fields

* Persist Jobs

* Fix jobtype

* Use WhileSubscribed

* MainScreenViewModel (#159)

* MainScreenViewModel

* Try to optimize

* Allow for simultaneous debug and release install

* Recomposition fixes

* SmartSelfieAuthDialog

* PR comments

* Perform background job status polling (#166)

* refactored main screen setting to add settings tab

* create viewmodel in activity and re use in composables

* return config as string to make it easy to edit on bottom sheet

* updated settings page strings

* added smile config bottom sheet

* fix lint

* archive APKs

* fixed smile setup to allow changing config

* running lint

* Setup Smile Config Runtime [Alternative] (#172)

* Allow for dynamic initialization

* remove from main screen view model

* created root screen and moved theming up to main activity

* added a boolean flag do enable/disable dismissing the config bottom sheet

* fixed lint

* moved theme setup up

* added option to dismiss bottom sheet

* cleaning up root logic to a viewmodel

* fixed build failure

---------

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

* added partner notes

* PR comments

* Update Actions

* Rebase updates

---------

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

* Bump dev.zacsweers.moshix from 0.23.0 to 0.24.0 (#176)

Bumps [dev.zacsweers.moshix](https://github.com/ZacSweers/MoshiX) from 0.23.0 to 0.24.0.
- [Release notes](https://github.com/ZacSweers/MoshiX/releases)
- [Changelog](https://github.com/ZacSweers/MoshiX/blob/main/CHANGELOG.md)
- [Commits](ZacSweers/MoshiX@0.23.0...0.24.0)

---
updated-dependencies:
- dependency-name: dev.zacsweers.moshix
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump io.sentry:sentry-bom from 6.25.2 to 6.26.0 (#177)

Bumps [io.sentry:sentry-bom](https://github.com/getsentry/sentry-java) from 6.25.2 to 6.26.0.
- [Release notes](https://github.com/getsentry/sentry-java/releases)
- [Changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md)
- [Commits](getsentry/sentry-java@6.25.2...6.26.0)

---
updated-dependencies:
- dependency-name: io.sentry:sentry-bom
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump com.google.devtools.ksp from 1.9.0-1.0.11 to 1.9.0-1.0.12 (#175)

Bumps [com.google.devtools.ksp](https://github.com/google/ksp) from 1.9.0-1.0.11 to 1.9.0-1.0.12.
- [Release notes](https://github.com/google/ksp/releases)
- [Commits](google/ksp@1.9.0-1.0.11...1.9.0-1.0.12)

---
updated-dependencies:
- dependency-name: com.google.devtools.ksp
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Expose OkHttp as an `api` dependency (#186)

* Prepare for 10.0.0-beta05 release (#174)

* Remove Polling (#169)

* Add Async Enhanced KYC endpoint (#168)

* Add Async Enhanced KYC endpoint

* Fix URL

* Setting up loading button (#170)

* setting up loading button

* fixed pr comments

* loading button tests

* Include ID Info in Document Verification network request (#173)

* Include ID Info in network request

* Update CHANGELOG

* Fix test

* Update CHANGELOG

---------

Co-authored-by: Juma Allan <[email protected]>

* Bump coroutines from 1.7.2 to 1.7.3 (#180)

* Bump io.sentry:sentry-bom from 6.25.2 to 6.27.0 (#182)

* Expose OkHttp as an `api` dependency

* Bump AGP to 8.1.0

---------

Co-authored-by: Juma Allan <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Prepare for 10.0.0-beta06

* Update CHANGELOG

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Juma Allan <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 8, 2023
1 parent 37f1186 commit 532890f
Show file tree
Hide file tree
Showing 30 changed files with 750 additions and 350 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
name: Lint Build and Test
on:
pull_request:
merge_group:
push:
branches: [ main ]
branches: [ main, develop ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand All @@ -21,11 +22,6 @@ jobs:
with:
distribution: temurin
java-version: 17
- name: Write Smile Config
run: |
echo "$SMILE_CONFIG" > sample/src/main/assets/smile_config.json
env:
SMILE_CONFIG: ${{ secrets.SMILE_CONFIG_PARTNER_2423 }}
- name: Calculate Snapshot Version
id: version
# Read version number from the VERSION file and append -SNAPSHOT if not already present
Expand Down Expand Up @@ -55,6 +51,11 @@ jobs:
with:
name: SDK AAR
path: lib/build/outputs/aar/lib-debug.aar
- name: Archive Sample App
uses: actions/upload-artifact@v3
with:
name: Sample App APK
path: sample/build/outputs/apk/debug/sample-debug.apk

lint:
runs-on: ubuntu-latest
Expand Down
21 changes: 15 additions & 6 deletions .github/workflows/release_sdk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ concurrency:
jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 10
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
# https://github.com/actions/checkout/issues/766
Expand All @@ -29,11 +29,6 @@ jobs:
with:
distribution: temurin
java-version: 17
- name: Write Smile Config
run: |
echo "$SMILE_CONFIG" > sample/src/main/assets/smile_config.json
env:
SMILE_CONFIG: ${{ secrets.SMILE_CONFIG_PARTNER_2423 }}
- name: Decode Keystore
id: decode_keystore
uses: timheuer/base64-to-file@v1
Expand Down Expand Up @@ -91,6 +86,11 @@ jobs:
with:
name: SDK AAR
path: lib/build/outputs/aar/lib-release.aar
- name: Archive Sample App
uses: actions/upload-artifact@v3
with:
name: Sample App APK
path: sample/build/outputs/apk/release/sample-release.apk
- name: Create GitHub Release
uses: actions/create-release@v1
id: create_release
Expand All @@ -109,6 +109,15 @@ jobs:
asset_path: lib/build/outputs/aar/lib-release.aar
asset_name: com.smileidentity_android-sdk_${{ steps.read_version.outputs.version }}.aar
asset_content_type: application/octet-stream
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: sample/build/outputs/apk/release/sample-release.apk
asset_name: sample_${{ steps.read_version.outputs.version }}.apk
asset_content_type: application/vnd.android.package-archive
- name: Bump Version
if: ${{ github.event.inputs.bump_version == 'true' }}
run: |
Expand Down
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# Changelog

## 10.0.0-beta07 (unreleased)

### Added

### Fixed

### Changed

### Removed

## 10.0.0-beta06

### Fixed
- Added OkHttp as an `api` dependency
- Updated `LoadingButton` visibility modifier

### Changed
- Switch from Java 17 to Java 11 to support Flutter
- Allow passing in a custom `Config` instance to `SmileID.initialize`
- Bump coroutines to 1.7.3
- Bump Sentry to 6.28.0
- Bump AndroidX Fragment to 1.6.1

## 10.0.0-beta05

### Added
Expand Down
4 changes: 0 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,3 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=true
kotlin.code.style=official
android.defaults.buildfeatures.buildconfig=true

# TODO: Remove once upgraded to AGP 8.1.0
# Upgrade lint to a newer version to work around https://issuetracker.google.com/issues/185418482.
android.experimental.lint.version=8.1.0-rc01
21 changes: 7 additions & 14 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
[versions]
accompanist-permissions = "0.30.1"
# TODO: Once updgraded to 8.1.0, remove the lint version from gradle.properties
android-gradle-plugin = "8.0.2"
android-gradle-plugin = "8.1.0"
androidx-activity = "1.7.2"
# TODO: Check if https://android-review.googlesource.com/c/platform/frameworks/support/+/2576871 has
# been merged and if so, swap the buttons in ImageCaptureConfirmationDialog
androidx-compose-bom = "2023.06.01"
androidx-compose-compiler = "1.5.0"
androidx-core = "1.10.1"
androidx-fragment = "1.6.0"
androidx-fragment = "1.6.1"
androidx-lifecycle = "2.6.1"
androidx-navigation = "2.6.0"
androidx-test-core = "1.5.0"
androidx-test-espresso = "3.5.1"
androidx-test-fragment = "1.6.0"
androidx-test-fragment = "1.6.1"
androidx-test-junit = "1.1.5"
androidx-test-rules = "1.5.0"
camposer = "0.2.2"
Expand All @@ -25,21 +24,21 @@ datastore = "1.0.0"
junit = "4.13.2"
kotlin = "1.9.0"
kotlin-immutable-collections = "0.3.5"
ksp = "1.9.0-1.0.11"
ksp = "1.9.0-1.0.13"
ktlint-plugin = "11.5.0"
leakcanary = "2.12"
maven-publish = "0.25.3"
mockk = "1.13.5"
moshi = "1.15.0"
moshix = "0.23.0"
moshix = "0.24.0"
moshi-lazy-adapters = "2.2"
okhttp = "4.11.0"
play-services-mlkit-face-detection = "17.1.0"
retrofit = "2.9.0"
sentry = "6.27.0"
sentry = "6.28.0"
timber = "5.0.1"
truth = "1.1.5"
uiautomator = "2.3.0-alpha03"
uiautomator = "2.3.0-alpha04"

[plugins]
android-application = { id = "com.android.application", version.ref = "android-gradle-plugin" }
Expand Down Expand Up @@ -91,20 +90,14 @@ mockk-android = { module = "io.mockk:mockk-android", version.ref = "mockk" }
moshi = { module = "com.squareup.moshi:moshi", version.ref = "moshi" }
moshi-adapters = { module = "com.squareup.moshi:moshi-adapters", version.ref = "moshi" }
moshi-adapters-lazy = { module = "com.serjltt.moshi:moshi-lazy-adapters", version.ref = "moshi-lazy-adapters" }
moshi-kotlin-codegen = { module = "com.squareup.moshi:moshi-kotlin-codegen", version.ref = "moshi" }
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
okhttp-logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttp" }
okhttp-mockwebserver = { module = "com.squareup.okhttp3:mockwebserver", version.ref = "okhttp" }
play-services-mlkit-face-detection = { module = "com.google.android.gms:play-services-mlkit-face-detection", version.ref = "play-services-mlkit-face-detection" }
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
retrofit-converter-moshi = { module = "com.squareup.retrofit2:converter-moshi", version.ref = "retrofit" }
sentry = { module = "io.sentry:sentry" }
sentry-android-core = { module = "io.sentry:sentry-android-core" }
sentry-android-fragment = { module = "io.sentry:sentry-android-fragment" }
sentry-android-okhttp = { module = "io.sentry:sentry-android-okhttp" }
sentry-android-timber = { module = "io.sentry:sentry-android-timber" }
sentry-bom = { module = "io.sentry:sentry-bom", version.ref = "sentry" }
sentry-compose-android = { module = "io.sentry:sentry-compose-android" }
timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" }
truth = { module = "com.google.truth:truth", version.ref = "truth" }
uiautomator = { module = "androidx.test.uiautomator:uiautomator", version.ref = "uiautomator" }
2 changes: 1 addition & 1 deletion lib/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.0.0-beta05-SNAPSHOT
10.0.0-beta06-SNAPSHOT
11 changes: 8 additions & 3 deletions lib/lib.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.ktlint)
alias(libs.plugins.ksp)
alias(libs.plugins.maven.publish)
alias(libs.plugins.moshix)
alias(libs.plugins.parcelize)
Expand Down Expand Up @@ -47,12 +48,12 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
jvmTarget = JavaVersion.VERSION_11.toString()
moduleName = "${groupId}_$artifactId"
compileOptions {
// https://kotlinlang.org/docs/opt-in-requirements.html#module-wide-opt-in
Expand Down Expand Up @@ -132,6 +133,8 @@ mavenPublishing {
}

dependencies {
// OkHttp is exposed in public SmileID interface (initialize), hence "api" vs "implementation"
api(libs.okhttp)
implementation(libs.retrofit)
implementation(libs.retrofit.converter.moshi)
implementation(libs.okhttp.logging.interceptor)
Expand All @@ -141,6 +144,8 @@ dependencies {
implementation(libs.moshi.adapters)
implementation(libs.moshi.adapters.lazy)

implementation(libs.coroutines.core)

implementation(libs.androidx.core)
implementation(libs.androidx.fragment)
implementation(libs.androidx.activity.compose)
Expand Down
17 changes: 12 additions & 5 deletions lib/src/main/java/com/smileidentity/SmileID.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ import retrofit2.converter.moshi.MoshiConverterFactory
import timber.log.Timber
import java.util.concurrent.TimeUnit

@Suppress("unused", "RemoveRedundantQualifierName")
@Suppress("unused")
object SmileID {
@JvmStatic
lateinit var api: SmileIDService internal set
val moshi: Moshi = initMoshi() // Initialized immediately so it can be used to parse Config

lateinit var config: Config
internal set
private lateinit var retrofit: Retrofit

// Can't use lateinit on primitives, this default will be overwritten as soon as init is called
Expand All @@ -44,7 +45,9 @@ object SmileID {
/**
* Initialize the SDK. This must be called before any other SDK methods.
*
* @param context A [Context] instance which will be used to load the config file from assets
* @param context A [Context] instance
* @param config The [Config] to use for the SDK. If not provided, will attempt to load from
* assets (the recommended approach)
* @param useSandbox Whether to use the sandbox environment. If false, uses production
* @param enableCrashReporting Whether to enable crash reporting for *ONLY* Smile ID related
* crashes. This is powered by Sentry, and further details on inner workings can be found in the
Expand All @@ -55,11 +58,12 @@ object SmileID {
@JvmOverloads
fun initialize(
context: Context,
config: Config = Config.fromAssets(context),
useSandbox: Boolean = false,
enableCrashReporting: Boolean = true,
okHttpClient: OkHttpClient = getOkHttpClientBuilder().build(),
) {
SmileID.config = Config.fromAssets(context)
SmileID.config = config
// Enable crash reporting as early as possible (the pre-req is that the config is loaded)
if (enableCrashReporting) {
val isInDebugMode = context.applicationInfo.flags and FLAG_DEBUGGABLE != 0
Expand Down Expand Up @@ -89,7 +93,9 @@ object SmileID {
* authToken from [config] need not be used.
*
* @param apiKey The API Key to use
* @param context A [Context] instance which will be used to load the config file from assets
* @param context A [Context] instance
* @param config The [Config] to use for the SDK. If not provided, will attempt to load from
* assets (the recommended approach)
* @param useSandbox Whether to use the sandbox environment. If false, uses production
* @param enableCrashReporting Whether to enable crash reporting for *ONLY* Smile ID related
* crashes. This is powered by Sentry, and further details on inner workings can be found in the
Expand All @@ -101,12 +107,13 @@ object SmileID {
fun initialize(
apiKey: String,
context: Context,
config: Config = Config.fromAssets(context),
useSandbox: Boolean = false,
enableCrashReporting: Boolean = true,
okHttpClient: OkHttpClient = getOkHttpClientBuilder().build(),
) {
SmileID.apiKey = apiKey
initialize(context, useSandbox, enableCrashReporting, okHttpClient)
initialize(context, config, useSandbox, enableCrashReporting, okHttpClient)
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/src/main/java/com/smileidentity/compose/SmileIDExt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ fun SmileID.SmartSelfieAuthentication(
* generated
* @param showAttribution Whether to show the Smile ID attribution or not on the Instructions screen
* @param allowGalleryUpload Whether to allow the user to upload images from their gallery or not
* @param showInstructions Whether to deactivate capture screen's instructions for
* Document Verification.
* @param showInstructions Whether to deactivate capture screen's instructions for Document
* Verification (NB! If instructions are disabled, gallery upload won't be possible)
* @param colorScheme The color scheme to use for the UI. This is passed in so that we show a Smile
* ID branded UI by default, but allow the user to override it if they want.
* @param typography The typography to use for the UI. This is passed in so that we show a Smile ID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import com.smileidentity.R
import com.smileidentity.compose.preview.SmilePreviews

@Composable
fun LoadingButton(
internal fun LoadingButton(
buttonText: String,
modifier: Modifier = Modifier,
loading: Boolean = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import androidx.compose.material3.Text
import androidx.compose.material3.contentColorFor
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
Expand Down Expand Up @@ -66,6 +67,7 @@ internal fun SelfieCaptureScreen(
val cameraState = rememberCameraState()
var camSelector by rememberCamSelector(CamSelector.Front)
val viewfinderZoom = 1.1f
val faceFillPercent = remember { MAX_FACE_AREA_THRESHOLD * viewfinderZoom * 2 }
// Force maximum brightness in order to light up the user's face
ForceBrightness()
Box(modifier = Modifier.fillMaxSize()) {
Expand All @@ -89,14 +91,14 @@ internal fun SelfieCaptureScreen(
// "out of bounds" content as a fraud prevention technique
.scale(viewfinderZoom),
)
val animatedProgress = animateFloatAsState(
val animatedProgress by animateFloatAsState(
targetValue = uiState.progress,
animationSpec = tween(easing = LinearEasing),
label = "selfie_progress",
).value
)
FaceShapedProgressIndicator(
progress = animatedProgress,
faceFillPercent = MAX_FACE_AREA_THRESHOLD * viewfinderZoom * 2,
faceFillPercent = faceFillPercent,
modifier = Modifier
.fillMaxSize()
.testTag("selfie_progress_indicator"),
Expand Down
8 changes: 3 additions & 5 deletions sample/sample.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ android {
targetSdk = 34
versionCode = findProperty("VERSION_CODE")?.toString()?.toInt() ?: 1
// Include the SDK version in the app version name
versionName = "1.3_sdk-" + project(":lib").version.toString()
versionName = "1.4_" + project(":lib").version.toString()

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down Expand Up @@ -93,10 +93,8 @@ val checkSmileConfigFileTaskName = "checkSmileConfigFile"
tasks.register(checkSmileConfigFileTaskName) {
doLast {
val configFile = file("src/main/assets/smile_config.json")
if (!configFile.exists()) {
throw IllegalArgumentException("Missing smile_config.json file in src/main/assets!")
}
if (configFile.readText().isBlank()) {
// It is okay if the Smile Config doesn't exist -- it will be prompted for upon startup
if (configFile.exists() && configFile.readText().isBlank()) {
throw IllegalArgumentException("Empty smile_config.json file in src/main/assets!")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class DataStoreRepositoryTest {
DataStoreRepository.clearConfig()

// then
val actual = DataStoreRepository.getConfig().first()
val actual = DataStoreRepository.getConfigJsonString().first()
assertNull(actual)
}
}
Loading

0 comments on commit 532890f

Please sign in to comment.