react-native-google-mobile-ads 11.1.1 → 11.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 (145) hide show
  1. package/README.md +15 -0
  2. package/RNGoogleMobileAds.podspec +6 -2
  3. package/__tests__/banner.test.tsx +10 -0
  4. package/__tests__/googleMobileAds.test.ts +21 -0
  5. package/__tests__/interstitial.test.ts +22 -8
  6. package/android/build.gradle +8 -0
  7. package/android/src/main/java/io/invertase/googlemobileads/OnNativeEvent.kt +21 -0
  8. package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsBannerAdViewManager.java +21 -9
  9. package/android/src/main/java/io/invertase/googlemobileads/common/SharedUtils.java +17 -15
  10. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.m +4 -0
  11. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.swift +4 -0
  12. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerComponent.h +4 -0
  13. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerComponent.m +11 -2
  14. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerView.h +30 -0
  15. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerView.mm +220 -0
  16. package/ios/RNGoogleMobileAds/{RNGoogleMobileAdsBannerViewManager.m → RNGoogleMobileAdsBannerViewManager.mm} +19 -2
  17. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.h +5 -1
  18. package/ios/RNGoogleMobileAds/{RNGoogleMobileAdsCommon.m → RNGoogleMobileAdsCommon.mm} +4 -0
  19. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsConsentModule.m +13 -1
  20. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenAd.swift +4 -0
  21. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenContentDelegate.swift +4 -0
  22. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.m +4 -0
  23. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.swift +4 -0
  24. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsModule.h +9 -1
  25. package/ios/RNGoogleMobileAds/{RNGoogleMobileAdsModule.m → RNGoogleMobileAdsModule.mm} +52 -21
  26. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.m +4 -0
  27. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.swift +4 -0
  28. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.m +4 -0
  29. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.swift +4 -0
  30. package/jest.setup.ts +12 -1
  31. package/lib/commonjs/MobileAds.js +26 -31
  32. package/lib/commonjs/MobileAds.js.map +1 -1
  33. package/lib/commonjs/NativeGoogleMobileAdsModule.js +10 -0
  34. package/lib/commonjs/NativeGoogleMobileAdsModule.js.map +1 -0
  35. package/lib/commonjs/ads/AppOpenAd.js +1 -2
  36. package/lib/commonjs/ads/AppOpenAd.js.map +1 -1
  37. package/lib/commonjs/ads/BaseAd.js +11 -13
  38. package/lib/commonjs/ads/BaseAd.js.map +1 -1
  39. package/lib/commonjs/ads/GAMBannerAd.js +3 -5
  40. package/lib/commonjs/ads/GAMBannerAd.js.map +1 -1
  41. package/lib/commonjs/ads/GoogleMobileAdsBannerViewNativeComponent.js +16 -0
  42. package/lib/commonjs/ads/GoogleMobileAdsBannerViewNativeComponent.js.map +1 -0
  43. package/lib/commonjs/ads/InterstitialAd.js +1 -2
  44. package/lib/commonjs/ads/InterstitialAd.js.map +1 -1
  45. package/lib/commonjs/ads/MobileAd.js +8 -6
  46. package/lib/commonjs/ads/MobileAd.js.map +1 -1
  47. package/lib/commonjs/ads/RewardedAd.js +1 -2
  48. package/lib/commonjs/ads/RewardedAd.js.map +1 -1
  49. package/lib/commonjs/ads/RewardedInterstitialAd.js +1 -2
  50. package/lib/commonjs/ads/RewardedInterstitialAd.js.map +1 -1
  51. package/lib/commonjs/internal/GoogleMobileAdsNativeEventEmitter.js.map +1 -1
  52. package/lib/commonjs/version.js +1 -1
  53. package/lib/module/MobileAds.js +25 -31
  54. package/lib/module/MobileAds.js.map +1 -1
  55. package/lib/module/NativeGoogleMobileAdsModule.js +3 -0
  56. package/lib/module/NativeGoogleMobileAdsModule.js.map +1 -0
  57. package/lib/module/ads/AppOpenAd.js +1 -2
  58. package/lib/module/ads/AppOpenAd.js.map +1 -1
  59. package/lib/module/ads/BaseAd.js +9 -12
  60. package/lib/module/ads/BaseAd.js.map +1 -1
  61. package/lib/module/ads/GAMBannerAd.js +3 -5
  62. package/lib/module/ads/GAMBannerAd.js.map +1 -1
  63. package/lib/module/ads/GoogleMobileAdsBannerViewNativeComponent.js +7 -0
  64. package/lib/module/ads/GoogleMobileAdsBannerViewNativeComponent.js.map +1 -0
  65. package/lib/module/ads/InterstitialAd.js +1 -2
  66. package/lib/module/ads/InterstitialAd.js.map +1 -1
  67. package/lib/module/ads/MobileAd.js +8 -6
  68. package/lib/module/ads/MobileAd.js.map +1 -1
  69. package/lib/module/ads/RewardedAd.js +1 -2
  70. package/lib/module/ads/RewardedAd.js.map +1 -1
  71. package/lib/module/ads/RewardedInterstitialAd.js +1 -2
  72. package/lib/module/ads/RewardedInterstitialAd.js.map +1 -1
  73. package/lib/module/internal/GoogleMobileAdsNativeEventEmitter.js.map +1 -1
  74. package/lib/module/version.js +1 -1
  75. package/lib/typescript/MobileAds.d.ts +3 -4
  76. package/lib/typescript/MobileAds.d.ts.map +1 -1
  77. package/lib/typescript/NativeGoogleMobileAdsModule.d.ts +12 -0
  78. package/lib/typescript/NativeGoogleMobileAdsModule.d.ts.map +1 -0
  79. package/lib/typescript/ads/AppOpenAd.d.ts.map +1 -1
  80. package/lib/typescript/ads/BaseAd.d.ts +1 -33
  81. package/lib/typescript/ads/BaseAd.d.ts.map +1 -1
  82. package/lib/typescript/ads/GAMBannerAd.d.ts.map +1 -1
  83. package/lib/typescript/ads/GoogleMobileAdsBannerViewNativeComponent.d.ts +27 -0
  84. package/lib/typescript/ads/GoogleMobileAdsBannerViewNativeComponent.d.ts.map +1 -0
  85. package/lib/typescript/ads/InterstitialAd.d.ts.map +1 -1
  86. package/lib/typescript/ads/MobileAd.d.ts +6 -5
  87. package/lib/typescript/ads/MobileAd.d.ts.map +1 -1
  88. package/lib/typescript/ads/RewardedAd.d.ts.map +1 -1
  89. package/lib/typescript/ads/RewardedInterstitialAd.d.ts.map +1 -1
  90. package/lib/typescript/index.d.ts +1 -1
  91. package/lib/typescript/internal/GoogleMobileAdsNativeEventEmitter.d.ts +2 -1
  92. package/lib/typescript/internal/GoogleMobileAdsNativeEventEmitter.d.ts.map +1 -1
  93. package/lib/typescript/types/MobileAdsModule.interface.d.ts +0 -10
  94. package/lib/typescript/types/MobileAdsModule.interface.d.ts.map +1 -1
  95. package/lib/typescript/version.d.ts +1 -1
  96. package/package.json +9 -1
  97. package/src/MobileAds.ts +29 -62
  98. package/src/NativeGoogleMobileAdsModule.ts +14 -0
  99. package/src/ads/AppOpenAd.ts +7 -2
  100. package/src/ads/BaseAd.tsx +101 -116
  101. package/src/ads/GAMBannerAd.tsx +5 -8
  102. package/src/ads/GoogleMobileAdsBannerViewNativeComponent.ts +37 -0
  103. package/src/ads/InterstitialAd.ts +7 -2
  104. package/src/ads/MobileAd.ts +22 -10
  105. package/src/ads/RewardedAd.ts +7 -2
  106. package/src/ads/RewardedInterstitialAd.ts +1 -2
  107. package/src/internal/GoogleMobileAdsNativeEventEmitter.ts +1 -1
  108. package/src/types/MobileAdsModule.interface.ts +0 -13
  109. package/src/version.ts +1 -1
  110. package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerViewManager.h +0 -23
  111. package/lib/commonjs/internal/Module.js +0 -44
  112. package/lib/commonjs/internal/Module.js.map +0 -1
  113. package/lib/commonjs/internal/index.js +0 -44
  114. package/lib/commonjs/internal/index.js.map +0 -1
  115. package/lib/commonjs/internal/registry/nativeModule.js +0 -180
  116. package/lib/commonjs/internal/registry/nativeModule.js.map +0 -1
  117. package/lib/commonjs/types/GoogleMobileAdsNativeModule.js +0 -6
  118. package/lib/commonjs/types/GoogleMobileAdsNativeModule.js.map +0 -1
  119. package/lib/commonjs/types/Module.interface.js +0 -2
  120. package/lib/commonjs/types/Module.interface.js.map +0 -1
  121. package/lib/module/internal/Module.js +0 -54
  122. package/lib/module/internal/Module.js.map +0 -1
  123. package/lib/module/internal/index.js +0 -22
  124. package/lib/module/internal/index.js.map +0 -1
  125. package/lib/module/internal/registry/nativeModule.js +0 -174
  126. package/lib/module/internal/registry/nativeModule.js.map +0 -1
  127. package/lib/module/types/GoogleMobileAdsNativeModule.js +0 -2
  128. package/lib/module/types/GoogleMobileAdsNativeModule.js.map +0 -1
  129. package/lib/module/types/Module.interface.js +0 -2
  130. package/lib/module/types/Module.interface.js.map +0 -1
  131. package/lib/typescript/internal/Module.d.ts +0 -14
  132. package/lib/typescript/internal/Module.d.ts.map +0 -1
  133. package/lib/typescript/internal/index.d.ts +0 -5
  134. package/lib/typescript/internal/index.d.ts.map +0 -1
  135. package/lib/typescript/internal/registry/nativeModule.d.ts +0 -10
  136. package/lib/typescript/internal/registry/nativeModule.d.ts.map +0 -1
  137. package/lib/typescript/types/GoogleMobileAdsNativeModule.d.ts +0 -22
  138. package/lib/typescript/types/GoogleMobileAdsNativeModule.d.ts.map +0 -1
  139. package/lib/typescript/types/Module.interface.d.ts +0 -15
  140. package/lib/typescript/types/Module.interface.d.ts.map +0 -1
  141. package/src/internal/Module.ts +0 -58
  142. package/src/internal/index.ts +0 -21
  143. package/src/internal/registry/nativeModule.ts +0 -205
  144. package/src/types/GoogleMobileAdsNativeModule.ts +0 -26
  145. package/src/types/Module.interface.ts +0 -16
