scandit-capacitor-datacapture-barcode 8.7.0-beta.1 → 8.7.1

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.
@@ -17,5 +17,5 @@ Pod::Spec.new do |s|
17
17
 
18
18
  s.dependency "Capacitor"
19
19
  s.dependency "ScanditCapacitorDatacaptureCore", "= #{version}"
20
- s.dependency "scandit-datacapture-frameworks-barcode", '= 8.7.0-beta.1'
20
+ s.dependency "scandit-datacapture-frameworks-barcode", '= 8.7.1'
21
21
  end
@@ -143,7 +143,7 @@ if (ext.has('repos')) {
143
143
  }
144
144
 
145
145
  dependencies {
146
- def sdk_version = "8.7.0-beta.1"
146
+ def sdk_version = "8.7.1"
147
147
 
148
148
  implementation fileTree(dir: 'libs', include: ['*.jar'])
149
149
  implementation fileTree(dir: 'library', include: ['*.aar'])
@@ -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
@@ -1,4 +1,4 @@
1
- import { nameForSerialization, ignoreFromSerializationIfNull, LogCategory, ScanditLogger, LogValues, serializationDefault, NoViewfinder, NoneLocationSelection, DefaultSerializeable, ignoreFromSerialization, ScanditIcon, FactoryMaker, Quadrilateral, Point, Feedback, BaseController, FrameDataController, ModeBase, ListenerRegistry, CameraSettings, Observable, TextAlignment, FontFamily, EventDataParser, SKIP, ViewCreationGate, AimerViewfinder, Brush, generateIdentifier, registerProxies, Color, NumberWithUnit, PointWithUnit, LogLevel } from 'scandit-capacitor-datacapture-core/dist/core';
1
+ import { nameForSerialization, ignoreFromSerializationIfNull, LogLevel, LogCategory, ScanditLogger, serializationDefault, NoViewfinder, NoneLocationSelection, DefaultSerializeable, ignoreFromSerialization, ScanditIcon, FactoryMaker, Quadrilateral, Point, Feedback, BaseController, FrameDataController, ModeBase, ListenerRegistry, CameraSettings, Observable, TextAlignment, FontFamily, EventDataParser, SKIP, ViewCreationGate, AimerViewfinder, Brush, generateIdentifier, registerProxies, Color, NumberWithUnit, PointWithUnit } from 'scandit-capacitor-datacapture-core/dist/core';
2
2
 
3
3
  var Symbology;
4
4
  (function (Symbology) {
@@ -5554,41 +5554,44 @@ class BarcodeProxyAdapter {
5554
5554
  // Generator: scripts/bridge_generator/generate.py
5555
5555
  // Schema: scripts/bridge_generator/schemas/barcode.json
5556
5556
  /**
5557
- * Per-method `LogRecord` category overrides for the BarcodeProxy
5558
- * bridge surface. Consumed by the centralized `ScanditLogger` interceptor
5559
- * to pick a non-default category (e.g. `Events`) for specific methods so
5560
- * that high-frequency per-frame / per-scan callbacks fall outside the
5561
- * default category mask. Level and category gate independently: those
5562
- * records are emitted at `Debug` and stay hidden until the category is
5563
- * opted into, so raising the level does not reveal them.
5557
+ * Per-method `LogRecord` level and category overrides for the BarcodeProxy
5558
+ * bridge surface. Consumed by the centralized `ScanditLogger` interceptor:
5559
+ * per-frame / per-scan callbacks log at `Trace` under their category label, so
5560
+ * they only show once the level is raised to `Trace`.
5564
5561
  *
5565
5562
  * Auto-registered as a side effect of importing this module via the
5566
5563
  * generated `index.ts` barrel — no customer wiring required.
5567
5564
  */
5568
5565
  const BARCODE_PROXY_LOG_METADATA = {
5569
- finishBarcodeCaptureDidUpdateSession: { category: LogCategory.Events },
5570
- finishBarcodeCaptureDidScan: { category: LogCategory.Events },
5571
- finishBarcodeSelectionDidSelect: { category: LogCategory.Events },
5572
- finishBarcodeSelectionDidUpdateSession: { category: LogCategory.Events },
5573
- finishBrushForAimedBarcodeCallback: { category: LogCategory.Events },
5574
- finishBrushForTrackedBarcodeCallback: { category: LogCategory.Events },
5575
- finishBarcodeBatchDidUpdateSessionCallback: { category: LogCategory.Events },
5576
- finishBarcodeCountBrushForRecognizedBarcode: { category: LogCategory.Events },
5577
- finishBarcodeCountBrushForRecognizedBarcodeNotInList: { category: LogCategory.Events },
5578
- finishBarcodeCountBrushForAcceptedBarcode: { category: LogCategory.Events },
5579
- finishBarcodeCountBrushForRejectedBarcode: { category: LogCategory.Events },
5580
- finishBarcodeCountOnScan: { category: LogCategory.Events },
5581
- finishBarcodeCountOnSessionUpdated: { category: LogCategory.Events },
5582
- finishSparkScanDidUpdateSession: { category: LogCategory.Events },
5583
- finishSparkScanDidScan: { category: LogCategory.Events },
5584
- finishPickAction: { category: LogCategory.Events },
5585
- finishOnProductIdentifierForItems: { category: LogCategory.Events },
5586
- finishBarcodePickViewHighlightStyleCustomViewProviderViewForRequest: { category: LogCategory.Events },
5587
- finishBarcodePickViewHighlightStyleAsyncProviderStyleForRequest: { category: LogCategory.Events },
5588
- finishBarcodeArFilterBarcodes: { category: LogCategory.Events },
5589
- finishBarcodeArAnnotationForBarcode: { category: LogCategory.Events },
5590
- finishBarcodeArHighlightForBarcode: { category: LogCategory.Events },
5591
- finishBarcodeArOnDidUpdateSession: { category: LogCategory.Events },
5566
+ finishBarcodeCaptureDidUpdateSession: { level: LogLevel.Trace, category: LogCategory.Events },
5567
+ finishBarcodeCaptureDidScan: { level: LogLevel.Trace, category: LogCategory.Events },
5568
+ finishBarcodeSelectionDidSelect: { level: LogLevel.Trace, category: LogCategory.Events },
5569
+ finishBarcodeSelectionDidUpdateSession: { level: LogLevel.Trace, category: LogCategory.Events },
5570
+ finishBrushForAimedBarcodeCallback: { level: LogLevel.Trace, category: LogCategory.Events },
5571
+ finishBrushForTrackedBarcodeCallback: { level: LogLevel.Trace, category: LogCategory.Events },
5572
+ finishBarcodeBatchDidUpdateSessionCallback: { level: LogLevel.Trace, category: LogCategory.Events },
5573
+ finishBarcodeCountBrushForRecognizedBarcode: { level: LogLevel.Trace, category: LogCategory.Events },
5574
+ finishBarcodeCountBrushForRecognizedBarcodeNotInList: { level: LogLevel.Trace, category: LogCategory.Events },
5575
+ finishBarcodeCountBrushForAcceptedBarcode: { level: LogLevel.Trace, category: LogCategory.Events },
5576
+ finishBarcodeCountBrushForRejectedBarcode: { level: LogLevel.Trace, category: LogCategory.Events },
5577
+ finishBarcodeCountOnScan: { level: LogLevel.Trace, category: LogCategory.Events },
5578
+ finishBarcodeCountOnSessionUpdated: { level: LogLevel.Trace, category: LogCategory.Events },
5579
+ finishSparkScanDidUpdateSession: { level: LogLevel.Trace, category: LogCategory.Events },
5580
+ finishSparkScanDidScan: { level: LogLevel.Trace, category: LogCategory.Events },
5581
+ finishPickAction: { level: LogLevel.Trace, category: LogCategory.Events },
5582
+ finishOnProductIdentifierForItems: { level: LogLevel.Trace, category: LogCategory.Events },
5583
+ finishBarcodePickViewHighlightStyleCustomViewProviderViewForRequest: {
5584
+ level: LogLevel.Trace,
5585
+ category: LogCategory.Events,
5586
+ },
5587
+ finishBarcodePickViewHighlightStyleAsyncProviderStyleForRequest: {
5588
+ level: LogLevel.Trace,
5589
+ category: LogCategory.Events,
5590
+ },
5591
+ finishBarcodeArFilterBarcodes: { level: LogLevel.Trace, category: LogCategory.Events },
5592
+ finishBarcodeArAnnotationForBarcode: { level: LogLevel.Trace, category: LogCategory.Events },
5593
+ finishBarcodeArHighlightForBarcode: { level: LogLevel.Trace, category: LogCategory.Events },
5594
+ finishBarcodeArOnDidUpdateSession: { level: LogLevel.Trace, category: LogCategory.Events },
5592
5595
  };
5593
5596
  ScanditLogger.registerMethodMetadata(BARCODE_PROXY_LOG_METADATA);
5594
5597
 
@@ -11107,9 +11110,6 @@ __decorate([
11107
11110
  nameForSerialization('parentId'),
11108
11111
  ignoreFromSerializationIfNull
11109
11112
  ], BarcodeCapture.prototype, "parentId", void 0);
11110
- __decorate([
11111
- LogValues({ source: 'ts.barcode', category: LogCategory.Lifecycle })
11112
- ], BarcodeCapture.prototype, "applySettings", null);
11113
11113
  __decorate([
11114
11114
  ignoreFromSerialization
11115
11115
  ], BarcodeCapture, "barcodeCaptureDefaults", null);
@@ -11482,9 +11482,6 @@ __decorate([
11482
11482
  __decorate([
11483
11483
  ignoreFromSerialization
11484
11484
  ], BarcodeAr.prototype, "_controller", void 0);
11485
- __decorate([
11486
- LogValues({ source: 'ts.barcode', category: LogCategory.Lifecycle })
11487
- ], BarcodeAr.prototype, "applySettings", null);
11488
11485
  __decorate([
11489
11486
  ignoreFromSerialization
11490
11487
  ], BarcodeAr, "barcodeArDefaults", null);
@@ -14519,9 +14516,6 @@ __decorate([
14519
14516
  __decorate([
14520
14517
  ignoreFromSerialization
14521
14518
  ], BaseBarcodeArView.prototype, "viewCreationGate", void 0);
14522
- __decorate([
14523
- LogValues({ source: 'ts.barcode', category: LogCategory.Lifecycle })
14524
- ], BaseBarcodeArView.prototype, "dispose", null);
14525
14519
  __decorate([
14526
14520
  ignoreFromSerialization
14527
14521
  ], BaseBarcodeArView, "barcodeArDefaults", null);
@@ -15031,9 +15025,6 @@ __decorate([
15031
15025
  __decorate([
15032
15026
  nameForSerialization('pointOfInterest')
15033
15027
  ], BarcodeSelection.prototype, "_pointOfInterest", void 0);
15034
- __decorate([
15035
- LogValues({ source: 'ts.barcode', category: LogCategory.Lifecycle })
15036
- ], BarcodeSelection.prototype, "applySettings", null);
15037
15028
  __decorate([
15038
15029
  ignoreFromSerialization
15039
15030
  ], BarcodeSelection, "barcodeSelectionDefaults", null);
@@ -16005,9 +15996,6 @@ __decorate([
16005
15996
  __decorate([
16006
15997
  ignoreFromSerialization
16007
15998
  ], BarcodeCount.prototype, "_pendingCaptureList", void 0);
16008
- __decorate([
16009
- LogValues({ source: 'ts.barcode', category: LogCategory.Lifecycle })
16010
- ], BarcodeCount.prototype, "applySettings", null);
16011
15999
  __decorate([
16012
16000
  ignoreFromSerialization
16013
16001
  ], BarcodeCount, "barcodeCountDefaults", null);
@@ -16936,16 +16924,11 @@ class BarcodeCountViewEventHandlers {
16936
16924
  const listener = this.view.listener;
16937
16925
  if (listener && typeof listener.iconForRecognizedBarcode === 'function') {
16938
16926
  // Opted in, so the listener's answer stands -- null included, which clears the icon.
16939
- icon = listener.iconForRecognizedBarcode(this.view.platformView, trackedBarcode);
16927
+ icon = BarcodeCountViewEventHandlers.iconOrDefault(() => listener.iconForRecognizedBarcode(this.view.platformView, trackedBarcode), getBarcodeCountDefaults().BarcodeCountView.defaultRecognizedIcon);
16940
16928
  }
16941
16929
  else {
16942
- // Not opted in. Answer with the default: the controller subscribes every event in
16943
- // BarcodeCountViewListenerEvents as soon as any listener is registered, so a listener
16944
- // that only wants taps or brushes lands here for every tracked barcode. Since the
16945
- // bridge now forwards a null icon as a removal, answering null would silently strip
16946
- // icons from apps that never asked to control them. Mirrors Flutter, which substitutes
16947
- // the default for a listener that is not a BarcodeCountViewExtendedListener
16948
- // (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.
16949
16932
  icon = getBarcodeCountDefaults().BarcodeCountView.defaultRecognizedIcon;
16950
16933
  }
16951
16934
  const finishPayload = buildTrackedBarcodeIconPayload(trackedBarcode, icon);
@@ -16974,16 +16957,11 @@ class BarcodeCountViewEventHandlers {
16974
16957
  const listener = this.view.listener;
16975
16958
  if (listener && typeof listener.iconForRecognizedBarcodeNotInList === 'function') {
16976
16959
  // Opted in, so the listener's answer stands -- null included, which clears the icon.
16977
- icon = listener.iconForRecognizedBarcodeNotInList(this.view.platformView, trackedBarcode);
16960
+ icon = BarcodeCountViewEventHandlers.iconOrDefault(() => listener.iconForRecognizedBarcodeNotInList(this.view.platformView, trackedBarcode), getBarcodeCountDefaults().BarcodeCountView.defaultNotInListIcon);
16978
16961
  }
16979
16962
  else {
16980
- // Not opted in. Answer with the default: the controller subscribes every event in
16981
- // BarcodeCountViewListenerEvents as soon as any listener is registered, so a listener
16982
- // that only wants taps or brushes lands here for every tracked barcode. Since the
16983
- // bridge now forwards a null icon as a removal, answering null would silently strip
16984
- // icons from apps that never asked to control them. Mirrors Flutter, which substitutes
16985
- // the default for a listener that is not a BarcodeCountViewExtendedListener
16986
- // (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.
16987
16965
  icon = getBarcodeCountDefaults().BarcodeCountView.defaultNotInListIcon;
16988
16966
  }
16989
16967
  const finishPayload = buildTrackedBarcodeIconPayload(trackedBarcode, icon);
@@ -17012,16 +16990,11 @@ class BarcodeCountViewEventHandlers {
17012
16990
  const listener = this.view.listener;
17013
16991
  if (listener && typeof listener.iconForAcceptedBarcode === 'function') {
17014
16992
  // Opted in, so the listener's answer stands -- null included, which clears the icon.
17015
- icon = listener.iconForAcceptedBarcode(this.view.platformView, trackedBarcode);
16993
+ icon = BarcodeCountViewEventHandlers.iconOrDefault(() => listener.iconForAcceptedBarcode(this.view.platformView, trackedBarcode), getBarcodeCountDefaults().BarcodeCountView.defaultAcceptedIcon);
17016
16994
  }
17017
16995
  else {
17018
- // Not opted in. Answer with the default: the controller subscribes every event in
17019
- // BarcodeCountViewListenerEvents as soon as any listener is registered, so a listener
17020
- // that only wants taps or brushes lands here for every tracked barcode. Since the
17021
- // bridge now forwards a null icon as a removal, answering null would silently strip
17022
- // icons from apps that never asked to control them. Mirrors Flutter, which substitutes
17023
- // the default for a listener that is not a BarcodeCountViewExtendedListener
17024
- // (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.
17025
16998
  icon = getBarcodeCountDefaults().BarcodeCountView.defaultAcceptedIcon;
17026
16999
  }
17027
17000
  const finishPayload = buildTrackedBarcodeIconPayload(trackedBarcode, icon);
@@ -17050,16 +17023,11 @@ class BarcodeCountViewEventHandlers {
17050
17023
  const listener = this.view.listener;
17051
17024
  if (listener && typeof listener.iconForRejectedBarcode === 'function') {
17052
17025
  // Opted in, so the listener's answer stands -- null included, which clears the icon.
17053
- icon = listener.iconForRejectedBarcode(this.view.platformView, trackedBarcode);
17026
+ icon = BarcodeCountViewEventHandlers.iconOrDefault(() => listener.iconForRejectedBarcode(this.view.platformView, trackedBarcode), getBarcodeCountDefaults().BarcodeCountView.defaultRejectedIcon);
17054
17027
  }
17055
17028
  else {
17056
- // Not opted in. Answer with the default: the controller subscribes every event in
17057
- // BarcodeCountViewListenerEvents as soon as any listener is registered, so a listener
17058
- // that only wants taps or brushes lands here for every tracked barcode. Since the
17059
- // bridge now forwards a null icon as a removal, answering null would silently strip
17060
- // icons from apps that never asked to control them. Mirrors Flutter, which substitutes
17061
- // the default for a listener that is not a BarcodeCountViewExtendedListener
17062
- // (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.
17063
17031
  icon = getBarcodeCountDefaults().BarcodeCountView.defaultRejectedIcon;
17064
17032
  }
17065
17033
  const finishPayload = buildTrackedBarcodeIconPayload(trackedBarcode, icon);
@@ -17070,6 +17038,16 @@ class BarcodeCountViewEventHandlers {
17070
17038
  });
17071
17039
  });
17072
17040
  }
17041
+ // A throwing app callback still gets a finish call, or native would keep no icon at all.
17042
+ static iconOrDefault(callback, fallback) {
17043
+ try {
17044
+ return callback();
17045
+ }
17046
+ catch (error) {
17047
+ console.error(`BarcodeCountView iconFor* listener failed: ${String(error)}`);
17048
+ return fallback;
17049
+ }
17050
+ }
17073
17051
  // Fire-and-forget ARE events are parsed strictly: a payload that fails the generated schema
17074
17052
  // parse is logged once and dropped, so a value outside the schema (for example an unknown error
17075
17053
  // reason) never reaches a listener. The frame metadata is built from the parsed payload. Nothing
@@ -17203,7 +17181,8 @@ var BarcodeCountAdaptiveRecognitionEvents;
17203
17181
  class BarcodeCountViewController extends BaseController {
17204
17182
  constructor(view, barcodeCount) {
17205
17183
  super('BarcodeCountViewProxy');
17206
- this.areIconEventsSubscribed = false;
17184
+ this.iconListener = null;
17185
+ this.iconListenerViewId = null;
17207
17186
  this.isViewListenerRegistered = false;
17208
17187
  this.isModeListenerRegistered = false;
17209
17188
  this.isStatusProviderRegistered = false;
@@ -17230,18 +17209,6 @@ class BarcodeCountViewController extends BaseController {
17230
17209
  this.handleBrushForRejectedBarcodeWrapper = (ev) => {
17231
17210
  return this.eventHandlers.handleBrushForRejectedBarcode(ev);
17232
17211
  };
17233
- this.handleIconForRecognizedBarcodeWrapper = (ev) => {
17234
- return this.eventHandlers.handleIconForRecognizedBarcode(ev);
17235
- };
17236
- this.handleIconForRecognizedBarcodeNotInListWrapper = (ev) => {
17237
- return this.eventHandlers.handleIconForRecognizedBarcodeNotInList(ev);
17238
- };
17239
- this.handleIconForAcceptedBarcodeWrapper = (ev) => {
17240
- return this.eventHandlers.handleIconForAcceptedBarcode(ev);
17241
- };
17242
- this.handleIconForRejectedBarcodeWrapper = (ev) => {
17243
- return this.eventHandlers.handleIconForRejectedBarcode(ev);
17244
- };
17245
17212
  this.handleFilteredBarcodeTappedWrapper = (ev) => {
17246
17213
  this.eventHandlers.handleFilteredBarcodeTapped(ev);
17247
17214
  };
@@ -17392,21 +17359,14 @@ class BarcodeCountViewController extends BaseController {
17392
17359
  if (!this.isViewCreated) {
17393
17360
  return;
17394
17361
  }
17395
- // SDC-33589: subscribe everything EXCEPT the four iconFor* events, then add those only if
17396
- // the assigned listener actually implements one. Native emits an event only when something
17397
- // is subscribed to it, so a blanket subscription would make every existing app that
17398
- // registers any view listener pay four native->JS->native round trips per tracked barcode
17399
- // just to hand back the default icon native had already drawn.
17362
+ // The iconFor* events are not subscribed here: syncIconEventRegistration puts them in the
17363
+ // ListenerRegistry for the callbacks the listener implements.
17400
17364
  this._proxy.subscribeForEvents(BarcodeCountViewController.nonIconViewListenerEvents);
17401
- this.syncIconEventSubscription();
17365
+ yield this.syncIconEventRegistration(this.view.listener);
17402
17366
  this._proxy.eventEmitter.on(BarcodeCountViewListenerEvents.brushForRecognizedBarcode, this.handleBrushForRecognizedBarcodeWrapper);
17403
17367
  this._proxy.eventEmitter.on(BarcodeCountViewListenerEvents.brushForRecognizedBarcodeNotInList, this.handleBrushForRecognizedBarcodeNotInListWrapper);
17404
17368
  this._proxy.eventEmitter.on(BarcodeCountViewListenerEvents.brushForAcceptedBarcode, this.handleBrushForAcceptedBarcodeWrapper);
17405
17369
  this._proxy.eventEmitter.on(BarcodeCountViewListenerEvents.brushForRejectedBarcode, this.handleBrushForRejectedBarcodeWrapper);
17406
- this._proxy.eventEmitter.on(BarcodeCountViewListenerEvents.iconForRecognizedBarcode, this.handleIconForRecognizedBarcodeWrapper);
17407
- this._proxy.eventEmitter.on(BarcodeCountViewListenerEvents.iconForRecognizedBarcodeNotInList, this.handleIconForRecognizedBarcodeNotInListWrapper);
17408
- this._proxy.eventEmitter.on(BarcodeCountViewListenerEvents.iconForAcceptedBarcode, this.handleIconForAcceptedBarcodeWrapper);
17409
- this._proxy.eventEmitter.on(BarcodeCountViewListenerEvents.iconForRejectedBarcode, this.handleIconForRejectedBarcodeWrapper);
17410
17370
  this._proxy.eventEmitter.on(BarcodeCountViewListenerEvents.filteredBarcodeTapped, this.handleFilteredBarcodeTappedWrapper);
17411
17371
  this._proxy.eventEmitter.on(BarcodeCountViewListenerEvents.recognizedBarcodeNotInListTapped, this.handleRecognizedBarcodeNotInListTappedWrapper);
17412
17372
  this._proxy.eventEmitter.on(BarcodeCountViewListenerEvents.recognizedBarcodeTapped, this.handleRecognizedBarcodeTappedWrapper);
@@ -17455,8 +17415,10 @@ class BarcodeCountViewController extends BaseController {
17455
17415
  if (listener != null) {
17456
17416
  yield this.registerViewListener();
17457
17417
  // registerViewListener returns early once registered, so a listener swapped in later
17458
- // would otherwise keep the icon subscription the FIRST listener decided on.
17459
- this.syncIconEventSubscription();
17418
+ // would otherwise keep the icon registration the FIRST listener decided on.
17419
+ if (this.isViewListenerRegistered) {
17420
+ yield this.syncIconEventRegistration(listener);
17421
+ }
17460
17422
  }
17461
17423
  else {
17462
17424
  yield this.unregisterViewListener();
@@ -17746,32 +17708,54 @@ class BarcodeCountViewController extends BaseController {
17746
17708
  hasTransformer: hasTransformer,
17747
17709
  });
17748
17710
  }
17749
- // True when the assigned listener implements at least one iconFor* callback. The callbacks are
17750
- // optional members, so a plain listener answers false and native never emits the icon events.
17751
- listenerWantsIconEvents() {
17752
- const listener = this.view.listener;
17753
- if (listener == null) {
17754
- return false;
17755
- }
17756
- return BarcodeCountViewController.iconViewListenerEvents.some(event => {
17757
- const callbackName = event.substring(event.indexOf('.') + 1);
17758
- return typeof listener[callbackName] === 'function';
17759
- });
17711
+ static listenerImplements(listener, eventName) {
17712
+ const callbackName = eventName.substring(eventName.indexOf('.') + 1);
17713
+ return typeof listener[callbackName] === 'function';
17760
17714
  }
17761
- // Idempotent: brings the icon subscription in line with the current listener, so it is safe to
17762
- // call on first registration and again on every listener swap.
17763
- syncIconEventSubscription() {
17764
- const wanted = this.listenerWantsIconEvents();
17765
- if (wanted === this.areIconEventsSubscribed) {
17766
- return;
17767
- }
17768
- if (wanted) {
17769
- this._proxy.subscribeForEvents(BarcodeCountViewController.iconViewListenerEvents);
17770
- }
17771
- else {
17772
- this._proxy.unsubscribeFromEvents(BarcodeCountViewController.iconViewListenerEvents);
17715
+ iconEventHandler(eventName) {
17716
+ switch (eventName) {
17717
+ case BarcodeCountViewListenerEvents.iconForRecognizedBarcodeNotInList:
17718
+ return ev => this.eventHandlers.handleIconForRecognizedBarcodeNotInList(ev);
17719
+ case BarcodeCountViewListenerEvents.iconForAcceptedBarcode:
17720
+ return ev => this.eventHandlers.handleIconForAcceptedBarcode(ev);
17721
+ case BarcodeCountViewListenerEvents.iconForRejectedBarcode:
17722
+ return ev => this.eventHandlers.handleIconForRejectedBarcode(ev);
17723
+ default:
17724
+ return ev => this.eventHandlers.handleIconForRecognizedBarcode(ev);
17773
17725
  }
17774
- this.areIconEventsSubscribed = wanted;
17726
+ }
17727
+ // Registers each iconFor* event only for a callback the listener implements. Add before remove:
17728
+ // an event both listeners share never leaves the native registry, so an iconFor* event in flight
17729
+ // during a swap still reaches a handler and gets its finish call.
17730
+ syncIconEventRegistration(next) {
17731
+ return __awaiter(this, void 0, void 0, function* () {
17732
+ const previous = this.iconListener;
17733
+ const previousViewId = this.iconListenerViewId;
17734
+ const viewId = this.view.viewId;
17735
+ if (previous === next && (next === null || previousViewId === viewId)) {
17736
+ return;
17737
+ }
17738
+ this.iconListener = next;
17739
+ this.iconListenerViewId = next ? viewId : null;
17740
+ const pending = [];
17741
+ if (next) {
17742
+ for (const eventName of BarcodeCountViewController.iconViewListenerEvents) {
17743
+ if (BarcodeCountViewController.listenerImplements(next, eventName)) {
17744
+ const handle = this.iconEventHandler(eventName);
17745
+ pending.push(ListenerRegistry.addListener(eventName, { viewId }, next, (_listeners, ev) => handle(ev)));
17746
+ }
17747
+ }
17748
+ }
17749
+ if (previous && previousViewId !== null) {
17750
+ const previousTarget = { viewId: previousViewId };
17751
+ for (const eventName of BarcodeCountViewController.iconViewListenerEvents) {
17752
+ if (ListenerRegistry.listenersFor(eventName, previousTarget).includes(previous)) {
17753
+ pending.push(ListenerRegistry.removeListener(eventName, previousTarget, previous));
17754
+ }
17755
+ }
17756
+ }
17757
+ yield Promise.all(pending);
17758
+ });
17775
17759
  }
17776
17760
  unregisterViewScopedListeners(viewId) {
17777
17761
  return __awaiter(this, void 0, void 0, function* () {
@@ -17797,16 +17781,12 @@ class BarcodeCountViewController extends BaseController {
17797
17781
  if (!this.isViewListenerRegistered) {
17798
17782
  return;
17799
17783
  }
17800
- this._proxy.unsubscribeFromEvents(Object.values(BarcodeCountViewListenerEvents));
17801
- this.areIconEventsSubscribed = false;
17784
+ this._proxy.unsubscribeFromEvents(BarcodeCountViewController.nonIconViewListenerEvents);
17785
+ yield this.syncIconEventRegistration(null);
17802
17786
  this._proxy.eventEmitter.off(BarcodeCountViewListenerEvents.brushForRecognizedBarcode, this.handleBrushForRecognizedBarcodeWrapper);
17803
17787
  this._proxy.eventEmitter.off(BarcodeCountViewListenerEvents.brushForRecognizedBarcodeNotInList, this.handleBrushForRecognizedBarcodeNotInListWrapper);
17804
17788
  this._proxy.eventEmitter.off(BarcodeCountViewListenerEvents.brushForAcceptedBarcode, this.handleBrushForAcceptedBarcodeWrapper);
17805
17789
  this._proxy.eventEmitter.off(BarcodeCountViewListenerEvents.brushForRejectedBarcode, this.handleBrushForRejectedBarcodeWrapper);
17806
- this._proxy.eventEmitter.off(BarcodeCountViewListenerEvents.iconForRecognizedBarcode, this.handleIconForRecognizedBarcodeWrapper);
17807
- this._proxy.eventEmitter.off(BarcodeCountViewListenerEvents.iconForRecognizedBarcodeNotInList, this.handleIconForRecognizedBarcodeNotInListWrapper);
17808
- this._proxy.eventEmitter.off(BarcodeCountViewListenerEvents.iconForAcceptedBarcode, this.handleIconForAcceptedBarcodeWrapper);
17809
- this._proxy.eventEmitter.off(BarcodeCountViewListenerEvents.iconForRejectedBarcode, this.handleIconForRejectedBarcodeWrapper);
17810
17790
  this._proxy.eventEmitter.off(BarcodeCountViewListenerEvents.filteredBarcodeTapped, this.handleFilteredBarcodeTappedWrapper);
17811
17791
  this._proxy.eventEmitter.off(BarcodeCountViewListenerEvents.recognizedBarcodeNotInListTapped, this.handleRecognizedBarcodeNotInListTappedWrapper);
17812
17792
  this._proxy.eventEmitter.off(BarcodeCountViewListenerEvents.recognizedBarcodeTapped, this.handleRecognizedBarcodeTappedWrapper);
@@ -17846,9 +17826,8 @@ class BarcodeCountViewController extends BaseController {
17846
17826
  return data;
17847
17827
  }
17848
17828
  }
17849
- // SDC-33589: the four iconFor* events are subscribed separately from the rest, so only a
17850
- // listener that implements at least one of them makes native emit them. See
17851
- // registerViewListener.
17829
+ // The four iconFor* events go through the ListenerRegistry, one per implemented callback, so
17830
+ // native answers nil (no default flash) only for an event the app will reply to.
17852
17831
  BarcodeCountViewController.iconViewListenerEvents = [
17853
17832
  BarcodeCountViewListenerEvents.iconForRecognizedBarcode,
17854
17833
  BarcodeCountViewListenerEvents.iconForRecognizedBarcodeNotInList,
@@ -19343,9 +19322,6 @@ __decorate([
19343
19322
  __decorate([
19344
19323
  ignoreFromSerialization
19345
19324
  ], BaseBarcodeCountView.prototype, "viewCreationGate", void 0);
19346
- __decorate([
19347
- LogValues({ source: 'ts.barcode', category: LogCategory.Lifecycle })
19348
- ], BaseBarcodeCountView.prototype, "dispose", null);
19349
19325
  __decorate([
19350
19326
  ignoreFromSerialization
19351
19327
  ], BaseBarcodeCountView, "barcodeCountDefaults", null);
@@ -19580,9 +19556,6 @@ __decorate([
19580
19556
  nameForSerialization('parentId'),
19581
19557
  ignoreFromSerializationIfNull
19582
19558
  ], BarcodeBatch.prototype, "parentId", void 0);
19583
- __decorate([
19584
- LogValues({ source: 'ts.barcode', category: LogCategory.Lifecycle })
19585
- ], BarcodeBatch.prototype, "applySettings", null);
19586
19559
  __decorate([
19587
19560
  ignoreFromSerialization
19588
19561
  ], BarcodeBatch, "barcodeBatchDefaults", null);
@@ -20543,9 +20516,6 @@ __decorate([
20543
20516
  __decorate([
20544
20517
  ignoreFromSerialization
20545
20518
  ], SparkScan.prototype, "controller", void 0);
20546
- __decorate([
20547
- LogValues({ source: 'ts.barcode', category: LogCategory.Lifecycle })
20548
- ], SparkScan.prototype, "applySettings", null);
20549
20519
 
20550
20520
  class SparkScanLicenseInfo {
20551
20521
  constructor() {
@@ -22571,9 +22541,6 @@ __decorate([
22571
22541
  __decorate([
22572
22542
  ignoreFromSerialization
22573
22543
  ], BaseSparkScanView.prototype, "viewCreationGate", void 0);
22574
- __decorate([
22575
- LogValues({ source: 'ts.barcode', category: LogCategory.Lifecycle })
22576
- ], BaseSparkScanView.prototype, "dispose", null);
22577
22544
 
22578
22545
  class SparkScanBarcodeFeedback extends DefaultSerializeable {
22579
22546
  constructor() {
@@ -26603,9 +26570,6 @@ __decorate([
26603
26570
  __decorate([
26604
26571
  ignoreFromSerialization
26605
26572
  ], BaseBarcodeFindView.prototype, "_viewId", void 0);
26606
- __decorate([
26607
- LogValues({ source: 'ts.barcode', category: LogCategory.Lifecycle })
26608
- ], BaseBarcodeFindView.prototype, "dispose", null);
26609
26573
 
26610
26574
  class BarcodeGeneratorCreationOptions {
26611
26575
  constructor(backgroundColor = null, foregroundColor = null, errorCorrectionLevel = null, versionNumber = null, minimumErrorCorrectionPercent = null, layers = null, compact = null, compactionMode = null, dimensions = null) {
@@ -26839,9 +26803,6 @@ __decorate([
26839
26803
  __decorate([
26840
26804
  ignoreFromSerialization
26841
26805
  ], BarcodeGenerator.prototype, "controller", void 0);
26842
- __decorate([
26843
- LogValues({ source: 'ts.barcode', category: LogCategory.Lifecycle })
26844
- ], BarcodeGenerator.prototype, "dispose", null);
26845
26806
 
26846
26807
  var QrCodeErrorCorrectionLevel;
26847
26808
  (function (QrCodeErrorCorrectionLevel) {