@adadapted/react-native-sdk 3.2.0 → 3.3.0

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.
Files changed (74) hide show
  1. package/android/.project +1 -1
  2. package/android/.settings/org.eclipse.buildship.core.prefs +2 -2
  3. package/android/bin/build.gradle +6 -5
  4. package/android/bin/gradle.properties +4 -4
  5. package/android/build.gradle +6 -5
  6. package/android/gradle.properties +3 -3
  7. package/android/src/main/AndroidManifest.xml +1 -3
  8. package/lib/commonjs/api/adadaptedApiRequests.js.map +1 -1
  9. package/lib/commonjs/api/adadaptedApiRequests.mock.js +25 -8
  10. package/lib/commonjs/api/adadaptedApiRequests.mock.js.map +1 -1
  11. package/lib/commonjs/api/adadaptedApiTypes.js +71 -26
  12. package/lib/commonjs/api/adadaptedApiTypes.js.map +1 -1
  13. package/lib/commonjs/components/AdZone.js +53 -14
  14. package/lib/commonjs/components/AdZone.js.map +1 -1
  15. package/lib/commonjs/components/ReportAdButton.js +38 -0
  16. package/lib/commonjs/components/ReportAdButton.js.map +1 -0
  17. package/lib/commonjs/images/ReportIcon.png +0 -0
  18. package/lib/commonjs/index.js +139 -89
  19. package/lib/commonjs/index.js.map +1 -1
  20. package/lib/commonjs/types.js +4 -0
  21. package/lib/commonjs/types.js.map +1 -1
  22. package/lib/commonjs/util.js +13 -0
  23. package/lib/commonjs/util.js.map +1 -1
  24. package/lib/module/api/adadaptedApiRequests.js.map +1 -1
  25. package/lib/module/api/adadaptedApiRequests.mock.js +25 -9
  26. package/lib/module/api/adadaptedApiRequests.mock.js.map +1 -1
  27. package/lib/module/api/adadaptedApiTypes.js +69 -24
  28. package/lib/module/api/adadaptedApiTypes.js.map +1 -1
  29. package/lib/module/components/AdZone.js +49 -14
  30. package/lib/module/components/AdZone.js.map +1 -1
  31. package/lib/module/components/ReportAdButton.js +30 -0
  32. package/lib/module/components/ReportAdButton.js.map +1 -0
  33. package/lib/module/images/ReportIcon.png +0 -0
  34. package/lib/module/index.js +139 -88
  35. package/lib/module/index.js.map +1 -1
  36. package/lib/module/types.js +1 -1
  37. package/lib/module/types.js.map +1 -1
  38. package/lib/module/util.js +14 -2
  39. package/lib/module/util.js.map +1 -1
  40. package/lib/typescript/example/index.d.ts +1 -0
  41. package/lib/typescript/example/index.d.ts.map +1 -0
  42. package/lib/typescript/example/src/App.d.ts +22 -2
  43. package/lib/typescript/example/src/App.d.ts.map +1 -0
  44. package/lib/typescript/example/src/OffScreenAdZone.d.ts +38 -0
  45. package/lib/typescript/example/src/OffScreenAdZone.d.ts.map +1 -0
  46. package/lib/typescript/example/src/StandardAdZone.d.ts +38 -0
  47. package/lib/typescript/example/src/StandardAdZone.d.ts.map +1 -0
  48. package/lib/typescript/index.d.ts +2 -0
  49. package/lib/typescript/index.d.ts.map +1 -0
  50. package/lib/typescript/jest.setup.d.ts +2 -1
  51. package/lib/typescript/jest.setup.d.ts.map +1 -0
  52. package/lib/typescript/src/api/adadaptedApiRequests.d.ts +1 -0
  53. package/lib/typescript/src/api/adadaptedApiRequests.d.ts.map +1 -0
  54. package/lib/typescript/src/api/adadaptedApiRequests.mock.d.ts +1 -0
  55. package/lib/typescript/src/api/adadaptedApiRequests.mock.d.ts.map +1 -0
  56. package/lib/typescript/src/api/adadaptedApiTypes.d.ts +1 -0
  57. package/lib/typescript/src/api/adadaptedApiTypes.d.ts.map +1 -0
  58. package/lib/typescript/src/components/AdZone.d.ts +5 -4
  59. package/lib/typescript/src/components/AdZone.d.ts.map +1 -0
  60. package/lib/typescript/src/components/ReportAdButton.d.ts +19 -0
  61. package/lib/typescript/src/components/ReportAdButton.d.ts.map +1 -0
  62. package/lib/typescript/src/index.d.ts +23 -6
  63. package/lib/typescript/src/index.d.ts.map +1 -0
  64. package/lib/typescript/src/types.d.ts +3 -2
  65. package/lib/typescript/src/types.d.ts.map +1 -0
  66. package/lib/typescript/src/util.d.ts +13 -0
  67. package/lib/typescript/src/util.d.ts.map +1 -0
  68. package/package.json +155 -155
  69. package/src/api/adadaptedApiRequests.mock.ts +25 -9
  70. package/src/components/AdZone.tsx +52 -20
  71. package/src/components/ReportAdButton.tsx +46 -0
  72. package/src/images/ReportIcon.png +0 -0
  73. package/src/index.tsx +134 -68
  74. package/src/util.ts +13 -0
