react-native-applovin-max 9.5.1 → 9.6.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.
@@ -53,7 +53,7 @@ android {
53
53
  minSdkVersion getExtOrIntegerDefault("minSdkVersion")
54
54
  targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
55
55
 
56
- buildConfigField("String", "VERSION_NAME", "\"9.5.1\"")
56
+ buildConfigField("String", "VERSION_NAME", "\"9.6.0\"")
57
57
  buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString())
58
58
  }
59
59
 
@@ -95,6 +95,6 @@ dependencies {
95
95
  //noinspection GradleDynamicVersion
96
96
  implementation "com.facebook.react:react-native:0.75.4"
97
97
 
98
- implementation "com.applovin:applovin-sdk:13.6.1"
98
+ implementation "com.applovin:applovin-sdk:13.6.3"
99
99
  }
100
100
 
@@ -235,9 +235,11 @@ public class AppLovinMAXAdView
235
235
  {
236
236
  super.requestLayout();
237
237
 
238
- if ( uiComponent != null )
238
+ // Capture locally to guard against destroy() nulling out uiComponent before the delay fires.
239
+ final AppLovinMAXAdViewUiComponent component = uiComponent;
240
+ if ( component != null )
239
241
  {
240
- postDelayed( () -> uiComponent.measureAndLayout( 0, 0, getWidth(), getHeight() ), 500 );
242
+ postDelayed( () -> component.measureAndLayout( 0, 0, getWidth(), getHeight() ), 500 );
241
243
  }
242
244
  }
243
245
 
@@ -250,6 +252,19 @@ public class AppLovinMAXAdView
250
252
  {
251
253
  uiComponent.setAutoRefreshEnabled( false );
252
254
  }
255
+
256
+ // Defer one frame: a tab switch detaches from the window but keeps the parent,
257
+ // while a real unmount removes the parent. Destroy only in the latter case.
258
+ post( () -> {
259
+ if ( getParent() == null )
260
+ {
261
+ destroy();
262
+ }
263
+ else if ( uiComponent != null )
264
+ {
265
+ uiComponent.setAutoRefreshEnabled( autoRefreshEnabled );
266
+ }
267
+ } );
253
268
  }
254
269
 
255
270
  @Override
@@ -369,6 +384,8 @@ public class AppLovinMAXAdView
369
384
  uiComponentInstances.remove( adViewId );
370
385
  uiComponent.destroy();
371
386
  }
387
+
388
+ uiComponent = null;
372
389
  }
373
390
  }
374
391
  }
@@ -79,7 +79,7 @@ public class AppLovinMAXModuleImpl
79
79
  {
80
80
  private static final String SDK_TAG = "AppLovinSdk";
81
81
  private static final String TAG = "AppLovinMAXModule";
82
- private static final String PLUGIN_VERSION = "9.5.1";
82
+ private static final String PLUGIN_VERSION = "9.6.0";
83
83
 
84
84
  private static final String USER_GEOGRAPHY_GDPR = "G";
85
85
  private static final String USER_GEOGRAPHY_OTHER = "O";
@@ -101,6 +101,7 @@ public class AppLovinMAXModuleImpl
101
101
 
102
102
  static
103
103
  {
104
+ ALCompatibleNativeSdkVersions.put( "9.6.0", "13.6.3" );
104
105
  ALCompatibleNativeSdkVersions.put( "9.5.1", "13.6.1" );
105
106
  ALCompatibleNativeSdkVersions.put( "9.5.0", "13.6.0" );
106
107
  ALCompatibleNativeSdkVersions.put( "9.4.2", "13.5.1" );
@@ -491,6 +491,21 @@ public class AppLovinMAXNativeAdView
491
491
  }
492
492
  }
493
493
 
494
+ @Override
495
+ protected void onDetachedFromWindow()
496
+ {
497
+ super.onDetachedFromWindow();
498
+
499
+ // Defer one frame: a tab switch detaches from the window but keeps the parent,
500
+ // while a real unmount removes the parent. Destroy only in the latter case.
501
+ post( () -> {
502
+ if ( getParent() == null )
503
+ {
504
+ destroy();
505
+ }
506
+ } );
507
+ }
508
+
494
509
  @Override
