react-native-applovin-max 6.0.1 → 6.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,8 +35,8 @@ android {
35
35
  defaultConfig {
36
36
  minSdkVersion 16
37
37
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
38
- versionCode 6000100
39
- versionName "6.0.1"
38
+ versionCode 6000200
39
+ versionName "6.0.2"
40
40
  }
41
41
 
42
42
  flavorDimensions("default")
@@ -140,5 +140,5 @@ dependencies {
140
140
  // noinspection GradleDynamicVersion
141
141
  api 'com.facebook.react:react-native:+'
142
142
 
143
- implementation 'com.applovin:applovin-sdk:11.11.3'
143
+ implementation 'com.applovin:applovin-sdk:12.0.0'
144
144
  }
package/ios/Podfile CHANGED
@@ -35,6 +35,6 @@ target 'AppLovinMAX' do
35
35
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
36
36
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
37
37
 
38
- pod 'AppLovinSDK', '11.11.4'
38
+ pod 'AppLovinSDK', '12.0.0'
39
39
 
40
40
  end
package/ios/Podfile.lock CHANGED
@@ -1,5 +1,5 @@
1
1
  PODS:
2
- - AppLovinSDK (11.11.4)
2
+ - AppLovinSDK (12.0.0)
3
3
  - boost-for-react-native (1.63.0)
4
4
  - DoubleConversion (1.1.6)
5
5
  - FBLazyVector (0.63.5)
@@ -249,7 +249,7 @@ PODS:
249
249
  - Yoga (1.14.0)
250
250
 
251
251
  DEPENDENCIES:
252
- - AppLovinSDK (= 11.11.4)
252
+ - AppLovinSDK (= 12.0.0)
253
253
  - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
254
254
  - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
255
255
  - FBReactNativeSpec (from `../node_modules/react-native/Libraries/FBReactNativeSpec`)
@@ -339,7 +339,7 @@ EXTERNAL SOURCES:
339
339
  :path: "../node_modules/react-native/ReactCommon/yoga"
340
340
 
341
341
  SPEC CHECKSUMS:
342
- AppLovinSDK: 5c667a790725d9529c01c3f3acf12ab195865fbb
342
+ AppLovinSDK: 15679e9f576a4d8662e1dc537c9a4ed47d3292a5
343
343
  boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
344
344
  DoubleConversion: cde416483dac037923206447da6e1454df403714
345
345
  FBLazyVector: 352a8ca9bbc8e2f097d680747a8c97ecef12d469
@@ -368,6 +368,6 @@ SPEC CHECKSUMS:
368
368
  ReactCommon: b9ff54b6dd22ba4a776eda22d7f83ec27544ca35
369
369
  Yoga: 0276e9f20976c8568e107cfc1163a8629051adc0
370
370
 
371
- PODFILE CHECKSUM: 76a08f1862fba288a559d37757b6d80d45c19d6e
371
+ PODFILE CHECKSUM: dc95f857ab3004d6fc04e845d974091e28859c7b
372
372
 
373
373
  COCOAPODS: 1.11.3
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-applovin-max",
3
3
  "author": "AppLovin Corporation",
4
- "version": "6.0.1",
4
+ "version": "6.0.2",
5
5
  "description": "AppLovin MAX React Native Plugin for Android and iOS",
6
6
  "homepage": "https://github.com/AppLovin/AppLovin-MAX-React-Native",
7
7
  "license": "MIT",
@@ -25,6 +25,10 @@
25
25
  "repository": "https://github.com/AppLovin/AppLovin-MAX-React-Native",
26
26
  "devDependencies": {
27
27
  "@types/react-native": "^0.63.1",
28
+ "@typescript-eslint/eslint-plugin": "^6.11.0",
29
+ "@typescript-eslint/parser": "^6.11.0",
30
+ "eslint": "^8.53.0",
31
+ "eslint-plugin-react": "^7.33.2",
28
32
  "react": "^16.13.1",
29
33
  "react-native": "^0.63.1"
30
34
  },
@@ -11,10 +11,10 @@ Pod::Spec.new do |s|
11
11
  s.authors = package["author"]
12
12
 
13
13
  s.platforms = { :ios => "10.0" }
14
- s.source = { :git => "https://github.com/AppLovin/AppLovin-MAX-React-Native.git", :tag => "release_6_0_1" }
14
+ s.source = { :git => "https://github.com/AppLovin/AppLovin-MAX-React-Native.git", :tag => "release_6_0_2" }
15
15
 
16
16
  s.source_files = "ios/AppLovinMAX*.{h,m}"
17
17
 
18
18
  s.dependency "React"
19
- s.dependency "AppLovinSDK", "11.11.4"
19
+ s.dependency "AppLovinSDK", "12.0.0"
20
20
  end
package/src/AdView.tsx CHANGED
@@ -1,9 +1,9 @@
1
- import React, { useEffect, useState } from "react";
2
- import { NativeModules, requireNativeComponent, StyleSheet } from "react-native";
3
- import type { ViewProps, ViewStyle, StyleProp } from "react-native";
4
- import type { AdDisplayFailedInfo, AdInfo, AdLoadFailedInfo, AdRevenueInfo } from "./types/AdInfo";
5
- import type { AdNativeEvent } from "./types/AdEvent";
6
- import type { AdViewProps } from "./types/AdViewProps";
1
+ import React, { useEffect, useState } from 'react';
2
+ import { NativeModules, requireNativeComponent, StyleSheet } from 'react-native';
3
+ import type { ViewProps, ViewStyle, StyleProp } from 'react-native';
4
+ import type { AdDisplayFailedInfo, AdInfo, AdLoadFailedInfo, AdRevenueInfo } from './types/AdInfo';
5
+ import type { AdNativeEvent } from './types/AdEvent';
6
+ import type { AdViewProps } from './types/AdViewProps';
7
7
 
8
8
  const { AppLovinMAX } = NativeModules;
9
9
 
@@ -26,7 +26,6 @@ const {
26
26
  * Defines a format of an ad.
27
27
  */
28
28
  export enum AdFormat {
29
-
30
29
  /**
31
30
  * Banner ad.
32
31
  */
@@ -54,16 +53,16 @@ export enum AdViewPosition {
54
53
  }
55
54
 
56
55
  type AdViewNativeEvents = {
57
- onAdLoadedEvent(event: AdNativeEvent<AdInfo>): void
58
- onAdLoadFailedEvent(event: AdNativeEvent<AdLoadFailedInfo>): void
59
- onAdDisplayFailedEvent(event: AdNativeEvent<AdDisplayFailedInfo>): void
60
- onAdClickedEvent(event: AdNativeEvent<AdInfo>): void
61
- onAdExpandedEvent(event: AdNativeEvent<AdInfo>): void
62
- onAdCollapsedEvent(event: AdNativeEvent<AdInfo>): void
63
- onAdRevenuePaidEvent(event: AdNativeEvent<AdRevenueInfo>): void
64
- }
56
+ onAdLoadedEvent(event: AdNativeEvent<AdInfo>): void;
57
+ onAdLoadFailedEvent(event: AdNativeEvent<AdLoadFailedInfo>): void;
58
+ onAdDisplayFailedEvent(event: AdNativeEvent<AdDisplayFailedInfo>): void;
59
+ onAdClickedEvent(event: AdNativeEvent<AdInfo>): void;
60
+ onAdExpandedEvent(event: AdNativeEvent<AdInfo>): void;
61
+ onAdCollapsedEvent(event: AdNativeEvent<AdInfo>): void;
62
+ onAdRevenuePaidEvent(event: AdNativeEvent<AdRevenueInfo>): void;
63
+ };
65
64
 
66
- const AdViewComponent = requireNativeComponent<AdViewProps & ViewProps & AdViewNativeEvents>("AppLovinMAXAdView");
65
+ const AdViewComponent = requireNativeComponent<AdViewProps & ViewProps & AdViewNativeEvents>('AppLovinMAXAdView');
67
66
 
68
67
  const ADVIEW_SIZE = {
69
68
  banner: { width: 320, height: 50 },
@@ -76,7 +75,12 @@ const getOutlineViewSize = (style: StyleProp<ViewStyle>) => {
76
75
  return [viewStyle?.width, viewStyle?.height];
77
76
  };
78
77
 
79
- const sizeAdViewDimensions = (adFormat: AdFormat, adaptiveBannerEnabled?: boolean, width?: number | string, height?: number | string): Promise<{}> => {
78
+ const sizeAdViewDimensions = (
79
+ adFormat: AdFormat,
80
+ adaptiveBannerEnabled?: boolean,
81
+ width?: number | string,
82
+ height?: number | string
83
+ ): Promise<Record<string, number>> => {
80
84
  const sizeForBannerFormat = async () => {
81
85
  const isTablet = await AppLovinMAX.isTablet();
82
86
 
@@ -84,7 +88,7 @@ const sizeAdViewDimensions = (adFormat: AdFormat, adaptiveBannerEnabled?: boolea
84
88
 
85
89
  let minHeight;
86
90
  if (adaptiveBannerEnabled) {
87
- if (typeof width === "number" && width > minWidth) {
91
+ if (typeof width === 'number' && width > minWidth) {
88
92
  minHeight = await AppLovinMAX.getAdaptiveBannerHeightForWidth(width);
89
93
  } else {
90
94
  minHeight = await AppLovinMAX.getAdaptiveBannerHeightForWidth(minWidth);
@@ -94,36 +98,44 @@ const sizeAdViewDimensions = (adFormat: AdFormat, adaptiveBannerEnabled?: boolea
94
98
  }
95
99
 
96
100
  return Promise.resolve({
97
- ...width === "auto" ? {
98
- width: minWidth,
99
- } : {
100
- minWidth: minWidth,
101
- },
102
- ...height === "auto" ? {
103
- height: minHeight,
104
- } : {
105
- minHeight: minHeight,
106
- }
101
+ ...(width === 'auto'
102
+ ? {
103
+ width: minWidth,
104
+ }
105
+ : {
106
+ minWidth: minWidth,
107
+ }),
108
+ ...(height === 'auto'
109
+ ? {
110
+ height: minHeight,
111
+ }
112
+ : {
113
+ minHeight: minHeight,
114
+ }),
107
115
  });
108
- }
116
+ };
109
117
 
110
118
  if (adFormat === AdFormat.BANNER) {
111
119
  return sizeForBannerFormat();
112
120
  } else {
113
121
  return Promise.resolve({
114
- ...width === "auto" ? {
115
- width: ADVIEW_SIZE.mrec.width,
116
- } : {
117
- minWidth: ADVIEW_SIZE.mrec.width,
118
- },
119
- ...height === "auto" ? {
120
- height: ADVIEW_SIZE.mrec.height,
121
- } : {
122
- minHeight: ADVIEW_SIZE.mrec.height,
123
- }
122
+ ...(width === 'auto'
123
+ ? {
124
+ width: ADVIEW_SIZE.mrec.width,
125
+ }
126
+ : {
127
+ minWidth: ADVIEW_SIZE.mrec.width,
128
+ }),
129
+ ...(height === 'auto'
130
+ ? {
131
+ height: ADVIEW_SIZE.mrec.height,
132
+ }
133
+ : {
134
+ minHeight: ADVIEW_SIZE.mrec.height,
135
+ }),
124
136
  });
125
137
  }
126
- }
138
+ };
127
139
 
128
140
  /**
129
141
  * The {@link AdView} component that you use building a banner or an MREC. Phones
@@ -174,7 +186,7 @@ export const AdView = ({
174
186
  AppLovinMAX.isInitialized().then((result: boolean) => {
175
187
  setIsInitialized(result);
176
188
  if (!result) {
177
- console.warn("ERROR: AdView is mounted before the initialization of the AppLovin MAX React Native module");
189
+ console.warn('AdView is mounted before the initialization of the AppLovin MAX React Native module');
178
190
  }
179
191
  });
180
192
  }, []);
@@ -182,7 +194,7 @@ export const AdView = ({
182
194
  useEffect(() => {
183
195
  if (!isInitialized) return;
184
196
  const [width, height] = getOutlineViewSize(style);
185
- sizeAdViewDimensions(adFormat, adaptiveBannerEnabled, width, height).then((value: {}) => {
197
+ sizeAdViewDimensions(adFormat, adaptiveBannerEnabled, width, height).then((value: Record<string, number>) => {
186
198
  setDimensions(value);
187
199
  });
188
200
  }, [isInitialized]);
@@ -219,7 +231,7 @@ export const AdView = ({
219
231
  if (!isInitialized) {
220
232
  return null;
221
233
  } else {
222
- const isDimensionsSet = (Object.keys(dimensions).length > 0);
234
+ const isDimensionsSet = Object.keys(dimensions).length > 0;
223
235
 
224
236
  // Not sized yet
225
237
  if (!isDimensionsSet) {
@@ -1,24 +1,22 @@
1
- import { NativeModules } from "react-native";
2
- import type { AppLovinMAXType } from "./types/AppLovinMAX";
3
- import type { Configuration } from "./types/Configuration";
1
+ import { NativeModules } from 'react-native';
2
+ import type { AppLovinMAXType } from './types/AppLovinMAX';
3
+ import type { Configuration } from './types/Configuration';
4
4
 
5
5
  const NativeAppLovinMAX = NativeModules.AppLovinMAX;
6
6
 
7
- const VERSION = "6.0.1";
7
+ const VERSION = '6.0.2';
8
8
 
9
- const initialize = async (
10
- sdkKey: string
11
- ): Promise<Configuration> => {
9
+ const initialize = async (sdkKey: string): Promise<Configuration> => {
12
10
  return NativeAppLovinMAX.initialize(VERSION, sdkKey);
13
- }
11
+ };
14
12
 
15
- type NativeAppLovinMAXType = Omit<AppLovinMAXType, | 'initialize'>;
13
+ type NativeAppLovinMAXType = Omit<AppLovinMAXType, 'initialize'>;
16
14
 
17
15
  const nativeMethods: NativeAppLovinMAXType = NativeAppLovinMAX;
18
16
 
19
17
  export const AppLovinMAX: AppLovinMAXType = {
20
18
  ...nativeMethods,
21
19
  initialize,
22
- }
20
+ };
23
21
 
24
22
  export default AppLovinMAX;
package/src/AppOpenAd.ts CHANGED
@@ -1,7 +1,8 @@
1
- import { NativeModules } from "react-native";
2
- import { addEventListener, removeEventListener } from "./EventEmitter"
3
- import type { AdDisplayFailedInfo, AdInfo, AdLoadFailedInfo, AdRevenueInfo } from "./types/AdInfo";
4
- import type { AppOpenAdType } from "./types/AppOpenAd";
1
+ import { NativeModules } from 'react-native';
2
+ import { addEventListener, removeEventListener } from './EventEmitter';
3
+ import type { AdDisplayFailedInfo, AdInfo, AdLoadFailedInfo, AdRevenueInfo } from './types/AdInfo';
4
+ import type { LocalExtraParameterValue } from './types/AdProps';
5
+ import type { AppOpenAdType } from './types/AppOpenAd';
5
6
 
6
7
  const { AppLovinMAX } = NativeModules;
7
8
 
@@ -17,83 +18,79 @@ const {
17
18
 
18
19
  const isAdReady = (adUnitId: string): Promise<boolean> => {
19
20
  return AppLovinMAX.isAppOpenAdReady(adUnitId);
20
- }
21
+ };
21
22
 
22
23
  const loadAd = (adUnitId: string): void => {
23
24
  AppLovinMAX.loadAppOpenAd(adUnitId);
24
- }
25
+ };
25
26
 
26
- const showAd = (
27
- adUnitId: string,
28
- placement?: string | null,
29
- customData?: string | null
30
- ): void => {
27
+ const showAd = (adUnitId: string, placement?: string | null, customData?: string | null): void => {
31
28
  AppLovinMAX.showAppOpenAd(adUnitId, placement ?? undefined, customData ?? undefined);
32
- }
29
+ };
33
30
 
34
- const setExtraParameter = (adUnitId: string, key: string, value: any): void => {
31
+ const setExtraParameter = (adUnitId: string, key: string, value: string | null): void => {
35
32
  AppLovinMAX.setAppOpenAdExtraParameter(adUnitId, key, value);
36
- }
33
+ };
37
34
 
38
- const setLocalExtraParameter = (adUnitId: string, key: string, value: any): void => {
35
+ const setLocalExtraParameter = (adUnitId: string, key: string, value: LocalExtraParameterValue): void => {
39
36
  AppLovinMAX.setAppOpenAdLocalExtraParameter(adUnitId, { [key]: value });
40
- }
37
+ };
41
38
 
42
39
  const addAdLoadedEventListener = (listener: (adInfo: AdInfo) => void) => {
43
40
  addEventListener(ON_APPOPEN_AD_LOADED_EVENT, (adInfo: AdInfo) => listener(adInfo));
44
- }
41
+ };
45
42
 
46
43
  const removeAdLoadedEventListener = () => {
47
44
  removeEventListener(ON_APPOPEN_AD_LOADED_EVENT);
48
- }
45
+ };
49
46
 
50
47
  const addAdLoadFailedEventListener = (listener: (errorInfo: AdLoadFailedInfo) => void) => {
51
48
  addEventListener(ON_APPOPEN_AD_LOAD_FAILED_EVENT, (errorInfo: AdLoadFailedInfo) => listener(errorInfo));
52
- }
49
+ };
53
50
 
54
51
  const removeAdLoadFailedEventListener = () => {
55
52
  removeEventListener(ON_APPOPEN_AD_LOAD_FAILED_EVENT);
56
- }
53
+ };
57
54
 
58
55
  const addAdClickedEventListener = (listener: (adInfo: AdInfo) => void) => {
59
56
  addEventListener(ON_APPOPEN_AD_CLICKED_EVENT, (adInfo: AdInfo) => listener(adInfo));
60
- }
57
+ };
61
58
 
62
59
  const removeAdClickedEventListener = () => {
63
60
  removeEventListener(ON_APPOPEN_AD_CLICKED_EVENT);
64
- }
61
+ };
65
62
 
66
63
  const addAdDisplayedEventListener = (listener: (adInfo: AdInfo) => void) => {
67
64
  addEventListener(ON_APPOPEN_AD_DISPLAYED_EVENT, (adInfo: AdInfo) => listener(adInfo));
68
- }
65
+ };
69
66
 
70
67
  const removeAdDisplayedEventListener = () => {
71
68
  removeEventListener(ON_APPOPEN_AD_DISPLAYED_EVENT);
72
- }
69
+ };
73
70
 
74
71
  const addAdFailedToDisplayEventListener = (listener: (errorInfo: AdDisplayFailedInfo) => void) => {
75
72
  addEventListener(ON_APPOPEN_AD_FAILED_TO_DISPLAY_EVENT, (errorInfo: AdDisplayFailedInfo) => listener(errorInfo));
76
- }
73
+ };
77
74
 
78
75
  const removeAdFailedToDisplayEventListener = () => {
79
76
  removeEventListener(ON_APPOPEN_AD_FAILED_TO_DISPLAY_EVENT);
80
- }
77
+ };
81
78
 
82
79
  const addAdHiddenEventListener = (listener: (adInfo: AdInfo) => void) => {
83
80
  addEventListener(ON_APPOPEN_AD_HIDDEN_EVENT, (adInfo: AdInfo) => listener(adInfo));
84
- }
81
+ };
85
82
 
86
83
  const removeAdHiddenEventListener = () => {
87
84
  removeEventListener(ON_APPOPEN_AD_HIDDEN_EVENT);
88
- }
85
+ };
89
86
 
90
87
  const addAdRevenuePaidListener = (listener: (adInfo: AdRevenueInfo) => void) => {
91
88
  addEventListener(ON_APPOPEN_AD_REVENUE_PAID, (adInfo: AdRevenueInfo) => listener(adInfo));
92
- }
89
+ };
93
90
 
94
91
  const removeAdRevenuePaidListener = () => {
95
92
  removeEventListener(ON_APPOPEN_AD_REVENUE_PAID);
96
- }
93
+ };
97
94
 
98
95
  export const AppOpenAd: AppOpenAdType = {
99
96
  isAdReady,
@@ -123,6 +120,6 @@ export const AppOpenAd: AppOpenAdType = {
123
120
 
124
121
  addAdRevenuePaidListener,
125
122
  removeAdRevenuePaidListener,
126
- }
123
+ };
127
124
 
128
125
  export default AppOpenAd;
package/src/BannerAd.ts CHANGED
@@ -1,8 +1,9 @@
1
- import { NativeModules } from "react-native";
2
- import { addEventListener, removeEventListener } from "./EventEmitter"
3
- import type { AdInfo, AdLoadFailedInfo, AdRevenueInfo } from "./types/AdInfo";
4
- import type { BannerAdType } from "./types/BannerAd";
5
- import type { AdViewPosition } from "./AdView";
1
+ import { NativeModules } from 'react-native';
2
+ import { addEventListener, removeEventListener } from './EventEmitter';
3
+ import type { AdInfo, AdLoadFailedInfo, AdRevenueInfo } from './types/AdInfo';
4
+ import type { LocalExtraParameterValue } from './types/AdProps';
5
+ import type { BannerAdType } from './types/BannerAd';
6
+ import type { AdViewPosition } from './AdView';
6
7
 
7
8
  const { AppLovinMAX } = NativeModules;
8
9
 
@@ -17,113 +18,113 @@ const {
17
18
 
18
19
  const createAd = (adUnitId: string, position: AdViewPosition, xOffset?: number, yOffset?: number): void => {
19
20
  AppLovinMAX.createBannerWithOffsets(adUnitId, position, xOffset ?? 0, yOffset ?? 0);
20
- }
21
+ };
21
22
 
22
23
  const destroyAd = (adUnitId: string): void => {
23
24
  AppLovinMAX.destroyBanner(adUnitId);
24
- }
25
+ };
25
26
 
26
27
  const showAd = (adUnitId: string): void => {
27
28
  AppLovinMAX.showBanner(adUnitId);
28
- }
29
+ };
29
30
 
30
31
  const hideAd = (adUnitId: string): void => {
31
32
  AppLovinMAX.hideBanner(adUnitId);
32
- }
33
+ };
33
34
 
34
35
  const setPlacement = (adUnitId: string, placement: string | null): void => {
35
36
  AppLovinMAX.setBannerPlacement(adUnitId, placement);
36
- }
37
+ };
37
38
 
38
39
  const setCustomData = (adUnitId: string, customData: string | null): void => {
39
40
  AppLovinMAX.setBannerCustomData(adUnitId, customData);
40
- }
41
+ };
41
42
 
42
43
  const updatePosition = (adUnitId: string, bannerPosition: AdViewPosition): void => {
43
44
  AppLovinMAX.updateBannerPosition(adUnitId, bannerPosition);
44
- }
45
+ };
45
46
 
46
- const setExtraParameter = (adUnitId: string, key: string, value: any): void => {
47
+ const setExtraParameter = (adUnitId: string, key: string, value: string | null): void => {
47
48
  AppLovinMAX.setBannerExtraParameter(adUnitId, key, value);
48
- }
49
+ };
49
50
 
50
- const setLocalExtraParameter = (adUnitId: string, key: string, value: any): void => {
51
+ const setLocalExtraParameter = (adUnitId: string, key: string, value: LocalExtraParameterValue): void => {
51
52
  AppLovinMAX.setBannerLocalExtraParameter(adUnitId, { [key]: value });
52
- }
53
+ };
53
54
 
54
55
  const startAutoRefresh = (adUnitId: string): void => {
55
56
  AppLovinMAX.startBannerAutoRefresh(adUnitId);
56
- }
57
+ };
57
58
 
58
59
  const stopAutoRefresh = (adUnitId: string): void => {
59
60
  AppLovinMAX.stopBannerAutoRefresh(adUnitId);
60
- }
61
+ };
61
62
 
62
63
  const addAdLoadedEventListener = (listener: (adInfo: AdInfo) => void) => {
63
64
  addEventListener(ON_BANNER_AD_LOADED_EVENT, (adInfo: AdInfo) => listener(adInfo));
64
- }
65
+ };
65
66
 
66
67
  const removeAdLoadedEventListener = () => {
67
68
  removeEventListener(ON_BANNER_AD_LOADED_EVENT);
68
- }
69
+ };
69
70
 
70
71
  const addAdLoadFailedEventListener = (listener: (errorInfo: AdLoadFailedInfo) => void) => {
71
72
  addEventListener(ON_BANNER_AD_LOAD_FAILED_EVENT, (errorInfo: AdLoadFailedInfo) => listener(errorInfo));
72
- }
73
+ };
73
74
 
74
75
  const removeAdLoadFailedEventListener = () => {
75
76
  removeEventListener(ON_BANNER_AD_LOAD_FAILED_EVENT);
76
- }
77
+ };
77
78
 
78
79
  const addAdClickedEventListener = (listener: (adInfo: AdInfo) => void) => {
79
80
  addEventListener(ON_BANNER_AD_CLICKED_EVENT, (adInfo: AdInfo) => listener(adInfo));
80
- }
81
+ };
81
82
 
82
83
  const removeAdClickedEventListener = () => {
83
84
  removeEventListener(ON_BANNER_AD_CLICKED_EVENT);
84
- }
85
+ };
85
86
 
86
87
  const addAdCollapsedEventListener = (listener: (adInfo: AdInfo) => void) => {
87
88
  addEventListener(ON_BANNER_AD_COLLAPSED_EVENT, (adInfo: AdInfo) => listener(adInfo));
88
- }
89
+ };
89
90
 
90
91
  const removeAdCollapsedEventListener = () => {
91
92
  removeEventListener(ON_BANNER_AD_COLLAPSED_EVENT);
92
- }
93
+ };
93
94
 
94
95
  const addAdExpandedEventListener = (listener: (adInfo: AdInfo) => void) => {
95
96
  addEventListener(ON_BANNER_AD_EXPANDED_EVENT, (adInfo: AdInfo) => listener(adInfo));
96
- }
97
+ };
97
98
 
98
99
  const removeAdExpandedEventListener = () => {
99
100
  removeEventListener(ON_BANNER_AD_EXPANDED_EVENT);
100
- }
101
+ };
101
102
 
102
103
  const addAdRevenuePaidListener = (listener: (adInfo: AdRevenueInfo) => void) => {
103
104
  addEventListener(ON_BANNER_AD_REVENUE_PAID, (adInfo: AdRevenueInfo) => listener(adInfo));
104
- }
105
+ };
105
106
 
106
107
  const removeAdRevenuePaidListener = () => {
107
108
  removeEventListener(ON_BANNER_AD_REVENUE_PAID);
108
- }
109
+ };
109
110
 
110
111
  // Banner specific APIs
111
112
 
112
113
  const setBackgroundColor = (adUnitId: string, hexColorCode: string): void => {
113
114
  AppLovinMAX.setBannerBackgroundColor(adUnitId, hexColorCode);
114
- }
115
+ };
115
116
 
116
117
  const setWidth = (adUnitId: string, width: number): void => {
117
118
  AppLovinMAX.setBannerWidth(adUnitId, width);
118
- }
119
+ };
119
120
 
120
121
  const updateOffsets = (adUnitId: string, xOffset: number, yOffset: number): void => {
121
122
  AppLovinMAX.updateBannerOffsets(adUnitId, xOffset, yOffset);
122
- }
123
+ };
123
124
 
124
125
  const getAdaptiveHeightForWidth = (width: number): Promise<number> => {
125
126
  return AppLovinMAX.getAdaptiveBannerHeightForWidth(width);
126
- }
127
+ };
127
128
 
128
129
  export const BannerAd: BannerAdType = {
129
130
  createAd,
@@ -170,6 +171,6 @@ export const BannerAd: BannerAdType = {
170
171
  updateOffsets,
171
172
 
172
173
  getAdaptiveHeightForWidth,
173
- }
174
+ };
174
175
 
175
176
  export default BannerAd;
@@ -1,27 +1,27 @@
1
- import { NativeModules, NativeEventEmitter } from "react-native";
2
- import type { EventSubscription } from "react-native";
3
- import type { AdEventObject, AdEventListener } from "./types/AdEvent";
1
+ import { NativeModules, NativeEventEmitter } from 'react-native';
2
+ import type { EventSubscription } from 'react-native';
3
+ import type { AdEventObject, AdEventListener } from './types/AdEvent';
4
4
 
5
5
  const { AppLovinMAX } = NativeModules;
6
6
 
7
7
  // Note that this is a singleton in ES6 module
8
8
  const emitter = new NativeEventEmitter(AppLovinMAX);
9
9
 
10
- const subscriptions: Record<string, EventSubscription> = { };
10
+ const subscriptions: Record<string, EventSubscription> = {};
11
11
 
12
12
  export const addEventListener = <T extends AdEventObject>(event: string, handler: AdEventListener<T>) => {
13
- let subscription: EventSubscription = emitter.addListener(event, handler);
14
- let currentSubscription = subscriptions[event];
13
+ const subscription: EventSubscription = emitter.addListener(event, handler);
14
+ const currentSubscription = subscriptions[event];
15
15
  if (currentSubscription) {
16
16
  currentSubscription.remove();
17
17
  }
18
18
  subscriptions[event] = subscription;
19
- }
19
+ };
20
20
 
21
21
  export const removeEventListener = (event: string) => {
22
- let currentSubscription = subscriptions[event];
22
+ const currentSubscription = subscriptions[event];
23
23
  if (currentSubscription) {
24
24
  currentSubscription.remove();
25
25
  delete subscriptions[event];
26
26
  }
27
- }
27
+ };