@@ -22,6 +22,7 @@ import { WebView } from "react-native-webview";
22
22
  import { ApiEnv, DeviceOS } from "../index";
23
23
  import { safeInvoke } from "../util";
24
24
  import { useEffect, useState } from "react";
25
+ import { ReportAdButton } from "./ReportAdButton";
25
26
 
26
27
  /**
27
28
  * Props interface for {@link AdZone}.
@@ -66,13 +67,13 @@ interface Props {
66
67
  */
67
68
  onAddToListTriggered?(items: DetailedListItem[]): void;
68
69
  /**
69
- * Track the ad zone visibility in parent component.
70
+ * Is the ad zone visible on render.
70
71
  */
71
- isAdZoneVisible?: boolean;
72
+ offScreenAdZone: boolean;
72
73
  /**
73
- * Set default ad zone visibility to false.
74
+ * Track the ad zone visibility in parent component. (for off-screen ads)
74
75
  */
75
- defaultToInvisibleAdZone?: boolean;
76
+ isAdZoneVisible?: boolean;
76
77
  }
77
78
 
78
79
  /**
@@ -101,6 +102,10 @@ interface StyleDef {
101
102
  * Styles for the WebView element.
102
103
  */
103
104
  webView: ViewStyle;
105
+ /**
106
+ * Styles for the ReportAdButton.
107
+ */
108
+ reportAd: ViewStyle;
104
109
  }
105
110
  /**
106
111
  * Timer used for cycling through ads in the zone
@@ -130,36 +135,51 @@ export function AdZone(props: Props): JSX.Element {
130
135
  /**
131
136
  * Track ad visibility (for off-screen ads).
132
137
  */
133
- const [isAdVisible, setIsAdVisibile] = useState(
134
- props.defaultToInvisibleAdZone ? false : true
135
- );
138
+ const [isAdVisible, setIsAdVisibile] = useState(props.isAdZoneVisible);
136
139
 
137
- // - Define all useEffect triggers.
140
+ // Setup device listeners.
138
141
  useEffect(() => {
139
- DeviceEventEmitter.addListener("visibility-event", (event) => {
142
+ DeviceEventEmitter.addListener("visibility-event", (event: boolean) => {
140
143
  setIsAdVisibile(event);
141
144
  });
142
- DeviceEventEmitter.addListener("acknowledge", (itemName) => {
145
+
146
+ DeviceEventEmitter.addListener("acknowledge", (itemName: string) => {
143
147
  acknowledge(itemName);
144
148
  });
149
+
150
+ if (props.offScreenAdZone && isAdVisible) {
151
+ sendAdImpression();
152
+ } else if (!props.offScreenAdZone) {
153
+ sendAdImpression();
154
+ }
155
+
145
156
  return () => {
146
157
  clearTimeout(cycleAdTimer);
147
158
  DeviceEventEmitter.removeAllListeners("visibility-event");
148
159
  DeviceEventEmitter.removeAllListeners("acknowledge");
149
160
  };
161
+ // eslint-disable-next-line react-hooks/exhaustive-deps
150
162
  }, []);
151
163
 
164
+ // Send impression on ad cycle.
152
165
  useEffect(() => {
153
166
  startAdTimer();
154
- if (isAdVisible) {
167
+ if (props.offScreenAdZone && isAdVisible) {
168
+ sendAdImpression();
169
+ } else if (!props.offScreenAdZone) {
155
170
  sendAdImpression();
156
171
  }
172
+ // eslint-disable-next-line react-hooks/exhaustive-deps
157
173
  }, [adIndexShown]);
158
174
 
175
+ // Send impression based on visibility change. (for off-screen ads)
159
176
  useEffect(() => {
160
- if (isAdVisible) {
177
+ if (props.offScreenAdZone && isAdVisible) {
178
+ sendAdImpression();
179
+ } else if (!props.offScreenAdZone) {
161
180
  sendAdImpression();
162
181
  }
182
+ // eslint-disable-next-line react-hooks/exhaustive-deps
163
183
  }, [isAdVisible]);
164
184
 
165
185
  /**
@@ -176,6 +196,11 @@ export function AdZone(props: Props): JSX.Element {
176
196
  width: "100%",
177
197
  height: "100%",
178
198
  },
199
+ reportAd: {
200
+ position: "absolute",
201
+ top: 10,
202
+ right: 10,
203
+ },
179
204
  });
180
205
  }
181
206
 
@@ -188,8 +213,8 @@ export function AdZone(props: Props): JSX.Element {
188
213
 
189
214
  if (!currentAd || !currentAd.creative_url) {
190
215
  // If there is no ad to display, make the view take up no space.
191
- finalMainViewStyle.width = "0";
192
- finalMainViewStyle.height = "0";
216
+ finalMainViewStyle.width = 0;
217
+ finalMainViewStyle.height = 0;
193
218
  }
194
219
 
195
220
  /**
@@ -225,11 +250,16 @@ export function AdZone(props: Props): JSX.Element {
225
250
  function acknowledge(itemName: string): void {
226
251
  if (props.adZoneData.ads) {
227
252
  props.adZoneData.ads.forEach((ad) => {
228
- ad.payload.detailed_list_items.forEach((item) => {
229
- if (item.product_title === itemName) {
230
- triggerReportAdEvent(ad, ReportedEventType.INTERACTION);
231
- }
232
- });
253
+ if (ad.action_type === "c") {
254
+ ad.payload.detailed_list_items.forEach((item) => {
255
+ if (item.product_title === itemName) {
256
+ triggerReportAdEvent(
257
+ ad,
258
+ ReportedEventType.INTERACTION
259
+ );
260
+ }
261
+ });
262
+ }
233
263
  });
234
264
  }
235
265
  }
@@ -312,7 +342,6 @@ export function AdZone(props: Props): JSX.Element {
312
342
  function sendAdImpression(): void {
313
343
  const ad = props.adZoneData.ads[adIndexShown];
314
344
 
315
- // Trigger an impression event for the ad.
316
345
  if (!ad.impression_tracked) {
317
346
  triggerReportAdEvent(ad, ReportedEventType.IMPRESSION);
318
347
  ad.impression_tracked = true;
@@ -360,6 +389,9 @@ export function AdZone(props: Props): JSX.Element {
360
389
  }}
361
390
  />
362
391
  ) : undefined}
392
+ <View style={styles.reportAd}>
393
+ <ReportAdButton adId={currentAd.ad_id} udid={props.udid} />
394
+ </View>
363
395
  </View>
364
396
  );
365
397
  }
@@ -0,0 +1,46 @@
1
+ import React, { useEffect } from "react";
2
+ import { Image, Linking, StyleSheet, TouchableOpacity } from "react-native";
3
+
4
+ interface Props {
5
+ /**
6
+ * The ad id of the current ad.
7
+ */
8
+ adId: string;
9
+ /**
10
+ * The current user's udid.
11
+ */
12
+ udid: string;
13
+ }
14
+
15
+ /**
16
+ * Creates the ReportAdButton component.
17
+ * @param props The component's props.
18
+ * @returns a reportSdButton JSX Element.
19
+ */
20
+ export function ReportAdButton(props: Props): JSX.Element {
21
+ const reportAdUrlBase = new URL("https://feedback.add-it.io/");
22
+
23
+ const styles = StyleSheet.create({
24
+ buttonStyle: {
25
+ width: 14,
26
+ height: 14,
27
+ },
28
+ });
29
+
30
+ useEffect(() => {
31
+ reportAdUrlBase.searchParams.append("aid", props.adId);
32
+ reportAdUrlBase.searchParams.append("uid", props.udid);
33
+ // eslint-disable-next-line react-hooks/exhaustive-deps
34
+ }, [props]);
35
+
36
+ return (
37
+ <TouchableOpacity
38
+ style={styles.buttonStyle}
39
+ onPress={() => {
40
+ Linking.openURL(reportAdUrlBase.toString());
41
+ }}
42
+ >
43
+ <Image source={require("../images/ReportIcon.png")} />
44
+ </TouchableOpacity>
45
+ );
46
+ }
Binary file
package/src/index.tsx CHANGED
@@ -3,7 +3,6 @@
3
3
  */
4
4
  import * as React from "react";
5
5
  import {
6
- AppState,
7
6
  DeviceEventEmitter,
8
7
  EmitterSubscription,
9
8
  Linking,
@@ -100,7 +99,7 @@ export enum PayloadApiEnv {
100
99
  }
101
100
 
102
101
  /**
103
- * Interface defining inputs to the {@link Sdk.initialize} method.
102
+ * Interface defining inputs to the {@link Sdk.initialize: AdadaptedReactNativeSdk} method.
104
103
  */
105
104
  export interface InitializeProps {
106
105
  /**
@@ -142,9 +141,9 @@ export interface InitializeProps {
142
141
  */
143
142
  onOutOfAppPayloadAvailable?(payloads: OutOfAppDataPayload[]): void;
144
143
  /**
145
- * Change the optional ad zone visibility default setting.
144
+ * Ad zones that contain off-screen ads.
146
145
  */
147
- defaultToInvisibleAdZone?: boolean;
146
+ offScreenAdZone?: [number];
148
147
  }
149
148
 
150
149
  /**
@@ -272,6 +271,10 @@ export class AdadaptedReactNativeSdk {
272
271
  * The available ad zones.
273
272
  */
274
273
  private adZones: AdZoneInfo[] | undefined;
274
+ /**
275
+ * The available off-screen ad zones.
276
+ */
277
+ private offScreenAdZones: AdZoneInfo[] = [];
275
278
  /**
276
279
  * The touch sensitivity of the Ad Zone in both the X and Y directions.
277
280
  * This is used to determine the click/press sensitivity when the
@@ -334,9 +337,9 @@ export class AdadaptedReactNativeSdk {
334
337
  */
335
338
  private isAdZoneVisible: boolean = true;
336
339
  /**
337
- * Optional default ad zone visibility for off-screen ads.
340
+ * Ad zones that contain off-screen ads..
338
341
  */
339
- private defaultAdZoneVisibility: boolean | undefined;
342
+ private offScreenAdZone: [number] | undefined;
340
343
  /**
341
344
  * Gets the Session ID.
342
345
  * @returns the Session ID.
@@ -361,6 +364,14 @@ export class AdadaptedReactNativeSdk {
361
364
  return this.adZones;
362
365
  }
363
366
 
367
+ /**
368
+ * Gets the list of available off-screen Ad Zones.
369
+ * @returns all available off-screen ad zones.
370
+ */
371
+ public getOffScreenAdZones(): AdZoneInfo[] | undefined {
372
+ return this.offScreenAdZones;
373
+ }
374
+
364
375
  /**
365
376
  * @inheritDoc
366
377
  */
@@ -409,33 +420,83 @@ export class AdadaptedReactNativeSdk {
409
420
 
410
421
  for (const adZoneId in adZones) {
411
422
  if (Object.prototype.hasOwnProperty.call(adZones, adZoneId)) {
412
- adZoneInfoList.push({
413
- zoneId: adZones[adZoneId].id,
414
- adZone: (
415
- <AdZone
416
- key={adZoneId}
417
- appId={this.appId}
418
- sessionId={this.sessionId!}
419
- udid={this.deviceInfo!.udid}
420
- deviceOs={this.deviceOs!}
421
- apiEnv={this.apiEnv}
422
- xyDragDistanceAllowed={
423
- this.xyAdZoneDragDistanceAllowed || 25
424
- }
425
- adZoneData={adZones[adZoneId]}
426
- onAddToListTriggered={(items) => {
427
- safeInvoke(this.onAddToListTriggered, items);
428
- }}
429
- isAdZoneVisible={!this.onAdZoneVisibilityChanged}
430
- defaultToInvisibleAdZone={
431
- this.defaultAdZoneVisibility
432
- }
433
- />
434
- ),
423
+ this.offScreenAdZone?.forEach((zone) => {
424
+ if (Number(adZones[adZoneId].id) !== zone) {
425
+ adZoneInfoList.push({
426
+ zoneId: adZones[adZoneId].id,
427
+ adZone: (
428
+ <AdZone
429
+ key={adZoneId}
430
+ appId={this.appId}
431
+ sessionId={this.sessionId!}
432
+ udid={this.deviceInfo!.udid}
433
+ deviceOs={this.deviceOs!}
434
+ apiEnv={this.apiEnv}
435
+ xyDragDistanceAllowed={
436
+ this.xyAdZoneDragDistanceAllowed || 25
437
+ }
438
+ adZoneData={adZones[adZoneId]}
439
+ onAddToListTriggered={(items) => {
440
+ safeInvoke(
441
+ this.onAddToListTriggered,
442
+ items
443
+ );
444
+ }}
445
+ isAdZoneVisible={true}
446
+ offScreenAdZone={false}
447
+ />
448
+ ),
449
+ });
450
+ }
435
451
  });
436
452
  }
437
453
  }
454
+ return adZoneInfoList;
455
+ }
456
+
457
+ /**
458
+ * Creates all off-screen Ad Zone Info objects based on provided off-screen Ad Zones.
459
+ * @param adZones - The object of available zones.
460
+ * @returns the array of off-screen Ad Zone Info objects.
461
+ */
462
+ private generateOffScreenAdZones(adZones: {
463
+ [key: number]: Zone;
464
+ }): AdZoneInfo[] {
465
+ const adZoneInfoList: AdZoneInfo[] = [];
438
466
 
467
+ for (const adZoneId in adZones) {
468
+ if (Object.prototype.hasOwnProperty.call(adZones, adZoneId)) {
469
+ this.offScreenAdZone?.forEach((zone) => {
470
+ if (Number(adZones[adZoneId].id) === zone) {
471
+ adZoneInfoList.push({
472
+ zoneId: adZones[adZoneId].id,
473
+ adZone: (
474
+ <AdZone
475
+ key={adZoneId}
476
+ appId={this.appId}
477
+ sessionId={this.sessionId!}
478
+ udid={this.deviceInfo!.udid}
479
+ deviceOs={this.deviceOs!}
480
+ apiEnv={this.apiEnv}
481
+ xyDragDistanceAllowed={
482
+ this.xyAdZoneDragDistanceAllowed || 25
483
+ }
484
+ adZoneData={adZones[adZoneId]}
485
+ onAddToListTriggered={(items) => {
486
+ safeInvoke(
487
+ this.onAddToListTriggered,
488
+ items
489
+ );
490
+ }}
491
+ isAdZoneVisible={this.isAdZoneVisible}
492
+ offScreenAdZone={true}
493
+ />
494
+ ),
495
+ });
496
+ }
497
+ });
498
+ }
499
+ }
439
500
  return adZoneInfoList;
440
501
  }
441
502
 
@@ -466,6 +527,9 @@ export class AdadaptedReactNativeSdk {
466
527
  .then((response) => {
467
528
  this.sessionInfo = response.data;
468
529
  this.adZones = this.generateAdZones(response.data.zones);
530
+ this.offScreenAdZones = this.generateOffScreenAdZones(
531
+ response.data.zones
532
+ );
469
533
 
470
534
  // Call the user defined callback indicating
471
535
  // the session data has been refreshed.
@@ -576,13 +640,15 @@ export class AdadaptedReactNativeSdk {
576
640
  */
577
641
  private handleDeepLink(event: any): void {
578
642
  const searchStr = "data=";
579
- const dataIndex: number = event["url"].indexOf(searchStr);
643
+ const dataIndex: number = event.url.indexOf(searchStr);
580
644
 
581
645
  if (dataIndex !== -1) {
582
- const encodedData = event.url.substr(dataIndex + searchStr.length);
646
+ const encodedData: string = event.url.substr(
647
+ `${dataIndex}${searchStr.length}`
648
+ );
583
649
  const payloadData = JSON.parse(base64.decode(encodedData));
584
- const payloadId = payloadData["payload_id"];
585
- const itemDataList = payloadData["detailed_list_items"];
650
+ const payloadId = payloadData.payload_id;
651
+ const itemDataList = payloadData.detailed_list_items;
586
652
 
587
653
  if (itemDataList && itemDataList.length > 0) {
588
654
  const finalItemList: OutOfAppDataPayload[] = [];
@@ -592,13 +658,13 @@ export class AdadaptedReactNativeSdk {
592
658
  payload_id: payloadId,
593
659
  detailed_list_items: [
594
660
  {
595
- product_title: itemData["product_title"],
596
- product_brand: itemData["product_brand"],
597
- product_category: itemData["product_category"],
598
- product_barcode: itemData["product_barcode"],
599
- product_discount: itemData["product_discount"],
600
- product_image: itemData["product_image"],
601
- product_sku: itemData["product_sku"],
661
+ product_title: itemData.product_title,
662
+ product_brand: itemData.product_brand,
663
+ product_category: itemData.product_category,
664
+ product_barcode: itemData.product_barcode,
665
+ product_discount: itemData.product_discount,
666
+ product_image: itemData.product_image,
667
+ product_sku: itemData.product_sku,
602
668
  },
603
669
  ],
604
670
  });
@@ -642,16 +708,13 @@ export class AdadaptedReactNativeSdk {
642
708
  payload_id: payload.payload_id,
643
709
  detailed_list_items: [
644
710
  {
645
- product_title: itemData["product_title"],
646
- product_brand: itemData["product_brand"],
647
- product_category:
648
- itemData["product_category"],
649
- product_barcode:
650
- itemData["product_barcode"],
651
- product_discount:
652
- itemData["product_discount"],
653
- product_image: itemData["product_image"],
654
- product_sku: itemData["product_sku"],
711
+ product_title: itemData.product_title,
712
+ product_brand: itemData.product_brand,
713
+ product_category: itemData.product_category,
714
+ product_barcode: itemData.product_barcode,
715
+ product_discount: itemData.product_discount,
716
+ product_image: itemData.product_image,
717
+ product_sku: itemData.product_sku,
655
718
  },
656
719
  ],
657
720
  });
@@ -668,9 +731,9 @@ export class AdadaptedReactNativeSdk {
668
731
 
669
732
  /**
670
733
  * Notify the ad zone of visibility status change for off-screen ads.
734
+ * @param isVisible - Ad Zone visibility tracking.
671
735
  */
672
- public onAdZoneVisibilityChanged(): void {
673
- const isVisible = !this.isAdZoneVisible;
736
+ public onAdZoneVisibilityChanged(isVisible: boolean): void {
674
737
  this.isAdZoneVisible = isVisible;
675
738
  DeviceEventEmitter.emit("visibility-event", isVisible);
676
739
  }
@@ -735,10 +798,9 @@ export class AdadaptedReactNativeSdk {
735
798
  this.onOutOfAppPayloadAvailable = props.onOutOfAppPayloadAvailable;
736
799
  }
737
800
 
738
- // If provided for off-screen ads, set the ad zone visibility for ad tracking.
739
- if (props.defaultToInvisibleAdZone) {
740
- this.defaultAdZoneVisibility = props.defaultToInvisibleAdZone;
741
- this.onAdZoneVisibilityChanged();
801
+ // If provided set any off-screen ad zones.
802
+ if (props.offScreenAdZone) {
803
+ this.offScreenAdZone = props.offScreenAdZone;
742
804
  }
743
805
 
744
806
  return new Promise<void>((resolve, reject) => {
@@ -796,6 +858,10 @@ export class AdadaptedReactNativeSdk {
796
858
  this.adZones = this.generateAdZones(
797
859
  response.data.zones
798
860
  );
861
+ this.offScreenAdZones =
862
+ this.generateOffScreenAdZones(
863
+ response.data.zones
864
+ );
799
865
 
800
866
  // Start the session data refresh timer.
801
867
  this.onRefreshAdZones();
@@ -821,18 +887,18 @@ export class AdadaptedReactNativeSdk {
821
887
  this.getPayloadItemData();
822
888
 
823
889
  // Initialize an event listener to intercept deep links while the app is running.
824
-
825
- this.deepLinkOnEventListener = Linking.addEventListener(
826
- "url",
827
- this.handleDeepLink
828
- );
829
-
830
- // Initialize an event listener to intercept App state changes.
831
-
832
- this.AppStateOnEventListener = AppState.addEventListener(
833
- "change",
834
- this.handleAppStateChange
835
- );
890
+ this.deepLinkOnEventListener =
891
+ Linking.addEventListener(
892
+ "url",
893
+ this.handleDeepLink
894
+ );
895
+
896
+ // // Initialize an event listener to intercept App state changes.
897
+ // this.AppStateOnEventListener =
898
+ // AppState.addEventListener(
899
+ // "change",
900
+ // this.handleAppStateChange
901
+ // );
836
902
 
837
903
  resolve();
838
904
  })
package/src/util.ts CHANGED
@@ -14,6 +14,8 @@ export function safeInvoke<R>(func: (() => R) | nil): R | undefined;
14
14
  * See main definition above.
15
15
  * @param func - The function to call.
16
16
  * @param arg1 - Function argument.
17
+ * @returns The return value of the executed function, or undefined if
18
+ * the function is null/undefined
17
19
  */
18
20
  export function safeInvoke<A1, R>(
19
21
  func: ((arg1: A1) => R) | nil,
@@ -24,6 +26,8 @@ export function safeInvoke<A1, R>(
24
26
  * @param func - The function to call.
25
27
  * @param arg1 - Function argument.
26
28
  * @param arg2 - Function argument.
29
+ * @returns The return value of the executed function, or undefined if
30
+ * the function is null/undefined
27
31
  */
28
32
  export function safeInvoke<A1, A2, R>(
29
33
  func: ((arg1: A1, arg2: A2) => R) | nil,
@@ -36,6 +40,8 @@ export function safeInvoke<A1, A2, R>(
36
40
  * @param arg1 - Function argument.
37
41
  * @param arg2 - Function argument.
38
42
  * @param arg3 - Function argument.
43
+ * @returns The return value of the executed function, or undefined if
44
+ * the function is null/undefined
39
45
  */
40
46
  export function safeInvoke<A1, A2, A3, R>(
41
47
  func: ((arg1: A1, arg2: A2, arg3: A3) => R) | nil,
@@ -50,6 +56,8 @@ export function safeInvoke<A1, A2, A3, R>(
50
56
  * @param arg2 - Function argument.
51
57
  * @param arg3 - Function argument.
52
58
  * @param arg4 - Function argument.
59
+ * @returns The return value of the executed function, or undefined if
60
+ * the function is null/undefined
53
61
  */
54
62
  export function safeInvoke<A1, A2, A3, A4, R>(
55
63
  func: ((arg1: A1, arg2: A2, arg3: A3, arg4: A4) => R) | nil,
@@ -66,6 +74,8 @@ export function safeInvoke<A1, A2, A3, A4, R>(
66
74
  * @param arg3 - Function argument.
67
75
  * @param arg4 - Function argument.
68
76
  * @param arg5 - Function argument.
77
+ * @returns The return value of the executed function, or undefined if
78
+ * the function is null/undefined
69
79
  */
70
80
  export function safeInvoke<A1, A2, A3, A4, A5, R>(
71
81
  func: ((arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => R) | nil,
@@ -84,6 +94,8 @@ export function safeInvoke<A1, A2, A3, A4, A5, R>(
84
94
  * @param arg4 - Function argument.
85
95
  * @param arg5 - Function argument.
86
96
  * @param arg6 - Function argument.
97
+ * @returns The return value of the executed function, or undefined if
98
+ * the function is null/undefined
87
99
  */
88
100
  export function safeInvoke<A1, A2, A3, A4, A5, A6, R>(
89
101
  func:
@@ -105,6 +117,7 @@ export function safeInvoke<A1, A2, A3, A4, A5, A6, R>(
105
117
  // eslint-disable-next-line @typescript-eslint/ban-types
106
118
  export function safeInvoke(func: Function | nil, ...args: any[]): any {
107
119
  if (func) {
120
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
108
121
  return func(...args);
109
122
  }
110
123
  }