UNPKG

react-native-scanbot-sdk

Version:

Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS

108 lines (105 loc) 3.65 kB
import { BackgroundStyle } from '../common/Common'; import { ButtonConfiguration } from '../common/Common'; import { DeepPartial, PartiallyConstructible } from '../../utils'; import { ForegroundStyle } from '../common/Common'; import { IconStyle } from '../common/Common'; import { StatusBarMode } from '../common/TopBarConfiguration'; import { StyledText } from '../common/Common'; /** Configuration of the camera permission request view. */ export class CameraPermissionScreen extends PartiallyConstructible { /** Determines the visual mode for displaying the contents of the status bar. Default is DARK */ public statusBarMode: StatusBarMode = 'DARK'; /** The background color of the camera permission request. Default is "?sbColorSurface" */ public background: string = '?sbColorSurface'; /** The background color of the icon used in the camera permission request. Default is "?sbColorOutline" */ public iconBackground: string = '?sbColorOutline'; /** Configuration of the icon used in the camera permission request. */ public icon: IconStyle = new IconStyle({ visible: true, color: '?sbColorOnSurface' }); /** Configuration of the camera permission request's confirmation button. */ public enableCameraButton: ButtonConfiguration = new ButtonConfiguration({ text: 'Grant permission', background: new BackgroundStyle({ strokeColor: '?sbColorPrimary', fillColor: '?sbColorPrimary', strokeWidth: 0.0, }), foreground: new ForegroundStyle({ iconVisible: false, color: '?sbColorOnPrimary', useShadow: false, }), }); /** Configuration of the camera permission request's close button. */ public closeButton: ButtonConfiguration = new ButtonConfiguration({ text: 'Close', background: new BackgroundStyle({ strokeColor: '#00000000', fillColor: '#00000000', strokeWidth: 0.0, }), foreground: new ForegroundStyle({ iconVisible: false, color: '?sbColorPrimary', useShadow: false, }), }); /** Configuration of the camera permission request's title. */ public enableCameraTitle: StyledText = new StyledText({ text: 'Camera permission denied!', color: '?sbColorOnSurface', }); /** Configuration of the camera permission request's explanatory text. */ public enableCameraExplanation: StyledText = new StyledText({ text: 'Please allow the usage of the camera to start the scanning process.', color: '?sbColorOnSurfaceVariant', }); /** @param source {@displayType `DeepPartial<CameraPermissionScreen>`} */ public constructor(source: DeepPartial<CameraPermissionScreen> = {}) { super(); if (source.statusBarMode !== undefined) { this.statusBarMode = source.statusBarMode; } if (source.background !== undefined) { this.background = source.background; } if (source.iconBackground !== undefined) { this.iconBackground = source.iconBackground; } if (source.icon !== undefined) { this.icon = new IconStyle(source.icon); } if (source.enableCameraButton !== undefined) { this.enableCameraButton = new ButtonConfiguration(source.enableCameraButton); } if (source.closeButton !== undefined) { this.closeButton = new ButtonConfiguration(source.closeButton); } if (source.enableCameraTitle !== undefined) { this.enableCameraTitle = new StyledText(source.enableCameraTitle); } if (source.enableCameraExplanation !== undefined) { this.enableCameraExplanation = new StyledText(source.enableCameraExplanation); } } }