495
510
  public void onLayoutChange(View view, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom)
496
511
  {
@@ -73,7 +73,7 @@
73
73
  @implementation AppLovinMAX
74
74
  static NSString *const SDK_TAG = @"AppLovinSdk";
75
75
  static NSString *const TAG = @"AppLovinMAX";
76
- static NSString *const PLUGIN_VERSION = @"9.5.1";
76
+ static NSString *const PLUGIN_VERSION = @"9.6.0";
77
77
 
78
78
  static NSString *const USER_GEOGRAPHY_GDPR = @"G";
79
79
  static NSString *const USER_GEOGRAPHY_OTHER = @"O";
@@ -149,6 +149,7 @@ RCT_EXPORT_MODULE()
149
149
  [super initialize];
150
150
 
151
151
  ALCompatibleNativeSDKVersions = @{
152
+ @"9.6.0" : @"13.6.3",
152
153
  @"9.5.1" : @"13.6.1",
153
154
  @"9.5.0" : @"13.6.0",
154
155
  @"9.4.2" : @"13.5.1",
@@ -561,7 +561,7 @@ static NSMutableDictionary<NSNumber *, AppLovinMAXAdViewUIComponent *> *preloade
561
561
 
562
562
  if ( self.uiComponent )
563
563
  {
564
- self.uiComponent.autoRefreshEnabled = autoRefresh;
564
+ self.uiComponent.autoRefreshEnabled = self.window ? autoRefresh : NO;
565
565
  }
566
566
  }
567
567
 
@@ -639,9 +639,9 @@ static NSMutableDictionary<NSNumber *, AppLovinMAXAdViewUIComponent *> *preloade
639
639
  if ( ![self.uiComponent hasContainerView] )
640
640
  {
641
641
  [[AppLovinMAX shared] log: @"Mounting the preloaded AdView (%@) for Ad Unit ID %@", self.adViewId, self.adUnitId];
642
-
643
- self.uiComponent.autoRefreshEnabled = [self isAutoRefreshEnabled];
642
+
644
643
  [self.uiComponent attachAdView: self];
644
+ [self updateAutoRefreshForWindowVisibility];
645
645
  return;
646
646
  }
647
647
  }
@@ -676,10 +676,9 @@ static NSMutableDictionary<NSNumber *, AppLovinMAXAdViewUIComponent *> *preloade
676
676
  self.uiComponent.customData = self.customData;
677
677
  self.uiComponent.extraParameters = flattenedExtraParameters;
678
678
  self.uiComponent.localExtraParameters = flattenedLocalExtraParameters;
679
- self.uiComponent.autoRefreshEnabled = [self isAutoRefreshEnabled];
680
-
681
679
  [self.uiComponent attachAdView: self];
682
-
680
+ [self updateAutoRefreshForWindowVisibility];
681
+
683
682
  if ( [self isLoadOnMount] )
684
683
  {
685
684
  [self.uiComponent loadAd];
@@ -698,6 +697,51 @@ static NSMutableDictionary<NSNumber *, AppLovinMAXAdViewUIComponent *> *preloade
698
697
  [self.uiComponent loadAd];
699
698
  }
700
699
 
700
+ - (void)updateAutoRefreshForWindowVisibility
701
+ {
702
+ if ( !self.uiComponent ) return;
703
+
704
+ BOOL shouldRefresh = self.window ? [self isAutoRefreshEnabled] : NO;
705
+ self.uiComponent.autoRefreshEnabled = shouldRefresh;
706
+ }
707
+
708
+ - (void)didMoveToWindow
709
+ {
710
+ [super didMoveToWindow];
711
+ [self updateAutoRefreshForWindowVisibility];
712
+ }
713
+
714
+ - (void)didMoveToSuperview
715
+ {
716
+ [super didMoveToSuperview];
717
+
718
+ if ( self.superview != nil )
719
+ {
720
+ [self updateAutoRefreshForWindowVisibility];
721
+ return;
722
+ }
723
+
724
+ // Superview is nil — could be a real unmount or brief reparenting (e.g. react-native-screens).
725
+ // Defer one main queue turn to let reparenting settle before deciding to destroy.
726
+ // Use a strong reference: a weak capture could become nil before the block runs, causing
727
+ // destroyCurrentAdIfNeeded to never fire while uiComponentInstances still retains the ad.
728
+ AppLovinMAXAdView *viewRef = self;
729
+ dispatch_async(dispatch_get_main_queue(), ^{
730
+ if ( viewRef.superview != nil )
731
+ {
732
+ [viewRef updateAutoRefreshForWindowVisibility];
733
+ return;
734
+ }
735
+
736
+ [viewRef destroyCurrentAdIfNeeded];
737
+ });
738
+ }
739
+
740
+ - (void)dealloc
741
+ {
742
+ [self destroyCurrentAdIfNeeded];
743
+ }
744
+
701
745
  - (void)destroy
