com.azerion.bluestack 3.1.6 → 3.1.8
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 +24 -0
- package/Editor/Android/AndroidDependencyModifier.cs +28 -16
- package/Editor/BlueStackAssetPostProcessor.cs +16 -0
- package/Editor/BlueStackAssetPostProcessor.cs.meta +11 -0
- package/Editor/BlueStackSettingsEditor.cs +25 -25
- package/Editor/DependencyProvider.cs +34 -54
- package/Editor/MediationNetworkDependency.cs +4 -4
- package/Editor/iOS/IOSDependencyModifier.cs +34 -30
- package/Example/Scripts/NativeAdManager.cs +4 -4
- package/Example/Scripts/SmallNativeAdManager.cs +3 -3
- package/Runtime/API/NativeAd/NativeAd.cs +4 -7
- package/Runtime/API/NativeAd/NativeAdInteractionHandler.cs +1 -1
- package/Runtime/API/NativeAd/NativeAdObject.cs +260 -153
- package/Runtime/API/Rewarded/RewardedItem.cs +3 -2
- package/Runtime/API/Rewarded/RewardedVideoAd.cs +3 -1
- package/Runtime/Common/NativeAd/NativeUtils.cs +61 -0
- package/Runtime/Internal/IRewardedVideoAdClient.cs +0 -1
- package/Runtime/Platforms/Android/RewardedVideoAdClient.cs +0 -1
- package/Runtime/Platforms/Unity/AdvertisementManager.cs +0 -1
- package/Runtime/Platforms/Unity/RewardedTimer.cs +1 -1
- package/Runtime/Platforms/Unity/RewardedVideoAdClient.cs +0 -1
- package/Runtime/Platforms/iOS/RewardedVideoAdClient.cs +0 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,24 +1,48 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.1.8] - 2024-11-07
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- BlueStackSettings Initialization on AssetPostProcess
|
|
8
|
+
|
|
9
|
+
## [3.1.7] - 2024-10-23
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Renamed the `GetBadge` method to `GetBadgeText`
|
|
14
|
+
- Renamed the `GetTitle` method to `GetTitleText`
|
|
15
|
+
- Renamed the `RegisterImageGameObject` method to `RegisterCoverImageGameObject`
|
|
16
|
+
- Renamed the `RegisterCallToActionGameObject` method to `RegisterCallToActionTextGameObject`
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- Restricted interaction with Native ad objects while any overlay view is on top.
|
|
21
|
+
|
|
3
22
|
## [3.1.6] - 2024-07-26
|
|
4
23
|
|
|
5
24
|
### Changed
|
|
25
|
+
|
|
6
26
|
- BlueStack Android SDK version upgraded to 4.4.0
|
|
7
27
|
|
|
8
28
|
### Added
|
|
29
|
+
|
|
9
30
|
- Manage Android mediation networks from the BlueStack Settings
|
|
10
31
|
|
|
11
32
|
## [3.1.5] - 2024-07-10
|
|
12
33
|
|
|
13
34
|
### Added
|
|
35
|
+
|
|
14
36
|
- Method added to refresh Banner in the unity editor
|
|
15
37
|
- Native ad Close method added to trigger OnNativeAdClosed event in the editor
|
|
16
38
|
|
|
17
39
|
### Changed
|
|
40
|
+
|
|
18
41
|
- Unity deprecated methods handled
|
|
19
42
|
- Readme doc update
|
|
20
43
|
|
|
21
44
|
### Fixed
|
|
45
|
+
|
|
22
46
|
- Fixed the BlueStack Settings null exception issue when no settings exist
|
|
23
47
|
- Fixed the issue with saving AdMob App ids
|
|
24
48
|
- Error handled in Native ads, in case of null or empty image urls
|
|
@@ -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,16 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
using UnityEditor;
|
|
3
|
+
|
|
4
|
+
namespace Azerion.BlueStack.Editor
|
|
5
|
+
{
|
|
6
|
+
public class BlueStackAssetPostProcessor : AssetPostprocessor
|
|
7
|
+
{
|
|
8
|
+
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets,
|
|
9
|
+
string[] movedFromAssetPaths, bool didDomainReload)
|
|
10
|
+
{
|
|
11
|
+
// This is Required when updating the SDK.
|
|
12
|
+
// Initialize and Sync dependencies when project loaded in Unity Editor.
|
|
13
|
+
BlueStackSettingsEditor.Initialize();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -40,6 +40,7 @@ namespace Azerion.BlueStack.Editor
|
|
|
40
40
|
{
|
|
41
41
|
if (BlueStackSettings.Instance == null)
|
|
42
42
|
{
|
|
43
|
+
Debug.LogWarning("BlueStackSettings Instance is not available!");
|
|
43
44
|
try
|
|
44
45
|
{
|
|
45
46
|
Directory.CreateDirectory(BlueStackSettingsResDir);
|
|
@@ -69,21 +70,20 @@ namespace Azerion.BlueStack.Editor
|
|
|
69
70
|
|
|
70
71
|
// This is Required when updating the SDK.
|
|
71
72
|
// Initialize and Sync dependencies when project loaded in Unity Editor.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
// This logic is now moved to OnPostprocessAllAssets of BlueStackAssetPostProcessor
|
|
74
|
+
// [InitializeOnLoadMethod]
|
|
75
|
+
// static void OnProjectLoadedInEditor()
|
|
76
|
+
// {
|
|
77
|
+
// Initialize();
|
|
78
|
+
// }
|
|
77
79
|
|
|
78
80
|
void OnEnable()
|
|
79
81
|
{
|
|
80
82
|
Initialize();
|
|
81
83
|
}
|
|
82
84
|
|
|
83
|
-
static void Initialize()
|
|
85
|
+
public static void Initialize()
|
|
84
86
|
{
|
|
85
|
-
Debug.LogWarning("BlueStackSettings Initialize");
|
|
86
|
-
|
|
87
87
|
if (!DoesBlueStackSettingsExist()) return;
|
|
88
88
|
|
|
89
89
|
BlueStackSettings.Instance.IOSMediationNetworks.Clear();
|
|
@@ -110,37 +110,37 @@ namespace Azerion.BlueStack.Editor
|
|
|
110
110
|
EditorGUI.BeginChangeCheck();
|
|
111
111
|
serializedObject.Update();
|
|
112
112
|
|
|
113
|
-
iOSAdmobAppIdProperty = serializedObject.FindProperty("admobAppIdIOS");
|
|
114
113
|
androidAdmobAppIdProperty = serializedObject.FindProperty("admobAppIdAndroid");
|
|
114
|
+
iOSAdmobAppIdProperty = serializedObject.FindProperty("admobAppIdIOS");
|
|
115
115
|
|
|
116
|
-
EditorGUILayout.PropertyField(iOSAdmobAppIdProperty, new GUIContent("Admob AppId IOS: "));
|
|
117
116
|
EditorGUILayout.PropertyField(androidAdmobAppIdProperty, new GUIContent("Admob AppId Android: "));
|
|
117
|
+
EditorGUILayout.PropertyField(iOSAdmobAppIdProperty, new GUIContent("Admob AppId IOS: "));
|
|
118
118
|
|
|
119
|
-
//
|
|
119
|
+
// Android Mediation Networks
|
|
120
120
|
EditorGUILayout.Separator();
|
|
121
|
-
EditorGUILayout.LabelField("
|
|
121
|
+
EditorGUILayout.LabelField("Android Mediation Networks: ", EditorStyles.boldLabel);
|
|
122
122
|
|
|
123
|
-
foreach (var dependency in BlueStackSettings.Instance.
|
|
123
|
+
foreach (var dependency in BlueStackSettings.Instance.AndroidMediationNetworks)
|
|
124
124
|
{
|
|
125
125
|
// dependency.Print();
|
|
126
|
-
bool newAutomaticConfigurationFilesUpdate = GUILayout.Toggle(dependency.
|
|
127
|
-
if (newAutomaticConfigurationFilesUpdate != dependency.
|
|
126
|
+
bool newAutomaticConfigurationFilesUpdate = GUILayout.Toggle(dependency.IsActive, dependency.Name);
|
|
127
|
+
if (newAutomaticConfigurationFilesUpdate != dependency.IsActive)
|
|
128
128
|
{
|
|
129
|
-
dependency.
|
|
129
|
+
dependency.IsActive = newAutomaticConfigurationFilesUpdate;
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
|
|
133
|
-
//
|
|
132
|
+
|
|
133
|
+
// iOS Mediation Networks
|
|
134
134
|
EditorGUILayout.Separator();
|
|
135
|
-
EditorGUILayout.LabelField("
|
|
135
|
+
EditorGUILayout.LabelField("iOS Mediation Networks: ", EditorStyles.boldLabel);
|
|
136
136
|
|
|
137
|
-
foreach (var dependency in BlueStackSettings.Instance.
|
|
137
|
+
foreach (var dependency in BlueStackSettings.Instance.IOSMediationNetworks)
|
|
138
138
|
{
|
|
139
139
|
// dependency.Print();
|
|
140
|
-
bool newAutomaticConfigurationFilesUpdate = GUILayout.Toggle(dependency.
|
|
141
|
-
if (newAutomaticConfigurationFilesUpdate != dependency.
|
|
140
|
+
bool newAutomaticConfigurationFilesUpdate = GUILayout.Toggle(dependency.IsActive, dependency.Name);
|
|
141
|
+
if (newAutomaticConfigurationFilesUpdate != dependency.IsActive)
|
|
142
142
|
{
|
|
143
|
-
dependency.
|
|
143
|
+
dependency.IsActive = newAutomaticConfigurationFilesUpdate;
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
@@ -150,10 +150,10 @@ namespace Azerion.BlueStack.Editor
|
|
|
150
150
|
onIOSMediationNetworksUpdateEvent?.Invoke(this, BlueStackSettings.Instance.IOSMediationNetworks);
|
|
151
151
|
onAndroidMediationNetworksUpdateEvent?.Invoke(this, BlueStackSettings.Instance.AndroidMediationNetworks);
|
|
152
152
|
|
|
153
|
-
DependencyProvider.UpdateMediationNetworkDependencies(new IOSDependencyModifier(),
|
|
154
|
-
BlueStackSettings.Instance.IOSMediationNetworks);
|
|
155
153
|
DependencyProvider.UpdateMediationNetworkDependencies(new AndroidDependencyModifier(),
|
|
156
154
|
BlueStackSettings.Instance.AndroidMediationNetworks);
|
|
155
|
+
DependencyProvider.UpdateMediationNetworkDependencies(new IOSDependencyModifier(),
|
|
156
|
+
BlueStackSettings.Instance.IOSMediationNetworks);
|
|
157
157
|
|
|
158
158
|
serializedObject.ApplyModifiedProperties();
|
|
159
159
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
using System;
|
|
1
2
|
using System.Collections.Generic;
|
|
2
3
|
using System.IO;
|
|
3
4
|
using System.Xml;
|
|
@@ -8,17 +9,13 @@ namespace Azerion.BlueStack.Editor
|
|
|
8
9
|
{
|
|
9
10
|
public class DependencyProvider
|
|
10
11
|
{
|
|
11
|
-
private static readonly string
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
private static readonly string _mediationDependencyPathInPackage =
|
|
15
|
-
"Packages/com.azerion.bluestack/Editor/" + "BlueStackMediationNetworks.xml";
|
|
12
|
+
private static readonly string _editorPathInPackage = "Packages/com.azerion.bluestack/Editor/";
|
|
13
|
+
private static readonly string _dependencyPathInPackage = _editorPathInPackage + "BlueStackDependencies.xml";
|
|
14
|
+
private static readonly string _mediationDependencyPathInPackage = _editorPathInPackage + "BlueStackMediationNetworks.xml";
|
|
16
15
|
|
|
17
16
|
private static readonly string _editorPathInAssets = "Assets/Editor/";
|
|
18
17
|
private static readonly string _dependencyPathInAssets = _editorPathInAssets + "BlueStackDependencies.xml";
|
|
19
|
-
|
|
20
|
-
private static readonly string _mediationDependencyPathInAssets =
|
|
21
|
-
_editorPathInAssets + "BlueStackMediationNetworks.xml";
|
|
18
|
+
private static readonly string _mediationDependencyPathInAssets = _editorPathInAssets + "BlueStackMediationNetworks.xml";
|
|
22
19
|
|
|
23
20
|
public static List<Dependency> GetAllDependencies(IDependencyParser parser)
|
|
24
21
|
{
|
|
@@ -71,9 +68,9 @@ namespace Azerion.BlueStack.Editor
|
|
|
71
68
|
public static void SyncDependenciesXMLs()
|
|
72
69
|
{
|
|
73
70
|
// Copy from the source
|
|
74
|
-
CopyDependenciesXMLFileToAssets()
|
|
75
|
-
if (CopyMediationDependenciesXMLFileToAssets())
|
|
71
|
+
if (CopyDependenciesXMLFileToAssets() & CopyMediationDependenciesXMLFileToAssets())
|
|
76
72
|
{
|
|
73
|
+
Debug.LogWarning("XML Files Copied from package to To Assets.");
|
|
77
74
|
return;
|
|
78
75
|
}
|
|
79
76
|
|
|
@@ -86,7 +83,7 @@ namespace Azerion.BlueStack.Editor
|
|
|
86
83
|
if (!XMLStructuresMatch(mainDependencyXML, updateDependencyXML))
|
|
87
84
|
{
|
|
88
85
|
Debug.LogWarning("XML structures do not match. replacing main with update.");
|
|
89
|
-
|
|
86
|
+
SaveMediationDependenciesXMLFile(updateDependencyXML.OuterXml);
|
|
90
87
|
return;
|
|
91
88
|
}
|
|
92
89
|
|
|
@@ -123,42 +120,7 @@ namespace Azerion.BlueStack.Editor
|
|
|
123
120
|
}
|
|
124
121
|
|
|
125
122
|
// Save the modified main XML
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
// Debug.Log("Mediation Dependency XML files merged and updated successfully.");
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
public static void UpdateMediationDependencyXML(List<MediationNetworkDependency> dependencies)
|
|
132
|
-
{
|
|
133
|
-
// if file doesn't exists, return
|
|
134
|
-
if (!File.Exists(_mediationDependencyPathInAssets))
|
|
135
|
-
{
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
XmlDocument mainDependencyXML = new XmlDocument();
|
|
140
|
-
mainDependencyXML.Load(_mediationDependencyPathInAssets);
|
|
141
|
-
|
|
142
|
-
foreach (MediationNetworkDependency dependency in dependencies)
|
|
143
|
-
{
|
|
144
|
-
XmlNode mainNode = mainDependencyXML.SelectSingleNode($"//network[@name='{dependency.Name}']");
|
|
145
|
-
|
|
146
|
-
if (mainNode != null)
|
|
147
|
-
{
|
|
148
|
-
mainNode.Attributes["active"].Value = dependency.Active.ToString();
|
|
149
|
-
}
|
|
150
|
-
else
|
|
151
|
-
{
|
|
152
|
-
// Node doesn't exists in Mediation Dependency XML
|
|
153
|
-
Debug.LogError("Something went wrong: Node doesn't exists in Mediation Dependency XML! " +
|
|
154
|
-
"Please check if you have manually changed the xml");
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// Save the modified XML
|
|
159
|
-
SaveMainXMLFile(mainDependencyXML.OuterXml);
|
|
160
|
-
|
|
161
|
-
Debug.Log("Mediation Dependency XML files merged and updated successfully.");
|
|
123
|
+
SaveMediationDependenciesXMLFile(mainDependencyXML.OuterXml);
|
|
162
124
|
}
|
|
163
125
|
|
|
164
126
|
private static bool XMLStructuresMatch(XmlDocument mainDoc, XmlDocument updateDoc)
|
|
@@ -178,22 +140,40 @@ namespace Azerion.BlueStack.Editor
|
|
|
178
140
|
return true;
|
|
179
141
|
}
|
|
180
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
|
+
}
|
|
181
150
|
|
|
182
|
-
public static void
|
|
151
|
+
public static void SaveMediationDependenciesXMLFile(string updatedXML)
|
|
183
152
|
{
|
|
184
153
|
// Replace main mediation dependency XML content with the updated XML
|
|
185
154
|
System.IO.File.WriteAllText(_mediationDependencyPathInAssets, updatedXML);
|
|
186
155
|
AssetDatabase.Refresh();
|
|
187
156
|
}
|
|
188
|
-
|
|
189
|
-
|
|
157
|
+
|
|
158
|
+
public static void SaveMainXMLFile(string updatedXML, string path)
|
|
190
159
|
{
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
FileUtil.ReplaceFile(_dependencyPathInPackage, _dependencyPathInAssets);
|
|
160
|
+
// Replace main XML content with the updated XML
|
|
161
|
+
System.IO.File.WriteAllText(path, updatedXML);
|
|
194
162
|
AssetDatabase.Refresh();
|
|
195
163
|
}
|
|
196
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
|
+
|
|
197
177
|
private static bool CopyMediationDependenciesXMLFileToAssets()
|
|
198
178
|
{
|
|
199
179
|
// Delete previous BlueStackMediationDependencies.xml file - TODO: remove in future
|
|
@@ -218,7 +198,7 @@ namespace Azerion.BlueStack.Editor
|
|
|
218
198
|
Debug.Log($"====================={dependencies.Count}=====================>");
|
|
219
199
|
foreach (MediationNetworkDependency dependency in dependencies)
|
|
220
200
|
{
|
|
221
|
-
Debug.Log($"Network Name: {dependency.Name}, Package: {dependency.Package}, Status: {dependency.
|
|
201
|
+
Debug.Log($"Network Name: {dependency.Name}, Package: {dependency.Package}, Status: {dependency.IsActive}");
|
|
222
202
|
}
|
|
223
203
|
Debug.Log("<==========================================");
|
|
224
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
|
}
|
|
@@ -24,14 +24,13 @@ namespace Azerion.BlueStack.Editor.iOS
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
XmlNode mainNode = xmlDoc.SelectSingleNode($"//dependencies/iosPods/iosPod[@name='BlueStack-SDK']");
|
|
27
|
-
if (mainNode
|
|
27
|
+
if (mainNode?.Attributes == null)
|
|
28
28
|
{
|
|
29
29
|
Debug.LogError("No node with the name 'BlueStack-SDK' found in the xml");
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
if (subspecsAttribute == null)
|
|
33
|
+
if (mainNode.Attributes["subspecs"] == null)
|
|
35
34
|
{
|
|
36
35
|
Debug.LogError("No 'subspecs' Attribute found in the node 'BlueStack-SDK'");
|
|
37
36
|
return;
|
|
@@ -39,67 +38,72 @@ namespace Azerion.BlueStack.Editor.iOS
|
|
|
39
38
|
|
|
40
39
|
// remove all inactive networks from the list
|
|
41
40
|
// dependencies.RemoveAll(a => dependencies.Any(b => !b.Active));
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
|
|
42
|
+
string subspecsValue;
|
|
43
|
+
subspecsValue = "[";
|
|
44
44
|
foreach (MediationNetworkDependency dependency in dependencies)
|
|
45
45
|
{
|
|
46
|
-
if (dependency.
|
|
46
|
+
if (dependency.IsActive)
|
|
47
47
|
{
|
|
48
|
-
|
|
48
|
+
subspecsValue += $"'{dependency.Package}', ";
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
subspecsValue += "]";
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
if (subspecsValue != mainNode.Attributes["subspecs"].Value)
|
|
54
|
+
{
|
|
55
|
+
mainNode.Attributes["subspecs"].Value = subspecsValue;
|
|
56
|
+
|
|
57
|
+
// Replace main dependency XML content with the updated XML
|
|
58
|
+
DependencyProvider.SaveDependenciesXMLFile(xmlDoc.OuterXml);
|
|
59
|
+
// Debug.Log("iOS Mediation Dependencies are updated successfully in Main Dependencies XML.");
|
|
60
|
+
}
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
void IDependencyModifier.modifyMediationNetworkDependencies(string xmlFilePath,
|
|
61
64
|
List<MediationNetworkDependency> dependencies)
|
|
62
65
|
{
|
|
63
|
-
XmlDocument
|
|
66
|
+
XmlDocument mediationDependencyXML = new XmlDocument();
|
|
64
67
|
|
|
65
68
|
try
|
|
66
69
|
{
|
|
67
|
-
|
|
70
|
+
mediationDependencyXML.Load(xmlFilePath);
|
|
68
71
|
}
|
|
69
72
|
catch (IOException e)
|
|
70
73
|
{
|
|
71
74
|
throw new Exception("Unable to load xml, error: " + e.Message);
|
|
72
75
|
}
|
|
73
76
|
|
|
77
|
+
bool valueChanged = false;
|
|
74
78
|
foreach (MediationNetworkDependency dependency in dependencies)
|
|
75
79
|
{
|
|
76
80
|
XmlNode mainNode =
|
|
77
|
-
|
|
81
|
+
mediationDependencyXML.SelectSingleNode($"//networkList/iosNetworks/network[@name='{dependency.Name}']");
|
|
78
82
|
|
|
79
|
-
if (mainNode
|
|
83
|
+
if (mainNode is { Attributes: not null })
|
|
80
84
|
{
|
|
81
|
-
mainNode.Attributes["active"].Value
|
|
85
|
+
if (mainNode.Attributes["active"].Value != dependency.IsActive.ToString())
|
|
86
|
+
{
|
|
87
|
+
mainNode.Attributes["active"].Value = dependency.IsActive.ToString();
|
|
88
|
+
valueChanged = true;
|
|
89
|
+
}
|
|
82
90
|
}
|
|
83
91
|
else
|
|
84
92
|
{
|
|
85
93
|
// Node doesn't exists in Mediation Dependency XML
|
|
86
94
|
Debug.LogError(
|
|
87
|
-
$"Something went wrong:
|
|
95
|
+
$"Something went wrong: " +
|
|
96
|
+
$"Node '{dependency.Name}' doesn't exists in Mediation Dependency XML! " +
|
|
88
97
|
"Please check if you have manually changed the xml");
|
|
89
98
|
}
|
|
90
99
|
}
|
|
91
|
-
|
|
100
|
+
|
|
92
101
|
// 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();
|
|
102
|
+
if (valueChanged)
|
|
103
|
+
{
|
|
104
|
+
DependencyProvider.SaveMediationDependenciesXMLFile(mediationDependencyXML.OuterXml);
|
|
105
|
+
// Debug.Log("iOS Mediation Network Dependencies XML file updated successfully.");
|
|
106
|
+
}
|
|
103
107
|
}
|
|
104
108
|
}
|
|
105
109
|
}
|
|
@@ -86,7 +86,7 @@ namespace Azerion.BlueStack.Example
|
|
|
86
86
|
Debug.Log("NativeAdManager: RegisterGameObjects");
|
|
87
87
|
|
|
88
88
|
// badge
|
|
89
|
-
string badgeText = this.nativeAd.
|
|
89
|
+
string badgeText = this.nativeAd.GetBadgeText();
|
|
90
90
|
if (badgeText != null)
|
|
91
91
|
{
|
|
92
92
|
Debug.Log("NativeAdManager: Register AdChoices");
|
|
@@ -110,7 +110,7 @@ namespace Azerion.BlueStack.Example
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
// Headline/Title
|
|
113
|
-
string titleText = this.nativeAd.
|
|
113
|
+
string titleText = this.nativeAd.GetTitleText();
|
|
114
114
|
if (titleText != null)
|
|
115
115
|
{
|
|
116
116
|
Debug.Log("NativeAdManager: Register Head line");
|
|
@@ -139,7 +139,7 @@ namespace Azerion.BlueStack.Example
|
|
|
139
139
|
{
|
|
140
140
|
Debug.Log("NativeAdManager: Register Cover Images");
|
|
141
141
|
coverImage.GetComponent<RawImage>().texture = imageTexture;
|
|
142
|
-
if (!this.nativeAd.
|
|
142
|
+
if (!this.nativeAd.RegisterCoverImageGameObject(coverImage))
|
|
143
143
|
{
|
|
144
144
|
Debug.Log("RegisterImageGameObject Unsuccessful");
|
|
145
145
|
}
|
|
@@ -151,7 +151,7 @@ namespace Azerion.BlueStack.Example
|
|
|
151
151
|
{
|
|
152
152
|
Debug.Log("NativeAdManager: Register CallToAction");
|
|
153
153
|
callToAction.GetComponent<Text>().text = callToActionText;
|
|
154
|
-
if (!this.nativeAd.
|
|
154
|
+
if (!this.nativeAd.RegisterCallToActionTextGameObject(callToAction))
|
|
155
155
|
{
|
|
156
156
|
Debug.Log("RegisterCallToActionGameObject Unsuccessful");
|
|
157
157
|
}
|
|
@@ -84,7 +84,7 @@ namespace Azerion.BlueStack.Example
|
|
|
84
84
|
Debug.Log("NativeAdManager: RegisterGameObjects");
|
|
85
85
|
|
|
86
86
|
// badge
|
|
87
|
-
string badgeText = this.nativeAd.
|
|
87
|
+
string badgeText = this.nativeAd.GetBadgeText();
|
|
88
88
|
if (badgeText != null)
|
|
89
89
|
{
|
|
90
90
|
Debug.Log("NativeAdManager: Register AdChoices");
|
|
@@ -108,7 +108,7 @@ namespace Azerion.BlueStack.Example
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
// Headline/Title
|
|
111
|
-
string titleText = this.nativeAd.
|
|
111
|
+
string titleText = this.nativeAd.GetTitleText();
|
|
112
112
|
if (titleText != null)
|
|
113
113
|
{
|
|
114
114
|
Debug.Log("NativeAdManager: Register Head line");
|
|
@@ -125,7 +125,7 @@ namespace Azerion.BlueStack.Example
|
|
|
125
125
|
{
|
|
126
126
|
Debug.Log("NativeAdManager: Register CallToAction");
|
|
127
127
|
callToAction.GetComponent<Text>().text = callToActionText;
|
|
128
|
-
if (!this.nativeAd.
|
|
128
|
+
if (!this.nativeAd.RegisterCallToActionTextGameObject(callToAction))
|
|
129
129
|
{
|
|
130
130
|
Debug.Log("RegisterCallToActionGameObject Unsuccessful");
|
|
131
131
|
}
|