com.azerion.bluestack 2.0.1 → 3.0.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 (98) hide show
  1. package/Editor/BlueStackDependencies.xml +1 -1
  2. package/Example/Azerion.BlueStack.Example.asmdef +16 -0
  3. package/Example/Azerion.BlueStack.Example.asmdef.meta +7 -0
  4. package/Example/Prefabs/NativeAd.prefab +908 -0
  5. package/Example/Prefabs/NativeAd.prefab.meta +7 -0
  6. package/Example/Prefabs/SmallNativeAd.prefab +739 -0
  7. package/Example/Prefabs/SmallNativeAd.prefab.meta +7 -0
  8. package/Example/Prefabs.meta +8 -0
  9. package/Example/Scripts/NativeAdManager.cs +208 -0
  10. package/Example/Scripts/NativeAdManager.cs.meta +11 -0
  11. package/Example/Scripts/SmallNativeAdManager.cs +181 -0
  12. package/Example/Scripts/SmallNativeAdManager.cs.meta +11 -0
  13. package/Example/Scripts.meta +8 -0
  14. package/Example.meta +8 -0
  15. package/Plugins/Android/{bluestack-unity-android-bridge-1.0.1.aar → bluestack-unity-android-bridge-2.0.0-preview1.aar} +0 -0
  16. package/Plugins/Android/{bluestack-unity-android-bridge-1.0.1.aar.meta → bluestack-unity-android-bridge-2.0.0-preview1.aar.meta} +1 -1
  17. package/Plugins/iOS/BSUInterface.h +14 -0
  18. package/Plugins/iOS/BSUInterface.m +83 -1
  19. package/Plugins/iOS/BSUNativeAd.h +32 -0
  20. package/Plugins/iOS/BSUNativeAd.h.meta +27 -0
  21. package/Plugins/iOS/BSUNativeAd.m +82 -0
  22. package/Plugins/iOS/BSUNativeAd.m.meta +37 -0
  23. package/Plugins/iOS/BSUTypes.h +12 -0
  24. package/Runtime/API/BlueStackAds.cs +4 -2
  25. package/Runtime/API/NativeAd/NativeAd.cs +182 -0
  26. package/Runtime/API/NativeAd/NativeAd.cs.meta +3 -0
  27. package/Runtime/API/NativeAd/NativeAdEventArgs.cs +14 -0
  28. package/Runtime/API/NativeAd/NativeAdEventArgs.cs.meta +11 -0
  29. package/Runtime/API/NativeAd/NativeAdInteractionHandler.cs +157 -0
  30. package/Runtime/API/NativeAd/NativeAdInteractionHandler.cs.meta +11 -0
  31. package/Runtime/API/NativeAd/NativeAdInteractionUtils.cs +122 -0
  32. package/Runtime/API/NativeAd/NativeAdInteractionUtils.cs.meta +11 -0
  33. package/Runtime/API/NativeAd/NativeAdLoader.cs +57 -0
  34. package/Runtime/API/NativeAd/NativeAdLoader.cs.meta +11 -0
  35. package/Runtime/API/NativeAd/NativeAdObject.cs +520 -0
  36. package/Runtime/API/NativeAd/NativeAdObject.cs.meta +11 -0
  37. package/Runtime/API/NativeAd/NativeAdType.cs +8 -0
  38. package/Runtime/API/NativeAd/NativeAdType.cs.meta +11 -0
  39. package/Runtime/API/NativeAd/NativeAssetID.cs +30 -0
  40. package/Runtime/API/NativeAd/NativeAssetID.cs.meta +11 -0
  41. package/Runtime/API/NativeAd/NativeClientFactoryManager.cs +32 -0
  42. package/Runtime/API/NativeAd/NativeClientFactoryManager.cs.meta +11 -0
  43. package/Runtime/API/NativeAd.meta +8 -0
  44. package/Runtime/Common/NativeAd/AdLoaderClientArgs.cs +16 -0
  45. package/Runtime/Common/NativeAd/AdLoaderClientArgs.cs.meta +11 -0
  46. package/Runtime/Common/NativeAd/AdsEventExecutor.cs +84 -0
  47. package/Runtime/Common/NativeAd/AdsEventExecutor.cs.meta +11 -0
  48. package/Runtime/Common/NativeAd/DummyNativeClient.cs +61 -0
  49. package/Runtime/Common/NativeAd/DummyNativeClient.cs.meta +11 -0
  50. package/Runtime/Common/NativeAd/NativeClientEventArgs.cs +10 -0
  51. package/Runtime/Common/NativeAd/NativeClientEventArgs.cs.meta +11 -0
  52. package/Runtime/Common/NativeAd/NativeUtils.cs +117 -0
  53. package/Runtime/Common/NativeAd/NativeUtils.cs.meta +11 -0
  54. package/Runtime/Internal/IClientsFactory.cs +5 -2
  55. package/Runtime/Internal/NativeAd/IAdLoaderClient.cs +24 -0
  56. package/Runtime/Internal/NativeAd/IAdLoaderClient.cs.meta +11 -0
  57. package/Runtime/Internal/NativeAd/INativeAdClient.cs +25 -0
  58. package/Runtime/Internal/NativeAd/INativeAdClient.cs.meta +3 -0
  59. package/Runtime/Internal/NativeAd/INativeAdInteractionHandlerClient.cs +15 -0
  60. package/Runtime/Internal/NativeAd/INativeAdInteractionHandlerClient.cs.meta +11 -0
  61. package/Runtime/Internal/NativeAd/INativeClientFactory.cs +9 -0
  62. package/Runtime/Internal/NativeAd/INativeClientFactory.cs.meta +11 -0
  63. package/Runtime/Internal/NativeAd.meta +8 -0
  64. package/Runtime/Platforms/Android/AndroidJavaObjectFactory.cs +9 -1
  65. package/Runtime/Platforms/Android/BannerAdClient.cs +1 -1
  66. package/Runtime/Platforms/Android/BlueStackClient.cs +1 -1
  67. package/Runtime/Platforms/Android/BlueStackErrorUtils.cs +1 -1
  68. package/Runtime/Platforms/Android/BlueStackNativeClassNames.cs +4 -1
  69. package/Runtime/Platforms/Android/ClientsFactory.cs +12 -1
  70. package/Runtime/Platforms/Android/InitializationStatusClient.cs +1 -1
  71. package/Runtime/Platforms/Android/InterstitialAdClient.cs +1 -1
  72. package/Runtime/Platforms/Android/NativeAdClient.cs +108 -0
  73. package/Runtime/Platforms/Android/NativeAdClient.cs.meta +3 -0
  74. package/Runtime/Platforms/Android/PreferenceClient.cs +1 -1
  75. package/Runtime/Platforms/Android/RewardedVideoAdClient.cs +1 -1
  76. package/Runtime/Platforms/Unity/BannerAdClient.cs +1 -0
  77. package/Runtime/Platforms/Unity/ClientsFactory.cs +6 -1
  78. package/Runtime/Platforms/Unity/NativeAdClient.cs +101 -0
  79. package/Runtime/Platforms/Unity/NativeAdClient.cs.meta +3 -0
  80. package/Runtime/Platforms/Unity/RewardedTimer.cs +2 -2
  81. package/Runtime/Platforms/Unity/Utils.cs +73 -0
  82. package/Runtime/Platforms/Unity/Utils.cs.meta +11 -0
  83. package/Runtime/Platforms/iOS/BannerAdClient.cs +1 -1
  84. package/Runtime/Platforms/iOS/BlueStackClient.cs +1 -1
  85. package/Runtime/Platforms/iOS/BlueStackErrorUtils.cs +1 -1
  86. package/Runtime/Platforms/iOS/ClientsFactory.cs +13 -1
  87. package/Runtime/Platforms/iOS/Externs.cs +49 -1
  88. package/Runtime/Platforms/iOS/InitializationStatusClient.cs +1 -1
  89. package/Runtime/Platforms/iOS/InterstitialAdClient.cs +1 -1
  90. package/Runtime/Platforms/iOS/NativeAdClient.cs +156 -0
  91. package/Runtime/Platforms/iOS/NativeAdClient.cs.meta +3 -0
  92. package/Runtime/Platforms/iOS/PreferenceClient.cs +1 -1
  93. package/Runtime/Platforms/iOS/RewardedVideoAdClient.cs +1 -1
  94. package/Runtime/Platforms/iOS/Utils.cs +1 -1
  95. package/Runtime/Utilities/MiniJSON.cs +581 -0
  96. package/Runtime/Utilities/MiniJSON.cs.meta +11 -0
  97. package/Runtime/Utilities.meta +8 -0
  98. package/package.json +1 -1
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 383491ed83636436d9d16b7350922264
3
+ PrefabImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: e061ab56cd4bb44c5bb037cdd730bd22
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,208 @@
1
+ using System.Collections;
2
+ using System.Collections.Generic;
3
+ using UnityEngine;
4
+ using Azerion.BlueStack.API;
5
+ using UnityEngine.UI;
6
+ using System.Linq;
7
+ using UnityEngine.Serialization;
8
+
9
+ namespace Azerion.BlueStack.Example
10
+ {
11
+ public class NativeAdManager : MonoBehaviour
12
+ {
13
+
14
+ private NativeAd nativeAd;
15
+ private bool unifiedNativeAdLoaded;
16
+ private Preference _preference;
17
+
18
+ private string AppId
19
+ {
20
+ get
21
+ {
22
+ #if UNITY_IOS
23
+ return "3180317"; //3180317
24
+ #elif UNITY_ANDROID
25
+ return "5180317";
26
+ #endif
27
+ }
28
+ }
29
+
30
+ private string NativeAdUnitId
31
+ {
32
+ get
33
+ {
34
+ #if UNITY_IOS
35
+ return "/" + AppId + "/nativead";
36
+ #elif UNITY_ANDROID
37
+ return "/" + AppId + "/nativead";
38
+ #endif
39
+ }
40
+ }
41
+
42
+ // Below are the UI element that you need to assign from Unity Editor
43
+ public GameObject badge;
44
+ public GameObject appIcon;
45
+ public GameObject title;
46
+ public GameObject body;
47
+ public GameObject coverImage;
48
+ public GameObject callToAction;
49
+
50
+ // Use this for initialization
51
+ void Start()
52
+ {
53
+
54
+ Settings settings = new Settings(isDebugModeEnabled: true);
55
+ BlueStackAds.Initialize(AppId, settings, HandleSDKInitCompleteAction);
56
+ _preference = CreatePreference();
57
+ }
58
+
59
+ private void HandleSDKInitCompleteAction(SDKInitializationStatus sdkInitializationStatus)
60
+ {
61
+ bool isSuccess = sdkInitializationStatus.IsSuccess;
62
+ string description = sdkInitializationStatus.Description;
63
+
64
+ if (isSuccess)
65
+ {
66
+ Debug.Log("BlueStack SDK initialization success: " + description);
67
+ RequestNativeAd();
68
+ }
69
+ else
70
+ {
71
+ Debug.Log("BlueStack SDK initialization failed: " + description);
72
+ }
73
+ }
74
+
75
+
76
+ // Update is called once per frame
77
+ void Update()
78
+ {
79
+ if (this.unifiedNativeAdLoaded)
80
+ {
81
+ this.unifiedNativeAdLoaded = false;
82
+
83
+ Debug.Log("NativeAdManager: RegisterGameObjects");
84
+
85
+ // badge
86
+ string badgeText = this.nativeAd.GetBadge();
87
+ if (badgeText != null)
88
+ {
89
+ Debug.Log("NativeAdManager: Register AdChoices");
90
+ this.badge.GetComponent<Text>().text = badgeText;
91
+ if (!this.nativeAd.RegisterBadgeTextGameObject(this.badge))
92
+ {
93
+ Debug.Log("RegisterBadgeTextGameObject Unsuccessful");
94
+ }
95
+ }
96
+
97
+ // Icon Texture
98
+ Texture2D iconTexture = this.nativeAd.GetIconTexture();
99
+ if (iconTexture != null)
100
+ {
101
+ Debug.Log("NativeAdManager: Register Icon Texture");
102
+ appIcon.GetComponent<RawImage>().texture = iconTexture;
103
+ if (!this.nativeAd.RegisterIconImageGameObject(appIcon))
104
+ {
105
+ Debug.Log("RegisterIconImageGameObject Unsuccessful");
106
+ }
107
+ }
108
+
109
+ // Headline/Title
110
+ string titleText = this.nativeAd.GetTitle();
111
+ if (titleText != null)
112
+ {
113
+ Debug.Log("NativeAdManager: Register Head line");
114
+ title.GetComponent<Text>().text = titleText;
115
+ if (!this.nativeAd.RegisterTitleTextGameObject(title))
116
+ {
117
+ Debug.Log("RegisterHeadlineTextGameObject Unsuccessful");
118
+ }
119
+ }
120
+
121
+ // Body Text
122
+ string bodyText = this.nativeAd.GetBodyText();
123
+ if (bodyText != null)
124
+ {
125
+ Debug.Log("NativeAdManager: Register Body Text");
126
+ this.body.GetComponent<Text>().text = bodyText;
127
+ if (!this.nativeAd.RegisterBodyTextGameObject(this.body))
128
+ {
129
+ Debug.Log("RegisterBodyTextGameObject Unsuccessful");
130
+
131
+ }
132
+ }
133
+
134
+ // Main/Cover Image
135
+ Texture2D imageTexture = this.nativeAd.GetCoverImageTexture();
136
+ if (imageTexture != null)
137
+ {
138
+ Debug.Log("NativeAdManager: Register Cover Images");
139
+ coverImage.GetComponent<RawImage>().texture = imageTexture;
140
+ if (!this.nativeAd.RegisterImageGameObject(coverImage))
141
+ {
142
+ Debug.Log("RegisterImageGameObject Unsuccessful");
143
+ }
144
+ }
145
+
146
+ // CallToAction
147
+ string callToActionText = this.nativeAd.GetCallToActionText();
148
+ if (callToActionText != null)
149
+ {
150
+ Debug.Log("NativeAdManager: Register CallToAction");
151
+ callToAction.GetComponent<Text>().text = callToActionText;
152
+ if (!this.nativeAd.RegisterCallToActionGameObject(callToAction))
153
+ {
154
+ Debug.Log("RegisterCallToActionGameObject Unsuccessful");
155
+ }
156
+ }
157
+
158
+ // Debug.Log("Headline is " + titleText);
159
+ // Debug.Log("GetBodyText is " + this.nativeAd.GetBodyText());
160
+ // Debug.Log("GetCallToActionText is " + callToActionText);
161
+ }
162
+ }
163
+
164
+ private void RequestNativeAd()
165
+ {
166
+ Debug.Log("NativeAdManager: Requesting Ad!");
167
+ NativeAdLoader nativeAdLoader = new NativeAdLoader(NativeAdUnitId);
168
+ nativeAdLoader.OnNativeAdLoaded += this.HandleNativeAdLoaded;
169
+ nativeAdLoader.OnNativeAdFailedToLoad += this.HandleNativeNativeAdFailedToLoad;
170
+ nativeAdLoader.Load();
171
+ }
172
+
173
+ private void HandleNativeNativeAdFailedToLoad(object sender, BlueStackError args)
174
+ {
175
+ Debug.Log("BlueStack NativeAd failed to load: " + "errorCode: " + args.ErrorCode + " message: " +
176
+ args.Message);
177
+ }
178
+
179
+ private void HandleNativeAdLoaded(object sender, NativeAdEventArgs args)
180
+ {
181
+ Debug.Log("NativeAdManager: Unified Native Ad Loaded");
182
+ this.nativeAd = args.nativeAd;
183
+ this.unifiedNativeAdLoaded = true;
184
+ // RegisterGameObjects();
185
+ }
186
+
187
+
188
+ private Preference CreatePreference()
189
+ {
190
+ Preference bsPreference = new Preference();
191
+
192
+ Location myLocation = new Location(Location.NONE_PROVIDER)
193
+ {
194
+ Latitude = 35.757866,
195
+ Longitude = 10.810547
196
+ };
197
+
198
+ bsPreference.SetAge(25);
199
+ bsPreference.SetLanguage("en");
200
+ bsPreference.SetGender(Gender.Male);
201
+ bsPreference.SetKeyword("brand=myBrand;category=sport");
202
+ bsPreference.SetLocation(myLocation, 1);
203
+ bsPreference.SetContentUrl("https://madvertise.com/en/");
204
+
205
+ return bsPreference;
206
+ }
207
+ }
208
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: ae41d79969d6147a58e9259deac9b3f9
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,181 @@
1
+ using System.Collections;
2
+ using System.Collections.Generic;
3
+ using UnityEngine;
4
+ using Azerion.BlueStack.API;
5
+ using UnityEngine.UI;
6
+ using System.Linq;
7
+ using UnityEngine.Serialization;
8
+
9
+ namespace Azerion.BlueStack.Example
10
+ {
11
+ public class SmallNativeAdManager : MonoBehaviour
12
+ {
13
+
14
+ private NativeAd nativeAd;
15
+ private bool unifiedNativeAdLoaded;
16
+ private Preference _preference;
17
+
18
+ private string AppId
19
+ {
20
+ get
21
+ {
22
+ #if UNITY_IOS
23
+ return "3180317"; //3180317
24
+ #elif UNITY_ANDROID
25
+ return "5180317";
26
+ #endif
27
+ }
28
+ }
29
+
30
+ private string NativeAdUnitId
31
+ {
32
+ get
33
+ {
34
+ #if UNITY_IOS
35
+ return "/" + AppId + "/nativead";
36
+ #elif UNITY_ANDROID
37
+ return "/" + AppId + "/nativead";
38
+ #endif
39
+ }
40
+ }
41
+
42
+ // Below are the UI element that you need to assign from Unity Editor
43
+ public GameObject badge;
44
+ public GameObject appIcon;
45
+ public GameObject title;
46
+ public GameObject callToAction;
47
+
48
+ // Use this for initialization
49
+ void Start()
50
+ {
51
+ Settings settings = new Settings(isDebugModeEnabled: true);
52
+ BlueStackAds.Initialize(AppId, settings, HandleSDKInitCompleteAction);
53
+ _preference = CreatePreference();
54
+ }
55
+
56
+ private void HandleSDKInitCompleteAction(SDKInitializationStatus sdkInitializationStatus)
57
+ {
58
+ bool isSuccess = sdkInitializationStatus.IsSuccess;
59
+ string description = sdkInitializationStatus.Description;
60
+
61
+ if (isSuccess)
62
+ {
63
+ Debug.Log("BlueStack SDK initialization success: " + description);
64
+ RequestNativeAd();
65
+ }
66
+ else
67
+ {
68
+ Debug.Log("BlueStack SDK initialization failed: " + description);
69
+ }
70
+ }
71
+
72
+
73
+ // Update is called once per frame
74
+ void Update()
75
+ {
76
+
77
+ if (this.unifiedNativeAdLoaded)
78
+ {
79
+ this.unifiedNativeAdLoaded = false;
80
+
81
+ Debug.Log("NativeAdManager: RegisterGameObjects");
82
+
83
+ // badge
84
+ string badgeText = this.nativeAd.GetBadge();
85
+ if (badgeText != null)
86
+ {
87
+ Debug.Log("NativeAdManager: Register AdChoices");
88
+ this.badge.GetComponent<Text>().text = badgeText;
89
+ if (!this.nativeAd.RegisterBadgeTextGameObject(this.badge))
90
+ {
91
+ Debug.Log("RegisterBadgeTextGameObject Unsuccessful");
92
+ }
93
+ }
94
+
95
+ // Icon Texture
96
+ Texture2D iconTexture = this.nativeAd.GetIconTexture();
97
+ if (iconTexture != null)
98
+ {
99
+ Debug.Log("NativeAdManager: Register Icon Texture");
100
+ appIcon.GetComponent<RawImage>().texture = iconTexture;
101
+ if (!this.nativeAd.RegisterIconImageGameObject(appIcon))
102
+ {
103
+ Debug.Log("RegisterIconImageGameObject Unsuccessful");
104
+ }
105
+ }
106
+
107
+ // Headline/Title
108
+ string titleText = this.nativeAd.GetTitle();
109
+ if (titleText != null)
110
+ {
111
+ Debug.Log("NativeAdManager: Register Head line");
112
+ title.GetComponent<Text>().text = titleText;
113
+ if (!this.nativeAd.RegisterTitleTextGameObject(title))
114
+ {
115
+ Debug.Log("RegisterHeadlineTextGameObject Unsuccessful");
116
+ }
117
+ }
118
+
119
+ // CallToAction
120
+ string callToActionText = this.nativeAd.GetCallToActionText();
121
+ if (callToActionText != null)
122
+ {
123
+ Debug.Log("NativeAdManager: Register CallToAction");
124
+ callToAction.GetComponent<Text>().text = callToActionText;
125
+ if (!this.nativeAd.RegisterCallToActionGameObject(callToAction))
126
+ {
127
+ Debug.Log("RegisterCallToActionGameObject Unsuccessful");
128
+ }
129
+ }
130
+
131
+ // Debug.Log("Headline is " + titleText);
132
+ // Debug.Log("GetBodyText is " + this.nativeAd.GetBodyText());
133
+ // Debug.Log("GetCallToActionText is " + callToActionText);
134
+ }
135
+ }
136
+
137
+ private void RequestNativeAd()
138
+ {
139
+ Debug.Log("NativeAdManager: Requesting Ad!");
140
+ NativeAdLoader nativeAdLoader = new NativeAdLoader(NativeAdUnitId);
141
+ nativeAdLoader.OnNativeAdLoaded += this.HandleNativeAdLoaded;
142
+ nativeAdLoader.OnNativeAdFailedToLoad += this.HandleNativeNativeAdFailedToLoad;
143
+ nativeAdLoader.Load();
144
+ }
145
+
146
+ private void HandleNativeNativeAdFailedToLoad(object sender, BlueStackError args)
147
+ {
148
+ Debug.Log("BlueStack NativeAd failed to load: " + "errorCode: " + args.ErrorCode + " message: " +
149
+ args.Message);
150
+ }
151
+
152
+ private void HandleNativeAdLoaded(object sender, NativeAdEventArgs args)
153
+ {
154
+ Debug.Log("NativeAdManager: Unified Native Ad Loaded");
155
+ this.nativeAd = args.nativeAd;
156
+ this.unifiedNativeAdLoaded = true;
157
+ // RegisterGameObjects();
158
+ }
159
+
160
+
161
+ private Preference CreatePreference()
162
+ {
163
+ Preference bsPreference = new Preference();
164
+
165
+ Location myLocation = new Location(Location.NONE_PROVIDER)
166
+ {
167
+ Latitude = 35.757866,
168
+ Longitude = 10.810547
169
+ };
170
+
171
+ bsPreference.SetAge(25);
172
+ bsPreference.SetLanguage("en");
173
+ bsPreference.SetGender(Gender.Male);
174
+ bsPreference.SetKeyword("brand=myBrand;category=sport");
175
+ bsPreference.SetLocation(myLocation, 1);
176
+ bsPreference.SetContentUrl("https://madvertise.com/en/");
177
+
178
+ return bsPreference;
179
+ }
180
+ }
181
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 0a16319ad811140899c0a2f9f1fb2ad6
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: e47e58aa81c2742beaf50abe6b672dce
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
package/Example.meta ADDED
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 93769483d95fa411095f41bab0194ec6
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -1,5 +1,5 @@
1
1
  fileFormatVersion: 2
2
- guid: 82ecf432ec49047bfb48b7d7014c1f4b
2
+ guid: 505fa3b888bfa43f994c430c74b494b3
3
3
  PluginImporter:
4
4
  externalObjects: {}
5
5
  serializedVersion: 2
@@ -98,3 +98,17 @@ void BSUHideBannerAd(BSUTypeBannerRef banner);
98
98
  void BSUShowBannerAd(BSUTypeBannerRef banner);
99
99
  void BSUSetBannerAdPosition(BSUTypeBannerRef banner, BSUAdPosition adPosition);
100
100
  void BSUDestroyBannerAd(BSUTypeBannerRef banner);
101
+
102
+ // Native Ad
103
+ void BSUSetNativeAdCallbacks(BSUTypeNativeAdRef nativeAd,
104
+ BSUOnNativeAdDidLoadCallback
105
+ onDidLoadCallback,
106
+ BSUOnNativeAdDidFailCallback
107
+ onDidFailCallback);
108
+ BSUTypeNativeAdRef BSUCreateNativeAd(BSUTypeNativeAdClientRef *nativeAdClient, const char *placementId);
109
+ void BSULoadNativeAd(BSUTypeNativeAdRef nativeAd);
110
+ void BSULoadNativeAdWithPreference(BSUTypeNativeAdRef nativeAd, BSUTypePreferenceRef preferenceRef);
111
+ const char *BSUNativeAdGetTitle(BSUTypeNativeAdRef nativeAd);
112
+ const char *BSUNativeAdGetBodyText(BSUTypeNativeAdRef nativeAd);
113
+ const char *BSUNativeAdGetCTAText(BSUTypeNativeAdRef nativeAd);
114
+ void BSUDestroyNativeAd(BSUTypeNativeAdRef nativeAd);
@@ -17,7 +17,7 @@
17
17
  #import "BSURewardedVideoAd.h"
18
18
  #import "BSUInterstitialAd.h"
19
19
  #import "BSUBanner.h"
20
- // #import "BSUNativeAd.h"
20
+ #import "BSUNativeAd.h"
21
21
 
22
22
  static NSString *BSUStringFromUTF8String(const char *bytes) { return bytes ? @(bytes) : nil; }
23
23
 
@@ -83,11 +83,16 @@ NSDictionary *classNameKeyedDictionaryFromArray(NSArray *array) {
83
83
  for (objectInstance in array)
84
84
  if (objectInstance.provider != nil && objectInstance.descriptionStatus != nil){
85
85
  status = [[BSUAdNetworkStatus alloc] initWithAdProvider:objectInstance.provider withState:objectInstance.state withDescription:objectInstance.descriptionStatus];
86
+
87
+ // NSLog(@"classNameKeyedDictionaryFromArray objectInstance.provider: %@",objectInstance.provider);
86
88
  [mutableDictionary setObject:status forKey:[NSString stringWithString:objectInstance.provider]];
87
89
  }
88
90
  return [mutableDictionary copy];
91
+ // return (NSDictionary *)[mutableDictionary autorelease];
89
92
  }
90
93
 
94
+ //TODO: Later we will implement adapter list in bluestack sdk
95
+
91
96
  int BSUGetInitState(BSUTypeInitializationStatusRef statusRef, const char *className) {
92
97
  BSUInitializtionStatus *initStatus = (__bridge BSUInitializtionStatus *)statusRef;
93
98
  NSString *classNameString = BSUStringFromUTF8String(className);
@@ -361,3 +366,80 @@ void BSUDestroyBannerAd(BSUTypeBannerRef banner) {
361
366
  BSUBanner *internalBanner = (__bridge BSUBanner *)banner;
362
367
  [internalBanner destroy];
363
368
  }
369
+
370
+ #pragma mark Native Ad
371
+
372
+ void BSUSetNativeAdCallbacks(BSUTypeNativeAdRef nativeAd,
373
+ BSUOnNativeAdDidLoadCallback
374
+ onDidLoadCallback,
375
+ BSUOnNativeAdDidFailCallback
376
+ onDidFailCallback) {
377
+ BSUNativeAd *internalNativeAd = (__bridge BSUNativeAd *)nativeAd;
378
+ internalNativeAd.onDidLoadCallback = onDidLoadCallback;
379
+ internalNativeAd.onDidFailCallback = onDidFailCallback;
380
+ }
381
+
382
+ BSUTypeNativeAdRef BSUCreateNativeAd(BSUTypeNativeAdClientRef *nativeAdClient, const char *placementId) {
383
+ NSString *placementIdStr = BSUStringFromUTF8String(placementId);
384
+ BSUNativeAd *internalNativeAd = [[BSUNativeAd alloc] initWithNativeAdClientReference:nativeAdClient placementId:placementIdStr];
385
+ BSUObjectCache *cache = [BSUObjectCache sharedInstance];
386
+ cache[internalNativeAd.BSU_referenceKey] = internalNativeAd;
387
+ return (__bridge BSUTypeNativeAdRef)internalNativeAd;
388
+ }
389
+
390
+ void BSULoadNativeAd(BSUTypeNativeAdRef nativeAd) {
391
+ BSUNativeAd *internalNativeAd = (__bridge BSUNativeAd *)nativeAd;
392
+ [internalNativeAd loadAd];
393
+ }
394
+
395
+ void BSULoadNativeAdWithPreference(BSUTypeNativeAdRef nativeAd, BSUTypePreferenceRef preferenceRef) {
396
+ BSUNativeAd *internalNativeAd = (__bridge BSUNativeAd *)nativeAd;
397
+ [internalNativeAd loadAdWithPreference:preferenceRef];
398
+ }
399
+
400
+ const char *BSUNativeAdGetTitle(BSUTypeNativeAdRef nativeAd) {
401
+ BSUNativeAd *internalNativeAd = (__bridge BSUNativeAd *)nativeAd;
402
+ NSLog(@"BSUNativeAdGetTitle %@",internalNativeAd.title);
403
+ return cStringCopy(internalNativeAd.title.UTF8String);
404
+ }
405
+
406
+ const char *BSUNativeAdGetBodyText(BSUTypeNativeAdRef nativeAd) {
407
+ BSUNativeAd *internalNativeAd = (__bridge BSUNativeAd *)nativeAd;
408
+ NSLog(@"BSUNativeAdGetBodyText %@",internalNativeAd.body);
409
+ return cStringCopy(internalNativeAd.body.UTF8String);
410
+ }
411
+
412
+ const char *BSUNativeAdGetCTAText(BSUTypeNativeAdRef nativeAd) {
413
+ BSUNativeAd *internalNativeAd = (__bridge BSUNativeAd *)nativeAd;
414
+ NSLog(@"BSUNativeAdGetCTAText %@",internalNativeAd.callToAction);
415
+ return cStringCopy(internalNativeAd.callToAction.UTF8String);
416
+ }
417
+
418
+ const char *BSUNativeAdGetBadge(BSUTypeNativeAdRef nativeAd) {
419
+ BSUNativeAd *internalNativeAd = (__bridge BSUNativeAd *)nativeAd;
420
+ NSLog(@"BSUNativeAdGetBadge %@",internalNativeAd.badge);
421
+ return cStringCopy(internalNativeAd.badge.UTF8String);
422
+ }
423
+
424
+ const char *BSUNativeAdGetIconUrl(BSUTypeNativeAdRef nativeAd) {
425
+ BSUNativeAd *internalNativeAd = (__bridge BSUNativeAd *)nativeAd;
426
+ NSLog(@"BSUNativeAdGetIconUrl %@",internalNativeAd.iconUrl);
427
+ return cStringCopy(internalNativeAd.iconUrl.UTF8String);
428
+ }
429
+
430
+ const char *BSUNativeAdGetCoverImageUrl(BSUTypeNativeAdRef nativeAd) {
431
+ BSUNativeAd *internalNativeAd = (__bridge BSUNativeAd *)nativeAd;
432
+ NSLog(@"BSUNativeAdGetCoverImageUrl %@",internalNativeAd.coverImageUrl);
433
+ return cStringCopy(internalNativeAd.coverImageUrl.UTF8String);
434
+ }
435
+
436
+ const char *BSUNativeAdGetClickUrl(BSUTypeNativeAdRef nativeAd) {
437
+ BSUNativeAd *internalNativeAd = (__bridge BSUNativeAd *)nativeAd;
438
+ NSLog(@"BSUNativeAdGetClickUrl %@",internalNativeAd.clickUrl);
439
+ return cStringCopy(internalNativeAd.clickUrl.UTF8String);
440
+ }
441
+
442
+ void BSUDestroyNativeAd(BSUTypeNativeAdRef nativeAd) {
443
+ BSUNativeAd *internalNativeAd = (__bridge BSUNativeAd *)nativeAd;
444
+ [internalNativeAd destroy];
445
+ }
@@ -0,0 +1,32 @@
1
+ #import <Foundation/Foundation.h>
2
+ #import <CoreGraphics/CoreGraphics.h>
3
+ #import "BSUTypes.h"
4
+
5
+ @interface BSUNativeAd : NSObject
6
+
7
+ NS_ASSUME_NONNULL_BEGIN
8
+
9
+ - (id)initWithNativeAdClientReference:(BSUTypeNativeAdClientRef *)nativeAdClient
10
+ placementId:(NSString *_Nullable)placementId;
11
+
12
+ @property(nonatomic, assign) BSUTypeNativeAdClientRef * _Nonnull nativeAdClient;
13
+
14
+ @property(nonatomic, assign) BSUOnNativeAdDidLoadCallback onDidLoadCallback;
15
+
16
+ @property(nonatomic, assign) BSUOnNativeAdDidFailCallback onDidFailCallback;
17
+
18
+ @property (nonatomic, retain) NSString *title;
19
+ @property (nonatomic, retain) NSString *body;
20
+ @property (nonatomic, retain) NSString *callToAction;
21
+ @property (nonatomic, retain) NSString *badge;
22
+ @property (nonatomic, retain) NSString *iconUrl;
23
+ @property (nonatomic, retain) NSString *coverImageUrl;
24
+ @property (nonatomic, retain) NSString *clickUrl;
25
+
26
+ NS_ASSUME_NONNULL_END
27
+
28
+ - (void)loadAd;
29
+ - (void)loadAdWithPreference:(BSUTypePreferenceRef)preferenceRef;
30
+ - (void)destroy;
31
+
32
+ @end
@@ -0,0 +1,27 @@
1
+ fileFormatVersion: 2
2
+ guid: 29f887abf42064007976c9cd86377d11
3
+ PluginImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ iconMap: {}
7
+ executionOrder: {}
8
+ defineConstraints: []
9
+ isPreloaded: 0
10
+ isOverridable: 1
11
+ isExplicitlyReferenced: 0
12
+ validateReferences: 1
13
+ platformData:
14
+ - first:
15
+ Any:
16
+ second:
17
+ enabled: 1
18
+ settings: {}
19
+ - first:
20
+ Editor: Editor
21
+ second:
22
+ enabled: 0
23
+ settings:
24
+ DefaultValueInitialized: true
25
+ userData:
26
+ assetBundleName:
27
+ assetBundleVariant: