com.azerion.bluestack 3.0.0-preview2 → 3.0.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.
Files changed (33) hide show
  1. package/Editor/BlueStackDependencies.xml +1 -1
  2. package/Example/Prefabs/NativeAd.prefab +76 -15
  3. package/Example/Scripts/NativeAdManager.cs +2 -3
  4. package/Plugins/Android/bluestack-unity-android-bridge-2.0.0.aar +0 -0
  5. package/Plugins/Android/{bluestack-unity-android-bridge-2.0.0-preview1.aar.meta → bluestack-unity-android-bridge-2.0.0.aar.meta} +1 -1
  6. package/Plugins/iOS/BSUInterface.h +12 -4
  7. package/Plugins/iOS/BSUInterface.m +29 -5
  8. package/Plugins/iOS/BSUNativeAd.h +7 -1
  9. package/Plugins/iOS/BSUNativeAd.m +42 -2
  10. package/Plugins/iOS/BSUTypes.h +6 -0
  11. package/Runtime/API/Banner/BannerAd.cs +2 -1
  12. package/Runtime/API/InterstitialAd.cs +2 -1
  13. package/Runtime/API/NativeAd/NativeAd.cs +25 -10
  14. package/Runtime/API/NativeAd/NativeAdInteractionHandler.cs +55 -30
  15. package/Runtime/API/NativeAd/NativeAdLoader.cs +1 -1
  16. package/Runtime/API/NativeAd/NativeAdObject.cs +146 -108
  17. package/Runtime/API/NativeAd/{NativeAssetID.cs → NativeAssetInfo.cs} +13 -0
  18. package/Runtime/API/Rewarded/RewardedVideoAd.cs +2 -1
  19. package/Runtime/Internal/NativeAd/INativeAdClient.cs +7 -1
  20. package/Runtime/Platforms/Android/AndroidJavaObjectFactory.cs +8 -0
  21. package/Runtime/Platforms/Android/BlueStackClient.cs +6 -2
  22. package/Runtime/Platforms/Android/BlueStackNativeClassNames.cs +2 -0
  23. package/Runtime/Platforms/Android/NativeAdClient.cs +33 -7
  24. package/Runtime/Platforms/Unity/NativeAdClient.cs +27 -1
  25. package/Runtime/Platforms/iOS/Externs.cs +11 -2
  26. package/Runtime/Platforms/iOS/NativeAdClient.cs +53 -4
  27. package/package.json +1 -1
  28. package/Plugins/Android/bluestack-unity-android-bridge-2.0.0-preview1.aar +0 -0
  29. package/Runtime/API/NativeAd/NativeAdInteractionUtils.cs +0 -122
  30. package/Runtime/API/NativeAd/NativeAdInteractionUtils.cs.meta +0 -11
  31. package/Runtime/API/NativeAd/NativeClientFactoryManager.cs +0 -32
  32. package/Runtime/API/NativeAd/NativeClientFactoryManager.cs.meta +0 -11
  33. /package/Runtime/API/NativeAd/{NativeAssetID.cs.meta → NativeAssetInfo.cs.meta} +0 -0
@@ -1,6 +1,6 @@
1
1
  <dependencies>
2
2
  <androidPackages>
3
- <androidPackage spec="com.azerion:bluestack-sdk-core:4.2.9" />
3
+ <androidPackage spec="com.azerion:bluestack-sdk-core:4.3.0" />
4
4
  </androidPackages>
5
5
  <iosPods>
6
6
  <iosPod name="BlueStack-SDK" version="4.2.9" bitcodeEnabled="false"
@@ -28,10 +28,10 @@ RectTransform:
28
28
  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
29
29
  m_LocalPosition: {x: 0, y: 0, z: 0}
30
30
  m_LocalScale: {x: 1, y: 1, z: 1}
31
+ m_ConstrainProportionsScale: 0
31
32
  m_Children:
32
33
  - {fileID: 5666620918551509491}
33
34
  m_Father: {fileID: 5666620918374091928}
34
- m_RootOrder: 0
35
35
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
36
36
  m_AnchorMin: {x: 0, y: 1}
37
37
  m_AnchorMax: {x: 0, y: 1}
@@ -102,9 +102,9 @@ RectTransform:
102
102
  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
103
103
  m_LocalPosition: {x: 0, y: 0, z: 0}
