react-native-applovin-max 4.0.0 → 4.1.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.
@@ -9,7 +9,7 @@
9
9
  #import "AppLovinMAX.h"
10
10
  #import "AppLovinMAXAdView.h"
11
11
 
12
- @interface AppLovinMAXAdView()
12
+ @interface AppLovinMAXAdView()<MAAdViewAdDelegate>
13
13
 
14
14
  @property (nonatomic, strong, nullable) MAAdView *adView; // nil when unmounted
15
15
 
@@ -145,7 +145,7 @@
145
145
  adFormat: adFormat
146
146
  sdk: [AppLovinMAX shared].sdk];
147
147
  self.adView.frame = (CGRect) { CGPointZero, self.frame.size };
148
- self.adView.delegate = [AppLovinMAX shared]; // Go through core class for callback forwarding to React Native layer
148
+ self.adView.delegate = self;
149
149
  self.adView.revenueDelegate = [AppLovinMAX shared];
150
150
  self.adView.placement = self.placement;
151
151
  self.adView.customData = self.customData;
@@ -178,7 +178,7 @@
178
178
  [super didMoveToWindow];
179
179
 
180
180
  // This view is unmounted
181
- if ( !self.window )
181
+ if ( !self.window && !self.superview )
182
182
  {
183
183
  if ( self.adView )
184
184
  {
@@ -194,4 +194,45 @@
194
194
  }
195
195
  }
196
196
 
197
+ #pragma mark - MAAdDelegate Protocol
198
+
199
+ - (void)didLoadAd:(MAAd *)ad
200
+ {
201
+ [[AppLovinMAX shared] didLoadAd: ad];
202
+ }
203
+
204
+ - (void)didFailToLoadAdForAdUnitIdentifier:(NSString *)adUnitIdentifier withError:(MAError *)error
205
+ {
206
+ NSString *name = ( MAAdFormat.mrec == self.adFormat ) ? @"OnMRecAdLoadFailedEvent" : @"OnBannerAdLoadFailedEvent";
207
+
208
+ [[AppLovinMAX shared] sendReactNativeEventForAdLoadFailed: name forAdUnitIdentifier: adUnitIdentifier withError: error];
209
+ }
210
+
211
+ - (void)didFailToDisplayAd:(MAAd *)ad withError:(MAError *)error
212
+ {
213
+ [[AppLovinMAX shared] didFailToDisplayAd: ad withError: error];
214
+ }
215
+
216
+ - (void)didClickAd:(MAAd *)ad
217
+ {
218
+ [[AppLovinMAX shared] didClickAd: ad];
219
+ }
220
+
221
+ #pragma mark - MAAdViewAdDelegate Protocol
222
+
223
+ - (void)didExpandAd:(MAAd *)ad
224
+ {
225
+ [[AppLovinMAX shared] didExpandAd: ad];
226
+ }
227
+
228
+ - (void)didCollapseAd:(MAAd *)ad
229
+ {
230
+ [[AppLovinMAX shared] didCollapseAd: ad];
231
+ }
232
+
233
+ #pragma mark - Deprecated Callbacks
234
+
235
+ - (void)didDisplayAd:(MAAd *)ad {}
236
+ - (void)didHideAd:(MAAd *)ad {}
237
+
197
238
  @end
@@ -120,6 +120,12 @@
120
120
  if ( !self.nativeAd.nativeAd.title ) return;
121
121
 
122
122
  UIView *view = [self.bridge.uiManager viewForReactTag: tag];
123
+ if ( !view )
124
+ {
125
+ [[AppLovinMAX shared] log: @"Cannot find a title view with tag \"%@\" for %@", tag, self.adUnitId];
126
+ return;
127
+ }
128
+
123
129
  [self.clickableViews addObject: view];
124
130
  }
125
131
 
@@ -128,6 +134,12 @@
128
134
  if ( !self.nativeAd.nativeAd.advertiser ) return;
129
135
 
130
136
  UIView *view = [self.bridge.uiManager viewForReactTag: tag];
137
+ if ( !view )
138
+ {
139
+ [[AppLovinMAX shared] log: @"Cannot find an advertiser view with tag \"%@\" for %@", tag, self.adUnitId];
140
+ return;
141
+ }
142
+
131
143
  [self.clickableViews addObject: view];
132
144
  }
133
145
 
@@ -136,6 +148,12 @@
136
148
  if ( !self.nativeAd.nativeAd.body ) return;
137
149
 
138
150
  UIView *view = [self.bridge.uiManager viewForReactTag: tag];
151
+ if ( !view )
152
+ {
153
+ [[AppLovinMAX shared] log: @"Cannot find a body view with tag \"%@\" for %@", tag, self.adUnitId];
154
+ return;
155
+ }
156
+
139
157
  [self.clickableViews addObject: view];
140
158
  }
141
159
 
@@ -144,6 +162,12 @@
144
162
  if ( !self.nativeAd.nativeAd.callToAction ) return;
145
163
 
146
164
  UIView *view = [self.bridge.uiManager viewForReactTag: tag];
165
+ if ( !view )
166
+ {
167
+ [[AppLovinMAX shared] log: @"Cannot find a callToAction view with tag \"%@\" for %@", tag, self.adUnitId];
168
+ return;
169
+ }
170
+
147
171
  [self.clickableViews addObject: view];
148
172
  }
149
173
 
@@ -152,6 +176,12 @@
152
176
  if ( !self.nativeAd.nativeAd.mediaView ) return;
153
177
 
