Compare commits
221 Commits
feature/In
...
main
| Author | SHA1 | Date |
|---|---|---|
|
|
5c1f73fc18 | |
|
|
8a81ed78b4 | |
|
|
76fc4f5c26 | |
|
|
72bf076537 | |
|
|
19a46fff1e | |
|
|
4989926a47 | |
|
|
fe691235d6 | |
|
|
dc47cec8bd | |
|
|
2075f676b9 | |
|
|
660303e45d | |
|
|
2a895b370e | |
|
|
c0c557b34e | |
|
|
edcc533d33 | |
|
|
3d9d027e89 | |
|
|
1256880b22 | |
|
|
e77994d811 | |
|
|
85dc4a7ddc | |
|
|
b7aacb61e4 | |
|
|
8cc083410d | |
|
|
81f37625c1 | |
|
|
1a9481b094 | |
|
|
2174bcf1a3 | |
|
|
602662881c | |
|
|
e36f7483a3 | |
|
|
7cbc5ac148 | |
|
|
e8c17f4cf4 | |
|
|
e8b3112cc5 | |
|
|
e0e78da9a3 | |
|
|
9e7e94ef36 | |
|
|
80e38bf85d | |
|
|
cfe81b5583 | |
|
|
34ae9e3f0b | |
|
|
eba48e4a75 | |
|
|
a53c153338 | |
|
|
ffcb846a64 | |
|
|
dbb56e5a32 | |
|
|
b6e038a027 | |
|
|
4e24169b25 | |
|
|
9024b8171c | |
|
|
f5747977ec | |
|
|
d3028d9e3b | |
|
|
a9a438b288 | |
|
|
523115bdb9 | |
|
|
f360529552 | |
|
|
f96e506a19 | |
|
|
c59f76aead | |
|
|
ba90a32195 | |
|
|
4a5229780a | |
|
|
9ec1038a00 | |
|
|
b1ee76ef0e | |
|
|
85dc66dc2d | |
|
|
6512ed327c | |
|
|
225197c867 | |
|
|
6df7530aa8 | |
|
|
d5c02418c7 | |
|
|
5882d213c3 | |
|
|
aca914ab02 | |
|
|
7f4beb6e3f | |
|
|
f641f1828c | |
|
|
073c0ef7ac | |
|
|
5974cb163a | |
|
|
beb027bf76 | |
|
|
7babe561b0 | |
|
|
e8884f325a | |
|
|
3649c24d26 | |
|
|
4b6a458396 | |
|
|
94f8e44ea9 | |
|
|
42025a081a | |
|
|
36ddbc96d2 | |
|
|
0125fa383e | |
|
|
e2c3b5bc7c | |
|
|
7867db4655 | |
|
|
e33b2ae024 | |
|
|
f9f4d7428f | |
|
|
b486af2768 | |
|
|
28c1dd47a6 | |
|
|
2dd94403ea | |
|
|
3c22bea3f7 | |
|
|
3033c42c03 | |
|
|
1862517c0f | |
|
|
3811ec0d61 | |
|
|
9b4870c91a | |
|
|
b728102800 | |
|
|
df75e0e2d1 | |
|
|
8ea0171247 | |
|
|
bb3a1310b3 | |
|
|
171e67ac77 | |
|
|
9b1efd069c | |
|
|
629687b3a6 | |
|
|
0d47b48058 | |
|
|
7474ec0c4b | |
|
|
755a15e73d | |
|
|
7c99fb6d4c | |
|
|
19d51274ab | |
|
|
d53cdab2e5 | |
|
|
39d1ad0d39 | |
|
|
a9346bc1bb | |
|
|
4c899f9aeb | |
|
|
4fd0f8fec4 | |
|
|
55352073f8 | |
|
|
714d1edf68 | |
|
|
913dcf7495 | |
|
|
30c33f8ec9 | |
|
|
5a52fc0987 | |
|
|
6ef4d0cdec | |
|
|
01ee547c8e | |
|
|
0fd037d1ae | |
|
|
252de80d7d | |
|
|
1ecd077085 | |
|
|
0c88e35f24 | |
|
|
8100628320 | |
|
|
bba3d61ce0 | |
|
|
a42779671c | |
|
|
e44b4cef4e | |
|
|
98010b4b95 | |
|
|
caffa7f5fe | |
|
|
019869253c | |
|
|
62bf31437f | |
|
|
b22018bd7c | |
|
|
dbd3ad14ab | |
|
|
f63c3681d8 | |
|
|
aced9b0d1d | |
|
|
07818bd40e | |
|
|
fa00f99dd9 | |
|
|
eb7b743146 | |
|
|
bc703d1e12 | |
|
|
c0cf313903 | |
|
|
c233146632 | |
|
|
c9b4385a4c | |
|
|
dab15ac1da | |
|
|
d76f6de15e | |
|
|
19c9cb831b | |
|
|
8f3aa1437d | |
|
|
53862fefda | |
|
|
de58e5f6dd | |
|
|
ba059e9995 | |
|
|
f0a64b1e2c | |
|
|
905f683c7c | |
|
|
754ea97fb4 | |
|
|
e4ce0fb408 | |
|
|
97d472beaa | |
|
|
68a14a4ae5 | |
|
|
603a78736e | |
|
|
fac01f8109 | |
|
|
a240dc4e2c | |
|
|
2d05040807 | |
|
|
bde7220146 | |
|
|
5bf3fff26a | |
|
|
13154f30db | |
|
|
5c82f40e86 | |
|
|
17d9b14cd2 | |
|
|
9c7e8ac83c | |
|
|
ebcdc9ccbf | |
|
|
a947f2445b | |
|
|
d471e5c00b | |
|
|
6b26ad26ac | |
|
|
369b90d766 | |
|
|
67d0896424 | |
|
|
7bf90ae804 | |
|
|
cef528e5dc | |
|
|
292ef44bad | |
|
|
2f25b8523c | |
|
|
aef99259b5 | |
|
|
282aaeadf4 | |
|
|
7bd9413a83 | |
|
|
a056a5c23d | |
|
|
d834446dc3 | |
|
|
3ef3807253 | |
|
|
6169adbcdb | |
|
|
25d644328c | |
|
|
c4c711f6f8 | |
|
|
c341374748 | |
|
|
426b0028fd | |
|
|
ed41a44758 | |
|
|
fdf1dd7c0e | |
|
|
c9301aa45e | |
|
|
269010590d | |
|
|
b28a039bd0 | |
|
|
a7d3a5147a | |
|
|
f9acc5785b | |
|
|
0c9b2a77fe | |
|
|
277bf0bfba | |
|
|
c5851880c1 | |
|
|
041cbdc36e | |
|
|
ffd2b7da21 | |
|
|
bdb15cdf1d | |
|
|
be1c9cc327 | |
|
|
9c3795227c | |
|
|
203263769e | |
|
|
b5576b12a3 | |
|
|
fde37d807a | |
|
|
c5a23e19d1 | |
|
|
076f784b1c | |
|
|
e313c9af80 | |
|
|
64fedf4856 | |
|
|
8e2229687e | |
|
|
fa06ab3f87 | |
|
|
6023017cc9 | |
|
|
08980212d5 | |
|
|
bc86f40bcd | |
|
|
7da2acc15f | |
|
|
2303c7acbf | |
|
|
8d38347952 | |
|
|
179cd87253 | |
|
|
800193017c | |
|
|
18656daec0 | |
|
|
69cb6fa1f1 | |
|
|
8511faeabd | |
|
|
7435bdf3d5 | |
|
|
d839a68bf7 | |
|
|
82328c1555 | |
|
|
18c7876f8f | |
|
|
1bfbce04f1 | |
|
|
897f39e6d9 | |
|
|
bee51ce435 | |
|
|
06626b781a | |
|
|
b790ac34ac | |
|
|
a5cfdd4df6 | |
|
|
1eef3d618c | |
|
|
0a3c54e0a7 | |
|
|
135a0ac23b |
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
|
||||
namespace Guru.Editor
|
||||
{
|
||||
using UnityEngine;
|
||||
|
|
@ -12,23 +11,34 @@ namespace Guru.Editor
|
|||
|
||||
public class AppBuildParam
|
||||
{
|
||||
public const string TargetNameAndroid = "Android";
|
||||
public const string TargetNameIOS = "iOS";
|
||||
|
||||
//------------ Basic ----------------
|
||||
public bool IsBuildRelease; // 是否构建发布包体
|
||||
public bool IsBuildShowLog; // 是否显示日志
|
||||
public bool IsBuildRelease = false; // 是否构建发布包体
|
||||
public bool IsBuildShowLog = false; // 是否显示日志
|
||||
public AppBuilderType BuilderType; // 构建类型
|
||||
public string BuildVersion = ""; // 构建版本号, 填写后会依据此版本设置应用的 Version
|
||||
public bool AutoSetBuildNumber = true; // 自动设置构建号, 可参考 Guru的SDK 接入说明文档
|
||||
public bool UseGuruCerts = true; // 是否使用 Guru 的证书打包
|
||||
public string TargetName = "";
|
||||
//------------ Android ----------------
|
||||
public bool IsBuildAAB; // 是否构建 AAB 包体 ( GooglePlay 发布专用 )
|
||||
public bool IsBuildSymbols = false; // 是否需要构建 Symbols.zip 文件 ( GooglePlay 发布专用 )
|
||||
public int AndroidTargetVersion = 0; // Android SDK 版本设置 ( GooglePlay 发布专用 )
|
||||
public bool AndroidUseMinify = false; // 是否开启 Android 的代码混淆和保护文件
|
||||
public bool DebugWithMono = true; // 是否使用 Mono 编译项目 ( Android Debug包专用 )
|
||||
public string AndroidKeystorePath = ""; // Android KeyStore 文件名
|
||||
public string AndroidKeystorePass = ""; // Android KeyStore 文件名
|
||||
public string AndroidAlias = ""; // Android KeyStore 文件名
|
||||
public string AndroidAliasPass = ""; // Android KeyStore 文件名
|
||||
//------------ iOS ----------------
|
||||
public string IOSTargetVersion = ""; // IOS SDK 版本设置 ( iOS 发布专用 )
|
||||
public string IOSTeamId = ""; // IOS 打包 TeamId ( iOS 使用专用的开发证书后开启 )
|
||||
public string CompanyName = ""; // 发布厂商的名称
|
||||
//------------ Publish -------------
|
||||
public bool AutoPublish = false;
|
||||
public string PgyerAPIKey = "";
|
||||
|
||||
|
||||
|
||||
|
|
@ -38,13 +48,14 @@ namespace Guru.Editor
|
|||
}
|
||||
|
||||
|
||||
public static AppBuildParam Build(bool isRelease, AppBuilderType builderType = AppBuilderType.Editor, string version = "", bool autoBuildNumber = true, string companyName = "",
|
||||
bool buildShowLog = false, bool useGuruCerts = true,
|
||||
public static AppBuildParam Build(bool isRelease, AppBuilderType builderType = AppBuilderType.Editor, string version = "", bool autoBuildNumber = true, string companyName = "",
|
||||
string targetName = "", bool buildShowLog = false, bool useGuruCerts = true,
|
||||
bool buildSymbols = false, bool buildAAB = false, bool useMinify = false, int androidTargetVersion = 0, bool debugWithMono = true,
|
||||
string iOSTargetVersion = "", string iOSTeamId = "")
|
||||
{
|
||||
return new AppBuildParam()
|
||||
{
|
||||
TargetName = targetName,
|
||||
IsBuildRelease = isRelease,
|
||||
IsBuildShowLog = buildShowLog,
|
||||
BuilderType = builderType,
|
||||
|
|
@ -75,14 +86,18 @@ namespace Guru.Editor
|
|||
/// <param name="useMinify"></param>
|
||||
/// <param name="androidTargetVersion"></param>
|
||||
/// <param name="debugWithMono"></param>
|
||||
/// <param name="isBuildAAB"></param>
|
||||
/// <returns></returns>
|
||||
public static AppBuildParam AndroidParam(bool isRelease, string version = "", bool autoBuildNumber = true, AppBuilderType builderType = AppBuilderType.Editor,
|
||||
string companyName = "", bool useGuruCerts = true, bool useMinify = false, int androidTargetVersion = 0, bool debugWithMono = true)
|
||||
public static AppBuildParam AndroidParam(bool isRelease, string version = "", bool autoBuildNumber = true,
|
||||
AppBuilderType builderType = AppBuilderType.Editor,
|
||||
string companyName = "", bool useGuruCerts = true, bool useMinify = false, int androidTargetVersion = 0,
|
||||
bool debugWithMono = true, bool isBuildAAB = false)
|
||||
{
|
||||
bool buildAAB = isRelease;
|
||||
bool buildAAB = isBuildAAB;
|
||||
bool buildShowLog = isRelease;
|
||||
bool buildSymbols = isRelease;
|
||||
return Build(isRelease, builderType, version, autoBuildNumber,companyName, buildShowLog, useGuruCerts, buildSymbols, buildAAB, useMinify, androidTargetVersion, debugWithMono);
|
||||
string targetName = TargetNameAndroid;
|
||||
return Build(isRelease, builderType, version, autoBuildNumber,companyName, targetName, buildShowLog, useGuruCerts, buildSymbols, buildAAB, useMinify, androidTargetVersion, debugWithMono);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -102,7 +117,8 @@ namespace Guru.Editor
|
|||
string companyName = "", bool useGuruCerts = true, string iOSTargetVersion = "", string iOSTeamId = "" )
|
||||
{
|
||||
bool buildShowLog = isRelease;
|
||||
return Build(isRelease, builderType, version, autoBuildNumber, companyName, buildShowLog, useGuruCerts, iOSTargetVersion:iOSTargetVersion, iOSTeamId:iOSTeamId);
|
||||
string targetName = TargetNameIOS;
|
||||
return Build(isRelease, builderType, version, autoBuildNumber, companyName, targetName, buildShowLog, useGuruCerts, iOSTargetVersion:iOSTargetVersion, iOSTeamId:iOSTeamId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,30 +17,68 @@ namespace Guru.Editor
|
|||
public static int AndroidTargetSdkVersion = 33;
|
||||
public static string IOSTargetOSVersion = "13.0";
|
||||
public static string GuruIOSTeamId = "39253T242A";
|
||||
public static string KeystoreName => $"guru_key.jks";
|
||||
public static string KeystorePath => Application.dataPath + $"/Plugins/Android/{KeystoreName}";
|
||||
public static string ProguardName => $"proguard-user.txt";
|
||||
public static string GuruKeystoreName => "guru_key.jks";
|
||||
public static string GuruKeystorePass => "guru0622";
|
||||
public static string GuruAliasName => "guru";
|
||||
public static string GuruAliasPass => "guru0622";
|
||||
public static string GuruKeystorePath => Application.dataPath + $"/Plugins/Android/{GuruKeystoreName}";
|
||||
public static string ProguardName => "proguard-user.txt";
|
||||
public static string ProguardPath => Application.dataPath + $"/Plugins/Android/{ProguardName}";
|
||||
public static string OutputDirName => "BuildOutput";
|
||||
|
||||
#region 构建接口
|
||||
|
||||
/// <summary>
|
||||
/// 直接调用 Build 接口
|
||||
/// </summary>
|
||||
/// <param name="buildParam"></param>
|
||||
/// <returns></returns>
|
||||
public static string Build(AppBuildParam buildParam)
|
||||
{
|
||||
string outputPath = string.Empty;
|
||||
switch (buildParam.TargetName)
|
||||
{
|
||||
case AppBuildParam.TargetNameAndroid:
|
||||
SwitchBuildPlatform(BuildTarget.Android);
|
||||
outputPath = BuildAndroid(buildParam);
|
||||
break;
|
||||
case AppBuildParam.TargetNameIOS:
|
||||
SwitchBuildPlatform(BuildTarget.iOS);
|
||||
outputPath = BuildIOS(buildParam);
|
||||
break;
|
||||
default:
|
||||
Debug.Log($"<color=red> Unsupported build target: {buildParam.TargetName}. Skip build...</color>");
|
||||
break;
|
||||
}
|
||||
|
||||
return outputPath;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 构建 Android 接口
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// 构建 Android 包体
|
||||
/// </summary>
|
||||
/// <param name="buildParam"></param>
|
||||
/// <returns></returns>
|
||||
public static string BuildAndroid(AppBuildParam buildParam)
|
||||
{
|
||||
//切换平台
|
||||
BuildSwitchPlatform(BuildTarget.Android);
|
||||
//打包通用设置
|
||||
// 切换平台
|
||||
SwitchBuildPlatform(BuildTarget.Android);
|
||||
// 打包通用设置
|
||||
ChangeBuildPlayerCommonSetting(buildParam, BuildTargetGroup.Android);
|
||||
|
||||
var isDebug = !buildParam.IsBuildRelease;
|
||||
var useMinify = buildParam.AndroidUseMinify;
|
||||
var buildNumber= GetBuildNumberString(BuildTarget.Android);
|
||||
if(buildParam.AutoSetBuildNumber) buildNumber= ChangeBuildNumber(BuildTarget.Android);
|
||||
if(buildParam.AutoSetBuildNumber) buildNumber = ChangeBuildNumber(BuildTarget.Android);
|
||||
|
||||
// 保存版本信息
|
||||
SaveBuildVersion(buildParam.BuildVersion, buildNumber);
|
||||
|
||||
//android专用打包设置
|
||||
EditorUserBuildSettings.buildAppBundle = buildParam.IsBuildAAB;
|
||||
EditorUserBuildSettings.development = isDebug;
|
||||
|
|
@ -60,10 +98,19 @@ namespace Guru.Editor
|
|||
{
|
||||
// ---- 使用 Guru 专用的 KeyStore ----
|
||||
PlayerSettings.Android.useCustomKeystore = true;
|
||||
PlayerSettings.Android.keystoreName = KeystorePath;
|
||||
PlayerSettings.Android.keystorePass = "guru0622";
|
||||
PlayerSettings.Android.keyaliasName = "guru";
|
||||
PlayerSettings.Android.keyaliasPass = "guru0622";
|
||||
PlayerSettings.Android.keystoreName = GuruKeystorePath;
|
||||
PlayerSettings.Android.keystorePass = GuruKeystorePass;
|
||||
PlayerSettings.Android.keyaliasName = GuruAliasName;
|
||||
PlayerSettings.Android.keyaliasPass = GuruAliasPass;
|
||||
}
|
||||
else if(!string.IsNullOrEmpty(buildParam.AndroidKeystorePath))
|
||||
{
|
||||
// ---- 使用 Custom 的 KeyStore ----
|
||||
PlayerSettings.Android.useCustomKeystore = true;
|
||||
PlayerSettings.Android.keystoreName = buildParam.AndroidKeystorePath;
|
||||
PlayerSettings.Android.keystorePass = buildParam.AndroidKeystorePass;
|
||||
PlayerSettings.Android.keyaliasName = buildParam.AndroidAlias;
|
||||
PlayerSettings.Android.keyaliasPass = buildParam.AndroidAliasPass;
|
||||
}
|
||||
|
||||
PlayerSettings.Android.targetArchitectures = AndroidArchitecture.ARMv7 | AndroidArchitecture.ARM64; //只构建 armv7 和 arm64
|
||||
|
|
@ -77,7 +124,7 @@ namespace Guru.Editor
|
|||
string version = Application.version;
|
||||
string extension = buildParam.IsBuildAAB ? ".aab" : ".apk";
|
||||
if (EditorUserBuildSettings.exportAsGoogleAndroidProject) extension = ""; // 输出工程
|
||||
string outputDir = Path.GetFullPath($"{Application.dataPath }/../BuildOutput/Android");
|
||||
string outputDir = Path.GetFullPath($"{Application.dataPath }/../{OutputDirName}/Android");
|
||||
apkPath = $"{outputDir}/{Application.productName.Replace(" ","_")}_{symbolDefine}_{version}_{buildNumber}{extension}";
|
||||
if (!Directory.Exists(outputDir)) Directory.CreateDirectory(outputDir);
|
||||
|
||||
|
|
@ -87,7 +134,11 @@ namespace Guru.Editor
|
|||
{
|
||||
Open(outputDir);
|
||||
}
|
||||
|
||||
|
||||
if (buildParam.AutoPublish)
|
||||
{
|
||||
GuruPublishHelper.Publish(apkPath, buildParam.PgyerAPIKey); // 直接发布版本
|
||||
}
|
||||
return apkPath;
|
||||
}
|
||||
|
||||
|
|
@ -97,8 +148,8 @@ namespace Guru.Editor
|
|||
private static bool DeployAndroidKeystore()
|
||||
{
|
||||
var dir = GetWorkingDir();
|
||||
var from = $"{dir}/{KeystoreName}";
|
||||
var to = KeystorePath;
|
||||
var from = $"{dir}/{GuruKeystoreName}";
|
||||
var to = GuruKeystorePath;
|
||||
|
||||
if (File.Exists(to)) return true;
|
||||
|
||||
|
|
@ -136,15 +187,19 @@ namespace Guru.Editor
|
|||
|
||||
#region 构建 IOS 接口
|
||||
|
||||
public static void BuildIOS(AppBuildParam buildParam)
|
||||
public static string BuildIOS(AppBuildParam buildParam)
|
||||
{
|
||||
//切换平台
|
||||
BuildSwitchPlatform(BuildTarget.iOS);
|
||||
SwitchBuildPlatform(BuildTarget.iOS);
|
||||
//打包通用设置
|
||||
ChangeBuildPlayerCommonSetting(buildParam, BuildTargetGroup.iOS);
|
||||
|
||||
//修改打包版本号
|
||||
if(buildParam.AutoSetBuildNumber) ChangeBuildNumber(BuildTarget.iOS);
|
||||
var buildNumber= GetBuildNumberString(BuildTarget.Android);
|
||||
if(buildParam.AutoSetBuildNumber) buildNumber = ChangeBuildNumber(BuildTarget.iOS);
|
||||
|
||||
// 保存版本信息
|
||||
SaveBuildVersion(buildParam.BuildVersion, buildNumber);
|
||||
|
||||
var isDebug = !buildParam.IsBuildRelease;
|
||||
|
||||
|
|
@ -169,26 +224,28 @@ namespace Guru.Editor
|
|||
}
|
||||
|
||||
//打包
|
||||
string xcodePath = Application.dataPath + "/../../xcode";
|
||||
if (Directory.Exists(xcodePath))
|
||||
string outputDir = Path.GetFullPath($"{Application.dataPath }/../{OutputDirName}/Xcode");
|
||||
if (Directory.Exists(outputDir))
|
||||
{
|
||||
Directory.Delete(xcodePath, true);
|
||||
Directory.Delete(outputDir, true);
|
||||
}
|
||||
|
||||
// 构建后打开路径
|
||||
try
|
||||
{
|
||||
BuildOptions opts = isDebug ? BuildOptions.Development : BuildOptions.None;
|
||||
BuildPipeline.BuildPlayer(GetBuildScenes(), xcodePath, BuildTarget.iOS, BuildOptions.None);
|
||||
BuildPipeline.BuildPlayer(GetBuildScenes(), outputDir, BuildTarget.iOS, BuildOptions.None);
|
||||
if (buildParam.BuilderType == AppBuilderType.Editor)
|
||||
{
|
||||
Open(xcodePath);
|
||||
Open(outputDir);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError(e.Message);
|
||||
}
|
||||
|
||||
return outputDir;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -221,7 +278,7 @@ namespace Guru.Editor
|
|||
/// 平台切换
|
||||
/// </summary>
|
||||
/// <param name="targetPlatform"></param>
|
||||
private static void BuildSwitchPlatform(BuildTarget targetPlatform)
|
||||
private static void SwitchBuildPlatform(BuildTarget targetPlatform)
|
||||
{
|
||||
if (EditorUserBuildSettings.activeBuildTarget != targetPlatform)
|
||||
{
|
||||
|
|
@ -318,6 +375,12 @@ namespace Guru.Editor
|
|||
return "";
|
||||
}
|
||||
|
||||
|
||||
private static void SaveBuildVersion(string version, string code)
|
||||
{
|
||||
GuruAppVersion.SaveToDisk(version, code);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取打包场景
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,338 @@
|
|||
|
||||
namespace Guru.Editor
|
||||
{
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
|
||||
public class PgyerAPI
|
||||
{
|
||||
public const string Version = "1.0.0";
|
||||
|
||||
internal static readonly string DefaultBashPathWin = "C:\\Program Files\\Git\\bin\\bash.exe";
|
||||
internal static readonly string DefaultBashPathMac = "/bin/bash";
|
||||
internal static readonly string ShellFile = "pgyer_upload.sh";
|
||||
private static readonly string GuruAPIKey = "20a3d1106b802abbd84ec687eedf17eb";
|
||||
private static readonly string PgyerHost = "https://www.pgyer.com";
|
||||
internal static string WorkingDir => $"{Application.dataPath.Replace("Assets", "Library")}/guru_publish";
|
||||
|
||||
public static string GetDownloadUrl(string shortUrl) => $"{PgyerHost}/{shortUrl}";
|
||||
|
||||
/// <summary>
|
||||
/// 发布产品到蒲公英平台
|
||||
/// </summary>
|
||||
/// <param name="packagePath"></param>
|
||||
/// <param name="apiKey"></param>
|
||||
/// <param name="bashPath"></param>
|
||||
/// <param name="callback"></param>
|
||||
public static void PublishToPgyer(string packagePath, string apiKey = "", string bashPath = "",
|
||||
Action<string> callback = null)
|
||||
{
|
||||
if (File.Exists(packagePath))
|
||||
{
|
||||
Debug.Log($"=== START PUBLISH APP: {packagePath}");
|
||||
CheckWorkingDir();
|
||||
CallPublishShell(packagePath, apiKey, bashPath, callback);
|
||||
}
|
||||
}
|
||||
|
||||
private static void CheckWorkingDir()
|
||||
{
|
||||
if (!Directory.Exists(WorkingDir))
|
||||
{
|
||||
Directory.CreateDirectory(WorkingDir);
|
||||
}
|
||||
|
||||
var file = $"{WorkingDir}/{ShellFile}";
|
||||
if (!File.Exists(file))
|
||||
{
|
||||
var from = GetShellPath();
|
||||
if (File.Exists(from))
|
||||
{
|
||||
File.Copy(from, file);
|
||||
#if UNITY_EDITOR_OSX
|
||||
RunCmd("chmod", $"+x {file}", workpath: WorkingDir);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"[Publisher] Source shell file not found :{from}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取 CMD 命令路径
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static string GetShellPath()
|
||||
{
|
||||
var path = "";
|
||||
var guids = AssetDatabase.FindAssets($"{nameof(PgyerAPI)} t:script");
|
||||
if (guids.Length > 0)
|
||||
{
|
||||
path = Path.Combine(Directory.GetParent(AssetDatabase.GUIDToAssetPath(guids[0])).FullName, ShellFile);
|
||||
return Path.GetFullPath(path);
|
||||
}
|
||||
|
||||
path = Path.GetFullPath(
|
||||
$"{Application.dataPath.Replace("Assets", "Packages")}/com.guru.unity.sdk.core/Editor/BuildTool/{ShellFile}");
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void RunCmd(string cmd, string args, Action<string> callback = null, string workpath = "")
|
||||
{
|
||||
System.Diagnostics.Process process = new System.Diagnostics.Process();
|
||||
process.StartInfo.FileName = cmd;
|
||||
process.StartInfo.Arguments = args;
|
||||
process.StartInfo.UseShellExecute = false;
|
||||
process.StartInfo.RedirectStandardOutput = true;
|
||||
process.StartInfo.RedirectStandardError = true;
|
||||
process.StartInfo.CreateNoWindow = true;
|
||||
if (!string.IsNullOrEmpty(workpath)) process.StartInfo.WorkingDirectory = workpath;
|
||||
process.Start();
|
||||
string log = process.StandardOutput.ReadToEnd();
|
||||
callback?.Invoke(log);
|
||||
process.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 在 mac 下进行发布
|
||||
/// </summary>
|
||||
/// <param name="packagePath"></param>
|
||||
/// <param name="apiKey"></param>
|
||||
/// <param name="bashPath"></param>
|
||||
/// <param name="callback"></param>
|
||||
private static void CallPublishShell(string packagePath, string apiKey = "", string bashPath = "",
|
||||
Action<string> callback = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(bashPath))
|
||||
{
|
||||
#if UNITY_EDITOR_OSX
|
||||
bashPath = DefaultBashPathMac;
|
||||
#elif UNITY_EDITOR_WIN
|
||||
bashPath = DefaultBashPathWin.Replace("\\", "/");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!File.Exists(bashPath))
|
||||
{
|
||||
string msg = $"Error: Bash file not found at path: {bashPath}! skip publishing!";
|
||||
Debug.LogError(msg);
|
||||
callback?.Invoke(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
packagePath = packagePath.Replace("\\", "/");
|
||||
if (string.IsNullOrEmpty(apiKey)) apiKey = GuruAPIKey;
|
||||
var args = $"-c \"./{ShellFile} -k {apiKey} {packagePath}\"";
|
||||
// Debug.Log(bashPath);
|
||||
// Debug.Log(args);
|
||||
// Debug.Log(WorkingDir);
|
||||
RunCmd(bashPath, args, callback, WorkingDir);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Guru 包体上传工具
|
||||
/// </summary>
|
||||
public class GuruPublishHelper
|
||||
{
|
||||
// Check Env and Exe files
|
||||
private static string EvnCheck()
|
||||
{
|
||||
if (!Directory.Exists(PgyerAPI.WorkingDir))
|
||||
Directory.CreateDirectory(PgyerAPI.WorkingDir);
|
||||
|
||||
// #1 --- read from cached file with available path
|
||||
string bash_path = "";
|
||||
var envFile = $"{PgyerAPI.WorkingDir}/.env";
|
||||
if (File.Exists(envFile))
|
||||
{
|
||||
bash_path = File.ReadAllText(envFile);
|
||||
return bash_path;
|
||||
}
|
||||
|
||||
// #2 --- Try to find bash exe file from default path
|
||||
bash_path = PgyerAPI.DefaultBashPathMac;
|
||||
#if UNITY_EDITOR_WIN
|
||||
bash_path = PgyerAPI.DefaultBashPathWin;
|
||||
#endif
|
||||
if (File.Exists(bash_path))
|
||||
{
|
||||
bash_path = bash_path.Replace("\\", "/");
|
||||
File.WriteAllText(envFile, bash_path);
|
||||
return bash_path;
|
||||
}
|
||||
|
||||
// #3 --- Try to let user select bash exe file from disk
|
||||
string title = "选择 bash 可执行文件";
|
||||
string despath = "/bin";
|
||||
string exts = "*";
|
||||
|
||||
#if UNITY_EDITOR_WIN
|
||||
despath = "C:\\Program Files\\";
|
||||
title = $"选择 bash 可执行文件, 例如: {despath}\\Git\\bin\\bash.exe";
|
||||
exts = "exe";
|
||||
#endif
|
||||
bash_path = EditorUtility.OpenFilePanel(title, despath, exts);
|
||||
if (File.Exists(bash_path))
|
||||
{
|
||||
File.WriteAllText(envFile, bash_path.Replace("\\", "/"));
|
||||
}
|
||||
return bash_path;
|
||||
}
|
||||
|
||||
|
||||
[MenuItem("Guru/Publish/Android APK...")]
|
||||
private static void EditorPublishAPK()
|
||||
{
|
||||
SelectAndPublish();
|
||||
}
|
||||
|
||||
// [MenuItem("Guru/Publish/Publish Release AAB...")]
|
||||
// private static void EditorPublishAAB()
|
||||
// {
|
||||
// SelectAndPublish("aab");
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// 直接发布版本
|
||||
/// </summary>
|
||||
/// <param name="appPath"></param>
|
||||
/// <param name="apiKey"></param>
|
||||
public static void Publish(string appPath, string apiKey = "")
|
||||
{
|
||||
string bash_path = EvnCheck();
|
||||
if (string.IsNullOrEmpty(bash_path))
|
||||
{
|
||||
ShowDialog("找不到 Bash 执行文件", $"Bash文件不存在: {bash_path}!");
|
||||
return;
|
||||
}
|
||||
if (!File.Exists(appPath))
|
||||
{
|
||||
ShowDialog("找不到包体文件", $"包体文件不存在: {appPath}!");
|
||||
return;
|
||||
}
|
||||
|
||||
PgyerAPI.PublishToPgyer(appPath, apiKey, bash_path, OnResponse);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选择文件及发布版本
|
||||
/// </summary>
|
||||
/// <param name="extension"></param>
|
||||
/// <param name="apiKey"></param>
|
||||
public static void SelectAndPublish(string extension = "apk", string apiKey = "")
|
||||
{
|
||||
string file = EditorUtility.OpenFilePanel("选择包体", $"~/Downloads", extension);
|
||||
Publish(file, apiKey);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Show system dialogs
|
||||
/// </summary>
|
||||
/// <param name="title"></param>
|
||||
/// <param name="body"></param>
|
||||
/// <param name="callback"></param>
|
||||
/// <param name="cancelAction"></param>
|
||||
/// <param name="okName"></param>
|
||||
/// <param name="cancelName"></param>
|
||||
private static void ShowDialog(string title, string body, Action callback = null, Action cancelAction = null, string okName= "OK", string cancelName = "")
|
||||
{
|
||||
if (EditorUtility.DisplayDialog(title, body, okName, cancelName))
|
||||
{
|
||||
callback?.Invoke();
|
||||
}
|
||||
else
|
||||
{
|
||||
cancelAction?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On pgyer response callback
|
||||
/// </summary>
|
||||
/// <param name="log"></param>
|
||||
private static void OnResponse(string log)
|
||||
{
|
||||
var logPath = $"{PgyerAPI.WorkingDir}/log.txt";
|
||||
File.WriteAllText(logPath, log);
|
||||
|
||||
bool success = log.Contains(ResponseObject.HeadTag);
|
||||
|
||||
if (success)
|
||||
{
|
||||
var json = log.Substring(log.IndexOf(ResponseObject.HeadTag, StringComparison.Ordinal));
|
||||
var res = ResponseObject.Parse(json);
|
||||
if (res != null)
|
||||
{
|
||||
var url = PgyerAPI.GetDownloadUrl(res.ShortUrl());
|
||||
ShowDialog($"==== 上传成功 ({PgyerAPI.Version}) ====", $"包体 {res.BuildVersion()} ({res.BuildVersionCode()}) 上传成功!\n下载链接:{url}", () =>
|
||||
{
|
||||
Debug.Log($"INSTALL URL:{url}"); // output url
|
||||
Application.OpenURL(url);
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ShowDialog($"==== 上传失败 ({PgyerAPI.Version}) ====", $"上传文件失败, 查看详细日志: \n{logPath}", () =>
|
||||
{
|
||||
#if UNITY_EDITOR_OSX
|
||||
EditorUtility.RevealInFinder(PgyerAPI.WorkingDir);
|
||||
return;
|
||||
#endif
|
||||
Application.OpenURL(PgyerAPI.WorkingDir);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
internal class ResponseObject
|
||||
{
|
||||
public int code;
|
||||
public string message;
|
||||
public PublishData data;
|
||||
|
||||
public static readonly string HeadTag = "{\"code\":";
|
||||
|
||||
public string BuildVersion() => data?.buildVersion ?? "0.0.0";
|
||||
public string BuildVersionCode() => data?.buildVersionNo ?? "0";
|
||||
public string ShortUrl() => data?.buildShortcutUrl ?? "#";
|
||||
|
||||
|
||||
public static bool IsValid(string json)
|
||||
{
|
||||
return json.Contains(HeadTag);
|
||||
}
|
||||
|
||||
public static ResponseObject Parse(string json)
|
||||
{
|
||||
if (string.IsNullOrEmpty(json)) return null;
|
||||
if (!IsValid(json)) return null;
|
||||
return JsonUtility.FromJson<ResponseObject>(json);
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
internal class PublishData
|
||||
{
|
||||
public string buildIdentifier;
|
||||
public string buildQRCodeURL;
|
||||
public string buildShortcutUrl;
|
||||
public string buildName;
|
||||
public string buildVersion;
|
||||
public string buildVersionNo;
|
||||
public string buildUpdated;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 615e8fb3101146048570e17d27bfbb9b
|
||||
timeCreated: 1709605527
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
namespace Guru.Editor
|
||||
{
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using System.Linq;
|
||||
|
||||
public class JenkinsHelper
|
||||
{
|
||||
public const string DefaultArgsTag = "+args";
|
||||
|
||||
public static AppBuildParam ParseJenkinsBuildParam(string[] commandlineArgs, string argsTag = "")
|
||||
{
|
||||
if (string.IsNullOrEmpty(argsTag)) argsTag = DefaultArgsTag;
|
||||
int len = commandlineArgs.Length;
|
||||
|
||||
Debug.Log($"------------ Jenkins set commands: {len} ------------");
|
||||
|
||||
var buildParam = new AppBuildParam()
|
||||
{
|
||||
BuilderType = AppBuilderType.Jenkins,
|
||||
TargetName = "Android",
|
||||
IsBuildAAB = false,
|
||||
IsBuildSymbols = false,
|
||||
AutoPublish = false,
|
||||
};
|
||||
|
||||
string p = "";
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
p = commandlineArgs[i];
|
||||
// Debug.Log($"--- [{i}]: {p}");
|
||||
|
||||
if (p.StartsWith(argsTag))
|
||||
{
|
||||
// Debug.Log($"--- find param: {p}");
|
||||
var args = p.Split('-').ToList();
|
||||
if (args.Count > 1)
|
||||
{
|
||||
// Debug.Log($"--- ENV: {args[1]}");
|
||||
if (args[1].ToUpper() == "RELEASE")
|
||||
{
|
||||
buildParam.IsBuildRelease = true;
|
||||
buildParam.IsBuildShowLog = false;
|
||||
buildParam.IsBuildSymbols = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
buildParam.IsBuildRelease = false;
|
||||
buildParam.IsBuildShowLog = true;
|
||||
buildParam.IsBuildSymbols = false;
|
||||
}
|
||||
}
|
||||
if (args.Count > 2)
|
||||
{
|
||||
// Debug.Log($"--- VERSION: {args[2]}");
|
||||
buildParam.BuildVersion = args[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return buildParam;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取构建参数
|
||||
/// </summary>
|
||||
/// <param name="argsTag"></param>
|
||||
/// <returns></returns>
|
||||
public static AppBuildParam GetBuildParams(string argsTag = "")
|
||||
{
|
||||
return ParseJenkinsBuildParam(Environment.GetCommandLineArgs(), argsTag);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6f2cde4b226e401babf1c1e9088e1673
|
||||
timeCreated: 1711889309
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# 通过shell脚本来实现将本地app文件通过API上传到蒲公英
|
||||
# https://www.pgyer.com/doc/view/api#fastUploadApp
|
||||
#
|
||||
|
||||
# Display log. 1=enable, 0=disable
|
||||
LOG_ENABLE=1
|
||||
|
||||
printHelp() {
|
||||
echo "Usage: $0 -k <api_key> [OPTION]... file"
|
||||
echo "Upload iOS or Android app package file to PGYER."
|
||||
echo "Example: $0 -k xxxxxxxxxxxxxxx /data/app.ipa"
|
||||
echo ""
|
||||
echo "Description:"
|
||||
echo " -k api_key (required) api key from PGYER"
|
||||
echo " -t buildInstallType build install type, 1=public, 2=password, 3=invite"
|
||||
echo " -p buildPassword build password, required if buildInstallType=2"
|
||||
echo " -d buildUpdateDescription build update description"
|
||||
echo " -e buildInstallDate build install date, 1=buildInstallStartDate~buildInstallEndDate, 2=forever"
|
||||
echo " -s buildInstallStartDate build install start date, format: yyyy-MM-dd"
|
||||
echo " -e buildInstallEndDate build install end date, format: yyyy-MM-dd"
|
||||
echo " -c buildChannelShortcut build channel shortcut"
|
||||
echo " -h help show this help"
|
||||
echo ""
|
||||
echo "Report bugs to: <https://github.com/PGYER/pgyer_api_example/issues>"
|
||||
echo "Project home page: <https://github.com/PGYER/pgyer_api_example>"
|
||||
exit 1
|
||||
}
|
||||
|
||||
while getopts 'k:t:p:d:s:e:c:h' OPT; do
|
||||
case $OPT in
|
||||
k) api_key="$OPTARG";;
|
||||
t) buildInstallType="$OPTARG";;
|
||||
p) buildPassword="$OPTARG";;
|
||||
d) buildUpdateDescription="$OPTARG";;
|
||||
e) buildInstallDate="$OPTARG";;
|
||||
s) buildInstallStartDate="$OPTARG";;
|
||||
e) buildInstallEndDate="$OPTARG";;
|
||||
c) buildChannelShortcut="$OPTARG";;
|
||||
?) printHelp;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $(($OPTIND - 1))
|
||||
readonly file=$1
|
||||
|
||||
# check api_key exists
|
||||
if [ -z "$api_key" ]; then
|
||||
echo "api_key is empty"
|
||||
printHelp
|
||||
fi
|
||||
|
||||
# check file exists
|
||||
if [ ! -f "$file" ]; then
|
||||
echo "file not exists"
|
||||
printHelp
|
||||
fi
|
||||
|
||||
# check ext supported
|
||||
buildType=${file##*.}
|
||||
if [ "$buildType" != "ipa" ] && [ "$buildType" != "apk" ]; then
|
||||
echo "file ext is not supported"
|
||||
printHelp
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------
|
||||
# functions
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
log() {
|
||||
[ $LOG_ENABLE -eq 1 ] && echo "[$(date +'%Y-%m-%d %H:%M:%S')] $*"
|
||||
}
|
||||
|
||||
logTitle() {
|
||||
log "-------------------------------- $* --------------------------------"
|
||||
}
|
||||
|
||||
execCommand() {
|
||||
log "$@"
|
||||
result=$(eval $@)
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------
|
||||
# 获取上传凭证
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
logTitle "获取凭证"
|
||||
|
||||
command="curl -s"
|
||||
[ -n "$api_key" ] && command="${command} --form-string '_api_key=${api_key}'";
|
||||
[ -n "$buildType" ] && command="${command} --form-string 'buildType=${buildType}'";
|
||||
[ -n "$buildInstallType" ] && command="${command} --form-string 'buildInstallType=${buildInstallType}'";
|
||||
[ -n "$buildPassword" ] && command="${command} --form-string 'buildPassword=${buildPassword}'";
|
||||
[ -n "$buildUpdateDescription" ] && command="${command} --form-string $'buildUpdateDescription=${buildUpdateDescription}'";
|
||||
[ -n "$buildInstallDate" ] && command="${command} --form-string 'buildInstallDate=${buildInstallDate}'";
|
||||
[ -n "$buildInstallStartDate" ] && command="${command} --form-string 'buildInstallStartDate=${buildInstallStartDate}'";
|
||||
[ -n "$buildInstallEndDate" ] && command="${command} --form-string 'buildInstallEndDate=${buildInstallEndDate}'";
|
||||
[ -n "$buildChannelShortcut" ] && command="${command} --form-string 'buildChannelShortcut=${buildChannelShortcut}'";
|
||||
command="${command} http://www.pgyer.com/apiv2/app/getCOSToken";
|
||||
execCommand $command
|
||||
|
||||
[[ "${result}" =~ \"endpoint\":\"([\:\_\.\/\\A-Za-z0-9\-]+)\" ]] && endpoint=`echo ${BASH_REMATCH[1]} | sed 's!\\\/!/!g'`
|
||||
[[ "${result}" =~ \"key\":\"([\.a-z0-9]+)\" ]] && key=`echo ${BASH_REMATCH[1]}`
|
||||
[[ "${result}" =~ \"signature\":\"([\=\&\_\;A-Za-z0-9\-]+)\" ]] && signature=`echo ${BASH_REMATCH[1]}`
|
||||
[[ "${result}" =~ \"x-cos-security-token\":\"([\_A-Za-z0-9\-]+)\" ]] && x_cos_security_token=`echo ${BASH_REMATCH[1]}`
|
||||
|
||||
if [ -z "$key" ] || [ -z "$signature" ] || [ -z "$x_cos_security_token" ] || [ -z "$endpoint" ]; then
|
||||
log "get upload token failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------
|
||||
# 上传文件
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
logTitle "上传文件"
|
||||
|
||||
file_name=${file##*/}
|
||||
|
||||
execCommand "curl -s -o /dev/null -w '%{http_code}' \
|
||||
--form-string 'key=${key}' \
|
||||
--form-string 'signature=${signature}' \
|
||||
--form-string 'x-cos-security-token=${x_cos_security_token}' \
|
||||
--form-string 'x-cos-meta-file-name=${file_name}' \
|
||||
-F 'file=@${file}' ${endpoint}"
|
||||
if [ $result -ne 204 ]; then # if http code != 204, upload failed
|
||||
log "Upload failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------
|
||||
# 检查结果
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
logTitle "检查结果"
|
||||
|
||||
for i in {1..60}; do
|
||||
execCommand "curl -s http://www.pgyer.com/apiv2/app/buildInfo?_api_key=${api_key}\&buildKey=${key}"
|
||||
[[ "${result}" =~ \"code\":([0-9]+) ]] && code=`echo ${BASH_REMATCH[1]}`
|
||||
if [ $code -eq 0 ]; then
|
||||
echo $result
|
||||
break
|
||||
else
|
||||
sleep 1
|
||||
fi
|
||||
done
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 10035163694574b63b74cd99c7ee5c68
|
||||
guid: 64be73b7342084dd583da03a6730370d
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
#proguard-adjust.pro
|
||||
-keep public class com.adjust.sdk.** { *; }
|
||||
-keep class com.amazon.device.ads.** { *; }
|
||||
-keep class com.amazon.aps.** { *; }
|
||||
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {
|
||||
com.google.android.gms.ads.identifier.AdvertisingIdClient$Info getAdvertisingIdInfo(android.content.Context);
|
||||
}
|
||||
|
|
@ -97,3 +98,7 @@
|
|||
|
||||
-keep class com.onevcat.uniwebview.* { *; }
|
||||
-keep class com.iab.omid.* { *; }
|
||||
|
||||
-keep public class com.tradplus.** { *; }
|
||||
-keep class com.tradplus.ads.** { *; }
|
||||
-keep class com.applovin.mediation.adapters.** { *; }
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"name": "Guru.Editor",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"Guru.Runtime"
|
||||
"Guru.Runtime",
|
||||
"Guru.Notification"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c2bda7db652148e7a73fd2179e22be09
|
||||
guid: 70312596ce564426aa363479bc5fd1f9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b460e9873d8bf445da1764952f4f966c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
#if UNITY_IOS
|
||||
namespace Guru.Editor
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Callbacks;
|
||||
using UnityEditor.iOS.Xcode;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// SKAdNetwork 注入逻辑
|
||||
/// </summary>
|
||||
public static class IOSPostBuild_SKAdNetwork
|
||||
{
|
||||
private static List<string> NETWORK_IDENTIFIER_ARRAY = new List<string>();
|
||||
public static readonly string SKADNetworkIdentifier = "SKAdNetworkIdentifier";
|
||||
|
||||
private static readonly char DIR_CHAR = Path.DirectorySeparatorChar;
|
||||
public static readonly string OS_PLATFORM_LOCATION = $"Assets/Guru/GuruBuildTool/Editor/IOS_POST_AD/";
|
||||
public static readonly string SKADNetworkName = "SKADNetwork.plist";
|
||||
|
||||
[PostProcessBuild(10)]
|
||||
private static void OnPostProcessBuild(BuildTarget buildTarget, string path)
|
||||
{
|
||||
if (buildTarget != BuildTarget.iOS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var plistPath = Path.Combine(path, "Info.plist");
|
||||
var plist = new PlistDocument();
|
||||
plist.ReadFromFile(plistPath);
|
||||
|
||||
//设置SKAdNetworkItems
|
||||
ReadSKADNetworkPlistFile();
|
||||
var plistElementArray = plist.root.CreateArray("SKAdNetworkItems");
|
||||
AddPlatformADNetworkIdentifier(plistElementArray, NETWORK_IDENTIFIER_ARRAY);
|
||||
plist.WriteToFile(plistPath);
|
||||
}
|
||||
|
||||
public static void ReadSKADNetworkPlistFile()
|
||||
{
|
||||
string plistPath = Path.Combine(GetToolRootDir(), SKADNetworkName);
|
||||
if (File.Exists(plistPath))
|
||||
{
|
||||
var plist = new PlistDocument();
|
||||
plist.ReadFromFile(plistPath);
|
||||
var skADNetworksArr = plist.root["SKAdNetworkItems"].AsArray();
|
||||
if (skADNetworksArr != null)
|
||||
{
|
||||
foreach (var plistElement in skADNetworksArr.values)
|
||||
{
|
||||
var adNetworkValue = plistElement.AsDict()[SKADNetworkIdentifier].AsString();
|
||||
if(!NETWORK_IDENTIFIER_ARRAY.Contains(adNetworkValue))
|
||||
NETWORK_IDENTIFIER_ARRAY.Add(adNetworkValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"[POST] --- Inject SKADNetwork Failed: {plistPath}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void AddPlatformADNetworkIdentifier(PlistElementArray plistElementArray, List<string> arrays)
|
||||
{
|
||||
foreach (var value in arrays)
|
||||
{
|
||||
PlistArrayAddDict(plistElementArray, value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void PlistArrayAddDict(PlistElementArray plistElementArray, string value)
|
||||
{
|
||||
plistElementArray.AddDict().SetString(SKADNetworkIdentifier, value);
|
||||
}
|
||||
|
||||
|
||||
private static string GetToolRootDir()
|
||||
{
|
||||
var guids = AssetDatabase.FindAssets($"{nameof(IOSPostBuild_SKAdNetwork)}");
|
||||
if (guids.Length > 0)
|
||||
{
|
||||
var path = Directory.GetParent(AssetDatabase.GUIDToAssetPath(guids[0])).FullName;
|
||||
return path;
|
||||
}
|
||||
return $"{Application.dataPath.Replace("Assets", "Packages")}/com.guru.unity.sdk.core/Editor/GuruBuildSuit/IOS_POST_AD";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: be1ddc59e4ac2416f8174a5611f0c98a
|
||||
timeCreated: 1632375624
|
||||
|
|
@ -0,0 +1,925 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>SKAdNetworkItems</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>cstr6suwn9.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>4fzdc2evr5.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>4pfyvq9l8r.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>2fnua5tdw4.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>ydx93a7ass.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>5a6flpkh64.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>p78axxw29g.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>v72qych5uu.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>ludvb6z3bs.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>cp8zw746q7.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>3sh42y64q3.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>c6k4g5qg8m.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>s39g8k73mm.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>3qy4746246.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>f38h382jlk.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>hs6bdukanm.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>v4nxqhlyqp.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>wzmmz9fp6w.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>yclnxrl5pm.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>t38b2kh725.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>7ug5zh24hu.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>gta9lk7p23.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>vutu7akeur.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>y5ghdn5j9k.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>n6fk4nfna4.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>v9wttpbfk9.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>n38lu8286q.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>47vhws6wlr.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>kbd757ywx3.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>9t245vhmpl.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>eh6m2bh4zr.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>a2p9lx4jpn.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>22mmun2rn5.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>4468km3ulz.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>2u9pt9hc89.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>8s468mfl3y.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>klf5c3l5u5.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>ppxm28t8ap.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>ecpz2srf59.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>uw77j35x4d.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>pwa73g5rt2.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>mlmmfzh3r3.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>578prtvx9j.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>4dzt52r2t5.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>e5fvkxwrpn.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>8c4e2ghe7u.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>zq492l623r.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>3rd42ekr43.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>3qcr597p9d.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>238da6jt44.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>24t9a8vw3c.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>24zw6aqk47.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>252b5q8x7y.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>275upjj5gd.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>294l99pt4k.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>32z4fx6l9h.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>3l6bd9hu43.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>424m5254lk.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>44jx6755aq.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>44n7hlldy6.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>488r3q3dtq.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>4mn522wn87.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>4w7y6s5ca2.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>523jb4fst2.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>52fl2v3hgk.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>54nzkqm89y.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>5l3tpt7t6e.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>5lm9lj6jb7.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>5tjdwbrq8w.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>6964rsfnh4.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>6g9af3uyq4.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>6p4ks3rnbw.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>6v7lgmsu45.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>6xzpu9s2p8.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>737z793b9f.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>74b6s63p6l.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>79pbpufp6p.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>7fmhfwg9en.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>7rz58n8ntl.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>84993kbrcf.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>89z7zv988g.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>8m87ys6875.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>8r8llnkz5a.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>97r2b46745.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>9b89h5y424.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>9nlqeag3gk.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>9rd848q2bz.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>9vvzujtq5s.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>9yg77x724h.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>a7xqa6mtl2.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>a8cz6cu7e5.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>av6w8kgt66.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>b9bk5wbcq9.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>bxvub5ada5.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>c3frkrj4fj.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>cg4yq2srnc.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>cj5566h2ga.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>cs644xg564.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>dbu4b84rxf.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>dkc879ngq3.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>dzg6xy7pwj.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>ejvt5qm6ak.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>f73kdq92p3.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>f7s53z58qe.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>feyaarzu9v.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>g28c52eehv.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>g2y4y55b64.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>ggvn48r87g.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>glqzh8vgby.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>gta8lk7p23.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>hb56zgv37p.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>hdw39hrw9y.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>k674qkevps.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>kbmxgpxpgc.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>krvm3zuq6h.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>lr83yxwka7.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>m297p6643m.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>m5mvw97r93.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>m8dbw4sv7c.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>mls7yz5dvl.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>mp6xlyr22a.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>mtkv5xtk9e.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>n66cz3y3bx.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>n9x2a789qt.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>nzq8sh4pbs.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>prcb7njmu6.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>pwdxu55a5a.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>qqp299437r.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>r45fhb6rf7.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>rvh3l7un93.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>rx5hdcabgc.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>s69wq72ugq.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>su67r6k2v3.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>tl55sbb4fm.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>u679fj5vs4.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>v79kvwwj4g.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>vcra2ehyfk.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>w9q455wk68.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>wg4vff78zm.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>x44k69ngh6.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>x5l83yy675.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>x8jxxk4ff5.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>x8uqf25wch.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>xy9t38ct57.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>y45688jllp.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>z24wtl6j62.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>zmvfpc5aq8.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>k6y4y55b64.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>t6d3zquu66.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>9g2aggbj52.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>h65wbv5k3f.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>bvpn9ufa9b.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>hjevpa356n.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>6yxyv74ff7.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>mqn7fxpca7.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>7953jerfzd.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>qu637u8glc.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>g6gcrrvk4p.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>ln5gz23vtd.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>z959bm4gru.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>nu4557a4je.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>gvmwg8q7h5.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>pu4na253f3.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>yrqqpx2mcb.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>z4gj7hsk7h.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>bd757ywx3.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>33r6p7g8nc.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>g69uk9uh2b.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>633vhxswh4.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>tmhh9296z4.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>zh3b7bxvad.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>xmn954pzmp.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>79w64w269u.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>d7g9azk84q.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>866k9ut3g3.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>2q884k2j68.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>gfat3222tu.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>pd25vrrwzn.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>y755zyxw56.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>qlbq5gtkt8.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>67369282zy.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>899vrgt9g8.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>mj797d8u6f.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>88k8774x49.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>t3b3f7n3x8.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>c7g47wypnu.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>z5b3gh5ugf.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>dd3a75yxkv.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>h5jmj969g5.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>dr774724x4.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>t7ky8fmwkd.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>fz2k2k5tej.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>w28pnjg2k4.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>2rq3zucswp.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>vc83br9sjg.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>eqhxz8m8av.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>7k3cvf297u.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>7tnzynbdc7.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>l6nv3x923s.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>h8vml93bkz.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>uzqba5354d.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>8qiegk9qfv.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>xx9sdjej2w.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>au67k4efj4.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>dmv22haz9p.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>7fbxrn65az.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>b55w3d8y8z.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>v7896pgt74.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>5ghnmfs3dh.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>627r9wr2y5.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>sczv5946wb.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>8w3np9l82g.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>nrt9jy4kw9.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>dn942472g5.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>cad8qz2s3j.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>r26jy69rpl.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>jb7bn6koa5.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>fkak3gfpt6.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>2tdux39lx8.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>3cgn6rq224.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>nfqy3847ph.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>dticjx1a9i.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>9wsyqb3ku7.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>x5854y7y24.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>6qx585k4p6.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>l93v5h6a4m.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>axh5283zss.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>5mv394q32t.skadnetwork</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>x2jnk7ly8j.skadnetwork</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e15412105e424ee0934897a153640a34
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 815571d7e09647a8b91951918d0feb7e
|
||||
timeCreated: 1699597324
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
#if UNITY_IOS
|
||||
|
||||
namespace Guru.Editor
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Callbacks;
|
||||
using UnityEditor.iOS.Xcode;
|
||||
using UnityEngine;
|
||||
using System.IO;
|
||||
using Enumerable = System.Linq.Enumerable;
|
||||
|
||||
/// <summary>
|
||||
/// Fireabse DebugView 开启参数注入
|
||||
/// </summary>
|
||||
public class IOSPostBuild_FireabseDebugView
|
||||
{
|
||||
public static readonly string Tag = "[POST]";
|
||||
private static readonly string CodeFixMark = "CODE_FIX_BY_GURU";
|
||||
private static readonly string CodeCmdArgsFix = $"\t\t//--------- {CodeFixMark} --------------\n\t\tNSMutableArray *newArguments = [NSMutableArray arrayWithArray:[[NSProcessInfo processInfo] arguments]];\n\t\t[newArguments addObject:@\"-FIRAnalyticsDebugEnabled\"];\n\t\t[newArguments addObject:@\"-FIRDebugEnabled\"];\n\t\t[[NSProcessInfo processInfo] setValue:[newArguments copy] forKey:@\"arguments\"];";
|
||||
private static readonly string CodeDidFinishedLaunch =
|
||||
"(BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:";
|
||||
|
||||
/// <summary>
|
||||
/// 需要在外部接口调用参数注入
|
||||
/// </summary>
|
||||
public static bool EnableDebugView = false; // 默认为False, 需要外部注入
|
||||
|
||||
[PostProcessBuild(1)]
|
||||
public static void PostBuildXcodeArgs(BuildTarget target, string buildPath)
|
||||
{
|
||||
Debug.Log($"{Tag} --- Add Firebase debug args: {EnableDebugView}");
|
||||
|
||||
if (target != BuildTarget.iOS) return;
|
||||
if (!EnableDebugView) return;
|
||||
|
||||
AddLauncherArgsToSchema(buildPath);
|
||||
InjectLaunchCode(buildPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加启动参数到Scheme
|
||||
/// </summary>
|
||||
/// <param name="buildPath"></param>
|
||||
private static void AddLauncherArgsToSchema(string buildPath)
|
||||
{
|
||||
string schemePath = buildPath + "/Unity-iPhone.xcodeproj/xcshareddata/xcschemes/Unity-iPhone.xcscheme";
|
||||
|
||||
var xcscheme = new XcScheme();
|
||||
xcscheme.ReadFromFile(schemePath);
|
||||
|
||||
xcscheme.SetMetalValidationOnRun(XcScheme.MetalValidation.Extended);
|
||||
xcscheme.SetFrameCaptureModeOnRun(XcScheme.FrameCaptureMode.Metal);
|
||||
xcscheme.AddArgumentPassedOnLaunch("-FIRDebugEnabled");
|
||||
|
||||
xcscheme.WriteToFile(schemePath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注入命令行参数
|
||||
/// </summary>
|
||||
/// <param name="buildPath"></param>
|
||||
private static void InjectLaunchCode(string buildPath)
|
||||
{
|
||||
string path = $"{buildPath}/Classes/UnityAppController.mm";
|
||||
|
||||
if (File.Exists(path))
|
||||
{
|
||||
List<string> lines = Enumerable.ToList(File.ReadAllLines(path));
|
||||
string line = "";
|
||||
int idx = -1;
|
||||
for (int i = 0; i < lines.Count; i++)
|
||||
{
|
||||
line = lines[i];
|
||||
if (line.Contains(CodeDidFinishedLaunch))
|
||||
{
|
||||
// 找到注入行
|
||||
idx = i + 1;
|
||||
if (lines[idx].Contains("{"))
|
||||
{
|
||||
idx++;
|
||||
}
|
||||
if (lines[idx].Contains(@"::printf(""-> applicationDidFinishLaunching()\n"");"))
|
||||
{
|
||||
idx++;
|
||||
}
|
||||
|
||||
if (lines[idx].Contains(CodeFixMark) || lines[idx+1].Contains(CodeFixMark))
|
||||
{
|
||||
Debug.Log($"{Tag} <color=orange>---- code has already injected, skip... </color>");
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
lines.Insert(idx, CodeCmdArgsFix);
|
||||
File.WriteAllLines(path, lines.ToArray());
|
||||
Debug.Log($"{Tag} <color=#88ff00>---- code has success injected.</color> path:\n{path}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"{Tag} <color=red>---- file not found: {path}, inject failed... </color>");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7f98aa3ce0d04b2d9f8442a0b288f27e
|
||||
timeCreated: 1699597308
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
#if UNITY_IOS
|
||||
|
||||
namespace Guru.Editor
|
||||
{
|
||||
using UnityEditor;
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnityEditor.Callbacks;
|
||||
|
||||
|
||||
public class IOSPostBuild_Firebase_VersionFix
|
||||
{
|
||||
|
||||
|
||||
private static string[] fixedLibs = new string[]
|
||||
{
|
||||
"Firebase/Core",
|
||||
"Firebase/Firestore",
|
||||
"Firebase/Analytics",
|
||||
"Firebase/Storage",
|
||||
"Firebase/Auth",
|
||||
"Firebase/Messaging",
|
||||
"Firebase/Crashlytics",
|
||||
"Firebase/DynamicLinks",
|
||||
"Firebase/RemoteConfig",
|
||||
};
|
||||
|
||||
private static string[] additionLibs = new string[]
|
||||
{
|
||||
"FirebaseFirestoreInternal",
|
||||
};
|
||||
|
||||
private static string fixedVersion = "10.22.0";
|
||||
private static string minTargetSdk = "8.0";
|
||||
|
||||
// <iosPod name="Firebase/Core" version="10.22.0" minTargetSdk="8.0" />
|
||||
|
||||
|
||||
|
||||
// Firebase 10.20.0 fixed to 10.22.0. BUT higher version do not open this ATTRIBUTE !!
|
||||
// [PostProcessBuild(47)] // MAX POD Process Order
|
||||
public static void PostBuildFixPodDeps(BuildTarget target, string projPath)
|
||||
{
|
||||
if (target != BuildTarget.iOS) return;
|
||||
|
||||
string podfile = Path.Combine(projPath, "Podfile");
|
||||
if (!File.Exists(podfile)) return;
|
||||
|
||||
FixFirebasePodVersion(podfile);
|
||||
}
|
||||
|
||||
|
||||
private static void FixFirebasePodVersion(string podfile)
|
||||
{
|
||||
var lines = File.ReadAllLines(podfile).ToList();
|
||||
string line = "";
|
||||
int idx = 0;
|
||||
bool isDirty = false;
|
||||
List<string> needAdded = new List<string>(additionLibs);
|
||||
for (int i = 0; i < lines.Count; i++)
|
||||
{
|
||||
line = lines[i];
|
||||
|
||||
if (line.Contains("pod '"))
|
||||
{
|
||||
idx = i;
|
||||
}
|
||||
|
||||
foreach (var libName in fixedLibs)
|
||||
{
|
||||
if (line.Contains(libName))
|
||||
{
|
||||
lines[i] = FixOneFirebaseLibVersion(line, fixedVersion);
|
||||
isDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var libName in additionLibs)
|
||||
{
|
||||
if (line.Contains(libName))
|
||||
{
|
||||
needAdded.Remove(libName);
|
||||
lines[i] = FixOneFirebaseLibVersion(line, fixedVersion);
|
||||
isDirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (needAdded.Count > 0)
|
||||
{
|
||||
// pod 'Firebase/DynamicLinks', '10.20.0'
|
||||
foreach (var libName in needAdded)
|
||||
{
|
||||
idx++;
|
||||
idx = Mathf.Min(idx, lines.Count - 1);
|
||||
lines.Insert(idx, $"\tpod '{libName}', '{fixedVersion}'");
|
||||
isDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(isDirty) File.WriteAllLines(podfile, lines);
|
||||
}
|
||||
|
||||
private static string FixOneFirebaseLibVersion(string line, string fixedVersion)
|
||||
{
|
||||
if(!line.Contains("', '") || !line.Contains("pod")) return line;
|
||||
string fixedLine = line.Substring(0, line.IndexOf("', '") + 4) + $"{fixedVersion}'";
|
||||
return fixedLine;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2aab28d86c8346e581c650a86cad060f
|
||||
timeCreated: 1717039005
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bf616a5ad654b418281c06863ad401eb
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,215 @@
|
|||
#if UNITY_IOS
|
||||
|
||||
namespace Guru.Editor
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Callbacks;
|
||||
using UnityEditor.iOS.Xcode;
|
||||
using UnityEditor.iOS.Xcode.Extensions;
|
||||
using UnityEngine;
|
||||
|
||||
public static class IOSPostProcessBuildIPM
|
||||
{
|
||||
public static readonly string DEFAULT_PROJECT_TARGET_NAME = "Unity-iPhone";
|
||||
public static readonly string NOTIFICATION_SERVICE_EXTENSION_TARGET_NAME = "U3D2FCM-iOS";
|
||||
public static readonly string NOTIFICATION_SERVICE_EXTENSION_OBJECTIVEC_FILENAME = "NotificationService";
|
||||
|
||||
private static readonly char DIR_CHAR = Path.DirectorySeparatorChar;
|
||||
public static readonly string OS_PLATFORM_LOCATION = $"Assets/Guru/GuruBuildTool/Editor/IOS_POST_IPM/";
|
||||
private static readonly string SKADNetworkIdentifier = "SKAdNetworkIdentifier";
|
||||
private static List<string> NETWORK_IDENTIFIER_ARRAY = new List<string>();
|
||||
|
||||
private enum EntitlementOptions {
|
||||
AppGroups,
|
||||
}
|
||||
|
||||
private static readonly string[] FRAMEWORKS_MAIN_TO_ADD = {
|
||||
};
|
||||
|
||||
private static readonly string[] FRAMEWORKS_UNITY_FRAMEWORK_TO_ADD = {
|
||||
"GameKit.framework",
|
||||
};
|
||||
|
||||
private static readonly string[] FRAMEWORKS_FCM_TO_ADD = {
|
||||
"UserNotifications.framework",
|
||||
"UIKit.framework",
|
||||
};
|
||||
|
||||
[PostProcessBuild(1)]
|
||||
private static void OnPostProcessBuild(BuildTarget buildTarget, string path)
|
||||
{
|
||||
if (buildTarget != BuildTarget.iOS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var projectPath = PBXProject.GetPBXProjectPath(path);
|
||||
var project = new PBXProject();
|
||||
project.ReadFromString(File.ReadAllText(projectPath));
|
||||
|
||||
var mainTargetName = GetPBXProjectTargetName(project);
|
||||
var mainTargetGUID = GetPBXProjectTargetGUID(project);
|
||||
var unityFrameworkGUID = GetPBXProjectUnityFrameworkGUID(project);
|
||||
|
||||
foreach(var framework in FRAMEWORKS_MAIN_TO_ADD) {
|
||||
project.AddFrameworkToProject(mainTargetGUID, framework, false);
|
||||
}
|
||||
|
||||
foreach(var framework in FRAMEWORKS_UNITY_FRAMEWORK_TO_ADD) {
|
||||
project.AddFrameworkToProject(unityFrameworkGUID, framework, false);
|
||||
}
|
||||
|
||||
ModifyPlistFile(path);
|
||||
|
||||
// 关闭Bitode
|
||||
project.SetBuildProperty(mainTargetGUID, "ENABLE_BITCODE", "NO");
|
||||
project.SetBuildProperty(unityFrameworkGUID, "ENABLE_BITCODE", "NO");
|
||||
|
||||
// 添加 UnityFramework 版本号
|
||||
project.SetBuildProperty(unityFrameworkGUID, "CURRENT_PROJECT_VERSION", PlayerSettings.bundleVersion);
|
||||
project.SetBuildProperty(unityFrameworkGUID, "MARKETING_VERSION", PlayerSettings.iOS.buildNumber);
|
||||
|
||||
AddOrUpdateEntitlements(path, project, mainTargetGUID, mainTargetName,
|
||||
new HashSet<EntitlementOptions>
|
||||
{
|
||||
EntitlementOptions.AppGroups
|
||||
});
|
||||
|
||||
// AddNotificationServiceExtension(project ,path); // <--- 无需添加Extension了
|
||||
|
||||
project.WriteToFile(projectPath);
|
||||
var contents = File.ReadAllText(projectPath);
|
||||
project.ReadFromString(contents);
|
||||
|
||||
// Add push notifications as a capability on the main app target
|
||||
AddPushCapability(project, path, mainTargetGUID, mainTargetName);
|
||||
|
||||
project.SetBuildProperty(unityFrameworkGUID, "GCC_ENABLE_OBJC_EXCEPTIONS", "YES");
|
||||
project.SetBuildProperty(mainTargetGUID, "GCC_ENABLE_OBJC_EXCEPTIONS", "YES");
|
||||
File.WriteAllText(projectPath, project.WriteToString());
|
||||
}
|
||||
|
||||
private static void ModifyPlistFile(string pathToBuildProject)
|
||||
{
|
||||
var plistPath = Path.Combine(pathToBuildProject, "Info.plist");
|
||||
var plist = new PlistDocument();
|
||||
plist.ReadFromFile(plistPath);
|
||||
//设置Google AD GADApplicationIdentifier
|
||||
plist.root.SetString("NSCalendarsUsageDescription", "Store calendar events from ads");
|
||||
// plist.root.SetString("GADApplicationIdentifier", "ca-app-pub-2436733915645843~7788635385");
|
||||
// plist.root.SetString("FacebookClientToken", "2414c9079473645856a5ef6b8ac95cf6");
|
||||
// plist.root.SetString("FacebookDisplayName", PlayerSettings.productName);
|
||||
//设置Xcode的Att弹窗配置
|
||||
plist.root.SetString("NSUserTrackingUsageDescription","By allowing tracking, we'll be able to better tailor ads served to you on this game.");
|
||||
//设置SKAdNetworkItems
|
||||
// ReadSKADNetworkPlistFile();
|
||||
// var plistElementArray = plist.root.CreateArray("SKAdNetworkItems");
|
||||
// AddPlatformADNetworkIdentifier(plistElementArray, NETWORK_IDENTIFIER_ARRAY);
|
||||
|
||||
// 设置合规出口证明
|
||||
plist.root.SetBoolean("ITSAppUsesNonExemptEncryption", false);
|
||||
|
||||
var root = plist.root.values;
|
||||
PlistElement atsRoot;
|
||||
root.TryGetValue("NSAppTransportSecurity", out atsRoot);
|
||||
|
||||
if (atsRoot == null || atsRoot.GetType() != typeof(PlistElementDict))
|
||||
{
|
||||
atsRoot = plist.root.CreateDict("NSAppTransportSecurity");
|
||||
atsRoot.AsDict().SetBoolean("NSAllowsArbitraryLoads", true);
|
||||
}
|
||||
|
||||
var atsRootDict = atsRoot.AsDict().values;
|
||||
if (atsRootDict.ContainsKey("NSAllowsArbitraryLoadsInWebContent"))
|
||||
{
|
||||
atsRootDict.Remove("NSAllowsArbitraryLoadsInWebContent");
|
||||
}
|
||||
|
||||
plist.WriteToFile(plistPath);
|
||||
}
|
||||
|
||||
#region 纯功能函数
|
||||
|
||||
private static void AddOrUpdateEntitlements(string path, PBXProject project, string targetGUI,
|
||||
string targetName, HashSet<EntitlementOptions> options)
|
||||
{
|
||||
string entitlementPath = GetEntitlementsPath(path, project, targetGUI, targetName);
|
||||
var entitlements = new PlistDocument();
|
||||
|
||||
// Check if the file already exisits and read it
|
||||
if (File.Exists(entitlementPath)) {
|
||||
entitlements.ReadFromFile(entitlementPath);
|
||||
}
|
||||
|
||||
// TOOD: This can be updated to use project.AddCapability() in the future
|
||||
if (options.Contains(EntitlementOptions.AppGroups) && entitlements.root["com.apple.security.application-groups"] == null) {
|
||||
var groups = entitlements.root.CreateArray("com.apple.security.application-groups");
|
||||
groups.AddString("group." + PlayerSettings.applicationIdentifier);
|
||||
}
|
||||
|
||||
entitlements.WriteToFile(entitlementPath);
|
||||
|
||||
// Copy the entitlement file to the xcode project
|
||||
var entitlementFileName = Path.GetFileName(entitlementPath);
|
||||
var relativeDestination = targetName + "/" + entitlementFileName;
|
||||
|
||||
// Add the pbx configs to include the entitlements files on the project
|
||||
project.AddFile(relativeDestination, entitlementFileName);
|
||||
project.AddBuildProperty(targetGUI, "CODE_SIGN_ENTITLEMENTS", relativeDestination);
|
||||
}
|
||||
|
||||
private static void AddPushCapability(PBXProject project, string path, string targetGUID, string targetName)
|
||||
{
|
||||
var projectPath = PBXProject.GetPBXProjectPath(path);
|
||||
//project.AddCapability(targetGUID, PBXCapabilityType.PushNotifications);
|
||||
//project.AddCapability(targetGUID, PBXCapabilityType.BackgroundModes);
|
||||
|
||||
var entitlementsPath = GetEntitlementsPath(path, project, targetGUID, targetName);
|
||||
// NOTE: ProjectCapabilityManager's 4th constructor param requires Unity 2019.3+
|
||||
var projCapability = new ProjectCapabilityManager(projectPath, entitlementsPath, targetName);
|
||||
//projCapability.AddBackgroundModes(BackgroundModesOptions.BackgroundFetch);
|
||||
//projCapability.AddBackgroundModes(BackgroundModesOptions.RemoteNotifications);
|
||||
projCapability.AddPushNotifications(false);
|
||||
projCapability.WriteToFile();
|
||||
}
|
||||
|
||||
|
||||
private static string GetPBXProjectTargetName(PBXProject project)
|
||||
{
|
||||
// var projectUUID = project.GetUnityMainTargetGuid();
|
||||
// return project.GetBuildPhaseName(projectUUID);
|
||||
// The above always returns null, using a static value for now.
|
||||
return DEFAULT_PROJECT_TARGET_NAME;
|
||||
}
|
||||
|
||||
private static string GetPBXProjectTargetGUID(PBXProject project)
|
||||
{
|
||||
return project.GetUnityMainTargetGuid();
|
||||
}
|
||||
|
||||
private static string GetPBXProjectUnityFrameworkGUID(PBXProject project)
|
||||
{
|
||||
return project.GetUnityFrameworkTargetGuid();
|
||||
}
|
||||
|
||||
private static string GetEntitlementsPath(string path, PBXProject project, string targetGUI, string targetName)
|
||||
{
|
||||
// Check if there is already an eltitlements file configured in the Xcode project
|
||||
var relativeEntitlementPath = project.GetBuildPropertyForConfig(targetGUI, "CODE_SIGN_ENTITLEMENTS");
|
||||
if (relativeEntitlementPath != null) {
|
||||
var entitlementPath = path + DIR_CHAR + relativeEntitlementPath;
|
||||
if (File.Exists(entitlementPath)) {
|
||||
return entitlementPath;
|
||||
}
|
||||
}
|
||||
|
||||
// No existing file, use a new name
|
||||
return path + DIR_CHAR + targetName + DIR_CHAR + targetName + ".entitlements";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 963cba5e4a074d208e7d9343acb547dc
|
||||
timeCreated: 1632375624
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>U3D2FCM-iOS</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>8</string>
|
||||
<key>NSExtension</key>
|
||||
<dict>
|
||||
<key>NSExtensionPointIdentifier</key>
|
||||
<string>com.apple.usernotifications.service</string>
|
||||
<key>NSExtensionPrincipalClass</key>
|
||||
<string>NotificationService</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c76614c2deb1e4591a5f2f0d5cdfabf7
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
//
|
||||
// NotificationService.h
|
||||
// U3D2FCM-iOS
|
||||
//
|
||||
// Created by Xiaohang Yang on 2021/1/28.
|
||||
//
|
||||
|
||||
#import <UserNotifications/UserNotifications.h>
|
||||
|
||||
@interface NotificationService : UNNotificationServiceExtension
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 45e43a2e87043417d8f83185b71b4199
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
//
|
||||
// NotificationService.m
|
||||
// U3D2FCM
|
||||
//
|
||||
// Created by Michael on 2020/11/27.
|
||||
//
|
||||
|
||||
#import "NotificationService.h"
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
|
||||
@interface NotificationService ()
|
||||
|
||||
@property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver);
|
||||
@property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@implementation NotificationService
|
||||
|
||||
|
||||
- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
|
||||
self.contentHandler = contentHandler;
|
||||
self.bestAttemptContent = [request.content mutableCopy];
|
||||
|
||||
NSLog(@"EventPush-NotificationService-didReceiveNotificationRequest");
|
||||
|
||||
NSString *packageName = @"";
|
||||
NSArray *arr = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"] componentsSeparatedByString:@"."];
|
||||
for(int i=0;i<arr.count-1;i++){
|
||||
if(i==arr.count-2){
|
||||
packageName = [packageName stringByAppendingString:arr[i]];
|
||||
}else{
|
||||
packageName = [packageName stringByAppendingString: [NSString stringWithFormat:@"%@.",arr[i]]];
|
||||
}
|
||||
}
|
||||
NSLog(@"EventPush-NotificationService-packageName: %@", packageName);
|
||||
NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName: [NSString stringWithFormat: @"group.%@", packageName]];
|
||||
NSString *appCountry= [defaults stringForKey:@"appCountry"];
|
||||
NSString *appIdentifier = [defaults stringForKey:@"appIdentifier"];
|
||||
NSString *appVersion = [defaults stringForKey:@"appVersion"];
|
||||
NSString *deviceCountry = [defaults stringForKey:@"deviceCountry"];
|
||||
NSString *deviceId = [defaults stringForKey:@"deviceId"];
|
||||
NSString *deviceToken = [defaults stringForKey:@"deviceToken"];
|
||||
NSString *eventUrl = [defaults stringForKey:@"eventUrl"];
|
||||
NSString *IPM_X_APP_ID = [defaults stringForKey:@"IPM_X_APP_ID"];
|
||||
NSString *IPM_TOKEN = [defaults stringForKey:@"IPM_TOKEN"];
|
||||
NSString *IPM_UID = [defaults stringForKey:@"IPM_UID"];
|
||||
|
||||
//timezone
|
||||
NSTimeZone *zone = [NSTimeZone localTimeZone];
|
||||
NSString *timezone = [zone name];
|
||||
//model
|
||||
UIDevice *currentDevice = [UIDevice currentDevice];
|
||||
NSString *model = [currentDevice model];
|
||||
//language
|
||||
NSArray *languageArray = [NSLocale preferredLanguages];
|
||||
NSString *language = [languageArray objectAtIndex:0];
|
||||
//locale
|
||||
NSLocale *localeObj = [NSLocale currentLocale];
|
||||
NSString *locale = [localeObj localeIdentifier];
|
||||
|
||||
NSDate *currentDate = [[NSDate alloc] init];
|
||||
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
|
||||
[dateFormatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"UTC"]];
|
||||
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss'Z'"];
|
||||
NSString *appEventTime = [dateFormatter stringFromDate:currentDate];
|
||||
|
||||
NSString *deviceData = [NSString stringWithFormat: @"{\"androidId\":null,\"appCountry\":\"%@\",\"appIdentifier\":\"%@\",\"appVersion\":\"%@\",\"brand\":null,\"deviceCoordinates\":{\"latitude\":0,\"longitude\":0},\"deviceCountry\":\"%@\",\"deviceId\":\"%@\",\"deviceToken\":\"%@\",\"deviceType\":\"iOS\",\"gpsCoordinates\":{\"latitude\":0,\"longitude\":0},\"groups\":null,\"language\":\"%@\",\"locale\":\"%@\",\"model\":\"%@\",\"pushDeviceType\":\"iOS\",\"pushNotificationEnable\":true,\"pushNotifications\":null,\"pushType\":\"FCM\",\"timezone\":\"%@\",\"uid\":\"%@\"}", appCountry,appIdentifier,appVersion,deviceCountry,deviceId,deviceToken,language,locale,model,timezone,IPM_UID];
|
||||
NSString *postData = [NSString stringWithFormat: @"{\"appEventTime\":\"%@\",\"deviceData\":%@, \"eventType\":\"DeviceReceive\",\"serverParams\":\"{\\\"itemIndex\\\":0,\\\"pushEventId\\\":\\\"test123\\\",\\\"serverPushTime\\\":\\\"2020-11-27T08:48:39Z\\\",\\\"silent\\\":true,\\\"taskName\\\":\\\"pushTest-dof\\\"}\" }",appEventTime,deviceData];
|
||||
|
||||
|
||||
NSLog(@"EventPush-NotificationService-PlayerPrefs: %@", postData);
|
||||
NSLog(@"EventPush-NotificationService-eventUrl: %@", eventUrl);
|
||||
|
||||
NSURL *url = [NSURL URLWithString:eventUrl];
|
||||
NSMutableURLRequest *httpRequest = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
|
||||
NSData *requestData = [postData dataUsingEncoding:NSUTF8StringEncoding];
|
||||
[httpRequest setHTTPMethod:@"POST"];
|
||||
[httpRequest setValue:IPM_X_APP_ID forHTTPHeaderField:@"X-APP-ID"];
|
||||
[httpRequest setValue:IPM_TOKEN forHTTPHeaderField:@"X-ACCESS-TOKEN"];
|
||||
[httpRequest setValue:IPM_UID forHTTPHeaderField:@"X-UID"];
|
||||
[httpRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
|
||||
|
||||
[httpRequest setValue:[NSString stringWithFormat:@"%d", [requestData length]] forHTTPHeaderField:@"Content-Length"];
|
||||
[httpRequest setHTTPBody: requestData];
|
||||
|
||||
NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration];
|
||||
NSURLSession *session = [NSURLSession sessionWithConfiguration:config];
|
||||
__block NSURLSessionDataTask *task = [session dataTaskWithRequest:httpRequest completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
|
||||
if (error!=nil)
|
||||
{
|
||||
[task suspend];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSString *requestReply = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
|
||||
NSLog(@"EventPush-NotificationService-response: %@", requestReply);
|
||||
[task suspend];
|
||||
}
|
||||
}];
|
||||
[task resume];
|
||||
|
||||
// Modify the notification content here...
|
||||
//self.bestAttemptContent.title = [NSString stringWithFormat:@"%@ [modified]", self.bestAttemptContent.title];
|
||||
|
||||
self.contentHandler(self.bestAttemptContent);
|
||||
}
|
||||
|
||||
- (void)serviceExtensionTimeWillExpire {
|
||||
// Called just before the extension will be terminated by the system.
|
||||
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
|
||||
self.contentHandler(self.bestAttemptContent);
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 280f79c00824a4499a2ef446aa7d00ca
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a605997850a6a4ee79efe04dbacff91b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
#if UNITY_IOS
|
||||
|
||||
namespace Guru.Editor
|
||||
{
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Callbacks;
|
||||
using Debug = UnityEngine.Debug;
|
||||
|
||||
/// <summary>
|
||||
/// 针对AmazonSDK iOS平台构建后
|
||||
/// BitCode报错的问题
|
||||
/// </summary>
|
||||
public class IOSPostProcessBuild_PodFix
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 添加内容
|
||||
/// </summary>
|
||||
private static readonly string MOD_SCRIPT = @"#Compile bugs fixed by HuYufei 2023-11-16
|
||||
post_install do |installer|
|
||||
installer.pods_project.targets.each do |target|
|
||||
target.build_configurations.each do |config|
|
||||
config.build_settings['ENABLE_BITCODE'] = 'NO'
|
||||
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
|
||||
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
|
||||
xcconfig_path = config.base_configuration_reference.real_path
|
||||
xcconfig = File.read(xcconfig_path)
|
||||
xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, ""TOOLCHAIN_DIR"")
|
||||
File.open(xcconfig_path, ""w"") { |file| file << xcconfig_mod }
|
||||
end
|
||||
end
|
||||
end";
|
||||
|
||||
/// <summary>
|
||||
/// 构建操作
|
||||
/// 构建顺序 45-50 可以保证执行时序在MAX 自身生成podfile之后, 注入需要的逻辑
|
||||
/// AmazonSDK使用了45, 工具设为46,确保后发执行
|
||||
/// </summary>
|
||||
/// <param name="target"></param>
|
||||
/// <param name="projPath"></param>
|
||||
[PostProcessBuild(46)]
|
||||
private static void OnPostProcessBuild(BuildTarget target, string projPath)
|
||||
{
|
||||
if (target != BuildTarget.iOS)
|
||||
return;
|
||||
|
||||
string podPath = Path.Combine(projPath, "Podfile");
|
||||
if (File.Exists(podPath))
|
||||
{
|
||||
bool needFix = false;
|
||||
string content = File.ReadAllText(podPath);
|
||||
if (!content.Contains("#BITCODE"))
|
||||
{
|
||||
content = content + "\n" + MOD_SCRIPT;
|
||||
File.WriteAllText(podPath, content);
|
||||
Debug.Log($"<color=#88ff00>=== Fix Pods BitCode bug ===</color>");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"=== POD not exists, exit pod hook...===");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7418e71e42e99424c9df47a84b05b37c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7c29eec7a52a4f8a9e8638eaa0985442
|
||||
timeCreated: 1715317220
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
#if UNITY_IOS
|
||||
|
||||
namespace Guru.Editor
|
||||
{
|
||||
using UnityEditor;
|
||||
using UnityEditor.Callbacks;
|
||||
using UnityEngine;
|
||||
using UnityEditor.iOS.Xcode;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
public class IOSPostProcessBuild_PrivacyInfo
|
||||
{
|
||||
private const string XCPrivacyInfo = "PrivacyInfo.xcprivacy";
|
||||
private const string DefaultWorkdir = "Guru/BuildTools/Editor/IOS_POST_PRIVACYINFO";
|
||||
private const string SourceFileName = "PrivacyInfo.plist";
|
||||
private static string IosPrivacyInfoPath => $"{Application.dataPath}/Plugins/iOS/{SourceFileName}";
|
||||
|
||||
[PostProcessBuild(200)]
|
||||
public static void OnPostProcessBuild(BuildTarget target, string buildPath)
|
||||
{
|
||||
if (target == BuildTarget.iOS)
|
||||
{
|
||||
AddPrivacyInfo(buildPath);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 向 XCode 添加隐私清单文件
|
||||
/// </summary>
|
||||
/// <param name="buildPath"></param>
|
||||
private static void AddPrivacyInfo(string buildPath)
|
||||
{
|
||||
if (CheckEvn())
|
||||
{
|
||||
var xcprojPath = PBXProject.GetPBXProjectPath(buildPath);
|
||||
var xcproj = new PBXProject();
|
||||
xcproj.ReadFromFile(xcprojPath);
|
||||
|
||||
var dest = $"{buildPath}/{XCPrivacyInfo}";
|
||||
FileUtil.ReplaceFile(IosPrivacyInfoPath, dest);
|
||||
|
||||
var mainTarget = xcproj.GetUnityMainTargetGuid();
|
||||
var guid = xcproj.AddFile(dest,$"{XCPrivacyInfo}", PBXSourceTree.Source);
|
||||
|
||||
xcproj.AddFileToBuild(mainTarget, guid);
|
||||
xcproj.WriteToFile(xcprojPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("Inject iOS PrivacyInfo failed!");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工作目录
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static string GetWorkdir()
|
||||
{
|
||||
var guids = AssetDatabase.FindAssets($"{nameof(IOSPostProcessBuild_PrivacyInfo)}");
|
||||
if (guids.Length > 0)
|
||||
{
|
||||
var path = AssetDatabase.GUIDToAssetPath(guids[0]);
|
||||
var dir = Directory.GetParent(path).FullName;
|
||||
if (Directory.Exists(dir)) return dir;
|
||||
}
|
||||
return DefaultWorkdir;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查环境
|
||||
/// </summary>
|
||||
private static bool CheckEvn()
|
||||
{
|
||||
if (File.Exists(IosPrivacyInfoPath)) return true;
|
||||
|
||||
var workdir = GetWorkdir();
|
||||
var source = $"{workdir}/{SourceFileName}";
|
||||
var toDir = Directory.GetParent(IosPrivacyInfoPath);
|
||||
if (!toDir.Exists) toDir.Create();
|
||||
if (File.Exists(source))
|
||||
{
|
||||
FileUtil.ReplaceFile(source, IosPrivacyInfoPath);
|
||||
return true;
|
||||
}
|
||||
|
||||
Debug.LogError($"--- PrivacyInfo.plist not found,Check file path:{source}");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3405624b18974efa8564223e50bf0c55
|
||||
timeCreated: 1713372443
|
||||
|
|
@ -0,0 +1,158 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPrivacyTracking</key>
|
||||
<true/>
|
||||
<key>NSPrivacyTrackingDomains</key>
|
||||
<array>
|
||||
<string>https://consent.adjust.com</string>
|
||||
<string>https://consent.adjust.net.in</string>
|
||||
<string>https://consent.adjust.world</string>
|
||||
<string>https://consent.adjust.cn</string>
|
||||
<string>https://consent.eu.adjust.com</string>
|
||||
<string>https://consent.tr.adjust.com</string>
|
||||
<string>https://consent.us.adjust.com</string>
|
||||
</array>
|
||||
<key>NSPrivacyAccessedAPITypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>NSPrivacyAccessedAPIType</key>
|
||||
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
|
||||
<key>NSPrivacyAccessedAPITypeReasons</key>
|
||||
<array>
|
||||
<string>CA92.1</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>NSPrivacyAccessedAPIType</key>
|
||||
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
|
||||
<key>NSPrivacyAccessedAPITypeReasons</key>
|
||||
<array>
|
||||
<string>C617.1</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>NSPrivacyCollectedDataTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>NSPrivacyCollectedDataType</key>
|
||||
<string>NSPrivacyCollectedDataTypeDeviceID</string>
|
||||
<key>NSPrivacyCollectedDataTypeLinked</key>
|
||||
<true/>
|
||||
<key>NSPrivacyCollectedDataTypeTracking</key>
|
||||
<false/>
|
||||
<key>NSPrivacyCollectedDataTypePurposes</key>
|
||||
<array>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>NSPrivacyCollectedDataType</key>
|
||||
<string>NSPrivacyCollectedDataTypeAdvertisingData</string>
|
||||
<key>NSPrivacyCollectedDataTypeLinked</key>
|
||||
<true/>
|
||||
<key>NSPrivacyCollectedDataTypeTracking</key>
|
||||
<true/>
|
||||
<key>NSPrivacyCollectedDataTypePurposes</key>
|
||||
<array>
|
||||
<string>NSPrivacyCollectedDataTypePurposeThirdPartyAdvertising</string>
|
||||
<string>NSPrivacyCollectedDataTypePurposeDeveloperAdvertising</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>NSPrivacyCollectedDataType</key>
|
||||
<string>NSPrivacyCollectedDataTypeProductInteraction</string>
|
||||
<key>NSPrivacyCollectedDataTypeLinked</key>
|
||||
<true/>
|
||||
<key>NSPrivacyCollectedDataTypeTracking</key>
|
||||
<false/>
|
||||
<key>NSPrivacyCollectedDataTypePurposes</key>
|
||||
<array>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
|
||||
<string>NSPrivacyCollectedDataTypePurposeProductPersonalization</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>NSPrivacyCollectedDataType</key>
|
||||
<string>NSPrivacyCollectedDataTypeOtherDataTypes</string>
|
||||
<key>NSPrivacyCollectedDataTypeLinked</key>
|
||||
<false/>
|
||||
<key>NSPrivacyCollectedDataTypeTracking</key>
|
||||
<false/>
|
||||
<key>NSPrivacyCollectedDataTypePurposes</key>
|
||||
<array>
|
||||
<string>NSPrivacyCollectedDataTypePurposeThirdPartyAdvertising</string>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>NSPrivacyCollectedDataType</key>
|
||||
<string>NSPrivacyCollectedDataTypeCrashData</string>
|
||||
<key>NSPrivacyCollectedDataTypeLinked</key>
|
||||
<false/>
|
||||
<key>NSPrivacyCollectedDataTypeTracking</key>
|
||||
<false/>
|
||||
<key>NSPrivacyCollectedDataTypePurposes</key>
|
||||
<array>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>NSPrivacyCollectedDataType</key>
|
||||
<string>NSPrivacyCollectedDataTypeOtherUsageData</string>
|
||||
<key>NSPrivacyCollectedDataTypeLinked</key>
|
||||
<false/>
|
||||
<key>NSPrivacyCollectedDataTypeTracking</key>
|
||||
<false/>
|
||||
<key>NSPrivacyCollectedDataTypePurposes</key>
|
||||
<array>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
|
||||
<string>NSPrivacyCollectedDataTypePurposeThirdPartyAdvertising</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>NSPrivacyCollectedDataType</key>
|
||||
<string>NSPrivacyCollectedDataTypeAdvertisingData</string>
|
||||
<key>NSPrivacyCollectedDataTypeLinked</key>
|
||||
<false/>
|
||||
<key>NSPrivacyCollectedDataTypeTracking</key>
|
||||
<false/>
|
||||
<key>NSPrivacyCollectedDataTypePurposes</key>
|
||||
<array>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
|
||||
<string>NSPrivacyCollectedDataTypePurposeThirdPartyAdvertising</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>NSPrivacyCollectedDataType</key>
|
||||
<string>NSPrivacyCollectedDataTypeDeviceID</string>
|
||||
<key>NSPrivacyCollectedDataTypeLinked</key>
|
||||
<true/>
|
||||
<key>NSPrivacyCollectedDataTypeTracking</key>
|
||||
<true/>
|
||||
<key>NSPrivacyCollectedDataTypePurposes</key>
|
||||
<array>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
|
||||
<string>NSPrivacyCollectedDataTypePurposeThirdPartyAdvertising</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>NSPrivacyCollectedDataType</key>
|
||||
<string>NSPrivacyCollectedDataTypeUserID</string>
|
||||
<key>NSPrivacyCollectedDataTypeLinked</key>
|
||||
<false/>
|
||||
<key>NSPrivacyCollectedDataTypeTracking</key>
|
||||
<false/>
|
||||
<key>NSPrivacyCollectedDataTypePurposes</key>
|
||||
<array>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
|
||||
<string>NSPrivacyCollectedDataTypePurposeThirdPartyAdvertising</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f04c7fe558ae4a1bbb278ed19c5be0f2
|
||||
timeCreated: 1715315327
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a78e5d32ead914b3f9f0a718da8594ea
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
#if UNITY_IOS
|
||||
using UnityEditor;
|
||||
using UnityEditor.iOS.Xcode;
|
||||
using UnityEditor.Callbacks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Guru
|
||||
{
|
||||
/// <summary>
|
||||
/// SWIFT语言支持
|
||||
/// </summary>
|
||||
public class IOSPostBuildSwift
|
||||
{
|
||||
[PostProcessBuild(2000)]
|
||||
public static void OnPostProcessBuild(BuildTarget target, string buildPath)
|
||||
{
|
||||
if (target != BuildTarget.iOS) return;
|
||||
|
||||
Debug.Log($"--- Add Swift support to project: {buildPath}");
|
||||
|
||||
// 更新Swift语言支持
|
||||
AddSwiftSupport(buildPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加Swift Support
|
||||
/// </summary>
|
||||
/// <param name="buildPath"></param>
|
||||
private static void AddSwiftSupport(string buildPath)
|
||||
{
|
||||
var projectPath = PBXProject.GetPBXProjectPath(buildPath);
|
||||
var project = new PBXProject();
|
||||
project.ReadFromFile(projectPath);
|
||||
var mainTargetGuid = project.GetUnityMainTargetGuid();
|
||||
var frameworkTargetGuid = project.GetUnityFrameworkTargetGuid();
|
||||
|
||||
// 关闭BitCode
|
||||
project.SetBuildProperty(mainTargetGuid, "ENABLE_BITCODE", "NO");
|
||||
project.SetBuildProperty(frameworkTargetGuid, "ENABLE_BITCODE", "NO");
|
||||
|
||||
// 添加搜索路径
|
||||
project.AddBuildProperty(frameworkTargetGuid, "LD_RUNPATH_SEARCH_PATHS", "/usr/lib/swift");
|
||||
|
||||
// 设置主项目的SWIFT构建支持
|
||||
project.SetBuildProperty(mainTargetGuid, "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES", "YES");
|
||||
project.SetBuildProperty(frameworkTargetGuid, "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES", "NO");
|
||||
|
||||
project.WriteToFile(projectPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 661b372db3634542856a44e37664649c
|
||||
timeCreated: 1673406971
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a0af2d1a3be34a4cb6101bd2a40b4c36
|
||||
timeCreated: 1705373808
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#if UNITY_ANDROID
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor.Android;
|
||||
using UnityEngine;
|
||||
using Debug=UnityEngine.Debug;
|
||||
|
||||
namespace Guru.Editor
|
||||
{
|
||||
public class AndroidGradleOutputDeps: IPostGenerateGradleAndroidProject
|
||||
{
|
||||
public int callbackOrder => 1;
|
||||
|
||||
/// <summary>
|
||||
/// 生成Android项目后执行逻辑
|
||||
/// </summary>
|
||||
/// <param name="buildPath"></param>
|
||||
public void OnPostGenerateGradleAndroidProject(string buildPath)
|
||||
{
|
||||
Debug.Log($"<color=#88ff00>---- Android Projct start build {buildPath}</color>");
|
||||
DepsOutputHelper.InstallAndRun(buildPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f8b64715449c4f23a7781dc15f5d38fe
|
||||
timeCreated: 1702349739
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
namespace Guru.Editor
|
||||
{
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
using Debug=UnityEngine.Debug;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class DepsOutputHelper
|
||||
{
|
||||
public static readonly string DepsScriptName = "deps.sh";
|
||||
public static readonly string EnvScriptName = ".deps_env";
|
||||
private static string _scriptFilePath = String.Empty;
|
||||
public static string ScriptFilePath
|
||||
{
|
||||
get
|
||||
{
|
||||
if(string.IsNullOrEmpty(_scriptFilePath))
|
||||
_scriptFilePath = GetScriptFilePath();
|
||||
return _scriptFilePath;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取脚本路径
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static string GetScriptFilePath()
|
||||
{
|
||||
string sc = string.Empty;
|
||||
var guids = AssetDatabase.FindAssets($"{nameof(DepsOutputHelper)} t:script");
|
||||
if (guids.Length > 0)
|
||||
{
|
||||
sc = AssetDatabase.GUIDToAssetPath(guids[0]);
|
||||
var fpath = $"{Directory.GetParent(sc).FullName}/files/{DepsScriptName}";
|
||||
if(File.Exists(fpath)) return fpath;
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行脚本
|
||||
/// </summary>
|
||||
/// <param name="projPath"></param>
|
||||
/// <param name="cmd"></param>
|
||||
public static void CallDepsScript(string workpath, string cmd = "")
|
||||
{
|
||||
if (string.IsNullOrEmpty(cmd)) cmd = DepsScriptName;
|
||||
RunShellCmd(workpath, cmd);
|
||||
Debug.Log($"---- running command: {cmd} is over -----");
|
||||
}
|
||||
|
||||
// 运行命令
|
||||
public static void RunShellCmd(string workpath, string cmd)
|
||||
{
|
||||
//------ 启动命令 --------
|
||||
Process p = new Process();
|
||||
p.StartInfo.WorkingDirectory = workpath;
|
||||
p.StartInfo.FileName = "/bin/bash";
|
||||
p.StartInfo.Arguments = cmd;
|
||||
p.StartInfo.UseShellExecute = false;
|
||||
p.StartInfo.RedirectStandardOutput = true;
|
||||
p.Start();
|
||||
var log = p.StandardOutput.ReadToEnd();
|
||||
p.WaitForExit();
|
||||
Debug.Log(log);
|
||||
}
|
||||
|
||||
// 设置ENV文件
|
||||
private static void SetupEnvScript(string projPath, string depauditPath = "")
|
||||
{
|
||||
string buildName = $"1.0.0-00000000";
|
||||
string platform = $"editor";
|
||||
string dir = projPath;
|
||||
|
||||
#if UNITY_ANDROID
|
||||
buildName = $"{Application.version}-{PlayerSettings.Android.bundleVersionCode}";
|
||||
platform = "android";
|
||||
#elif UNITY_IOS
|
||||
buildName = $"{Application.version}-{PlayerSettings.iOS.buildNumber}";
|
||||
platform = "ios";
|
||||
#endif
|
||||
List<string> lines = new List<string>()
|
||||
{
|
||||
$"export BUILD_NAME={buildName}",
|
||||
$"export APP_NAME=\"{PlayerSettings.productName}\"",
|
||||
$"export APP_ID={Application.identifier}",
|
||||
$"export PLATFORM={platform}",
|
||||
$"export DIR={dir}",
|
||||
};
|
||||
|
||||
if (!string.IsNullOrEmpty(depauditPath))
|
||||
{
|
||||
// 本地调试, 需要工具路径
|
||||
lines.Add($"export depaudit={depauditPath}");
|
||||
}
|
||||
|
||||
File.WriteAllLines($"{projPath}/{EnvScriptName}", lines.ToArray());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 安装和运行依赖输出器
|
||||
/// </summary>
|
||||
/// <param name="buildPath"></param>
|
||||
public static void InstallAndRun(string buildPath)
|
||||
{
|
||||
if (string.IsNullOrEmpty(ScriptFilePath) || !File.Exists(ScriptFilePath))
|
||||
{
|
||||
Debug.LogError($"--- deps script file not found, skip output deps...");
|
||||
return;
|
||||
}
|
||||
|
||||
string projPath = buildPath;
|
||||
#if UNITY_ANDROID
|
||||
projPath = Directory.GetParent(buildPath).FullName;
|
||||
#elif UNITY_IOS
|
||||
//TBD
|
||||
#endif
|
||||
//---- Setup Env ----
|
||||
SetupEnvScript(projPath);
|
||||
|
||||
//---- Setup Deps ----
|
||||
string to = $"{projPath}/{DepsScriptName}";
|
||||
if (File.Exists(to)) File.Delete(to);
|
||||
FileUtil.CopyFileOrDirectory(ScriptFilePath, to); //拷贝脚本
|
||||
|
||||
try
|
||||
{
|
||||
Debug.Log($"=== Output build deps data ===");
|
||||
CallDepsScript(projPath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError(ex);
|
||||
Debug.Log($"=== Output pods deps failed: {ex}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 831ffddddd78421b8597eac6367fd920
|
||||
timeCreated: 1702366162
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
#if UNITY_IOS
|
||||
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Callbacks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Guru.Editor
|
||||
{
|
||||
public class IOSXcodeOutputDeps
|
||||
{
|
||||
// <summary>
|
||||
/// 构建操作
|
||||
/// 构建顺序 45-50 可以保证执行时序在MAX 自身生成podfile之后, 注入需要的逻辑
|
||||
/// AmazonSDK使用了45, 工具设为 > 45, 确保后发执行
|
||||
/// </summary>
|
||||
/// <param name="target"></param>
|
||||
/// <param name="projPath"></param>
|
||||
[PostProcessBuild(1000)]
|
||||
private static void OnPostProcessBuild(BuildTarget target, string projPath)
|
||||
{
|
||||
string podlock = Path.Combine(projPath, "Podfile.lock");
|
||||
if (File.Exists(podlock))
|
||||
{
|
||||
DepsOutputHelper.InstallAndRun(projPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"=== POD install not success, exit deps hook...===");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b2e00c5d9f49480988f78c88fc9d2bac
|
||||
timeCreated: 1702365324
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d7b67912d7d245e0bf67086a8e2f395a
|
||||
timeCreated: 1702349190
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
#!/bin/bash
|
||||
|
||||
GRADLE_VERSION=6.7.1
|
||||
|
||||
export PATH="~/.gradle/${GRADLE_VERSION}:$PATH"
|
||||
export PATH="~/.gradle/${GRADLE_VERSION}/bin:$PATH"
|
||||
export GURU_BIN="~/dev/flutter/guru_app/tools/bin"
|
||||
export PATH="$GURU_BIN:$PATH"
|
||||
|
||||
source .deps_env
|
||||
|
||||
echo "--- BuildName: ${BUILD_NAME}"
|
||||
echo "--- AppName: ${APP_NAME}"
|
||||
echo "--- APP_ID: ${APP_ID}"
|
||||
echo "--- Platform: ${PLATFORM}"
|
||||
echo "--- DIR: ${DIR}"
|
||||
|
||||
|
||||
if [ "${PLATFORM}" = "android" ]; then
|
||||
gradle w
|
||||
fi
|
||||
|
||||
echo "----- collect deps start-----"
|
||||
|
||||
depaudit --platform "${PLATFORM}" --dir "${DIR}" --build_version "${BUILD_NAME}" --app_name "${APP_NAME}" --app_id "${APP_ID}" --engine unity
|
||||
|
||||
echo "----- collect deps over -----"
|
||||
|
||||
if [ "${PLATFORM}" = "android" ]; then
|
||||
|
||||
if [ -f ${DIR}/gradlew ]; then
|
||||
${DIR}/gradlew --stop
|
||||
echo "***************** deps collect success! *****************"
|
||||
else
|
||||
echo "***************** gradlew not found, deps collect failed! *****************"
|
||||
fi
|
||||
|
||||
else
|
||||
echo "***************** deps collect success! *****************"
|
||||
fi
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d43d22568540f49378be159486b4e1d3
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1429f4e79961470ba0597d4f3caceee8
|
||||
timeCreated: 1711525393
|
||||
12
README.md
12
README.md
|
|
@ -1,5 +1,17 @@
|
|||
# Guru SDK Core
|
||||
|
||||
**Version 2.2.1**
|
||||
|
||||
- 更新 Firebase -> Unity 11.7.0 | FirebaseSDK 10.20.0 (iOS 10.22.0)
|
||||
- 添加 GooglePlay DMA 合规逻辑 (2024 年 3 月 6 日之前升级即可)
|
||||
- 广告渠道 Inmobi 升级 双端版本: Android 10.6.3.0 , iOS 10.6.0.0
|
||||
- 广告渠道 Pubmatic iOS 平台版本指定为 3.2 修复打包报错的问题
|
||||
- 更新内核的 JsonParser 解析器为 JsonConvert
|
||||
- fix: 修复配置导出功能解析报错的问题
|
||||
- fix: 修复 ABTestManager 的解析错误.
|
||||
- fix: 修复 Tch 打点在不满足 0.01 的情况下补偿的逻辑
|
||||
- fix: 修复 GuruConsent 在 iOS 上返回 Purpose 乱码的解析问题, 添加了 TCF 映射规则.
|
||||
|
||||
|
||||
**Version 2.1.0**
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
|
||||
namespace Guru
|
||||
{
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Firebase.RemoteConfig;
|
||||
using Guru.LitJson;
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -12,7 +13,7 @@ namespace Guru
|
|||
/// </summary>
|
||||
public class ABTestManager : Singleton<ABTestManager>
|
||||
{
|
||||
public const string Version = "1.0.0";
|
||||
public const string Version = "1.0.2";
|
||||
private FirebaseRemoteConfig _remoteConfig;
|
||||
private List<ABParamData> _params;
|
||||
|
||||
|
|
@ -51,10 +52,13 @@ namespace Guru
|
|||
|
||||
_remoteConfig = FirebaseRemoteConfig.DefaultInstance;
|
||||
|
||||
Debug.Log($"[AB] --- remoteConfig Counts: {_remoteConfig.Keys.Count()}");
|
||||
|
||||
string strValue;
|
||||
foreach (var key in _remoteConfig.Keys)
|
||||
{
|
||||
strValue = _remoteConfig.GetValue(key).StringValue;
|
||||
Debug.Log($"[AB] --- raw config: [{key}] : {strValue}");
|
||||
AddParam(strValue);
|
||||
}
|
||||
|
||||
|
|
@ -135,7 +139,8 @@ namespace Guru
|
|||
try
|
||||
{
|
||||
// 发现Guru AB测试标志位
|
||||
var dict = JsonMapper.ToObject<Dictionary<string, JsonData>>(value);
|
||||
// var dict = JsonMapper.ToObject<Dictionary<string, JsonData>>(value);
|
||||
var dict = JsonConvert.DeserializeObject<Dictionary<string, object>>(value);
|
||||
if (null != dict)
|
||||
{
|
||||
foreach (var k in dict.Keys)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
"MaxSdk",
|
||||
"MaxSdk.Scripts",
|
||||
"Amazon",
|
||||
"Amazon.Scripts",
|
||||
"OpenWrapSDK",
|
||||
"UniWebView-CSharp",
|
||||
"UnityEngine.Purchasing",
|
||||
|
|
@ -17,7 +18,9 @@
|
|||
"Google.Play.Review",
|
||||
"Google.Play.Common",
|
||||
"Guru.LitJson",
|
||||
"Unity.Advertisement.IosSupport"
|
||||
"Unity.Advertisement.IosSupport",
|
||||
"Unity.Notifications.Android",
|
||||
"Unity.Notifications.iOS"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2b993d660d0a48b1a098f5d42611b464
|
||||
timeCreated: 1717034031
|
||||
|
|
@ -1,21 +1,24 @@
|
|||
using System.Collections;
|
||||
using System.Threading;
|
||||
|
||||
|
||||
|
||||
namespace Guru
|
||||
{
|
||||
using UnityEngine;
|
||||
using com.adjust.sdk;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
|
||||
public static class AdjustService
|
||||
public class AdjustService
|
||||
{
|
||||
public const string Version = "1.6.0";
|
||||
public const string Version = "1.6.1";
|
||||
public const string AdjustVersion = "4.38.0"; // Adjust SDK Version
|
||||
public static readonly string LOG_TAG = "Adjust";
|
||||
public static readonly float DelayTime = 1f; // 延迟启动时间
|
||||
|
||||
public const string K_IAP_PURCHASE = "iap_purchase"; // 固定点位事件
|
||||
public const string K_SUB_PURCHASE = "sub_purchase"; // 固定点位事件
|
||||
|
||||
private static Action<string> _onSessionSuccessCallback;
|
||||
|
||||
|
||||
private static string _adId = "";
|
||||
|
|
@ -28,6 +31,8 @@ namespace Guru
|
|||
}
|
||||
}
|
||||
|
||||
public static string IDFA => Adjust.getIdfa();
|
||||
|
||||
private static string _adjustId = "";
|
||||
public static string AdjustId
|
||||
{
|
||||
|
|
@ -37,7 +42,7 @@ namespace Guru
|
|||
return _adjustId; // Adjust AdId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region 启动服务
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -45,20 +50,25 @@ namespace Guru
|
|||
/// </summary>
|
||||
/// <param name="appToken"></param>
|
||||
/// <param name="fbAppId">MIR 追踪 AppID</param>
|
||||
public static void StartService(string appToken, string fbAppId = "")
|
||||
public static void StartService(string appToken, string fbAppId = "", Action<string> onSessionSuccess = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(appToken))
|
||||
{
|
||||
Log.E(LOG_TAG, "Adjust没有设置token,无法进行初始化");
|
||||
LogE(LOG_TAG, "Adjust没有设置token,无法进行初始化");
|
||||
return;
|
||||
}
|
||||
|
||||
_onSessionSuccessCallback = onSessionSuccess;
|
||||
|
||||
InstallEvent(IPMConfig.FIREBASE_ID, IPMConfig.IPM_DEVICE_ID); // 注入启动参数
|
||||
|
||||
AdjustEnvironment environment = GetAdjustEnvironment();
|
||||
AdjustConfig config = new AdjustConfig(appToken, environment);
|
||||
config.setLogLevel(GetAdjustLogLevel());
|
||||
config.setDelayStart(DelayTime);
|
||||
|
||||
config.setPreinstallTrackingEnabled(true); // Adjust Preinstall
|
||||
config.setSessionSuccessDelegate(OnSessionSuccessCallback); // SessionSuccess
|
||||
|
||||
#if UNITY_ANDROID
|
||||
if (!string.IsNullOrEmpty(fbAppId)) config.setFbAppId(fbAppId); // 注入 MIR ID
|
||||
|
|
@ -66,10 +76,10 @@ namespace Guru
|
|||
|
||||
|
||||
#if UNITY_EDITOR || DEBUG
|
||||
config.setLogDelegate(log => Log.I(LOG_TAG, log));
|
||||
config.setLogDelegate(log => LogI(LOG_TAG, log));
|
||||
config.setEventSuccessDelegate(OnEventSuccessCallback);
|
||||
config.setEventFailureDelegate(OnEventFailureCallback);
|
||||
config.setSessionSuccessDelegate(OnSessionSuccessCallback);
|
||||
|
||||
config.setSessionFailureDelegate(OnSessionFailureCallback);
|
||||
config.setAttributionChangedDelegate(OnAttributionChangedCallback);
|
||||
#endif
|
||||
|
|
@ -81,7 +91,9 @@ namespace Guru
|
|||
_adjustId = Adjust.getAdid(); // 获取AdjustID
|
||||
|
||||
// 异步加载AdId
|
||||
FetchGoogleAdId();
|
||||
FetchGoogleAdId();
|
||||
|
||||
LogI(LOG_TAG, $"----- Start AdjustService[{Version}] AdjustVer:{AdjustVersion} -----");
|
||||
}
|
||||
|
||||
public static void FetchGoogleAdId()
|
||||
|
|
@ -111,6 +123,9 @@ namespace Guru
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 关键属性上报
|
||||
|
|
@ -148,171 +163,154 @@ namespace Guru
|
|||
|
||||
private static void OnAttributionChangedCallback(AdjustAttribution attributionData)
|
||||
{
|
||||
Log.I(LOG_TAG, "Attribution changed!");
|
||||
LogI(LOG_TAG, "Attribution changed!");
|
||||
|
||||
if (attributionData.trackerName != null)
|
||||
{
|
||||
Log.I(LOG_TAG, "Tracker name: " + attributionData.trackerName);
|
||||
LogI(LOG_TAG, "Tracker name: " + attributionData.trackerName);
|
||||
}
|
||||
|
||||
if (attributionData.trackerToken != null)
|
||||
{
|
||||
Log.I(LOG_TAG, "Tracker token: " + attributionData.trackerToken);
|
||||
LogI(LOG_TAG, "Tracker token: " + attributionData.trackerToken);
|
||||
}
|
||||
|
||||
if (attributionData.network != null)
|
||||
{
|
||||
Log.I(LOG_TAG, "Network: " + attributionData.network);
|
||||
LogI(LOG_TAG, "Network: " + attributionData.network);
|
||||
}
|
||||
|
||||
if (attributionData.campaign != null)
|
||||
{
|
||||
Log.I(LOG_TAG, "Campaign: " + attributionData.campaign);
|
||||
LogI(LOG_TAG, "Campaign: " + attributionData.campaign);
|
||||
}
|
||||
|
||||
if (attributionData.adgroup != null)
|
||||
{
|
||||
Log.I(LOG_TAG, "Adgroup: " + attributionData.adgroup);
|
||||
LogI(LOG_TAG, "Adgroup: " + attributionData.adgroup);
|
||||
}
|
||||
|
||||
if (attributionData.creative != null)
|
||||
{
|
||||
Log.I(LOG_TAG, "Creative: " + attributionData.creative);
|
||||
LogI(LOG_TAG, "Creative: " + attributionData.creative);
|
||||
}
|
||||
|
||||
if (attributionData.clickLabel != null)
|
||||
{
|
||||
Log.I(LOG_TAG , "Click label: " + attributionData.clickLabel);
|
||||
LogI(LOG_TAG , "Click label: " + attributionData.clickLabel);
|
||||
}
|
||||
|
||||
if (attributionData.adid != null)
|
||||
{
|
||||
Log.I(LOG_TAG, "ADID: " + attributionData.adid);
|
||||
LogI(LOG_TAG, "ADID: " + attributionData.adid);
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnEventSuccessCallback(AdjustEventSuccess eventSuccessData)
|
||||
{
|
||||
Log.I(LOG_TAG, "Event tracked successfully!");
|
||||
LogI(LOG_TAG, "Event tracked successfully!");
|
||||
|
||||
if (eventSuccessData.Message != null)
|
||||
{
|
||||
Log.I(LOG_TAG, "Message: " + eventSuccessData.Message);
|
||||
LogI(LOG_TAG, "Message: " + eventSuccessData.Message);
|
||||
}
|
||||
|
||||
if (eventSuccessData.Timestamp != null)
|
||||
{
|
||||
Log.I(LOG_TAG, "Timestamp: " + eventSuccessData.Timestamp);
|
||||
LogI(LOG_TAG, "Timestamp: " + eventSuccessData.Timestamp);
|
||||
}
|
||||
|
||||
if (eventSuccessData.Adid != null)
|
||||
{
|
||||
Log.I(LOG_TAG, "Adid: " + eventSuccessData.Adid);
|
||||
LogI(LOG_TAG, "Adid: " + eventSuccessData.Adid);
|
||||
}
|
||||
|
||||
if (eventSuccessData.EventToken != null)
|
||||
{
|
||||
Log.I(LOG_TAG, "EventToken: " + eventSuccessData.EventToken);
|
||||
LogI(LOG_TAG, "EventToken: " + eventSuccessData.EventToken);
|
||||
}
|
||||
|
||||
if (eventSuccessData.CallbackId != null)
|
||||
{
|
||||
Log.I(LOG_TAG, "CallbackId: " + eventSuccessData.CallbackId);
|
||||
LogI(LOG_TAG, "CallbackId: " + eventSuccessData.CallbackId);
|
||||
}
|
||||
|
||||
if (eventSuccessData.JsonResponse != null)
|
||||
{
|
||||
Log.I(LOG_TAG, "JsonResponse: " + eventSuccessData.GetJsonResponse());
|
||||
LogI(LOG_TAG, "JsonResponse: " + eventSuccessData.GetJsonResponse());
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnEventFailureCallback(AdjustEventFailure eventFailureData)
|
||||
{
|
||||
Log.I(LOG_TAG, "Event tracking failed!");
|
||||
LogI(LOG_TAG, "Event tracking failed!");
|
||||
|
||||
if (eventFailureData.Message != null)
|
||||
{
|
||||
Log.I(LOG_TAG, "Message: " + eventFailureData.Message);
|
||||
LogI(LOG_TAG, "Message: " + eventFailureData.Message);
|
||||
}
|
||||
|
||||
if (eventFailureData.Timestamp != null)
|
||||
{
|
||||
Log.I(LOG_TAG, "Timestamp: " + eventFailureData.Timestamp);
|
||||
LogI(LOG_TAG, "Timestamp: " + eventFailureData.Timestamp);
|
||||
}
|
||||
|
||||
if (eventFailureData.Adid != null)
|
||||
{
|
||||
Log.I(LOG_TAG, "Adid: " + eventFailureData.Adid);
|
||||
LogI(LOG_TAG, "Adid: " + eventFailureData.Adid);
|
||||
}
|
||||
|
||||
if (eventFailureData.EventToken != null)
|
||||
{
|
||||
Log.I(LOG_TAG, "EventToken: " + eventFailureData.EventToken);
|
||||
LogI(LOG_TAG, "EventToken: " + eventFailureData.EventToken);
|
||||
}
|
||||
|
||||
if (eventFailureData.CallbackId != null)
|
||||
{
|
||||
Log.I(LOG_TAG, "CallbackId: " + eventFailureData.CallbackId);
|
||||
LogI(LOG_TAG, "CallbackId: " + eventFailureData.CallbackId);
|
||||
}
|
||||
|
||||
if (eventFailureData.JsonResponse != null)
|
||||
{
|
||||
Log.I(LOG_TAG, "JsonResponse: " + eventFailureData.GetJsonResponse());
|
||||
LogI(LOG_TAG, "JsonResponse: " + eventFailureData.GetJsonResponse());
|
||||
}
|
||||
|
||||
Log.I(LOG_TAG, "WillRetry: " + eventFailureData.WillRetry.ToString());
|
||||
LogI(LOG_TAG, "WillRetry: " + eventFailureData.WillRetry.ToString());
|
||||
}
|
||||
|
||||
private static void OnSessionSuccessCallback(AdjustSessionSuccess sessionSuccessData)
|
||||
{
|
||||
Log.I(LOG_TAG,"Session tracked successfully!");
|
||||
LogI(LOG_TAG,$"{LOG_TAG} --- Session tracked successfully!");
|
||||
|
||||
if (sessionSuccessData.Message != null)
|
||||
{
|
||||
Log.I(LOG_TAG,"Message: " + sessionSuccessData.Message);
|
||||
}
|
||||
|
||||
if (sessionSuccessData.Timestamp != null)
|
||||
{
|
||||
Log.I(LOG_TAG,"Timestamp: " + sessionSuccessData.Timestamp);
|
||||
}
|
||||
|
||||
if (sessionSuccessData.Adid != null)
|
||||
{
|
||||
Log.I(LOG_TAG, "Adid: " + sessionSuccessData.Adid);
|
||||
}
|
||||
|
||||
if (sessionSuccessData.JsonResponse != null)
|
||||
{
|
||||
Log.I(LOG_TAG, "JsonResponse: " + sessionSuccessData.GetJsonResponse());
|
||||
}
|
||||
var adid = sessionSuccessData.Adid;
|
||||
_onSessionSuccessCallback?.Invoke(adid);
|
||||
}
|
||||
|
||||
private static void OnSessionFailureCallback(AdjustSessionFailure sessionFailureData)
|
||||
{
|
||||
Log.I(LOG_TAG,"Session tracking failed!");
|
||||
LogI(LOG_TAG,"Session tracking failed!");
|
||||
|
||||
if (sessionFailureData.Message != null)
|
||||
{
|
||||
Log.I(LOG_TAG,"Message: " + sessionFailureData.Message);
|
||||
LogI(LOG_TAG,"Message: " + sessionFailureData.Message);
|
||||
}
|
||||
|
||||
if (sessionFailureData.Timestamp != null)
|
||||
{
|
||||
Log.I(LOG_TAG,"Timestamp: " + sessionFailureData.Timestamp);
|
||||
LogI(LOG_TAG,"Timestamp: " + sessionFailureData.Timestamp);
|
||||
}
|
||||
|
||||
if (sessionFailureData.Adid != null)
|
||||
{
|
||||
Log.I(LOG_TAG,"Adid: " + sessionFailureData.Adid);
|
||||
LogI(LOG_TAG,"Adid: " + sessionFailureData.Adid);
|
||||
}
|
||||
|
||||
if (sessionFailureData.JsonResponse != null)
|
||||
{
|
||||
Log.I(LOG_TAG,"JsonResponse: " + sessionFailureData.GetJsonResponse());
|
||||
LogI(LOG_TAG,"JsonResponse: " + sessionFailureData.GetJsonResponse());
|
||||
}
|
||||
|
||||
Log.I(LOG_TAG,"WillRetry: " + sessionFailureData.WillRetry.ToString());
|
||||
LogI(LOG_TAG,"WillRetry: " + sessionFailureData.WillRetry.ToString());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -427,8 +425,17 @@ namespace Guru
|
|||
return AdjustLogLevel.Suppress;
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void LogI(string tag, object conent)
|
||||
{
|
||||
Debug.Log($"{tag} {conent}");
|
||||
}
|
||||
|
||||
public static void LogE(string tag, object conent)
|
||||
{
|
||||
Debug.LogError($"{tag} {conent}");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 43aa7a523e0141d4a7f64e16e5294d2d
|
||||
timeCreated: 1717034046
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"name": "GuruAdjust.Editor",
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 82f90ccbb33b42e9ad29f5f5a861dc4a
|
||||
timeCreated: 1717137351
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 522c3aca8edd4e5bb3c57f54460df356
|
||||
timeCreated: 1717137307
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Guru
|
||||
{
|
||||
public class AdjustSignatureHelper
|
||||
{
|
||||
|
||||
private static readonly string AndroidLib = "adjust-android-signature-3.13.1.aar";
|
||||
private static readonly string iOSLib = "AdjustSigSdk.a";
|
||||
|
||||
public static void DeployFiles()
|
||||
{
|
||||
var dir = GetParentDir();
|
||||
var files = $"{dir}/Files";
|
||||
if (Directory.Exists(files))
|
||||
{
|
||||
string from, to;
|
||||
bool res;
|
||||
from = $"{files}/{AndroidLib}.f";
|
||||
to = $"{Application.dataPath}/Plugins/Android/{AndroidLib}";
|
||||
res = CopyFile(from, to);
|
||||
if (res) Debug.Log($"Copy <color=#88ff00>{AndroidLib} to {to}</color> success...");
|
||||
from = $"{files}/{AndroidLib}.f.meta";
|
||||
to = $"{Application.dataPath}/Plugins/Android/{AndroidLib}.meta";
|
||||
CopyFile(from, to);
|
||||
|
||||
from = $"{files}/{iOSLib}.f";
|
||||
to = $"{Application.dataPath}/Plugins/iOS/{iOSLib}";
|
||||
res = CopyFile(from, to);
|
||||
if (res) Debug.Log($"Copy <color=#88ff00>{iOSLib} to {to}</color> success...");
|
||||
from = $"{files}/{iOSLib}.f.meta";
|
||||
to = $"{Application.dataPath}/Plugins/iOS/{iOSLib}.meta";
|
||||
CopyFile(from, to);
|
||||
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"<color=red>Files not found: {files}</color>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static string GetParentDir()
|
||||
{
|
||||
var guids = AssetDatabase.FindAssets(nameof(AdjustSignatureHelper));
|
||||
if (guids != null && guids.Length > 0)
|
||||
{
|
||||
var path = AssetDatabase.GUIDToAssetPath(guids[0]);
|
||||
var dir = Directory.GetParent(Path.GetFullPath(path));
|
||||
return dir.FullName;
|
||||
}
|
||||
return Path.GetFullPath($"{Application.dataPath}/../Packages/com.guru.unity.sdk.core/Runtime/GuruAdjust/Editor/Signature");
|
||||
}
|
||||
|
||||
private static bool CopyFile(string source, string dest)
|
||||
{
|
||||
if (File.Exists(source))
|
||||
{
|
||||
if (!File.Exists(dest))
|
||||
{
|
||||
File.Delete(dest);
|
||||
}
|
||||
else
|
||||
{
|
||||
var destDir = Directory.GetParent(dest);
|
||||
if(!destDir.Exists) destDir.Create();
|
||||
}
|
||||
|
||||
File.Copy(source, dest, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
Debug.Log($"<colo=red>File not found: {source}...</color>");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fcbb67d0a48d4b88bc8fd1430c4bbda4
|
||||
timeCreated: 1717137470
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
namespace Guru
|
||||
{
|
||||
using UnityEditor;
|
||||
|
||||
public class AdjustSignatureMenuItem
|
||||
{
|
||||
[MenuItem("Guru/Adjust/SignatureV3/Deploy Libs")]
|
||||
private static void CopyLibsToPlugins()
|
||||
{
|
||||
AdjustSignatureHelper.DeployFiles();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5f624e98bef44a399cf808a6aa7f5499
|
||||
timeCreated: 1717137523
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f0f3f1cbb077474882bf4725c274efa9
|
||||
timeCreated: 1717034059
|
||||
Binary file not shown.
|
|
@ -0,0 +1,80 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7dfc92df774d347749c60047aaa3da41
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 0
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: ARMv7
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
CPU: AnyCPU
|
||||
CompileFlags:
|
||||
FrameworkDependencies:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c5a9f9e11213b4bb78856debe4c967ca
|
||||
guid: 07dda3e28d25446c3bb0924d7fc21cb4
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
|
@ -70,7 +70,7 @@ namespace Guru
|
|||
{
|
||||
string version = UnityEngine.iOS.Device.systemVersion;
|
||||
|
||||
Debug.Log($"[ATT] --- Get iOS system version: {version}");
|
||||
// Debug.Log($"[ATT] --- Get iOS system version: {version}");
|
||||
|
||||
string tmp = version;
|
||||
if (version.Contains(" "))
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
-keep class com.amazon.device.ads.** { *; }
|
||||
-keep class com.amazon.device.ads.** { *; }
|
||||
-keep class com.amazon.aps.** { *; }
|
||||
|
|
@ -79,7 +79,7 @@ namespace Guru
|
|||
/// <summary>
|
||||
/// 初始化平台
|
||||
/// </summary>
|
||||
public void Initialize()
|
||||
public void Initialize(bool isDebug = false)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
Debug.Log($"<color=orange>=== Amazon will not init on Editor ===</color>");
|
||||
|
|
@ -93,11 +93,9 @@ namespace Guru
|
|||
// 初始化Amazon
|
||||
Amazon.Initialize (AmazonAppID);
|
||||
Amazon.SetAdNetworkInfo(new AdNetworkInfo(DTBAdNetwork.MAX));
|
||||
#if UNITY_EDITOR || DEBUG
|
||||
Amazon.EnableTesting (true); // Make sure to take this off when going live.
|
||||
#else
|
||||
Amazon.EnableLogging (false);
|
||||
#endif
|
||||
Debug.Log($"[Ads] --- Amazon init start isDebug:{isDebug}, AmazonID:{AmazonAppID}");
|
||||
Amazon.EnableTesting (isDebug); // Make sure to take this off when going live.
|
||||
Amazon.EnableLogging (isDebug);
|
||||
|
||||
#if UNITY_IOS
|
||||
Amazon.SetAPSPublisherExtendedIdFeatureEnabled(true);
|
||||
|
|
|
|||
|
|
@ -50,16 +50,22 @@ namespace Guru
|
|||
* before it can request an ad using OpenWrap SDK.
|
||||
* The storeURL is the URL where users can download your app from the App Store/Google Play Store.
|
||||
*/
|
||||
public void Initialize()
|
||||
public void Initialize(bool isDebug = false)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
Debug.Log($"<color=orange>=== PubMatic will not init on Editor ===</color>");
|
||||
Debug.Log($"<color=orange>=== PubMatic will not init on Editor ===</color>");
|
||||
#endif
|
||||
if (!IsEnabled)
|
||||
{
|
||||
Debug.Log($"[Ads] --- PubMatic is not enabled");
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(PMStoreUrl))
|
||||
{
|
||||
Debug.Log($"[Ads] --- PubMatic with empty store url. skip initialize...");
|
||||
return;
|
||||
}
|
||||
|
||||
var appInfo = new POBApplicationInfo();
|
||||
appInfo.StoreURL = new Uri(PMStoreUrl);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2b371a8d213e4b7db1d5d5348581eec3
|
||||
timeCreated: 1709268083
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0b106e716338488090bac0280df955cd
|
||||
timeCreated: 1709268091
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
namespace Guru
|
||||
{
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Tradplus 广告配置
|
||||
/// </summary>
|
||||
public partial class GuruSettings
|
||||
{
|
||||
[Header("Tradplus 广告配置")]
|
||||
public AdChannelSettings TradplusSetting;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 284881a6a8164dbda8a288a73a5c4933
|
||||
timeCreated: 1709268103
|
||||
|
|
@ -20,16 +20,11 @@ Sample Dependencies.xml:
|
|||
<androidPackage spec="com.squareup.retrofit2:converter-gson:2.7.1" />
|
||||
<androidPackage spec="com.squareup.retrofit2:adapter-rxjava2:2.7.1" />
|
||||
<androidPackage spec="com.squareup.okhttp3:okhttp:4.9.3" />
|
||||
|
||||
<!-- <androidPackage spec="com.mapzen:on-the-road:0.8.1" />-->
|
||||
<!-- <androidPackage spec="com.squareup.retrofit2:retrofit:2.7.1" />-->
|
||||
</androidPackages>
|
||||
<iosPods>
|
||||
<iosPod name="GuruAnalyticsLib" version="0.3.2" bitcodeEnabled="false">
|
||||
<sources>
|
||||
<source>git@github.com:castbox/GuruSpecs.git</source>
|
||||
</sources>
|
||||
</iosPod>
|
||||
<iosPod name="GuruAnalyticsLib" bitcodeEnabled="false" path="Packages/com.guru.unity.sdk.core/Runtime/GuruAnalytics/Plugins/iOS" />
|
||||
<iosPod name="JJException" bitcodeEnabled="false" />
|
||||
</iosPods>
|
||||
</dependencies>
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7b835e3950e934b5eaa8d02c24aa5a18
|
||||
guid: 32eda01e213614348899eefe856392d3
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
Binary file not shown.
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a336b814594434b4092d38e5ce76577a
|
||||
guid: 66c5f430ab9654ef4a2376e71aa04bca
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
Binary file not shown.
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e53e2bfca0fd949559d383674081f737
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 502f707bde2a24fadb6ec09ac5a3593f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPrivacyAccessedAPITypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>NSPrivacyAccessedAPITypeReasons</key>
|
||||
<array>
|
||||
<string>CA92.1</string>
|
||||
</array>
|
||||
<key>NSPrivacyAccessedAPIType</key>
|
||||
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>NSPrivacyAccessedAPITypeReasons</key>
|
||||
<array>
|
||||
<string>C617.1</string>
|
||||
</array>
|
||||
<key>NSPrivacyAccessedAPIType</key>
|
||||
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>NSPrivacyAccessedAPITypeReasons</key>
|
||||
<array>
|
||||
<string>35F9.1</string>
|
||||
<string>8FFB.1</string>
|
||||
<string>3D61.1</string>
|
||||
</array>
|
||||
<key>NSPrivacyAccessedAPIType</key>
|
||||
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>NSPrivacyTracking</key>
|
||||
<false/>
|
||||
<key>NSPrivacyTrackingDomains</key>
|
||||
<array>
|
||||
<string></string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 63885139be48c43ae8cd3b1c403a686f
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 1
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: ARMv7
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
CPU: AnyCPU
|
||||
CompileFlags:
|
||||
FrameworkDependencies:
|
||||
- first:
|
||||
tvOS: tvOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d30316515c87a4421bc7032194f888e1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e0086576c1ac64707b788bef25dc9316
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,158 @@
|
|||
//
|
||||
// GuruAnalytics.swift
|
||||
// GuruAnalytics_iOS
|
||||
//
|
||||
// Created by mayue on 2022/11/4.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public class GuruAnalytics: NSObject {
|
||||
|
||||
internal static var uploadPeriodInSecond: Double = 60
|
||||
internal static var batchLimit: Int = 25
|
||||
internal static var eventExpiredSeconds: Double = 7 * 24 * 60 * 60
|
||||
internal static var initializeTimeout: Double = 5
|
||||
internal static var saasXAPPID = ""
|
||||
internal static var saasXDEVICEINFO = ""
|
||||
internal static var loggerDebug = true
|
||||
internal static var enableUpload = true
|
||||
|
||||
/// 初始化设置
|
||||
/// - Parameters:
|
||||
/// - uploadPeriodInSecond: 批量上传周期,单位秒
|
||||
/// - batchLimit: 批量条数
|
||||
/// - eventExpiredSeconds: 数据过期时间,单位秒
|
||||
/// - initializeTimeout: 初始化后等待user id/device id/firebase pseudo id等属性超时时间,单位秒
|
||||
/// - saasXAPPID: 中台接口header中的X-APP-ID
|
||||
/// - saasXDEVICEINFO: 中台接口header中的X-DEVICE-INFO
|
||||
/// - loggerDebug: 开启控制台输出debug信息
|
||||
@objc
|
||||
public class func initializeLib(uploadPeriodInSecond: Double = 60,
|
||||
batchLimit: Int = 25,
|
||||
eventExpiredSeconds: Double = 7 * 24 * 60 * 60,
|
||||
initializeTimeout: Double = 5,
|
||||
saasXAPPID: String,
|
||||
saasXDEVICEINFO: String,
|
||||
loggerDebug: Bool = true) {
|
||||
Self.uploadPeriodInSecond = uploadPeriodInSecond
|
||||
Self.batchLimit = batchLimit
|
||||
Self.eventExpiredSeconds = eventExpiredSeconds
|
||||
Self.initializeTimeout = initializeTimeout
|
||||
Self.saasXAPPID = saasXAPPID
|
||||
Self.saasXDEVICEINFO = saasXDEVICEINFO
|
||||
Self.loggerDebug = loggerDebug
|
||||
_ = Manager.shared
|
||||
}
|
||||
|
||||
/// 记录event
|
||||
@objc
|
||||
public class func logEvent(_ name: String, parameters: [String : Any]?) {
|
||||
Manager.shared.logEvent(name, parameters: parameters)
|
||||
}
|
||||
|
||||
/// 中台ID。只在未获取到uid时可以为空
|
||||
@objc
|
||||
public class func setUserID(_ userID: String?) {
|
||||
setUserProperty(userID, forName: .uid)
|
||||
}
|
||||
|
||||
/// 设备ID(用户的设备ID,iOS取用户的IDFV或UUID,Android取androidID)
|
||||
@objc
|
||||
public class func setDeviceId(_ deviceId: String?) {
|
||||
setUserProperty(deviceId, forName: .deviceId)
|
||||
}
|
||||
|
||||
/// adjust_id。只在未获取到adjust时可以为空
|
||||
@objc
|
||||
public class func setAdjustId(_ adjustId: String?) {
|
||||
setUserProperty(adjustId, forName: .adjustId)
|
||||
}
|
||||
|
||||
/// 广告 ID/广告标识符 (IDFA)
|
||||
@objc
|
||||
public class func setAdId(_ adId: String?) {
|
||||
setUserProperty(adId, forName: .adId)
|
||||
}
|
||||
|
||||
/// 用户的pseudo_id
|
||||
@objc
|
||||
public class func setFirebaseId(_ firebaseId: String?) {
|
||||
setUserProperty(firebaseId, forName: .firebaseId)
|
||||
}
|
||||
|
||||
/// screen name
|
||||
@objc
|
||||
public class func setScreen(_ name: String) {
|
||||
Manager.shared.setScreen(name)
|
||||
}
|
||||
|
||||
/// 设置userproperty
|
||||
@objc
|
||||
public class func setUserProperty(_ value: String?, forName name: String) {
|
||||
Manager.shared.setUserProperty(value ?? "", forName: name)
|
||||
}
|
||||
|
||||
/// 移除userproperty
|
||||
@objc
|
||||
public class func removeUserProperties(forNames names: [String]) {
|
||||
Manager.shared.removeUserProperties(forNames: names)
|
||||
}
|
||||
|
||||
/// 获取events相关日志文件zip包
|
||||
/// zip解压密码:Castbox123
|
||||
@available(*, deprecated, renamed: "eventsLogsDirectory", message: "废弃,使用eventsLogsDirectory方法获取日志文件目录URL")
|
||||
@objc
|
||||
public class func eventsLogsArchive(_ callback: @escaping (_ url: URL?) -> Void) {
|
||||
Manager.shared.eventsLogsArchive(callback)
|
||||
}
|
||||
|
||||
/// 获取events相关日志文件目录
|
||||
@objc
|
||||
public class func eventsLogsDirectory(_ callback: @escaping (_ url: URL?) -> Void) {
|
||||
Manager.shared.eventsLogsDirURL(callback)
|
||||
}
|
||||
|
||||
/// 更新events上报服务器域名
|
||||
/// host: 服务器域名,例如:“abc.bbb.com”, "https://abc.bbb.com", "http://abc.bbb.com"
|
||||
@objc
|
||||
public class func setEventsUploadEndPoint(host: String?) {
|
||||
UserDefaults.eventsServerHost = host
|
||||
}
|
||||
|
||||
/// 获取events统计数据
|
||||
/// - Parameter callback: 数据回调
|
||||
/// - callback parameters:
|
||||
/// - uploadedEventsCount: 上传后端成功event条数
|
||||
/// - loggedEventsCount: 已记录event总条数
|
||||
@objc
|
||||
@available(*, deprecated, message: "used for debug, will be removed on any future released versions")
|
||||
public class func debug_eventsStatistics(_ callback: @escaping (_ uploadedEventsCount: Int, _ loggedEventsCount: Int) -> Void) {
|
||||
Manager.shared.debug_eventsStatistics(callback)
|
||||
}
|
||||
|
||||
/// 将内部事件信息上报给应用层
|
||||
/// - Parameter reportCallback: 数据回调
|
||||
/// - callback parameters:
|
||||
/// - eventCode: 事件代码
|
||||
/// - info: 事件相关信息
|
||||
@objc
|
||||
public class func registerInternalEventObserver(reportCallback: @escaping (_ eventCode: Int, _ info: String) -> Void) {
|
||||
Manager.shared.registerInternalEventObserver(reportCallback: reportCallback)
|
||||
}
|
||||
|
||||
/// 获取当前user property
|
||||
@objc
|
||||
public class func getUserProperties() -> [String : String] {
|
||||
return Manager.shared.getUserProperties()
|
||||
}
|
||||
|
||||
/// 设置上传开关,默认为true
|
||||
/// true - 开启上传
|
||||
/// false - 关闭上传
|
||||
@objc
|
||||
public class func setEnableUpload(isOn: Bool = true) -> Void {
|
||||
enableUpload = isOn
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 669b744f21d994fd3b6fb7aeb95b0669
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 1
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: ARMv7
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
CPU: AnyCPU
|
||||
CompileFlags:
|
||||
FrameworkDependencies:
|
||||
- first:
|
||||
tvOS: tvOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c6cbae57da78c46c7918b2bfd24d7335
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue