Skip to content

Commit

Permalink
feat(capture-sdk): Set GiniBankVer
Browse files Browse the repository at this point in the history
PP-778
  • Loading branch information
danicretu committed Aug 28, 2024
1 parent 6ce0ecb commit 8729182
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.gini.android.bank.sdk.capture

import net.gini.android.bank.sdk.BuildConfig
import net.gini.android.bank.sdk.capture.skonto.SkontoNavigationBarBottomAdapter
import net.gini.android.capture.DocumentImportEnabledFileTypes
import net.gini.android.capture.EntryPoint
Expand Down Expand Up @@ -233,6 +234,7 @@ internal fun GiniCapture.Builder.applyConfiguration(configuration: CaptureConfig
.setBottomNavigationBarEnabled(configuration.bottomNavigationBarEnabled)
.setEntryPoint(configuration.entryPoint)
.setAllowScreenshots(configuration.allowScreenshots)
.setGiniBankVersion(BuildConfig.VERSION_NAME)
.apply {
configuration.eventTracker?.let { setEventTracker(it) }
configuration.errorLoggerListener?.let { setCustomErrorLoggerListener(it) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ public class GiniCapture {
private final EntryPoint entryPoint;
private final boolean allowScreenshots;

private final String mGiniBankVersion;


/**
* Retrieve the current instance.
Expand Down Expand Up @@ -345,6 +347,7 @@ private GiniCapture(@NonNull final Builder builder) {
onButtonLoadingIndicatorAdapterInstance = builder.getOnButtonLoadingIndicatorAdapterInstance();
entryPoint = builder.getEntryPoint();
allowScreenshots = builder.getAllowScreenshots();
mGiniBankVersion = builder.getGiniBankVersion();
}

/**
Expand Down Expand Up @@ -695,6 +698,13 @@ public boolean getAllowScreenshots() {
return allowScreenshots;
}

/**
* Get the version number of GiniBank
*
* @return the version number
*/
public String getGiniBankVersion() { return mGiniBankVersion; }

public static GiniCaptureFragment createGiniCaptureFragment() {
if (!GiniCapture.hasInstance()) {
throw new IllegalStateException("GiniCapture instance was created. Call GiniCapture.newInstance() before creating the GiniCaptureFragment.");
Expand Down Expand Up @@ -771,6 +781,8 @@ public static class Builder {
private boolean mFlashButtonEnabled;
private boolean mIsFlashOnByDefault = false;

private String mGiniBankVersion = "";

private EventTracker mEventTracker = new EventTracker() {
@Override
public void onOnboardingScreenEvent(@NotNull final Event<OnboardingScreenEvent> event) {
Expand Down Expand Up @@ -808,6 +820,8 @@ public void onAnalysisScreenEvent(@NotNull final Event<AnalysisScreenEvent> even
private EntryPoint entryPoint = Internal.DEFAULT_ENTRY_POINT;
private boolean allowScreenshots = true;

private String giniBankVersion;

/**
* Create a new {@link GiniCapture} instance.
*/
Expand Down Expand Up @@ -1344,6 +1358,15 @@ public Builder setAllowScreenshots(boolean allowScreenshots) {
private boolean getAllowScreenshots() {
return allowScreenshots;
}

public Builder setGiniBankVersion(String giniBankVersion) {
this.giniBankVersion = giniBankVersion;
return this;
}

private String getGiniBankVersion() {
return giniBankVersion;
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ internal object UploadMetadata {
private const val USER_COMMENT_PLATFORM = "Platform"
private const val USER_COMMENT_OS_VERSION = "OSVer"
private const val USER_COMMENT_GINI_CAPTURE_VERSION = "GiniCaptureVer"
private const val USER_COMMENT_GINI_BANK_VERSION = "GiniBankVer"
private const val USER_COMMENT_DEVICE_ORIENTATION = "DeviceOrientation"
private const val USER_COMMENT_DEVICE_TYPE = "DeviceType"
private const val USER_COMMENT_SOURCE = "Source"
Expand Down Expand Up @@ -70,10 +71,12 @@ internal object UploadMetadata {
metadataMap[USER_COMMENT_GINI_CAPTURE_VERSION] = BuildConfig.VERSION_NAME.replace(" ", "")

if (GiniCapture.hasInstance()) {
metadataMap[USER_COMMENT_ENTRY_POINT] = entryPointToString(GiniCapture.getInstance().getEntryPoint())
metadataMap[USER_COMMENT_ENTRY_POINT] = entryPointToString(GiniCapture.getInstance().entryPoint)
metadataMap[USER_COMMENT_GINI_BANK_VERSION] = GiniCapture.getInstance().giniBankVersion
} else {
metadataMap[USER_COMMENT_ENTRY_POINT] = entryPointToString(GiniCapture.Internal.DEFAULT_ENTRY_POINT)
}

return convertMapToCSV(metadataMap)
}

Expand Down

0 comments on commit 8729182

Please sign in to comment.