Skip to content

Commit

Permalink
refactor: Refactor the example apps and merge them into one
Browse files Browse the repository at this point in the history
- Delete bank example app
- Move capture example app to bank-sdk
- Refactor the package name to fit the bank

PIA-4417
  • Loading branch information
abolfazlimahdi committed Sep 5, 2023
1 parent 4add54f commit b92ec32
Show file tree
Hide file tree
Showing 198 changed files with 318 additions and 1,503 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import net.gini.gradle.*
import org.gradle.internal.impldep.org.junit.experimental.categories.Categories.CategoryFilter.exclude

plugins {
id("com.android.application")
Expand All @@ -23,15 +24,15 @@ plugins {

android {
// after upgrading to AGP 8, we need this (copied from the module's AndroidManifest.xml
namespace = "net.gini.android.capture.screen"
namespace = "net.gini.android.bank.screen"
compileSdk = libs.versions.android.compileSdk.get().toInt()

// after upgrading to AGP 8, we need this to have the defaultConfig block
buildFeatures {
buildConfig = true
}
defaultConfig {
applicationId = "net.gini.android.capture.screenapiexample"
applicationId = "net.gini.android.bank.screenapiexample"

minSdk = libs.versions.android.minSdk.get().toInt()
targetSdk = libs.versions.android.targetSdk.get().toInt()
Expand Down Expand Up @@ -91,7 +92,7 @@ tasks.withType(type = org.jetbrains.kotlin.gradle.internal.KaptGenerateStubsTask
}

dependencies {
// For testing the local version
// For testing the local version
api(project(":capture-sdk:sdk"))
// For testing a released version
//implementation "net.gini.android:gini-capture-sdk:0.0.1"
Expand All @@ -101,6 +102,11 @@ dependencies {
// For testing a released version
//implementation "net.gini.android:gini-capture-sdk-default-network:0.0.1"

// For testing the local version
api(project(":bank-sdk:sdk"))
// For testing a released version
//implementation "net.gini.android:gini-bank-sdk:3.3.0"

implementation(libs.androidx.appcompat)
implementation(libs.androidx.activity.ktx)
implementation(libs.androidx.coordinatorlayout)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package net.gini.android.capture.screen.screenshots;

import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;

import android.content.Context;
import android.content.Intent;

Expand All @@ -11,6 +9,8 @@
import androidx.test.uiautomator.UiSelector;
import androidx.test.uiautomator.Until;

import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;

public class Helper {

public static final long APP_START_TIMEOUT = 10_000;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package net.gini.android.capture.screen.screenshots.screens.screenapi;

import static net.gini.android.capture.screen.screenshots.Helper.isObjectAvailable;

import net.gini.android.capture.screen.screenshots.screens.Screen;

import androidx.test.uiautomator.UiDevice;
import androidx.test.uiautomator.UiSelector;

import static net.gini.android.capture.screen.screenshots.Helper.isObjectAvailable;

public class AnalysisScreen implements Screen {

private static final String IMAGE_RES_ID =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package net.gini.android.capture.screen.screenshots.screens.screenapi;

import static net.gini.android.capture.screen.screenshots.Helper.isObjectAvailable;

import net.gini.android.capture.screen.screenshots.screens.Screen;

import androidx.test.uiautomator.UiDevice;
import androidx.test.uiautomator.UiObject;
import androidx.test.uiautomator.UiObjectNotFoundException;
import androidx.test.uiautomator.UiSelector;

import static net.gini.android.capture.screen.screenshots.Helper.isObjectAvailable;

public class MainScreen implements Screen {

private static final String START_SCANNER_BUTTON_RES_ID =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package net.gini.android.capture.screen.screenshots.screens.screenapi;

import static net.gini.android.capture.screen.screenshots.Helper.isObjectAvailable;

import net.gini.android.capture.screen.screenshots.screens.Screen;

import androidx.test.uiautomator.UiDevice;
import androidx.test.uiautomator.UiObject;
import androidx.test.uiautomator.UiObjectNotFoundException;
import androidx.test.uiautomator.UiSelector;

import static net.gini.android.capture.screen.screenshots.Helper.isObjectAvailable;

public class OnboardingScreen implements Screen {

private static final String NEXT_BUTTON_RES_ID =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package net.gini.android.capture.screen.screenshots.screens.screenapi;

import static net.gini.android.capture.screen.screenshots.Helper.isObjectAvailable;

import net.gini.android.capture.screen.screenshots.screens.Screen;

import androidx.test.uiautomator.UiDevice;
import androidx.test.uiautomator.UiObject;
import androidx.test.uiautomator.UiObjectNotFoundException;
import androidx.test.uiautomator.UiSelector;

import static net.gini.android.capture.screen.screenshots.Helper.isObjectAvailable;

public class ReviewScreen implements Screen {

private static final String ROTATE_BUTTON_RES_ID =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="net.gini.android.capture.screen">
package="net.gini.android.bank.screen">

<uses-permission android:name="android.permission.CAMERA" />

Expand Down Expand Up @@ -31,13 +31,13 @@
android:required="true" />

<application
android:name="net.gini.android.capture.screen.ScreenApiExampleApp"
android:name="net.gini.android.bank.screen.ExampleApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:theme="@style/AppTheme">
<activity android:name="net.gini.android.capture.screen.ui.MainActivity"
<activity android:name="net.gini.android.bank.screen.ui.MainActivity"
android:launchMode="singleTask"
android:exported="true">
<intent-filter>
Expand All @@ -63,22 +63,35 @@
<data android:mimeType="application/pdf" />
</intent-filter>
</activity>
<activity android:name="net.gini.android.capture.screen.ui.CameraScreenApiActivity"
<activity android:name="net.gini.android.bank.screen.ui.CameraScreenApiActivity"
android:label="@string/gc_title_camera"
android:theme="@style/GiniCaptureTheme"/>
<activity
android:name="net.gini.android.capture.screen.ui.ExtractionsActivity"
android:name="net.gini.android.bank.screen.ui.ExtractionsActivity"
android:label="@string/title_extractions" />
<activity
android:name=".ui.CustomHelpActivity"
android:name="net.gini.android.bank.screen.ui.CustomHelpActivity"
android:label="@string/custom_help_screen_title" />

<activity android:name="net.gini.android.capture.screen.ui.ConfigurationActivity"
<activity android:name="net.gini.android.bank.screen.ui.ConfigurationActivity"
android:label="@string/configuration_activity_title" />

<activity android:name=".ui.pay.PayActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />

<data
android:host="payment"
android:scheme="ginipay" />
</intent-filter>
</activity>

<provider
android:name="androidx.core.content.FileProvider"
android:authorities="net.gini.android.capture.screen.fileprovider"
android:authorities="net.gini.android.bank.screen.fileprovider"
android:grantUriPermissions="true"
android:exported="false">
<meta-data
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.gini.android.capture.screen
package net.gini.android.bank.screen

import androidx.multidex.MultiDexApplication
import dagger.hilt.android.HiltAndroidApp
Expand All @@ -11,7 +11,7 @@ import javax.inject.Inject
*/

@HiltAndroidApp
class ScreenApiExampleApp : MultiDexApplication() {
class ExampleApp : MultiDexApplication() {
@set:Inject var giniCaptureDefaultNetworkService: GiniCaptureDefaultNetworkService? = null

fun clearGiniCaptureNetworkInstances() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.gini.android.capture.screen.core
package net.gini.android.bank.screen.core

import android.util.Log
import kotlinx.coroutines.CoroutineScope
Expand All @@ -10,7 +10,6 @@ import net.gini.android.core.api.Resource
import net.gini.android.core.api.models.Document
import net.gini.android.core.api.models.ExtractionsContainer
import net.gini.android.core.api.models.SpecificExtraction
import java.lang.Exception
import kotlin.coroutines.CoroutineContext

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.gini.android.capture.screen.core
package net.gini.android.bank.screen.core

import android.content.Intent
import android.os.Bundle
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.gini.android.bank.sdk.screenapiexample.util
package net.gini.android.bank.screen.core

sealed class ResultWrapper<out T> {
class Success<T>(val value: T) : ResultWrapper<T>()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.gini.android.capture.screen.core
package net.gini.android.bank.screen.core

import android.Manifest
import android.annotation.SuppressLint
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package net.gini.android.capture.screen.core.di
package net.gini.android.bank.screen.core.di

import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import net.gini.android.capture.screen.ScreenApiExampleApp
import net.gini.android.bank.screen.ExampleApp
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import javax.inject.Singleton
Expand All @@ -16,6 +16,6 @@ class AppModule {
@Singleton
@Provides
fun bindScreenApiExampleAppLogger(): Logger {
return LoggerFactory.getLogger(ScreenApiExampleApp::class.java)
return LoggerFactory.getLogger(ExampleApp::class.java)
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.gini.android.capture.screen.core.di
package net.gini.android.bank.screen.core.di

import android.content.Context
import android.text.TextUtils
Expand All @@ -7,15 +7,15 @@ import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import net.gini.android.bank.screen.R
import net.gini.android.capture.network.GiniCaptureDefaultNetworkService
import net.gini.android.capture.screen.R
import net.gini.android.core.api.DocumentMetadata
import org.slf4j.Logger
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
class GiniCaptureModule {
class GiniExampleModule {

@Singleton
@Provides
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package net.gini.android.capture.screen.ui
package net.gini.android.bank.screen.ui

import android.graphics.BitmapFactory
import android.graphics.Rect
import android.graphics.pdf.PdfRenderer
import android.net.Uri
import net.gini.android.bank.screen.R
import net.gini.android.capture.Document
import net.gini.android.capture.camera.CameraActivity
import net.gini.android.capture.camera.CameraFragmentListener.DocumentCheckResultCallback
import net.gini.android.capture.screen.R
import net.gini.android.capture.util.IntentHelper
import net.gini.android.capture.util.UriHelper
import org.slf4j.LoggerFactory
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.gini.android.capture.screen.ui
package net.gini.android.bank.screen.ui

import android.app.Activity
import android.content.Intent
Expand All @@ -13,14 +13,14 @@ import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch
import net.gini.android.bank.screen.R
import net.gini.android.bank.screen.databinding.ActivityConfigurationBinding
import net.gini.android.bank.screen.ui.MainActivity.Companion.CAMERA_PERMISSION_BUNDLE
import net.gini.android.bank.screen.ui.MainActivity.Companion.CONFIGURATION_BUNDLE
import net.gini.android.bank.screen.ui.data.Configuration
import net.gini.android.capture.DocumentImportEnabledFileTypes
import net.gini.android.capture.EntryPoint
import net.gini.android.capture.internal.util.ActivityHelper.interceptOnBackPressed
import net.gini.android.capture.screen.R
import net.gini.android.capture.screen.databinding.ActivityConfigurationBinding
import net.gini.android.capture.screen.ui.MainActivity.Companion.CAMERA_PERMISSION_BUNDLE
import net.gini.android.capture.screen.ui.MainActivity.Companion.CONFIGURATION_BUNDLE
import net.gini.android.capture.screen.ui.data.Configuration

@AndroidEntryPoint
class ConfigurationActivity : AppCompatActivity() {
Expand Down Expand Up @@ -191,6 +191,9 @@ class ConfigurationActivity : AppCompatActivity() {
else -> R.id.btn_buttonEntryPoint
}
binding.toggleBtnEntryPoint.check(checkedEntryPointButtonId)

// 31 enable return reasons dialog
binding.switchEnableReturnReasonsDialog.isChecked = configuration.enableReturnReasons
}

private fun setConfigurationFeatures() {
Expand Down Expand Up @@ -501,6 +504,15 @@ class ConfigurationActivity : AppCompatActivity() {
)
}

// 31 enable return reasons dialog
binding.switchEnableReturnReasonsDialog.setOnCheckedChangeListener { _, isChecked ->
configurationViewModel.setConfiguration(
configurationViewModel.configurationFlow.value.copy(
enableReturnReasons = isChecked
)
)
}

}

}
Loading

0 comments on commit b92ec32

Please sign in to comment.