com.azerion.bluestack 3.0.3 → 3.1.0-preview2

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.
Files changed (78) hide show
  1. package/Editor/Android/AndroidBuildPostProcess.cs +0 -1
  2. package/Editor/Android/AndroidDependency.cs +1 -2
  3. package/Editor/Android/AndroidDependencyModifier.cs +55 -0
  4. package/Editor/Android/AndroidDependencyModifier.cs.meta +3 -0
  5. package/Editor/Android/AndroidDependencyParser.cs +26 -1
  6. package/Editor/Android/ManifestProcessor.cs +2 -1
  7. package/Editor/Azerion.BlueStack.Editor.asmdef +14 -14
  8. package/Editor/BlueStackDependencies.xml +1 -1
  9. package/Editor/BlueStackMediationDependencies.xml +11 -0
  10. package/Editor/BlueStackMediationDependencies.xml.meta +7 -0
  11. package/Editor/BlueStackSettings.cs +21 -18
  12. package/Editor/BlueStackSettingsEditor.cs +64 -1
  13. package/Editor/DebugHelper.cs +2 -2
  14. package/Editor/Dependency.cs +1 -1
  15. package/Editor/DependencyProvider.cs +213 -2
  16. package/Editor/IDependencyModifier.cs +12 -0
  17. package/Editor/IDependencyModifier.cs.meta +11 -0
  18. package/Editor/IDependencyParser.cs +1 -0
  19. package/Editor/MediationNetworkDependency.cs +34 -0
  20. package/Editor/MediationNetworkDependency.cs.meta +3 -0
  21. package/Editor/iOS/IOSDependency.cs +12 -0
  22. package/Editor/iOS/IOSDependency.cs.meta +11 -0
  23. package/Editor/iOS/IOSDependencyModifier.cs +105 -0
  24. package/Editor/iOS/IOSDependencyModifier.cs.meta +3 -0
  25. package/Editor/iOS/IOSDependencyParser.cs +32 -0
  26. package/Editor/iOS/PodDependency/PodDependencyUtils.cs +5 -1
  27. package/Example/Azerion.BlueStack.Example.asmdef +14 -14
  28. package/Example/Scripts/NativeAdManager.cs +5 -7
  29. package/Example/Scripts/SmallNativeAdManager.cs +4 -6
  30. package/README.md +4 -1
  31. package/Runtime/API/AdSize.cs +2 -2
  32. package/Runtime/API/Banner/BannerAd.cs +1 -1
  33. package/Runtime/API/BlueStackAds.cs +7 -3
  34. package/Runtime/API/InterstitialAd.cs +20 -5
  35. package/Runtime/API/NativeAd/NativeAd.cs +20 -26
  36. package/Runtime/API/NativeAd/NativeAdEventArgs.cs +1 -5
  37. package/Runtime/API/NativeAd/NativeAdInteractionHandler.cs +176 -173
  38. package/Runtime/API/NativeAd/NativeAdLoader.cs +10 -14
  39. package/Runtime/API/NativeAd/NativeAdObject.cs +563 -547
  40. package/Runtime/API/NativeAd/NativeAdType.cs +6 -6
  41. package/Runtime/API/NativeAd/NativeAssetInfo.cs +28 -28
  42. package/Runtime/Azerion.BlueStack.asmdef +14 -14
  43. package/Runtime/Common/NativeAd/AdLoaderClientArgs.cs +8 -8
  44. package/Runtime/Common/NativeAd/AdsEventExecutor.cs +69 -68
  45. package/Runtime/Common/NativeAd/DummyNativeClient.cs +52 -52
  46. package/Runtime/Common/NativeAd/NativeClientEventArgs.cs +5 -5
  47. package/Runtime/Common/NativeAd/NativeUtils.cs +111 -107
  48. package/Runtime/Internal/IBannerAdClient.cs +1 -1
  49. package/Runtime/Internal/IBlueStackClient.cs +2 -1
  50. package/Runtime/Internal/NativeAd/IAdLoaderClient.cs +12 -12
  51. package/Runtime/Internal/NativeAd/INativeAdClient.cs +1 -1
  52. package/Runtime/Internal/NativeAd/INativeClientFactory.cs +5 -5
  53. package/Runtime/Platforms/Android/BlueStackClient.cs +2 -1
  54. package/Runtime/Platforms/Android/BlueStackNativeClassNames.cs +2 -1
  55. package/Runtime/Platforms/Unity/AdvertisementManager.cs +5 -4
  56. package/Runtime/Platforms/Unity/BannerAdClient.cs +16 -9
  57. package/Runtime/Platforms/Unity/BaseAdClient.cs +7 -5
  58. package/Runtime/Platforms/Unity/BlueStackClient.cs +4 -3
  59. package/Runtime/Platforms/Unity/ClientsFactory.cs +0 -1
  60. package/Runtime/Platforms/Unity/InitializationStatusClient.cs +1 -0
  61. package/Runtime/Platforms/Unity/InterstitialAdClient.cs +12 -6
  62. package/Runtime/Platforms/Unity/NativeAdClient.cs +16 -10
  63. package/Runtime/Platforms/Unity/RewardedVideoAdClient.cs +9 -3
  64. package/Runtime/Platforms/Unity/Utils.cs +7 -3
  65. package/Runtime/Platforms/iOS/BannerAdClient.cs +33 -24
  66. package/Runtime/Platforms/iOS/BlueStackClient.cs +14 -10
  67. package/Runtime/Platforms/iOS/ClientsFactory.cs +0 -2
  68. package/Runtime/Platforms/iOS/Externs.cs +72 -65
  69. package/Runtime/Platforms/iOS/InitializationStatusClient.cs +6 -5
  70. package/Runtime/Platforms/iOS/InterstitialAdClient.cs +27 -21
  71. package/Runtime/Platforms/iOS/NativeAdClient.cs +27 -22
  72. package/Runtime/Platforms/iOS/PreferenceClient.cs +1 -1
  73. package/Runtime/Platforms/iOS/RewardedVideoAdClient.cs +27 -20
  74. package/Runtime/Platforms/iOS/Utils.cs +6 -3
  75. package/Runtime/Utilities/MiniJSON.cs +12 -12
  76. package/package.json +1 -1
  77. package/Editor/iOS/Dependency.cs +0 -0
  78. package/Editor/iOS/Dependency.cs.meta +0 -3
