Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ data class Configuration(
val isSavePhotosLocallyEnabled: Boolean,
val isAlreadyPaidHintEnabled: Boolean,
val isPaymentDueHintEnabled: Boolean,
val isCreditNoteHintEnabled: Boolean,
)
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ data class ConfigurationResponse(
@Json(name = "alreadyPaidHintEnabled") val alreadyPaidHintEnabled: Boolean?,
@Json(name = "paymentDueHintEnabled") val paymentDueHintEnabled: Boolean?,
@Json(name = "savePhotosLocallyEnabled") val savePhotosLocallyEnabled: Boolean?,
@Json(name = "creditNoteHintEnabled") val creditNoteHintEnabled: Boolean?,
)

internal fun ConfigurationResponse.toConfiguration() = Configuration(
Expand All @@ -33,5 +34,6 @@ internal fun ConfigurationResponse.toConfiguration() = Configuration(
isAlreadyPaidHintEnabled = alreadyPaidHintEnabled ?: false,
isPaymentDueHintEnabled = paymentDueHintEnabled ?: false,
isSavePhotosLocallyEnabled = savePhotosLocallyEnabled ?: false,
isCreditNoteHintEnabled = creditNoteHintEnabled ?: false,
)

Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ class CaptureSdkStandAloneActivity : AppCompatActivity() {

private fun restoreFragmentListener() {
val fragment =
supportFragmentManager.findFragmentByTag(ClientCaptureSDKFragment::class.java.name) as? ClientCaptureSDKFragment?
supportFragmentManager.findFragmentByTag(
ClientCaptureSDKFragment::class.java.name
) as? ClientCaptureSDKFragment?
listener?.let { fragment?.setListener(it) }
}

Expand Down Expand Up @@ -83,4 +85,4 @@ class ClientCaptureSDKFragmentFactory(
else -> super.instantiate(classLoader, className)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import net.gini.android.capture.util.SharedPreferenceHelper
import net.gini.android.capture.util.SharedPreferenceHelper.SAF_STORAGE_URI_KEY
import javax.inject.Inject

@Suppress("LargeClass")
@AndroidEntryPoint
class ConfigurationActivity : AppCompatActivity() {

Expand Down Expand Up @@ -109,6 +110,7 @@ class ConfigurationActivity : AppCompatActivity() {
finish()
}

@Suppress("LongMethod")
private fun updateUIWithConfigurationObject(configuration: ExampleAppBankConfiguration) {
// setup sdk with default configuration
binding.layoutFeatureToggle.switchSetupSdkWithDefaultConfiguration.isChecked =
Expand All @@ -118,7 +120,8 @@ class ConfigurationActivity : AppCompatActivity() {
// Capture SDK
binding.layoutFeatureToggle.switchCaptureSdk.isChecked = configuration.isCaptureSDK
// Saving Invoices Locally
binding.layoutFeatureToggle.switchSaveInvoicesLocallyFeature.isChecked = configuration.saveInvoicesLocallyEnabled
binding.layoutFeatureToggle.switchSaveInvoicesLocallyFeature.isChecked =
configuration.saveInvoicesLocallyEnabled
// QR code scanning
binding.layoutFeatureToggle.switchQrCodeScanning.isChecked = configuration.isQrCodeEnabled
// only QR code scanning
Expand Down Expand Up @@ -240,6 +243,10 @@ class ConfigurationActivity : AppCompatActivity() {
binding.layoutFeatureToggle.editTextPaymentDueHintThresholdDays.hint =
configuration.paymentDueHintThresholdDays.toString()

// enable credit note hint
binding.layoutFeatureToggle.switchCreditNoteHint.isChecked =
configuration.isCreditNoteHintEnabled

// enable return reasons dialog
binding.layoutReturnAssistantToggles.switchReturnReasonsDialog.isChecked =
configuration.isReturnReasonsEnabled
Expand Down Expand Up @@ -602,6 +609,14 @@ class ConfigurationActivity : AppCompatActivity() {
}
}

//enable credit note hint for showing warning
binding.layoutFeatureToggle.switchCreditNoteHint.setOnCheckedChangeListener{ _, isChecked ->
configurationViewModel.setConfiguration(
configurationViewModel.configurationFlow.value.copy(
isCreditNoteHintEnabled = isChecked
)
)
}

// enable supported format help screen
binding.layoutHelpToggles.switchSupportedFormatsScreen.setOnCheckedChangeListener { _, isChecked ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,14 @@ class ConfigurationViewModel @Inject constructor(
documentImportEnabledFileTypes = configuration.documentImportEnabledFileTypes,
// enable bottom navigation bar
bottomNavigationBarEnabled = configuration.isBottomNavigationBarEnabled,
// enable payment hints
// enable already paid hint
alreadyPaidHintEnabled = configuration.isAlreadyPaidHintEnabled,
// enable payment due hint
paymentDueHintEnabled = configuration.isPaymentDueHintEnabled,
// set payment due hint threshold days
paymentDueHintThresholdDays = configuration.paymentDueHintThresholdDays,
// enable credit note hint
creditNoteHintEnabled = configuration.isCreditNoteHintEnabled,
// enable onboarding screens at first launch
showOnboardingAtFirstRun = configuration.isOnboardingAtFirstRunEnabled,
// enable onboarding at every launch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,18 @@ data class ExampleAppBankConfiguration(
val isFlashDefaultStateEnabled: Boolean = false,

// set import document type support
// net.gini.android.capture.GiniCapture.Builder#setDocumentImportEnabledFileTypes → radio buttons to select an available enum value
val documentImportEnabledFileTypes: DocumentImportEnabledFileTypes = DocumentImportEnabledFileTypes.PDF_AND_IMAGES,
// net.gini.android.capture.GiniCapture.Builder#setDocumentImportEnabledFileTypes →
// radio buttons to select an available enum value
val documentImportEnabledFileTypes: DocumentImportEnabledFileTypes =
DocumentImportEnabledFileTypes.PDF_AND_IMAGES,

// enable bottom navigation bar
// net.gini.android.capture.GiniCapture.Builder#setBottomNavigationBarEnabled → on/off switch
val isBottomNavigationBarEnabled: Boolean = false,

// enable Help screens custom bottom navigation bar
// net.gini.android.capture.GiniCapture.Builder#setHelpNavigationBarBottomAdapter → on/off switch to show a custom adapter implementation
// net.gini.android.capture.GiniCapture.Builder#setHelpNavigationBarBottomAdapter →
// on/off switch to show a custom adapter implementation
val isHelpScreensCustomBottomNavBarEnabled: Boolean = false,

// enable Error screens custom bottom navigation bar
Expand All @@ -56,11 +59,13 @@ data class ExampleAppBankConfiguration(
val isErrorScreensCustomBottomNavBarEnabled: Boolean = false,

// enable camera screens custom bottom navigation bar
// net.gini.android.capture.GiniCapture.Builder#setCameraNavigationBarBottomAdapter → on/off switch to show a custom adapter implementation
// net.gini.android.capture.GiniCapture.Builder#setCameraNavigationBarBottomAdapter →
// on/off switch to show a custom adapter implementation
val isCameraBottomNavBarEnabled: Boolean = false,

// enable review screens custom bottom navigation bar
// net.gini.android.capture.GiniCapture.Builder#setReviewBottomBarNavigationAdapter → on/off switch to show a custom adapter implementation
// net.gini.android.capture.GiniCapture.Builder#setReviewBottomBarNavigationAdapter →
// on/off switch to show a custom adapter implementation
val isReviewScreenCustomBottomNavBarEnabled: Boolean = false,

// enable image picker screens custom bottom navigation bar -> was implemented on iOS, not needed for Android
Expand All @@ -74,7 +79,8 @@ data class ExampleAppBankConfiguration(
val isOnboardingAtEveryLaunchEnabled: Boolean = false,

// enable custom onboarding pages
// net.gini.android.capture.GiniCapture.Builder#setCustomOnboardingPages → on/off switch to show custom onboarding pages
// net.gini.android.capture.GiniCapture.Builder#setCustomOnboardingPages →
// on/off switch to show custom onboarding pages
val isCustomOnboardingPagesEnabled: Boolean = false,

// enable align corners in custom onboarding pages
Expand All @@ -86,7 +92,8 @@ data class ExampleAppBankConfiguration(
val isLightingInCustomOnboardingEnabled: Boolean = false,

// enable QR code in custom onboarding pages
// net.gini.android.capture.GiniCapture.Builder#setOnboardingQRCodeIllustrationAdapter-> on/off switch to show custom adapter with animated illustrations
// net.gini.android.capture.GiniCapture.Builder#setOnboardingQRCodeIllustrationAdapter->
// on/off switch to show custom adapter with animated illustrations
val isQRCodeInCustomOnboardingEnabled: Boolean = false,

// enable multi page in custom onboarding pages
Expand All @@ -99,11 +106,13 @@ data class ExampleAppBankConfiguration(


// enable button's custom loading indicator
// net.gini.android.capture.GiniCapture.Builder#setOnButtonLoadingIndicatorAdapter → on/off switch to show a custom adapter implementation
// net.gini.android.capture.GiniCapture.Builder#setOnButtonLoadingIndicatorAdapter →
// on/off switch to show a custom adapter implementation
val isButtonsCustomLoadingIndicatorEnabled: Boolean = false,

// enable screen's custom loading indicator
// net.gini.android.capture.GiniCapture.Builder#setLoadingIndicatorAdapter → on/off switch to show a custom adapter implementation
// net.gini.android.capture.GiniCapture.Builder#setLoadingIndicatorAdapter →
// on/off switch to show a custom adapter implementation

val isScreenCustomLoadingIndicatorEnabled: Boolean = false,

Expand All @@ -116,7 +125,8 @@ data class ExampleAppBankConfiguration(
val isCustomHelpItemsEnabled: Boolean = false,

// enable custom navigation bar
// net.gini.android.capture.GiniCapture.Builder#setNavigationBarTopAdapter → on/off switch to show a custom adapter implementation
// net.gini.android.capture.GiniCapture.Builder#setNavigationBarTopAdapter →
// on/off switch to show a custom adapter implementation
val isCustomNavBarEnabled: Boolean = false,

// enable custom primary button in compose
Expand Down Expand Up @@ -161,6 +171,9 @@ data class ExampleAppBankConfiguration(
// payment due hint threshold days
val paymentDueHintThresholdDays: Int = GiniCapture.PAYMENT_DUE_HINT_THRESHOLD_DAYS,

// enable credit note hint
val isCreditNoteHintEnabled: Boolean = true,

// Digital invoice onboarding custom illustration
val isDigitalInvoiceOnboardingCustomIllustrationEnabled: Boolean = false,

Expand Down Expand Up @@ -219,6 +232,7 @@ data class ExampleAppBankConfiguration(
isAlreadyPaidHintEnabled = defaultCaptureConfiguration.alreadyPaidHintEnabled,
isPaymentDueHintEnabled = defaultCaptureConfiguration.paymentDueHintEnabled,
paymentDueHintThresholdDays = defaultCaptureConfiguration.paymentDueHintThresholdDays,
isCreditNoteHintEnabled = defaultCaptureConfiguration.creditNoteHintEnabled,
isOnboardingAtFirstRunEnabled = defaultCaptureConfiguration.showOnboardingAtFirstRun,
isOnboardingAtEveryLaunchEnabled = defaultCaptureConfiguration.showOnboarding,
isSupportedFormatsHelpScreenEnabled = defaultCaptureConfiguration.supportedFormatsHelpScreenEnabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ class CaptureResultListener(val context: Activity) : GiniCaptureFragmentListener
is CaptureSDKResult.Error -> {
Toast.makeText(
context,
"Error: ${(result.value as ResultError.FileImport).code} ${(result.value as ResultError.FileImport).message}",
"Error: ${(result.value as ResultError.FileImport).code} " +
"${(result.value as ResultError.FileImport).message}",
Toast.LENGTH_LONG
).show()

Expand All @@ -54,4 +55,4 @@ class CaptureResultListener(val context: Activity) : GiniCaptureFragmentListener
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -204,5 +204,11 @@
tools:text="Hello@World and stuff and foo and bar and whatchamacallit" />
</com.google.android.material.textfield.TextInputLayout>

</LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/switch_creditNoteHint"
style="@style/SwitchConfigurationStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/credit_note_hint_switch_label" />

</LinearLayout>
1 change: 1 addition & 0 deletions bank-sdk/example-app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
<string name="already_paid_hint_switch_label">Already Paid Hint</string>
<string name="payment_due_hint_switch_label">Payment Due Hint</string>
<string name="payment_due_hint_threshold_days_label">Payment Due Hint Threshold Days</string>
<string name="credit_note_hint_switch_label">Credit Note Hint</string>
<string name="open_with_switch_label">Open with</string>
<string name="qr_code_scanning_switch_label">QR code scanning</string>
<string name="only_qr_code_scanning_switch_label">QR code scanning only</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ data class CaptureConfiguration(
val bottomNavigationBarEnabled: Boolean = false,

/**
* Enable/disable the payment hint.
* Enable/disable the already paid hint.
*
* On by default.
*/
Expand All @@ -162,6 +162,13 @@ data class CaptureConfiguration(
*/
val paymentDueHintThresholdDays: Int = GiniCapture.PAYMENT_DUE_HINT_THRESHOLD_DAYS,

/**
* Enable/disable the credit note hint.
*
* On by default.
*/
val creditNoteHintEnabled: Boolean = true,

/**
* Set an adapter implementation to show a custom bottom navigation bar on the onboarding screen.
*/
Expand Down Expand Up @@ -276,6 +283,7 @@ internal fun GiniCapture.Builder.applyConfiguration(configuration: CaptureConfig
.setAlreadyPaidHintEnabled(configuration.alreadyPaidHintEnabled)
.setPaymentDueHintEnabled(configuration.paymentDueHintEnabled)
.setPaymentDueHintThresholdDays(configuration.paymentDueHintThresholdDays)
.setCreditNoteHintEnabled(configuration.creditNoteHintEnabled)
.setEntryPoint(configuration.entryPoint)
.setAllowScreenshots(configuration.allowScreenshots)
.setSaveInvoicesLocallyEnabled(configuration.saveInvoicesLocallyEnabled)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ internal constructor(
isPaymentDueHintEnabled = configuration.isPaymentDueHintEnabled,
isEInvoiceEnabled = configuration.isEInvoiceEnabled,
amplitudeApiKey = configuration.amplitudeApiKey ?: "",
isSavePhotosLocallyEnabled = configuration.isSavePhotosLocallyEnabled
isSavePhotosLocallyEnabled = configuration.isSavePhotosLocallyEnabled,
isCreditNoteHintEnabled = configuration.isCreditNoteHintEnabled,
)

@Suppress("LongMethod")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ class GiniCaptureDefaultNetworkServiceTest {
isQrCodeEducationEnabled = true,
isSavePhotosLocallyEnabled = true,
isAlreadyPaidHintEnabled = true,
isPaymentDueHintEnabled = true
isPaymentDueHintEnabled = true,
isCreditNoteHintEnabled = true
)

// Add more stubs if mapBankConfigurationToConfiguration uses other properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ class GiniCaptureFragmentTest {
amplitudeApiKey = TEST_API_KEY,
isSavePhotosLocallyEnabled = savePhotosLocallyEnabled,
isPaymentDueHintEnabled = false,
isAlreadyPaidHintEnabled = false
isAlreadyPaidHintEnabled = false,
isCreditNoteHintEnabled = false
)

return ConfigurationNetworkResult(testConfig, UUID.randomUUID())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public class GiniCapture {
private final boolean isAlreadyPaidHintEnabled;
private final boolean isPaymentDueHintEnabled;
private final int paymentDueHintThresholdDays;
private final boolean isCreditNoteHintEnabled;
private final InjectedViewAdapterInstance<OnboardingIllustrationAdapter> onboardingAlignCornersIllustrationAdapterInstance;
private final InjectedViewAdapterInstance<OnboardingIllustrationAdapter> onboardingLightingIllustrationAdapterInstance;
private final InjectedViewAdapterInstance<OnboardingIllustrationAdapter> onboardingMultiPageIllustrationAdapterInstance;
Expand Down Expand Up @@ -435,6 +436,7 @@ private GiniCapture(@NonNull final Builder builder) {
isAlreadyPaidHintEnabled = builder.isAlreadyPaidHintEnabled();
isPaymentDueHintEnabled = builder.isPaymentDueHintEnabled();
paymentDueHintThresholdDays = builder.getPaymentDueHintThresholdDays();
isCreditNoteHintEnabled = builder.isCreditNoteHintEnabled();
onboardingAlignCornersIllustrationAdapterInstance = builder.getOnboardingAlignCornersIllustrationAdapterInstance();
onboardingLightingIllustrationAdapterInstance = builder.getOnboardingLightingIllustrationAdapterInstance();
onboardingMultiPageIllustrationAdapterInstance = builder.getOnboardingMultiPageIllustrationAdapterInstance();
Expand Down Expand Up @@ -736,6 +738,10 @@ public int getPaymentDueHintThresholdDays() {
return paymentDueHintThresholdDays;
}

public boolean isCreditNoteHintEnabled() {
return isCreditNoteHintEnabled;
}

@Nullable
public OnboardingIllustrationAdapter getOnboardingAlignCornersIllustrationAdapter() {
if (onboardingAlignCornersIllustrationAdapterInstance == null) {
Expand Down Expand Up @@ -942,6 +948,7 @@ public void onAnalysisScreenEvent(@NotNull final Event<AnalysisScreenEvent> even
private boolean isAlreadyPaidHintEnabled = true;
private boolean isPaymentDueHintEnabled = true;
private int paymentDueHintThresholdDays = PAYMENT_DUE_HINT_THRESHOLD_DAYS;
private boolean isCreditNoteHintEnabled = true;
private InjectedViewAdapterInstance<OnboardingIllustrationAdapter> onboardingAlignCornersIllustrationAdapterInstance;
private InjectedViewAdapterInstance<OnboardingIllustrationAdapter> onboardingLightingIllustrationAdapterInstance;
private InjectedViewAdapterInstance<OnboardingIllustrationAdapter> onboardingMultiPageIllustrationAdapterInstance;
Expand Down Expand Up @@ -1378,6 +1385,11 @@ public Builder setPaymentDueHintThresholdDays(final int thresholdDays){
return this;
}

public Builder setCreditNoteHintEnabled(final Boolean enabled){
isCreditNoteHintEnabled = enabled;
return this;
}

private boolean isBottomNavigationBarEnabled() {
return isBottomNavigationBarEnabled;
}
Expand All @@ -1394,6 +1406,10 @@ private int getPaymentDueHintThresholdDays(){
return paymentDueHintThresholdDays;
}

private boolean isCreditNoteHintEnabled(){
return isCreditNoteHintEnabled;
}

@NonNull
private InjectedViewAdapterInstance<OnboardingIllustrationAdapter> getOnboardingAlignCornersIllustrationAdapterInstance() {
return onboardingAlignCornersIllustrationAdapterInstance;
Expand Down
Loading
Loading