Skip to content

Commit

Permalink
Line/2022.2.16.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins committed Oct 1, 2022
1 parent 9e8e0c2 commit e4d275f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 21 deletions.
4 changes: 4 additions & 0 deletions Line/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2022.2.16.2
* Remove checks to enable initializing and showing interstitial and rewarded ads using different `activity` instances.
* Update error code mapping for `NO_AD`.

## 2022.2.16.1
* Add comment stating that FiveAd's SDK requires that same `activity` instance used to initialize an interstitial or rewarded ad needs to be the SAME one used to show it.

Expand Down
2 changes: 1 addition & 1 deletion Line/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
private val versionMajor = 2022
private val versionMinor = 2
private val versionPatch = 16
private val versionAdapterPatch = 1
private val versionAdapterPatch = 2

val libraryVersionName by extra("${versionMajor}.${versionMinor}.${versionPatch}.${versionAdapterPatch}")
val libraryVersionCode by extra((versionMajor * 1000000) + (versionMinor * 10000) + (versionPatch * 100) + versionAdapterPatch)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ public class LineMediationAdapter
private FiveAdVideoReward rewardedAd;
private FiveAdCustomLayout adView;
private FiveAdNative nativeAd;
private WeakReference<Activity> activityRef;

public LineMediationAdapter(final AppLovinSdk sdk) { super( sdk ); }

Expand Down Expand Up @@ -154,7 +153,6 @@ public void loadInterstitialAd(final MaxAdapterResponseParameters parameters, fi
log( "Loading interstitial ad for slot id: " + slotId + "..." );

interstitialAd = new FiveAdInterstitial( activity, slotId );
activityRef = new WeakReference<>( activity );

InterstitialListener interstitialListener = new InterstitialListener( listener );
interstitialAd.setLoadListener( interstitialListener );
Expand All @@ -165,14 +163,6 @@ public void loadInterstitialAd(final MaxAdapterResponseParameters parameters, fi
@Override
public void showInterstitialAd(final MaxAdapterResponseParameters parameters, final Activity activity, final MaxInterstitialAdapterListener listener)
{
// NOTE: LINE's SDK requires the same Activity instance used to initialize an interstitial ad to be the SAME as the one used to show it
if ( activityRef.get() != activity )
{
log( "Display error: Activity instance used in interstitial ad initialization is different from activity instance being used to display ad." );
listener.onInterstitialAdDisplayFailed( new MaxAdapterError( -4205, "Ad Display Failed" ) );
return;
}

String slotId = parameters.getThirdPartyAdPlacementId();
log( "Showing interstitial ad for slot id: " + slotId + "..." );

Expand All @@ -186,7 +176,6 @@ public void loadRewardedAd(final MaxAdapterResponseParameters parameters, final
log( "Loading rewarded ad for slot id: " + slotId + "..." );

rewardedAd = new FiveAdVideoReward( activity, slotId );
activityRef = new WeakReference<>( activity );

RewardedListener rewardedListener = new RewardedListener( listener );
rewardedAd.setLoadListener( rewardedListener );
Expand All @@ -197,14 +186,6 @@ public void loadRewardedAd(final MaxAdapterResponseParameters parameters, final
@Override
public void showRewardedAd(final MaxAdapterResponseParameters parameters, final Activity activity, final MaxRewardedAdapterListener listener)
{
// NOTE: LINE's SDK requires the same Activity instance used to initialize a rewarded ad to be the SAME as the one used to show it
if ( activityRef.get() != activity )
{
log( "Display error: Activity instance used in rewarded ad initialization is different from activity instance being used to display ad." );
listener.onRewardedAdDisplayFailed( new MaxAdapterError( -4205, "Ad Display Failed" ) );
return;
}

String slotId = parameters.getThirdPartyAdPlacementId();
log( "Showing rewarded ad for slot id: " + slotId + "..." );

Expand Down Expand Up @@ -274,7 +255,7 @@ private static MaxAdapterError toMaxError(FiveAdErrorCode lineAdsError)
thirdPartySdkErrorMessage = "Please try again in a stable network environment.";
break;
case NO_AD:
adapterError = MaxAdapterError.AD_NOT_READY;
adapterError = MaxAdapterError.NO_FILL;
thirdPartySdkErrorMessage = "Ad was not ready at display time. Please try again.";
break;
case BAD_APP_ID:
Expand Down

0 comments on commit e4d275f

Please sign in to comment.