com.azerion.bluestack 3.0.0-preview1 → 3.0.0-preview3
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.
- package/Editor/BlueStackDependencies.xml +2 -2
- package/Example/Prefabs/NativeAd.prefab +4 -4
- package/Example/Scripts/NativeAdManager.cs +15 -14
- package/Example/Scripts/SmallNativeAdManager.cs +12 -10
- package/Plugins/Android/bluestack-unity-android-bridge-2.0.0-preview1.aar +0 -0
- package/Plugins/iOS/BSUInterface.h +12 -4
- package/Plugins/iOS/BSUInterface.m +27 -5
- package/Plugins/iOS/BSUNativeAd.h +7 -1
- package/Plugins/iOS/BSUNativeAd.m +43 -3
- package/Plugins/iOS/BSUTypes.h +6 -0
- package/Runtime/API/Banner/BannerAd.cs +2 -1
- package/Runtime/API/InterstitialAd.cs +2 -1
- package/Runtime/API/NativeAd/NativeAd.cs +24 -8
- package/Runtime/API/NativeAd/NativeAdInteractionHandler.cs +38 -18
- package/Runtime/API/NativeAd/NativeAdInteractionUtils.cs +2 -4
- package/Runtime/API/NativeAd/NativeAdLoader.cs +57 -0
- package/Runtime/API/NativeAd/NativeAdObject.cs +67 -46
- package/Runtime/API/Rewarded/RewardedVideoAd.cs +2 -1
- package/Runtime/Internal/NativeAd/INativeAdClient.cs +7 -1
- package/Runtime/Platforms/Android/BlueStackClient.cs +1 -2
- package/Runtime/Platforms/Android/NativeAdClient.cs +33 -6
- package/Runtime/Platforms/Unity/NativeAdClient.cs +27 -1
- package/Runtime/Platforms/iOS/Externs.cs +11 -2
- package/Runtime/Platforms/iOS/NativeAdClient.cs +53 -4
- package/package.json +1 -1
- package/Runtime/API/NativeAd/AdLoader.cs +0 -135
- /package/Runtime/API/NativeAd/{AdLoader.cs.meta → NativeAdLoader.cs.meta} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<dependencies>
|
|
2
2
|
<androidPackages>
|
|
3
|
-
<androidPackage spec="com.azerion:bluestack-sdk-core:4.2.
|
|
3
|
+
<androidPackage spec="com.azerion:bluestack-sdk-core:4.2.10" />
|
|
4
4
|
</androidPackages>
|
|
5
5
|
<iosPods>
|
|
6
|
-
<iosPod name="BlueStack-SDK" version="4.
|
|
6
|
+
<iosPod name="BlueStack-SDK" version="4.3.0-preview.1" bitcodeEnabled="false"
|
|
7
7
|
addToAllTargets="false"/>
|
|
8
8
|
</iosPods>
|
|
9
9
|
</dependencies>
|
|
@@ -206,7 +206,7 @@ RectTransform:
|
|
|
206
206
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
207
207
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
|
208
208
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
|
209
|
-
m_AnchoredPosition: {x: 0, y:
|
|
209
|
+
m_AnchoredPosition: {x: 0, y: 241}
|
|
210
210
|
m_SizeDelta: {x: 1040, y: 1040}
|
|
211
211
|
m_Pivot: {x: 0.5, y: 0.5}
|
|
212
212
|
--- !u!222 &5666620918374091933
|
|
@@ -801,13 +801,13 @@ BoxCollider2D:
|
|
|
801
801
|
m_PrefabInstance: {fileID: 0}
|
|
802
802
|
m_PrefabAsset: {fileID: 0}
|
|
803
803
|
m_GameObject: {fileID: 5666620919071030920}
|
|
804
|
-
m_Enabled:
|
|
804
|
+
m_Enabled: 1
|
|
805
805
|
m_Density: 1
|
|
806
806
|
m_Material: {fileID: 0}
|
|
807
807
|
m_IsTrigger: 0
|
|
808
808
|
m_UsedByEffector: 0
|
|
809
809
|
m_UsedByComposite: 0
|
|
810
|
-
m_Offset: {x: 100
|
|
810
|
+
m_Offset: {x: 100, y: -100}
|
|
811
811
|
m_SpriteTilingProperty:
|
|
812
812
|
border: {x: 0, y: 0, z: 0, w: 0}
|
|
813
813
|
pivot: {x: 0, y: 0}
|
|
@@ -818,7 +818,7 @@ BoxCollider2D:
|
|
|
818
818
|
adaptiveTiling: 0
|
|
819
819
|
m_AutoTiling: 0
|
|
820
820
|
serializedVersion: 2
|
|
821
|
-
m_Size: {x:
|
|
821
|
+
m_Size: {x: 200, y: 200}
|
|
822
822
|
m_EdgeRadius: 0
|
|
823
823
|
--- !u!1 &5666620919168347859
|
|
824
824
|
GameObject:
|
|
@@ -32,7 +32,7 @@ namespace Azerion.BlueStack.Example
|
|
|
32
32
|
get
|
|
33
33
|
{
|
|
34
34
|
#if UNITY_IOS
|
|
35
|
-
return "/" + AppId + "/
|
|
35
|
+
return "/" + AppId + "/nativeadmng";
|
|
36
36
|
#elif UNITY_ANDROID
|
|
37
37
|
return "/" + AppId + "/nativead";
|
|
38
38
|
#endif
|
|
@@ -53,7 +53,7 @@ namespace Azerion.BlueStack.Example
|
|
|
53
53
|
|
|
54
54
|
Settings settings = new Settings(isDebugModeEnabled: true);
|
|
55
55
|
BlueStackAds.Initialize(AppId, settings, HandleSDKInitCompleteAction);
|
|
56
|
-
_preference =
|
|
56
|
+
_preference = CreatePreference();
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
private void HandleSDKInitCompleteAction(SDKInitializationStatus sdkInitializationStatus)
|
|
@@ -74,13 +74,14 @@ namespace Azerion.BlueStack.Example
|
|
|
74
74
|
|
|
75
75
|
|
|
76
76
|
// Update is called once per frame
|
|
77
|
-
void
|
|
77
|
+
void Update()
|
|
78
78
|
{
|
|
79
|
-
Debug.Log("NativeAdManager: RegisterGameObjects");
|
|
80
79
|
if (this.unifiedNativeAdLoaded)
|
|
81
80
|
{
|
|
82
81
|
this.unifiedNativeAdLoaded = false;
|
|
83
|
-
|
|
82
|
+
|
|
83
|
+
Debug.Log("NativeAdManager: RegisterGameObjects");
|
|
84
|
+
|
|
84
85
|
// badge
|
|
85
86
|
string badgeText = this.nativeAd.GetBadge();
|
|
86
87
|
if (badgeText != null)
|
|
@@ -130,7 +131,7 @@ namespace Azerion.BlueStack.Example
|
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
133
|
|
|
133
|
-
// Main/Cover
|
|
134
|
+
// Main/Cover Image
|
|
134
135
|
Texture2D imageTexture = this.nativeAd.GetCoverImageTexture();
|
|
135
136
|
if (imageTexture != null)
|
|
136
137
|
{
|
|
@@ -160,16 +161,16 @@ namespace Azerion.BlueStack.Example
|
|
|
160
161
|
}
|
|
161
162
|
}
|
|
162
163
|
|
|
163
|
-
|
|
164
|
+
public void RequestNativeAd()
|
|
164
165
|
{
|
|
165
166
|
Debug.Log("NativeAdManager: Requesting Ad!");
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
167
|
+
NativeAdLoader nativeAdLoader = new NativeAdLoader(NativeAdUnitId);
|
|
168
|
+
nativeAdLoader.OnNativeAdLoaded += this.HandleNativeAdLoaded;
|
|
169
|
+
nativeAdLoader.OnNativeAdFailedToLoad += this.HandleNativeNativeAdFailedToLoad;
|
|
170
|
+
nativeAdLoader.Load();
|
|
170
171
|
}
|
|
171
172
|
|
|
172
|
-
private void
|
|
173
|
+
private void HandleNativeNativeAdFailedToLoad(object sender, BlueStackError args)
|
|
173
174
|
{
|
|
174
175
|
Debug.Log("BlueStack NativeAd failed to load: " + "errorCode: " + args.ErrorCode + " message: " +
|
|
175
176
|
args.Message);
|
|
@@ -180,11 +181,11 @@ namespace Azerion.BlueStack.Example
|
|
|
180
181
|
Debug.Log("NativeAdManager: Unified Native Ad Loaded");
|
|
181
182
|
this.nativeAd = args.nativeAd;
|
|
182
183
|
this.unifiedNativeAdLoaded = true;
|
|
183
|
-
RegisterGameObjects();
|
|
184
|
+
// RegisterGameObjects();
|
|
184
185
|
}
|
|
185
186
|
|
|
186
187
|
|
|
187
|
-
private Preference
|
|
188
|
+
private Preference CreatePreference()
|
|
188
189
|
{
|
|
189
190
|
Preference bsPreference = new Preference();
|
|
190
191
|
|
|
@@ -50,7 +50,7 @@ namespace Azerion.BlueStack.Example
|
|
|
50
50
|
{
|
|
51
51
|
Settings settings = new Settings(isDebugModeEnabled: true);
|
|
52
52
|
BlueStackAds.Initialize(AppId, settings, HandleSDKInitCompleteAction);
|
|
53
|
-
_preference =
|
|
53
|
+
_preference = CreatePreference();
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
private void HandleSDKInitCompleteAction(SDKInitializationStatus sdkInitializationStatus)
|
|
@@ -71,13 +71,15 @@ namespace Azerion.BlueStack.Example
|
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
// Update is called once per frame
|
|
74
|
-
void
|
|
74
|
+
void Update()
|
|
75
75
|
{
|
|
76
|
-
|
|
76
|
+
|
|
77
77
|
if (this.unifiedNativeAdLoaded)
|
|
78
78
|
{
|
|
79
79
|
this.unifiedNativeAdLoaded = false;
|
|
80
80
|
|
|
81
|
+
Debug.Log("NativeAdManager: RegisterGameObjects");
|
|
82
|
+
|
|
81
83
|
// badge
|
|
82
84
|
string badgeText = this.nativeAd.GetBadge();
|
|
83
85
|
if (badgeText != null)
|
|
@@ -135,13 +137,13 @@ namespace Azerion.BlueStack.Example
|
|
|
135
137
|
private void RequestNativeAd()
|
|
136
138
|
{
|
|
137
139
|
Debug.Log("NativeAdManager: Requesting Ad!");
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
NativeAdLoader nativeAdLoader = new NativeAdLoader(NativeAdUnitId);
|
|
141
|
+
nativeAdLoader.OnNativeAdLoaded += this.HandleNativeAdLoaded;
|
|
142
|
+
nativeAdLoader.OnNativeAdFailedToLoad += this.HandleNativeNativeAdFailedToLoad;
|
|
143
|
+
nativeAdLoader.Load();
|
|
142
144
|
}
|
|
143
145
|
|
|
144
|
-
private void
|
|
146
|
+
private void HandleNativeNativeAdFailedToLoad(object sender, BlueStackError args)
|
|
145
147
|
{
|
|
146
148
|
Debug.Log("BlueStack NativeAd failed to load: " + "errorCode: " + args.ErrorCode + " message: " +
|
|
147
149
|
args.Message);
|
|
@@ -152,11 +154,11 @@ namespace Azerion.BlueStack.Example
|
|
|
152
154
|
Debug.Log("NativeAdManager: Unified Native Ad Loaded");
|
|
153
155
|
this.nativeAd = args.nativeAd;
|
|
154
156
|
this.unifiedNativeAdLoaded = true;
|
|
155
|
-
RegisterGameObjects();
|
|
157
|
+
// RegisterGameObjects();
|
|
156
158
|
}
|
|
157
159
|
|
|
158
160
|
|
|
159
|
-
private Preference
|
|
161
|
+
private Preference CreatePreference()
|
|
160
162
|
{
|
|
161
163
|
Preference bsPreference = new Preference();
|
|
162
164
|
|
|
Binary file
|
|
@@ -101,14 +101,22 @@ void BSUDestroyBannerAd(BSUTypeBannerRef banner);
|
|
|
101
101
|
|
|
102
102
|
// Native Ad
|
|
103
103
|
void BSUSetNativeAdCallbacks(BSUTypeNativeAdRef nativeAd,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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,7 @@ 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
|
+
[[BSUInitializer sharedInstance] prepareBlueStackSDKWithAppId:appIdString withSettings:settings
|
|
62
62
|
withSDKCompletionHandler:^(BOOL success, NSError *error) {
|
|
63
63
|
NSLog(@"BSUInitializeWithCallback withCompletionHandler");
|
|
64
64
|
sdkInitCallback(mobileAdsClientRef, success, (__bridge BSUTypeErrorRef)error);
|
|
@@ -370,16 +370,26 @@ void BSUDestroyBannerAd(BSUTypeBannerRef banner) {
|
|
|
370
370
|
#pragma mark Native Ad
|
|
371
371
|
|
|
372
372
|
void BSUSetNativeAdCallbacks(BSUTypeNativeAdRef nativeAd,
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
373
|
+
BSUOnNativeAdDidLoadCallback
|
|
374
|
+
onDidLoadCallback,
|
|
375
|
+
BSUOnNativeAdDidFailCallback
|
|
376
|
+
onDidFailCallback,
|
|
377
|
+
BSUOnNativeAdDidRecordImpressionCallback
|
|
378
|
+
onRecordImpressionCallback,
|
|
379
|
+
BSUOnNativeAdDidPerformClickCallback
|
|
380
|
+
onPerformClickCallback,
|
|
381
|
+
BSUOnNativeAdCloseCallback
|
|
382
|
+
onCloseCallback) {
|
|
377
383
|
BSUNativeAd *internalNativeAd = (__bridge BSUNativeAd *)nativeAd;
|
|
378
384
|
internalNativeAd.onDidLoadCallback = onDidLoadCallback;
|
|
379
385
|
internalNativeAd.onDidFailCallback = onDidFailCallback;
|
|
386
|
+
internalNativeAd.onRecordImpressionCallback = onRecordImpressionCallback;
|
|
387
|
+
internalNativeAd.onPerformClickCallback = onPerformClickCallback;
|
|
388
|
+
internalNativeAd.onCloseCallback = onCloseCallback;
|
|
380
389
|
}
|
|
381
390
|
|
|
382
391
|
BSUTypeNativeAdRef BSUCreateNativeAd(BSUTypeNativeAdClientRef *nativeAdClient, const char *placementId) {
|
|
392
|
+
[[NSUserDefaults standardUserDefaults] setBool: YES forKey:@"IsCrossPlatformNativeAd"];
|
|
383
393
|
NSString *placementIdStr = BSUStringFromUTF8String(placementId);
|
|
384
394
|
BSUNativeAd *internalNativeAd = [[BSUNativeAd alloc] initWithNativeAdClientReference:nativeAdClient placementId:placementIdStr];
|
|
385
395
|
BSUObjectCache *cache = [BSUObjectCache sharedInstance];
|
|
@@ -439,6 +449,18 @@ const char *BSUNativeAdGetClickUrl(BSUTypeNativeAdRef nativeAd) {
|
|
|
439
449
|
return cStringCopy(internalNativeAd.clickUrl.UTF8String);
|
|
440
450
|
}
|
|
441
451
|
|
|
452
|
+
void BSURecordImpression(BSUTypeNativeAdRef nativeAd) {
|
|
453
|
+
BSUNativeAd *internalNativeAd = (__bridge BSUNativeAd *)nativeAd;
|
|
454
|
+
NSDictionary *emptyDictionary = [NSDictionary dictionary]; // for later implementation
|
|
455
|
+
[internalNativeAd recordImpression:emptyDictionary];
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
void BSUPerformClick(BSUTypeNativeAdRef nativeAd) {
|
|
459
|
+
BSUNativeAd *internalNativeAd = (__bridge BSUNativeAd *)nativeAd;
|
|
460
|
+
NSDictionary *emptyDictionary = [NSDictionary dictionary]; // for later implementation
|
|
461
|
+
[internalNativeAd performClick:emptyDictionary];
|
|
462
|
+
}
|
|
463
|
+
|
|
442
464
|
void BSUDestroyNativeAd(BSUTypeNativeAdRef nativeAd) {
|
|
443
465
|
BSUNativeAd *internalNativeAd = (__bridge BSUNativeAd *)nativeAd;
|
|
444
466
|
[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
|
-
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;
|
|
89
|
+
self.iconUrl = @"https://creative.mng-ads.com/10/10394-15539.jpg"; //nativeObject.iconUrl; //
|
|
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
|
-
//
|
|
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
|
package/Plugins/iOS/BSUTypes.h
CHANGED
|
@@ -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
|
-
|
|
61
|
+
Preference preference = new Preference();
|
|
62
|
+
_bannerAdClient.Load(adSize, preference.getIPreferenceClient());
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
public void Load(AdSize adSize, Preference preference)
|
|
@@ -14,12 +14,13 @@ namespace Azerion.BlueStack.API
|
|
|
14
14
|
private Texture2D _imageTexture;
|
|
15
15
|
private bool _isTextureLoaded;
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
58
|
+
internal void Load()
|
|
54
59
|
{
|
|
55
|
-
|
|
60
|
+
Preference preference = new Preference();
|
|
61
|
+
_nativeAdClient.Load(preference.getIPreferenceClient());
|
|
56
62
|
}
|
|
57
63
|
|
|
58
|
-
|
|
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());
|
|
@@ -2,24 +2,25 @@ using System;
|
|
|
2
2
|
using System.Collections.Generic;
|
|
3
3
|
using Azerion.BlueStack.Common;
|
|
4
4
|
using Azerion.BlueStack.Internal;
|
|
5
|
-
using Castle.Components.DictionaryAdapter.Xml;
|
|
6
5
|
using UnityEngine;
|
|
7
6
|
|
|
8
7
|
namespace Azerion.BlueStack.API
|
|
9
8
|
{
|
|
10
9
|
public class NativeAdInteractionHandler
|
|
11
10
|
{
|
|
11
|
+
private INativeAdClient _nativeAdClient;
|
|
12
12
|
private List<NativeAdObject> _nativeAdObjects;
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
private INativeAdInteractionHandlerClient _nativeAdInteractionHandlerClient;
|
|
15
15
|
|
|
16
16
|
// public NativeAdInteractionHandler(INativeAdInteractionHandlerClient interactionHandlerClient)
|
|
17
17
|
|
|
18
18
|
private string _clickUrl;
|
|
19
|
-
public NativeAdInteractionHandler()
|
|
19
|
+
public NativeAdInteractionHandler(INativeAdClient nativeAdClient)
|
|
20
20
|
{
|
|
21
21
|
// _nativeAdInteractionHandlerClient = interactionHandlerClient;
|
|
22
22
|
_nativeAdObjects = new List<NativeAdObject>();
|
|
23
|
+
_nativeAdClient = nativeAdClient;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
public bool RegisterImageGameObjects(GameObject gameObject)
|
|
@@ -112,17 +113,28 @@ namespace Azerion.BlueStack.API
|
|
|
112
113
|
{
|
|
113
114
|
impressionComplete = true;
|
|
114
115
|
Debug.LogWarning("Impression Complete");
|
|
115
|
-
|
|
116
|
+
|
|
116
117
|
if (sender is NativeAdObject nativeAdObject)
|
|
117
118
|
{
|
|
118
|
-
|
|
119
|
+
_nativeAdClient.RecordImpression();
|
|
120
|
+
_nativeAdClient.OnNativeAdImpression += (sender, args) =>
|
|
119
121
|
{
|
|
122
|
+
Debug.LogWarning("InteractionHandlerClient: OnNativeAdImpression!");
|
|
120
123
|
foreach (NativeAdObject adObject in _nativeAdObjects)
|
|
121
124
|
{
|
|
122
125
|
if(adObject != null)
|
|
123
126
|
adObject.StopImpressionCheck();
|
|
124
127
|
}
|
|
125
|
-
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// if (_nativeAdInteractionHandlerClient.RecordImpression(NativeAdInteractionUtils.CreateImpressionSignal(nativeAdObject, _nativeAdObjects)))
|
|
131
|
+
// {
|
|
132
|
+
// foreach (NativeAdObject adObject in _nativeAdObjects)
|
|
133
|
+
// {
|
|
134
|
+
// if(adObject != null)
|
|
135
|
+
// adObject.StopImpressionCheck();
|
|
136
|
+
// }
|
|
137
|
+
// }
|
|
126
138
|
}
|
|
127
139
|
}
|
|
128
140
|
|
|
@@ -130,20 +142,28 @@ namespace Azerion.BlueStack.API
|
|
|
130
142
|
private void RecordClick(object sender, ClickEventArgs clickEventArgs)
|
|
131
143
|
{
|
|
132
144
|
// clickComplete = true;
|
|
133
|
-
Debug.Log("Record Click");
|
|
134
|
-
|
|
145
|
+
Debug.Log("Record Click!");
|
|
146
|
+
// Debug.Log("Record Click: " + NativeAdInteractionUtils.BuildVersionString(NativeUtils.Version));
|
|
147
|
+
|
|
135
148
|
if (sender is NativeAdObject nativeAdObject)
|
|
136
149
|
{
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
//
|
|
145
|
-
|
|
146
|
-
|
|
150
|
+
_nativeAdClient.OnNativeAdClicked += (sender, args) =>
|
|
151
|
+
{
|
|
152
|
+
OpenURL();
|
|
153
|
+
Debug.LogWarning("InteractionHandlerClient: OnNativeAdClicked!");
|
|
154
|
+
};
|
|
155
|
+
_nativeAdClient.PerformClick();
|
|
156
|
+
|
|
157
|
+
// Dictionary<string, string> touchEventSignal =
|
|
158
|
+
// NativeAdInteractionUtils.CreateTouchEventSignal(clickEventArgs.startClick, clickEventArgs.endClick);
|
|
159
|
+
// Dictionary<string, object> clickSignal =
|
|
160
|
+
// NativeAdInteractionUtils.CreateClickSignal(nativeAdObject, _nativeAdObjects, clickEventArgs.startClick, clickEventArgs.endClick);
|
|
161
|
+
//
|
|
162
|
+
// // _nativeAdInteractionHandlerClient.ReportTouchEvent(touchEventSignal);
|
|
163
|
+
// Debug.LogWarning("InteractionHandlerClient: ReportTouchEvent!");
|
|
164
|
+
// // _nativeAdInteractionHandlerClient.PerformClick(clickSignal);
|
|
165
|
+
// Debug.LogWarning("InteractionHandlerClient: PerformClick!");
|
|
166
|
+
// OpenURL();
|
|
147
167
|
}
|
|
148
168
|
}
|
|
149
169
|
|
|
@@ -3,8 +3,6 @@ using System.Collections.Generic;
|
|
|
3
3
|
using System.Globalization;
|
|
4
4
|
using System.Text;
|
|
5
5
|
using Azerion.BlueStack.Common;
|
|
6
|
-
using Azerion.BlueStack.Internal;
|
|
7
|
-
using Castle.Components.DictionaryAdapter.Xml;
|
|
8
6
|
using UnityEngine;
|
|
9
7
|
|
|
10
8
|
// incomplete
|
|
@@ -74,7 +72,7 @@ namespace Azerion.BlueStack.API
|
|
|
74
72
|
return hash.ToString();
|
|
75
73
|
}
|
|
76
74
|
|
|
77
|
-
private static string GetHashedString(string text, string
|
|
75
|
+
private static string GetHashedString(string text, string key = "")
|
|
78
76
|
{
|
|
79
77
|
if (String.IsNullOrEmpty(text))
|
|
80
78
|
{
|
|
@@ -85,7 +83,7 @@ namespace Azerion.BlueStack.API
|
|
|
85
83
|
using (var sha = new System.Security.Cryptography.SHA256Managed())
|
|
86
84
|
{
|
|
87
85
|
// Convert the string to a byte array first, to be processed
|
|
88
|
-
byte[] textBytes = System.Text.Encoding.UTF8.GetBytes(text +
|
|
86
|
+
byte[] textBytes = System.Text.Encoding.UTF8.GetBytes(text + key);
|
|
89
87
|
byte[] hashBytes = sha.ComputeHash(textBytes);
|
|
90
88
|
|
|
91
89
|
// Convert back to a string, removing the '-' that BitConverter adds
|