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

DescriptionDefault valueiOS PropertyAndroid Property
Enables the tips featuretrueenableCaptureTipsenableCaptureTips
Enables a blur warning on the preview screen after capturingtrueenableBlurDetection
(Note: this feature is only available on the iPhone 6s and newer)
Not supported on Android
Enables the visibility of feedback while capturing receipt.trueenableCaptureProgressFeedbackenableCaptureProgressFeedback
Enables toast on the long receipt capture screen.trueenableLongReceiptPageToastenableLongReceiptPageToast
Enables the auto-capture featuretrueenableAutoCaptureenableAutoCapture
Enables the user to select an image from their phone’s image gallerytrueenableImageGalleryenableGalleryImport
Enables the long receipt capture feature - capturing a longer receipt composed from a top and bottom imagetrueenableLongCaptureenableLongCapture
Enables the ability to crop captured imagestrueenableCropenableCrop
Enables the ability to toggle the phone’s flash on/off to help capture in low-light situationstrueenableFlashallowFlashToggling
(Android only) Sets the flash mode that will be set by default when the capture flow beginsFlashMode.FLASH_MODE_AUTON/AdefaultFlashMode
Starts the capture screen with auto-capture mode enabled by defaulttruedefaultToAutoCaptureinitialAutoCaptureState
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 permissionfalseattachLocationDataattachLocationData
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.
truecompressForSensibillApicompressForSensibillApi
(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 flowfalseN/AenableSecureWindow
Determines the maximal number of receipts a user can capture in a single capture session. The number must be in 1-10 range.1maxImagesmaxImages

Reference

iOS CaptureFeatureFlags
Android CaptureConfig

Instructions

Use SDKConfiguration.shared.capture.features to enable and disable features and use SDKConfiguration.shared.capture.themeto 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

CaptureConfig
default 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 Flow
default 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
);

Reference Launching Standalone Capture
CaptureConfig



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.

DescriptionStatesDefault state
Email receipt registration. Determines if a user should be allowed/required to set an email receipt addressOptional (default), Required, Disabledoptional
Allow exportstrue/falsetrue
Show receipt folderstrue/falsetrue
Show receipt notestrue/falsetrue
Show receipt categoriestrue/falsetrue
Enable insights and achievementtrue/falsetrue