com.azerion.bluestack 3.1.7 → 3.1.9
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/CHANGELOG.md +13 -1
- package/Editor/Android/AndroidDependencyModifier.cs +28 -16
- package/Editor/Android/Gradle/GradleConfigUtils.cs +0 -3
- package/Editor/Android/ManifestProcessor.cs +0 -3
- package/Editor/BlueStackAssetPostProcessor.cs +15 -0
- package/Editor/BlueStackAssetPostProcessor.cs.meta +11 -0
- package/Editor/BlueStackSettings.cs +0 -3
- package/Editor/BlueStackSettingsEditor.cs +14 -14
- package/Editor/Constants.cs +0 -3
- package/Editor/DependencyProvider.cs +30 -12
- package/Editor/MediationNetworkDependency.cs +4 -4
- package/Editor/iOS/BlueStackBuildPostProcess.cs +0 -1
- package/Editor/iOS/IOSDependencyModifier.cs +34 -32
- package/Editor/iOS/IOSDependencyParser.cs +0 -1
- package/Example/Scripts/NativeAdManager.cs +0 -4
- package/Example/Scripts/SmallNativeAdManager.cs +0 -4
- package/Runtime/API/Banner/BannerAd.cs +0 -2
- package/Runtime/API/NativeAd/NativeAd.cs +0 -1
- package/Runtime/API/NativeAd/NativeAdInteractionHandler.cs +1 -1
- package/Runtime/API/NativeAd/NativeAdLoader.cs +0 -2
- package/Runtime/API/NativeAd/NativeAdObject.cs +102 -58
- package/Runtime/Internal/IBannerAdClient.cs +0 -1
- package/Runtime/Internal/NativeAd/INativeAdClient.cs +0 -1
- package/Runtime/Platforms/Unity/BaseAdClient.cs +0 -1
- package/Runtime/Platforms/Unity/BlueStackClient.cs +0 -1
- package/Runtime/Platforms/Unity/NativeAdClient.cs +0 -2
- package/Runtime/Platforms/Unity/Utils.cs +0 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.1.9] - 2024-11-07
|
|
4
|
+
|
|
5
|
+
### fixed
|
|
6
|
+
|
|
7
|
+
- Removed unused namespaces and fixed assembly reference missing issue.
|
|
8
|
+
|
|
9
|
+
## [3.1.8] - 2024-11-07
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- BlueStackSettings Initialization on AssetPostProcess.
|
|
14
|
+
|
|
3
15
|
## [3.1.7] - 2024-10-23
|
|
4
16
|
|
|
5
17
|
### Changed
|
|
@@ -11,7 +23,7 @@
|
|
|
11
23
|
|
|
12
24
|
### Fixed
|
|
13
25
|
|
|
14
|
-
-
|
|
26
|
+
- Restricted interaction with Native ad objects while any overlay view is on top.
|
|
15
27
|
|
|
16
28
|
## [3.1.6] - 2024-07-26
|
|
17
29
|
|
|
@@ -29,6 +29,7 @@ namespace Azerion.BlueStack.Editor.Android
|
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
bool valueChanged = false;
|
|
32
33
|
// Remove all networks from the packages node
|
|
33
34
|
// androidPackages.RemoveAll();
|
|
34
35
|
|
|
@@ -41,16 +42,17 @@ namespace Azerion.BlueStack.Editor.Android
|
|
|
41
42
|
if (packageNode != null)
|
|
42
43
|
{
|
|
43
44
|
// Remove inactive network
|
|
44
|
-
if (!dependency.
|
|
45
|
+
if (!dependency.IsActive)
|
|
45
46
|
{
|
|
46
47
|
androidPackages.RemoveChild(packageNode);
|
|
48
|
+
valueChanged = true;
|
|
47
49
|
}
|
|
48
50
|
// else keep it
|
|
49
51
|
}
|
|
50
52
|
else
|
|
51
53
|
{
|
|
52
54
|
// Add new active network
|
|
53
|
-
if (dependency.
|
|
55
|
+
if (dependency.IsActive)
|
|
54
56
|
{
|
|
55
57
|
XmlElement package = xmlDoc.CreateElement("androidPackage");
|
|
56
58
|
package.SetAttribute("spec", dependency.Package);
|
|
@@ -60,54 +62,64 @@ namespace Azerion.BlueStack.Editor.Android
|
|
|
60
62
|
package.AppendChild(repositories);
|
|
61
63
|
}
|
|
62
64
|
androidPackages.AppendChild(package);
|
|
65
|
+
valueChanged = true;
|
|
63
66
|
}
|
|
64
67
|
}
|
|
65
68
|
}
|
|
66
69
|
|
|
67
70
|
// Replace main dependency XML content with the updated XML
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
if (valueChanged)
|
|
72
|
+
{
|
|
73
|
+
DependencyProvider.SaveDependenciesXMLFile(xmlDoc.OuterXml);
|
|
74
|
+
// Debug.Log("Android Mediation Dependencies are updated successfully in Main Dependencies XML.");
|
|
75
|
+
}
|
|
72
76
|
}
|
|
73
77
|
|
|
74
78
|
void IDependencyModifier.modifyMediationNetworkDependencies(string xmlFilePath,
|
|
75
79
|
List<MediationNetworkDependency> dependencies)
|
|
76
80
|
{
|
|
77
|
-
XmlDocument
|
|
81
|
+
XmlDocument mediationDependencyXML = new XmlDocument();
|
|
78
82
|
|
|
79
83
|
try
|
|
80
84
|
{
|
|
81
|
-
|
|
85
|
+
mediationDependencyXML.Load(xmlFilePath);
|
|
82
86
|
}
|
|
83
87
|
catch (IOException e)
|
|
84
88
|
{
|
|
85
89
|
throw new Exception("Unable to load xml, error: " + e.Message);
|
|
86
90
|
}
|
|
87
91
|
|
|
92
|
+
bool valueChanged = false;
|
|
88
93
|
foreach (MediationNetworkDependency dependency in dependencies)
|
|
89
94
|
{
|
|
90
95
|
XmlNode mainNode =
|
|
91
|
-
|
|
96
|
+
mediationDependencyXML.SelectSingleNode(
|
|
92
97
|
$"//networkList/androidNetworks/network[@name='{dependency.Name}']");
|
|
93
98
|
|
|
94
|
-
if (mainNode
|
|
99
|
+
if (mainNode is { Attributes: not null })
|
|
95
100
|
{
|
|
96
|
-
mainNode.Attributes["active"].Value
|
|
101
|
+
if (mainNode.Attributes["active"].Value != dependency.IsActive.ToString())
|
|
102
|
+
{
|
|
103
|
+
mainNode.Attributes["active"].Value = dependency.IsActive.ToString();
|
|
104
|
+
valueChanged = true;
|
|
105
|
+
}
|
|
97
106
|
}
|
|
98
107
|
else
|
|
99
108
|
{
|
|
100
109
|
// Node doesn't exists in Mediation Dependency XML
|
|
101
110
|
Debug.LogError(
|
|
102
|
-
|
|
111
|
+
"Something went wrong: " +
|
|
112
|
+
$"Node '{dependency.Name}' doesn't exists in Mediation Dependency XML! " +
|
|
103
113
|
"Please check if you have manually changed the xml");
|
|
104
114
|
}
|
|
105
115
|
}
|
|
106
116
|
|
|
107
|
-
// Save the modified XML
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
117
|
+
// if changed, Save the modified XML
|
|
118
|
+
if (valueChanged)
|
|
119
|
+
{
|
|
120
|
+
DependencyProvider.SaveMediationDependenciesXMLFile(mediationDependencyXML.OuterXml);
|
|
121
|
+
// Debug.Log("Android Mediation Dependency XML files merged and updated successfully.");
|
|
122
|
+
}
|
|
111
123
|
}
|
|
112
124
|
}
|
|
113
125
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
using UnityEditor;
|
|
2
|
+
|
|
3
|
+
namespace Azerion.BlueStack.Editor
|
|
4
|
+
{
|
|
5
|
+
public class BlueStackAssetPostProcessor : AssetPostprocessor
|
|
6
|
+
{
|
|
7
|
+
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets,
|
|
8
|
+
string[] movedFromAssetPaths, bool didDomainReload)
|
|
9
|
+
{
|
|
10
|
+
// This is Required when updating the SDK.
|
|
11
|
+
// Initialize and Sync dependencies when project loaded in Unity Editor.
|
|
12
|
+
BlueStackSettingsEditor.Initialize();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
using System;
|
|
2
2
|
using System.Collections.Generic;
|
|
3
3
|
using System.IO;
|
|
4
|
-
using System.Linq;
|
|
5
4
|
using UnityEditor;
|
|
6
5
|
using UnityEngine;
|
|
7
|
-
using System.Xml;
|
|
8
6
|
using Azerion.BlueStack.Editor.Android;
|
|
9
7
|
using Azerion.BlueStack.Editor.iOS;
|
|
10
8
|
|
|
@@ -40,6 +38,7 @@ namespace Azerion.BlueStack.Editor
|
|
|
40
38
|
{
|
|
41
39
|
if (BlueStackSettings.Instance == null)
|
|
42
40
|
{
|
|
41
|
+
Debug.LogWarning("BlueStackSettings Instance is not available!");
|
|
43
42
|
try
|
|
44
43
|
{
|
|
45
44
|
Directory.CreateDirectory(BlueStackSettingsResDir);
|
|
@@ -69,18 +68,19 @@ namespace Azerion.BlueStack.Editor
|
|
|
69
68
|
|
|
70
69
|
// This is Required when updating the SDK.
|
|
71
70
|
// Initialize and Sync dependencies when project loaded in Unity Editor.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
// This logic is now moved to OnPostprocessAllAssets of BlueStackAssetPostProcessor
|
|
72
|
+
// [InitializeOnLoadMethod]
|
|
73
|
+
// static void OnProjectLoadedInEditor()
|
|
74
|
+
// {
|
|
75
|
+
// Initialize();
|
|
76
|
+
// }
|
|
77
77
|
|
|
78
78
|
void OnEnable()
|
|
79
79
|
{
|
|
80
80
|
Initialize();
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
static void Initialize()
|
|
83
|
+
public static void Initialize()
|
|
84
84
|
{
|
|
85
85
|
if (!DoesBlueStackSettingsExist()) return;
|
|
86
86
|
|
|
@@ -121,10 +121,10 @@ namespace Azerion.BlueStack.Editor
|
|
|
121
121
|
foreach (var dependency in BlueStackSettings.Instance.AndroidMediationNetworks)
|
|
122
122
|
{
|
|
123
123
|
// dependency.Print();
|
|
124
|
-
bool newAutomaticConfigurationFilesUpdate = GUILayout.Toggle(dependency.
|
|
125
|
-
if (newAutomaticConfigurationFilesUpdate != dependency.
|
|
124
|
+
bool newAutomaticConfigurationFilesUpdate = GUILayout.Toggle(dependency.IsActive, dependency.Name);
|
|
125
|
+
if (newAutomaticConfigurationFilesUpdate != dependency.IsActive)
|
|
126
126
|
{
|
|
127
|
-
dependency.
|
|
127
|
+
dependency.IsActive = newAutomaticConfigurationFilesUpdate;
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
|
|
@@ -135,10 +135,10 @@ namespace Azerion.BlueStack.Editor
|
|
|
135
135
|
foreach (var dependency in BlueStackSettings.Instance.IOSMediationNetworks)
|
|
136
136
|
{
|
|
137
137
|
// dependency.Print();
|
|
138
|
-
bool newAutomaticConfigurationFilesUpdate = GUILayout.Toggle(dependency.
|
|
139
|
-
if (newAutomaticConfigurationFilesUpdate != dependency.
|
|
138
|
+
bool newAutomaticConfigurationFilesUpdate = GUILayout.Toggle(dependency.IsActive, dependency.Name);
|
|
139
|
+
if (newAutomaticConfigurationFilesUpdate != dependency.IsActive)
|
|
140
140
|
{
|
|
141
|
-
dependency.
|
|
141
|
+
dependency.IsActive = newAutomaticConfigurationFilesUpdate;
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
|
package/Editor/Constants.cs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
using System;
|
|
1
2
|
using System.Collections.Generic;
|
|
2
3
|
using System.IO;
|
|
3
4
|
using System.Xml;
|
|
@@ -67,9 +68,9 @@ namespace Azerion.BlueStack.Editor
|
|
|
67
68
|
public static void SyncDependenciesXMLs()
|
|
68
69
|
{
|
|
69
70
|
// Copy from the source
|
|
70
|
-
CopyDependenciesXMLFileToAssets()
|
|
71
|
-
if (CopyMediationDependenciesXMLFileToAssets())
|
|
71
|
+
if (CopyDependenciesXMLFileToAssets() & CopyMediationDependenciesXMLFileToAssets())
|
|
72
72
|
{
|
|
73
|
+
Debug.LogWarning("XML Files Copied from package to To Assets.");
|
|
73
74
|
return;
|
|
74
75
|
}
|
|
75
76
|
|
|
@@ -82,7 +83,7 @@ namespace Azerion.BlueStack.Editor
|
|
|
82
83
|
if (!XMLStructuresMatch(mainDependencyXML, updateDependencyXML))
|
|
83
84
|
{
|
|
84
85
|
Debug.LogWarning("XML structures do not match. replacing main with update.");
|
|
85
|
-
|
|
86
|
+
SaveMediationDependenciesXMLFile(updateDependencyXML.OuterXml);
|
|
86
87
|
return;
|
|
87
88
|
}
|
|
88
89
|
|
|
@@ -119,9 +120,7 @@ namespace Azerion.BlueStack.Editor
|
|
|
119
120
|
}
|
|
120
121
|
|
|
121
122
|
// Save the modified main XML
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
// Debug.Log("Mediation Dependency XML files merged and updated successfully.");
|
|
123
|
+
SaveMediationDependenciesXMLFile(mainDependencyXML.OuterXml);
|
|
125
124
|
}
|
|
126
125
|
|
|
127
126
|
private static bool XMLStructuresMatch(XmlDocument mainDoc, XmlDocument updateDoc)
|
|
@@ -141,21 +140,40 @@ namespace Azerion.BlueStack.Editor
|
|
|
141
140
|
return true;
|
|
142
141
|
}
|
|
143
142
|
}
|
|
143
|
+
|
|
144
|
+
public static void SaveDependenciesXMLFile(string updatedXML)
|
|
145
|
+
{
|
|
146
|
+
// Replace main mediation dependency XML content with the updated XML
|
|
147
|
+
System.IO.File.WriteAllText(_dependencyPathInAssets, updatedXML);
|
|
148
|
+
AssetDatabase.Refresh();
|
|
149
|
+
}
|
|
144
150
|
|
|
145
|
-
public static void
|
|
151
|
+
public static void SaveMediationDependenciesXMLFile(string updatedXML)
|
|
146
152
|
{
|
|
147
153
|
// Replace main mediation dependency XML content with the updated XML
|
|
148
154
|
System.IO.File.WriteAllText(_mediationDependencyPathInAssets, updatedXML);
|
|
149
155
|
AssetDatabase.Refresh();
|
|
150
156
|
}
|
|
151
|
-
|
|
152
|
-
|
|
157
|
+
|
|
158
|
+
public static void SaveMainXMLFile(string updatedXML, string path)
|
|
153
159
|
{
|
|
154
|
-
|
|
155
|
-
|
|
160
|
+
// Replace main XML content with the updated XML
|
|
161
|
+
System.IO.File.WriteAllText(path, updatedXML);
|
|
156
162
|
AssetDatabase.Refresh();
|
|
157
163
|
}
|
|
158
164
|
|
|
165
|
+
private static bool CopyDependenciesXMLFileToAssets()
|
|
166
|
+
{
|
|
167
|
+
if (!File.Exists(_dependencyPathInAssets))
|
|
168
|
+
{
|
|
169
|
+
Directory.CreateDirectory(_editorPathInAssets);
|
|
170
|
+
FileUtil.ReplaceFile(_dependencyPathInPackage, _dependencyPathInAssets);
|
|
171
|
+
AssetDatabase.Refresh();
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
|
|
159
177
|
private static bool CopyMediationDependenciesXMLFileToAssets()
|
|
160
178
|
{
|
|
161
179
|
// Delete previous BlueStackMediationDependencies.xml file - TODO: remove in future
|
|
@@ -180,7 +198,7 @@ namespace Azerion.BlueStack.Editor
|
|
|
180
198
|
Debug.Log($"====================={dependencies.Count}=====================>");
|
|
181
199
|
foreach (MediationNetworkDependency dependency in dependencies)
|
|
182
200
|
{
|
|
183
|
-
Debug.Log($"Network Name: {dependency.Name}, Package: {dependency.Package}, Status: {dependency.
|
|
201
|
+
Debug.Log($"Network Name: {dependency.Name}, Package: {dependency.Package}, Status: {dependency.IsActive}");
|
|
184
202
|
}
|
|
185
203
|
Debug.Log("<==========================================");
|
|
186
204
|
}
|
|
@@ -7,22 +7,22 @@ namespace Azerion.BlueStack.Editor
|
|
|
7
7
|
[Serializable]
|
|
8
8
|
public class MediationNetworkDependency
|
|
9
9
|
{
|
|
10
|
-
public MediationNetworkDependency(string name, string package, bool
|
|
10
|
+
public MediationNetworkDependency(string name, string package, bool isActive, XmlNode repositories = null)
|
|
11
11
|
{
|
|
12
12
|
Name = name;
|
|
13
13
|
Package = package;
|
|
14
|
-
|
|
14
|
+
IsActive = isActive;
|
|
15
15
|
Repositories = repositories;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
public string Name { get; set; }
|
|
19
19
|
public string Package { get; set; }
|
|
20
|
-
public bool
|
|
20
|
+
public bool IsActive { get; set; }
|
|
21
21
|
public XmlNode Repositories { get; set; }
|
|
22
22
|
|
|
23
23
|
public void Print()
|
|
24
24
|
{
|
|
25
|
-
Debug.Log("Name: " + Name + "Package: " + Package + "Active: " +
|
|
25
|
+
Debug.Log("Name: " + Name + "Package: " + Package + "Active: " + IsActive + "\nRepositories: " + Repositories.ToString());
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
using System;
|
|
2
2
|
using System.Collections.Generic;
|
|
3
3
|
using System.IO;
|
|
4
|
-
using System.Linq;
|
|
5
4
|
using System.Xml;
|
|
6
|
-
using UnityEditor;
|
|
7
5
|
using UnityEngine;
|
|
8
6
|
|
|
9
7
|
namespace Azerion.BlueStack.Editor.iOS
|
|
@@ -24,14 +22,13 @@ namespace Azerion.BlueStack.Editor.iOS
|
|
|
24
22
|
}
|
|
25
23
|
|
|
26
24
|
XmlNode mainNode = xmlDoc.SelectSingleNode($"//dependencies/iosPods/iosPod[@name='BlueStack-SDK']");
|
|
27
|
-
if (mainNode
|
|
25
|
+
if (mainNode?.Attributes == null)
|
|
28
26
|
{
|
|
29
27
|
Debug.LogError("No node with the name 'BlueStack-SDK' found in the xml");
|
|
30
28
|
return;
|
|
31
29
|
}
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
if (subspecsAttribute == null)
|
|
31
|
+
if (mainNode.Attributes["subspecs"] == null)
|
|
35
32
|
{
|
|
36
33
|
Debug.LogError("No 'subspecs' Attribute found in the node 'BlueStack-SDK'");
|
|
37
34
|
return;
|
|
@@ -39,67 +36,72 @@ namespace Azerion.BlueStack.Editor.iOS
|
|
|
39
36
|
|
|
40
37
|
// remove all inactive networks from the list
|
|
41
38
|
// dependencies.RemoveAll(a => dependencies.Any(b => !b.Active));
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
|
|
40
|
+
string subspecsValue;
|
|
41
|
+
subspecsValue = "[";
|
|
44
42
|
foreach (MediationNetworkDependency dependency in dependencies)
|
|
45
43
|
{
|
|
46
|
-
if (dependency.
|
|
44
|
+
if (dependency.IsActive)
|
|
47
45
|
{
|
|
48
|
-
|
|
46
|
+
subspecsValue += $"'{dependency.Package}', ";
|
|
49
47
|
}
|
|
50
48
|
}
|
|
51
|
-
|
|
49
|
+
subspecsValue += "]";
|
|
52
50
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
if (subspecsValue != mainNode.Attributes["subspecs"].Value)
|
|
52
|
+
{
|
|
53
|
+
mainNode.Attributes["subspecs"].Value = subspecsValue;
|
|
54
|
+
|
|
55
|
+
// Replace main dependency XML content with the updated XML
|
|
56
|
+
DependencyProvider.SaveDependenciesXMLFile(xmlDoc.OuterXml);
|
|
57
|
+
// Debug.Log("iOS Mediation Dependencies are updated successfully in Main Dependencies XML.");
|
|
58
|
+
}
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
void IDependencyModifier.modifyMediationNetworkDependencies(string xmlFilePath,
|
|
61
62
|
List<MediationNetworkDependency> dependencies)
|
|
62
63
|
{
|
|
63
|
-
XmlDocument
|
|
64
|
+
XmlDocument mediationDependencyXML = new XmlDocument();
|
|
64
65
|
|
|
65
66
|
try
|
|
66
67
|
{
|
|
67
|
-
|
|
68
|
+
mediationDependencyXML.Load(xmlFilePath);
|
|
68
69
|
}
|
|
69
70
|
catch (IOException e)
|
|
70
71
|
{
|
|
71
72
|
throw new Exception("Unable to load xml, error: " + e.Message);
|
|
72
73
|
}
|
|
73
74
|
|
|
75
|
+
bool valueChanged = false;
|
|
74
76
|
foreach (MediationNetworkDependency dependency in dependencies)
|
|
75
77
|
{
|
|
76
78
|
XmlNode mainNode =
|
|
77
|
-
|
|
79
|
+
mediationDependencyXML.SelectSingleNode($"//networkList/iosNetworks/network[@name='{dependency.Name}']");
|
|
78
80
|
|
|
79
|
-
if (mainNode
|
|
81
|
+
if (mainNode is { Attributes: not null })
|
|
80
82
|
{
|
|
81
|
-
mainNode.Attributes["active"].Value
|
|
83
|
+
if (mainNode.Attributes["active"].Value != dependency.IsActive.ToString())
|
|
84
|
+
{
|
|
85
|
+
mainNode.Attributes["active"].Value = dependency.IsActive.ToString();
|
|
86
|
+
valueChanged = true;
|
|
87
|
+
}
|
|
82
88
|
}
|
|
83
89
|
else
|
|
84
90
|
{
|
|
85
91
|
// Node doesn't exists in Mediation Dependency XML
|
|
86
92
|
Debug.LogError(
|
|
87
|
-
$"Something went wrong:
|
|
93
|
+
$"Something went wrong: " +
|
|
94
|
+
$"Node '{dependency.Name}' doesn't exists in Mediation Dependency XML! " +
|
|
88
95
|
"Please check if you have manually changed the xml");
|
|
89
96
|
}
|
|
90
97
|
}
|
|
91
|
-
|
|
98
|
+
|
|
92
99
|
// Replace main mediation dependency XML content with the modified XML
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
private static void SaveMainXMLFile(string updatedXML, string path)
|
|
99
|
-
{
|
|
100
|
-
// Replace main mediation dependency XML content with the updated XML
|
|
101
|
-
System.IO.File.WriteAllText(path, updatedXML);
|
|
102
|
-
AssetDatabase.Refresh();
|
|
100
|
+
if (valueChanged)
|
|
101
|
+
{
|
|
102
|
+
DependencyProvider.SaveMediationDependenciesXMLFile(mediationDependencyXML.OuterXml);
|
|
103
|
+
// Debug.Log("iOS Mediation Network Dependencies XML file updated successfully.");
|
|
104
|
+
}
|
|
103
105
|
}
|
|
104
106
|
}
|
|
105
107
|
}
|
|
@@ -87,7 +87,7 @@ namespace Azerion.BlueStack.API
|
|
|
87
87
|
{
|
|
88
88
|
nativeAdObject.Initialize(assetID, isImpressive, isClickable);
|
|
89
89
|
}
|
|
90
|
-
catch (
|
|
90
|
+
catch (SystemException ex)
|
|
91
91
|
{
|
|
92
92
|
Debug.LogWarning("Unable to initialize nativeAdObject!");
|
|
93
93
|
Debug.LogException(ex);
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
using Azerion.BlueStack.Common;
|
|
2
2
|
using System;
|
|
3
3
|
using System.Collections.Generic;
|
|
4
|
-
using System.Threading;
|
|
5
4
|
using UnityEngine;
|
|
6
5
|
using UnityEngine.EventSystems;
|
|
7
|
-
using UnityEngine.Serialization;
|
|
8
6
|
using UnityEngine.UI;
|
|
9
7
|
|
|
10
8
|
namespace Azerion.BlueStack.API
|
|
@@ -34,7 +32,7 @@ namespace Azerion.BlueStack.API
|
|
|
34
32
|
ObstructedHit,
|
|
35
33
|
UnobstructedHit,
|
|
36
34
|
}
|
|
37
|
-
|
|
35
|
+
|
|
38
36
|
[AddComponentMenu(""), DisallowMultipleComponent, HideInInspector]
|
|
39
37
|
internal sealed class NativeAdObject : MonoBehaviour
|
|
40
38
|
{
|
|
@@ -51,11 +49,46 @@ namespace Azerion.BlueStack.API
|
|
|
51
49
|
internal bool HasMadeImpression;
|
|
52
50
|
internal bool IsImpressive;
|
|
53
51
|
internal bool IsClickable;
|
|
54
|
-
|
|
52
|
+
internal bool IsUIObject;
|
|
53
|
+
|
|
54
|
+
|
|
55
55
|
internal float InteractionTime { get; private set; }
|
|
56
56
|
|
|
57
57
|
internal string ObjectTag { get; private set; }
|
|
58
58
|
|
|
59
|
+
private Canvas _canvas;
|
|
60
|
+
private Canvas CanvasComponent
|
|
61
|
+
{
|
|
62
|
+
get
|
|
63
|
+
{
|
|
64
|
+
if (_canvas == null)
|
|
65
|
+
{
|
|
66
|
+
_canvas = GetComponent<Canvas>();
|
|
67
|
+
|
|
68
|
+
if (_canvas == null)
|
|
69
|
+
{
|
|
70
|
+
_canvas = GetComponentInParent<Canvas>();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return _canvas;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
private CanvasRenderer _canvasRenderer;
|
|
78
|
+
private CanvasRenderer CanvasRendererComponent => _canvasRenderer ??= GetComponent<CanvasRenderer>();
|
|
79
|
+
|
|
80
|
+
private RectTransform _rectTransform;
|
|
81
|
+
private RectTransform RectTransformComponent => _rectTransform ??= GetComponent<RectTransform>();
|
|
82
|
+
|
|
83
|
+
private Renderer _renderer;
|
|
84
|
+
private Renderer RendererComponent => _renderer ??= GetComponent<Renderer>();
|
|
85
|
+
|
|
86
|
+
private Collider2D _collider2D;
|
|
87
|
+
private Collider2D Collider2DComponent => _collider2D ??= GetComponent<Collider2D>();
|
|
88
|
+
|
|
89
|
+
private Collider _collider;
|
|
90
|
+
private Collider ColliderComponent => _collider ??= GetComponent<Collider>();
|
|
91
|
+
|
|
59
92
|
public void Start()
|
|
60
93
|
{
|
|
61
94
|
_lastInteractionTime = 0f;
|
|
@@ -69,7 +102,7 @@ namespace Azerion.BlueStack.API
|
|
|
69
102
|
IsClickable = isClickable;
|
|
70
103
|
|
|
71
104
|
// Check for Collider or Collider2D
|
|
72
|
-
if (!
|
|
105
|
+
if (!HasCollider())
|
|
73
106
|
{
|
|
74
107
|
throw new MissingComponentException("No Collider or Collider2D component found.");
|
|
75
108
|
}
|
|
@@ -77,7 +110,7 @@ namespace Azerion.BlueStack.API
|
|
|
77
110
|
// Check if the GameObject has a Renderer or is a valid UI object
|
|
78
111
|
if (!ValidateRendererOrUIObject(nativeAssetID))
|
|
79
112
|
{
|
|
80
|
-
throw new
|
|
113
|
+
throw new InvalidOperationException("Not a valid Ad Object.");
|
|
81
114
|
}
|
|
82
115
|
|
|
83
116
|
if (IsImpressive)
|
|
@@ -135,11 +168,11 @@ namespace Azerion.BlueStack.API
|
|
|
135
168
|
Bounds worldSpaceBounds;
|
|
136
169
|
if (!_is2DColliderPresent) // Check if 3D object
|
|
137
170
|
{
|
|
138
|
-
worldSpaceBounds =
|
|
171
|
+
worldSpaceBounds = ColliderComponent.bounds;
|
|
139
172
|
}
|
|
140
173
|
else
|
|
141
174
|
{
|
|
142
|
-
worldSpaceBounds =
|
|
175
|
+
worldSpaceBounds = Collider2DComponent.bounds;
|
|
143
176
|
}
|
|
144
177
|
|
|
145
178
|
// Get max bounds
|
|
@@ -208,7 +241,7 @@ namespace Azerion.BlueStack.API
|
|
|
208
241
|
// Check if the raycast hit is obstructed by a Collider component
|
|
209
242
|
if (rayIntersection2D.collider != null)
|
|
210
243
|
{
|
|
211
|
-
if (rayIntersection2D.collider ==
|
|
244
|
+
if (rayIntersection2D.collider == Collider2DComponent)
|
|
212
245
|
{
|
|
213
246
|
// Perform a 3D raycast and store the result
|
|
214
247
|
if (Physics.Raycast(ray, out var hitInfo3D, float.PositiveInfinity))
|
|
@@ -220,7 +253,7 @@ namespace Azerion.BlueStack.API
|
|
|
220
253
|
}
|
|
221
254
|
}
|
|
222
255
|
|
|
223
|
-
if (
|
|
256
|
+
if (IsUIObject)
|
|
224
257
|
{
|
|
225
258
|
return CheckHitStatusCanvas(position);
|
|
226
259
|
}
|
|
@@ -230,13 +263,13 @@ namespace Azerion.BlueStack.API
|
|
|
230
263
|
}
|
|
231
264
|
|
|
232
265
|
// Check if the 2D raycast is hit but Obstructed
|
|
233
|
-
if(NativeUtils.CheckRayHits2DCollider(ray,
|
|
266
|
+
if(NativeUtils.CheckRayHits2DCollider(ray, Collider2DComponent))
|
|
234
267
|
{
|
|
235
268
|
return HitStatus.ObstructedHit;
|
|
236
269
|
}
|
|
237
270
|
}
|
|
238
271
|
// Check if the gameobject is rendered in the screen space overlay canvas and valid UI Object
|
|
239
|
-
// else if (NativeUtils.IsRenderedInScreenSpaceOverlayCanvas(gameObject) &&
|
|
272
|
+
// else if (NativeUtils.IsRenderedInScreenSpaceOverlayCanvas(gameObject) && IsUIObject)
|
|
240
273
|
// {
|
|
241
274
|
// return CheckHitStatusCanvas(position);
|
|
242
275
|
// }
|
|
@@ -301,13 +334,13 @@ namespace Azerion.BlueStack.API
|
|
|
301
334
|
// Initialize variables for raycast hits
|
|
302
335
|
RaycastHit hitInfo3D;
|
|
303
336
|
RaycastHit2D rayIntersection2D;
|
|
304
|
-
// bool isHit =
|
|
337
|
+
// bool isHit = AdObjCollider.Raycast(ray, out hitInfo3D, float.PositiveInfinity);
|
|
305
338
|
|
|
306
339
|
// Check for 3D raycast hit
|
|
307
340
|
if (Physics.Raycast(ray, out hitInfo3D, float.PositiveInfinity))
|
|
308
341
|
{
|
|
309
342
|
// Check if the hit object is the current object
|
|
310
|
-
if (hitInfo3D.collider ==
|
|
343
|
+
if (hitInfo3D.collider == ColliderComponent)
|
|
311
344
|
{
|
|
312
345
|
rayIntersection2D = Physics2D.GetRayIntersection(ray);
|
|
313
346
|
if (rayIntersection2D.collider != null)
|
|
@@ -319,7 +352,7 @@ namespace Azerion.BlueStack.API
|
|
|
319
352
|
}
|
|
320
353
|
}
|
|
321
354
|
|
|
322
|
-
if (
|
|
355
|
+
if (IsUIObject)
|
|
323
356
|
{
|
|
324
357
|
return CheckHitStatusCanvas(position);
|
|
325
358
|
}
|
|
@@ -329,13 +362,13 @@ namespace Azerion.BlueStack.API
|
|
|
329
362
|
}
|
|
330
363
|
|
|
331
364
|
// Check if the 3D raycast is hit but Obstructed
|
|
332
|
-
if(NativeUtils.CheckRayHits3DCollider(ray,
|
|
365
|
+
if(NativeUtils.CheckRayHits3DCollider(ray, ColliderComponent))
|
|
333
366
|
{
|
|
334
367
|
return HitStatus.ObstructedHit;
|
|
335
368
|
}
|
|
336
369
|
}
|
|
337
370
|
// Check if the gameobject is rendered in the screen space overlay canvas and valid UI Object
|
|
338
|
-
// else if (NativeUtils.IsRenderedInScreenSpaceOverlayCanvas(gameObject) &&
|
|
371
|
+
// else if (NativeUtils.IsRenderedInScreenSpaceOverlayCanvas(gameObject) && IsUIObject)
|
|
339
372
|
// {
|
|
340
373
|
// return CheckHitStatusCanvas(position);
|
|
341
374
|
// }
|
|
@@ -407,18 +440,21 @@ namespace Azerion.BlueStack.API
|
|
|
407
440
|
// Method to check if a UI element overlaps with the screen
|
|
408
441
|
private bool DoesUIElementOverlapScreen()
|
|
409
442
|
{
|
|
410
|
-
|
|
411
|
-
|
|
443
|
+
if (RectTransformComponent == null)
|
|
444
|
+
{
|
|
445
|
+
Debug.LogWarning(ObjectTag + ": RectTransform component is missing.");
|
|
446
|
+
return false;
|
|
447
|
+
}
|
|
412
448
|
|
|
413
449
|
// Create a rect for the screen size
|
|
414
450
|
Rect screenRect = new Rect(0.0f, 0.0f, Screen.width, Screen.height);
|
|
415
451
|
|
|
416
452
|
// Get the anchored position of the UI element
|
|
417
|
-
float x =
|
|
418
|
-
float y = Screen.height -
|
|
453
|
+
float x = RectTransformComponent.anchoredPosition.x + RectTransformComponent.position.x;
|
|
454
|
+
float y = Screen.height - RectTransformComponent.position.y - RectTransformComponent.anchoredPosition.y;
|
|
419
455
|
|
|
420
456
|
// Get the size of the UI element
|
|
421
|
-
Vector2 elementSize = Vector2.Scale(
|
|
457
|
+
Vector2 elementSize = Vector2.Scale(RectTransformComponent.rect.size, RectTransformComponent.lossyScale);
|
|
422
458
|
|
|
423
459
|
// Create a rect for the UI element
|
|
424
460
|
Rect elementRect = new Rect(x, y, elementSize.x, elementSize.y);
|
|
@@ -445,11 +481,11 @@ namespace Azerion.BlueStack.API
|
|
|
445
481
|
Bounds bounds;
|
|
446
482
|
if (_is2DColliderPresent)
|
|
447
483
|
{
|
|
448
|
-
bounds =
|
|
484
|
+
bounds = Collider2DComponent.bounds;
|
|
449
485
|
}
|
|
450
486
|
else
|
|
451
487
|
{
|
|
452
|
-
bounds =
|
|
488
|
+
bounds = ColliderComponent.bounds;
|
|
453
489
|
}
|
|
454
490
|
// Debug.LogWarning("bounds: " + bounds);
|
|
455
491
|
|
|
@@ -514,15 +550,16 @@ namespace Azerion.BlueStack.API
|
|
|
514
550
|
return 1.0f;
|
|
515
551
|
}
|
|
516
552
|
|
|
517
|
-
private bool
|
|
553
|
+
private bool HasCollider()
|
|
518
554
|
{
|
|
519
555
|
// Check for the presence of a Collider or Collider2D component
|
|
520
|
-
if (
|
|
556
|
+
if (ColliderComponent != null)
|
|
521
557
|
{
|
|
522
558
|
// Regular 3D collider found, no issues
|
|
523
559
|
return true;
|
|
524
560
|
}
|
|
525
|
-
|
|
561
|
+
|
|
562
|
+
if (Collider2DComponent != null)
|
|
526
563
|
{
|
|
527
564
|
// 2D collider found, set the flag for later use
|
|
528
565
|
_is2DColliderPresent = true;
|
|
@@ -536,15 +573,14 @@ namespace Azerion.BlueStack.API
|
|
|
536
573
|
private bool ValidateRendererOrUIObject(string nativeAssetID)
|
|
537
574
|
{
|
|
538
575
|
// Check for Renderer component on the GameObject
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
if (rendererComponent != null)
|
|
576
|
+
if (RendererComponent != null)
|
|
542
577
|
{
|
|
543
|
-
Debug.Log($"RendererComponent.isVisible: {nativeAssetID} : {
|
|
578
|
+
Debug.Log($"RendererComponent.isVisible: {nativeAssetID} : {RendererComponent.isVisible}");
|
|
544
579
|
|
|
545
580
|
// Throw an exception if the object is not visible
|
|
546
|
-
if (!
|
|
581
|
+
if (!RendererComponent.isVisible)
|
|
547
582
|
{
|
|
583
|
+
Debug.Log("Renderer Component not visible!!");
|
|
548
584
|
throw new InvalidOperationException("Object is not visible.");
|
|
549
585
|
}
|
|
550
586
|
|
|
@@ -553,9 +589,9 @@ namespace Azerion.BlueStack.API
|
|
|
553
589
|
}
|
|
554
590
|
|
|
555
591
|
// If no Renderer, check if the GameObject is a valid UI object
|
|
556
|
-
|
|
592
|
+
IsUIObject = IsValidUIObject();
|
|
593
|
+
if (IsUIObject)
|
|
557
594
|
{
|
|
558
|
-
// Valid UI Object
|
|
559
595
|
return true;
|
|
560
596
|
}
|
|
561
597
|
|
|
@@ -563,42 +599,47 @@ namespace Azerion.BlueStack.API
|
|
|
563
599
|
return false;
|
|
564
600
|
}
|
|
565
601
|
|
|
566
|
-
// TODO: More testing and Improvement required
|
|
567
|
-
// TODO: BSSDK-401 : Move viewability to container level - may not have a container
|
|
568
602
|
private bool IsValidUIObject()
|
|
569
603
|
{
|
|
570
|
-
|
|
571
|
-
if (canvas == null)
|
|
604
|
+
if (CanvasComponent == null)
|
|
572
605
|
{
|
|
573
|
-
//
|
|
606
|
+
// throw new MissingComponentException("Unable to find Canvas component in parents.");
|
|
607
|
+
Debug.LogWarning(ObjectTag + ": Unable to find Canvas component in parents.");
|
|
574
608
|
return false;
|
|
575
609
|
}
|
|
576
610
|
|
|
577
|
-
|
|
578
|
-
if (rectTransform == null)
|
|
611
|
+
if (RectTransformComponent == null)
|
|
579
612
|
{
|
|
580
|
-
//
|
|
613
|
+
// throw new MissingComponentException("RectTransform component is missing.");
|
|
614
|
+
Debug.LogWarning(ObjectTag + ": RectTransform component is missing.");
|
|
581
615
|
return false;
|
|
582
616
|
}
|
|
583
617
|
|
|
584
|
-
|
|
585
|
-
if (canvasRenderer == null)
|
|
618
|
+
if (CanvasRendererComponent == null)
|
|
586
619
|
{
|
|
587
|
-
//
|
|
620
|
+
// throw new MissingComponentException("CanvasRenderer component is missing.");
|
|
621
|
+
Debug.LogWarning(ObjectTag + ": CanvasRenderer component is missing.");
|
|
588
622
|
return false;
|
|
589
623
|
}
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
624
|
+
|
|
625
|
+
return true;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
// TODO: More testing and Improvement required
|
|
629
|
+
// TODO: BSSDK-401 : Move viewability to container level - may not have a container
|
|
630
|
+
|
|
631
|
+
// In future if want to check the center position or full object inside the viewport
|
|
632
|
+
|
|
633
|
+
// Check if the center is inside the viewport
|
|
634
|
+
private bool IsCenterInsideViewport()
|
|
635
|
+
{
|
|
636
|
+
Rect rect = RectTransformComponent.rect;
|
|
596
637
|
|
|
597
638
|
// Get the center position of the RectTransform in its local coordinates
|
|
598
639
|
Vector2 centerLocalPosition = new Vector2(rect.center.x, rect.center.y);
|
|
599
640
|
|
|
600
641
|
// Convert the local center position to world position
|
|
601
|
-
Vector3 centerWorldPosition =
|
|
642
|
+
Vector3 centerWorldPosition = RectTransformComponent.TransformPoint(centerLocalPosition);
|
|
602
643
|
Debug.Log("centerWorldPosition: " + centerWorldPosition);
|
|
603
644
|
|
|
604
645
|
Vector3 centerViewportPoint = NativeUtils.GetCamera().WorldToViewportPoint(centerWorldPosition);
|
|
@@ -610,9 +651,14 @@ namespace Azerion.BlueStack.API
|
|
|
610
651
|
return true;
|
|
611
652
|
}
|
|
612
653
|
|
|
613
|
-
|
|
654
|
+
return false;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
// Check if the object is completely inside the viewport
|
|
658
|
+
private bool IsCompletelyInsideViewport()
|
|
659
|
+
{
|
|
614
660
|
Vector3[] corners = new Vector3[4];
|
|
615
|
-
|
|
661
|
+
RectTransformComponent.GetWorldCorners(corners);
|
|
616
662
|
foreach (Vector3 corner in corners)
|
|
617
663
|
{
|
|
618
664
|
Vector3 cornerViewportPoint = NativeUtils.GetCamera().WorldToViewportPoint(corner);
|
|
@@ -623,10 +669,8 @@ namespace Azerion.BlueStack.API
|
|
|
623
669
|
return true;
|
|
624
670
|
}
|
|
625
671
|
}
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
return true;
|
|
672
|
+
|
|
673
|
+
return false;
|
|
630
674
|
}
|
|
631
675
|
|
|
632
676
|
}
|
package/package.json
CHANGED