104
104
  m_LocalScale: {x: 1, y: 1, z: 1}
105
+ m_ConstrainProportionsScale: 0
105
106
  m_Children: []
106
107
  m_Father: {fileID: 5666620918604549423}
107
- m_RootOrder: 0
108
108
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
109
109
  m_AnchorMin: {x: 0, y: 0}
110
110
  m_AnchorMax: {x: 1, y: 1}
@@ -161,9 +161,17 @@ BoxCollider:
161
161
  m_PrefabAsset: {fileID: 0}
162
162
  m_GameObject: {fileID: 5666620917415584048}
163
163
  m_Material: {fileID: 0}
164
+ m_IncludeLayers:
165
+ serializedVersion: 2
166
+ m_Bits: 0
167
+ m_ExcludeLayers:
168
+ serializedVersion: 2
169
+ m_Bits: 0
170
+ m_LayerOverridePriority: 0
164
171
  m_IsTrigger: 0
172
+ m_ProvidesContacts: 0
165
173
  m_Enabled: 1
166
- serializedVersion: 2
174
+ serializedVersion: 3
167
175
  m_Size: {x: 1000, y: 100, z: 1}
168
176
  m_Center: {x: 0, y: 0, z: 0}
169
177
  --- !u!1 &5666620918374091929
@@ -194,6 +202,7 @@ RectTransform:
194
202
  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
195
203
  m_LocalPosition: {x: 0, y: 0, z: 0}
196
204
  m_LocalScale: {x: 1, y: 1, z: 1}
205
+ m_ConstrainProportionsScale: 0
197
206
  m_Children:
198
207
  - {fileID: 5666620917246655718}
199
208
  - {fileID: 5666620919071030927}
@@ -202,7 +211,6 @@ RectTransform:
202
211
  - {fileID: 5666620919168347858}
203
212
  - {fileID: 5666620918604549423}
204
213
  m_Father: {fileID: 5666620918536744664}
205
- m_RootOrder: 0
206
214
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
207
215
  m_AnchorMin: {x: 0.5, y: 0.5}
208
216
  m_AnchorMax: {x: 0.5, y: 0.5}
@@ -276,9 +284,9 @@ RectTransform:
276
284
  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
277
285
  m_LocalPosition: {x: 0, y: 0, z: 0}
278
286
  m_LocalScale: {x: 1, y: 1, z: 1}
287
+ m_ConstrainProportionsScale: 0
279
288
  m_Children: []
280
289
  m_Father: {fileID: 5666620918374091928}
281
- m_RootOrder: 2
282
290
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
283
291
  m_AnchorMin: {x: 0, y: 1}
284
292
  m_AnchorMax: {x: 0, y: 1}
@@ -335,9 +343,17 @@ BoxCollider:
335
343
  m_PrefabAsset: {fileID: 0}
336
344
  m_GameObject: {fileID: 5666620918419381243}
337
345
  m_Material: {fileID: 0}
346
+ m_IncludeLayers:
347
+ serializedVersion: 2
348
+ m_Bits: 0
349
+ m_ExcludeLayers:
350
+ serializedVersion: 2
351
+ m_Bits: 0
352
+ m_LayerOverridePriority: 0
338
353
  m_IsTrigger: 0
354
+ m_ProvidesContacts: 0
339
355
  m_Enabled: 1
340
- serializedVersion: 2
356
+ serializedVersion: 3
341
357
  m_Size: {x: 785, y: 130, z: 1}
342
358
  m_Center: {x: 392.5, y: -65.6, z: 0}
343
359
  --- !u!1 &5666620918536744661
@@ -370,10 +386,10 @@ RectTransform:
370
386
  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
371
387
  m_LocalPosition: {x: 0, y: 0, z: 0}
372
388
  m_LocalScale: {x: 0, y: 0, z: 0}
389
+ m_ConstrainProportionsScale: 0
373
390
  m_Children:
374
391
  - {fileID: 5666620918374091928}
375
392
  m_Father: {fileID: 0}
376
- m_RootOrder: 0
377
393
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
378
394
  m_AnchorMin: {x: 0, y: 0}
379
395
  m_AnchorMax: {x: 0, y: 0}
@@ -397,7 +413,9 @@ Canvas:
397
413
  m_OverrideSorting: 0