@@ -1,180 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getNativeModule = getNativeModule;
7
- var _reactNative = require("react-native");
8
- var _NativeError = require("../NativeError");
9
- var _GoogleMobileAdsNativeEventEmitter = require("../GoogleMobileAdsNativeEventEmitter");
10
- var _SharedEventEmitter = require("../SharedEventEmitter");
11
- var _common = require("../../common");
12
- /*
13
- * Copyright (c) 2016-present Invertase Limited & Contributors
14
- *
15
- * Licensed under the Apache License, Version 2.0 (the "License");
16
- * you may not use this library except in compliance with the License.
17
- * You may obtain a copy of the License at
18
- *
19
- * http://www.apache.org/licenses/LICENSE-2.0
20
- *
21
- * Unless required by applicable law or agreed to in writing, software
22
- * distributed under the License is distributed on an "AS IS" BASIS,
23
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
- * See the License for the specific language governing permissions and
25
- * limitations under the License.
26
- *
27
- */
28
-
29
- const NATIVE_MODULE_REGISTRY = {};
30
- const NATIVE_MODULE_EVENT_SUBSCRIPTIONS = {};
31
- function nativeModuleKey(module) {
32
- return `${module._customUrlOrRegion || ''}:${module.app.name}:${module._config.namespace}`;
33
- }
34
-
35
- /**
36
- * Wraps a native module method to provide
37
- * auto prepended args and custom Error classes.
38
- *
39
- * @param namespace
40
- * @param method
41
- * @param argToPrepend
42
- * @returns {Function}
43
- */
44
- function nativeModuleMethodWrapped(namespace, method, argToPrepend) {
45
- return function () {
46
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
47
- args[_key] = arguments[_key];
48
- }
49
- const possiblePromise = method(...[...argToPrepend, ...args]);
50
-
51
- // @ts-ignore -- return type is Promise, so tsc infers we *know* it is a promise and .then always exists, but
52
- // but the typing is actually speculative, we do need to test it
53
- if (possiblePromise && possiblePromise.then) {
54
- const jsStack = new Error().stack || '';
55
- return possiblePromise.catch(nativeError => Promise.reject(new _NativeError.NativeError(nativeError, jsStack, namespace)));
56
- }
57
- return possiblePromise;
58
- };
59
- }
60
-
61
- /**
62
- * Prepends all arguments in prependArgs to all native method calls
63
- *
64
- * @param namespace
65
- * @param NativeModule
66
- * @param argToPrepend
67
- */
68
- function nativeModuleWrapped(namespace, NativeModule, argToPrepend) {
69
- const native = {};
70
- if (!NativeModule) {
71
- return NativeModule;
72
- }
73
- const properties = Object.keys(NativeModule);
74
- for (let i = 0, len = properties.length; i < len; i++) {
75
- const property = properties[i];
76
- if ((0, _common.isFunction)(NativeModule[property])) {
77
- native[property] = nativeModuleMethodWrapped(namespace, NativeModule[property], argToPrepend);
78
- } else {
79
- native[property] = NativeModule[property];
80
- }
81
- }
82
- return native;
83
- }
84
-
85
- /**
86
- * Initialises and wraps all the native module methods.
87
- *
88
- * @param module
89
- * @returns {*}
90
- */
91
- function initialiseNativeModule(module) {
92
- const config = module._config;
93
- const key = nativeModuleKey(module);
94
- const {
95
- namespace,
96
- nativeEvents,
97
- nativeModuleName
98
- } = config;
99
- const multiModuleRoot = {};
100
- const multiModule = Array.isArray(nativeModuleName);
101
- const nativeModuleNames = multiModule ? nativeModuleName : [nativeModuleName];
102
- for (let i = 0; i < nativeModuleNames.length; i++) {
103
- const nativeModule = _reactNative.NativeModules[nativeModuleNames[i]];
104
-
105
- // only error if there's a single native module
106
- // as multi modules can mean some are optional
107
- if (!multiModule && !nativeModule) {
108
- throw new Error(getMissingModuleHelpText(namespace));
109
- }
110
- if (multiModule) {
111
- multiModuleRoot[nativeModuleNames[i]] = !!nativeModule;
112
- }
113
- Object.assign(multiModuleRoot, nativeModuleWrapped(namespace, nativeModule, []));
114
- }
115
- if (nativeEvents && nativeEvents.length) {
116
- for (let i = 0, len = nativeEvents.length; i < len; i++) {
117
- subscribeToNativeModuleEvent(nativeEvents[i]);
118
- }
119
- }
120
- Object.freeze(multiModuleRoot);
121
- NATIVE_MODULE_REGISTRY[key] = multiModuleRoot;
122
- return NATIVE_MODULE_REGISTRY[key];
123
- }
124
-
125
- /**
126
- * Subscribe to a native event for js side distribution by appName
127
- * React Native events are hard set at compile - cant do dynamic event names
128
- * so we use a single event send it to js and js then internally can prefix it
129
- * and distribute dynamically.
130
- *
131
- * @param eventName
132
- * @private
133
- */
134
- function subscribeToNativeModuleEvent(eventName) {
135
- if (!NATIVE_MODULE_EVENT_SUBSCRIPTIONS[eventName]) {
136
- _GoogleMobileAdsNativeEventEmitter.GoogleMobileAdsNativeEventEmitter.addListener(eventName, event => {
137
- if (event.appName) {
138
- // native event has an appName property - auto prefix and internally emit
139
- _SharedEventEmitter.SharedEventEmitter.emit(`${event.appName}-${eventName}`, event);
140
- } else {
141
- // standard event - no need to prefix
142
- _SharedEventEmitter.SharedEventEmitter.emit(eventName, event);
143
- }
144
- });
145
- NATIVE_MODULE_EVENT_SUBSCRIPTIONS[eventName] = true;
146
- }
147
- }
148
-
149
- /**
150
- * Help text for integrating the native counter parts for each module.
151
- *
152
- * @param namespace
153
- * @returns {string}
154
- */
155
- function getMissingModuleHelpText(namespace) {
156
- const snippet = `${namespace}()`;
157
- const nativeModule = namespace.charAt(0).toUpperCase() + namespace.slice(1);
158
- if (_reactNative.Platform.OS === 'ios') {
159
- return `You attempted to use a module that's not installed natively on your iOS project by calling ${snippet}.` + '\r\n\r\nEnsure you have either linked the module or added it to your projects Podfile.' + '\r\n\r\nSee http://invertase.link/ios for full setup instructions.';
160
- }
161
- const rnPackage = `'io.invertase.${namespace}.ReactNative${nativeModule}Package'`;
162
- const newInstance = `'new ReactNative${nativeModule}Package()'`;
163
- return `You attempted to use a module that's not installed on your Android project by calling ${snippet}.` + `\r\n\r\nEnsure you have:\r\n\r\n1) imported the ${rnPackage} module in your 'MainApplication.java' file.\r\n\r\n2) Added the ` + `${newInstance} line inside of the RN 'getPackages()' method list.` + '\r\n\r\nSee http://invertase.link/android for full setup instructions.';
164
- }
165
-
166
- /**
167
- * Gets a wrapped native module instance for the provided module.
168
- * Will attempt to create a new instance if non previously created.
169
- *
170
- * @param module
171
- * @returns {*}
172
- */
173
- function getNativeModule(module) {
174
- const key = nativeModuleKey(module);
175
- if (NATIVE_MODULE_REGISTRY[key]) {
176
- return NATIVE_MODULE_REGISTRY[key];
177
- }
178
- return initialiseNativeModule(module);
179
- }
180
- //# sourceMappingURL=nativeModule.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["NATIVE_MODULE_REGISTRY","NATIVE_MODULE_EVENT_SUBSCRIPTIONS","nativeModuleKey","module","_customUrlOrRegion","app","name","_config","namespace","nativeModuleMethodWrapped","method","argToPrepend","args","possiblePromise","then","jsStack","Error","stack","catch","nativeError","Promise","reject","NativeError","nativeModuleWrapped","NativeModule","native","properties","Object","keys","i","len","length","property","isFunction","initialiseNativeModule","config","key","nativeEvents","nativeModuleName","multiModuleRoot","multiModule","Array","isArray","nativeModuleNames","nativeModule","NativeModules","getMissingModuleHelpText","assign","subscribeToNativeModuleEvent","freeze","eventName","GoogleMobileAdsNativeEventEmitter","addListener","event","appName","SharedEventEmitter","emit","snippet","charAt","toUpperCase","slice","Platform","OS","rnPackage","newInstance","getNativeModule"],"sourceRoot":"../../src","sources":["nativeModule.ts"],"mappings":";;;;;;AAiBA;AACA;AACA;AACA;AACA;AArBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,MAAMA,sBAA+C,GAAG,CAAC,CAAC;AAC1D,MAAMC,iCAA0D,GAAG,CAAC,CAAC;AAErE,SAASC,eAAe,CAACC,MAAuB,EAAE;EAChD,OAAQ,GAAEA,MAAM,CAACC,kBAAkB,IAAI,EAAG,IAAGD,MAAM,CAACE,GAAG,CAACC,IAAK,IAAGH,MAAM,CAACI,OAAO,CAACC,SAAU,EAAC;AAC5F;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,yBAAyB,CAChCD,SAAiB,EACjBE,MAAuD,EACvDC,YAAgB,EAChB;EACA,OAAO,YAAiB;IAAA,kCAAbC,IAAI;MAAJA,IAAI;IAAA;IACb,MAAMC,eAAe,GAAGH,MAAM,CAAC,GAAG,CAAC,GAAGC,YAAY,EAAE,GAAGC,IAAI,CAAC,CAAC;;IAE7D;IACA;IACA,IAAIC,eAAe,IAA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GAAG,CAAC;EACpC;EAEA,OAAOF,sBAAsB,CAAC/B,MAAM,CAAC;AACvC"}
@@ -1,6 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- //# sourceMappingURL=GoogleMobileAdsNativeModule.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../src","sources":["GoogleMobileAdsNativeModule.ts"],"mappings":""}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=Module.interface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../src","sources":["Module.interface.ts"],"mappings":""}
@@ -1,54 +0,0 @@
1
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
- /*
3
- * Copyright (c) 2016-present Invertase Limited & Contributors
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this library except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- *
17
- */
18
-
19
- import { getNativeModule } from './registry/nativeModule';
20
- import { SharedEventEmitter } from './SharedEventEmitter';
21
- export class AppModule {
22
- constructor(app, config) {
23
- _defineProperty(this, "_app", void 0);
24
- _defineProperty(this, "_nativeModule", void 0);
25
- _defineProperty(this, "_config", void 0);
26
- this._app = app;
27
- this._nativeModule = null;
28
- this._config = Object.assign({}, config);
29
- }
30
- get app() {
31
- return this._app;
32
- }
33
- get emitter() {
34
- return SharedEventEmitter;
35
- }
36
- eventNameForApp() {
37
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
38
- args[_key] = arguments[_key];
39
- }
40
- return `${this.app.name}-${args.join('-')}`;
41
- }
42
- get native() {
43
- if (this._nativeModule) {
44
- return this._nativeModule;
45
- }
46
- this._nativeModule = getNativeModule(this);
47
- return this._nativeModule;
48
- }
49
- }
50
-
51
- // Instance of checks don't work once compiled
52
- _defineProperty(AppModule, "__extended__", {});
53
- AppModule.__extended__ = {};
54
- //# sourceMappingURL=Module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["getNativeModule","SharedEventEmitter","AppModule","constructor","app","config","_app","_nativeModule","_config","Object","assign","emitter","eventNameForApp","args","name","join","native","__extended__"],"sourceRoot":"../../src","sources":["Module.ts"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,eAAe,QAAQ,yBAAyB;AACzD,SAASC,kBAAkB,QAAQ,sBAAsB;AAIzD,OAAO,MAAMC,SAAS,CAAC;EAOrBC,WAAW,CAACC,GAAQ,EAAEC,MAAc,EAAE;IAAA;IAAA;IAAA;IACpC,IAAI,CAACC,IAAI,GAAGF,GAAG;IACf,IAAI,CAACG,aAAa,GAAG,IAAI;IACzB,IAAI,CAACC,OAAO,GAAGC,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,EAAEL,MAAM,CAAC;EAC1C;EAEA,IAAID,GAAG,GAAG;IACR,OAAO,IAAI,CAACE,IAAI;EAClB;EAEA,IAAIK,OAAO,GAAG;IACZ,OAAOV,kBAAkB;EAC3B;EAEAW,eAAe,GAAoB;IAAA,kCAAhBC,IAAI;MAAJA,IAAI;IAAA;IACrB,OAAQ,GAAE,IAAI,CAACT,GAAG,CAACU,IAAK,IAAGD,IAAI,CAACE,IAAI,CAAC,GAAG,CAAE,EAAC;EAC7C;EAEA,IAAIC,MAAM,GAAG;IACX,IAAI,IAAI,CAACT,aAAa,EAAE;MACtB,OAAO,IAAI,CAACA,aAAa;IAC3B;IACA,IAAI,CAACA,aAAa,GAAGP,eAAe,CAAC,IAAI,CAAC;IAC1C,OAAO,IAAI,CAACO,aAAa;EAC3B;AACF;;AAEA;AAAA,gBAlCaL,SAAS,kBAKE,CAAC,CAAC;AA8B1BA,SAAS,CAACe,YAAY,GAAG,CAAC,CAAC"}
@@ -1,22 +0,0 @@
1
- /*
2
- * Copyright (c) 2016-present Invertase Limited & Contributors
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this library except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- *
16
- */
17
-
18
- export { AppModule as Module } from './Module';
19
- export { NativeError } from './NativeError';
20
- export * from './registry/nativeModule';
21
- export { SharedEventEmitter } from './SharedEventEmitter';
22
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["AppModule","Module","NativeError","SharedEventEmitter"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,SAAS,IAAIC,MAAM,QAAQ,UAAU;AAC9C,SAASC,WAAW,QAAQ,eAAe;AAC3C,cAAc,yBAAyB;AACvC,SAASC,kBAAkB,QAAQ,sBAAsB"}
@@ -1,174 +0,0 @@
1
- /*
2
- * Copyright (c) 2016-present Invertase Limited & Contributors
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this library except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- *
16
- */
17
-
18
- import { NativeModules, Platform } from 'react-native';
19
- import { NativeError } from '../NativeError';
20
- import { GoogleMobileAdsNativeEventEmitter } from '../GoogleMobileAdsNativeEventEmitter';
21
- import { SharedEventEmitter } from '../SharedEventEmitter';
22
- import { isFunction } from '../../common';
23
- const NATIVE_MODULE_REGISTRY = {};
24
- const NATIVE_MODULE_EVENT_SUBSCRIPTIONS = {};
25
- function nativeModuleKey(module) {
26
- return `${module._customUrlOrRegion || ''}:${module.app.name}:${module._config.namespace}`;
27
- }
28
-
29
- /**
30
- * Wraps a native module method to provide
31
- * auto prepended args and custom Error classes.
32
- *
33
- * @param namespace
34
- * @param method
35
- * @param argToPrepend
36
- * @returns {Function}
37
- */
38
- function nativeModuleMethodWrapped(namespace, method, argToPrepend) {
39
- return function () {
40
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
41
- args[_key] = arguments[_key];
42
- }
43
- const possiblePromise = method(...[...argToPrepend, ...args]);
44
-
45
- // @ts-ignore -- return type is Promise, so tsc infers we *know* it is a promise and .then always exists, but
46
- // but the typing is actually speculative, we do need to test it
47
- if (possiblePromise && possiblePromise.then) {
48
- const jsStack = new Error().stack || '';
49
- return possiblePromise.catch(nativeError => Promise.reject(new NativeError(nativeError, jsStack, namespace)));
50
- }
51
- return possiblePromise;
52
- };
53
- }
54
-
55
- /**
56
- * Prepends all arguments in prependArgs to all native method calls
57
- *
58
- * @param namespace
59
- * @param NativeModule
60
- * @param argToPrepend
61
- */
62
- function nativeModuleWrapped(namespace, NativeModule, argToPrepend) {
63
- const native = {};
64
- if (!NativeModule) {
65
- return NativeModule;
66
- }
67
- const properties = Object.keys(NativeModule);
68
- for (let i = 0, len = properties.length; i < len; i++) {
69
- const property = properties[i];
70
- if (isFunction(NativeModule[property])) {
71
- native[property] = nativeModuleMethodWrapped(namespace, NativeModule[property], argToPrepend);
72
- } else {
73
- native[property] = NativeModule[property];
74
- }
75
- }
76
- return native;
77
- }
78
-
79
- /**
80
- * Initialises and wraps all the native module methods.
81
- *
82
- * @param module
83
- * @returns {*}
84
- */
85
- function initialiseNativeModule(module) {
86
- const config = module._config;
87
- const key = nativeModuleKey(module);
88
- const {
89
- namespace,
90
- nativeEvents,
91
- nativeModuleName
92
- } = config;
93
- const multiModuleRoot = {};
94
- const multiModule = Array.isArray(nativeModuleName);
95
- const nativeModuleNames = multiModule ? nativeModuleName : [nativeModuleName];
96
- for (let i = 0; i < nativeModuleNames.length; i++) {
97
- const nativeModule = NativeModules[nativeModuleNames[i]];
98
-
99
- // only error if there's a single native module
100
- // as multi modules can mean some are optional
101
- if (!multiModule && !nativeModule) {
102
- throw new Error(getMissingModuleHelpText(namespace));
103
- }
104
- if (multiModule) {
105
- multiModuleRoot[nativeModuleNames[i]] = !!nativeModule;
106
- }
107
- Object.assign(multiModuleRoot, nativeModuleWrapped(namespace, nativeModule, []));
108
- }
109
- if (nativeEvents && nativeEvents.length) {
110
- for (let i = 0, len = nativeEvents.length; i < len; i++) {
111
- subscribeToNativeModuleEvent(nativeEvents[i]);
112
- }
113
- }
114
- Object.freeze(multiModuleRoot);
115
- NATIVE_MODULE_REGISTRY[key] = multiModuleRoot;
116
- return NATIVE_MODULE_REGISTRY[key];
117
- }
118
-
119
- /**
120
- * Subscribe to a native event for js side distribution by appName
121
- * React Native events are hard set at compile - cant do dynamic event names
122
- * so we use a single event send it to js and js then internally can prefix it
123
- * and distribute dynamically.
124
- *
125
- * @param eventName
126
- * @private
127
- */
128
- function subscribeToNativeModuleEvent(eventName) {
129
- if (!NATIVE_MODULE_EVENT_SUBSCRIPTIONS[eventName]) {
130
- GoogleMobileAdsNativeEventEmitter.addListener(eventName, event => {
131
- if (event.appName) {
132
- // native event has an appName property - auto prefix and internally emit
133
- SharedEventEmitter.emit(`${event.appName}-${eventName}`, event);
134
- } else {
135
- // standard event - no need to prefix
136
- SharedEventEmitter.emit(eventName, event);
137
- }
138
- });
139
- NATIVE_MODULE_EVENT_SUBSCRIPTIONS[eventName] = true;
140
- }
141
- }
142
-
143
- /**
144
- * Help text for integrating the native counter parts for each module.
145
- *
146
- * @param namespace
147
- * @returns {string}
148
- */
149
- function getMissingModuleHelpText(namespace) {
150
- const snippet = `${namespace}()`;
151
- const nativeModule = namespace.charAt(0).toUpperCase() + namespace.slice(1);
152
- if (Platform.OS === 'ios') {
153
- return `You attempted to use a module that's not installed natively on your iOS project by calling ${snippet}.` + '\r\n\r\nEnsure you have either linked the module or added it to your projects Podfile.' + '\r\n\r\nSee http://invertase.link/ios for full setup instructions.';
154
- }
155
- const rnPackage = `'io.invertase.${namespace}.ReactNative${nativeModule}Package'`;
156
- const newInstance = `'new ReactNative${nativeModule}Package()'`;
157
- return `You attempted to use a module that's not installed on your Android project by calling ${snippet}.` + `\r\n\r\nEnsure you have:\r\n\r\n1) imported the ${rnPackage} module in your 'MainApplication.java' file.\r\n\r\n2) Added the ` + `${newInstance} line inside of the RN 'getPackages()' method list.` + '\r\n\r\nSee http://invertase.link/android for full setup instructions.';
158
- }
159
-
160
- /**
161
- * Gets a wrapped native module instance for the provided module.
162
- * Will attempt to create a new instance if non previously created.
163
- *
164
- * @param module
165
- * @returns {*}
166
- */
167
- export function getNativeModule(module) {
168
- const key = nativeModuleKey(module);
169
- if (NATIVE_MODULE_REGISTRY[key]) {
170
- return NATIVE_MODULE_REGISTRY[key];
171
- }
172
- return initialiseNativeModule(module);
173
- }
174
- //# sourceMappingURL=nativeModule.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["NativeModules","Platform","NativeError","GoogleMobileAdsNativeEventEmitter","SharedEventEmitter","isFunction","NATIVE_MODULE_REGISTRY","NATIVE_MODULE_EVENT_SUBSCRIPTIONS","nativeModuleKey","module","_customUrlOrRegion","app","name","_config","namespace","nativeModuleMethodWrapped","method","argToPrepend","args","possiblePromise","then","jsStack","Error","stack","catch","nativeError","Promise","reject","nativeModuleWrapped","NativeModule","native","properties","Object","keys","i","len","length","property","initialiseNativeModule","config","key","nativeEvents","nativeModuleName","multiModuleRoot","multiModule","Array","isArray","nativeModuleNames","nativeModule","getMissingModuleHelpText","assign","subscribeToNativeModuleEvent","freeze","eventName","addListener","event","appName","emit","snippet","charAt","toUpperCase","slice","OS","rnPackage","newInstance","getNativeModule"],"sourceRoot":"../../src","sources":["nativeModule.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AACtD,SAASC,WAAW,QAAQ,gBAAgB;AAC5C,SAASC,iCAAiC,QAAQ,sCAAsC;AACxF,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,SAASC,UAAU,QAAQ,cAAc;AAGzC,MAAMC,sBAA+C,GAAG,CAAC,CAAC;AAC1D,MAAMC,iCAA0D,GAAG,CAAC,CAAC;AAErE,SAASC,eAAe,CAACC,MAAuB,EAAE;EAChD,OAAQ,GAAEA,MAAM,CAACC,kBAAkB,IAAI,EAAG,IAAGD,MAAM,CAACE,GAAG,CAACC,IAAK,IAAGH,MAAM,CAACI,OAAO,CAACC,SAAU,EAAC;AAC5F;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,yBAAyB,CAChCD,SAAiB,EACjBE,MAAuD,EACvDC,YAAgB,EAChB;EACA,OAAO,YAAiB;IAAA,kCAAbC,IAAI;MAAJA,IAAI;IAAA;IACb,MAAMC,eAAe,GAAGH,MAAM,CAAC,GAAG,CAAC,GAAGC,YAAY,EAAE,GAAGC,IAAI,CAAC,CAAC;;IAE7D;IACA;IACA,IAAIC,eAAe,IAAIA,eAAe,CAACC,IAAI,EAAE;MAC3C,MAAMC,OAAO,GAAG,IAAIC,KAAK,EAAE,CAACC,KAAK,IAAI,EAAE;MACvC,OAAOJ,eAAe,CAACK,KAAK,CAACC,WAAW,IAC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Module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../src","sources":["GoogleMobileAdsNativeModule.ts"],"mappings":""}
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=Module.interface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../src","sources":["Module.interface.ts"],"mappings":""}
@@ -1,14 +0,0 @@
1
- import { App, Config } from '../types/Module.interface';
2
- import { GoogleMobileAdsNativeModule } from '../types/GoogleMobileAdsNativeModule';
3
- export declare class AppModule {
4
- _app: App;
5
- _nativeModule: unknown;
6
- _config: Config;
7
- static __extended__: {};
8
- constructor(app: App, config: Config);
9
- get app(): App;
10
- get emitter(): import("react-native").EventEmitter;
11
- eventNameForApp(...args: string[]): string;
12
- get native(): GoogleMobileAdsNativeModule;
13
- }
14
- //# sourceMappingURL=Module.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Module.d.ts","sourceRoot":"","sources":["../../../src/internal/Module.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AAEnF,qBAAa,SAAS;IACpB,IAAI,EAAE,GAAG,CAAC;IACV,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAEhB,MAAM,CAAC,YAAY,KAAM;gBAEb,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM;IAMpC,IAAI,GAAG,QAEN;IAED,IAAI,OAAO,wCAEV;IAED,eAAe,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE;IAIjC,IAAI,MAAM,gCAMT;CACF"}
@@ -1,5 +0,0 @@
1
- export { AppModule as Module } from './Module';
2
- export { NativeError } from './NativeError';
3
- export * from './registry/nativeModule';
4
- export { SharedEventEmitter } from './SharedEventEmitter';
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/internal/index.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,SAAS,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -1,10 +0,0 @@
1
- import { ModuleInterface } from '../../types/Module.interface';
2
- /**
3
- * Gets a wrapped native module instance for the provided module.
4
- * Will attempt to create a new instance if non previously created.
5
- *
6
- * @param module
7
- * @returns {*}
8
- */
9
- export declare function getNativeModule(module: ModuleInterface): unknown;
10
- //# sourceMappingURL=nativeModule.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nativeModule.d.ts","sourceRoot":"","sources":["../../../../src/internal/registry/nativeModule.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAuK/D;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,WAQtD"}
@@ -1,22 +0,0 @@
1
- import { AdapterStatus } from './AdapterStatus';
2
- import { RequestConfiguration } from './RequestConfiguration';
3
- import { RequestOptions } from './RequestOptions';
4
- import { AdShowOptions } from './AdShowOptions';
5
- declare type AdLoadFunction = (requestId: number, adUnitId: string, requestOptions: RequestOptions) => void;
6
- declare type AdShowFunction = (requestId: number, adUnitId: string, showOptions?: AdShowOptions) => Promise<void>;
7
- export interface GoogleMobileAdsNativeModule {
8
- initialize(): Promise<AdapterStatus[]>;
9
- setRequestConfiguration(requestConfiguration?: RequestConfiguration): Promise<void>;
10
- openAdInspector(): Promise<void>;
11
- appOpenLoad: AdLoadFunction;
12
- appOpenShow: AdShowFunction;
13
- interstitialLoad: AdLoadFunction;
14
- interstitialShow: AdShowFunction;
15
- rewardedLoad: AdLoadFunction;
16
- rewardedShow: AdShowFunction;
17
- rewardedInterstitialLoad: AdLoadFunction;
18
- rewardedInterstitialShow: AdShowFunction;
19
- openDebugMenu(adUnit: string): void;
20
- }
21
- export {};
22
- //# sourceMappingURL=GoogleMobileAdsNativeModule.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GoogleMobileAdsNativeModule.d.ts","sourceRoot":"","sources":["../../../src/types/GoogleMobileAdsNativeModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,aAAK,cAAc,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,KAAK,IAAI,CAAC;AACpG,aAAK,cAAc,GAAG,CACpB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,aAAa,KACxB,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB,MAAM,WAAW,2BAA2B;IAC1C,UAAU,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IACvC,uBAAuB,CAAC,oBAAoB,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpF,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,WAAW,EAAE,cAAc,CAAC;IAC5B,WAAW,EAAE,cAAc,CAAC;IAC5B,gBAAgB,EAAE,cAAc,CAAC;IACjC,gBAAgB,EAAE,cAAc,CAAC;IACjC,YAAY,EAAE,cAAc,CAAC;IAC7B,YAAY,EAAE,cAAc,CAAC;IAC7B,wBAAwB,EAAE,cAAc,CAAC;IACzC,wBAAwB,EAAE,cAAc,CAAC;IACzC,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC"}
@@ -1,15 +0,0 @@
1
- export interface App {
2
- name: string;
3
- }
4
- export interface Config {
5
- version: string;
6
- namespace: string;
7
- nativeModuleName: string[];
8
- nativeEvents: string[];
9
- }
10
- export interface ModuleInterface {
11
- app: App;
12
- _config: Config;
13
- _customUrlOrRegion?: string;
14
- }
15
- //# sourceMappingURL=Module.interface.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Module.interface.d.ts","sourceRoot":"","sources":["../../../src/types/Module.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,MAAM;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,GAAG,CAAC;IACT,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B"}
@@ -1,58 +0,0 @@
1
- /*
2
- * Copyright (c) 2016-present Invertase Limited & Contributors
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this library except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- *
16
- */
17
-
18
- import { getNativeModule } from './registry/nativeModule';
19
- import { SharedEventEmitter } from './SharedEventEmitter';
20
- import { App, Config } from '../types/Module.interface';
21
- import { GoogleMobileAdsNativeModule } from '../types/GoogleMobileAdsNativeModule';
22
-
23
- export class AppModule {
24
- _app: App;
25
- _nativeModule: unknown;
26
- _config: Config;
27
-
28
- static __extended__ = {};
29
-
30
- constructor(app: App, config: Config) {
31
- this._app = app;
32
- this._nativeModule = null;
33
- this._config = Object.assign({}, config);
34
- }
35
-
36
- get app() {
37
- return this._app;
38
- }
39
-
40
- get emitter() {
41
- return SharedEventEmitter;
42
- }
43
-
44
- eventNameForApp(...args: string[]) {
45
- return `${this.app.name}-${args.join('-')}`;
46
- }
47
-
48
- get native() {
49
- if (this._nativeModule) {
50
- return this._nativeModule as GoogleMobileAdsNativeModule;
51
- }
52
- this._nativeModule = getNativeModule(this);
53
- return this._nativeModule as GoogleMobileAdsNativeModule;
54
- }
55
- }
56
-
57
- // Instance of checks don't work once compiled
58
- AppModule.__extended__ = {};