feat(channel): 支持渠道 Manifest 增量合并
This commit is contained in:
@@ -1,54 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest
|
<manifest
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.arkgame.ft.ep"
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
|
||||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
|
||||||
<application android:extractNativeLibs="true" android:name="com.unity3d.player.TYApp"
|
|
||||||
tools:replace="android:usesCleartextTraffic"
|
|
||||||
android:usesCleartextTraffic="true">
|
|
||||||
<activity android:name="com.unity3d.player.TYUnityActivity"
|
|
||||||
android:theme="@style/UnityThemeSelector">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
<intent-filter android:autoVerify="true">
|
<application>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<meta-data
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
android:name="com.sensorsdata.analytics.android.MainProcessName"
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
|
||||||
<data android:scheme="https" android:host="fishingtraveliae.onelink.me" android:pathPrefix="/jT1Q"/>
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.VIEW" />
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
|
||||||
<data android:host="mainactivity" android:scheme="zzft" />
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
|
|
||||||
|
|
||||||
<meta-data android:name="google_analytics_default_allow_analytics_storage" android:value="true" />
|
|
||||||
<meta-data android:name="google_analytics_default_allow_ad_storage" android:value="true" />
|
|
||||||
<meta-data android:name="google_analytics_default_allow_ad_user_data" android:value="true" />
|
|
||||||
<meta-data android:name="google_analytics_default_allow_ad_personalization_signals" android:value="true" />
|
|
||||||
</activity>
|
|
||||||
<meta-data android:name="com.arkgame.ft.channel" android:value="EnjoyPay" />
|
|
||||||
|
|
||||||
<meta-data android:name="com.sensorsdata.analytics.android.MainProcessName"
|
|
||||||
android:value="${applicationId}"
|
android:value="${applicationId}"
|
||||||
tools:replace="android:value" />
|
tools:replace="android:value" />
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
<queries>
|
|
||||||
<provider android:authorities="com.facebook.katana.provider.PlatformProvider" />
|
|
||||||
<provider android:authorities="com.facebook.orca.provider.PlatformProvider" />
|
|
||||||
<intent>
|
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
|
||||||
</intent>
|
|
||||||
</queries>
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
implementation project(':channel_manifest_lib')
|
||||||
|
|
||||||
api "com.android.support:support-v4:28.0.0"
|
api "com.android.support:support-v4:28.0.0"
|
||||||
api "com.android.support:appcompat-v7:28.0.0"
|
api "com.android.support:appcompat-v7:28.0.0"
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ pluginManagement {
|
|||||||
include ':launcher', ':unityLibrary'
|
include ':launcher', ':unityLibrary'
|
||||||
**INCLUDES**
|
**INCLUDES**
|
||||||
|
|
||||||
|
def channelUnityProjectPath = $/**DIR_UNITYPROJECT**/$.replace("\\", "/")
|
||||||
|
include ':channel_manifest_lib'
|
||||||
|
project(':channel_manifest_lib').projectDir = new File(channelUnityProjectPath, 'Assets/Plugins/Android/channel_manifest_lib')
|
||||||
|
|
||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
|
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
|
||||||
repositories {
|
repositories {
|
||||||
|
|||||||
@@ -1,69 +1,21 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest
|
<manifest
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.arkgame.ft.flexion"
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
|
||||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
|
||||||
<application android:extractNativeLibs="true" android:name="com.unity3d.player.TYApp"
|
|
||||||
tools:replace="android:usesCleartextTraffic,android:fullBackupContent"
|
|
||||||
android:fullBackupContent="@xml/flexion_backup_rules"
|
|
||||||
android:usesCleartextTraffic="true">
|
|
||||||
<activity android:name="com.unity3d.player.TYUnityActivity"
|
|
||||||
android:theme="@style/UnityThemeSelector">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
<intent-filter android:autoVerify="true">
|
<application>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<meta-data
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
android:name="com.sensorsdata.analytics.android.MainProcessName"
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
|
||||||
<data android:scheme="https" android:host="fishingtraveliae.onelink.me" android:pathPrefix="/jT1Q"/>
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.VIEW" />
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
|
||||||
<data android:host="mainactivity" android:scheme="zzft" />
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<!-- 渠道标识,ChannelManager 读取此值以识别 Flexion 渠道 -->
|
|
||||||
<meta-data android:name="com.arkgame.ft.channel" android:value="Flexion" />
|
|
||||||
|
|
||||||
<!-- 覆盖 gasdk 与 tuyoosdk 的 MainProcessName 冲突 -->
|
|
||||||
<meta-data android:name="com.sensorsdata.analytics.android.MainProcessName"
|
|
||||||
android:value="${applicationId}"
|
android:value="${applicationId}"
|
||||||
tools:replace="android:value" />
|
tools:replace="android:value" />
|
||||||
|
|
||||||
<!-- Flexion SDK 应用标识,从 DropPoint 获取 -->
|
|
||||||
<meta-data android:name="com.flexionmobile.fdk.apptoken" android:value="fishingtravel" />
|
<meta-data android:name="com.flexionmobile.fdk.apptoken" android:value="fishingtravel" />
|
||||||
|
|
||||||
<!-- 告知 Flexion SDK 当前为 Unity 项目,必须声明 -->
|
|
||||||
<meta-data android:name="com.flexionmobile.fdk.sdk-type" android:value="unity" />
|
<meta-data android:name="com.flexionmobile.fdk.sdk-type" android:value="unity" />
|
||||||
|
|
||||||
<!--
|
|
||||||
覆盖 tuyoosdk AAR 中硬编码的 Facebook ContentProvider authority。
|
|
||||||
AAR 原值:com.facebook.app.FacebookContentProvider162066986963808
|
|
||||||
追加 ${applicationId}(Flexion 包名)作为后缀后,与 GP 版 authority 不同,
|
|
||||||
两个渠道包可同时安装在同一设备上,不会触发 INSTALL_FAILED_CONFLICTING_PROVIDER。
|
|
||||||
参考:Flexion 官方文档《Unique package name - follow-on requirements》
|
|
||||||
-->
|
|
||||||
<provider
|
<provider
|
||||||
android:name="com.facebook.FacebookContentProvider"
|
android:name="com.facebook.FacebookContentProvider"
|
||||||
android:authorities="com.facebook.app.FacebookContentProvider162066986963808.${applicationId}"
|
android:authorities="com.facebook.app.FacebookContentProvider162066986963808.${applicationId}"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
tools:replace="android:authorities" />
|
tools:replace="android:authorities" />
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
<queries>
|
|
||||||
<provider android:authorities="com.facebook.katana.provider.PlatformProvider" />
|
|
||||||
<provider android:authorities="com.facebook.orca.provider.PlatformProvider" />
|
|
||||||
</queries>
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
implementation project(':channel_manifest_lib')
|
||||||
|
|
||||||
api "com.android.support:support-v4:28.0.0"
|
api "com.android.support:support-v4:28.0.0"
|
||||||
api "com.android.support:appcompat-v7:28.0.0"
|
api "com.android.support:appcompat-v7:28.0.0"
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ pluginManagement {
|
|||||||
include ':launcher', ':unityLibrary'
|
include ':launcher', ':unityLibrary'
|
||||||
**INCLUDES**
|
**INCLUDES**
|
||||||
|
|
||||||
|
def channelUnityProjectPath = $/**DIR_UNITYPROJECT**/$.replace("\\", "/")
|
||||||
|
include ':channel_manifest_lib'
|
||||||
|
project(':channel_manifest_lib').projectDir = new File(channelUnityProjectPath, 'Assets/Plugins/Android/channel_manifest_lib')
|
||||||
|
|
||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
|
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
|
||||||
repositories {
|
repositories {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
implementation project(':channel_manifest_lib')
|
||||||
|
|
||||||
api "com.android.support:support-v4:28.0.0"
|
api "com.android.support:support-v4:28.0.0"
|
||||||
api "com.android.support:appcompat-v7:28.0.0"
|
api "com.android.support:appcompat-v7:28.0.0"
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ pluginManagement {
|
|||||||
include ':launcher', ':unityLibrary'
|
include ':launcher', ':unityLibrary'
|
||||||
**INCLUDES**
|
**INCLUDES**
|
||||||
|
|
||||||
|
def channelUnityProjectPath = $/**DIR_UNITYPROJECT**/$.replace("\\", "/")
|
||||||
|
include ':channel_manifest_lib'
|
||||||
|
project(':channel_manifest_lib').projectDir = new File(channelUnityProjectPath, 'Assets/Plugins/Android/channel_manifest_lib')
|
||||||
|
|
||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
|
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
|
||||||
repositories {
|
repositories {
|
||||||
|
|||||||
@@ -1,42 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest
|
<manifest
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.arkgame.ft"
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
|
||||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
|
||||||
<application android:extractNativeLibs="true" android:name="com.unity3d.player.TYApp"
|
|
||||||
tools:replace="android:usesCleartextTraffic"
|
|
||||||
tools:overrideLibrary="com.tuyoo.gamesdk"
|
|
||||||
android:usesCleartextTraffic="true">
|
|
||||||
<activity android:name="com.unity3d.player.TYUnityActivity"
|
|
||||||
android:theme="@style/UnityThemeSelector">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
<intent-filter android:autoVerify="true">
|
<application tools:overrideLibrary="com.tuyoo.gamesdk">
|
||||||
<action android:name="android.intent.action.VIEW" />
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
|
||||||
<data android:scheme="https" android:host="fishingtraveliae.onelink.me" android:pathPrefix="/jT1Q"/>
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.VIEW" />
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
|
||||||
<data android:host="mainactivity" android:scheme="zzft" />
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
|
|
||||||
</activity>
|
|
||||||
<meta-data android:name="com.arkgame.ft.channel" android:value="Rustore" />
|
|
||||||
</application>
|
</application>
|
||||||
<queries>
|
|
||||||
<provider android:authorities="com.facebook.katana.provider.PlatformProvider" /> <!-- allows app to access Facebook app features -->
|
|
||||||
<provider android:authorities="com.facebook.orca.provider.PlatformProvider" /> <!-- allows sharing to Messenger app -->
|
|
||||||
</queries>
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
implementation project(':channel_manifest_lib')
|
||||||
|
|
||||||
api "com.android.support:support-v4:28.0.0"
|
api "com.android.support:support-v4:28.0.0"
|
||||||
api "com.android.support:appcompat-v7:28.0.0"
|
api "com.android.support:appcompat-v7:28.0.0"
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ pluginManagement {
|
|||||||
include ':launcher', ':unityLibrary'
|
include ':launcher', ':unityLibrary'
|
||||||
**INCLUDES**
|
**INCLUDES**
|
||||||
|
|
||||||
|
def channelUnityProjectPath = $/**DIR_UNITYPROJECT**/$.replace("\\", "/")
|
||||||
|
include ':channel_manifest_lib'
|
||||||
|
project(':channel_manifest_lib').projectDir = new File(channelUnityProjectPath, 'Assets/Plugins/Android/channel_manifest_lib')
|
||||||
|
|
||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
|
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
|
||||||
repositories {
|
repositories {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Xml.Linq;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditor.AddressableAssets;
|
using UnityEditor.AddressableAssets;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@@ -16,6 +17,10 @@ public class ChannelBuildTool
|
|||||||
private const string AndroidAddressablesContentState = "Assets/AddressableAssetsData/Android/addressables_content_state.bin";
|
private const string AndroidAddressablesContentState = "Assets/AddressableAssetsData/Android/addressables_content_state.bin";
|
||||||
private const string DefaultProductName = "Fishing Travel";
|
private const string DefaultProductName = "Fishing Travel";
|
||||||
private const string EnjoyPayProductName = "Fishing Travel: Hook & Explore";
|
private const string EnjoyPayProductName = "Fishing Travel: Hook & Explore";
|
||||||
|
private const string ChannelManifestLib = "channel_manifest_lib";
|
||||||
|
private const string EmptyManifest = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" />\n";
|
||||||
|
private static readonly XNamespace AndroidNamespace = "http://schemas.android.com/apk/res/android";
|
||||||
|
private static readonly XNamespace ToolsNamespace = "http://schemas.android.com/tools";
|
||||||
|
|
||||||
// ==================== Channel Switching ====================
|
// ==================== Channel Switching ====================
|
||||||
|
|
||||||
@@ -29,9 +34,10 @@ public class ChannelBuildTool
|
|||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log($"[ChannelSwitch] Switching to {channel}...");
|
Debug.Log($"[ChannelSwitch] Switching to {channel}...");
|
||||||
|
CleanChannelManifestLibBuildArtifacts();
|
||||||
|
|
||||||
// 1. Sync root Android config files
|
// 1. Sync root Android config files
|
||||||
SyncRootAndroidConfigFiles(cfgDir);
|
SyncRootAndroidConfigFiles(channel, cfgDir);
|
||||||
|
|
||||||
// 2. Sync channel SDK adapter Java files to tysdk package
|
// 2. Sync channel SDK adapter Java files to tysdk package
|
||||||
SyncChannelAdapterFiles(cfgDir);
|
SyncChannelAdapterFiles(cfgDir);
|
||||||
@@ -110,6 +116,7 @@ public class ChannelBuildTool
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
CleanChannelManifestLibBuildArtifacts();
|
||||||
SwitchChannel(channel);
|
SwitchChannel(channel);
|
||||||
|
|
||||||
var fileName = debug ? $"tysdkTest_{channel}_debug.apk" : $"tysdkTest_{channel}.apk";
|
var fileName = debug ? $"tysdkTest_{channel}_debug.apk" : $"tysdkTest_{channel}.apk";
|
||||||
@@ -190,11 +197,12 @@ public class ChannelBuildTool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SyncRootAndroidConfigFiles(string cfgDir)
|
private static void SyncRootAndroidConfigFiles(string channel, string cfgDir)
|
||||||
{
|
{
|
||||||
CopyRootConfigFiles(cfgDir, "*.gradle");
|
CopyRootConfigFiles(cfgDir, "*.gradle");
|
||||||
CopyRootConfigFiles(cfgDir, "*.properties");
|
CopyRootConfigFiles(cfgDir, "*.properties");
|
||||||
CopyRootConfigFile(cfgDir, "AndroidManifest.xml");
|
SetMainManifestChannel(channel);
|
||||||
|
SyncChannelManifestLib(channel, cfgDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SyncChannelAdapterFiles(string cfgDir)
|
private static void SyncChannelAdapterFiles(string cfgDir)
|
||||||
@@ -215,18 +223,134 @@ public class ChannelBuildTool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CopyRootConfigFiles(string cfgDir, string searchPattern)
|
private static void SyncChannelManifestLib(string channel, string cfgDir)
|
||||||
{
|
{
|
||||||
foreach (var src in Directory.GetFiles(cfgDir, searchPattern, SearchOption.TopDirectoryOnly))
|
var dest = Path.Combine(AssetsPlugins, ChannelManifestLib, "src");
|
||||||
|
if (channel == "GooglePlay")
|
||||||
{
|
{
|
||||||
CopyRootConfigFile(src);
|
WriteEmptyChannelManifestLib(dest);
|
||||||
|
Debug.Log($"[ChannelSwitch] Manifest lib reset to empty default. Channel={channel}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var srcManifest = Path.Combine(cfgDir, "AndroidManifest.xml");
|
||||||
|
if (!File.Exists(srcManifest))
|
||||||
|
{
|
||||||
|
throw new FileNotFoundException($"[ChannelSwitch] Channel manifest not found: {srcManifest}");
|
||||||
|
}
|
||||||
|
|
||||||
|
WriteChannelManifestLib(srcManifest, Path.Combine(cfgDir, "res"), dest);
|
||||||
|
Debug.Log($"[ChannelSwitch] Manifest: {srcManifest} -> {Path.Combine(dest, "main", "AndroidManifest.xml")}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SetMainManifestChannel(string channel)
|
||||||
|
{
|
||||||
|
var manifestPath = Path.Combine(AssetsPlugins, "AndroidManifest.xml");
|
||||||
|
if (!File.Exists(manifestPath))
|
||||||
|
{
|
||||||
|
throw new FileNotFoundException($"[ChannelSwitch] Main AndroidManifest not found: {manifestPath}");
|
||||||
|
}
|
||||||
|
|
||||||
|
var doc = XDocument.Load(manifestPath);
|
||||||
|
var root = doc.Root;
|
||||||
|
var application = root?.Elements().FirstOrDefault(x => x.Name.LocalName == "application");
|
||||||
|
if (application == null)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException($"[ChannelSwitch] Main AndroidManifest application node not found: {manifestPath}");
|
||||||
|
}
|
||||||
|
|
||||||
|
var channelMeta = application.Elements()
|
||||||
|
.FirstOrDefault(x => x.Name.LocalName == "meta-data" &&
|
||||||
|
(string)x.Attribute(AndroidNamespace + "name") == "com.arkgame.ft.channel");
|
||||||
|
if (channelMeta == null)
|
||||||
|
{
|
||||||
|
channelMeta = new XElement("meta-data",
|
||||||
|
new XAttribute(AndroidNamespace + "name", "com.arkgame.ft.channel"));
|
||||||
|
application.Add(channelMeta);
|
||||||
|
}
|
||||||
|
|
||||||
|
channelMeta.SetAttributeValue(AndroidNamespace + "value", channel);
|
||||||
|
SetMainManifestBackupRules(application, channel);
|
||||||
|
doc.Save(manifestPath);
|
||||||
|
AssetDatabase.ImportAsset(manifestPath, ImportAssetOptions.ForceSynchronousImport | ImportAssetOptions.ForceUpdate);
|
||||||
|
Debug.Log($"[ChannelSwitch] Main manifest channel -> {channel}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SetMainManifestBackupRules(XElement application, string channel)
|
||||||
|
{
|
||||||
|
const string fullBackupContent = "android:fullBackupContent";
|
||||||
|
var replaceAttr = application.Attribute(ToolsNamespace + "replace");
|
||||||
|
var replaceItems = replaceAttr?.Value
|
||||||
|
.Split(',')
|
||||||
|
.Select(x => x.Trim())
|
||||||
|
.Where(x => !string.IsNullOrEmpty(x))
|
||||||
|
.ToList() ?? new List<string>();
|
||||||
|
|
||||||
|
if (channel == "Flexion")
|
||||||
|
{
|
||||||
|
application.SetAttributeValue(AndroidNamespace + "fullBackupContent", "@xml/flexion_backup_rules");
|
||||||
|
if (!replaceItems.Contains(fullBackupContent))
|
||||||
|
{
|
||||||
|
replaceItems.Add(fullBackupContent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
application.SetAttributeValue(AndroidNamespace + "fullBackupContent", null);
|
||||||
|
replaceItems.RemoveAll(x => x == fullBackupContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
application.SetAttributeValue(ToolsNamespace + "replace",
|
||||||
|
replaceItems.Count > 0 ? string.Join(",", replaceItems) : null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void WriteEmptyChannelManifestLib(string dest)
|
||||||
|
{
|
||||||
|
if (Directory.Exists(dest))
|
||||||
|
{
|
||||||
|
Directory.Delete(dest, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
var manifestDir = Path.Combine(dest, "main");
|
||||||
|
Directory.CreateDirectory(manifestDir);
|
||||||
|
File.WriteAllText(Path.Combine(manifestDir, "AndroidManifest.xml"), EmptyManifest);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void CleanChannelManifestLibBuildArtifacts()
|
||||||
|
{
|
||||||
|
var buildDir = Path.Combine(AssetsPlugins, ChannelManifestLib, "build");
|
||||||
|
if (Directory.Exists(buildDir))
|
||||||
|
{
|
||||||
|
Directory.Delete(buildDir, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
var buildMeta = buildDir + ".meta";
|
||||||
|
if (File.Exists(buildMeta))
|
||||||
|
{
|
||||||
|
File.Delete(buildMeta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CopyRootConfigFile(string cfgDir, string fileName)
|
private static void WriteChannelManifestLib(string srcManifest, string srcResDir, string dest)
|
||||||
{
|
{
|
||||||
var src = Path.Combine(cfgDir, fileName);
|
if (Directory.Exists(dest))
|
||||||
if (File.Exists(src))
|
{
|
||||||
|
Directory.Delete(dest, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
var manifestDir = Path.Combine(dest, "main");
|
||||||
|
Directory.CreateDirectory(manifestDir);
|
||||||
|
File.Copy(srcManifest, Path.Combine(manifestDir, "AndroidManifest.xml"), true);
|
||||||
|
|
||||||
|
if (Directory.Exists(srcResDir))
|
||||||
|
{
|
||||||
|
CopyDirectoryClean(srcResDir, Path.Combine(manifestDir, "res"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void CopyRootConfigFiles(string cfgDir, string searchPattern)
|
||||||
|
{
|
||||||
|
foreach (var src in Directory.GetFiles(cfgDir, searchPattern, SearchOption.TopDirectoryOnly))
|
||||||
{
|
{
|
||||||
CopyRootConfigFile(src);
|
CopyRootConfigFile(src);
|
||||||
}
|
}
|
||||||
@@ -240,6 +364,27 @@ public class ChannelBuildTool
|
|||||||
Debug.Log($"[ChannelSwitch] Config: {src} -> {dest}");
|
Debug.Log($"[ChannelSwitch] Config: {src} -> {dest}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void CopyDirectoryClean(string src, string dest)
|
||||||
|
{
|
||||||
|
if (Directory.Exists(dest))
|
||||||
|
{
|
||||||
|
Directory.Delete(dest, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
Directory.CreateDirectory(dest);
|
||||||
|
foreach (var srcFile in Directory.GetFiles(src, "*", SearchOption.AllDirectories))
|
||||||
|
{
|
||||||
|
if (srcFile.EndsWith(".meta")) continue;
|
||||||
|
|
||||||
|
var relativePath = srcFile.Substring(src.Length).TrimStart(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
|
||||||
|
var destFile = Path.Combine(dest, relativePath);
|
||||||
|
var destDir = Path.GetDirectoryName(destFile);
|
||||||
|
if (!Directory.Exists(destDir)) Directory.CreateDirectory(destDir);
|
||||||
|
|
||||||
|
File.Copy(srcFile, destFile, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void SetAddressablesProfile(string channel)
|
private static void SetAddressablesProfile(string channel)
|
||||||
{
|
{
|
||||||
var settings = AddressableAssetSettingsDefaultObject.Settings;
|
var settings = AddressableAssetSettingsDefaultObject.Settings;
|
||||||
|
|||||||
@@ -1,48 +1,41 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.arkgame.ft" xmlns:tools="http://schemas.android.com/tools">
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
package="com.arkgame.ft"
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
<application android:extractNativeLibs="true" android:name="com.unity3d.player.TYApp" android:usesCleartextTraffic="true">
|
||||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
<activity android:name="com.unity3d.player.TYUnityActivity" android:theme="@style/UnityThemeSelector">
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
<intent-filter>
|
||||||
<application android:extractNativeLibs="true" android:name="com.unity3d.player.TYApp" android:usesCleartextTraffic="true">
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<activity android:name="com.unity3d.player.TYUnityActivity"
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
android:theme="@style/UnityThemeSelector">
|
</intent-filter>
|
||||||
<intent-filter>
|
<intent-filter android:autoVerify="true">
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
</intent-filter>
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="https" android:host="fishingtraveliae.onelink.me" android:pathPrefix="/jT1Q" />
|
||||||
<intent-filter android:autoVerify="true">
|
</intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<intent-filter>
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<data android:scheme="https" android:host="fishingtraveliae.onelink.me" android:pathPrefix="/jT1Q"/>
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
</intent-filter>
|
<data android:host="mainactivity" android:scheme="zzft" />
|
||||||
|
</intent-filter>
|
||||||
<intent-filter>
|
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<meta-data android:name="google_analytics_default_allow_analytics_storage" android:value="true" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<meta-data android:name="google_analytics_default_allow_ad_storage" android:value="true" />
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<meta-data android:name="google_analytics_default_allow_ad_user_data" android:value="true" />
|
||||||
<data android:host="mainactivity" android:scheme="zzft" />
|
<meta-data android:name="google_analytics_default_allow_ad_personalization_signals" android:value="true" />
|
||||||
</intent-filter>
|
</activity>
|
||||||
|
<meta-data android:name="com.arkgame.ft.channel" android:value="GooglePlay" />
|
||||||
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
|
</application>
|
||||||
|
<queries>
|
||||||
<meta-data android:name="google_analytics_default_allow_analytics_storage" android:value="true" />
|
<provider android:authorities="com.facebook.katana.provider.PlatformProvider" />
|
||||||
<meta-data android:name="google_analytics_default_allow_ad_storage" android:value="true" />
|
<!-- allows app to access Facebook app features -->
|
||||||
<meta-data android:name="google_analytics_default_allow_ad_user_data" android:value="true" />
|
<provider android:authorities="com.facebook.orca.provider.PlatformProvider" />
|
||||||
<meta-data android:name="google_analytics_default_allow_ad_personalization_signals" android:value="true" />
|
<!-- allows sharing to Messenger app -->
|
||||||
|
<intent>
|
||||||
</activity>
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<meta-data android:name="com.arkgame.ft.channel" android:value="GooglePlay" />
|
</intent>
|
||||||
</application>
|
</queries>
|
||||||
<queries>
|
</manifest>
|
||||||
<provider android:authorities="com.facebook.katana.provider.PlatformProvider" /> <!-- allows app to access Facebook app features -->
|
|
||||||
<provider android:authorities="com.facebook.orca.provider.PlatformProvider" /> <!-- allows sharing to Messenger app -->
|
|
||||||
<intent>
|
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
|
||||||
</intent>
|
|
||||||
</queries>
|
|
||||||
</manifest>
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ad9923efa7716e24a9eacfdeaba25735
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
apply plugin: 'com.android.library'
|
||||||
|
|
||||||
|
evaluationDependsOn(':unityLibrary')
|
||||||
|
def unityAndroid = project(':unityLibrary').extensions.getByName('android')
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace 'com.arkgame.ft.channelmanifest'
|
||||||
|
compileSdkVersion unityAndroid.compileSdkVersion
|
||||||
|
buildToolsVersion unityAndroid.buildToolsVersion
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion unityAndroid.defaultConfig.minSdkVersion.apiLevel
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6b1864b7c14c2874290c96b313f016da
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0c6d5688cdd2a434fae148ccc076e1ee
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4835437bf5f97d548abb765917c4873c
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" />
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f8101f5c11c019f45843819fd0a0aec8
|
||||||
|
TextScriptImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -18,6 +18,7 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
implementation project(':channel_manifest_lib')
|
||||||
|
|
||||||
api "com.android.support:support-v4:28.0.0"
|
api "com.android.support:support-v4:28.0.0"
|
||||||
api "com.android.support:appcompat-v7:28.0.0"
|
api "com.android.support:appcompat-v7:28.0.0"
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ pluginManagement {
|
|||||||
include ':launcher', ':unityLibrary'
|
include ':launcher', ':unityLibrary'
|
||||||
**INCLUDES**
|
**INCLUDES**
|
||||||
|
|
||||||
|
def channelUnityProjectPath = $/**DIR_UNITYPROJECT**/$.replace("\\", "/")
|
||||||
|
include ':channel_manifest_lib'
|
||||||
|
project(':channel_manifest_lib').projectDir = new File(channelUnityProjectPath, 'Assets/Plugins/Android/channel_manifest_lib')
|
||||||
|
|
||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
|
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
|
||||||
repositories {
|
repositories {
|
||||||
|
|||||||
Reference in New Issue
Block a user