398
414
  m_OverridePixelPerfect: 0
399
415
  m_SortingBucketNormalizedSize: 0
416
+ m_VertexColorAlwaysGammaSpace: 0
400
417
  m_AdditionalShaderChannelsFlag: 0
418
+ m_UpdateRectTransformForStandalone: 0
401
419
  m_SortingLayerID: 0
402
420
  m_SortingOrder: 100
403
421
  m_TargetDisplay: 0
@@ -488,9 +506,9 @@ RectTransform:
488
506
  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
489
507
  m_LocalPosition: {x: 0, y: 0, z: 0}
490
508
  m_LocalScale: {x: 1, y: 1, z: 1}
509
+ m_ConstrainProportionsScale: 0
491
510
  m_Children: []
492
511
  m_Father: {fileID: 5666620917246655718}
493
- m_RootOrder: 0
494
512
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
495
513
  m_AnchorMin: {x: 0.5, y: 0.5}
496
514
  m_AnchorMax: {x: 0.5, y: 0.5}
@@ -547,9 +565,17 @@ BoxCollider:
547
565
  m_PrefabAsset: {fileID: 0}
548
566
  m_GameObject: {fileID: 5666620918551509388}
549
567
  m_Material: {fileID: 0}
568
+ m_IncludeLayers:
569
+ serializedVersion: 2
570
+ m_Bits: 0
571
+ m_ExcludeLayers:
572
+ serializedVersion: 2
573
+ m_Bits: 0
574
+ m_LayerOverridePriority: 0
550
575
  m_IsTrigger: 0
576
+ m_ProvidesContacts: 0
551
577
  m_Enabled: 1
552
- serializedVersion: 2
578
+ serializedVersion: 3
553
579
  m_Size: {x: 100, y: 50, z: 1}
554
580
  m_Center: {x: 0, y: 0, z: 0}
555
581
  --- !u!1 &5666620918604549416
@@ -580,10 +606,10 @@ RectTransform:
580
606
  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
581
607
  m_LocalPosition: {x: 0, y: 0, z: 0}
582
608
  m_LocalScale: {x: 1, y: 1, z: 1}
609
+ m_ConstrainProportionsScale: 0
583
610
  m_Children:
584
611
  - {fileID: 5666620917415584055}
585
612
  m_Father: {fileID: 5666620918374091928}
586
- m_RootOrder: 5
587
613
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
588
614
  m_AnchorMin: {x: 0.5, y: 0}
589
615
  m_AnchorMax: {x: 0.5, y: 0}
@@ -657,9 +683,9 @@ RectTransform:
657
683
  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
658
684
  m_LocalPosition: {x: 0, y: 0, z: 0}
659
685
  m_LocalScale: {x: 1, y: 1, z: 1}
686
+ m_ConstrainProportionsScale: 0
660
687
  m_Children: []
661
688
  m_Father: {fileID: 5666620918374091928}
662
- m_RootOrder: 3
663
689
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
664
690
  m_AnchorMin: {x: 0, y: 1}
665
691
  m_AnchorMax: {x: 0, y: 1}
@@ -716,9 +742,17 @@ BoxCollider:
716
742
  m_PrefabAsset: {fileID: 0}
717
743
  m_GameObject: {fileID: 5666620918867964668}
718
744
  m_Material: {fileID: 0}
745
+ m_IncludeLayers:
746
+ serializedVersion: 2
747
+ m_Bits: 0
748
+ m_ExcludeLayers:
749
+ serializedVersion: 2
750
+ m_Bits: 0
751
+ m_LayerOverridePriority: 0
719
752
  m_IsTrigger: 0
753
+ m_ProvidesContacts: 0
720
754
  m_Enabled: 1
721
- serializedVersion: 2
755
+ serializedVersion: 3
722
756
  m_Size: {x: 1000, y: 137, z: 1}
723
757
  m_Center: {x: 494.51, y: -68.2, z: 0}
724
758
  --- !u!1 &5666620919071030920
@@ -750,9 +784,9 @@ RectTransform:
750
784
  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
751
785
  m_LocalPosition: {x: 0, y: 0, z: 0}
752
786
  m_LocalScale: {x: 1, y: 1, z: 1}
787
+ m_ConstrainProportionsScale: 0
753
788
  m_Children: []