@@ -6,13 +6,15 @@ using Azerion.BlueStack.Internal;
6
6
 
7
7
  namespace Azerion.BlueStack.Platforms.iOS
8
8
  {
9
- public class BlueStackClient: IBlueStackClient
9
+ public class BlueStackClient : IBlueStackClient
10
10
  {
11
11
  public static BlueStackClient Instance { get; } = new BlueStackClient();
12
12
  private Action<SDKInitializationStatus> _sdkInitCompleteAction;
13
13
  private Action<IInitializationStatusClient> _adaptersInitCompleteAction;
14
14
  private IntPtr _iOSAdsClientPtr;
15
+
15
16
  internal delegate void BSUSDKInitializationCompleteCallback(IntPtr iOSAdsClient, bool success, IntPtr error);
17
+
16
18
  internal delegate void BSUInitializationCompleteCallback(IntPtr iOSAdsClient, IntPtr initStatusClient);
17
19
  //internal delegate void BSUAdaptersInitializationCompleteCallback(IntPtr iOSAdsClient, IntPtr initStatusClient);
18
20
 
@@ -20,15 +22,17 @@ namespace Azerion.BlueStack.Platforms.iOS
20
22
  {
21
23
  this._iOSAdsClientPtr = (IntPtr)GCHandle.Alloc(this);
22
24
  }
23
-
24
- public void Initialize(string appId, Settings settings, Action<SDKInitializationStatus> sdkInitCompleteAction, Action<IInitializationStatusClient> adaptersInitCompleteAction = null)
25
+
26
+ public void Initialize(string appId, Settings settings, Action<SDKInitializationStatus> sdkInitCompleteAction,
27
+ Action<IInitializationStatusClient> adaptersInitCompleteAction = null)
25
28
  {
26
29
  this._sdkInitCompleteAction = sdkInitCompleteAction;
27
30
  this._adaptersInitCompleteAction = adaptersInitCompleteAction;
28
31
  IntPtr settingsPtr = Utils.BuildSettings(settings);
29
- Externs.BSUInitializeWithCallback(this._iOSAdsClientPtr, appId, settingsPtr, SDKInitializationCompleteCallback, AdaptersInitializationCompleteCallback);
32
+ Externs.BSUInitializeWithCallback(this._iOSAdsClientPtr, appId, settingsPtr,
33
+ SDKInitializationCompleteCallback, AdaptersInitializationCompleteCallback);
30
34
  }
31
-
35
+
32
36
  [AOT.MonoPInvokeCallback(typeof(BSUSDKInitializationCompleteCallback))]
33
37
  private static void SDKInitializationCompleteCallback(IntPtr iOSAdsClient, bool success, IntPtr error)
34
38
  {
@@ -51,7 +55,7 @@ namespace Azerion.BlueStack.Platforms.iOS
51
55
  client._adaptersInitCompleteAction(statusClient);
52
56
  }
53
57
  }
54
-
58
+
55
59
  private static BlueStackClient IntPtrToAdsClient(IntPtr iOSAdsClientPtr)
56
60
  {
57
61
  GCHandle handle = (GCHandle)iOSAdsClientPtr;
@@ -62,11 +66,11 @@ namespace Azerion.BlueStack.Platforms.iOS
62
66
  {
63
67
  ((GCHandle)this._iOSAdsClientPtr).Free();
64
68
  }
65
-
66
- ~BlueStackClient() {
69
+
70
+ ~BlueStackClient()
71
+ {
67
72
  this.Dispose();
68
73
  }
69
74
  }
70
75
  }
71
- #endif
72
-
76
+ #endif
@@ -43,7 +43,6 @@ namespace Azerion.BlueStack.Platforms.iOS
43
43
 
44
44
  public IBannerAdClient CreatBannerAdClient()
45
45
  {
46
-
47
46
  if (Application.platform == RuntimePlatform.IPhonePlayer)
48
47
  {
49
48
  return new BannerAdClient();
@@ -55,7 +54,6 @@ namespace Azerion.BlueStack.Platforms.iOS
55
54
 
56
55
  public INativeAdClient CreateNativeAdClient()
57
56
  {
58
-
59
57
  if (Application.platform == RuntimePlatform.IPhonePlayer)
60
58
  {
61
59
  return new NativeAdClient();
@@ -6,34 +6,34 @@ namespace Azerion.BlueStack.Platforms.iOS
6
6
  {
7
7
  public class Externs
8
8
  {
9
- #region Common externs
9
+ #region Common externs
10
10
 
11
11
  [DllImport("__Internal")]
12
12
  internal static extern void BSURelease(IntPtr obj);
13
-
14
- #endregion
15
-
16
- #region Error
13
+
14
+ #endregion
15
+
16
+ #region Error
17
17
 
18
18
  [DllImport("__Internal")]
19
19
  internal static extern string BSUGetAdErrorDomain(IntPtr obj);
20
-
20
+
21
21
  [DllImport("__Internal")]
22
22
  internal static extern string BSUGetAdErrorMessage(IntPtr obj);
23
-
23
+
24
24
  [DllImport("__Internal")]
25
25
  internal static extern int BSUGetAdErrorCode(IntPtr obj);
26
-
27
- #endregion
28
-
29
- #region Initialization
26
+
27
+ #endregion
28
+
29
+ #region Initialization
30
30
 
31
31
  [DllImport("__Internal")]
32
32
  internal static extern IntPtr BSUGetInitDescription(IntPtr status, string className);
33
33
 
34
34
  [DllImport("__Internal")]
35
35
  internal static extern IntPtr BSUGetInitProviderName(IntPtr status, string className);
36
-
36
+
37
37
  [DllImport("__Internal")]
38
38
  internal static extern int BSUGetInitState(IntPtr status, string className);
39
39
 
@@ -44,57 +44,60 @@ namespace Azerion.BlueStack.Platforms.iOS
44
44
  internal static extern int BSUGetInitNumberOfAdapterClasses(IntPtr status);
45
45
 
46
46
  [DllImport("__Internal")]
47
- internal static extern void BSUInitializeWithCallback(IntPtr iOSAdsClient, string appId, IntPtr settings, BlueStackClient.BSUSDKInitializationCompleteCallback callback, BlueStackClient.BSUInitializationCompleteCallback adaptersInitCallback);
48
-
49
- #endregion
50
-
51
- #region Settings
47
+ internal static extern void BSUInitializeWithCallback(IntPtr iOSAdsClient, string appId, IntPtr settings,
48
+ BlueStackClient.BSUSDKInitializationCompleteCallback callback,
49
+ BlueStackClient.BSUInitializationCompleteCallback adaptersInitCallback);
50
+
51
+ #endregion
52
+
53
+ #region Settings
52
54
 
53
55
  [DllImport("__Internal")]
54
56
  internal static extern IntPtr BSUCreateSettings();
55
-
57
+
56
58
  [DllImport("__Internal")]
57
59
  internal static extern void BSUSetDebugModeEnabled(IntPtr settingsRef, bool debugModeEnabled);
58
-
59
- #endregion
60
60
 
61
- #region Preference
61
+ #endregion
62
+
63
+ #region Preference
62
64
 
63
65
  [DllImport("__Internal")]
64
66
  internal static extern IntPtr BSUCreatePreference();
65
-
67
+
66
68
  [DllImport("__Internal")]
67
69
  internal static extern void BSUSetGender(IntPtr preferencePtr, int gender);
68
70
 
69
71
  [DllImport("__Internal")]
70
72
  internal static extern void BSUSetAge(IntPtr preferencePtr, int age);
71
-
73
+
72
74
  [DllImport("__Internal")]
73
- internal static extern void BSUSetLocation(IntPtr preferencePtr, double latitude, double longitude, int consentFlag);
74
-
75
+ internal static extern void BSUSetLocation(IntPtr preferencePtr, double latitude, double longitude,
76
+ int consentFlag);
77
+
75
78
  [DllImport("__Internal")]
76
79
  internal static extern void BSULanguage(IntPtr preferencePtr, string language);
77
-
80
+
78
81
  [DllImport("__Internal")]
79
82
  internal static extern void BSUSetKeyword(IntPtr preferencePtr, string keyword);
80
83
 
81
84
  [DllImport("__Internal")]
82
85
  internal static extern void BSUSetContentUrl(IntPtr preferencePtr, string contentUrl);
83
-
86
+
84
87
  [DllImport("__Internal")]
85
88
  internal static extern void BSUDestroyPreference(IntPtr preferencePtr);
86
-
87
- #endregion
88
-
89
- #region RewardedVideoAd
89
+
90
+ #endregion
91
+
92
+ #region RewardedVideoAd
90
93
 
91
94
  [DllImport("__Internal")]
92
95
  internal static extern IntPtr BSUCreateRewardedVideoAd(IntPtr rewardedClient, string placementId);
93
-
96
+
94
97
  [DllImport("__Internal")]
95
98
  internal static extern void BSUSetRewardedVideoAdCallbacks(
96
99
  IntPtr rewardedAd,
97
- RewardedVideoAdClient.BSUOnRewardedVideoLoadedCallback
100
+ RewardedVideoAdClient.BSUOnRewardedVideoLoadedCallback
98
101
  onLoadedCallback,
99
102
  RewardedVideoAdClient.BSUOnRewardedVideoErrorCallback
100
103
  onErrorCallback,
@@ -107,30 +110,31 @@ namespace Azerion.BlueStack.Platforms.iOS
107
110
  RewardedVideoAdClient.BSUOnUserRewardEarnedCallback
108
111
  onRewardEarnedCallback
109
112
  );
110
-
113
+
111
114
  [DllImport("__Internal")]
112
115
  internal static extern void BSULoadRewardedVideoAd(IntPtr rewardedClient);
113
-
116
+
114
117
  [DllImport("__Internal")]
115
- internal static extern void BSULoadRewardedVideoAdWithPreference(IntPtr rewardedClient, IntPtr preferenceClient);
116
-
118
+ internal static extern void
119
+ BSULoadRewardedVideoAdWithPreference(IntPtr rewardedClient, IntPtr preferenceClient);
120
+
117
121
  [DllImport("__Internal")]
118
122
  internal static extern void BSUShowRewardedVideoAd(IntPtr rewardedClient);
119
-
123
+
120
124
  [DllImport("__Internal")]
121
125
  internal static extern void BSUDestroyRewardedVideoAd(IntPtr rewardedClient);
122
-
123
- #endregion
124
126
 
125
- #region InterstitialAd
126
-
127
+ #endregion
128
+
129
+ #region InterstitialAd
130
+
127
131
  [DllImport("__Internal")]
128
132
  internal static extern IntPtr BSUCreateInterstitialAd(IntPtr interstitialClient, string placementId);
129
-
133
+
130
134
  [DllImport("__Internal")]
131
135
  internal static extern void BSUSetInterstitialAdCallbacks(
132
136
  IntPtr interstitial,
133
- InterstitialAdClient.BSUOnInterstitialDidLoadedCallback
137
+ InterstitialAdClient.BSUOnInterstitialDidLoadedCallback
134
138
  onDidLoadedCallback,
135
139
  InterstitialAdClient.BSUOnInterstitialDidFailCallback
136
140
  onDidFailCallback,
@@ -141,33 +145,35 @@ namespace Azerion.BlueStack.Platforms.iOS
141
145
  InterstitialAdClient.BSUOnInterstitialDidShownCallback
142
146
  onDidShownCallback
143
147
  );
144
-
148
+
145
149
  [DllImport("__Internal")]
146
150
  internal static extern void BSULoadInterstitialAd(IntPtr interstitialClient);
147
-
151
+
148
152
  [DllImport("__Internal")]
149
- internal static extern void BSULoadInterstitialAdWithPreference(IntPtr interstitialClient, IntPtr preferencePtr);
150
-
153
+ internal static extern void
154
+ BSULoadInterstitialAdWithPreference(IntPtr interstitialClient, IntPtr preferencePtr);
155
+
151
156
  [DllImport("__Internal")]
152
157
  internal static extern void BSUShowInterstitialAd(IntPtr interstitialClient);
153
-
158
+
154
159
  [DllImport("__Internal")]
155
160
  internal static extern void BSUDestroyInterstitialAd(IntPtr interstitialClient);
156
-
157
- #endregion
158
-
159
- #region BannerAd
161
+
162
+ #endregion
163
+
164
+ #region BannerAd
160
165
 
161
166
  [DllImport("__Internal")]
162
167
  internal static extern IntPtr BSUCreateBannerAd(
163
168
  IntPtr bannerClient, string placementId, int adPosition);
164
-
169
+
165
170
  [DllImport("__Internal")]
166
171
  internal static extern void BSULoadBannerAd(IntPtr banner, int width, int height);
167
-
172
+
168
173
  [DllImport("__Internal")]
169
- internal static extern void BSULoadBannerAdWithPreference(IntPtr banner, int width, int height, IntPtr preferencePtr);
170
-
174
+ internal static extern void BSULoadBannerAdWithPreference(IntPtr banner, int width, int height,
175
+ IntPtr preferencePtr);
176
+
171
177
  [DllImport("__Internal")]
172
178
  internal static extern void BSUHideBannerAd(IntPtr banner);
173
179
 
@@ -176,7 +182,7 @@ namespace Azerion.BlueStack.Platforms.iOS
176
182
 
177
183
  [DllImport("__Internal")]
178
184
  internal static extern IntPtr BSUSetBannerAdPosition(IntPtr banner, int adPosition);
179
-
185
+
180
186
  [DllImport("__Internal")]
181
187
  internal static extern void BSUDestroyBannerAd(IntPtr banner);
182
188
 
@@ -191,9 +197,10 @@ namespace Azerion.BlueStack.Platforms.iOS
191
197
  BannerAdClient.BSUOnBannerHideCallback onBannerHideCallback,
192
198
  BannerAdClient.BSUOnBannerDisplayCallback onBannerDisplayCallback
193
199
  );
194
- #endregion
195
200
 
196
- #region NativeAd
201
+ #endregion
202
+
203
+ #region NativeAd
197
204
 
198
205
  [DllImport("__Internal")]
199
206
  internal static extern IntPtr BSUCreateNativeAd(
@@ -219,7 +226,7 @@ namespace Azerion.BlueStack.Platforms.iOS
219
226
 
220
227
  [DllImport("__Internal")]
221
228
  internal static extern string BSUNativeAdGetBadge(IntPtr native);
222
-
229
+
223
230
  [DllImport("__Internal")]
224
231
  internal static extern string BSUNativeAdGetCoverImageUrl(IntPtr native);
225
232
 
@@ -231,13 +238,13 @@ namespace Azerion.BlueStack.Platforms.iOS
231
238
 
232
239
  [DllImport("__Internal")]
233
240
  internal static extern void BSUDestroyNativeAd(IntPtr native);
234
-
241
+
235
242
  [DllImport("__Internal")]
236
243
  internal static extern void BSURecordImpression(IntPtr native);
237
-
244
+
238
245
  [DllImport("__Internal")]
239
246
  internal static extern void BSUPerformClick(IntPtr native);
240
-
247
+
241
248
  [DllImport("__Internal")]
242
249
  internal static extern void BSUSetNativeAdCallbacks(
243
250
  IntPtr bannerAd,
@@ -247,8 +254,8 @@ namespace Azerion.BlueStack.Platforms.iOS
247
254
  NativeAdClient.BSUOnNativeAdDidPerformClickCallback onNativeAdDidPerformClickCallback,
248
255
  NativeAdClient.BSUOnNativeAdCloseCallback onNativeAdCloseCallback
249
256
  );
250
- #endregion
251
257
 
258
+ #endregion
252
259
  }
253
260
  }
254
261
  #endif
@@ -6,7 +6,7 @@ using Azerion.BlueStack.Internal;
6
6
 
7
7
  namespace Azerion.BlueStack.Platforms.iOS
8
8
  {
9
- public class InitializationStatusClient: IInitializationStatusClient
9
+ public class InitializationStatusClient : IInitializationStatusClient
10
10
  {
11
11
  private IntPtr _status;
12
12
 
@@ -14,7 +14,7 @@ namespace Azerion.BlueStack.Platforms.iOS
14
14
  {
15
15
  this._status = status;
16
16
  }
17
-
17
+
18
18
  public AdapterStatus GetAdapterStatusForClassName(string className)
19
19
  {
20
20
  string description = Utils.PtrToString(Externs.BSUGetInitDescription(this._status, className));
@@ -22,18 +22,19 @@ namespace Azerion.BlueStack.Platforms.iOS
22
22
  AdapterState state = (AdapterState)Externs.BSUGetInitState(this._status, className);
23
23
  return new AdapterStatus(state, description, name);
24
24
  }
25
-
25
+
26
26
  public Dictionary<string, AdapterStatus> GetAdapterStatusMap()
27
27
  {
28
28
  Dictionary<string, AdapterStatus> map = new Dictionary<string, AdapterStatus>();
29
29
  List<string> keys = GetAdapterClassNames();
30
- foreach(string key in keys)
30
+ foreach (string key in keys)
31
31
  {
32
32
  map.Add(key, GetAdapterStatusForClassName(key));
33
33
  }
34
+
34
35
  return map;
35
36
  }
36
-
37
+
37
38
  public List<string> GetAdapterClassNames()
38
39
  {
39
40
  IntPtr unmanagedAssetArray =
@@ -6,26 +6,29 @@ using Azerion.BlueStack.Internal;
6
6
 
7
7
  namespace Azerion.BlueStack.Platforms.iOS
8
8
  {
9
- public class InterstitialAdClient: IInterstitialAdClient, IDisposable
9
+ public class InterstitialAdClient : IInterstitialAdClient, IDisposable
10
10
  {
11
11
  private IntPtr interstitialClientPtr;
12
12
  private IntPtr interstitialPtr;
13
-
13
+
14
14
  public InterstitialAdClient()
15
15
  {
16
-
17
16
  }
18
-
19
- #region interstitial ad callback types
17
+
18
+ #region interstitial ad callback types
20
19
 
21
20
  internal delegate void BSUOnInterstitialDidLoadedCallback(IntPtr interstitialClient);
21
+
22
22
  internal delegate void BSUOnInterstitialDidFailCallback(IntPtr interstitialClient, IntPtr error);
23
+
23
24
  internal delegate void BSUOnInterstitialClickedCallback(IntPtr interstitialClient);
25
+
24
26
  internal delegate void BSUOnInterstitialDisappearCallback(IntPtr interstitialClient);
27
+
25
28
  internal delegate void BSUOnInterstitialDidShownCallback(IntPtr interstitialClient);
26
-
27
- #endregion
28
-
29
+
30
+ #endregion
31
+
29
32
  // This property should be used when setting the interstitialPtr.
30
33
  private IntPtr InterstitialPtr
31
34
  {
@@ -36,12 +39,13 @@ namespace Azerion.BlueStack.Platforms.iOS
36
39
  this.interstitialPtr = value;
37
40
  }
38
41
  }
39
-
42
+
40
43
  public event EventHandler<EventArgs> OnInterstitialDidLoaded;
41
44
  public event EventHandler<BlueStackError> OnInterstitialDidFail;
42
45
  public event EventHandler<EventArgs> OnInterstitialClicked;
43
46
  public event EventHandler<EventArgs> OnInterstitialDisappear;
44
47
  public event EventHandler<EventArgs> OnInterstitialDidShown;
48
+
45
49
  public void Create(string placementId)
46
50
  {
47
51
  this.interstitialClientPtr = (IntPtr)GCHandle.Alloc(this);
@@ -63,7 +67,8 @@ namespace Azerion.BlueStack.Platforms.iOS
63
67
  public void Load(IPreferenceClient iPreferenceClient)
64
68
  {
65
69
  PreferenceClient preferenceClient = (PreferenceClient)iPreferenceClient;
66
- Externs.BSULoadInterstitialAdWithPreference(this.InterstitialPtr, preferenceClient.GetPreferenceClientPtr());
70
+ Externs.BSULoadInterstitialAdWithPreference(this.InterstitialPtr,
71
+ preferenceClient.GetPreferenceClientPtr());
67
72
  }
68
73
 
69
74
  public void Show()
@@ -76,7 +81,7 @@ namespace Azerion.BlueStack.Platforms.iOS
76
81
  Externs.BSUDestroyInterstitialAd(this.InterstitialPtr);
77
82
  DestroyInterstitial();
78
83
  }
79
-
84
+
80
85
  // Destroys the interstitial ad.
81
86
  public void DestroyInterstitial()
82
87
  {
@@ -93,8 +98,8 @@ namespace Azerion.BlueStack.Platforms.iOS
93
98
  {
94
99
  this.Dispose();
95
100
  }
96
-
97
- #region interstitial ad callback methods
101
+
102
+ #region interstitial ad callback methods
98
103
 
99
104
  [AOT.MonoPInvokeCallback(typeof(BSUOnInterstitialDidLoadedCallback))]
100
105
  private static void OnInterstitialDidLoadedCallback(IntPtr interstitialClient)
@@ -102,12 +107,13 @@ namespace Azerion.BlueStack.Platforms.iOS
102
107
  InterstitialAdClient client = IntPtrToInterstitialAdClient(interstitialClient);
103
108
  if (client.OnInterstitialDidLoaded != null)
104
109
  {
105
- client.OnInterstitialDidLoaded(client,EventArgs.Empty);
110
+ client.OnInterstitialDidLoaded(client, EventArgs.Empty);
106
111
  }
107
112
  }
108
113
 
109
114
  [AOT.MonoPInvokeCallback(typeof(BSUOnInterstitialDidFailCallback))]
110
- private static void OnInterstitialDidFailCallback(IntPtr interstitialClient, IntPtr error) {
115
+ private static void OnInterstitialDidFailCallback(IntPtr interstitialClient, IntPtr error)
116
+ {
111
117
  InterstitialAdClient client = IntPtrToInterstitialAdClient(interstitialClient);
112
118
  if (client.OnInterstitialDidFail != null)
113
119
  {
@@ -121,27 +127,27 @@ namespace Azerion.BlueStack.Platforms.iOS
121
127
  InterstitialAdClient client = IntPtrToInterstitialAdClient(interstitialClient);
122
128
  if (client.OnInterstitialClicked != null)
123
129
  {
124
- client.OnInterstitialClicked(client,EventArgs.Empty);
130
+ client.OnInterstitialClicked(client, EventArgs.Empty);
125
131
  }
126
132
  }
127
-
133
+
128
134
  [AOT.MonoPInvokeCallback(typeof(BSUOnInterstitialDisappearCallback))]
129
135
  private static void OnInterstitialDisappearCallback(IntPtr interstitialClient)
130
136
  {
131
137
  InterstitialAdClient client = IntPtrToInterstitialAdClient(interstitialClient);
132
138
  if (client.OnInterstitialDisappear != null)
133
139
  {
134
- client.OnInterstitialDisappear(client,EventArgs.Empty);
140
+ client.OnInterstitialDisappear(client, EventArgs.Empty);
135
141
  }
136
142
  }
137
-
143
+
138
144
  [AOT.MonoPInvokeCallback(typeof(BSUOnInterstitialDidShownCallback))]
139
145
  private static void OnInterstitialDidShownCallback(IntPtr interstitialClient)
140
146
  {
141
147
  InterstitialAdClient client = IntPtrToInterstitialAdClient(interstitialClient);
142
148
  if (client.OnInterstitialDidShown != null)
143
149
  {
144
- client.OnInterstitialDidShown(client,EventArgs.Empty);
150
+ client.OnInterstitialDidShown(client, EventArgs.Empty);
145
151
  }
146
152
  }
147
153
 
@@ -152,7 +158,7 @@ namespace Azerion.BlueStack.Platforms.iOS
152
158
  return handle.Target as InterstitialAdClient;
153
159
  }
154
160
 
155
- #endregion
161
+ #endregion
156
162
  }
157
163
  }
158
164
  #endif
@@ -10,30 +10,34 @@ namespace Azerion.BlueStack.Platforms.iOS
10
10
  {
11
11
  private IntPtr _nativeAdPtr;
12
12
  private IntPtr _nativeAdClientPtr;
13
-
14
- #region NativeAd callback types
13
+
14
+ #region NativeAd callback types
15
15
 
16
16
  internal delegate void BSUOnNativeAdDidLoadCallback(IntPtr nativeClient);
17
+
17
18
  internal delegate void BSUOnNativeAdDidFailedCallback(IntPtr nativeClient, IntPtr error);
19
+
18
20
  internal delegate void BSUOnNativeAdDidRecordImpressionCallback(IntPtr nativeClient);
21
+
19
22
  internal delegate void BSUOnNativeAdDidPerformClickCallback(IntPtr nativeClient);
23
+
20
24
  internal delegate void BSUOnNativeAdCloseCallback(IntPtr nativeClient);
21
-
22
- #endregion
23
-
25
+
26
+ #endregion
27
+
24
28
  // This property should be used when setting the nativeViewPtr.
25
29
  private IntPtr NativeAdPtr
26
30
  {
27
31
  get => this._nativeAdPtr;
28
-
32
+
29
33
  set
30
34
  {
31
35
  Externs.BSURelease(this._nativeAdPtr);
32
36
  this._nativeAdPtr = value;
33
37
  }
34
38
  }
35
-
36
- #region Native callback methods
39
+
40
+ #region Native callback methods
37
41
 
38
42
  [AOT.MonoPInvokeCallback(typeof(BSUOnNativeAdDidLoadCallback))]
39
43
  private static void OnNativeAdDidLoadCallback(IntPtr bannerClient)
@@ -44,7 +48,7 @@ namespace Azerion.BlueStack.Platforms.iOS
44
48
  client.OnNativeAdDidLoad(client, EventArgs.Empty);
45
49
  }
46
50
  }
47
-
51
+
48
52
  [AOT.MonoPInvokeCallback(typeof(BSUOnNativeAdDidFailedCallback))]
49
53
  private static void OnNativeAdDidFailCallback(IntPtr nativeClient, IntPtr error)
50
54
  {
@@ -64,7 +68,7 @@ namespace Azerion.BlueStack.Platforms.iOS
64
68
  client.OnNativeAdImpression(client, EventArgs.Empty);
65
69
  }
66
70
  }
67
-
71
+
68
72
  [AOT.MonoPInvokeCallback(typeof(BSUOnNativeAdDidLoadCallback))]
69
73
  private static void OnNativeAdDidPerformClickCallback(IntPtr bannerClient)
70
74
  {
@@ -74,7 +78,7 @@ namespace Azerion.BlueStack.Platforms.iOS
74
78
  client.OnNativeAdClicked(client, EventArgs.Empty);
75
79
  }
76
80
  }
77
-
81
+
78
82
  [AOT.MonoPInvokeCallback(typeof(BSUOnNativeAdDidLoadCallback))]
79
83
  private static void OnNativeAdCloseCallback(IntPtr bannerClient)
80
84
  {
@@ -90,9 +94,9 @@ namespace Azerion.BlueStack.Platforms.iOS
90
94
  GCHandle handle = (GCHandle)nativeClient;
91
95
  return handle.Target as NativeAdClient;
92
96
  }
93
-
94
- #endregion
95
-
97
+
98
+ #endregion
99
+
96
100
  public void Destroy()
97
101
  {
98
102
  this.DestroyNativeAd();
@@ -104,27 +108,28 @@ namespace Azerion.BlueStack.Platforms.iOS
104
108
  Externs.BSUDestroyNativeAd(this.NativeAdPtr);
105
109
  this.NativeAdPtr = IntPtr.Zero;
106
110
  }
111
+
107
112
  public void Dispose()
108
113
  {
109
114
  this.DestroyNativeAd();
110
- ((GCHandle) this._nativeAdClientPtr).Free();
115
+ ((GCHandle)this._nativeAdClientPtr).Free();
111
116
  }
112
117
 
113
118
  ~NativeAdClient()
114
119
  {
115
120
  this.Dispose();
116
121
  }
117
-
122
+
118
123
  public event EventHandler<EventArgs> OnNativeAdDidLoad;
119
124
  public event EventHandler<BlueStackError> OnNativeAdDidFail;
120
125
  public event EventHandler<EventArgs> OnNativeAdImpression;
121
126
  public event EventHandler<EventArgs> OnNativeAdClicked;
122
127
  public event EventHandler<EventArgs> OnNativeAdOpening;
123
128
  public event EventHandler<EventArgs> OnNativeAdClosed;
124
-
129
+
125
130
  public void Create(string placementId)
126
131
  {
127
- this._nativeAdClientPtr = (IntPtr) GCHandle.Alloc(this);
132
+ this._nativeAdClientPtr = (IntPtr)GCHandle.Alloc(this);
128
133
 
129
134
  this.NativeAdPtr = Externs.BSUCreateNativeAd(
130
135
  this._nativeAdClientPtr, placementId);
@@ -164,12 +169,12 @@ namespace Azerion.BlueStack.Platforms.iOS
164
169
  {
165
170
  return Externs.BSUNativeAdGetCTAText(this.NativeAdPtr);
166
171
  }
167
-
172
+
168
173
  public byte[] GetBadgeBytes()
169
174
  {
170
175
  return Array.Empty<byte>();
171
176
  }
172
-
177
+
173
178
  public string GetBadge()
174
179
  {
175
180
  return Externs.BSUNativeAdGetBadge(this.NativeAdPtr);
@@ -189,12 +194,12 @@ namespace Azerion.BlueStack.Platforms.iOS
189
194
  {
190
195
  return Externs.BSUNativeAdGetClickUrl(this.NativeAdPtr);
191
196
  }
192
-
197
+
193
198
  public void RecordImpression()
194
199
  {
195
200
  Externs.BSURecordImpression(this.NativeAdPtr);
196
201
  }
197
-
202
+
198
203
  public void PerformClick()
199
204
  {
200
205
  Externs.BSUPerformClick(this.NativeAdPtr);