diff --git a/.github/workflows/bank-sdk.check.yml b/.github/workflows/bank-sdk.check.yml index 90cb7c549b..e69af11334 100644 --- a/.github/workflows/bank-sdk.check.yml +++ b/.github/workflows/bank-sdk.check.yml @@ -141,7 +141,7 @@ jobs: - name: archive debug screen api example app uses: actions/upload-artifact@v3 with: - name: example-app-debug + name: bank-sdk-example-app-debug path: bank-sdk/example-app/build/outputs/apk/debug - name: build release screen api example app @@ -157,7 +157,7 @@ jobs: - name: archive release screen api example app uses: actions/upload-artifact@v3 with: - name: example-app-release + name: bank-sdk-example-app-release path: bank-sdk/example-app/build/outputs/apk/release android-lint: diff --git a/bank-sdk/example-app/src/main/java/net/gini/android/bank/sdk/exampleapp/ui/ConfigurationActivity.kt b/bank-sdk/example-app/src/main/java/net/gini/android/bank/sdk/exampleapp/ui/ConfigurationActivity.kt index 134fca3ea1..c48260132f 100644 --- a/bank-sdk/example-app/src/main/java/net/gini/android/bank/sdk/exampleapp/ui/ConfigurationActivity.kt +++ b/bank-sdk/example-app/src/main/java/net/gini/android/bank/sdk/exampleapp/ui/ConfigurationActivity.kt @@ -19,7 +19,6 @@ import net.gini.android.bank.sdk.exampleapp.ui.MainActivity.Companion.CAMERA_PER import net.gini.android.bank.sdk.exampleapp.ui.MainActivity.Companion.CONFIGURATION_BUNDLE import net.gini.android.bank.sdk.exampleapp.ui.data.Configuration import net.gini.android.capture.DocumentImportEnabledFileTypes -import net.gini.android.capture.EntryPoint import net.gini.android.capture.internal.util.ActivityHelper.interceptOnBackPressed @AndroidEntryPoint @@ -184,13 +183,6 @@ class ConfigurationActivity : AppCompatActivity() { // 29 set imported file size bytes limit binding.editTextImportedFileSizeBytesLimit.hint = configuration.importedFileSizeBytesLimit.toString() - // 30 entry point - val checkedEntryPointButtonId = when (configuration.entryPoint) { - EntryPoint.BUTTON -> R.id.btn_buttonEntryPoint - EntryPoint.FIELD -> R.id.btn_fieldEntryPoint - else -> R.id.btn_buttonEntryPoint - } - binding.toggleBtnEntryPoint.check(checkedEntryPointButtonId) // 31 enable return assistant binding.switchReturnAssistantFeature.isChecked = configuration.isReturnAssistantEnabled @@ -507,26 +499,6 @@ class ConfigurationActivity : AppCompatActivity() { ) } - // 30 entry point - binding.toggleBtnEntryPoint.addOnButtonCheckedListener { toggleButton, checkedId, isChecked -> - val checked = toggleButton.checkedButtonId - configurationViewModel.setConfiguration( - when (checked) { - R.id.btn_buttonEntryPoint -> configurationViewModel.configurationFlow.value.copy( - entryPoint = EntryPoint.BUTTON - ) - - R.id.btn_fieldEntryPoint -> configurationViewModel.configurationFlow.value.copy( - entryPoint = EntryPoint.FIELD - ) - - else -> configurationViewModel.configurationFlow.value.copy( - entryPoint = EntryPoint.BUTTON - ) - } - ) - } - // 31 enable return assistant binding.switchReturnAssistantFeature.setOnCheckedChangeListener { _, isChecked -> configurationViewModel.setConfiguration( diff --git a/bank-sdk/example-app/src/main/java/net/gini/android/bank/sdk/exampleapp/ui/MainActivity.kt b/bank-sdk/example-app/src/main/java/net/gini/android/bank/sdk/exampleapp/ui/MainActivity.kt index 5d6aa51840..07a0beafd8 100644 --- a/bank-sdk/example-app/src/main/java/net/gini/android/bank/sdk/exampleapp/ui/MainActivity.kt +++ b/bank-sdk/example-app/src/main/java/net/gini/android/bank/sdk/exampleapp/ui/MainActivity.kt @@ -4,7 +4,6 @@ import android.Manifest import android.annotation.SuppressLint import android.content.Intent import android.os.Bundle -import android.view.View import android.widget.Toast import androidx.activity.viewModels import androidx.appcompat.app.AppCompatActivity @@ -17,11 +16,11 @@ import net.gini.android.bank.sdk.capture.CaptureFlowContract import net.gini.android.bank.sdk.capture.CaptureFlowImportContract import net.gini.android.bank.sdk.capture.CaptureResult import net.gini.android.bank.sdk.capture.ResultError -import net.gini.android.bank.sdk.exampleapp.BuildConfig import net.gini.android.bank.sdk.exampleapp.R import net.gini.android.bank.sdk.exampleapp.core.PermissionHandler import net.gini.android.bank.sdk.exampleapp.databinding.ActivityMainBinding import net.gini.android.bank.sdk.exampleapp.ui.data.Configuration +import net.gini.android.capture.EntryPoint import net.gini.android.capture.requirements.RequirementsReport import net.gini.android.capture.util.CancellationToken @@ -89,16 +88,20 @@ class MainActivity : AppCompatActivity() { @SuppressLint("SetTextI18n") private fun showVersions() { binding.textGiniBankVersion.text = - getString(R.string.gini_capture_sdk_version) + BuildConfig.VERSION_NAME + getString(R.string.gini_bank_sdk_version) + net.gini.android.bank.sdk.BuildConfig.VERSION_NAME + + getString(R.string.gini_capture_sdk_version) + net.gini.android.capture.BuildConfig.VERSION_NAME + + getString(R.string.gini_client_id) + getString(R.string.gini_api_client_id) + } private fun addInputHandlers() { - binding.buttonStartScanner.setOnClickListener { v: View? -> - if (configurationViewModel.disableCameraPermissionFlow.value) { - startGiniCaptureSdk() - } else { - checkCameraPermission() - } + binding.buttonStartScanner.setOnClickListener { + checkIfAppShouldAskForCameraPermission(EntryPoint.BUTTON) + } + + binding.tilFieldEntryPoint.setEndIconOnClickListener { + checkIfAppShouldAskForCameraPermission(EntryPoint.FIELD) + } binding.textGiniBankVersion.setOnClickListener { @@ -120,6 +123,19 @@ class MainActivity : AppCompatActivity() { } + private fun checkIfAppShouldAskForCameraPermission(entryPoint: EntryPoint) { + configurationViewModel.setConfiguration( + configurationViewModel.configurationFlow.value.copy( + entryPoint = entryPoint + ) + ) + if (configurationViewModel.disableCameraPermissionFlow.value) { + startGiniCaptureSdk() + } else { + checkCameraPermission() + } + } + private fun checkCameraPermission(intent: Intent? = null) { lifecycleScope.launch { if (permissionHandler.grantPermission(Manifest.permission.CAMERA)) { diff --git a/bank-sdk/example-app/src/main/res/color/text_input_layout_stroke_color.xml b/bank-sdk/example-app/src/main/res/color/text_input_layout_stroke_color.xml new file mode 100644 index 0000000000..5184a8e46f --- /dev/null +++ b/bank-sdk/example-app/src/main/res/color/text_input_layout_stroke_color.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/bank-sdk/example-app/src/main/res/drawable/gini_logo.xml b/bank-sdk/example-app/src/main/res/drawable/gini_logo.xml new file mode 100644 index 0000000000..6629120b64 --- /dev/null +++ b/bank-sdk/example-app/src/main/res/drawable/gini_logo.xml @@ -0,0 +1,14 @@ + + + + diff --git a/bank-sdk/example-app/src/main/res/drawable/ic_camera.xml b/bank-sdk/example-app/src/main/res/drawable/ic_camera.xml new file mode 100644 index 0000000000..8e93524689 --- /dev/null +++ b/bank-sdk/example-app/src/main/res/drawable/ic_camera.xml @@ -0,0 +1,22 @@ + + + + diff --git a/bank-sdk/example-app/src/main/res/layout/activity_configuration.xml b/bank-sdk/example-app/src/main/res/layout/activity_configuration.xml index bd5a738098..e5873ef84a 100644 --- a/bank-sdk/example-app/src/main/res/layout/activity_configuration.xml +++ b/bank-sdk/example-app/src/main/res/layout/activity_configuration.xml @@ -4,7 +4,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context="net.gini.android.bank.exampleapp.ui.ConfigurationActivity"> + tools:context=".ui.ConfigurationActivity"> - - - - -