754
789
  m_Father: {fileID: 5666620918374091928}
755
- m_RootOrder: 1
756
790
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
757
791
  m_AnchorMin: {x: 0, y: 1}
758
792
  m_AnchorMax: {x: 0, y: 1}
@@ -804,6 +838,25 @@ BoxCollider2D:
804
838
  m_Enabled: 1
805
839
  m_Density: 1
806
840
  m_Material: {fileID: 0}
841
+ m_IncludeLayers:
842
+ serializedVersion: 2
843
+ m_Bits: 0
844
+ m_ExcludeLayers:
845
+ serializedVersion: 2
846
+ m_Bits: 0
847
+ m_LayerOverridePriority: 0
848
+ m_ForceSendLayers:
849
+ serializedVersion: 2
850
+ m_Bits: 4294967295
851
+ m_ForceReceiveLayers:
852
+ serializedVersion: 2
853
+ m_Bits: 4294967295
854
+ m_ContactCaptureLayers:
855
+ serializedVersion: 2
856
+ m_Bits: 4294967295
857
+ m_CallbackLayers:
858
+ serializedVersion: 2
859
+ m_Bits: 4294967295
807
860
  m_IsTrigger: 0
808
861
  m_UsedByEffector: 0
809
862
  m_UsedByComposite: 0
@@ -849,9 +902,9 @@ RectTransform:
849
902
  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
850
903
  m_LocalPosition: {x: 0, y: 0, z: 0}
851
904
  m_LocalScale: {x: 1, y: 1, z: 1}
905
+ m_ConstrainProportionsScale: 0
852
906
  m_Children: []
853
907
  m_Father: {fileID: 5666620918374091928}
854
- m_RootOrder: 4
855
908
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
856
909
  m_AnchorMin: {x: 0, y: 1}
857
910
  m_AnchorMax: {x: 0, y: 1}
@@ -866,9 +919,17 @@ BoxCollider:
866
919
  m_PrefabAsset: {fileID: 0}
867
920
  m_GameObject: {fileID: 5666620919168347859}
868
921
  m_Material: {fileID: 0}
922
+ m_IncludeLayers:
923
+ serializedVersion: 2
924
+ m_Bits: 0
925
+ m_ExcludeLayers:
926
+ serializedVersion: 2
927
+ m_Bits: 0
928
+ m_LayerOverridePriority: 0
869
929
  m_IsTrigger: 0
930
+ m_ProvidesContacts: 0
870
931
  m_Enabled: 1
871
- serializedVersion: 2
932
+ serializedVersion: 3
872
933
  m_Size: {x: 1000, y: 500, z: 1}
873
934
  m_Center: {x: 500, y: -250, z: 0}
874
935
  --- !u!222 &5666620919168347856
@@ -32,7 +32,7 @@ namespace Azerion.BlueStack.Example
32
32
  get
33
33
  {
34
34
  #if UNITY_IOS
35
- return "/" + AppId + "/nativead";
35
+ return "/" + AppId + "/nativeadmng";
36
36
  #elif UNITY_ANDROID
37
37
  return "/" + AppId + "/nativead";
38
38
  #endif
@@ -127,7 +127,6 @@ namespace Azerion.BlueStack.Example
127
127
  if (!this.nativeAd.RegisterBodyTextGameObject(this.body))
128
128
  {
129
129
  Debug.Log("RegisterBodyTextGameObject Unsuccessful");
130
-
131
130
  }
132
131
  }
133
132
 
@@ -161,7 +160,7 @@ namespace Azerion.BlueStack.Example
161
160
  }
162
161
  }
163
162
 
