Feature Switching
Introduction
You can customize the experience and features available in the SDK through the use of feature toggles. There are two areas in which features can be toggled:
Capture
Use the following options to modify the capabilities of the Capture
Description | Default value | iOS Property | Android Property |
---|---|---|---|
Enables the tips feature | true | enableCaptureTips | enableCaptureTips |
Enables a blur warning on the preview screen after capturing | true | enableBlurDetection (Note: this feature is only available on the iPhone 6s and newer) | Not supported on Android |
Enables the visibility of feedback while capturing receipt. | true | enableCaptureProgressFeedback | enableCaptureProgressFeedback |
Enables toast on the long receipt capture screen. | true | enableLongReceiptPageToast | enableLongReceiptPageToast |
Enables the auto-capture feature | true | enableAutoCapture | enableAutoCapture |
Enables the user to select an image from their phone’s image gallery | true | enableImageGallery | enableGalleryImport |
Enables the long receipt capture feature - capturing a longer receipt composed from a top and bottom image | true | enableLongCapture | enableLongCapture |
Enables the ability to crop captured images | true | enableCrop | enableCrop |
Enables the ability to toggle the phone’s flash on/off to help capture in low-light situations | true | enableFlash | allowFlashToggling |
(Android only) Sets the flash mode that will be set by default when the capture flow begins | FlashMode.FLASH_MODE_AUTO | N/A | defaultFlashMode |
Starts the capture screen with auto-capture mode enabled by default | true | defaultToAutoCapture | initialAutoCaptureState |
Enables the ability to attach the device’s current location to the image being captured. Requires location permission to have been granted by the user before launching capture. Ensure your app has appropriate location permission | false | attachLocationData | attachLocationData |
Ensures that the images returned as a result of capture comply with the size and quality requirements of Sensibill API.Note: this flag can only be changed if using standalone capture. | true | compressForSensibillApi | compressForSensibillApi |
(Android only) Will cause the capture flow to set the WindowManager.LayoutParams.FLAG_SECURE flag in order to prevent users from taking screenshots from within the flow | false | N/A | enableSecureWindow |
Determines the maximal number of receipts a user can capture in a single capture session. The number must be in 1-10 range. | 1 | maxImages | maxImages |
Reference
iOS CaptureFeatureFlagsAndroid CaptureConfig
Instructions
Use SDKConfiguration.shared.capture.features
to enable and disable features and use SDKConfiguration.shared.capture.theme
to customize the appearance of the capture flow. Please refer to the above documentation for a full list of configurable properties.
Example:
import Sensibill
class ViewController: UIViewController {
// MARK: - Private Methods
private func startReceiptCaptureFlow() {
// Disable crop functionality
SDKConfiguration.shared.capture.features.enableCrop = false
// Set auto-capture detection rectangle border line width
SDKConfiguration.shared.capture.theme.detectionlineWidth = 2.0
// Update auto-capture processing circle edge stroke color
SDKConfiguration.shared.capture.theme.captureCircleStrokeColor = UIColor.red
// create instance of coordinator
let coordinator = CaptureFlowCoordinator(host: self)
...
}
}
Depending on your use case for capture, the method for feature customization may change. Please find below the appropriate method for your use case.
Customizing the Default CaptureConfig
By default, every created instance of the capture flow will use the default CaptureConfig
object: CaptureConfig.defaultConfig
.
This default CaptureConfig
can be modified to globally change the default capture configuration. Once a new default config has been set, every subsequent instance of any capture use case will use that default, unless otherwise directly overridden.
This property lives in a Kotlin object
(singleton), so it should be customized either in your Application.onCreate
, or when you set up the SensibillSDK
. The customized values will then be used from that point onward.
Kotlin
// Use default settings, overriding the maximum captured image limit to be 5
CaptureConfig.defaultConfig = CaptureConfig.defaultConfig.copy(
maxImages = 5
)
Java
// Use default settings, overriding the maximum captured image limit to be 5
final CaptureConfig intendedDefaultConfig = new CaptureConfig(
true,
true,
FlashMode.FLASH_MODE_AUTO,
true,
true,
true,
true,
5,
true,
true,
false,
false,
true,
true
);
CaptureConfig.Companion.setDefaultConfig(intendedDefaultConfig);
Reference
CaptureConfigdefault CaptureConfig
Customizing Capture Launched From the Spend Manager UI
The only way to customize capture launched from the Spend Manager UI is to change the default CaptureConfig
(see previous section).
Customizing Capture for Capture Flow
When customizing capture when using the Capture Flow, use CaptureConfig
’s built in copy
method to create a modified copy of the default configuration for use with the Capture Flow.
Kotlin
val config = CaptureConfig.defaultConfig.copy(
allowFlashToggling = false,
enableLongCapture = false
)
Java
final CaptureConfig config = new CaptureConfig(
false,
FlashMode.FLASH_MODE_AUTO,
false,
true,
true,
true,
true,
false,
1,
false,
true,
true,
true,
true
);
Reference Launching the Capture Flowdefault CaptureConfig
Customizing Standalone Capture
When customizing capture when Standalone Capture directly, create a new CaptureConfig
to be passed as an Intent extra to the StandaloneCaptureActivity
, or as an argument to a CaptureImages
ActivityResultLauncher.launch()
call.
Kotlin
val config = CaptureConfig(
allowFlashToggling = false,
enableLongCapture = false
)
Java
final CaptureConfig config = new CaptureConfig(
false,
FlashMode.FLASH_MODE_AUTO,
false,
true,
true,
true,
true,
true,
3,
false,
true,
true,
true,
true
);
Spend Manager UI
Spend Manager has both a mobile and desktop web version, as such configuration/feature are modified by Sensibill. Please contact Sensibill support to modify these values.
Description | States | Default state |
---|---|---|
Email receipt registration. Determines if a user should be allowed/required to set an email receipt address | Optional (default), Required, Disabled | optional |
Allow exports | true/false | true |
Show receipt folders | true/false | true |
Show receipt notes | true/false | true |
Show receipt categories | true/false | true |
Enable insights and achievement | true/false | true |