react-native-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS
346 lines (334 loc) • 12.5 kB
text/typescript
/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten.
/// Generated from rtu-ui-v2/schemas/textpattern/TextPatternScannerScreenConfiguration.yaml
import { TextPatternScannerConfiguration } from '../../text_pattern_scanner/TextPatternScannerTypes';
import { ActionBarConfiguration } from '../../ui_v2/common/ActionBarConfiguration';
import { CameraConfiguration } from '../../ui_v2/common/CameraConfiguration';
import { CameraPermissionScreen } from '../../ui_v2/common/CameraPermission';
import {
BackgroundStyle,
ButtonConfiguration,
ForegroundStyle,
IconButton,
IconStyle,
Palette,
RoundButton,
Sound,
StyledText,
Vibration,
} from '../../ui_v2/common/Common';
import { ScanCompletionOverlay } from '../../ui_v2/common/ScanCompletionOverlay';
import { ScanbotAlertDialog } from '../../ui_v2/common/ScanbotAlertDialog';
import { TopBarConfiguration } from '../../ui_v2/common/TopBarConfiguration';
import { UserGuidanceConfiguration } from '../../ui_v2/common/UserGuidanceConfiguration';
import {
FinderCorneredStyle,
PermanentViewFinderConfiguration,
} from '../../ui_v2/common/ViewFinderConfiguration';
import { TextPatternScannerIntroScreenConfiguration } from '../../ui_v2/textpattern/TextPatternScannerIntroScreenConfiguration';
import { TextPatternScannerScreenTextLocalization } from '../../ui_v2/textpattern/TextPatternScannerScreenTextLocalization';
import { AspectRatio } from '../../utils/geometry/Geometry';
import { DeepPartial, PartiallyConstructible } from '../../utils/utils';
/**
Configuration of the screen for detecting generic text data.
*/
export class TextPatternScannerScreenConfiguration extends PartiallyConstructible {
/**
Version number of the configuration object.
Default is "1.0"
*/
public readonly version: string = '1.0';
/**
The configuration object should be applied for this screen.
Default is "TextPatternScanner"
*/
public readonly screen: string = 'TextPatternScanner';
/**
Configuration of the all strings for generic text scanner screen.
*/
public localization: TextPatternScannerScreenTextLocalization =
new TextPatternScannerScreenTextLocalization({});
/**
Define the screen's base color values from which other colors are derived.
*/
public palette: Palette = new Palette({});
/**
The background color of the generic text scanner screen.
Default is "?sbColorSurfaceLow"
*/
public backgroundColor: string = '?sbColorSurfaceLow';
/**
Configuration of the camera behavior.
*/
public cameraConfiguration: CameraConfiguration = new CameraConfiguration({
orientationLockMode: 'PORTRAIT',
});
/**
Configuration of the dialog for requesting camera permissions.
*/
public cameraPermission: CameraPermissionScreen = new CameraPermissionScreen({
statusBarMode: 'DARK',
background: '?sbColorSurface',
iconBackground: '?sbColorOutline',
icon: new IconStyle({ visible: true, color: '?sbColorOnSurface' }),
enableCameraButton: new ButtonConfiguration({
visible: true,
text: '?cameraPermissionEnableCameraButton',
accessibilityDescription: '?accessibilityDescriptionCameraPermissionEnableCameraButton',
background: new BackgroundStyle({
strokeColor: '?sbColorPrimary',
fillColor: '?sbColorPrimary',
strokeWidth: 0.0,
}),
foreground: new ForegroundStyle({
iconVisible: false,
color: '?sbColorOnPrimary',
useShadow: false,
}),
}),
closeButton: new ButtonConfiguration({
visible: true,
text: '?cameraPermissionCloseButton',
accessibilityDescription: '?accessibilityDescriptionCameraPermissionCloseButton',
background: new BackgroundStyle({
strokeColor: '#00000000',
fillColor: '#00000000',
strokeWidth: 0.0,
}),
foreground: new ForegroundStyle({
iconVisible: false,
color: '?sbColorPrimary',
useShadow: false,
}),
}),
enableCameraTitle: new StyledText({
text: '?cameraPermissionEnableCameraTitle',
color: '?sbColorOnSurface',
}),
enableCameraExplanation: new StyledText({
text: '?cameraPermissionEnableCameraExplanation',
color: '?sbColorOnSurfaceVariant',
}),
});
/**
Configuration of the top user guidance.
*/
public topUserGuidance: UserGuidanceConfiguration = new UserGuidanceConfiguration({
title: new StyledText({ text: '?topUserGuidance' }),
});
/**
Configuration of the user guidance below finder view.
*/
public finderViewUserGuidance: UserGuidanceConfiguration = new UserGuidanceConfiguration({
title: new StyledText({ text: '?finderViewUserGuidance' }),
});
/**
Configuration of the top bar on the generic text scanner screen.
*/
public topBar: TopBarConfiguration = new TopBarConfiguration({
title: new StyledText({ visible: true, text: '?topBarTitle' }),
cancelButton: new ButtonConfiguration({
text: '?topBarCancelButton',
accessibilityDescription: '?accessibilityDescriptionCancelButton',
background: new BackgroundStyle({
strokeColor: '#00000000',
fillColor: '#00000000',
strokeWidth: 0.0,
}),
foreground: new ForegroundStyle({ color: '?sbColorOnPrimary' }),
}),
});
/**
Configuration of the button in the top bar that opens the introduction screen.
*/
public topBarOpenIntroScreenButton: IconButton = new IconButton({
color: '?sbColorOnPrimary',
accessibilityDescription: '?accessibilityDescriptionOpenIntroScreenButton',
});
/**
Configuration of the introduction screen for the generic text scanner screen.
*/
public introScreen: TextPatternScannerIntroScreenConfiguration =
new TextPatternScannerIntroScreenConfiguration({});
/**
Configuration of the action bar.
*/
public actionBar: ActionBarConfiguration = new ActionBarConfiguration({
flipCameraButton: new RoundButton({
visible: false,
accessibilityDescription: '?accessibilityDescriptionFlipCameraButton',
backgroundColor: '?sbColorSurfaceHigh',
foregroundColor: '?sbColorOnPrimary',
activeBackgroundColor: '?sbColorWarning',
activeForegroundColor: '#1C1B1F',
}),
});
/**
Configuration of the view finder.
*/
public viewFinder: PermanentViewFinderConfiguration = new PermanentViewFinderConfiguration({
style: new FinderCorneredStyle({ strokeColor: '?sbColorSurface', strokeWidth: 2.0 }),
aspectRatio: new AspectRatio({ width: 3.85, height: 1.0 }),
preferredHeight: 48.0,
});
/**
Configuration of the scanner.
*/
public scannerConfiguration: TextPatternScannerConfiguration =
new TextPatternScannerConfiguration({});
/**
Whether word boxes should be displayed or not.
Default is true
*/
public shouldShowWordBoxes: boolean = true;
/**
The color of word boxes filling. Works best with an alpha < 0.5.
Default is "#33CCE54C"
*/
public wordBoxesFillColor: string = '#33CCE54C';
/**
The color of word boxes border lines.
Default is "#33CCE599"
*/
public wordBoxesLineColor: string = '#33CCE599';
/**
If the confirmation alert dialog is enabled.
Default is false
*/
public confirmationAlertDialogEnabled: boolean = false;
/**
Configuration of the confirmation alert dialog.
*/
public confirmationAlertDialog: ScanbotAlertDialog = new ScanbotAlertDialog({
title: new StyledText({
text: '?textPatternConfirmationAlertTitle',
color: '?sbColorOnSurface',
}),
subtitle: new StyledText({ color: '?sbColorOnSurfaceVariant' }),
sheetColor: '?sbColorSurface',
modalOverlayColor: '?sbColorModalOverlay',
dividerColor: '?sbColorOutline',
okButton: new ButtonConfiguration({
visible: true,
text: '?textPatternConfirmationAlertSubmitButton',
accessibilityDescription: '?accessibilityDescriptionConfirmationSubmitButton',
background: new BackgroundStyle({
strokeColor: '?sbColorPrimary',
fillColor: '?sbColorPrimary',
strokeWidth: 1.0,
}),
foreground: new ForegroundStyle({
iconVisible: true,
color: '?sbColorOnPrimary',
useShadow: false,
}),
}),
cancelButton: new ButtonConfiguration({
visible: true,
text: '?textPatternConfirmationAlertCancelButton',
accessibilityDescription: '?accessibilityDescriptionConfirmationCancelButton',
background: new BackgroundStyle({
strokeColor: '#00000000',
fillColor: '#00000000',
strokeWidth: 1.0,
}),
foreground: new ForegroundStyle({
iconVisible: false,
color: '?sbColorPrimary',
useShadow: false,
}),
}),
});
/**
Configuration of the result overlay.
*/
public successOverlay: ScanCompletionOverlay = new ScanCompletionOverlay({});
/**
Configuration of the scan confirmation sound.
*/
public sound: Sound = new Sound({});
/**
Configuration of the vibration feedback.
*/
public vibration: Vibration = new Vibration({});
/**
If enabled, the screen will not turn off while the barcode scanner is active. (Android only).
Default is true
*/
public keepScreenOn: boolean = true;
/** @param source {@displayType `DeepPartial<TextPatternScannerScreenConfiguration>`} */
public constructor(source: DeepPartial<TextPatternScannerScreenConfiguration> = {}) {
super();
if (source.version !== undefined) {
this.version = source.version;
}
if (source.screen !== undefined) {
this.screen = source.screen;
}
if (source.localization !== undefined) {
this.localization = new TextPatternScannerScreenTextLocalization(source.localization);
}
if (source.palette !== undefined) {
this.palette = new Palette(source.palette);
}
if (source.backgroundColor !== undefined) {
this.backgroundColor = source.backgroundColor;
}
if (source.cameraConfiguration !== undefined) {
this.cameraConfiguration = new CameraConfiguration(source.cameraConfiguration);
}
if (source.cameraPermission !== undefined) {
this.cameraPermission = new CameraPermissionScreen(source.cameraPermission);
}
if (source.topUserGuidance !== undefined) {
this.topUserGuidance = new UserGuidanceConfiguration(source.topUserGuidance);
}
if (source.finderViewUserGuidance !== undefined) {
this.finderViewUserGuidance = new UserGuidanceConfiguration(source.finderViewUserGuidance);
}
if (source.topBar !== undefined) {
this.topBar = new TopBarConfiguration(source.topBar);
}
if (source.topBarOpenIntroScreenButton !== undefined) {
this.topBarOpenIntroScreenButton = new IconButton(source.topBarOpenIntroScreenButton);
}
if (source.introScreen !== undefined) {
this.introScreen = new TextPatternScannerIntroScreenConfiguration(source.introScreen);
}
if (source.actionBar !== undefined) {
this.actionBar = new ActionBarConfiguration(source.actionBar);
}
if (source.viewFinder !== undefined) {
this.viewFinder = new PermanentViewFinderConfiguration(source.viewFinder);
}
if (source.scannerConfiguration !== undefined) {
this.scannerConfiguration = new TextPatternScannerConfiguration(source.scannerConfiguration);
}
if (source.shouldShowWordBoxes !== undefined) {
this.shouldShowWordBoxes = source.shouldShowWordBoxes;
}
if (source.wordBoxesFillColor !== undefined) {
this.wordBoxesFillColor = source.wordBoxesFillColor;
}
if (source.wordBoxesLineColor !== undefined) {
this.wordBoxesLineColor = source.wordBoxesLineColor;
}
if (source.confirmationAlertDialogEnabled !== undefined) {
this.confirmationAlertDialogEnabled = source.confirmationAlertDialogEnabled;
}
if (source.confirmationAlertDialog !== undefined) {
this.confirmationAlertDialog = new ScanbotAlertDialog(source.confirmationAlertDialog);
}
if (source.successOverlay !== undefined) {
this.successOverlay = new ScanCompletionOverlay(source.successOverlay);
}
if (source.sound !== undefined) {
this.sound = new Sound(source.sound);
}
if (source.vibration !== undefined) {
this.vibration = new Vibration(source.vibration);
}
if (source.keepScreenOn !== undefined) {
this.keepScreenOn = source.keepScreenOn;
}
}
}