164
- private void RequestNativeAd()
163
+ public void RequestNativeAd()
165
164
  {
166
165
  Debug.Log("NativeAdManager: Requesting Ad!");
167
166
  NativeAdLoader nativeAdLoader = new NativeAdLoader(NativeAdUnitId);
@@ -1,5 +1,5 @@
1
1
  fileFormatVersion: 2
2
- guid: 505fa3b888bfa43f994c430c74b494b3
2
+ guid: 0ef5e1c8c3bad4e478a34254a658d3bc
3
3
  PluginImporter:
4
4
  externalObjects: {}
5
5
  serializedVersion: 2
@@ -101,14 +101,22 @@ void BSUDestroyBannerAd(BSUTypeBannerRef banner);
101
101
 
102
102
  // Native Ad
103
103
  void BSUSetNativeAdCallbacks(BSUTypeNativeAdRef nativeAd,
104
- BSUOnNativeAdDidLoadCallback
105
- onDidLoadCallback,
106
- BSUOnNativeAdDidFailCallback
107
- onDidFailCallback);
104
+ BSUOnNativeAdDidLoadCallback
105
+ onDidLoadCallback,
106
+ BSUOnNativeAdDidFailCallback
107
+ onDidFailCallback,
108
+ BSUOnNativeAdDidRecordImpressionCallback
109
+ onRecordImpressionCallback,
110
+ BSUOnNativeAdDidPerformClickCallback
111
+ onPerformClickCallback,
112
+ BSUOnNativeAdCloseCallback
113
+ onCloseCallback);
108
114
  BSUTypeNativeAdRef BSUCreateNativeAd(BSUTypeNativeAdClientRef *nativeAdClient, const char *placementId);
109
115
  void BSULoadNativeAd(BSUTypeNativeAdRef nativeAd);
110
116
  void BSULoadNativeAdWithPreference(BSUTypeNativeAdRef nativeAd, BSUTypePreferenceRef preferenceRef);
111
117
  const char *BSUNativeAdGetTitle(BSUTypeNativeAdRef nativeAd);
112
118
  const char *BSUNativeAdGetBodyText(BSUTypeNativeAdRef nativeAd);
113
119
  const char *BSUNativeAdGetCTAText(BSUTypeNativeAdRef nativeAd);
120
+ void BSURecordImpression(BSUTypeNativeAdRef nativeAd);
121
+ void BSUPerformClick(BSUTypeNativeAdRef nativeAd);
114
122
  void BSUDestroyNativeAd(BSUTypeNativeAdRef nativeAd);