154
178
  UIView *view = [self.bridge.uiManager viewForReactTag: tag];
179
+ if ( !view )
180
+ {
181
+ [[AppLovinMAX shared] log: @"Cannot find a media view with tag \"%@\" for %@", tag, self.adUnitId];
182
+ return;
183
+ }
184
+
155
185
  [self.clickableViews addObject: view];
156
186
 
157
187
  [view addSubview: self.nativeAd.nativeAd.mediaView];
@@ -163,6 +193,11 @@
163
193
  if ( !self.nativeAd.nativeAd.optionsView ) return;
164
194
 
165
195
  UIView *view = [self.bridge.uiManager viewForReactTag: tag];
196
+ if ( !view )
197
+ {
198
+ [[AppLovinMAX shared] log: @"Cannot find an option view with tag \"%@\" for %@", tag, self.adUnitId];
199
+ return;
200
+ }
166
201
 
167
202
  [view addSubview: self.nativeAd.nativeAd.optionsView];
168
203
  [self.nativeAd.nativeAd.optionsView al_pinToSuperview];
@@ -176,11 +211,11 @@
176
211
  [[AppLovinMAX shared] log: @"Cannot find an icon image view with tag \"%@\" for %@", tag, self.adUnitId];
177
212
  return;
178
213
  }
179
-
180
- [self.clickableViews addObject: view];
181
-
182
- MANativeAdImage *icon = self.nativeAd.nativeAd.icon;
183
-
214
+
215
+ [self.clickableViews addObject: view];
216
+
217
+ MANativeAdImage *icon = self.nativeAd.nativeAd.icon;
218
+
184
219
  // Check if "URL" was missing and therefore need to set the image data
185
220
  if ( !icon.URL && icon.image )
186
221
  {
@@ -201,7 +236,7 @@
201
236
  [self.isLoading set: NO];
202
237
 
203
238
  [[AppLovinMAX shared] log: @"Native ad is of template type, failing ad load..."];
204
- [[AppLovinMAX shared] handleNativeAdLoadFailureForAdUnitIdentifier: self.adUnitId error: nil];
239
+ [[AppLovinMAX shared] sendReactNativeEventForAdLoadFailed: @"OnNativeAdLoadFailedEvent" forAdUnitIdentifier: self.adUnitId withError: nil];
205
240
 
206
241
  return;
207
242
  }
@@ -273,7 +308,7 @@
273
308
  [[AppLovinMAX shared] log: @"Failed to load native ad for Ad Unit ID %@ with error: %@", self.adUnitId, error];
274
309
 
275
310
  // Notify publisher
276
- [[AppLovinMAX shared] handleNativeAdLoadFailureForAdUnitIdentifier: self.adUnitId error: error];
311
+ [[AppLovinMAX shared] sendReactNativeEventForAdLoadFailed: @"OnNativeAdLoadFailedEvent" forAdUnitIdentifier: self.adUnitId withError: error];
277
312
  }
278
313
 
279
314
  - (void)didClickNativeAd:(MAAd *)ad
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.5.3'
38
+ pod 'AppLovinSDK', '11.6.0'
39
39
 
40
40
  end
package/ios/Podfile.lock CHANGED
@@ -1,5 +1,5 @@
1
1
  PODS:
2
- - AppLovinSDK (11.5.3)
2
+ - AppLovinSDK (11.6.0)
3
3
  - boost-for-react-native (1.63.0)
4
4
  - DoubleConversion (1.1.6)
5
5
  - FBLazyVector (0.63.4)
@@ -249,7 +249,7 @@ PODS:
249
249
  - Yoga (1.14.0)
250
250
 
251
251
  DEPENDENCIES:
252
- - AppLovinSDK (= 11.5.3)
252
+ - AppLovinSDK (= 11.6.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: 6b10288343b15b31f7037ecd7aa630d6ea117585
342
+ AppLovinSDK: cdd2a1a6401e1f8076ca247bbd5f49e7f64e0a77
343
343
  boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
344
344
  DoubleConversion: cde416483dac037923206447da6e1454df403714
345
345
  FBLazyVector: 3bb422f41b18121b71783a905c10e58606f7dc3e
@@ -368,6 +368,6 @@ SPEC CHECKSUMS:
368
368
  ReactCommon: 73d79c7039f473b76db6ff7c6b159c478acbbb3b
369
369
  Yoga: 4bd86afe9883422a7c4028c00e34790f560923d6
370
370
 
371
- PODFILE CHECKSUM: 0c10edf9192bf11ff0acfafe564110bde14135a5
371
+ PODFILE CHECKSUM: 57a045cb94c23cb6c925c2da52cf258edc0128d1
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": "4.0.0",
4
+ "version": "4.1.1",
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",
@@ -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_4_0_0" }
14
+ s.source = { :git => "https://github.com/AppLovin/AppLovin-MAX-React-Native.git", :tag => "release_4_1_1" }
15
15
 
16
16
  s.source_files = "ios/AppLovinMAX*.{h,m}"
17
17
 
18
18
  s.dependency "React"
19
- s.dependency "AppLovinSDK", "11.5.3"
19
+ s.dependency "AppLovinSDK", "11.6.0"
20
20
  end
@@ -16,7 +16,7 @@ const UserGender = {
16
16
  Other: 'O'
17
17
  };
18
18
 
19
- let TargetingData = {
19
+ const TargetingData = {
20
20
 
21
21
  set yearOfBirth(value) {
22
22
  AppLovinMAX.setTargetingDataYearOfBirth(value);