702
746
  {
703
747
  [self destroyCurrentAdIfNeeded];
@@ -602,6 +602,27 @@ using namespace facebook::react;
602
602
  }
603
603
  }
604
604
 
605
+ - (void)didMoveToSuperview
606
+ {
607
+ [super didMoveToSuperview];
608
+
609
+ if ( self.superview != nil ) return;
610
+
611
+ // Superview is nil — could be a real unmount or brief reparenting (e.g. react-native-screens).
612
+ // Defer one main queue turn to let reparenting settle before deciding to destroy.
613
+ AppLovinMAXNativeAdView *viewRef = self;
614
+ dispatch_async(dispatch_get_main_queue(), ^{
615
+ if ( viewRef.superview != nil ) return;
616
+
617
+ [viewRef destroyCurrentAdIfNeeded];
618
+ });
619
+ }
620
+
621
+ - (void)dealloc
622
+ {
623
+ [self destroyCurrentAdIfNeeded];
624
+ }
625
+
605
626
  #pragma mark - Public API
606
627
 
607
628
  - (void)destroyAd
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = exports.ConsentFlowUserGeography = exports.CMPErrorCode = exports.AppTrackingStatus = exports.AppLovinMAX = void 0;
7
7
  var _NativeAppLovinMAXModule = _interopRequireDefault(require("./specs/NativeAppLovinMAXModule"));
8
8
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- const VERSION = '9.5.1';
9
+ const VERSION = '9.6.0';
10
10
 
11
11
  /**
12
12
  * Represents the user's geography, used to determine which type of consent flow to display.
@@ -1,5 +1,5 @@
1
1
  import NativeAppLovinMAX from './specs/NativeAppLovinMAXModule';
2
- const VERSION = '9.5.1';
2
+ const VERSION = '9.6.0';
3
3
 
4
4
  /**
5
5
  * Represents the user's geography, used to determine which type of consent flow to display.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-applovin-max",
3
3
  "author": "AppLovin Corporation <support@applovin.com> (https://applovin.com)",
4
- "version": "9.5.1",
4
+ "version": "9.6.0",
5
5
  "description": "AppLovin MAX React Native Plugin for Android and iOS",
6
6
  "main": "lib/commonjs/index",
7
7
  "module": "lib/module/index",
@@ -11,11 +11,11 @@ Pod::Spec.new do |s|
11
11
  s.authors = package["author"]
12
12
 
13
13
  s.platforms = { :ios => min_ios_version_supported }
14
- s.source = { :git => "https://github.com/AppLovin/AppLovin-MAX-React-Native.git", :tag => "release_9_5_1" }
14
+ s.source = { :git => "https://github.com/AppLovin/AppLovin-MAX-React-Native.git", :tag => "release_9_6_0" }
15
15
 
16
16
  s.source_files = "ios/AppLovinMAX*.{h,mm}"
17
17
 
18
- s.dependency "AppLovinSDK", "13.6.1"
18
+ s.dependency "AppLovinSDK", "13.6.3"
19
19
 
20
20
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
21
21
  # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
@@ -2,7 +2,7 @@ import type { AppLovinMAXType } from './types/AppLovinMAX';
2
2
  import type { Configuration } from './types/Configuration';
3
3
  import NativeAppLovinMAX from './specs/NativeAppLovinMAXModule';
4
4
 
5
- const VERSION = '9.5.1';
5
+ const VERSION = '9.6.0';
6
6
 
7
7
  /**
8
8
  * Represents the user's geography, used to determine which type of consent flow to display.