@@ -58,7 +58,10 @@ void BSUInitializeWithCallback(BSUTypeMobileAdsClientRef *mobileAdsClientRef, co
58
58
  NSString *appIdString = BSUStringFromUTF8String(appId);
59
59
  BSUSettings *settings = (__bridge BSUSettings *)settingsRef;
60
60
  NSLog(@"BSUInitializeWithCallback called for %@",appIdString);
61
- [[BSUInitializer sharedInstance] prepareBlueStackSDKWithAppId:appIdString withSettings:settings
61
+ // set the client as CrossPlatform
62
+ [[NSUserDefaults standardUserDefaults] setBool: YES forKey:@"IsCrossPlatformNativeAd"];
63
+
64
+ [[BSUInitializer sharedInstance] prepareBlueStackSDKWithAppId:appIdString withSettings:settings
62
65
  withSDKCompletionHandler:^(BOOL success, NSError *error) {
63
66
  NSLog(@"BSUInitializeWithCallback withCompletionHandler");
64
67
  sdkInitCallback(mobileAdsClientRef, success, (__bridge BSUTypeErrorRef)error);
@@ -370,13 +373,22 @@ void BSUDestroyBannerAd(BSUTypeBannerRef banner) {
370
373
  #pragma mark Native Ad
371
374
 
372
375
  void BSUSetNativeAdCallbacks(BSUTypeNativeAdRef nativeAd,
373
- BSUOnNativeAdDidLoadCallback
374
- onDidLoadCallback,
375
- BSUOnNativeAdDidFailCallback
376
- onDidFailCallback) {
376
+ BSUOnNativeAdDidLoadCallback
377
+ onDidLoadCallback,
378
+ BSUOnNativeAdDidFailCallback
379
+ onDidFailCallback,
380
+ BSUOnNativeAdDidRecordImpressionCallback
381
+ onRecordImpressionCallback,
382
+ BSUOnNativeAdDidPerformClickCallback
383
+ onPerformClickCallback,
384
+ BSUOnNativeAdCloseCallback
385
+ onCloseCallback) {
377
386
  BSUNativeAd *internalNativeAd = (__bridge BSUNativeAd *)nativeAd;
378
387
  internalNativeAd.onDidLoadCallback = onDidLoadCallback;
379
388
  internalNativeAd.onDidFailCallback = onDidFailCallback;
389
+ internalNativeAd.onRecordImpressionCallback = onRecordImpressionCallback;
390
+ internalNativeAd.onPerformClickCallback = onPerformClickCallback;
391
+ internalNativeAd.onCloseCallback = onCloseCallback;
380
392
  }
381
393
 
382
394
  BSUTypeNativeAdRef BSUCreateNativeAd(BSUTypeNativeAdClientRef *nativeAdClient, const char *placementId) {
@@ -439,6 +451,18 @@ const char *BSUNativeAdGetClickUrl(BSUTypeNativeAdRef nativeAd) {
439
451
  return cStringCopy(internalNativeAd.clickUrl.UTF8String);
440
452
  }
441
453
 
454
+ void BSURecordImpression(BSUTypeNativeAdRef nativeAd) {
455
+ BSUNativeAd *internalNativeAd = (__bridge BSUNativeAd *)nativeAd;
456
+ NSDictionary *emptyDictionary = [NSDictionary dictionary]; // for later implementation
457
+ [internalNativeAd recordImpression:emptyDictionary];
458
+ }
459
+
460
+ void BSUPerformClick(BSUTypeNativeAdRef nativeAd) {
461
+ BSUNativeAd *internalNativeAd = (__bridge BSUNativeAd *)nativeAd;
462
+ NSDictionary *emptyDictionary = [NSDictionary dictionary]; // for later implementation
463
+ [internalNativeAd performClick:emptyDictionary];
464
+ }
465
+
442
466
  void BSUDestroyNativeAd(BSUTypeNativeAdRef nativeAd) {
443
467
  BSUNativeAd *internalNativeAd = (__bridge BSUNativeAd *)nativeAd;
444
468
  [internalNativeAd destroy];
@@ -1,6 +1,7 @@
1
1
  #import <Foundation/Foundation.h>
2
2
  #import <CoreGraphics/CoreGraphics.h>
3
3
  #import "BSUTypes.h"
4
+ #import "BlueStackSDK/MNGNAtiveObject.h"
4
5
 
5
6
  @interface BSUNativeAd : NSObject
6
7
 
@@ -10,10 +11,13 @@ NS_ASSUME_NONNULL_BEGIN
10
11
  placementId:(NSString *_Nullable)placementId;
11
12
 
12
13
  @property(nonatomic, assign) BSUTypeNativeAdClientRef * _Nonnull nativeAdClient;
14
+ @property(nonatomic, assign) MNGNAtiveObject *nativeAdsObject;
13
15
 
14
16
  @property(nonatomic, assign) BSUOnNativeAdDidLoadCallback onDidLoadCallback;
15
-
16
17
  @property(nonatomic, assign) BSUOnNativeAdDidFailCallback onDidFailCallback;
18
+ @property(nonatomic, assign) BSUOnNativeAdDidRecordImpressionCallback onRecordImpressionCallback;
19
+ @property(nonatomic, assign) BSUOnNativeAdDidPerformClickCallback onPerformClickCallback;
20
+ @property(nonatomic, assign) BSUOnNativeAdCloseCallback onCloseCallback;
17
21
 
18
22
  @property (nonatomic, retain) NSString *title;
19
23
  @property (nonatomic, retain) NSString *body;
@@ -27,6 +31,8 @@ NS_ASSUME_NONNULL_END
27
31
 
28
32
  - (void)loadAd;
29
33
  - (void)loadAdWithPreference:(BSUTypePreferenceRef)preferenceRef;
34
+ - (void)recordImpression:(nonnull NSDictionary *)args;
35
+ - (void)performClick:(nonnull NSDictionary *)args;
30
36
  - (void)destroy;
31
37
 
32
38
  @end
@@ -38,10 +38,34 @@
38
38
  }
39
39
  }
40
40
 
41
+ - (void)recordImpression:(nonnull NSDictionary *)args {
42
+ if (self.nativeAdsObject) {
43
+ // [self.nativeAdsObject recordImpression:args];
44
+
45
+ if (self.onRecordImpressionCallback) {
46
+ self.onRecordImpressionCallback(self.nativeAdClient); // TODO : Should be verified and triggered from core sdk
47
+ }
48
+ }
49
+ }
50
+
51
+ - (void)performClick:(nonnull NSDictionary *)args {
52
+ if (self.nativeAdsObject) {
53
+ // [self.nativeAdsObject performClick:args];
54
+
55
+ if (self.onPerformClickCallback) {
56
+ self.onPerformClickCallback(self.nativeAdClient); // TODO : Should be verified and triggered from core sdk
57
+ }
58
+ }
59
+ }
60
+
41
61
  - (void)destroy {
42
62
  if (self.nativeAdsFactory) {
43
63
  [self.nativeAdsFactory releaseMemory];
44
64
  self.nativeAdsFactory = nil;
65
+
66
+ if (self.onCloseCallback) {
67
+ self.onCloseCallback(self.nativeAdClient);
68
+ }
45
69
  }
46
70
  }
47
71
 
@@ -56,18 +80,19 @@
56
80
  -(void)adsAdapter:(MNGAdsAdapter *)adsAdapter nativeObjectDidLoad:(MNGNAtiveObject *)nativeObject{
57
81
  NSLog(@"adsAdapterNativeObjectDidLoad:");
58
82
  if (self.onDidLoadCallback != nil) {
83
+ self.nativeAdsObject = nativeObject;
59
84
  self.title = nativeObject.title;
60
85
  self.body = nativeObject.body;
61
86
  self.badge = @"Ad"; //nativeObject.badge;
62
87
  self.callToAction = nativeObject.callToAction;
63
88
  self.clickUrl = @"https://developers.bluestack.app/"; //nativeObject.clickUrl;
64
89
  self.iconUrl = @"https://creative.mng-ads.com/10/10394-15539.jpg"; //nativeObject.iconUrl;
65
- self.coverImageUrl = @"https://creative.mng-ads.com/10/10394-15540.jpg"; //nativeObject.coverImageUrl;
90
+ self.coverImageUrl = @"https://creative.mng-ads.com/10/10394-15540.jpg"; //nativeObject.coverImageUrl;
66
91
 
67
92
  self.onDidLoadCallback(self.nativeAdClient);
68
93
  }
69
94
 
70
- // //possibility to customize the badge title
95
+ // possibility to customize the badge title
71
96
  // [nativeObject updateBadgeTitle:@"Publicité"];
72
97
  // badgeView = nativeObject.badgeView;
73
98
  // [_nativeObject registerViewForInteraction:self.nativeView withMediaView:self.backgroundImage withIconImageView:self.iconeImage withViewController:[APP_DELEGATE drawerViewController] withClickableView:self.callToActionButton];
@@ -79,4 +104,19 @@
79
104
  }
80
105
  }
81
106
 
107
+ #pragma mark MNGClickDelegate
108
+
109
+ -(void)adsAdapterNativeAdWasClicked:(MNGAdsAdapter *)adsAdapter nativeObjectClicked:(MNGNAtiveObject *)clickedAdView{
110
+ NSLog(@"BSUNativeAd: MNGClickDelegate: nativeObjectClicked!");
111
+ if (self.onPerformClickCallback) {
112
+ self.onPerformClickCallback(self.nativeAdClient);
113
+ }
114
+ }
115
+
116
+ //- (void)adsAdapterAdWasClicked:(MNGAdsAdapter *)adsAdapter {
117
+ // if (self.onAdClickedCallback) {
118
+ // self.onAdClickedCallback(self.bannerClient);
119
+ // }
120
+ //}
121
+
82
122
  @end
@@ -97,3 +97,9 @@ typedef void (*BSUOnNativeAdDidLoadCallback)(BSUTypeNativeAdClientRef *nativeAdC
97
97
 
98
98
  typedef void (*BSUOnNativeAdDidFailCallback)(
99
99
  BSUTypeNativeAdClientRef *nativeAdClient, BSUTypeErrorRef error);
100
+
101
+ typedef void (*BSUOnNativeAdDidRecordImpressionCallback)(BSUTypeNativeAdClientRef *nativeAdClient);
102
+
103
+ typedef void (*BSUOnNativeAdDidPerformClickCallback)(BSUTypeNativeAdClientRef *nativeAdClient);
104
+
105
+ typedef void (*BSUOnNativeAdCloseCallback)(BSUTypeNativeAdClientRef *nativeAdClient);
@@ -58,7 +58,8 @@ namespace Azerion.BlueStack.API.Banner
58
58
 
59
59
  public void Load(AdSize adSize)
60
60
  {
61
- _bannerAdClient.Load(adSize: adSize);
61
+ Preference preference = new Preference();
62
+ _bannerAdClient.Load(adSize, preference.getIPreferenceClient());
62
63
  }
63
64
 
64
65
  public void Load(AdSize adSize, Preference preference)
@@ -40,7 +40,8 @@ namespace Azerion.BlueStack.API
40
40
 
41
41
  public void Load()
42
42
  {
43
- _interstitialAdClient.Load();
43
+ Preference preference = new Preference();
44
+ _interstitialAdClient.Load(preference.getIPreferenceClient());
44
45
  }
45
46
 
46
47
  public void Load(Preference preference)
@@ -14,12 +14,13 @@ namespace Azerion.BlueStack.API
14
14
  private Texture2D _imageTexture;
15
15
  private bool _isTextureLoaded;
16
16
 
17
- public event EventHandler<EventArgs> OnNativeAdDidLoad;
18
- public event EventHandler<BlueStackError> OnNativeAdDidFail;
17
+ internal event EventHandler<EventArgs> OnNativeAdDidLoad;
18
+ internal event EventHandler<BlueStackError> OnNativeAdDidFail;
19
+ internal event EventHandler<EventArgs> OnNativeAdOpening;
20
+ internal event EventHandler<EventArgs> OnNativeAdClosed;
21
+
19
22
  public event EventHandler<EventArgs> OnNativeAdImpression;
20
23
  public event EventHandler<EventArgs> OnNativeAdClicked;
21
- public event EventHandler<EventArgs> OnNativeAdOpening;
22
- public event EventHandler<EventArgs> OnNativeAdClosed;
23
24
 
24
25
  private NativeAdInteractionHandler _nativeAdInteractionHandler;
25
26
 
@@ -35,7 +36,7 @@ namespace Azerion.BlueStack.API
35
36
  _nativeAdClient.Create(placementId);
36
37
  ConfigureEvents();
37
38
  InitializeTextures();
38
- _nativeAdInteractionHandler = new NativeAdInteractionHandler();
39
+ _nativeAdInteractionHandler = new NativeAdInteractionHandler(_nativeAdClient);
39
40
  }
40
41
 
41
42
  private void ConfigureEvents()
@@ -48,14 +49,19 @@ namespace Azerion.BlueStack.API
48
49
  SetClickUrl();
49
50
  };
50
51
  _nativeAdClient.OnNativeAdDidFail += (sender, args) => { OnNativeAdDidFail?.Invoke(this, args); };
52
+ _nativeAdClient.OnNativeAdImpression += (sender, args) => { OnNativeAdImpression?.Invoke(this, args); };
53
+ _nativeAdClient.OnNativeAdClicked += (sender, args) => { OnNativeAdClicked?.Invoke(this, args); };
54
+ _nativeAdClient.OnNativeAdClosed += (sender, args) => { OnNativeAdClosed?.Invoke(this, args); };
55
+
51
56
  }
52
57
 
53
- public void Load()
58
+ internal void Load()
54
59
  {
55
- _nativeAdClient.Load();
60
+ Preference preference = new Preference();
61
+ _nativeAdClient.Load(preference.getIPreferenceClient());
56
62
  }
57
63
 
58
- public void Load(Preference preference)
64
+ internal void Load(Preference preference)
59
65
  {
60
66
  _nativeAdClient.Load(preference.getIPreferenceClient());
61
67
  }
@@ -130,6 +136,16 @@ namespace Azerion.BlueStack.API
130
136
  return this._imageTexture;
131
137
  }
132
138
 
139
+ // public void RecordImpression()
140
+ // {
141
+ // _nativeAdClient.RecordImpression();
142
+ // }
143
+ //
144
+ // public void PerformClick()
145
+ // {
146
+ // _nativeAdClient.PerformClick();
147
+ // }
148
+
133
149
  private void SetClickUrl()
134
150
  {
135
151
  _nativeAdInteractionHandler.SetClickUrl(_nativeAdClient.GetClickUrl());
@@ -164,9 +180,8 @@ namespace Azerion.BlueStack.API
164
180
  {
165
181
  return _nativeAdInteractionHandler.RegisterAdvertiserTextGameObject(gameObject);
166
182
  }
167
-
168
183
 
169
- public void Destroy()
184
+ internal void Destroy()
170
185
  {
171
186
  _nativeAdClient.Destroy();
172
187
  }