scandit-cordova-datacapture-core
Advanced tools
Comparing version 6.2.1 to 6.3.0-beta.1
{ | ||
"name": "scandit-cordova-datacapture-core", | ||
"version": "6.2.1", | ||
"version": "6.3.0-beta.1", | ||
"description": "Scandit Data Capture SDK for Cordova", | ||
@@ -15,7 +15,6 @@ "license": "Apache-2.0", | ||
"lint": "tslint --project .", | ||
"paramedic:ios": "cordova-paramedic --platform ios --plugin ./ --skipAppiumTests --cleanUpAfterRun", | ||
"paramedic:android": "cordova-paramedic --platform android --plugin ./ --skipAppiumTests --cleanUpAfterRun", | ||
"paramedic:ios": "cordova-paramedic --verbose --platform ios@5.1.1 --plugin ./ --skipAppiumTests --cleanUpAfterRun", | ||
"paramedic:android": "cordova-paramedic --verbose --platform android@8.1.0 --plugin ./ --skipAppiumTests --cleanUpAfterRun", | ||
"paramedic": "npm run paramedic:ios && npm run paramedic:android", | ||
"coverage": "jest --coverage", | ||
"build-debug-app": "cd .. && rm -rf debugapp && scripts/create-debug-app.sh", | ||
"clear-jest-cache": "jest --clearCache || true", | ||
@@ -22,0 +21,0 @@ "clean": "npm run clear-jest-cache && node ./scripts/clean.js", |
@@ -143,2 +143,4 @@ const https = require('https'); | ||
return 'core'; | ||
} else if (name.includes('Parser')) { | ||
return 'parser'; | ||
} else { | ||
@@ -145,0 +147,0 @@ // e.g. ScanditBarcodeCapture => barcode |
@@ -16,2 +16,3 @@ /// <amd-module name="scandit-cordova-datacapture-core.Camera+Related"/> | ||
Off = 'off', | ||
Auto = 'auto', | ||
} | ||
@@ -43,3 +44,3 @@ | ||
export interface FrameSourceListener { | ||
didChangeState(frameSource: FrameSource, newState: FrameSourceState): void; | ||
didChangeState?(frameSource: FrameSource, newState: FrameSourceState): void; | ||
@@ -46,0 +47,0 @@ // TODO: adjust when readding framedata to the api https://jira.scandit.com/browse/SDC-1159 |
@@ -22,2 +22,4 @@ /// <amd-module name="scandit-cordova-datacapture-core.Cordova"/> | ||
GetCurrentCameraState = 'getCurrentCameraState', | ||
EmitFeedback = 'emitFeedback', | ||
} | ||
@@ -24,0 +26,0 @@ |
@@ -10,2 +10,3 @@ /// <amd-module name="scandit-cordova-datacapture-core.DataCaptureContextProxy"/> | ||
DidChangeContextStatus = 'didChangeStatus', | ||
DidStartObservingContext = 'didStartObservingContext', | ||
} | ||
@@ -92,2 +93,6 @@ | ||
if (event.name === DataCaptureContextListenerEvent.DidStartObservingContext) { | ||
this.context._deviceID = event.argument.deviceID; | ||
} | ||
(this.context as any).listeners.forEach((listener: DataCaptureContextListener) => { | ||
@@ -101,2 +106,8 @@ switch (event.name) { | ||
break; | ||
case DataCaptureContextListenerEvent.DidStartObservingContext: | ||
if (listener.didStartObservingContext) { | ||
listener.didStartObservingContext(this.context); | ||
} | ||
break; | ||
} | ||
@@ -103,0 +114,0 @@ }); |
@@ -22,3 +22,3 @@ /// <amd-module name="scandit-cordova-datacapture-core.DataCaptureViewProxy"/> | ||
public setPositionAndSize(top: number, left: number, width: number, height: number) { | ||
public setPositionAndSize(top: number, left: number, width: number, height: number, shouldBeUnderWebView: boolean) { | ||
DataCaptureViewProxy.cordovaExec( | ||
@@ -28,3 +28,3 @@ null, | ||
CordovaFunction.SetViewPositionAndSize, | ||
[{ top, left, width, height }], | ||
[{ top, left, width, height, shouldBeUnderWebView }], | ||
); | ||
@@ -31,0 +31,0 @@ } |
@@ -19,9 +19,12 @@ /// <amd-module name="scandit-cordova-datacapture-core.DataCaptureContext"/> | ||
export interface PrivateDataCaptureContext { | ||
proxy: DataCaptureContextProxy; | ||
modes: [DataCaptureMode]; | ||
components: [DataCaptureComponent]; | ||
initialize: () => void; | ||
update: () => Promise<void>; | ||
addComponent: (component: DataCaptureComponent) => void; | ||
} | ||
export interface DataCaptureContextCreationOptions { | ||
deviceName: Optional<string>; | ||
deviceName?: Optional<string>; | ||
} | ||
@@ -39,2 +42,4 @@ | ||
private components: DataCaptureComponent[] = []; | ||
@ignoreFromSerialization | ||
@@ -53,2 +58,9 @@ private proxy: DataCaptureContextProxy; | ||
@ignoreFromSerialization | ||
private _deviceID: Optional<string> = null; | ||
public get deviceID(): Optional<string> { | ||
return this._deviceID; | ||
} | ||
public static forLicenseKey(licenseKey: string): DataCaptureContext { | ||
@@ -147,2 +159,18 @@ return DataCaptureContext.forLicenseKeyWithOptions(licenseKey, null); | ||
} | ||
private addComponent(component: DataCaptureComponent) { | ||
if (!this.components.includes(component)) { | ||
this.components.push(component); | ||
(component as any as PrivateDataCaptureComponent)._context = this; | ||
this.update(); | ||
} | ||
} | ||
} | ||
export interface PrivateDataCaptureComponent { | ||
_context: DataCaptureContext; | ||
} | ||
export interface DataCaptureComponent { | ||
readonly id: string; | ||
} |
@@ -6,3 +6,4 @@ /// <amd-module name="scandit-cordova-datacapture-core.DataCaptureContext+Related"/> | ||
export interface DataCaptureContextListener { | ||
didChangeStatus(context: DataCaptureContext, contextStatus: ContextStatus): void; | ||
didChangeStatus?(context: DataCaptureContext, contextStatus: ContextStatus): void; | ||
didStartObservingContext?(context: DataCaptureContext): void; | ||
} | ||
@@ -9,0 +10,0 @@ |
@@ -10,6 +10,6 @@ /// <amd-module name="scandit-cordova-datacapture-core.DataCaptureView"/> | ||
// tslint:disable-next-line:no-empty-interface | ||
export interface DataCaptureOverlay {} | ||
export interface DataCaptureOverlay { } | ||
// tslint:disable-next-line:no-empty-interface | ||
export interface Control extends Serializeable {} | ||
export interface Control extends Serializeable { } | ||
@@ -22,3 +22,3 @@ // TODO: add back torch switch control https://jira.scandit.com/browse/SDC-1771 | ||
export interface DataCaptureViewListener { | ||
didChangeSize(view: DataCaptureView, size: Size, orientation: Orientation): void; | ||
didChangeSize?(view: DataCaptureView, size: Size, orientation: Orientation): void; | ||
} | ||
@@ -42,7 +42,40 @@ | ||
public size: Optional<{ width: number, height: number }> = null; | ||
public shouldBeUnderWebView = false; | ||
public get isValid(): boolean { | ||
return this.isShown !== undefined && this.isShown !== null | ||
&& this.position !== undefined && this.position !== null | ||
&& this.size !== undefined && this.size !== null | ||
&& this.shouldBeUnderWebView !== undefined && this.shouldBeUnderWebView !== null; | ||
} | ||
public didChangeComparedTo(other: HTMLElementState): boolean { | ||
return this.position !== other.position | ||
|| this.size !== other.size | ||
|| this.shouldBeUnderWebView !== other.shouldBeUnderWebView; | ||
} | ||
} | ||
export interface PrivateDataCaptureView { | ||
htmlElement: Optional<HTMLElement>; | ||
_htmlElementState: HTMLElementState; | ||
htmlElementState: HTMLElementState; | ||
readonly viewProxy: DataCaptureViewProxy; | ||
_viewProxy: DataCaptureViewProxy; | ||
overlays: DataCaptureOverlay[]; | ||
controls: Control[]; | ||
listeners: DataCaptureViewListener[]; | ||
addControl(control: Control): void; | ||
removeControl(control: Control): void; | ||
initialize(): void; | ||
updatePositionAndSize(): void; | ||
show(): void; | ||
hide(): void; | ||
elementDidChange(): void; | ||
subscribeToChangesOnHTMLElement(): void; | ||
} | ||
@@ -94,8 +127,7 @@ | ||
const didChangeShown = this._htmlElementState.isShown !== newState.isShown; | ||
const didChangePositionOrSize = this._htmlElementState.position !== newState.position | ||
|| this._htmlElementState.size !== newState.size; | ||
const didChangePositionOrSize = this._htmlElementState.didChangeComparedTo(newState); | ||
this._htmlElementState = newState; | ||
if (this._htmlElementState.isShown && didChangePositionOrSize) { | ||
if (didChangePositionOrSize) { | ||
this.updatePositionAndSize(); | ||
@@ -232,4 +264,8 @@ } | ||
newState.size = { width: boundingRect.width, height: boundingRect.height }; | ||
newState.shouldBeUnderWebView = parseInt(this.htmlElement.style.zIndex || '1', 10) < 0 | ||
|| parseInt(getComputedStyle(this.htmlElement).zIndex || '1', 10) < 0; | ||
const isDisplayed = getComputedStyle(this.htmlElement).display !== 'none'; | ||
const isDisplayed = getComputedStyle(this.htmlElement).display !== 'none' | ||
&& this.htmlElement.style.display !== 'none'; | ||
const isInDOM = document.body.contains(this.htmlElement); | ||
@@ -242,3 +278,3 @@ newState.isShown = isDisplayed && isInDOM && !this.htmlElement.hidden; | ||
private updatePositionAndSize(): void { | ||
if (!this.htmlElementState || !this.htmlElementState.position || !this.htmlElementState.size) { | ||
if (!this.htmlElementState || !this.htmlElementState.isValid) { | ||
return; | ||
@@ -248,6 +284,7 @@ } | ||
this.viewProxy.setPositionAndSize( | ||
this.htmlElementState.position.top, | ||
this.htmlElementState.position.left, | ||
this.htmlElementState.size.width, | ||
this.htmlElementState.size.height, | ||
this.htmlElementState.position!.top, | ||
this.htmlElementState.position!.left, | ||
this.htmlElementState.size!.width, | ||
this.htmlElementState.size!.height, | ||
this.htmlElementState.shouldBeUnderWebView, | ||
); | ||
@@ -263,3 +300,2 @@ } | ||
this.updatePositionAndSize(); | ||
this.viewProxy.show(); | ||
@@ -266,0 +302,0 @@ } |
/// <amd-module name="scandit-cordova-datacapture-core.Feedback"/> | ||
// ^ needed because Cordova can't resolve "../xx" style dependencies | ||
import { DefaultSerializeable, ignoreFromSerializationIfNull, nameForSerialization } from './Serializeable'; | ||
import { FeedbackProxy } from './Cordova/FeedbackProxy'; | ||
import { DefaultSerializeable, ignoreFromSerialization, ignoreFromSerializationIfNull, nameForSerialization } from './Serializeable'; | ||
@@ -37,2 +38,5 @@ export class Vibration extends DefaultSerializeable { | ||
@ignoreFromSerialization | ||
private proxy: FeedbackProxy; | ||
public get vibration(): Optional<Vibration> { | ||
@@ -49,3 +53,19 @@ return this._vibration; | ||
this._sound = sound; | ||
this.initialize(); | ||
} | ||
public emit(): void { | ||
if (!this.proxy) { | ||
return; | ||
} | ||
this.proxy.emit(); | ||
} | ||
private initialize(): void { | ||
if (this.proxy) { | ||
return; | ||
} | ||
this.proxy = FeedbackProxy.forFeedback(this); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
226953
2332
110
2