Compare commits

..
Author SHA1 Message Date
Daniel Sogl d0440b8558 feat(genius-scan): add barcode scanning and sync ScanConfiguration/result types with 6.3.0
Add scanBarcodesWithConfiguration() plus BarcodeConfiguration/BarcodeResult types,
and add ScanConfiguration fields (availableFilters, skipPostProcessingScreen,
defaultCurvatureCorrection, showCropValidation, defaultScanOrientation,
photoLibraryButtonHidden, structuredData, structuredDataBarcodeTypes,
requiredReadabilityLevel, pdfPassword, showFinalReview) that shipped upstream.
2026-07-27 22:22:26 +02:00
2 changed files with 129 additions and 203 deletions
@@ -3,27 +3,10 @@ import { AwesomeCordovaNativePlugin, Cordova, Plugin } from '@awesome-cordova-pl
import { Observable } from 'rxjs';
export interface InitializeConfig {
/**
* @deprecated Never populated by the native SDKs. Use `hasUserConsent` instead.
*/
hasUserConsentValue?: boolean;
/**
* @deprecated Never populated by the native SDKs, and the underlying `isAgeRestrictedUser`
* field was removed upstream in cordova-plugin-applovin-max@2.0.0.
*/
isAgeRestrictedUserValue?: boolean;
/**
* @deprecated Never populated by the native SDKs. Use `isDoNotSell` instead.
*/
isDoNotSellValue?: boolean;
/**
* @deprecated Never populated by the native SDKs. Use `isTablet` instead.
*/
isTabletValue?: boolean;
hasUserConsent: boolean;
isDoNotSell: boolean;
isTablet: boolean;
countryCode: string;
hasUserConsentValue: boolean;
isAgeRestrictedUserValue: boolean;
isDoNotSellValue: boolean;
isTabletValue: boolean;
}
export interface AdInfo {
@@ -34,11 +17,6 @@ export interface AdInfo {
revenue: number;
}
export interface AdRewardInfo extends AdInfo {
rewardLabel: string;
rewardAmount: number;
}
export enum AdViewPosition {
TOP_CENTER = 'top_center',
TOP_RIGHT = 'top_right',
@@ -50,10 +28,6 @@ export enum AdViewPosition {
BOTTOM_RIGHT = 'bottom_right',
}
/**
* @deprecated Only produced by the now-removed `getConsentDialogState` method
* (removed upstream in cordova-plugin-applovin-max@2.0.0).
*/
export enum ConsentDialogState {
UNKNOWN = 0,
APPLIES = 1,
@@ -106,22 +80,11 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
/**
* Check whether the SDK has been initialized.
*/
@Cordova()
isInitialized(): Promise<boolean> {
return;
}
@Cordova()
showMediationDebugger(): Promise<any> {
return;
}
/**
* @deprecated Removed upstream in cordova-plugin-applovin-max@2.0.0.
*/
@Cordova()
getConsentDialogState(): Promise<ConsentDialogState> {
return;
@@ -137,17 +100,11 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
/**
* @deprecated Removed upstream in cordova-plugin-applovin-max@2.0.0.
*/
@Cordova()
setIsAgeRestrictedUser(isAgeRestrictedUser: boolean): Promise<any> {
return;
}
/**
* @deprecated Removed upstream in cordova-plugin-applovin-max@2.0.0.
*/
@Cordova()
isAgeRestrictedUser(): Promise<boolean> {
return;
@@ -173,11 +130,8 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
/**
* @param {boolean} muted Whether ads should be muted.
*/
@Cordova()
setMuted(muted: boolean): Promise<any> {
setMuted(): Promise<boolean> {
return;
}
@@ -191,19 +145,6 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
/** SEGMENT TARGETING */
/**
* Add a segment for segment targeting. Must be called before `initialize()`.
*
* @param {number} key The segment key.
* @param {number[]} values The segment values.
*/
@Cordova()
addSegment(key: number, values: number[]): Promise<any> {
return;
}
@Cordova()
trackEvent(event: string, parameters?: object): Promise<any> {
return;
@@ -226,11 +167,6 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
@Cordova()
updateBannerPosition(adUnitId: string, position: AdViewPosition): Promise<any> {
return;
}
@Cordova()
setBannerExtraParameter(adUnitId: string, key: string, value: string): Promise<any> {
return;
@@ -251,46 +187,6 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
@Cordova({
eventObservable: true,
event: 'OnBannerAdLoadedEvent',
})
onBannerAdLoaded(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnBannerAdLoadFailedEvent',
})
onBannerAdLoadFailed(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnBannerAdClickedEvent',
})
onBannerAdClicked(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnBannerAdExpandedEvent',
})
onBannerAdExpanded(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnBannerAdCollapsedEvent',
})
onBannerAdCollapsed(): Observable<AdInfo> {
return;
}
/** MRECS */
@Cordova()
@@ -308,11 +204,6 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
@Cordova()
updateMRecPosition(adUnitId: string, position: AdViewPosition): Promise<any> {
return;
}
@Cordova()
setMRecExtraParameter(adUnitId: string, key: string, value: string): Promise<any> {
return;
@@ -333,46 +224,6 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
@Cordova({
eventObservable: true,
event: 'OnMRecAdLoadedEvent',
})
onMRecAdLoaded(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnMRecAdLoadFailedEvent',
})
onMRecAdLoadFailed(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnMRecAdClickedEvent',
})
onMRecAdClicked(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnMRecAdExpandedEvent',
})
onMRecAdExpanded(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnMRecAdCollapsedEvent',
})
onMRecAdCollapsed(): Observable<AdInfo> {
return;
}
/** INTERSTITIALS */
@Cordova()
@@ -380,14 +231,6 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
/**
* @param {string} adUnitId The ad unit id to check.
*/
@Cordova()
isInterstitialReady(adUnitId: string): Promise<boolean> {
return;
}
@Cordova()
showInterstitial(adUnitId: string, placement?: string): Promise<any> {
return;
@@ -406,14 +249,6 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
@Cordova({
eventObservable: true,
event: 'OnInterstitialClickedEvent',
})
onInterstitialClicked(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnInterstitialLoadFailedEvent',
@@ -453,14 +288,6 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
/**
* @param {string} adUnitId The ad unit id to check.
*/
@Cordova()
isRewardedAdReady(adUnitId: string): Promise<boolean> {
return;
}
@Cordova()
showRewardedAd(adUnitId: string, placement?: string): Promise<any> {
return;
@@ -479,14 +306,6 @@ export class Applovin extends AwesomeCordovaNativePlugin {
return;
}
@Cordova({
eventObservable: true,
event: 'OnRewardedAdClickedEvent',
})
onRewardedAdClicked(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnRewardedAdLoadFailedEvent',
@@ -513,17 +332,9 @@ export class Applovin extends AwesomeCordovaNativePlugin {
@Cordova({
eventObservable: true,
event: 'OnRewardedAdFailedToDisplayEvent',
event: 'OnRewardedAdAdFailedToDisplayEvent',
})
onRewardedAdAdFailedToDisplay(): Observable<AdInfo> {
return;
}
@Cordova({
eventObservable: true,
event: 'OnRewardedAdReceivedRewardEvent',
})
onRewardedAdReceivedReward(): Observable<AdRewardInfo> {
return;
}
}
@@ -40,7 +40,15 @@ export class GeniusScan extends AwesomeCordovaNativePlugin {
}
@Cordova()
scanWithConfiguration(configuration: ScanConfiguration): Promise<SuccessScanResult> {
scanWithConfiguration(configuration?: ScanConfiguration): Promise<SuccessScanResult> {
return;
}
/**
* Starts the barcode scanner module.
*/
@Cordova()
scanBarcodesWithConfiguration(configuration?: BarcodeConfiguration): Promise<BarcodeResult> {
return;
}
@@ -74,15 +82,31 @@ interface ScanConfiguration {
multiPageFormat?: 'pdf' | 'tiff' | 'none';
/**
* (by default, the filter is chosen automatically)
* The filter that will be applied by default to enhance scans, or 'none' if no
* enhancement should be performed by default. Possible values include 'automatic',
* 'automaticColor', 'automaticBlackAndWhite', 'automaticMonochrome', 'photo',
* 'softBlackAndWhite', 'softColor', 'strongMonochrome', 'strongBlackAndWhite',
* 'strongColor', 'darkBackground' and 'none' (defaults to 'automatic').
*/
defaultFilter?: 'none' | 'blackAndWhite' | 'monochrome' | 'color' | 'photo';
defaultFilter?: string;
/**
* an array of filters that the user can select when they tap on the edit filter button.
* Defaults to ['none', 'automatic', 'automaticMonochrome', 'automaticBlackAndWhite', 'automaticColor', 'photo'].
*/
availableFilters?: string[];
/**
* defaults to fit
*/
pdfPageSize?: 'fit' | 'a4' | 'letter';
/**
* Optional password used to protect generated PDF documents. Empty passwords are
* treated as no password. Only applies when multiPageFormat is 'pdf'.
*/
pdfPassword?: string;
/**
* max dimension in pixels when images are scaled before PDF generation,
* for example 2000 to fit both height and width within 2000px.
@@ -103,12 +127,42 @@ interface ScanConfiguration {
*/
jpegQuality?: number;
/**
* Whether to skip showing the post-processing screen. Only recommended when
* scanning structured data; generally the user should visually confirm each scan.
*/
skipPostProcessingScreen?: boolean;
/**
* an array with the desired actions to display during the post processing screen
* (defaults to all actions).
*/
postProcessingActions?: ('rotate' | 'editFilter' | 'correctDistortion')[];
/**
* whether a curvature correction should be applied by default (defaults to 'disabled').
*/
defaultCurvatureCorrection?: 'enabled' | 'disabled';
/**
* automatically show crop validation after capture. 'never', 'always', or an object
* with a confidence threshold below which validation should be shown.
*/
showCropValidation?:
'never' | 'always' | { whenConfidenceBelowOrEqual: 'lowest' | 'low' | 'medium' | 'high' | 'highest' };
/**
* 'automatic' to rotate scan automatically after capture or 'original' to keep the
* original scan orientation (defaults to 'automatic').
*/
defaultScanOrientation?: 'automatic' | 'original';
/**
* whether the button allowing the user to pick an image on the Camera screen
* should be hidden (defaults to false).
*/
photoLibraryButtonHidden?: boolean;
/**
* (default to false)
*/
@@ -160,13 +214,68 @@ interface ScanConfiguration {
*/
outputFormats?: ('rawText' | 'hOCR' | 'textLayerInPDF')[];
};
/**
* an array of the structured data you want to extract. E.g.: ['receipt', 'businessCard'].
* Possible values are 'receipt', 'barcode', 'bankDetails' (iOS only), 'businessCard' (iOS only).
*/
structuredData?: string[];
/**
* an array of the barcode types to extract, e.g. ['qr', 'code39']. Possible values are
* 'aztec', 'code39', 'code93', 'code128', 'dataMatrix', 'ean8', 'ean13', 'itf', 'pdf417',
* 'qr', 'upca' (Android only), 'upce', 'codabar' (iOS 15+ only), 'gs1DataBar' (iOS 15+ only),
* 'microPDF417' (iOS 15+ only), 'microQR' (iOS 15+ only), 'msiPlessey' (iOS 17+ only).
*/
structuredDataBarcodeTypes?: string[];
/**
* the required readability level below which a warning will be displayed to the user
* (defaults to 'lowest', which means the warning will never be displayed).
*/
requiredReadabilityLevel?: 'lowest' | 'low' | 'medium' | 'high' | 'highest';
/**
* whether the final review screen should be displayed before submission (default to false).
*/
showFinalReview?: boolean;
}
interface BarcodeConfiguration {
/**
* whether the barcode scanner should keep scanning and accumulating results after
* detecting a first barcode.
*/
isBatchModeEnabled?: boolean;
/**
* an array of the barcode types to detect. Defaults to all supported types.
*/
supportedCodeTypes?: string[];
}
interface BarcodeResult {
/**
* an array of the detected barcodes.
*/
barcodes: {
/**
* the decoded value of the barcode.
*/
value: string;
/**
* the type of the barcode, e.g. 'qr', 'code128'.
*/
type: string;
}[];
}
interface SuccessScanResult {
/**
* a document containing all the scanned pages (example: "file://.pdf")
*/
multiPageDocumentUrl: string;
multiPageDocumentUrl?: string;
/**
* an array of scan objects.
@@ -183,9 +292,9 @@ interface SuccessScanResult {
enhancedUrl: string;
/**
* the result of text recognition for this scan
* the result of text recognition for this scan, present when ocrConfiguration was set.
*/
ocrResult: {
ocrResult?: {
/**
* the raw text that was recognized
*/
@@ -194,8 +303,14 @@ interface SuccessScanResult {
/**
* the recognized text in hOCR format (with position, style…)
*/
hocrTextLayout: string;
hocrTextLayout?: string;
};
/**
* the result of the structured data extraction, present when structuredData was set.
* A subdictionary is present for each type of structured data detected.
*/
structuredData?: any;
}[];
}
@@ -209,7 +324,7 @@ interface GenerateDocumentPages {
/**
* the text layout in hOCR format
*/
hocrTextLayout: string;
hocrTextLayout?: string;
}[];
}