com.amanotes.gdk 0.2.50 → 0.2.52

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.
@@ -196,11 +196,11 @@ namespace Amanotes.Core
196
196
  // internal use
197
197
  internal static readonly AdsData localData = new AdsData().LoadJsonFromFile();
198
198
 
199
- internal protected static AdShowContext context;
200
- internal protected static AdAdapter _adapter;
201
- internal protected static float _savedVolume = -1;
202
- internal protected static float _savedTimeScale = -1;
203
-
199
+ protected internal static AdShowContext context;
200
+ protected internal static AdAdapter _adapter;
201
+ protected internal static float _savedVolume = -1;
202
+ protected internal static float _savedTimeScale = -1;
203
+
204
204
  public static void OnInter_Request(Action callback)
205
205
  {
206
206
  dispatcher.AddListener(Event.INTER_REQUEST, callback, false);
@@ -258,8 +258,8 @@ namespace Amanotes.Core
258
258
  }
259
259
  }
260
260
 
261
- public static bool HasInterstitial => _adapter.interstitial.hasAd;
262
- public static bool HasRewardedVideo => _adapter.rewardVideo.hasAd;
261
+ public static bool HasInterstitial => _adapter?.interstitial.hasAd ?? false;
262
+ public static bool HasRewardedVideo => _adapter?.rewardVideo.hasAd ?? false;
263
263
  public static bool IsBannerShowing => _isBannerShowing;
264
264
  public static bool IsAdShowing => context != null;
265
265
 
@@ -273,6 +273,7 @@ namespace Amanotes.Core
273
273
 
274
274
  public static IAdCallback ShowInterstitial(string placementName = null, Dictionary<string, object> userData = null)
275
275
  {
276
+ if (_adapter == null) return null;
276
277
  if (!ClearPrevContext()) return null;
277
278
 
278
279
  context = new AdShowContext(AdType.Interstitial, placementName, userData);
@@ -284,6 +285,7 @@ namespace Amanotes.Core
284
285
 
285
286
  public static IAdCallback ShowRewardedVideo(string placementName = null, Dictionary<string, object> userData = null)
286
287
  {
288
+ if (_adapter == null) return null;
287
289
  if (!ClearPrevContext()) return null;
288
290
 
289
291
  context = new AdShowContext(AdType.VideoReward, placementName, userData);
@@ -303,12 +305,8 @@ namespace Amanotes.Core
303
305
  _isBannerShowing = true;
304
306
  _showingBannerPosition = bannerPosition ?? Config.ad.bannerPosition;
305
307
 
306
- if (_adapter == null)
307
- {
308
- return;
309
- }
310
-
311
-
308
+ if (_adapter == null) return;
309
+
312
310
  dispatcher.Dispatch(Event.BANNER_SHOW);
313
311
  _adapter.ShowBanner(_showingBannerPosition);
314
312
  }
@@ -317,11 +315,13 @@ namespace Amanotes.Core
317
315
  {
318
316
  if (!_isBannerShowing) return;
319
317
  _isBannerShowing = false;
318
+ if (_adapter == null) return;
320
319
  _adapter.HideBanner();
321
320
  }
322
321
 
323
322
  public static void StopWaitForAd()
324
323
  {
324
+ if (_adapter == null) return;
325
325
  if (context == null)
326
326
  return;
327
327
 
@@ -357,6 +357,7 @@ namespace Amanotes.Core
357
357
 
358
358
  public static void SetUserId(string userId)
359
359
  {
360
+ if (_adapter == null) return;
360
361
  _adapter.SetUserId(userId);
361
362
  }
362
363
  }
@@ -397,14 +398,14 @@ namespace Amanotes.Core.Internal
397
398
  protected AdModuleConfig moduleConfig => Config.ad;
398
399
 
399
400
  // APIs
400
- internal protected abstract AdLogic interstitial { get; }
401
- internal protected abstract AdLogic rewardVideo { get; }
401
+ protected internal abstract AdLogic interstitial { get; }
402
+ protected internal abstract AdLogic rewardVideo { get; }
402
403
 
403
404
  public abstract void ShowBanner(BannerPosition bannerPosition);
404
405
  public abstract void HideBanner();
405
406
 
406
407
  // Internally used
407
- internal protected abstract void SetUserId(string userId);
408
+ protected internal abstract void SetUserId(string userId);
408
409
  }
409
410
 
410
411
  public interface IAdCallback { }
@@ -504,7 +505,6 @@ namespace Amanotes.Core.Internal
504
505
 
505
506
  public abstract class AdLogic
506
507
  {
507
- internal protected AdAdapter adapter => Ads._adapter;
508
508
  protected AdModuleConfig adConfig => Config.ad;
509
509
  protected AdShowContext context => Ads.context;
510
510