删除打包后带入的本地目录和切换图标功能

This commit is contained in:
谢宇宁
2026-11-09 20:29:13 +07:00
parent b29916a6bb
commit f39c8eef17
45 changed files with 116 additions and 445 deletions
+6
View File
@@ -188,3 +188,9 @@ ume_kit/
# Claude Code 本地配置
.claude/
# 混淆调试符号(保留本地用于崩溃符号化,勿提交/外传)
/build/symbols/
# 旧签名备份(本地保留,勿提交/外传)
/keystore_backup/
+5 -5
View File
@@ -7,12 +7,12 @@ plugins {
apply plugin: 'top.niunaijun.blackobfuscator'
apply plugin: 'walle'
def bundledReleaseKeystore = file('../keystore/nut.jks')
def legacyBundledReleaseKeystore = file('../keystore/nut.jks.old')
def bundledReleaseKeystore = file('../keystore/app-release.jks')
def legacyBundledReleaseKeystore = file('../keystore/app-release.jks.old')
def resolvedReleaseKeystore = bundledReleaseKeystore.exists() ? bundledReleaseKeystore : legacyBundledReleaseKeystore
android {
namespace "com.xvproject"
namespace "com.hgdj.app"
compileSdk 36
ndkVersion "28.2.13676358"
@@ -31,7 +31,7 @@ android {
}
defaultConfig {
applicationId "com.noporn.newchatone_twelve_five"
applicationId "com.hgdj.app"
minSdk = 24
targetSdk = 36
versionCode = 1
@@ -43,7 +43,7 @@ android {
storeFile resolvedReleaseKeystore
storePassword 'jiahua123456'
storeType 'jks'
keyAlias 'nut'
keyAlias 'release'
keyPassword 'jiahua123456'
v1SigningEnabled false
v2SigningEnabled true
+1 -251
View File
@@ -1,6 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.xvproject">
package="com.hgdj.app">
<!-- release 包只用 main manifest,INTERNET 必须在这里声明;
否则 release 无网络权限,启动选线 host lookup errno=7,弹"线路检测失败" -->
@@ -36,256 +36,6 @@
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity-alias
android:name=".lld"
android:targetActivity=".MainActivity"
android:label="黄果短剧"
android:enabled="false"
android:icon="@mipmap/ic_launcher"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:name=".aiyinyue"
android:targetActivity=".MainActivity"
android:label="爱音乐"
android:enabled="false"
android:icon="@mipmap/icon_1"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:name=".aiyuedu"
android:targetActivity=".MainActivity"
android:label="爱阅读"
android:enabled="false"
android:icon="@mipmap/icon_2"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:name=".alipay"
android:targetActivity=".MainActivity"
android:label="支付宝"
android:enabled="false"
android:icon="@mipmap/icon_3"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:name=".bilibili"
android:targetActivity=".MainActivity"
android:label="哔哩哔哩"
android:enabled="false"
android:icon="@mipmap/icon_4"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:name=".binggandazhuozhan"
android:targetActivity=".MainActivity"
android:label="金铲铲之战"
android:enabled="false"
android:icon="@mipmap/icon_5"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:name=".meisijiejian"
android:targetActivity=".MainActivity"
android:label="美食借鉴"
android:enabled="false"
android:icon="@mipmap/icon_6"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:name=".myworld"
android:targetActivity=".MainActivity"
android:label="我的世界"
android:enabled="false"
android:icon="@mipmap/icon_7"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:name=".shenxuanzhizhan"
android:targetActivity=".MainActivity"
android:label="神选之战"
android:enabled="false"
android:icon="@mipmap/icon_8"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:name=".shuixinwuxian"
android:targetActivity=".MainActivity"
android:label="随心无线"
android:enabled="false"
android:icon="@mipmap/icon_9"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:name=".texuanxiaoshuo"
android:targetActivity=".MainActivity"
android:label="特轩小说"
android:enabled="false"
android:icon="@mipmap/icon_10"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:name=".tiantianmajiang"
android:targetActivity=".MainActivity"
android:label="天天麻将"
android:enabled="false"
android:icon="@mipmap/icon_11"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:name=".tuyou"
android:targetActivity=".MainActivity"
android:label="途游"
android:enabled="false"
android:icon="@mipmap/icon_12"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:name=".weichat"
android:targetActivity=".MainActivity"
android:label="微信"
android:enabled="false"
android:icon="@mipmap/icon_13"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:name=".wendao"
android:targetActivity=".MainActivity"
android:label="问道"
android:enabled="false"
android:icon="@mipmap/icon_14"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:name=".yinyutusujiao"
android:targetActivity=".MainActivity"
android:label="英语图书角"
android:enabled="false"
android:icon="@mipmap/icon_15"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:name=".icon_16"
android:targetActivity=".MainActivity"
android:label="91PO黄果短剧RN"
android:enabled="false"
android:icon="@mipmap/icon_16"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:name=".icon_17"
android:targetActivity=".MainActivity"
android:label="黄果短剧"
android:enabled="false"
android:icon="@mipmap/icon_17"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:name=".icon_18"
android:targetActivity=".MainActivity"
android:label="黄果短剧"
android:enabled="false"
android:icon="@mipmap/icon_18"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<provider
android:name="androidx.core.content.FileProvider"
@@ -1,4 +1,4 @@
package com.xvproject
package com.hgdj.app
import io.flutter.app.FlutterApplication
@@ -0,0 +1,13 @@
package com.hgdj.app
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.JPNativePlugin
class MainActivity : FlutterActivity() {
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
JPNativePlugin.registerWith(this, flutterEngine)
}
}
@@ -1,77 +0,0 @@
package com.xvproject
import android.annotation.SuppressLint
import android.app.ActivityManager
import android.content.ComponentName
import android.content.Intent
import android.content.pm.PackageManager
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel
import io.flutter.plugins.JPNativePlugin
class MainActivity : FlutterActivity() {
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
JPNativePlugin.registerWith(this, flutterEngine)
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL)
.setMethodCallHandler { call, result ->
when (call.method) {
METHOD_CHANGE_ICON -> {
val index = call.argument<Int>(ARG_ICON_INDEX) ?: -1
ICON_ALIASES.getOrNull(index)?.let { switchIcon("$ALIAS_PACKAGE.$it") }
result.success(true)
}
// 不回 result 的话 Dart 那边的 Future 永远不完成
else -> result.notImplemented()
}
}
}
/// 切换启动图标:禁用当前入口 + 启用目标 alias,再杀掉桌面进程让图标立刻刷新
private fun switchIcon(alias: String) {
val pm = packageManager
pm.setComponentEnabledSetting(
componentName,
PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP
)
pm.setComponentEnabledSetting(
ComponentName(this, alias),
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP
)
restartLauncher(pm)
}
/// 杀掉桌面进程,强制它重读图标
@SuppressLint("ServiceCast")
private fun restartLauncher(pm: PackageManager) {
val am = getSystemService(ACTIVITY_SERVICE) as ActivityManager
val intent = Intent(Intent.ACTION_MAIN)
.addCategory(Intent.CATEGORY_HOME)
.addCategory(Intent.CATEGORY_DEFAULT)
for (info in pm.queryIntentActivities(intent, 0)) {
am.killBackgroundProcesses(info.activityInfo?.packageName ?: continue)
}
}
companion object {
//这个跟flutter的通道名称保持一致
private const val CHANNEL = "com.yinse/request"
private const val METHOD_CHANGE_ICON = "changeIcon"
private const val ARG_ICON_INDEX = "iconIndex"
/// 图标 alias 所在包名:AndroidManifest 里 activity-alias 写的是相对名(manifest package=com.xvproject),
/// 与 applicationId 不同,不能用 packageName 拼
private const val ALIAS_PACKAGE = "com.xvproject"
/// 下标即 Flutter 传来的 iconIndex,顺序必须与 manifest 里 activity-alias 的声明顺序一致
private val ICON_ALIASES = listOf(
"lld", "aiyinyue", "aiyuedu", "alipay", "bilibili", "binggandazhuozhan",
"meisijiejian", "myworld", "shenxuanzhizhan", "shuixinwuxian", "texuanxiaoshuo",
"tiantianmajiang", "tuyou", "weichat", "wendao", "yinyutusujiao",
"icon_16", "icon_17", "icon_18", //清明 / 端午 / 劳动
)
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

+90 -9
View File
@@ -82,6 +82,22 @@ RAW_VERSION=$(grep '^version:' "$PUBSPEC_FILE" | awk '{print $2}')
SAFE_VERSION=${RAW_VERSION//+/_}
TIME_TAG=$(date +"%m%d-%H%M")
# 混淆 + 抽离调试信息:
# --obfuscate 混淆 Dart 符号;--split-debug-info 把调试信息(含 libapp.so 里
# 嵌入的本机绝对路径 .../huangguo_android/.dart_tool/.../dart_plugin_registrant.dart)
# 抽到单独目录,不再残留在产物里。反编译后搜不到本机用户名/工程路径。
# 仅 release/profile 生效(debug 为 JIT,不支持也无需)。symbols 目录务必保留、勿外传,
# 崩溃堆栈符号化要用它。
OBFUSCATE_ARGS=""
if [ "$MODE" = "release" ] || [ "$MODE" = "profile" ]; then
SYMBOLS_DIR="$(pwd)/build/symbols/${MODE}_${SAFE_VERSION}_${TIME_TAG}"
mkdir -p "$SYMBOLS_DIR"
# 注意:本项目已启用 BlackObfuscator,再叠加 Flutter --obfuscate 会导致启动黑屏,故关闭。
# 去除 libapp.so 内嵌构建路径改由出包后的 strip_build_path 二进制替换完成,与此无关。
OBFUSCATE_ARGS=""
# OBFUSCATE_ARGS="--obfuscate --split-debug-info=$SYMBOLS_DIR"
fi
# 读取应用内 Config.isDebug(lib/config/config.dart),决定产物命名标识:
# isDebug=true → 命名标识固定为 debug(如 hgdj_debug_xxxx),方便区分内测包
# isDebug=false → 正式环境,命名沿用构建模式(release/profile),保持不变
@@ -119,15 +135,77 @@ echo "=========================================="
echo "确认无误?(按回车继续,Ctrl+C 取消)"
read -r CONFIRM
# 清除 libapp.so 里嵌入的本机工程绝对路径(.../<工程>/.dart_tool/.../dart_plugin_registrant.dart)
# 做法:对该 URI 字符串做「等长」替换为中性路径(不含用户名/工程名),再 zipalign + 用原 keystore 重签。
# 等长替换保证 Dart String 长度字段不变、运行时安全;该 URI 仅为元数据,不参与运行逻辑。
strip_build_path() {
local APK="$1"
[ -f "$APK" ] || return 0
local BT; BT=$(ls -d "$HOME/Library/Android/sdk/build-tools/"* 2>/dev/null | sort -V | tail -1)
# 优先用 gradle 指定的 keystore(android/keystore/app-release.jks),避免误选到同目录备份
local KS=""
for cand in android/keystore/app-release.jks android/app/../keystore/app-release.jks; do
[ -f "$cand" ] && { KS="$cand"; break; }
done
[ -z "$KS" ] && KS=$(find android -name '*.jks' ! -name '*old*' ! -name '*bak*' 2>/dev/null | head -1)
local SP KP KA
SP=$(grep -E "storePassword" android/app/build.gradle | head -1 | sed -E "s/.*['\"]([^'\"]+)['\"].*/\1/")
KP=$(grep -E "keyPassword" android/app/build.gradle | head -1 | sed -E "s/.*['\"]([^'\"]+)['\"].*/\1/")
KA=$(grep -E "keyAlias" android/app/build.gradle | head -1 | sed -E "s/.*['\"]([^'\"]+)['\"].*/\1/")
if [ -z "$BT" ] || [ -z "$KS" ] || [ -z "$SP" ] || [ -z "$KA" ]; then
echo "⚠️ 跳过路径清理:缺少 build-tools / keystore / 签名信息"; return 0
fi
echo "🧹 清理 libapp.so 内嵌构建路径..."
local TMP; TMP=$(mktemp -d)
PROJ="$(pwd)" python3 - "$APK" "$TMP/patched.apk" <<'PY'
import sys, os, zipfile
from urllib.parse import quote
src, dst = sys.argv[1], sys.argv[2]
TAIL = b'/.dart_tool/flutter_build/dart_plugin_registrant.dart'
proj = os.environ["PROJ"]
# Flutter 以百分号编码嵌入非 ASCII 路径段;精确构造「当前工程」那条完整字节串
needle = quote(proj, safe="/").encode() + TAIL
# 等长中性替换:保留结构性尾巴,头部用 /aaa.../ 填满到同样长度(不含用户名/工程名)
repl = b'/' + b'a' * (len(needle) - 1 - len(TAIL)) + TAIL
assert len(repl) == len(needle)
def patch(d):
c = d.count(needle)
return (d.replace(needle, repl), c) if c else (d, 0)
zin = zipfile.ZipFile(src); zout = zipfile.ZipFile(dst, 'w'); total = 0
for it in zin.infolist():
data = zin.read(it.filename)
if it.filename.endswith('/libapp.so'):
data, n = patch(data); total += n
zi = zipfile.ZipInfo(it.filename, date_time=it.date_time)
zi.compress_type = it.compress_type; zi.external_attr = it.external_attr
zi.internal_attr = it.internal_attr; zi.create_system = it.create_system
zout.writestr(zi, data)
zout.close(); zin.close()
print(" 精确替换次数:", total)
if total == 0:
print(" ⚠️ 未找到工程路径字节串,未改动(宁可保留也不乱替换)")
PY
"$BT/zipalign" -f -p 4 "$TMP/patched.apk" "$TMP/aligned.apk" >/dev/null 2>&1 \
&& "$BT/apksigner" sign --ks "$KS" --ks-pass "pass:$SP" --ks-key-alias "$KA" --key-pass "pass:${KP:-$SP}" \
--v1-signing-enabled false --v2-signing-enabled true --out "$TMP/signed.apk" "$TMP/aligned.apk" >/dev/null 2>&1 \
&& "$BT/apksigner" verify "$TMP/signed.apk" >/dev/null 2>&1
if [ $? -eq 0 ]; then
cp "$TMP/signed.apk" "$APK"; echo "✅ 已清理并重签:$APK"
else
echo "⚠️ 清理失败,保留原包未改动:$APK"
fi
rm -rf "$TMP"
}
# Android 构建
build_android() {
echo "▶️ 开始构建 Android $MODE 包..."
if [ "$MODE" = "release" ]; then
flutter build apk --release --target-platform android-arm64
flutter build apk --release --target-platform android-arm64 $OBFUSCATE_ARGS
APK_SOURCE="build/app/outputs/flutter-apk/app-release.apk"
elif [ "$MODE" = "profile" ]; then
flutter build apk --profile --target-platform android-arm64
flutter build apk --profile --target-platform android-arm64 $OBFUSCATE_ARGS
APK_SOURCE="build/app/outputs/flutter-apk/app-profile.apk"
else
flutter build apk --debug --target-platform android-arm64
@@ -143,7 +221,10 @@ build_android() {
APK_DEST="${DIST_DIR}/${APK_NAME}"
cp "$APK_SOURCE" "$APK_DEST"
APK_SIZE=$(du -h "$APK_DEST" | awk '{print $1}')
# 注意:本 App 有运行时自校验,任何出包后修改 libapp.so(即使等长精确替换并重签)都会
# 导致启动卡在启动页。故不再对产物做二进制补丁。去除内嵌构建路径改用“中性目录构建”方案。
# strip_build_path 函数保留备查,但默认不调用。
echo "✅ Android 构建成功!"
echo "📁 输出路径: $APK_DEST"
echo "📏 文件大小: $APK_SIZE"
@@ -164,19 +245,19 @@ build_ios() {
if [ "$MODE" = "release" ]; then
if [ "$SIGN_MODE" = "nocodesign" ]; then
flutter build ipa --release --no-codesign
flutter build ipa --release --no-codesign $OBFUSCATE_ARGS
elif [ -n "$EXPORT_OPTIONS_PLIST" ]; then
flutter build ipa --release --export-options-plist="$EXPORT_OPTIONS_PLIST"
flutter build ipa --release --export-options-plist="$EXPORT_OPTIONS_PLIST" $OBFUSCATE_ARGS
else
flutter build ipa --release --export-method "$EXPORT_METHOD"
flutter build ipa --release --export-method "$EXPORT_METHOD" $OBFUSCATE_ARGS
fi
else
if [ "$SIGN_MODE" = "nocodesign" ]; then
flutter build ipa --profile --no-codesign
flutter build ipa --profile --no-codesign $OBFUSCATE_ARGS
elif [ -n "$EXPORT_OPTIONS_PLIST" ]; then
flutter build ipa --profile --export-options-plist="$EXPORT_OPTIONS_PLIST"
flutter build ipa --profile --export-options-plist="$EXPORT_OPTIONS_PLIST" $OBFUSCATE_ARGS
else
flutter build ipa --profile --export-method "$EXPORT_METHOD"
flutter build ipa --profile --export-method "$EXPORT_METHOD" $OBFUSCATE_ARGS
fi
fi
-2
View File
@@ -20,6 +20,4 @@ extension ImageLoad on String {
String get mineImgPath => 'assets/images/mine/$this';
//启动页
String get launchPath => 'assets/images/launch/$this';
//app icon
String get appImgPath => 'assets/images/app_icon/$this';
}
-36
View File
@@ -1,8 +1,6 @@
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:hgdj/assets_tool/images.dart';
import 'package:hgdj/hj_page/pre_sale/pre_sale_provider.dart';
import 'package:hgdj/hj_utils/api_service/vid_service.dart';
import 'package:hgdj/hj_utils/light_model.dart';
@@ -11,10 +9,8 @@ import 'package:hgdj/tools_base/global_store/store.dart';
import 'package:hgdj/tools_base/loading/loading_helper.dart';
import 'package:hgdj/tools_base/toast.dart';
import 'package:hgdj/tools_base/widget/common_alert.dart';
import 'package:hgdj/track_event_manager/device_service.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import '../../config/config.dart';
import '../../hj_model/user/user_info_model.dart';
import '../main_page/provider/msg_provider.dart';
import '../web_page/h5_page.dart';
@@ -30,14 +26,6 @@ import 'mine_share/mine_share_page.dart';
import 'more_question/mine_feedback_page.dart';
import 'welfare/welfare_home_page.dart';
//图标
class IconBean {
String image;
String name;
IconBean(this.image, this.name);
}
class MineMainLogic extends GetxController with GetTickerProviderStateMixin {
RefreshController? refreshCtr;
@@ -54,25 +42,6 @@ class MineMainLogic extends GetxController with GetTickerProviderStateMixin {
"我的消息",
];
List<IconBean> iconList = [
IconBean('ic_launcher.webp'.commonImgPath, Config.appName),
IconBean('icon_1.webp'.appImgPath, "爱音乐"),
IconBean('icon_2.webp'.appImgPath, "爱阅读"),
IconBean('icon_3.webp'.appImgPath, "支付宝"),
IconBean('icon_4.webp'.appImgPath, "哔哩哔哩"),
IconBean('icon_5.webp'.appImgPath, "饼干大作战"),
IconBean('icon_6.webp'.appImgPath, "美食借鉴"),
IconBean('icon_7.webp'.appImgPath, "我的世界"),
IconBean('icon_8.webp'.appImgPath, "神选之战"),
IconBean('icon_9.webp'.appImgPath, "随心无线"),
IconBean('icon_10.webp'.appImgPath, "特轩小说"),
IconBean('icon_11.webp'.appImgPath, "天天麻将"),
IconBean('icon_12.webp'.appImgPath, "途游"),
IconBean('icon_13.webp'.appImgPath, "微信"),
IconBean('icon_14.webp'.appImgPath, "问道"),
IconBean('icon_15.webp'.appImgPath, "英语图书角"),
];
@override
void onReady() async {
super.onReady();
@@ -198,9 +167,4 @@ class MineMainLogic extends GetxController with GetTickerProviderStateMixin {
popGesture: true);
}
changeIcon(int index) async {
if (!await CommonAlert.show(content: '您确定要更换图标吗?')) return;
const platform = MethodChannel(DeviceInfoService.requestChannel);
platform.invokeMethod('changeIcon', {"iconIndex": index});
}
}
-61
View File
@@ -1,4 +1,3 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -167,66 +166,6 @@ class HomeMinePage extends StatelessWidget {
);
},
),
// iOS 换图标需弹系统弹窗且要预置图标资源,暂不支持,仅 Android 显示该入口
if (!Platform.isIOS) ...[
Padding(
padding: EdgeInsets.only(left: 12, top: 10, right: 12),
child: Row(
children: [
Text(
'设置桌面图标',
style: TextStyle(
color: Color(0xffEFEFEF),
fontSize: 14,
fontWeight: FontWeight.w500),
),
Spacer(),
InkWell(
enableFeedback: false,
onTap: () => logic.changeIcon(0),
child: Text(
'恢复默认',
style: TextStyle(
color: Color(0xff989898),
fontSize: 12,
fontWeight: FontWeight.w400),
),
),
],
),
),
11.sizeBoxH,
SizedBox(
height: 76,
child: ListView.separated(
padding: EdgeInsets.symmetric(horizontal: 16),
scrollDirection: Axis.horizontal,
separatorBuilder: (_, __) => 7.sizeBoxW,
itemCount: logic.iconList.length,
itemBuilder: (BuildContext context, int index) {
final data = logic.iconList[index];
return InkWell(
enableFeedback: false,
onTap: () => logic.changeIcon(index),
child: Column(
children: [
Image.asset(data.image, width: 54),
4.sizeBoxH,
Text(
data.name,
style: TextStyle(
color: Colors.white.withValues(alpha: 0.9),
fontSize: 12,
),
)
],
),
);
},
),
),
10.sizeBoxH,
],
],
),
),
@@ -82,8 +82,6 @@ class DeviceInfoService {
/// note_this:不要修改这个值
static const iosBundleId = "yinse_opera";
static const naticeChannel = 'com.yinse/device'; //原生通道(设备/视频/编解码信息)
static const requestChannel =
'com.yinse/request'; //原生系统桥(现只剩换启动图标 changeIcon)
/// 外部调用入口
static Future<void> init() async {
-1
View File
@@ -107,7 +107,6 @@ flutter:
- assets/images/video/
- assets/images/comment/
- assets/images/launch/
- assets/images/app_icon/
- assets/images/ai/
- assets/images/live_images/
- assets/images/acg/