update: 添加 Adjust preinstall Tracker
--story=1020232 --user=yufei.hu 【中台】【SDK】添加 Adjust Preinstall Tracker 功能 https://www.tapd.cn/33527076/s/1147510hotfix/v1.0.12.2
parent
0c4d6b31e9
commit
8b5f42706e
|
|
@ -32,6 +32,7 @@ namespace Guru.Editor
|
||||||
|
|
||||||
private XmlElement _manifestNode;
|
private XmlElement _manifestNode;
|
||||||
private XmlElement _applicationNode;
|
private XmlElement _applicationNode;
|
||||||
|
private XmlElement _queriesNode;
|
||||||
|
|
||||||
|
|
||||||
#region Initiallize
|
#region Initiallize
|
||||||
|
|
@ -103,6 +104,8 @@ namespace Guru.Editor
|
||||||
// --- Root Nodes ---
|
// --- Root Nodes ---
|
||||||
_manifestNode = _doc.SelectSingleNode("manifest") as XmlElement;
|
_manifestNode = _doc.SelectSingleNode("manifest") as XmlElement;
|
||||||
_applicationNode = _doc.SelectSingleNode("manifest/application") as XmlElement;
|
_applicationNode = _doc.SelectSingleNode("manifest/application") as XmlElement;
|
||||||
|
_queriesNode = _doc.SelectSingleNode("manifest/queries") as XmlElement;
|
||||||
|
|
||||||
|
|
||||||
AddXmlnsAndroid();
|
AddXmlnsAndroid();
|
||||||
AddXmlnsTools();
|
AddXmlnsTools();
|
||||||
|
|
@ -270,6 +273,44 @@ namespace Guru.Editor
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 添加 Queries Intent
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <param name="keyName"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public void AddQueriesIntent(string value, string keyName = "name")
|
||||||
|
{
|
||||||
|
if (_queriesNode == null)
|
||||||
|
{
|
||||||
|
_queriesNode = _doc.CreateElement("queries");
|
||||||
|
_manifestNode?.AppendChild(_queriesNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
var intentList = _queriesNode.SelectNodes("intent");
|
||||||
|
if (intentList != null)
|
||||||
|
{
|
||||||
|
foreach (XmlElement intent in intentList)
|
||||||
|
{
|
||||||
|
var action = intent?.SelectSingleNode("action") as XmlElement;
|
||||||
|
|
||||||
|
if (action != null
|
||||||
|
&& action.GetAttribute(keyName, NamespaceAndroid) == value)
|
||||||
|
{
|
||||||
|
return; // Has injected,skip ...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inject new intent node
|
||||||
|
XmlElement intentNode = _doc.CreateElement("intent");
|
||||||
|
_queriesNode.AppendChild(intentNode);
|
||||||
|
XmlElement actionNode = _doc.CreateElement("action");
|
||||||
|
intentNode.AppendChild(actionNode);
|
||||||
|
actionNode.SetAttribute(keyName, NamespaceAndroid, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Data Opration
|
#region Data Opration
|
||||||
|
|
@ -319,6 +360,17 @@ namespace Guru.Editor
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool TryRootNode(string nodeName, out XmlElement node)
|
||||||
|
{
|
||||||
|
node = null;
|
||||||
|
if (_doc != null)
|
||||||
|
{
|
||||||
|
node = _doc.SelectSingleNode(nodeName) as XmlElement;
|
||||||
|
return node != null;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Output
|
#region Output
|
||||||
|
|
|
||||||
|
|
@ -22,13 +22,17 @@ namespace Guru.Editor
|
||||||
private const string PermissionReadLogs = "android.permission.READ_LOGS";
|
private const string PermissionReadLogs = "android.permission.READ_LOGS";
|
||||||
private const string NetworkSecurityConfig = "networkSecurityConfig";
|
private const string NetworkSecurityConfig = "networkSecurityConfig";
|
||||||
private const string NetworkSecurityConfigValue = "@xml/network_security_config";
|
private const string NetworkSecurityConfigValue = "@xml/network_security_config";
|
||||||
|
private const string PermissionAdjustReadPermission = "com.adjust.preinstall.READ_PERMISSION"; // Adjust permission
|
||||||
|
private const string AdjustQueriesActionValue = "com.attribution.REFERRAL_PROVIDER"; // Adjust action
|
||||||
|
|
||||||
|
// Add Permissions
|
||||||
private static string[] addPermissions = new[]
|
private static string[] addPermissions = new[]
|
||||||
{
|
{
|
||||||
PermissionReadPostNotifications,
|
PermissionReadPostNotifications,
|
||||||
|
PermissionAdjustReadPermission,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Remove Permissions
|
||||||
private static string[] removePermissions = new[]
|
private static string[] removePermissions = new[]
|
||||||
{
|
{
|
||||||
PermissionReadPhoneState,
|
PermissionReadPhoneState,
|
||||||
|
|
@ -82,6 +86,9 @@ namespace Guru.Editor
|
||||||
// --- Bundle Id ---
|
// --- Bundle Id ---
|
||||||
doc.SetPackageName(PlayerSettings.applicationIdentifier);
|
doc.SetPackageName(PlayerSettings.applicationIdentifier);
|
||||||
|
|
||||||
|
// --- Adjust Preinstall (Content provider) ---
|
||||||
|
doc.AddQueriesIntent(AdjustQueriesActionValue);
|
||||||
|
|
||||||
doc.Save();
|
doc.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue