scandit-capacitor-datacapture-barcode 8.7.0 → 8.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ScanditCapacitorDatacaptureBarcode.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/scandit/capacitor/datacapture/barcode/ScanditBarcodeNative.java +5 -0
- package/dist/barcode.js +98 -114
- package/dist/barcode.js.map +1 -1
- package/dist/dts/barcode.d.ts +5 -11
- package/package.json +2 -2
package/android/build.gradle
CHANGED
package/android/src/main/java/com/scandit/capacitor/datacapture/barcode/ScanditBarcodeNative.java
CHANGED
|
@@ -214,6 +214,11 @@ public class ScanditBarcodeNative extends Plugin implements Emitter {
|
|
|
214
214
|
return this.hasListenersForEvent(eventName);
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
+
@Override
|
|
218
|
+
public boolean hasRegisteredViewListenersForEvent(int viewId, @NonNull String eventName) {
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
|
|
217
222
|
@PluginMethod
|
|
218
223
|
public void getDynamicDefaults(PluginCall call) {
|
|
219
224
|
try {
|
package/dist/barcode.js
CHANGED
|
@@ -16634,7 +16634,7 @@ class BarcodeCountViewEventHandlers {
|
|
|
16634
16634
|
const trackedBarcode = TrackedBarcode['fromJSON'](JSON.parse(payload.trackedBarcode));
|
|
16635
16635
|
let brush = this.view.recognizedBrush;
|
|
16636
16636
|
if (this.view.listener && this.view.listener.brushForRecognizedBarcode) {
|
|
16637
|
-
brush = this.view.listener.brushForRecognizedBarcode(this.view.platformView, trackedBarcode);
|
|
16637
|
+
brush = BarcodeCountViewEventHandlers.callOrFallback(() => this.view.listener.brushForRecognizedBarcode(this.view.platformView, trackedBarcode), this.view.recognizedBrush, 'brushFor*');
|
|
16638
16638
|
}
|
|
16639
16639
|
const finishPayload = this.buildTrackedBarcodeBrushPayload(trackedBarcode, brush);
|
|
16640
16640
|
yield this.adapter.finishBarcodeCountBrushForRecognizedBarcode({
|
|
@@ -16660,7 +16660,7 @@ class BarcodeCountViewEventHandlers {
|
|
|
16660
16660
|
const trackedBarcode = TrackedBarcode['fromJSON'](JSON.parse(payload.trackedBarcode));
|
|
16661
16661
|
let brush = this.view.notInListBrush;
|
|
16662
16662
|
if (this.view.listener && this.view.listener.brushForRecognizedBarcodeNotInList) {
|
|
16663
|
-
brush = this.view.listener.brushForRecognizedBarcodeNotInList(this.view.platformView, trackedBarcode);
|
|
16663
|
+
brush = BarcodeCountViewEventHandlers.callOrFallback(() => this.view.listener.brushForRecognizedBarcodeNotInList(this.view.platformView, trackedBarcode), this.view.notInListBrush, 'brushFor*');
|
|
16664
16664
|
}
|
|
16665
16665
|
const finishPayload = this.buildTrackedBarcodeBrushPayload(trackedBarcode, brush);
|
|
16666
16666
|
yield this.adapter.finishBarcodeCountBrushForRecognizedBarcodeNotInList({
|
|
@@ -16686,7 +16686,7 @@ class BarcodeCountViewEventHandlers {
|
|
|
16686
16686
|
const trackedBarcode = TrackedBarcode['fromJSON'](JSON.parse(payload.trackedBarcode));
|
|
16687
16687
|
let brush = this.view.acceptedBrush;
|
|
16688
16688
|
if (this.view.listener && this.view.listener.brushForAcceptedBarcode) {
|
|
16689
|
-
brush = this.view.listener.brushForAcceptedBarcode(this.view.platformView, trackedBarcode);
|
|
16689
|
+
brush = BarcodeCountViewEventHandlers.callOrFallback(() => this.view.listener.brushForAcceptedBarcode(this.view.platformView, trackedBarcode), this.view.acceptedBrush, 'brushFor*');
|
|
16690
16690
|
}
|
|
16691
16691
|
const finishPayload = this.buildTrackedBarcodeBrushPayload(trackedBarcode, brush);
|
|
16692
16692
|
yield this.adapter.finishBarcodeCountBrushForAcceptedBarcode({
|
|
@@ -16712,7 +16712,7 @@ class BarcodeCountViewEventHandlers {
|
|
|
16712
16712
|
const trackedBarcode = TrackedBarcode['fromJSON'](JSON.parse(payload.trackedBarcode));
|
|
16713
16713
|
let brush = this.view.rejectedBrush;
|
|
16714
16714
|
if (this.view.listener && this.view.listener.brushForRejectedBarcode) {
|
|
16715
|
-
brush = this.view.listener.brushForRejectedBarcode(this.view.platformView, trackedBarcode);
|
|
16715
|
+
brush = BarcodeCountViewEventHandlers.callOrFallback(() => this.view.listener.brushForRejectedBarcode(this.view.platformView, trackedBarcode), this.view.rejectedBrush, 'brushFor*');
|
|
16716
16716
|
}
|
|
16717
16717
|
const finishPayload = this.buildTrackedBarcodeBrushPayload(trackedBarcode, brush);
|
|
16718
16718
|
yield this.adapter.finishBarcodeCountBrushForRejectedBarcode({
|
|
@@ -16924,16 +16924,11 @@ class BarcodeCountViewEventHandlers {
|
|
|
16924
16924
|
const listener = this.view.listener;
|
|
16925
16925
|
if (listener && typeof listener.iconForRecognizedBarcode === 'function') {
|
|
16926
16926
|
// Opted in, so the listener's answer stands -- null included, which clears the icon.
|
|
16927
|
-
icon = listener.iconForRecognizedBarcode(this.view.platformView, trackedBarcode);
|
|
16927
|
+
icon = BarcodeCountViewEventHandlers.callOrFallback(() => listener.iconForRecognizedBarcode(this.view.platformView, trackedBarcode), getBarcodeCountDefaults().BarcodeCountView.defaultRecognizedIcon, 'iconFor*');
|
|
16928
16928
|
}
|
|
16929
16929
|
else {
|
|
16930
|
-
// Not opted in
|
|
16931
|
-
//
|
|
16932
|
-
// that only wants taps or brushes lands here for every tracked barcode. Since the
|
|
16933
|
-
// bridge now forwards a null icon as a removal, answering null would silently strip
|
|
16934
|
-
// icons from apps that never asked to control them. Mirrors Flutter, which substitutes
|
|
16935
|
-
// the default for a listener that is not a BarcodeCountViewExtendedListener
|
|
16936
|
-
// (barcode_count_view.dart:1309-1311).
|
|
16930
|
+
// Not opted in: answer with the default. The controller registers only the
|
|
16931
|
+
// implemented iconFor* events, so this runs while a listener swap is in flight.
|
|
16937
16932
|
icon = getBarcodeCountDefaults().BarcodeCountView.defaultRecognizedIcon;
|
|
16938
16933
|
}
|
|
16939
16934
|
const finishPayload = buildTrackedBarcodeIconPayload(trackedBarcode, icon);
|
|
@@ -16962,16 +16957,11 @@ class BarcodeCountViewEventHandlers {
|
|
|
16962
16957
|
const listener = this.view.listener;
|
|
16963
16958
|
if (listener && typeof listener.iconForRecognizedBarcodeNotInList === 'function') {
|
|
16964
16959
|
// Opted in, so the listener's answer stands -- null included, which clears the icon.
|
|
16965
|
-
icon = listener.iconForRecognizedBarcodeNotInList(this.view.platformView, trackedBarcode);
|
|
16960
|
+
icon = BarcodeCountViewEventHandlers.callOrFallback(() => listener.iconForRecognizedBarcodeNotInList(this.view.platformView, trackedBarcode), getBarcodeCountDefaults().BarcodeCountView.defaultNotInListIcon, 'iconFor*');
|
|
16966
16961
|
}
|
|
16967
16962
|
else {
|
|
16968
|
-
// Not opted in
|
|
16969
|
-
//
|
|
16970
|
-
// that only wants taps or brushes lands here for every tracked barcode. Since the
|
|
16971
|
-
// bridge now forwards a null icon as a removal, answering null would silently strip
|
|
16972
|
-
// icons from apps that never asked to control them. Mirrors Flutter, which substitutes
|
|
16973
|
-
// the default for a listener that is not a BarcodeCountViewExtendedListener
|
|
16974
|
-
// (barcode_count_view.dart:1309-1311).
|
|
16963
|
+
// Not opted in: answer with the default. The controller registers only the
|
|
16964
|
+
// implemented iconFor* events, so this runs while a listener swap is in flight.
|
|
16975
16965
|
icon = getBarcodeCountDefaults().BarcodeCountView.defaultNotInListIcon;
|
|
16976
16966
|
}
|
|
16977
16967
|
const finishPayload = buildTrackedBarcodeIconPayload(trackedBarcode, icon);
|
|
@@ -17000,16 +16990,11 @@ class BarcodeCountViewEventHandlers {
|
|
|
17000
16990
|
const listener = this.view.listener;
|
|
17001
16991
|
if (listener && typeof listener.iconForAcceptedBarcode === 'function') {
|
|
17002
16992
|
// Opted in, so the listener's answer stands -- null included, which clears the icon.
|
|
17003
|
-
icon = listener.iconForAcceptedBarcode(this.view.platformView, trackedBarcode);
|
|
16993
|
+
icon = BarcodeCountViewEventHandlers.callOrFallback(() => listener.iconForAcceptedBarcode(this.view.platformView, trackedBarcode), getBarcodeCountDefaults().BarcodeCountView.defaultAcceptedIcon, 'iconFor*');
|
|
17004
16994
|
}
|
|
17005
16995
|
else {
|
|
17006
|
-
// Not opted in
|
|
17007
|
-
//
|
|
17008
|
-
// that only wants taps or brushes lands here for every tracked barcode. Since the
|
|
17009
|
-
// bridge now forwards a null icon as a removal, answering null would silently strip
|
|
17010
|
-
// icons from apps that never asked to control them. Mirrors Flutter, which substitutes
|
|
17011
|
-
// the default for a listener that is not a BarcodeCountViewExtendedListener
|
|
17012
|
-
// (barcode_count_view.dart:1309-1311).
|
|
16996
|
+
// Not opted in: answer with the default. The controller registers only the
|
|
16997
|
+
// implemented iconFor* events, so this runs while a listener swap is in flight.
|
|
17013
16998
|
icon = getBarcodeCountDefaults().BarcodeCountView.defaultAcceptedIcon;
|
|
17014
16999
|
}
|
|
17015
17000
|
const finishPayload = buildTrackedBarcodeIconPayload(trackedBarcode, icon);
|
|
@@ -17038,16 +17023,11 @@ class BarcodeCountViewEventHandlers {
|
|
|
17038
17023
|
const listener = this.view.listener;
|
|
17039
17024
|
if (listener && typeof listener.iconForRejectedBarcode === 'function') {
|
|
17040
17025
|
// Opted in, so the listener's answer stands -- null included, which clears the icon.
|
|
17041
|
-
icon = listener.iconForRejectedBarcode(this.view.platformView, trackedBarcode);
|
|
17026
|
+
icon = BarcodeCountViewEventHandlers.callOrFallback(() => listener.iconForRejectedBarcode(this.view.platformView, trackedBarcode), getBarcodeCountDefaults().BarcodeCountView.defaultRejectedIcon, 'iconFor*');
|
|
17042
17027
|
}
|
|
17043
17028
|
else {
|
|
17044
|
-
// Not opted in
|
|
17045
|
-
//
|
|
17046
|
-
// that only wants taps or brushes lands here for every tracked barcode. Since the
|
|
17047
|
-
// bridge now forwards a null icon as a removal, answering null would silently strip
|
|
17048
|
-
// icons from apps that never asked to control them. Mirrors Flutter, which substitutes
|
|
17049
|
-
// the default for a listener that is not a BarcodeCountViewExtendedListener
|
|
17050
|
-
// (barcode_count_view.dart:1309-1311).
|
|
17029
|
+
// Not opted in: answer with the default. The controller registers only the
|
|
17030
|
+
// implemented iconFor* events, so this runs while a listener swap is in flight.
|
|
17051
17031
|
icon = getBarcodeCountDefaults().BarcodeCountView.defaultRejectedIcon;
|
|
17052
17032
|
}
|
|
17053
17033
|
const finishPayload = buildTrackedBarcodeIconPayload(trackedBarcode, icon);
|
|
@@ -17058,6 +17038,17 @@ class BarcodeCountViewEventHandlers {
|
|
|
17058
17038
|
});
|
|
17059
17039
|
});
|
|
17060
17040
|
}
|
|
17041
|
+
// A throwing app callback still gets a finish call, or native would keep the placeholder brush
|
|
17042
|
+
// (brushFor*) or no icon at all (iconFor*).
|
|
17043
|
+
static callOrFallback(callback, fallback, label) {
|
|
17044
|
+
try {
|
|
17045
|
+
return callback();
|
|
17046
|
+
}
|
|
17047
|
+
catch (error) {
|
|
17048
|
+
console.error(`BarcodeCountView ${label} listener failed: ${String(error)}`);
|
|
17049
|
+
return fallback;
|
|
17050
|
+
}
|
|
17051
|
+
}
|
|
17061
17052
|
// Fire-and-forget ARE events are parsed strictly: a payload that fails the generated schema
|
|
17062
17053
|
// parse is logged once and dropped, so a value outside the schema (for example an unknown error
|
|
17063
17054
|
// reason) never reaches a listener. The frame metadata is built from the parsed payload. Nothing
|
|
@@ -17191,7 +17182,8 @@ var BarcodeCountAdaptiveRecognitionEvents;
|
|
|
17191
17182
|
class BarcodeCountViewController extends BaseController {
|
|
17192
17183
|
constructor(view, barcodeCount) {
|
|
17193
17184
|
super('BarcodeCountViewProxy');
|
|
17194
|
-
this.
|
|
17185
|
+
this.iconListener = null;
|
|
17186
|
+
this.iconListenerViewId = null;
|
|
17195
17187
|
this.isViewListenerRegistered = false;
|
|
17196
17188
|
this.isModeListenerRegistered = false;
|
|
17197
17189
|
this.isStatusProviderRegistered = false;
|
|
@@ -17206,30 +17198,6 @@ class BarcodeCountViewController extends BaseController {
|
|
|
17206
17198
|
this.handleOnStatusRequestedWrapper = (ev) => {
|
|
17207
17199
|
this.handleOnStatusRequested(ev);
|
|
17208
17200
|
};
|
|
17209
|
-
this.handleBrushForRecognizedBarcodeWrapper = (ev) => {
|
|
17210
|
-
return this.eventHandlers.handleBrushForRecognizedBarcode(ev);
|
|
17211
|
-
};
|
|
17212
|
-
this.handleBrushForRecognizedBarcodeNotInListWrapper = (ev) => {
|
|
17213
|
-
return this.eventHandlers.handleBrushForRecognizedBarcodeNotInList(ev);
|
|
17214
|
-
};
|
|
17215
|
-
this.handleBrushForAcceptedBarcodeWrapper = (ev) => {
|
|
17216
|
-
return this.eventHandlers.handleBrushForAcceptedBarcode(ev);
|
|
17217
|
-
};
|
|
17218
|
-
this.handleBrushForRejectedBarcodeWrapper = (ev) => {
|
|
17219
|
-
return this.eventHandlers.handleBrushForRejectedBarcode(ev);
|
|
17220
|
-
};
|
|
17221
|
-
this.handleIconForRecognizedBarcodeWrapper = (ev) => {
|
|
17222
|
-
return this.eventHandlers.handleIconForRecognizedBarcode(ev);
|
|
17223
|
-
};
|
|
17224
|
-
this.handleIconForRecognizedBarcodeNotInListWrapper = (ev) => {
|
|
17225
|
-
return this.eventHandlers.handleIconForRecognizedBarcodeNotInList(ev);
|
|
17226
|
-
};
|
|
17227
|
-
this.handleIconForAcceptedBarcodeWrapper = (ev) => {
|
|
17228
|
-
return this.eventHandlers.handleIconForAcceptedBarcode(ev);
|
|
17229
|
-
};
|
|
17230
|
-
this.handleIconForRejectedBarcodeWrapper = (ev) => {
|
|
17231
|
-
return this.eventHandlers.handleIconForRejectedBarcode(ev);
|
|
17232
|
-
};
|
|
17233
17201
|
this.handleFilteredBarcodeTappedWrapper = (ev) => {
|
|
17234
17202
|
this.eventHandlers.handleFilteredBarcodeTapped(ev);
|
|
17235
17203
|
};
|
|
@@ -17380,21 +17348,10 @@ class BarcodeCountViewController extends BaseController {
|
|
|
17380
17348
|
if (!this.isViewCreated) {
|
|
17381
17349
|
return;
|
|
17382
17350
|
}
|
|
17383
|
-
//
|
|
17384
|
-
// the
|
|
17385
|
-
// is subscribed to it, so a blanket subscription would make every existing app that
|
|
17386
|
-
// registers any view listener pay four native->JS->native round trips per tracked barcode
|
|
17387
|
-
// just to hand back the default icon native had already drawn.
|
|
17351
|
+
// The iconFor* events are not subscribed here: syncIconEventRegistration puts them in the
|
|
17352
|
+
// ListenerRegistry for the callbacks the listener implements.
|
|
17388
17353
|
this._proxy.subscribeForEvents(BarcodeCountViewController.nonIconViewListenerEvents);
|
|
17389
|
-
this.
|
|
17390
|
-
this._proxy.eventEmitter.on(BarcodeCountViewListenerEvents.brushForRecognizedBarcode, this.handleBrushForRecognizedBarcodeWrapper);
|
|
17391
|
-
this._proxy.eventEmitter.on(BarcodeCountViewListenerEvents.brushForRecognizedBarcodeNotInList, this.handleBrushForRecognizedBarcodeNotInListWrapper);
|
|
17392
|
-
this._proxy.eventEmitter.on(BarcodeCountViewListenerEvents.brushForAcceptedBarcode, this.handleBrushForAcceptedBarcodeWrapper);
|
|
17393
|
-
this._proxy.eventEmitter.on(BarcodeCountViewListenerEvents.brushForRejectedBarcode, this.handleBrushForRejectedBarcodeWrapper);
|
|
17394
|
-
this._proxy.eventEmitter.on(BarcodeCountViewListenerEvents.iconForRecognizedBarcode, this.handleIconForRecognizedBarcodeWrapper);
|
|
17395
|
-
this._proxy.eventEmitter.on(BarcodeCountViewListenerEvents.iconForRecognizedBarcodeNotInList, this.handleIconForRecognizedBarcodeNotInListWrapper);
|
|
17396
|
-
this._proxy.eventEmitter.on(BarcodeCountViewListenerEvents.iconForAcceptedBarcode, this.handleIconForAcceptedBarcodeWrapper);
|
|
17397
|
-
this._proxy.eventEmitter.on(BarcodeCountViewListenerEvents.iconForRejectedBarcode, this.handleIconForRejectedBarcodeWrapper);
|
|
17354
|
+
yield this.syncIconEventRegistration(this.view.listener);
|
|
17398
17355
|
this._proxy.eventEmitter.on(BarcodeCountViewListenerEvents.filteredBarcodeTapped, this.handleFilteredBarcodeTappedWrapper);
|
|
17399
17356
|
this._proxy.eventEmitter.on(BarcodeCountViewListenerEvents.recognizedBarcodeNotInListTapped, this.handleRecognizedBarcodeNotInListTappedWrapper);
|
|
17400
17357
|
this._proxy.eventEmitter.on(BarcodeCountViewListenerEvents.recognizedBarcodeTapped, this.handleRecognizedBarcodeTappedWrapper);
|
|
@@ -17443,8 +17400,10 @@ class BarcodeCountViewController extends BaseController {
|
|
|
17443
17400
|
if (listener != null) {
|
|
17444
17401
|
yield this.registerViewListener();
|
|
17445
17402
|
// registerViewListener returns early once registered, so a listener swapped in later
|
|
17446
|
-
// would otherwise keep the icon
|
|
17447
|
-
this.
|
|
17403
|
+
// would otherwise keep the icon registration the FIRST listener decided on.
|
|
17404
|
+
if (this.isViewListenerRegistered) {
|
|
17405
|
+
yield this.syncIconEventRegistration(listener);
|
|
17406
|
+
}
|
|
17448
17407
|
}
|
|
17449
17408
|
else {
|
|
17450
17409
|
yield this.unregisterViewListener();
|
|
@@ -17734,32 +17693,62 @@ class BarcodeCountViewController extends BaseController {
|
|
|
17734
17693
|
hasTransformer: hasTransformer,
|
|
17735
17694
|
});
|
|
17736
17695
|
}
|
|
17737
|
-
|
|
17738
|
-
|
|
17739
|
-
|
|
17740
|
-
|
|
17741
|
-
|
|
17742
|
-
|
|
17696
|
+
static listenerImplements(listener, eventName) {
|
|
17697
|
+
const callbackName = eventName.substring(eventName.indexOf('.') + 1);
|
|
17698
|
+
return typeof listener[callbackName] === 'function';
|
|
17699
|
+
}
|
|
17700
|
+
iconEventHandler(eventName) {
|
|
17701
|
+
switch (eventName) {
|
|
17702
|
+
case BarcodeCountViewListenerEvents.iconForRecognizedBarcodeNotInList:
|
|
17703
|
+
return ev => this.eventHandlers.handleIconForRecognizedBarcodeNotInList(ev);
|
|
17704
|
+
case BarcodeCountViewListenerEvents.iconForAcceptedBarcode:
|
|
17705
|
+
return ev => this.eventHandlers.handleIconForAcceptedBarcode(ev);
|
|
17706
|
+
case BarcodeCountViewListenerEvents.iconForRejectedBarcode:
|
|
17707
|
+
return ev => this.eventHandlers.handleIconForRejectedBarcode(ev);
|
|
17708
|
+
case BarcodeCountViewListenerEvents.brushForRecognizedBarcode:
|
|
17709
|
+
return ev => this.eventHandlers.handleBrushForRecognizedBarcode(ev);
|
|
17710
|
+
case BarcodeCountViewListenerEvents.brushForRecognizedBarcodeNotInList:
|
|
17711
|
+
return ev => this.eventHandlers.handleBrushForRecognizedBarcodeNotInList(ev);
|
|
17712
|
+
case BarcodeCountViewListenerEvents.brushForAcceptedBarcode:
|
|
17713
|
+
return ev => this.eventHandlers.handleBrushForAcceptedBarcode(ev);
|
|
17714
|
+
case BarcodeCountViewListenerEvents.brushForRejectedBarcode:
|
|
17715
|
+
return ev => this.eventHandlers.handleBrushForRejectedBarcode(ev);
|
|
17716
|
+
default:
|
|
17717
|
+
return ev => this.eventHandlers.handleIconForRecognizedBarcode(ev);
|
|
17743
17718
|
}
|
|
17744
|
-
return BarcodeCountViewController.iconViewListenerEvents.some(event => {
|
|
17745
|
-
const callbackName = event.substring(event.indexOf('.') + 1);
|
|
17746
|
-
return typeof listener[callbackName] === 'function';
|
|
17747
|
-
});
|
|
17748
17719
|
}
|
|
17749
|
-
//
|
|
17750
|
-
//
|
|
17751
|
-
|
|
17752
|
-
|
|
17753
|
-
|
|
17754
|
-
|
|
17755
|
-
|
|
17756
|
-
|
|
17757
|
-
|
|
17758
|
-
|
|
17759
|
-
|
|
17760
|
-
this.
|
|
17761
|
-
|
|
17762
|
-
|
|
17720
|
+
// Registers each iconFor* event only for a callback the listener implements. Add before remove:
|
|
17721
|
+
// an event both listeners share never leaves the native registry, so an iconFor* event in flight
|
|
17722
|
+
// during a swap still reaches a handler and gets its finish call.
|
|
17723
|
+
syncIconEventRegistration(next) {
|
|
17724
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17725
|
+
const previous = this.iconListener;
|
|
17726
|
+
const previousViewId = this.iconListenerViewId;
|
|
17727
|
+
const viewId = this.view.viewId;
|
|
17728
|
+
if (previous === next && (next === null || previousViewId === viewId)) {
|
|
17729
|
+
return;
|
|
17730
|
+
}
|
|
17731
|
+
this.iconListener = next;
|
|
17732
|
+
this.iconListenerViewId = next ? viewId : null;
|
|
17733
|
+
const pending = [];
|
|
17734
|
+
if (next) {
|
|
17735
|
+
for (const eventName of BarcodeCountViewController.iconViewListenerEvents) {
|
|
17736
|
+
if (BarcodeCountViewController.listenerImplements(next, eventName)) {
|
|
17737
|
+
const handle = this.iconEventHandler(eventName);
|
|
17738
|
+
pending.push(ListenerRegistry.addListener(eventName, { viewId }, next, (_listeners, ev) => handle(ev)));
|
|
17739
|
+
}
|
|
17740
|
+
}
|
|
17741
|
+
}
|
|
17742
|
+
if (previous && previousViewId !== null) {
|
|
17743
|
+
const previousTarget = { viewId: previousViewId };
|
|
17744
|
+
for (const eventName of BarcodeCountViewController.iconViewListenerEvents) {
|
|
17745
|
+
if (ListenerRegistry.listenersFor(eventName, previousTarget).includes(previous)) {
|
|
17746
|
+
pending.push(ListenerRegistry.removeListener(eventName, previousTarget, previous));
|
|
17747
|
+
}
|
|
17748
|
+
}
|
|
17749
|
+
}
|
|
17750
|
+
yield Promise.all(pending);
|
|
17751
|
+
});
|
|
17763
17752
|
}
|
|
17764
17753
|
unregisterViewScopedListeners(viewId) {
|
|
17765
17754
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -17785,16 +17774,8 @@ class BarcodeCountViewController extends BaseController {
|
|
|
17785
17774
|
if (!this.isViewListenerRegistered) {
|
|
17786
17775
|
return;
|
|
17787
17776
|
}
|
|
17788
|
-
this._proxy.unsubscribeFromEvents(
|
|
17789
|
-
this.
|
|
17790
|
-
this._proxy.eventEmitter.off(BarcodeCountViewListenerEvents.brushForRecognizedBarcode, this.handleBrushForRecognizedBarcodeWrapper);
|
|
17791
|
-
this._proxy.eventEmitter.off(BarcodeCountViewListenerEvents.brushForRecognizedBarcodeNotInList, this.handleBrushForRecognizedBarcodeNotInListWrapper);
|
|
17792
|
-
this._proxy.eventEmitter.off(BarcodeCountViewListenerEvents.brushForAcceptedBarcode, this.handleBrushForAcceptedBarcodeWrapper);
|
|
17793
|
-
this._proxy.eventEmitter.off(BarcodeCountViewListenerEvents.brushForRejectedBarcode, this.handleBrushForRejectedBarcodeWrapper);
|
|
17794
|
-
this._proxy.eventEmitter.off(BarcodeCountViewListenerEvents.iconForRecognizedBarcode, this.handleIconForRecognizedBarcodeWrapper);
|
|
17795
|
-
this._proxy.eventEmitter.off(BarcodeCountViewListenerEvents.iconForRecognizedBarcodeNotInList, this.handleIconForRecognizedBarcodeNotInListWrapper);
|
|
17796
|
-
this._proxy.eventEmitter.off(BarcodeCountViewListenerEvents.iconForAcceptedBarcode, this.handleIconForAcceptedBarcodeWrapper);
|
|
17797
|
-
this._proxy.eventEmitter.off(BarcodeCountViewListenerEvents.iconForRejectedBarcode, this.handleIconForRejectedBarcodeWrapper);
|
|
17777
|
+
this._proxy.unsubscribeFromEvents(BarcodeCountViewController.nonIconViewListenerEvents);
|
|
17778
|
+
yield this.syncIconEventRegistration(null);
|
|
17798
17779
|
this._proxy.eventEmitter.off(BarcodeCountViewListenerEvents.filteredBarcodeTapped, this.handleFilteredBarcodeTappedWrapper);
|
|
17799
17780
|
this._proxy.eventEmitter.off(BarcodeCountViewListenerEvents.recognizedBarcodeNotInListTapped, this.handleRecognizedBarcodeNotInListTappedWrapper);
|
|
17800
17781
|
this._proxy.eventEmitter.off(BarcodeCountViewListenerEvents.recognizedBarcodeTapped, this.handleRecognizedBarcodeTappedWrapper);
|
|
@@ -17834,14 +17815,17 @@ class BarcodeCountViewController extends BaseController {
|
|
|
17834
17815
|
return data;
|
|
17835
17816
|
}
|
|
17836
17817
|
}
|
|
17837
|
-
//
|
|
17838
|
-
//
|
|
17839
|
-
// registerViewListener.
|
|
17818
|
+
// The iconFor* and brushFor* events go through the ListenerRegistry, one per implemented
|
|
17819
|
+
// callback, so native answers a placeholder (no default flash) only for an event the app will reply to.
|
|
17840
17820
|
BarcodeCountViewController.iconViewListenerEvents = [
|
|
17841
17821
|
BarcodeCountViewListenerEvents.iconForRecognizedBarcode,
|
|
17842
17822
|
BarcodeCountViewListenerEvents.iconForRecognizedBarcodeNotInList,
|
|
17843
17823
|
BarcodeCountViewListenerEvents.iconForAcceptedBarcode,
|
|
17844
17824
|
BarcodeCountViewListenerEvents.iconForRejectedBarcode,
|
|
17825
|
+
BarcodeCountViewListenerEvents.brushForRecognizedBarcode,
|
|
17826
|
+
BarcodeCountViewListenerEvents.brushForRecognizedBarcodeNotInList,
|
|
17827
|
+
BarcodeCountViewListenerEvents.brushForAcceptedBarcode,
|
|
17828
|
+
BarcodeCountViewListenerEvents.brushForRejectedBarcode,
|
|
17845
17829
|
];
|
|
17846
17830
|
BarcodeCountViewController.nonIconViewListenerEvents = Object.values(BarcodeCountViewListenerEvents).filter(event => !BarcodeCountViewController.iconViewListenerEvents.includes(event));
|
|
17847
17831
|
|