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.
- package/Editor/Android/AndroidBuildPostProcess.cs +0 -1
- package/Editor/Android/AndroidDependency.cs +1 -2
- package/Editor/Android/AndroidDependencyModifier.cs +55 -0
- package/Editor/Android/AndroidDependencyModifier.cs.meta +3 -0
- package/Editor/Android/AndroidDependencyParser.cs +26 -1
- package/Editor/Android/ManifestProcessor.cs +2 -1
- package/Editor/Azerion.BlueStack.Editor.asmdef +14 -14
- package/Editor/BlueStackDependencies.xml +1 -1
- package/Editor/BlueStackMediationDependencies.xml +11 -0
- package/Editor/BlueStackMediationDependencies.xml.meta +7 -0
- package/Editor/BlueStackSettings.cs +21 -18
- package/Editor/BlueStackSettingsEditor.cs +64 -1
- package/Editor/DebugHelper.cs +2 -2
- package/Editor/Dependency.cs +1 -1
- package/Editor/DependencyProvider.cs +213 -2
- package/Editor/IDependencyModifier.cs +12 -0
- package/Editor/IDependencyModifier.cs.meta +11 -0
- package/Editor/IDependencyParser.cs +1 -0
- package/Editor/MediationNetworkDependency.cs +34 -0
- package/Editor/MediationNetworkDependency.cs.meta +3 -0
- package/Editor/iOS/IOSDependency.cs +12 -0
- package/Editor/iOS/IOSDependency.cs.meta +11 -0
- package/Editor/iOS/IOSDependencyModifier.cs +105 -0
- package/Editor/iOS/IOSDependencyModifier.cs.meta +3 -0
- package/Editor/iOS/IOSDependencyParser.cs +32 -0
- package/Editor/iOS/PodDependency/PodDependencyUtils.cs +5 -1
- package/Example/Azerion.BlueStack.Example.asmdef +14 -14
- package/Example/Scripts/NativeAdManager.cs +5 -7
- package/Example/Scripts/SmallNativeAdManager.cs +4 -6
- package/README.md +4 -1
- package/Runtime/API/AdSize.cs +2 -2
- package/Runtime/API/Banner/BannerAd.cs +1 -1
- package/Runtime/API/BlueStackAds.cs +7 -3
- package/Runtime/API/InterstitialAd.cs +20 -5
- package/Runtime/API/NativeAd/NativeAd.cs +20 -26
- package/Runtime/API/NativeAd/NativeAdEventArgs.cs +1 -5
- package/Runtime/API/NativeAd/NativeAdInteractionHandler.cs +176 -173
- package/Runtime/API/NativeAd/NativeAdLoader.cs +10 -14
- package/Runtime/API/NativeAd/NativeAdObject.cs +563 -547
- package/Runtime/API/NativeAd/NativeAdType.cs +6 -6
- package/Runtime/API/NativeAd/NativeAssetInfo.cs +28 -28
- package/Runtime/Azerion.BlueStack.asmdef +14 -14
- package/Runtime/Common/NativeAd/AdLoaderClientArgs.cs +8 -8
- package/Runtime/Common/NativeAd/AdsEventExecutor.cs +69 -68
- package/Runtime/Common/NativeAd/DummyNativeClient.cs +52 -52
- package/Runtime/Common/NativeAd/NativeClientEventArgs.cs +5 -5
- package/Runtime/Common/NativeAd/NativeUtils.cs +111 -107
- package/Runtime/Internal/IBannerAdClient.cs +1 -1
- package/Runtime/Internal/IBlueStackClient.cs +2 -1
- package/Runtime/Internal/NativeAd/IAdLoaderClient.cs +12 -12
- package/Runtime/Internal/NativeAd/INativeAdClient.cs +1 -1
- package/Runtime/Internal/NativeAd/INativeClientFactory.cs +5 -5
- package/Runtime/Platforms/Android/BlueStackClient.cs +2 -1
- package/Runtime/Platforms/Android/BlueStackNativeClassNames.cs +2 -1
- package/Runtime/Platforms/Unity/AdvertisementManager.cs +5 -4
- package/Runtime/Platforms/Unity/BannerAdClient.cs +16 -9
- package/Runtime/Platforms/Unity/BaseAdClient.cs +7 -5
- package/Runtime/Platforms/Unity/BlueStackClient.cs +4 -3
- package/Runtime/Platforms/Unity/ClientsFactory.cs +0 -1
- package/Runtime/Platforms/Unity/InitializationStatusClient.cs +1 -0
- package/Runtime/Platforms/Unity/InterstitialAdClient.cs +12 -6
- package/Runtime/Platforms/Unity/NativeAdClient.cs +16 -10
- package/Runtime/Platforms/Unity/RewardedVideoAdClient.cs +9 -3
- package/Runtime/Platforms/Unity/Utils.cs +7 -3
- package/Runtime/Platforms/iOS/BannerAdClient.cs +33 -24
- package/Runtime/Platforms/iOS/BlueStackClient.cs +14 -10
- package/Runtime/Platforms/iOS/ClientsFactory.cs +0 -2
- package/Runtime/Platforms/iOS/Externs.cs +72 -65
- package/Runtime/Platforms/iOS/InitializationStatusClient.cs +6 -5
- package/Runtime/Platforms/iOS/InterstitialAdClient.cs +27 -21
- package/Runtime/Platforms/iOS/NativeAdClient.cs +27 -22
- package/Runtime/Platforms/iOS/PreferenceClient.cs +1 -1
- package/Runtime/Platforms/iOS/RewardedVideoAdClient.cs +27 -20
- package/Runtime/Platforms/iOS/Utils.cs +6 -3
- package/Runtime/Utilities/MiniJSON.cs +12 -12
- package/package.json +1 -1
- package/Editor/iOS/Dependency.cs +0 -0
- package/Editor/iOS/Dependency.cs.meta +0 -3
|
@@ -7,176 +7,179 @@ using UnityEngine;
|
|
|
7
7
|
|
|
8
8
|
namespace Azerion.BlueStack.API
|
|
9
9
|
{
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
10
|
+
public class NativeAdInteractionHandler
|
|
11
|
+
{
|
|
12
|
+
private INativeAdClient _nativeAdClient;
|
|
13
|
+
private List<NativeAdObject> _nativeAdObjects;
|
|
14
|
+
|
|
15
|
+
private INativeAdInteractionHandlerClient _nativeAdInteractionHandlerClient;
|
|
16
|
+
|
|
17
|
+
// public NativeAdInteractionHandler(INativeAdInteractionHandlerClient interactionHandlerClient)
|
|
18
|
+
|
|
19
|
+
private string _clickUrl;
|
|
20
|
+
|
|
21
|
+
public NativeAdInteractionHandler(INativeAdClient nativeAdClient)
|
|
22
|
+
{
|
|
23
|
+
// _nativeAdInteractionHandlerClient = interactionHandlerClient;
|
|
24
|
+
_nativeAdObjects = new List<NativeAdObject>();
|
|
25
|
+
_nativeAdClient = nativeAdClient;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public bool RegisterImageGameObjects(GameObject gameObject)
|
|
29
|
+
{
|
|
30
|
+
return RegisterGameObject(gameObject, NativeAssetID.Image);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public bool RegisterIconImageGameObject(GameObject gameObject)
|
|
34
|
+
{
|
|
35
|
+
return RegisterGameObject(gameObject, NativeAssetID.Icon, true);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public bool RegisterAdChoicesLogoGameObject(GameObject gameObject)
|
|
39
|
+
{
|
|
40
|
+
return RegisterGameObject(gameObject, NativeAssetID.AdChoices);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public bool RegisterHeadlineTextGameObject(GameObject gameObject)
|
|
44
|
+
{
|
|
45
|
+
return RegisterGameObject(gameObject, NativeAssetID.Headline, true);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public bool RegisterBodyTextGameObject(GameObject gameObject)
|
|
49
|
+
{
|
|
50
|
+
return RegisterGameObject(gameObject, NativeAssetID.Body);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public bool RegisterCallToActionGameObject(GameObject gameObject)
|
|
54
|
+
{
|
|
55
|
+
return RegisterGameObject(gameObject, NativeAssetID.CallToAction, true, true);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public bool RegisterAdvertiserTextGameObject(GameObject gameObject)
|
|
59
|
+
{
|
|
60
|
+
return RegisterGameObject(gameObject, NativeAssetID.Advertiser, true);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public bool RegisterPriceGameObject(GameObject gameObject)
|
|
64
|
+
{
|
|
65
|
+
return RegisterGameObject(gameObject, NativeAssetID.Price);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public bool RegisterStoreGameObject(GameObject gameObject)
|
|
69
|
+
{
|
|
70
|
+
return RegisterGameObject(gameObject, NativeAssetID.Store);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
private bool RegisterGameObject(GameObject adObject, NativeAssetID assetID, bool isImpressive = false,
|
|
74
|
+
bool isClickable = false)
|
|
75
|
+
{
|
|
76
|
+
return Register(adObject, assetID.Value, isImpressive, isClickable); // replace with GetAssetIDMappings
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
private bool Register(GameObject adObject, string assetID, bool isImpressive, bool isClickable)
|
|
80
|
+
{
|
|
81
|
+
NativeAdObject nativeAdObject = adObject.GetComponent<NativeAdObject>();
|
|
82
|
+
if (nativeAdObject != null)
|
|
83
|
+
{
|
|
84
|
+
UnityEngine.Object.DestroyImmediate(nativeAdObject);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
nativeAdObject = adObject.AddComponent<NativeAdObject>();
|
|
88
|
+
_nativeAdObjects.Add(nativeAdObject);
|
|
89
|
+
nativeAdObject.OnAdDisplay += RecordImpression;
|
|
90
|
+
nativeAdObject.OnAdClick += RecordClick;
|
|
91
|
+
try
|
|
92
|
+
{
|
|
93
|
+
nativeAdObject.Initialize(assetID, isImpressive, isClickable);
|
|
94
|
+
}
|
|
95
|
+
catch (InvalidOperationException ex)
|
|
96
|
+
{
|
|
97
|
+
// Debug.LogWarning("Failed to Register " + assetID + " :" + ex.Message);
|
|
98
|
+
UnityEngine.Object.Destroy(nativeAdObject);
|
|
99
|
+
_nativeAdObjects.Remove(nativeAdObject);
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
private bool impressionComplete = false;
|
|
107
|
+
private bool clickComplete = false;
|
|
108
|
+
|
|
109
|
+
internal void SetClickUrl(string url)
|
|
110
|
+
{
|
|
111
|
+
_clickUrl = url;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Handle Ad Impression - Incomplete
|
|
115
|
+
private void RecordImpression(object sender, EventArgs eventArgs)
|
|
116
|
+
{
|
|
117
|
+
List<string> requiredAssets = NativeAssetInfo.RequiredAssets;
|
|
118
|
+
var successfulImpressiveAssets = _nativeAdObjects
|
|
119
|
+
.Where(obj => requiredAssets.Contains(obj.ObjectTag) && obj.HasMadeImpression)
|
|
120
|
+
.Select(obj => obj.ObjectTag);
|
|
121
|
+
impressionComplete = requiredAssets.All(tag => successfulImpressiveAssets.Contains(tag));
|
|
122
|
+
// Debug.LogWarning("Is Impression check successful: " + impressionComplete);
|
|
123
|
+
|
|
124
|
+
if (!impressionComplete) return;
|
|
125
|
+
|
|
126
|
+
if (sender is NativeAdObject nativeAdObject)
|
|
127
|
+
{
|
|
128
|
+
_nativeAdClient.OnNativeAdImpression += (sender, args) =>
|
|
129
|
+
{
|
|
130
|
+
// Debug.LogWarning("InteractionHandlerClient: OnNativeAdImpression!");
|
|
131
|
+
foreach (NativeAdObject adObject in _nativeAdObjects)
|
|
132
|
+
{
|
|
133
|
+
if (adObject != null)
|
|
134
|
+
{
|
|
135
|
+
AdsEventExecutor.ExecuteInUpdate(delegate { adObject.StopImpressionCheck(); });
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
_nativeAdClient.RecordImpression();
|
|
140
|
+
|
|
141
|
+
// if (_nativeAdInteractionHandlerClient.RecordImpression(NativeAdInteractionUtils.CreateImpressionSignal(nativeAdObject, _nativeAdObjects)))
|
|
142
|
+
// {
|
|
143
|
+
// foreach (NativeAdObject adObject in _nativeAdObjects)
|
|
144
|
+
// {
|
|
145
|
+
// }
|
|
146
|
+
// }
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Handle Ad Clicked - Incomplete
|
|
151
|
+
private void RecordClick(object sender, ClickEventArgs clickEventArgs)
|
|
152
|
+
{
|
|
153
|
+
// clickComplete = true;
|
|
154
|
+
Debug.Log("Record Click!");
|
|
155
|
+
// Debug.Log("Record Click: " + NativeAdInteractionUtils.BuildVersionString(NativeUtils.Version));
|
|
156
|
+
|
|
157
|
+
if (sender is NativeAdObject nativeAdObject)
|
|
158
|
+
{
|
|
159
|
+
_nativeAdClient.OnNativeAdClicked += (sender, args) =>
|
|
160
|
+
{
|
|
161
|
+
// OpenURL();
|
|
162
|
+
Debug.LogWarning("InteractionHandlerClient: OnNativeAdClicked!");
|
|
163
|
+
};
|
|
164
|
+
_nativeAdClient.PerformClick();
|
|
165
|
+
|
|
166
|
+
// Dictionary<string, string> touchEventSignal =
|
|
167
|
+
// NativeAdInteractionUtils.CreateTouchEventSignal(clickEventArgs.startClick, clickEventArgs.endClick);
|
|
168
|
+
// Dictionary<string, object> clickSignal =
|
|
169
|
+
// NativeAdInteractionUtils.CreateClickSignal(nativeAdObject, _nativeAdObjects, clickEventArgs.startClick, clickEventArgs.endClick);
|
|
170
|
+
//
|
|
171
|
+
// // _nativeAdInteractionHandlerClient.ReportTouchEvent(touchEventSignal);
|
|
172
|
+
// Debug.LogWarning("InteractionHandlerClient: ReportTouchEvent!");
|
|
173
|
+
// // _nativeAdInteractionHandlerClient.PerformClick(clickSignal);
|
|
174
|
+
// Debug.LogWarning("InteractionHandlerClient: PerformClick!");
|
|
175
|
+
// OpenURL();
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
public void OpenURL()
|
|
180
|
+
{
|
|
181
|
+
Debug.Log("Opened URL");
|
|
182
|
+
Application.OpenURL(_clickUrl);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
@@ -13,26 +13,23 @@ namespace Azerion.BlueStack.API
|
|
|
13
13
|
{
|
|
14
14
|
private IAdLoaderClient _adLoaderClient;
|
|
15
15
|
public event EventHandler<BlueStackError> OnNativeAdFailedToLoad;
|
|
16
|
-
public event EventHandler<NativeAdEventArgs> OnNativeAdLoaded;
|
|
16
|
+
public event EventHandler<NativeAdEventArgs> OnNativeAdLoaded;
|
|
17
17
|
|
|
18
18
|
internal bool IsAdLoaded;
|
|
19
19
|
internal GameObject AdGameObject;
|
|
20
20
|
private NativeAd _nativeAd;
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
public NativeAdLoader(string adUnitId)
|
|
23
23
|
{
|
|
24
|
-
AdUnitId = adUnitId;
|
|
25
|
-
|
|
24
|
+
AdUnitId = adUnitId;
|
|
25
|
+
|
|
26
26
|
NativeUtils.CheckInitialization();
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
_nativeAd = new NativeAd(AdUnitId);
|
|
29
|
-
|
|
30
|
-
_nativeAd.OnNativeAdDidFail += (sender, args) =>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
_nativeAd.OnNativeAdDidLoad +=(_sender, _args) =>
|
|
29
|
+
|
|
30
|
+
_nativeAd.OnNativeAdDidFail += (sender, args) => { OnNativeAdFailedToLoad?.Invoke(this, args); };
|
|
31
|
+
|
|
32
|
+
_nativeAd.OnNativeAdDidLoad += (_sender, _args) =>
|
|
36
33
|
{
|
|
37
34
|
NativeAdEventArgs nativeAdEventArgs = new NativeAdEventArgs
|
|
38
35
|
{
|
|
@@ -47,10 +44,9 @@ namespace Azerion.BlueStack.API
|
|
|
47
44
|
public HashSet<NativeAdType> AdTypes { get; private set; }
|
|
48
45
|
public HashSet<string> FormatIds { get; private set; }
|
|
49
46
|
internal int NumberOfAdsToLoad { get; private set; }
|
|
50
|
-
|
|
47
|
+
|
|
51
48
|
public void Load() => this._nativeAd.Load();
|
|
52
49
|
public void Load(Preference preference) => this._nativeAd.Load(preference);
|
|
53
50
|
public void Destroy() => this._nativeAd.Destroy();
|
|
54
51
|
}
|
|
55
|
-
|
|
56
52
|
}
|