Skip to content

Commit

Permalink
Merge pull request #375 from gini/BSDK-258-create-host-fragmets
Browse files Browse the repository at this point in the history
Bsdk 258 create host fragmets
  • Loading branch information
a-szotyori authored Feb 12, 2024
2 parents 6507dc7 + 70aa68f commit bc17706
Show file tree
Hide file tree
Showing 196 changed files with 4,325 additions and 4,762 deletions.
24 changes: 14 additions & 10 deletions .github/workflows/bank-sdk.check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,33 +132,37 @@ jobs:
java-version: '17'
cache: 'gradle'

- name: build debug screen api example app
- name: build release example app for QA
run: >
./gradlew bank-sdk:example-app:assembleDebug
./gradlew bank-sdk:example-app:assembleQaRelease
-PclientId="gini-mobile-test"
-PclientSecret="${{ secrets.GINI_MOBILE_TEST_CLIENT_SECRET }}"
-PreleaseKeystoreFile="screen_api_example.jks"
-PreleaseKeystorePassword='${{ secrets.BANK_SDK_EXAMPLE_APP_KEYSTORE_PASSWORD }}'
-PreleaseKeyAlias="screen_api_example"
-PreleaseKeyPassword='${{ secrets.BANK_SDK_EXAMPLE_APP_KEYSTORE_PASSWORD }}'
- name: archive debug screen api example app
- name: archive release example app for QA
uses: actions/upload-artifact@v3
with:
name: bank-sdk-example-app-debug
path: bank-sdk/example-app/build/outputs/apk/debug
name: bank-sdk-example-app-qa-release
path: bank-sdk/example-app/build/outputs/apk/qa/release

- name: build release screen api example app
- name: build release example app for production
run: >
./gradlew bank-sdk:example-app:assembleRelease
./gradlew bank-sdk:example-app:assembleProdRelease
-PclientId="gini-mobile-test"
-PclientSecret="${{ secrets.GINI_MOBILE_TEST_CLIENT_SECRET }}"
-PreleaseKeystoreFile="screen_api_example.jks"
-PreleaseKeystorePassword='${{ secrets.BANK_SDK_EXAMPLE_APP_KEYSTORE_PASSWORD }}'
-PreleaseKeyAlias="screen_api_example"
-PreleaseKeyPassword='${{ secrets.BANK_SDK_EXAMPLE_APP_KEYSTORE_PASSWORD }}'
- name: archive release screen api example app
- name: archive release example app for production
uses: actions/upload-artifact@v3
with:
name: bank-sdk-example-app-release
path: bank-sdk/example-app/build/outputs/apk/release
name: bank-sdk-example-app-prod-release
path: bank-sdk/example-app/build/outputs/apk/prod/release

android-lint:
runs-on: ubuntu-latest
Expand Down
62 changes: 31 additions & 31 deletions RELEASE-ORDER.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
DO NOT EDIT MANUALLY!
Automatically created by the updateReleaseOrderFile task.

Release order for :capture-sdk:sdk 3.8.1:
1. :capture-sdk:sdk 3.8.1

Release order for :core-api-library:library 2.1.3:
1. :core-api-library:library 2.1.3

Release order for :bank-api-library:library 3.1.2:
1. :core-api-library:library 2.1.3
2. :bank-api-library:library 3.1.2

Release order for :health-api-library:library 2.1.3:
1. :core-api-library:library 2.1.3
2. :health-api-library:library 2.1.3

Release order for :health-sdk:sdk 2.1.3:
1. :core-api-library:library 2.1.3
2. :health-api-library:library 2.1.3
3. :health-sdk:sdk 2.1.3

Release order for :capture-sdk:default-network 3.8.1:
1. :core-api-library:library 2.1.3
2. :bank-api-library:library 3.1.2
3. :capture-sdk:sdk 3.8.1
4. :capture-sdk:default-network 3.8.1

Release order for :bank-sdk:sdk 3.8.1:
1. :core-api-library:library 2.1.3
2. :bank-api-library:library 3.1.2
3. :capture-sdk:sdk 3.8.1
4. :capture-sdk:default-network 3.8.1
5. :bank-sdk:sdk 3.8.1
Release order for :capture-sdk:sdk 3.9.0:
1. :capture-sdk:sdk 3.9.0

Release order for :core-api-library:library 2.1.4:
1. :core-api-library:library 2.1.4

Release order for :bank-api-library:library 3.1.3:
1. :core-api-library:library 2.1.4
2. :bank-api-library:library 3.1.3

Release order for :health-api-library:library 2.1.4:
1. :core-api-library:library 2.1.4
2. :health-api-library:library 2.1.4

Release order for :health-sdk:sdk 2.1.4:
1. :core-api-library:library 2.1.4
2. :health-api-library:library 2.1.4
3. :health-sdk:sdk 2.1.4

Release order for :capture-sdk:default-network 3.9.0:
1. :core-api-library:library 2.1.4
2. :bank-api-library:library 3.1.3
3. :capture-sdk:sdk 3.9.0
4. :capture-sdk:default-network 3.9.0

Release order for :bank-sdk:sdk 3.9.0:
1. :core-api-library:library 2.1.4
2. :bank-api-library:library 3.1.3
3. :capture-sdk:sdk 3.9.0
4. :capture-sdk:default-network 3.9.0
5. :bank-sdk:sdk 3.9.0

2 changes: 1 addition & 1 deletion bank-api-library/library/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Maven coordinates
# groupId is in the root gradle.properties
artifactId=gini-bank-api-lib
version=3.1.2
version=3.1.3
# Version code is visible only in the generated BuildConfig file
versionCode=0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import org.junit.Assert.assertTrue
import org.junit.Test
import org.junit.runner.RunWith
import java.util.*
import kotlin.time.Duration.Companion.seconds

/**
* Created by Alpár Szotyori on 24.01.22.
Expand All @@ -47,7 +48,7 @@ class GiniBankAPIIntegrationTest: GiniCoreAPIIntegrationTest<BankApiDocumentMana

@Test
@Throws(Exception::class)
fun sendFeedback_withCompoundExtractions_forDocument_withoutLineItems() = runTest {
fun sendFeedback_withCompoundExtractions_forDocument_withoutLineItems() = runTest(timeout = 30.seconds) {
val assetManager = getApplicationContext<Context>().resources.assets
val testDocumentAsStream = assetManager.open("test.jpg")
Assert.assertNotNull("test image test.jpg could not be loaded", testDocumentAsStream)
Expand Down Expand Up @@ -94,7 +95,7 @@ class GiniBankAPIIntegrationTest: GiniCoreAPIIntegrationTest<BankApiDocumentMana

@Test
@Throws(Exception::class)
fun sendFeedback_withoutCompoundExtractions_forDocument_withoutLineItems() = runTest {
fun sendFeedback_withoutCompoundExtractions_forDocument_withoutLineItems() = runTest(timeout = 30.seconds) {
val assetManager = getApplicationContext<Context>().resources.assets
val testDocumentAsStream = assetManager.open("test.jpg")
Assert.assertNotNull("test image test.jpg could not be loaded", testDocumentAsStream)
Expand Down Expand Up @@ -123,7 +124,7 @@ class GiniBankAPIIntegrationTest: GiniCoreAPIIntegrationTest<BankApiDocumentMana

@Test
@Throws(Exception::class)
fun sendFeedback_withoutCompoundExtractions_forDocument_withLineItems() = runTest {
fun sendFeedback_withoutCompoundExtractions_forDocument_withLineItems() = runTest(timeout = 30.seconds) {
val assetManager = getApplicationContext<Context>().resources.assets
val testDocumentAsStream = assetManager.open("line-items.pdf")
Assert.assertNotNull("test pdf line-items.pdf could not be loaded", testDocumentAsStream)
Expand Down Expand Up @@ -152,7 +153,7 @@ class GiniBankAPIIntegrationTest: GiniCoreAPIIntegrationTest<BankApiDocumentMana

@Test
@Throws(Exception::class)
fun sendFeedback_withCompoundExtractions_forDocument_withLineItems() = runTest {
fun sendFeedback_withCompoundExtractions_forDocument_withLineItems() = runTest(timeout = 30.seconds) {
val assetManager = getApplicationContext<Context>().resources.assets
val testDocumentAsStream = assetManager.open("line-items.pdf")
Assert.assertNotNull("test pdf line-items.pdf could not be loaded", testDocumentAsStream)
Expand Down Expand Up @@ -188,7 +189,7 @@ class GiniBankAPIIntegrationTest: GiniCoreAPIIntegrationTest<BankApiDocumentMana

@Test
@Throws(Exception::class)
fun testResolvePayment() = runTest {
fun testResolvePayment() = runTest(timeout = 30.seconds) {
val paymentRequestId = createPaymentRequest()
val paymentRequest = giniCoreApi.documentManager.getPaymentRequest(paymentRequestId).dataOrThrow
val (_, _, recipient, iban, _, amount, purpose) = paymentRequest
Expand All @@ -207,7 +208,7 @@ class GiniBankAPIIntegrationTest: GiniCoreAPIIntegrationTest<BankApiDocumentMana

@Test
@Throws(Exception::class)
fun testGetPayment() = runTest {
fun testGetPayment() = runTest(timeout = 30.seconds) {
val paymentRequestId = createPaymentRequest()
val paymentRequest = giniCoreApi.documentManager.getPaymentRequest(paymentRequestId).dataOrThrow
val (_, _, recipient, iban, bic, amount, purpose) = paymentRequest
Expand All @@ -226,7 +227,7 @@ class GiniBankAPIIntegrationTest: GiniCoreAPIIntegrationTest<BankApiDocumentMana

@Test
@Throws(Exception::class)
fun logErrorEvent() = runTest {
fun logErrorEvent() = runTest(timeout = 30.seconds) {
val errorEvent = ErrorEvent(
Build.MODEL, "Android", Build.VERSION.RELEASE,
"not available", BuildConfig.VERSION_NAME, "Error logging integration test"
Expand Down
9 changes: 8 additions & 1 deletion bank-sdk/example-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,11 @@ $ ./gradlew bank-sdk:example-app:assembleRelease \
-PclientId=<Gini API client id> \
-PclientSecret=<Gini API client secret>
```


Flavors
=======

The example app has three flavors: `dev`, `prod` and `qa`. The `dev` flavor is used by default. The `prod` flavor
is used for creating release builds which can be shared with clients while the `qa` flavor is used for creating release builds
for QA purposes. The difference between `prod` and `qa` is that `qa` allows using custom SSL root certificates for
SSL proxies (e.g. Charles Proxy).
16 changes: 16 additions & 0 deletions bank-sdk/example-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugins {
kotlin("kapt")
id("com.google.dagger.hilt.android")
id("kotlin-parcelize")
id("androidx.navigation.safeargs.kotlin")
}

// TODO: construct version code and name in fastlane and inject them
Expand Down Expand Up @@ -75,6 +76,19 @@ android {
resValue("string", "gini_api_client_secret", credentials["clientSecret"] ?: "")
}
}
flavorDimensions += "environment"
productFlavors {
create("prod") {
dimension = "environment"
}
create("dev") {
isDefault = true
dimension = "environment"
}
create("qa") {
dimension = "environment"
}
}
compileOptions {
sourceCompatibility(JavaVersion.VERSION_1_8)
targetCompatibility(JavaVersion.VERSION_1_8)
Expand Down Expand Up @@ -120,6 +134,8 @@ dependencies {
implementation(libs.lottie)

implementation(libs.hilt.library)
implementation(libs.navigation.fragment.ktx)
implementation(libs.navigation.ui.ktx)
kapt(libs.hilt.compiler)

implementation(libs.androidx.lifecycle.runtime.ktx)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<network-security-config>
<debug-overrides>
<base-config cleartextTrafficPermitted="false">
<trust-anchors>
<!-- Trust user added CAs while debuggable only -->
<certificates src="system" />
<certificates src="user" />
</trust-anchors>
</debug-overrides>
</base-config>
</network-security-config>
5 changes: 5 additions & 0 deletions bank-sdk/example-app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@
</intent-filter>
</activity>

<activity
android:name=".ui.CaptureFlowHostActivity"
android:launchMode="singleTask"
android:exported="false"/>

<provider
android:name="androidx.core.content.FileProvider"
android:authorities=".fileprovider"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package net.gini.android.bank.sdk.exampleapp.ui

import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.IntentCompat
import androidx.fragment.app.FragmentContainerView
import dagger.hilt.android.AndroidEntryPoint
import net.gini.android.bank.sdk.exampleapp.R

private const val EXTRA_IN_OPEN_WITH_INTENT = "EXTRA_IN_OPEN_WITH_INTENT"

@AndroidEntryPoint
class CaptureFlowHostActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_capture_flow_host)

if (savedInstanceState == null) {
val openWithIntent = IntentCompat.getParcelableExtra(intent, EXTRA_IN_OPEN_WITH_INTENT, Intent::class.java)
if (openWithIntent != null) {
startBankSDKForOpenWith(openWithIntent)
}
}
}

private fun startBankSDKForOpenWith(openWithIntent: Intent) {
findViewById<FragmentContainerView>(R.id.fragment_host).getFragment<ClientBankSDKFragment>()
.startBankSDKForIntent(openWithIntent)
}


private fun startCaptureSDKForOpenWith(openWithIntent: Intent) {
findViewById<FragmentContainerView>(R.id.fragment_host).getFragment<ClientCaptureSDKFragment>()
.startCaptureSDKForIntent(openWithIntent)
}

companion object {
fun newIntent(context: Context, openWithIntent: Intent? = null) =
Intent(context, CaptureFlowHostActivity::class.java).apply {
openWithIntent?.let { putExtra(EXTRA_IN_OPEN_WITH_INTENT, it) }
}
}

}
Loading

0 comments on commit bc17706

Please sign in to comment.