Author SHA1 Message Date
jingyun 117501130d fix:升级插件 2026-10-12 09:35:32 +08:00
jingyun 365fd2374e fix:补提iOS更新 2026-09-24 10:35:08 +08:00
jingyun 1eb7c3cdbb fix:更新三方插件 2026-09-24 10:05:34 +08:00
jingyun 4e730dbba8 fix:公共插件升级compileSdk 34到36 2026-09-20 14:12:11 +08:00
jingyun a3e9dfee66 fix:苹果对齐3.44.9iOS 模板的 2026-09-18 16:35:27 +08:00
jingyun a1819348d5 fix:升级 Flutter 3.44.9级相关插件 2026-09-18 11:04:29 +08:00
jingyun d364c6d908 fix:参考金值,研听,研值工程通用通用工程公共能力,重点对比网络请求、登录认证、状态管理、本地存储、WebView、推送、版本更新、一键登录、主题/UI 等模块,确定后续统一整改方案 2026-09-10 09:52:36 +08:00
jingyun 6997a65c96 fix:对齐金值,主要注销,一键登录等方面修改 2026-09-08 17:42:17 +08:00
jingyun e29ed0a2c8 fix:购买商品饰品 2026-09-08 14:27:32 +08:00
jingyun 1f9a8b67a2 fix:商城登录互通问题 2026-09-08 13:46:45 +08:00
jingyun 7b1852d9a6 fix:对齐金值的报名验证,商城入口逻辑对齐 2026-09-08 10:56:33 +08:00
jingyun 3b089e2205 feat: 对齐常驻商城与七鱼客服交互
- 同步商城 H5 登录态与原生 token
- 完善商城/原生 tab 切换、动画及返回交互
- 修复七鱼客服键盘避让和状态栏恢复
- 调整开屏跳过按钮与登录入口交互
2026-09-07 15:47:01 +08:00
jingyun b4343ea528 fix:app检测更新补充逻辑 2026-09-07 11:03:05 +08:00
jingyun 05e89b80bb fix:证书暂时用研听测试一键登录 2026-09-07 09:43:09 +08:00
jingyun 2a88320228 fix:热更新对比补充 2026-09-07 09:42:47 +08:00
jingyun b503cb7e6e fix:苹果一键登录页面,深浅色 2026-09-04 11:41:22 +08:00
jingyun afee4b5aec fix:推送权限弹窗时序问题 2026-09-01 15:03:27 +08:00
jingyun 33235f450b fix:第一轮跑 2026-08-24 19:07:31 +08:00
jingyun e834ec7586 fix:报错处理 2026-08-14 10:56:04 +08:00
jingyun c5653a3699 feat: align shared app foundations 2026-08-13 17:47:01 +08:00
jingyun bd6bb0ffce fix:优化和对齐版本 2026-08-13 17:17:52 +08:00
304 changed files with 15221 additions and 11562 deletions

No files matched your search

+7
View File
@@ -45,3 +45,10 @@ app.*.map.json
/android/app/debug /android/app/debug
/android/app/profile /android/app/profile
/android/app/release /android/app/release
/android/.kotlin/
# Release signing material and packaged runtime secrets are restored locally
# from the team's secure storage; never commit them.
/android/key.properties
/android/app/files/*.jks
/assets/env/.env
+33 -5
View File
@@ -1,9 +1,18 @@
.PHONY: runner run test lint apk ipa build-web .PHONY: runner run test lint apk ipa build-web rename_release_apk jinzhi_shorebird_android jinzhi_shorebird_ios jinzhi_shorebird_android_patch jinzhi_shorebird_ios_patch
WEB_API_URL ?= https://jinzhi.api.yqzhice.top WEB_API_URL ?= https://jinzhi.api.local
WEB_BASE_HREF ?= /flutter/ WEB_BASE_HREF ?= /flutter/
SHOREBIRD_TOKEN_FILE ?= $(HOME)/.shorebird_tokens/jinzhi.env
SHOREBIRD = if [ ! -f "$(SHOREBIRD_TOKEN_FILE)" ]; then echo "错误: 缺少 Shorebird token 文件: $(SHOREBIRD_TOKEN_FILE)"; exit 1; fi; set -a; . "$(SHOREBIRD_TOKEN_FILE)"; set +a; shorebird
GITVERSION := $(shell git describe --tags --always --dirty 2>/dev/null || git rev-parse --short HEAD) GITVERSION := $(shell git describe --tags --always --dirty 2>/dev/null || git rev-parse --short HEAD)
COMMON_DART_DEFINES := --dart-define=GITVERSION=$(GITVERSION) RELEASE_VERSION ?= latest
PATCH_TRACK ?= staging
COMMON_DART_DEFINES := --dart-define="GITVERSION=$(GITVERSION)"
APP_VERSION := $(shell sed -n 's/^version: *//p' pubspec.yaml | head -n 1)
APK_VERSION_NAME := $(subst .,,${word 1,$(subst +, ,$(APP_VERSION))})
APK_VERSION_CODE := $(word 2,$(subst +, ,$(APP_VERSION)))
RELEASE_APK := jinzhi-$(APK_VERSION_NAME)-$(APK_VERSION_CODE)-release.apk
RELEASE_APK_DIR := build/app/outputs/flutter-apk
runner: runner:
dart run build_runner build --delete-conflicting-outputs dart run build_runner build --delete-conflicting-outputs
@@ -18,10 +27,29 @@ lint:
flutter analyze flutter analyze
apk: apk:
flutter build apk $(COMMON_DART_DEFINES) --release --target-platform android-arm64 flutter build apk --obfuscate --split-debug-info=./build/symbos $(COMMON_DART_DEFINES) --release --target-platform android-arm64
$(MAKE) rename_release_apk
rename_release_apk:
@test -f "$(RELEASE_APK_DIR)/app-release.apk" || (echo "错误: 未找到 release APK: $(RELEASE_APK_DIR)/app-release.apk"; exit 1)
cp "$(RELEASE_APK_DIR)/app-release.apk" "$(RELEASE_APK_DIR)/$(RELEASE_APK)"
@echo "Release APK: $(RELEASE_APK_DIR)/$(RELEASE_APK)"
ipa: ipa:
flutter build ipa $(COMMON_DART_DEFINES) --release flutter build ipa --obfuscate --split-debug-info=./build/symbos $(COMMON_DART_DEFINES) --release
jinzhi_shorebird_android:
$(SHOREBIRD) release android --flutter-version=3.35.6 --split-debug-info=./build/symbos --target-platform android-arm64 --artifact apk -- --dart-define="GITVERSION=$(GITVERSION)"
$(MAKE) rename_release_apk
jinzhi_shorebird_ios:
$(SHOREBIRD) release ios --flutter-version=3.35.6 --split-debug-info=./build/symbos -- --dart-define="GITVERSION=$(GITVERSION)"
jinzhi_shorebird_android_patch:
$(SHOREBIRD) patch --platforms=android --release-version=$(RELEASE_VERSION) --split-debug-info=./build/symbos --track=$(PATCH_TRACK) -- --dart-define="GITVERSION=$(GITVERSION)"
jinzhi_shorebird_ios_patch:
$(SHOREBIRD) patch --platforms=ios --release-version=$(RELEASE_VERSION) --split-debug-info=./build/symbos --track=$(PATCH_TRACK) -- --dart-define="GITVERSION=$(GITVERSION)"
build-web: build-web:
API_BASE_URL=$(WEB_API_URL) BASE_HREF=$(WEB_BASE_HREF) bash scripts/build_web.sh API_BASE_URL=$(WEB_API_URL) BASE_HREF=$(WEB_BASE_HREF) bash scripts/build_web.sh
-2
View File
@@ -4,8 +4,6 @@ analyzer:
- "**/*.g.dart" - "**/*.g.dart"
- "lib/models/pb/**" - "lib/models/pb/**"
- "packages/**" - "packages/**"
plugins:
- custom_lint
linter: linter:
rules: rules:
prefer_const_constructors: true prefer_const_constructors: true
+46 -13
View File
@@ -2,8 +2,7 @@ import java.util.Properties
plugins { plugins {
id("com.android.application") id("com.android.application")
id("kotlin-android") // The Flutter Gradle Plugin must be applied after the Android plugin.
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id("dev.flutter.flutter-gradle-plugin") id("dev.flutter.flutter-gradle-plugin")
} }
@@ -14,6 +13,16 @@ if (!androidSigningPropertiesFile.isFile) {
} }
androidSigningPropertiesFile.inputStream().use { androidSigningProperties.load(it) } androidSigningPropertiesFile.inputStream().use { androidSigningProperties.load(it) }
val umengProperties = Properties()
val umengPropertiesFile = rootProject.file("../assets/env/.env")
if (umengPropertiesFile.isFile) {
umengPropertiesFile.inputStream().use { umengProperties.load(it) }
}
fun umengBuildValue(name: String): String =
System.getenv(name)?.takeIf { it.isNotBlank() }
?: umengProperties.getProperty(name)?.trim().orEmpty()
fun requireSigningProperty(name: String): String { fun requireSigningProperty(name: String): String {
val value = androidSigningProperties.getProperty(name)?.trim() val value = androidSigningProperties.getProperty(name)?.trim()
if (value.isNullOrBlank()) { if (value.isNullOrBlank()) {
@@ -24,11 +33,12 @@ fun requireSigningProperty(name: String): String {
android { android {
namespace = "com.jinzhi.butler" namespace = "com.jinzhi.butler"
compileSdk = flutter.compileSdkVersion // permission_handler and the current Android plugin set require API 37.
compileSdk = 37
ndkVersion = flutter.ndkVersion ndkVersion = flutter.ndkVersion
signingConfigs { signingConfigs {
create("release") { create("yanting") {
keyAlias = requireSigningProperty("keyAlias") keyAlias = requireSigningProperty("keyAlias")
keyPassword = requireSigningProperty("keyPassword") keyPassword = requireSigningProperty("keyPassword")
storeFile = file(requireSigningProperty("storeFile")) storeFile = file(requireSigningProperty("storeFile"))
@@ -37,16 +47,13 @@ android {
} }
compileOptions { compileOptions {
sourceCompatibility = JavaVersion.VERSION_11 sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
} }
defaultConfig { defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). // Keep the registered Jinzhi application identity. One-key login and
// push providers validate the package-and-certificate pair.
applicationId = "com.jinzhi.butler" applicationId = "com.jinzhi.butler"
// You can update the following values to match your application needs. // You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config. // For more information, see: https://flutter.dev/to/review-gradle-config.
@@ -55,17 +62,37 @@ android {
versionCode = flutter.versionCode versionCode = flutter.versionCode
versionName = flutter.versionName versionName = flutter.versionName
val umengChannel = System.getenv("UMENG_CHANNEL") ?: "" ndk {
abiFilters += "arm64-v8a"
}
val umengChannel = umengBuildValue("UMENG_CHANNEL").ifBlank { "test" }
manifestPlaceholders.putAll( manifestPlaceholders.putAll(
mutableMapOf( mutableMapOf(
"UMENG_CHANNEL" to umengChannel, "UMENG_CHANNEL" to umengChannel,
"UMENG_APPKEY" to umengBuildValue("UMENG_ANDROID_APP_KEY"),
"UMENG_MESSAGE_SECRET" to umengBuildValue("UMENG_ANDROID_PUSH_SECRET"),
"XIAOMI_APP_ID" to umengBuildValue("XIAOMI_APP_ID"),
"XIAOMI_APP_KEY" to umengBuildValue("XIAOMI_APP_KEY"),
"OPPO_APP_KEY" to umengBuildValue("OPPO_APP_KEY"),
"OPPO_APP_SECRET" to umengBuildValue("OPPO_APP_SECRET"),
"MEIZU_APP_ID" to umengBuildValue("MEIZU_APP_ID"),
"MEIZU_APP_KEY" to umengBuildValue("MEIZU_APP_KEY"),
"HUAWEI_APP_ID" to umengBuildValue("HUAWEI_APP_ID"),
"HONOR_APP_ID" to umengBuildValue("HONOR_APP_ID"),
"VIVO_APP_KEY" to umengBuildValue("VIVO_APP_KEY"),
"VIVO_APP_ID" to umengBuildValue("VIVO_APP_ID"),
) )
) )
} }
buildTypes { buildTypes {
debug {
// U-Verify validates the registered package-and-certificate pair.
signingConfig = signingConfigs.getByName("yanting")
}
release { release {
signingConfig = signingConfigs.getByName("release") signingConfig = signingConfigs.getByName("yanting")
proguardFiles( proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"), getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro", "proguard-rules.pro",
@@ -74,6 +101,12 @@ android {
} }
} }
kotlin {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
}
}
flutter { flutter {
source = "../.." source = "../.."
} }
Binary file not shown.
Binary file not shown.
+6 -6
View File
@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <manifest xmlns:android="http://schemas.android.com/apk/res/android"
<!-- The INTERNET permission is required for development. Specifically, xmlns:tools="http://schemas.android.com/tools">
the Flutter tool needs it to communicate with the running application <!-- Debug-only local API support. Release inherits false from main. -->
to allow setting breakpoints, to provide hot reload, etc. <application
--> android:usesCleartextTraffic="true"
<uses-permission android:name="android.permission.INTERNET"/> tools:replace="android:usesCleartextTraffic" />
</manifest> </manifest>
+34 -10
View File
@@ -1,19 +1,21 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" /> <uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.READ_MEDIA_VISUAL_USER_SELECTED" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" /> <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<!-- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />--> <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<!-- <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />-->
<application <application
android:label="金值" android:label="金值"
android:name="${applicationName}" android:name=".JinzhiApplication"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:usesCleartextTraffic="true"> android:usesCleartextTraffic="false"
tools:replace="android:usesCleartextTraffic">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:exported="true" android:exported="true"
@@ -35,6 +37,12 @@
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER"/>
</intent-filter> </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:scheme="jinzhi" />
</intent-filter>
</activity> </activity>
<!-- Don't delete the meta-data below. <!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --> This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
@@ -45,6 +53,22 @@
<meta-data <meta-data
android:name="UMENG_CHANNEL" android:name="UMENG_CHANNEL"
android:value="${UMENG_CHANNEL}" /> android:value="${UMENG_CHANNEL}" />
<meta-data
android:name="UMENG_APPKEY"
android:value="${UMENG_APPKEY}" />
<meta-data
android:name="UMENG_MESSAGE_SECRET"
android:value="${UMENG_MESSAGE_SECRET}" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/web_capture_paths" />
</provider>
</application> </application>
<!-- Required to query activities that can process text, see: <!-- Required to query activities that can process text, see:
@@ -0,0 +1,51 @@
package com.jinzhi.butler
import android.app.Activity
import android.content.pm.PackageManager
import android.os.Build
import android.view.View
import android.view.ViewTreeObserver
import com.umeng.commonsdk.UMConfigure
import io.flutter.app.FlutterApplication
/** Runs before Flutter so UMeng has no device collection before consent. */
class JinzhiApplication : FlutterApplication() {
override fun onCreate() {
super.onCreate()
@Suppress("DEPRECATION")
val metadata = packageManager.getApplicationInfo(
packageName,
PackageManager.GET_META_DATA,
).metaData
val appKey = metadata?.getString("UMENG_APPKEY")?.trim().orEmpty()
val channel = metadata?.getString("UMENG_CHANNEL")?.trim().orEmpty()
.ifBlank { "test" }
if (appKey.isNotBlank()) UMConfigure.preInit(this, appKey, channel)
registerActivityLifecycleCallbacks(OneKeyLoginButtonForceDarkGuard())
}
/** Aligns Android 10+ force-dark handling with Yanting's U-Verify page. */
private class OneKeyLoginButtonForceDarkGuard : ActivityLifecycleCallbacks {
override fun onActivityResumed(activity: Activity) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q ||
activity.javaClass.name != "com.mobile.auth.gatewayauth.LoginAuthActivity"
) return
val decor = activity.window.decorView
decor.viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
override fun onGlobalLayout() {
val id = activity.resources.getIdentifier("authsdk_login_view", "id", activity.packageName)
activity.findViewById<View>(id)?.let { button ->
button.isForceDarkAllowed = false
if (decor.viewTreeObserver.isAlive) decor.viewTreeObserver.removeOnGlobalLayoutListener(this)
}
}
})
}
override fun onActivityCreated(activity: Activity, state: android.os.Bundle?) = Unit
override fun onActivityStarted(activity: Activity) = Unit
override fun onActivityPaused(activity: Activity) = Unit
override fun onActivityStopped(activity: Activity) = Unit
override fun onActivitySaveInstanceState(activity: Activity, state: android.os.Bundle) = Unit
override fun onActivityDestroyed(activity: Activity) = Unit
}
}
@@ -1,5 +1,173 @@
package com.jinzhi.butler package com.jinzhi.butler
import android.app.Activity
import android.content.ActivityNotFoundException
import android.content.ClipData
import android.content.Intent
import android.net.Uri
import android.provider.MediaStore
import androidx.core.content.FileProvider
import com.umeng.commonsdk.UMConfigure
import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel
import java.io.File
class MainActivity : FlutterActivity() class MainActivity : FlutterActivity() {
companion object {
private const val WEB_FILE_PICKER_CHANNEL = "com.jinzhi.butler/web_file_picker"
private const val WEB_FILE_PICKER_REQUEST_CODE = 9814
}
private var pendingFilePickerResult: MethodChannel.Result? = null
private var pendingCapturedFile: File? = null
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, "jinzhi/privacy")
.setMethodCallHandler { call, result ->
if (call.method == "submitUmengPrivacyGranted") {
UMConfigure.submitPolicyGrantResult(applicationContext, true)
result.success(null)
} else {
result.notImplemented()
}
}
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, WEB_FILE_PICKER_CHANNEL)
.setMethodCallHandler { call, result ->
if (call.method != "pickFiles") {
result.notImplemented()
return@setMethodCallHandler
}
openWebFilePicker(call, result)
}
}
private fun openWebFilePicker(call: MethodCall, result: MethodChannel.Result) {
if (pendingFilePickerResult != null) {
result.error("picker_in_progress", "A file picker is already open.", null)
return
}
val acceptTypes = call.argument<List<String>>("acceptTypes")
.orEmpty().map(String::trim).filter(String::isNotEmpty).distinct()
val allowMultiple = call.argument<Boolean>("allowMultiple") ?: false
val captureEnabled = call.argument<Boolean>("captureEnabled") ?: false
val isQiyuSession = call.argument<Boolean>("isQiyuSession") ?: false
if (captureEnabled && !allowMultiple) {
captureIntentFor(acceptTypes)?.let { intent ->
pendingFilePickerResult = result
launchWebFilePicker(intent, result)
return
}
}
if (isQiyuSession && captureEnabled && isImageOrVideoRequest(acceptTypes)) {
val captureIntent = captureIntentFor(acceptTypes)
if (captureIntent != null) {
pendingFilePickerResult = result
val chooser = Intent.createChooser(
fileContentIntent(acceptTypes, allowMultiple),
"选择操作",
).putExtra(Intent.EXTRA_INITIAL_INTENTS, arrayOf(captureIntent))
launchWebFilePicker(chooser, result)
return
}
}
pendingFilePickerResult = result
launchWebFilePicker(
Intent.createChooser(fileContentIntent(acceptTypes, allowMultiple), "选择文件"),
result,
)
}
private fun fileContentIntent(acceptTypes: List<String>, allowMultiple: Boolean) =
Intent(Intent.ACTION_GET_CONTENT)
.addCategory(Intent.CATEGORY_OPENABLE)
.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, allowMultiple)
.apply {
if (acceptTypes.size == 1) type = acceptTypes.first()
else {
type = "*/*"
if (acceptTypes.isNotEmpty()) {
putExtra(Intent.EXTRA_MIME_TYPES, acceptTypes.toTypedArray())
}
}
}
private fun isImageOrVideoRequest(acceptTypes: List<String>): Boolean {
if (acceptTypes.isEmpty()) return false
val onlyImages = acceptTypes.all {
it.equals("image/*", ignoreCase = true) || it.startsWith("image/", ignoreCase = true)
}
val onlyVideos = acceptTypes.all {
it.equals("video/*", ignoreCase = true) || it.startsWith("video/", ignoreCase = true)
}
return onlyImages || onlyVideos
}
private fun captureIntentFor(acceptTypes: List<String>): Intent? {
val acceptsVideo = acceptTypes.any {
it.equals("video/*", ignoreCase = true) || it.startsWith("video/", ignoreCase = true)
}
val acceptsImage = acceptTypes.isEmpty() || acceptTypes.any {
it.equals("image/*", ignoreCase = true) || it.startsWith("image/", ignoreCase = true)
}
val action = when {
acceptsVideo && !acceptsImage -> MediaStore.ACTION_VIDEO_CAPTURE
acceptsImage -> MediaStore.ACTION_IMAGE_CAPTURE
else -> return null
}
val directory = File(cacheDir, "web_captures").apply { mkdirs() }
val suffix = if (action == MediaStore.ACTION_VIDEO_CAPTURE) ".mp4" else ".jpg"
val output = File.createTempFile("web_", suffix, directory)
val uri: Uri = FileProvider.getUriForFile(this, "$packageName.fileprovider", output)
pendingCapturedFile = output
return Intent(action)
.putExtra(MediaStore.EXTRA_OUTPUT, uri)
.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION or Intent.FLAG_GRANT_READ_URI_PERMISSION)
.apply { clipData = ClipData.newRawUri("web_capture", uri) }
}
private fun launchWebFilePicker(intent: Intent, result: MethodChannel.Result) {
try {
startActivityForResult(intent, WEB_FILE_PICKER_REQUEST_CODE)
} catch (_: ActivityNotFoundException) {
pendingFilePickerResult = null
pendingCapturedFile?.delete()
pendingCapturedFile = null
result.success(emptyList<String>())
}
}
@Deprecated("Deprecated in Android, retained for FlutterActivity compatibility")
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode != WEB_FILE_PICKER_REQUEST_CODE) return
val result = pendingFilePickerResult ?: return
pendingFilePickerResult = null
if (resultCode != Activity.RESULT_OK) {
pendingCapturedFile?.delete()
pendingCapturedFile = null
result.success(emptyList<String>())
return
}
val capturedFile = pendingCapturedFile
val hasCapturedFile = capturedFile?.length()?.let { it > 0L } == true
val uris = buildList {
if (hasCapturedFile) {
add(FileProvider.getUriForFile(
this@MainActivity, "$packageName.fileprovider", capturedFile!!,
).toString())
} else {
data?.data?.let { add(it.toString()) }
data?.clipData?.let { clip ->
for (index in 0 until clip.itemCount) add(clip.getItemAt(index).uri.toString())
}
}
}.distinct()
if (!hasCapturedFile) capturedFile?.delete()
pendingCapturedFile = null
result.success(uris)
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="52dp"
android:height="60dp"
android:viewportWidth="104"
android:viewportHeight="120">
<path
android:fillColor="#F7F7F7"
android:pathData="M31,48L15,60L31,72L36,67L27,61L43,61L43,53L27,53L36,53Z" />
</vector>
Binary file not shown.

After

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 751 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 B

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="52dp"
android:height="60dp"
android:viewportWidth="104"
android:viewportHeight="120">
<path
android:fillColor="#252529"
android:pathData="M31,48L15,60L31,72L36,67L27,61L43,61L43,53L27,53L36,53Z" />
</vector>
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<cache-path name="web_captures" path="web_captures/" />
</paths>
+38
View File
@@ -1,7 +1,13 @@
import com.android.build.api.dsl.LibraryExtension
allprojects { allprojects {
repositories { repositories {
google() google()
mavenCentral() mavenCentral()
maven("https://maven.aliyun.com/repository/public")
maven("https://maven.aliyun.com/repository/gradle-plugin")
maven("https://maven.aliyun.com/repository/google")
maven("https://developer.huawei.com/repo/")
} }
} }
@@ -19,6 +25,38 @@ subprojects {
project.evaluationDependsOn(":app") project.evaluationDependsOn(":app")
} }
// Partial shrinking is needed for the obfuscated one-key-login SDK. UMeng Push
// also runs an intermediate library shrinker with minSdk 14, which is not
// supported by partial shrinking. Let the app module remain the sole release
// shrinker (its minSdk is 24) and skip the redundant library minification.
subprojects {
if (name == "umeng_push_sdk") {
afterEvaluate {
extensions.configure<LibraryExtension> {
buildTypes {
getByName("release") {
isMinifyEnabled = false
}
}
}
}
}
}
// The Gitea U-Verify plugin still targets an older Android Gradle Plugin and
// declares only the manifest package. AGP 8 requires an explicit namespace;
// keep the dependency as a Git package and supply its published namespace here.
subprojects {
plugins.withId("com.android.library") {
if (project.name == "umeng_verify_sdk") {
val androidExtension = extensions.getByName("android")
androidExtension.javaClass
.getMethod("setNamespace", String::class.java)
.invoke(androidExtension, "com.umeng.umeng_verify_sdk")
}
}
}
tasks.register<Delete>("clean") { tasks.register<Delete>("clean") {
delete(rootProject.layout.buildDirectory) delete(rootProject.layout.buildDirectory)
} }
@@ -0,0 +1,663 @@
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<style type="text/css">
/*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */
html {
line-height: 1.15;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%
}
body {
margin: 0
}
article, aside, footer, header, nav, section {
display: block
}
h1 {
font-size: 2em;
margin: .67em 0
}
figcaption, figure, main {
display: block
}
figure {
margin: 1em 40px
}
hr {
box-sizing: content-box;
height: 0;
overflow: visible
}
pre {
font-family: monospace, monospace;
font-size: 1em
}
a {
background-color: transparent;
-webkit-text-decoration-skip: objects
}
abbr[title] {
border-bottom: none;
text-decoration: underline;
text-decoration: underline dotted
}
b, strong {
font-weight: inherit
}
b, strong {
font-weight: bolder
}
code, kbd, samp {
font-family: monospace, monospace;
font-size: 1em
}
dfn {
font-style: italic
}
mark {
background-color: #ff0;
color: #000
}
small {
font-size: 80%
}
sub, sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline
}
sub {
bottom: -.25em
}
sup {
top: -.5em
}
audio, video {
display: inline-block
}
audio:not([controls]) {
display: none;
height: 0
}
img {
border-style: none
}
svg:not(:root) {
overflow: hidden
}
button, input, optgroup, select, textarea {
font-family: sans-serif;
font-size: 100%;
line-height: 1.15;
margin: 0
}
button, input {
overflow: visible
}
button, select {
text-transform: none
}
[type=reset], [type=submit], button, html [type=button] {
-webkit-appearance: button
}
[type=button]::-moz-focus-inner, [type=reset]::-moz-focus-inner, [type=submit]::-moz-focus-inner, button::-moz-focus-inner {
border-style: none;
padding: 0
}
[type=button]:-moz-focusring, [type=reset]:-moz-focusring, [type=submit]:-moz-focusring, button:-moz-focusring {
outline: 1px dotted ButtonText
}
fieldset {
padding: .35em .75em .625em
}
legend {
box-sizing: border-box;
color: inherit;
display: table;
max-width: 100%;
padding: 0;
white-space: normal
}
progress {
display: inline-block;
vertical-align: baseline
}
textarea {
overflow: auto
}
[type=checkbox], [type=radio] {
box-sizing: border-box;
padding: 0
}
[type=number]::-webkit-inner-spin-button, [type=number]::-webkit-outer-spin-button {
height: auto
}
[type=search] {
-webkit-appearance: textfield;
outline-offset: -2px
}
[type=search]::-webkit-search-cancel-button, [type=search]::-webkit-search-decoration {
-webkit-appearance: none
}
::-webkit-file-upload-button {
-webkit-appearance: button;
font: inherit
}
details, menu {
display: block
}
summary {
display: list-item
}
canvas {
display: inline-block
}
template {
display: none
}
[hidden] {
display: none
}
/* configuration cache styles */
.report-wrapper {
margin: 0;
padding: 0 24px;
}
.gradle-logo {
width: 32px;
height: 24px;
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAYCAYAAACbU/80AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAIKADAAQAAAABAAAAGAAAAAA915G0AAAD5klEQVRIDbVWC0xTZxT+emmhVUEeA1/ROh/tFAFFGK7oJisIKsNVoOwBbJPowEWHzikRxeiMRpwwjDWRBHQLIzOmiRhe22BT40TitiyaMBQFfMEeLMIEaSmk+/+rvd7be4no6Elu7n++c/5zzv845/wyOyG4iGyDgzCdNOPLM9W41n4bnmNUiHo5DNsz0hGsmcV6lbkyAOOWXJjrz4qWp1C4o3z/LqzWL4VcJB1FIHmZHn/f78a6pDcxbeIEfNvQiPwTZbDZBpC24zOEaGfDpTsgtZby6u+QlrubFWUY3nh6AH39/ahr/Bn1jZfxW3ML2js60dtvgbtcQVblj8CZM7A0PBSrol6Ft+c4KZ8iTB1nwN0//8IEP9/hA2i924Gir0/iq8oa/NvbJzLiDKiUSqTE6pGVbEBY4BxnsYAPSnwXTa3tLCZ5BF3dPdAkGNHzoFcwcaRMnC4CeZkZiAgKFE252nITC1Pew9Dj5GNEGgS4Rbb5eZ1Te7UXG6FLX4cV6zeh5kIDaDpSunL9Boyf5nLOpwT4Sx+BxWrFK8QAnTAapPRQwofcj86uLoG59cbVEOzA0NAQNh38Atn5RSjY8rFAmc/I3dyQvOx1PsSNVy7Roa3ajHDePbBYLSLn1MaGd5KFAXy07xAOl59C6elK+I73hIHcbGd6wXs8qkyH8FZcjLOI5X/9/TrOnLsAldJDUu4As1NToFFPe3IEpm/M2HigwCFnU6t4Zw6Ck1JhGRhgcXq5juXloKyqFnlHirmz5CaNcEAv59kSE9wVikcB3O78A/MSU0Fznk/H9+yAetJEnPr+B8RFLsLcGS8ia28+qQuX+WrPNNZOV+Nc6VH4+3iz89g0pEaLzRUiQ3LGDWsM8Qidq2WL0PGKKlgf74ZIeQTAfFJ6a44WIsDXh9OW/dPdY58aawC9KK6kpOgolO7JxViVSuBGXnvxksudZ5F0O5yzGYxMJnBOGaau4fnPU2RNAtCFBKFoa7akczaAptY2iWmjB33+yQa4kZwfjpi2ex3Dyf43vuAljWQ/4Btmei1WPj+q45hF4U+1J4fEizCEvNf0EWHoIW244sfzoN1RipaT2kDfdjfv3MNpojdISjmfIheE8Fnp8WR9vJ2Zr+O+bYUmO+kJ9KnIUtf9bnvY2x9wcqrrvnCJvfL8Tw4V9v9LU7PdKzJaoNdy645AR4ph1JMncZHRKrVvYyYY5kmP8iO1v2T3dk6HDtYmrgJtOnwKnaPFrg8z+BBX7QSgEyOPJfX9Qd9DFs40GgTOHbrBs2ch4bXFuEG2mmFkeD9hpUMk+NMXEe0TNtsg/Ly94DVurEAuxfwHC1WiVbe0U7MAAAAASUVORK5CYII=");
background-size: contain;
}
.header {
display: flex;
flex-wrap: wrap;
position: fixed;
top: 0;
left: 0;
width: 100%;
padding: 24px 24px 0 24px;
background-color: white;
z-index: 1;
}
.learn-more {
margin-left: auto;
align-self: center;
font-size: 0.875rem;
font-weight: normal;
}
.title {
display: flex;
align-items: center;
padding: 18px 0 24px 0;
flex: 1 0 100%;
}
.content {
font-size: 0.875rem;
padding: 240px 0 48px;
overflow-x: auto;
white-space: nowrap;
}
.content ol:first-of-type {
margin: 0;
}
.tree-btn {
cursor: pointer;
display: inline-block;
width: 16px;
height: 16px;
background-size: contain;
background-repeat: no-repeat;
vertical-align: middle;
margin-top: -0.2em;
}
.tree-btn.collapsed {
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 192 512"><path d="M166.9 264.5l-117.8 116c-4.7 4.7-12.3 4.7-17 0l-7.1-7.1c-4.7-4.7-4.7-12.3 0-17L127.3 256 25.1 155.6c-4.7-4.7-4.7-12.3 0-17l7.1-7.1c4.7-4.7 12.3-4.7 17 0l117.8 116c4.6 4.7 4.6 12.3-.1 17z" fill="%23999999" stroke="%23999999"/></svg>');
}
.tree-btn.expanded {
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 512"><path d="M119.5 326.9L3.5 209.1c-4.7-4.7-4.7-12.3 0-17l7.1-7.1c4.7-4.7 12.3-4.7 17 0L128 287.3l100.4-102.2c4.7-4.7 12.3-4.7 17 0l7.1 7.1c4.7 4.7 4.7 12.3 0 17L136.5 327c-4.7 4.6-12.3 4.6-17-.1z" fill="%23999999" stroke="%23999999"/></svg>');
}
ul .tree-btn {
margin-right: 3px;
}
.leaf-icon {
display: inline-block;
width: 16px;
height: 16px;
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 512"><path d="M32 256 H224" stroke="%23999999" stroke-width="48" stroke-linecap="round"/></svg>');
background-size: contain;
background-repeat: no-repeat;
vertical-align: middle;
margin-top: -0.2em;
}
.invisible-text {
user-select: all; /* Allow the text to be selectable */
color: transparent; /* Hide the text */
text-indent: -9999px; /* Move the text out of view */
position: relative;
white-space: pre; /* Preserve meaningful whitespace in the invisible text for copying */
}
.text-for-copy {
display: inline-block;
}
.enum-icon {
display: inline-block;
width: 16px;
height: 16px;
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><circle cx="512" cy="512" r="200" /></svg>');
background-size: contain;
background-repeat: no-repeat;
vertical-align: middle;
margin-inline-start: 0.5ex;
margin-inline-end: 0.5ex;
margin-top: -0.2em;
}
.error-icon {
display: inline-block;
width: 16px;
height: 16px;
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M193.94 256L296.5 153.44l21.15-21.15c3.12-3.12 3.12-8.19 0-11.31l-22.63-22.63c-3.12-3.12-8.19-3.12-11.31 0L160 222.06 36.29 98.34c-3.12-3.12-8.19-3.12-11.31 0L2.34 120.97c-3.12 3.12-3.12 8.19 0 11.31L126.06 256 2.34 379.71c-3.12 3.12-3.12 8.19 0 11.31l22.63 22.63c3.12 3.12 8.19 3.12 11.31 0L160 289.94 262.56 392.5l21.15 21.15c3.12 3.12 8.19 3.12 11.31 0l22.63-22.63c3.12-3.12 3.12-8.19 0-11.31L193.94 256z" fill="%23FC461E" stroke="%23FC461E"/></svg>');
background-size: contain;
background-repeat: no-repeat;
vertical-align: middle;
margin-inline-start: 0.5ex;
margin-inline-end: 0.5ex;
margin-top: -0.2em;
}
.advice-icon {
display: inline-block;
width: 16px;
height: 16px;
background-image: url('data:image/svg+xml;utf8,<svg width="800px" height="800px" viewBox="-4.93 0 122.88 122.88" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="enable-background:new 0 0 113.01 122.88" xml:space="preserve"><g><path d="M44.13,102.06c-1.14,0.03-2.14-0.81-2.3-1.96c-0.17-1.2,0.64-2.31,1.82-2.54c-1.3-7.37-4.85-11.43-8.6-15.72 c-2.92-3.34-5.95-6.81-8.34-11.92c-2.35-5.03-3.64-10.23-3.6-15.63c0.05-5.4,1.42-10.96,4.4-16.71c0.02-0.04,0.04-0.07,0.06-0.11 l0,0c3.91-6.62,9.38-11.04,15.47-13.52c5.11-2.09,10.66-2.8,16.1-2.3c5.42,0.5,10.73,2.2,15.37,4.94 c5.9,3.49,10.75,8.67,13.42,15.21c1.44,3.54,2.42,7.49,2.54,11.82c0.12,4.31-0.62,8.96-2.61,13.88 c-2.66,6.59-6.18,10.68-9.47,14.51c-3.03,3.53-5.85,6.81-7.42,11.84c0.89,0.21,1.59,0.94,1.73,1.9c0.17,1.24-0.7,2.39-1.94,2.56 l-0.77,0.11c-0.14,1.09-0.23,2.26-0.27,3.51l0.25-0.04c1.24-0.17,2.39,0.7,2.56,1.94c0.17,1.24-0.7,2.39-1.94,2.56l-0.78,0.11 c0.01,0.15,0.02,0.3,0.03,0.45l0,0c0.07,0.88,0.08,1.73,0.03,2.54l0.13-0.02c1.25-0.15,2.38,0.74,2.54,1.98 c0.15,1.25-0.74,2.38-1.98,2.54l-1.68,0.21c-1.2,3.11-3.34,5.48-5.87,6.94c-1.74,1.01-3.67,1.59-5.61,1.71 c-1.97,0.12-3.96-0.25-5.78-1.13c-2.08-1.02-3.94-2.71-5.29-5.14c-0.65-0.33-1.13-0.97-1.23-1.75c-0.04-0.31-0.01-0.61,0.07-0.89 c-0.39-1.16-0.68-2.43-0.87-3.83l-0.07,0.01c-1.24,0.17-2.39-0.7-2.56-1.94c-0.17-1.24,0.7-2.39,1.94-2.56l0.54-0.08 C44.19,104.32,44.18,103.16,44.13,102.06L44.13,102.06z M2.18,58.86C1.01,58.89,0.04,57.98,0,56.81c-0.04-1.17,0.88-2.14,2.05-2.18 l8.7-0.3c1.17-0.04,2.14,0.88,2.18,2.05c0.04,1.17-0.88,2.14-2.05,2.18L2.18,58.86L2.18,58.86z M110.68,50.25 c1.16-0.12,2.2,0.73,2.32,1.89c0.12,1.16-0.73,2.2-1.89,2.32l-8.66,0.91c-1.16,0.12-2.2-0.73-2.32-1.89 c-0.12-1.16,0.73-2.2,1.89-2.32L110.68,50.25L110.68,50.25z M94.91,14.78c0.65-0.97,1.96-1.23,2.93-0.58 c0.97,0.65,1.23,1.96,0.58,2.93l-4.84,7.24c-0.65,0.97-1.96,1.23-2.93,0.58c-0.97-0.65-1.23-1.96-0.58-2.93L94.91,14.78 L94.91,14.78z M57.63,2.06c0.03-1.17,1-2.09,2.16-2.06c1.17,0.03,2.09,1,2.06,2.16l-0.22,8.7c-0.03,1.17-1,2.09-2.16,2.06 c-1.17-0.03-2.09-1-2.06-2.16L57.63,2.06L57.63,2.06z M13.88,15.53c-0.86-0.8-0.9-2.14-0.11-2.99c0.8-0.86,2.14-0.9,2.99-0.11 l6.37,5.94c0.86,0.8,0.9,2.14,0.11,2.99c-0.8,0.86-2.14,0.9-2.99,0.11L13.88,15.53L13.88,15.53z M47.88,96.95l18.49-2.63 c1.59-6.7,5.05-10.73,8.8-15.08c3.08-3.58,6.36-7.4,8.76-13.34c1.76-4.35,2.41-8.43,2.31-12.19c-0.1-3.75-0.96-7.21-2.24-10.34 c-2.3-5.63-6.51-10.11-11.65-13.15c-4.11-2.43-8.8-3.94-13.59-4.37c-4.77-0.44-9.64,0.19-14.13,2.02 c-5.26,2.15-9.99,5.97-13.39,11.72c-2.64,5.12-3.86,10.02-3.9,14.73c-0.04,4.74,1.11,9.33,3.2,13.8c2.13,4.56,4.97,7.8,7.69,10.92 C42.47,83.9,46.48,88.49,47.88,96.95L47.88,96.95z M65.62,99.02l-17.27,2.45c0.05,1.1,0.07,2.25,0.05,3.47l17.05-2.42 C65.47,101.29,65.52,100.12,65.62,99.02L65.62,99.02z M48.49,109.52c0.12,0.92,0.3,1.76,0.53,2.54l16.55-2.04 c0.11-0.86,0.13-1.77,0.05-2.74l0,0l0-0.02l-0.01-0.17L48.49,109.52L48.49,109.52z M51.37,116.36c0.64,0.67,1.35,1.19,2.1,1.55 c1.15,0.56,2.42,0.79,3.67,0.72c1.29-0.08,2.57-0.47,3.74-1.15c1.1-0.64,2.09-1.53,2.88-2.65L51.37,116.36L51.37,116.36z"/></g></svg>');
background-size: contain;
background-repeat: no-repeat;
vertical-align: middle;
margin-inline-start: 0.5ex;
margin-inline-end: 0.5ex;
margin-top: -0.2em;
}
.warning-icon {
display: inline-block;
width: 13px;
height: 13px;
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M270.2 160h35.5c3.4 0 6.1 2.8 6 6.2l-7.5 196c-.1 3.2-2.8 5.8-6 5.8h-20.5c-3.2 0-5.9-2.5-6-5.8l-7.5-196c-.1-3.4 2.6-6.2 6-6.2zM288 388c-15.5 0-28 12.5-28 28s12.5 28 28 28 28-12.5 28-28-12.5-28-28-28zm281.5 52L329.6 24c-18.4-32-64.7-32-83.2 0L6.5 440c-18.4 31.9 4.6 72 41.6 72H528c36.8 0 60-40 41.5-72zM528 480H48c-12.3 0-20-13.3-13.9-24l240-416c6.1-10.6 21.6-10.7 27.7 0l240 416c6.2 10.6-1.5 24-13.8 24z" fill="%23DEAD22" stroke="%23DEAD22"/></svg>');
background-size: contain;
background-repeat: no-repeat;
vertical-align: middle;
margin-inline-start: 0.3ex;
margin-inline-end: 1.1ex;
margin-top: -0.1em;
}
.documentation-button {
cursor: pointer;
display: inline-block;
width: 13px;
height: 13px;
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 340c-15.464 0-28 12.536-28 28s12.536 28 28 28 28-12.536 28-28-12.536-28-28-28zm7.67-24h-16c-6.627 0-12-5.373-12-12v-.381c0-70.343 77.44-63.619 77.44-107.408 0-20.016-17.761-40.211-57.44-40.211-29.144 0-44.265 9.649-59.211 28.692-3.908 4.98-11.054 5.995-16.248 2.376l-13.134-9.15c-5.625-3.919-6.86-11.771-2.645-17.177C185.658 133.514 210.842 116 255.67 116c52.32 0 97.44 29.751 97.44 80.211 0 67.414-77.44 63.849-77.44 107.408V304c0 6.627-5.373 12-12 12zM256 40c118.621 0 216 96.075 216 216 0 119.291-96.61 216-216 216-119.244 0-216-96.562-216-216 0-119.203 96.602-216 216-216m0-32C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8z" fill="%23999999" stroke="%23999999"/></svg>');
background-size: contain;
background-repeat: no-repeat;
vertical-align: middle;
margin-inline-start: 0.5ex;
margin-inline-end: 0.5ex;
margin-top: -0.2em;
}
.documentation-button::selection {
color: transparent;
}
.documentation-button:hover {
color: transparent;
}
.copy-button {
cursor: pointer;
display: inline-block;
width: 12px;
height: 12px;
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M433.941 193.941l-51.882-51.882A48 48 0 0 0 348.118 128H320V80c0-26.51-21.49-48-48-48h-66.752C198.643 13.377 180.858 0 160 0s-38.643 13.377-45.248 32H48C21.49 32 0 53.49 0 80v288c0 26.51 21.49 48 48 48h80v48c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48V227.882a48 48 0 0 0-14.059-33.941zm-22.627 22.627a15.888 15.888 0 0 1 4.195 7.432H352v-63.509a15.88 15.88 0 0 1 7.431 4.195l51.883 51.882zM160 30c9.941 0 18 8.059 18 18s-8.059 18-18 18-18-8.059-18-18 8.059-18 18-18zM48 384c-8.822 0-16-7.178-16-16V80c0-8.822 7.178-16 16-16h66.752c6.605 18.623 24.389 32 45.248 32s38.643-13.377 45.248-32H272c8.822 0 16 7.178 16 16v48H176c-26.51 0-48 21.49-48 48v208H48zm352 96H176c-8.822 0-16-7.178-16-16V176c0-8.822 7.178-16 16-16h144v72c0 13.2 10.8 24 24 24h72v208c0 8.822-7.178 16-16 16z" fill="%23999999" stroke="%23999999"/></svg>');
background-size: contain;
background-repeat: no-repeat;
vertical-align: middle;
margin-inline-start: 0.5ex;
margin-top: -0.2em;
}
.groups{
display: flex;
border-bottom: 1px solid #EDEEEF;
flex: 1 0 100%;
}
.uncategorized {
display: flex;
border-top: 4px solid #EDEEEF;
flex: 1 0 100%;
}
.group-selector {
padding: 0 52px 24px 0;
font-size: 0.9rem;
font-weight: bold;
color: #999999;
cursor: pointer;
}
.group-selector__count {
margin: 0 8px;
border-radius: 8px;
background-color: #999;
color: #fff;
padding: 1px 8px 2px;
font-size: 0.75rem;
}
.group-selector--active {
color: #02303A;
cursor: auto;
}
.group-selector--active .group-selector__count {
background-color: #686868;
}
.group-selector--disabled {
cursor: not-allowed;
}
.accordion-header {
cursor: pointer;
}
.container {
padding-left: 0.5em;
padding-right: 0.5em;
}
.stacktrace {
border-radius: 4px;
overflow-x: auto;
padding: 0.5rem;
margin-bottom: 0;
min-width: 1000px;
}
/* Lato (bold, regular) */
@font-face {
font-display: swap;
font-family: Lato;
font-weight: 500;
font-style: normal;
src: url("https://assets.gradle.com/lato/fonts/lato-semibold/lato-semibold.woff2") format("woff2"),
url("https://assets.gradle.com/lato/fonts/lato-semibold/lato-semibold.woff") format("woff");
}
@font-face {
font-display: swap;
font-family: Lato;
font-weight: bold;
font-style: normal;
src: url("https://assets.gradle.com/lato/fonts/lato-bold/lato-bold.woff2") format("woff2"),
url("https://assets.gradle.com/lato/fonts/lato-bold/lato-bold.woff") format("woff");
}
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
html,
body {
margin: 0;
padding: 0;
}
html {
font-family: "Lato", "Helvetica Neue", Arial, sans-serif;
font-size: 16px;
font-weight: 400;
line-height: 1.5;
}
body {
color: #02303A;
background-color: #ffffff;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
-webkit-font-smoothing: antialiased;
}
/* typography */
h1, h2, h3, h4, h5, h6 {
color: #02303A;
text-rendering: optimizeLegibility;
margin: 0;
}
h1 {
font-size: 1rem;
}
h2 {
font-size: 0.9rem;
}
h3 {
font-size: 1.125rem;
}
h4, h5, h6 {
font-size: 0.875rem;
}
h1 code {
font-weight: bold;
}
ul, ol, dl {
list-style-position: outside;
line-height: 1.6;
padding: 0;
margin: 0 0 0 20px;
list-style-type: none;
}
li {
line-height: 2;
}
a {
color: #1DA2BD;
text-decoration: none;
transition: all 0.3s ease, visibility 0s;
}
a:hover {
color: #35c1e4;
}
/* code */
code, pre {
font-family: Inconsolata, Monaco, "Courier New", monospace;
font-style: normal;
font-variant-ligatures: normal;
font-variant-caps: normal;
font-variant-numeric: normal;
font-variant-east-asian: normal;
font-weight: normal;
font-stretch: normal;
color: #686868;
}
*:not(pre) > code {
letter-spacing: 0;
padding: 0.1em 0.5ex;
text-rendering: optimizeSpeed;
word-spacing: -0.15em;
word-wrap: break-word;
}
pre {
font-size: 0.75rem;
line-height: 1.8;
margin-top: 0;
margin-bottom: 1.5em;
padding: 1rem;
}
pre code {
background-color: transparent;
color: inherit;
line-height: 1.8;
font-size: 100%;
padding: 0;
}
a code {
color: #1BA8CB;
}
pre.code, pre.programlisting, pre.screen, pre.tt {
background-color: #f7f7f8;
border-radius: 4px;
font-size: 1em;
line-height: 1.45;
margin-bottom: 1.25em;
overflow-x: auto;
padding: 1rem;
}
li em, p em {
padding: 0 1px;
}
code em, tt em {
text-decoration: none;
}
code + .copy-button {
margin-inline-start: 0.2ex;
}
.java-exception {
font-size: 0.75rem;
padding-left: 24px;
}
.java-exception ul {
margin: 0;
line-height: inherit;
}
.java-exception code {
white-space: pre;
}
.java-exception-part-toggle {
user-select: none;
cursor: pointer;
border-radius: 2px;
padding: 0.1em 0.2em;
background: azure;
color: #686868;
}
</style>
<!-- Inconsolata is used as a default monospace font in the report. -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inconsolata:400,700" />
<title>Gradle Configuration Cache</title>
</head>
<body>
<div id="playground"></div>
<div class="report" id="report">
Loading...
</div>
<script type="text/javascript">
function configurationCacheProblems() { return (
// begin-report-data
{"diagnostics":[{"locations":[{"path":"build file '/Users/mac/.pub-cache/git/flutter-packages-51fd4ba38d57fdc8fb23e744aa65bf2368878b7f/packages/android_id/android/build.gradle'","line":9},{"path":"build file '/Users/mac/.pub-cache/git/flutter-packages-51fd4ba38d57fdc8fb23e744aa65bf2368878b7f/packages/android_id/android/build.gradle'","line":9}],"problem":[{"text":"Space-assignment syntax in Groovy DSL has been deprecated."}],"severity":"WARNING","problemDetails":[{"text":"This is scheduled to be removed in Gradle 10.0."}],"contextualLabel":"Space-assignment syntax in Groovy DSL has been deprecated.","documentationLink":"https://docs.gradle.org/8.12/userguide/upgrading_version_8.html#groovy_space_assignment_syntax","problemId":[{"name":"deprecation","displayName":"Deprecation"},{"name":"space-assignment-syntax-in-groovy-dsl","displayName":"Space-assignment syntax in Groovy DSL has been deprecated."}],"solutions":[[{"text":"Use assignment ('url = <value>') instead."}]]},{"locations":[{"path":"build file '/Users/mac/.pub-cache/git/flutter-packages-51fd4ba38d57fdc8fb23e744aa65bf2368878b7f/packages/android_id/android/build.gradle'","line":22},{"path":"build file '/Users/mac/.pub-cache/git/flutter-packages-51fd4ba38d57fdc8fb23e744aa65bf2368878b7f/packages/android_id/android/build.gradle'","line":22}],"problem":[{"text":"Space-assignment syntax in Groovy DSL has been deprecated."}],"severity":"WARNING","problemDetails":[{"text":"This is scheduled to be removed in Gradle 10.0."}],"contextualLabel":"Space-assignment syntax in Groovy DSL has been deprecated.","documentationLink":"https://docs.gradle.org/8.12/userguide/upgrading_version_8.html#groovy_space_assignment_syntax","problemId":[{"name":"deprecation","displayName":"Deprecation"},{"name":"space-assignment-syntax-in-groovy-dsl","displayName":"Space-assignment syntax in Groovy DSL has been deprecated."}],"solutions":[[{"text":"Use assignment ('url = <value>') instead."}]]},{"locations":[{"path":"build file '/Users/mac/.pub-cache/git/flutter-packages-51fd4ba38d57fdc8fb23e744aa65bf2368878b7f/packages/android_oaid/android/build.gradle'","line":9},{"path":"build file '/Users/mac/.pub-cache/git/flutter-packages-51fd4ba38d57fdc8fb23e744aa65bf2368878b7f/packages/android_oaid/android/build.gradle'","line":9}],"problem":[{"text":"Space-assignment syntax in Groovy DSL has been deprecated."}],"severity":"WARNING","problemDetails":[{"text":"This is scheduled to be removed in Gradle 10.0."}],"contextualLabel":"Space-assignment syntax in Groovy DSL has been deprecated.","documentationLink":"https://docs.gradle.org/8.12/userguide/upgrading_version_8.html#groovy_space_assignment_syntax","problemId":[{"name":"deprecation","displayName":"Deprecation"},{"name":"space-assignment-syntax-in-groovy-dsl","displayName":"Space-assignment syntax in Groovy DSL has been deprecated."}],"solutions":[[{"text":"Use assignment ('url = <value>') instead."}]]},{"locations":[{"path":"build file '/Users/mac/.pub-cache/git/flutter-packages-51fd4ba38d57fdc8fb23e744aa65bf2368878b7f/packages/android_oaid/android/build.gradle'","line":22},{"path":"build file '/Users/mac/.pub-cache/git/flutter-packages-51fd4ba38d57fdc8fb23e744aa65bf2368878b7f/packages/android_oaid/android/build.gradle'","line":22}],"problem":[{"text":"Space-assignment syntax in Groovy DSL has been deprecated."}],"severity":"WARNING","problemDetails":[{"text":"This is scheduled to be removed in Gradle 10.0."}],"contextualLabel":"Space-assignment syntax in Groovy DSL has been deprecated.","documentationLink":"https://docs.gradle.org/8.12/userguide/upgrading_version_8.html#groovy_space_assignment_syntax","problemId":[{"name":"deprecation","displayName":"Deprecation"},{"name":"space-assignment-syntax-in-groovy-dsl","displayName":"Space-assignment syntax in Groovy DSL has been deprecated."}],"solutions":[[{"text":"Use assignment ('url = <value>') instead."}]]},{"locations":[{"path":"build file '/Users/mac/.pub-cache/hosted/pub.dev/device_info_plus-12.3.0/android/build.gradle'","line":1},{"path":"build file '/Users/mac/.pub-cache/hosted/pub.dev/device_info_plus-12.3.0/android/build.gradle'","line":1}],"problem":[{"text":"Space-assignment syntax in Groovy DSL has been deprecated."}],"severity":"WARNING","problemDetails":[{"text":"This is scheduled to be removed in Gradle 10.0."}],"contextualLabel":"Space-assignment syntax in Groovy DSL has been deprecated.","documentationLink":"https://docs.gradle.org/8.12/userguide/upgrading_version_8.html#groovy_space_assignment_syntax","problemId":[{"name":"deprecation","displayName":"Deprecation"},{"name":"space-assignment-syntax-in-groovy-dsl","displayName":"Space-assignment syntax in Groovy DSL has been deprecated."}],"solutions":[[{"text":"Use assignment ('group = <value>') instead."}]]},{"locations":[{"path":"build file '/Users/mac/.pub-cache/hosted/pub.dev/device_info_plus-12.3.0/android/build.gradle'","line":2},{"path":"build file '/Users/mac/.pub-cache/hosted/pub.dev/device_info_plus-12.3.0/android/bLine truncated
// end-report-data
);}
</script>
<script type="text/javascript">
!function(n,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["configuration-cache-report"]=t():n["configuration-cache-report"]=t()}(this,(()=>(({70:function(){void 0===ArrayBuffer.isView&&(ArrayBuffer.isView=function(n){return null!=n&&null!=n.__proto__&&n.__proto__.__proto__===Int8Array.prototype.__proto__}),void 0===Math.imul&&(Math.imul=function(n,t){return(4294901760&n)*(65535&t)+(65535&n)*(0|t)|0}),this["configuration-cache-report"]=function(n){"use strict";var t,r,i,e,u,o,f,s,c,a,h,l,_,v,d,g,w,b,p,m,k,y,q,B,C,x,j,P,I,S,z,E,T,L,N,A,M,F,D,O,R,H,$,G,U,V,Q,Z,Y,W,K,X,J,nn,tn,rn,en,un,on,fn,sn,cn,an,hn,ln,_n,vn,dn,gn,wn,bn,pn,mn,kn,yn,qn,Bn,Cn,xn,jn,Pn,In,Sn,zn=Math.imul,En=ArrayBuffer.isView;function Tn(n,t){if(!(t>=0))throw fu(ie("Requested element count "+t+" is less than zero."));return function(n,t){if(!(t>=0))throw fu(ie("Requested element count "+t+" is less than zero."));if(0===t)return pt();if(t>=n.length)return function(n){switch(n.length){case 0:return pt();case 1:return gr(n[0]);default:return function(n){return Ar(function(n){return new qt(n,!1)}(n))}(n)}}(n);if(1===t)return gr(n[0]);var r=0,i=Nr(),e=0,u=n.length;n:for(;e<u;){var o=n[e];if(e=e+1|0,i.d(o),(r=r+1|0)===t)break n}return i}(n,Wn(n.length-t|0,0))}function Ln(n,t,r,i,e,u,o){return t=t===A?", ":t,r=r===A?"":r,i=i===A?"":i,e=e===A?-1:e,u=u===A?"...":u,o=o===A?null:o,function(n,t,r,i,e,u,o,f){r=r===A?", ":r,i=i===A?"":i,e=e===A?"":e,u=u===A?-1:u,o=o===A?"...":o,f=f===A?null:f,t.e(i);var s=0,c=0,a=n.length;n:for(;c<a;){var h=n[c];if(c=c+1|0,(s=s+1|0)>1&&t.e(r),!(u<0||s<=u))break n;Qt(t,h,f)}return u>=0&&s>u&&t.e(o),t.e(e),t}(n,bi(),t,r,i,e,u,o).toString()}function Nn(n){return n.length-1|0}function An(n,t){if(null==t){var r=0,i=n.length-1|0;if(r<=i)do{var e=r;if(r=r+1|0,null==n[e])return e}while(r<=i)}else{var u=0,o=n.length-1|0;if(u<=o)do{var f=u;if(u=u+1|0,oe(t,n[f]))return f}while(u<=o)}return-1}function Mn(n,t,r,i,e,u,o){return t=t===A?", ":t,r=r===A?"":r,i=i===A?"":i,e=e===A?-1:e,u=u===A?"...":u,o=o===A?null:o,Fn(n,bi(),t,r,i,e,u,o).toString()}function Fn(n,t,r,i,e,u,o,f){r=r===A?", ":r,i=i===A?"":i,e=e===A?"":e,u=u===A?-1:u,o=o===A?"...":o,f=f===A?null:f,t.e(i);var s=0,c=n.f();n:for(;c.g();){var a=c.h();if((s=s+1|0)>1&&t.e(r),!(u<0||s<=u))break n;Qt(t,a,f)}return u>=0&&s>u&&t.e(o),t.e(e),t}function Dn(n){if(n.i())throw mu("List is empty.");return n.j(0)}function On(n){return new Yn(n)}function Rn(n){if(Ue(n,Ti)){var t;switch(n.k()){case 0:t=pt();break;case 1:t=gr(Ue(n,Ei)?n.j(0):n.f().h());break;default:t=Hn(n)}return t}return mt(Vn(n))}function Hn(n){return Ar(n)}function $n(n){if(Ue(n,Ti)&&n.k()<=1)return Rn(n);var t=Vn(n);return function(n){var t=(n.k()/2|0)-1|0;if(t<0)return lr();var r=kt(n),i=0;if(i<=t)do{var e=i;i=i+1|0;var u=n.j(e);n.f4(e,n.j(r)),n.f4(r,u),r=r-1|0}while(e!==t)}(t),t}function Gn(n,t){if(!(t>=0))throw fu(ie("Requested element count "+t+" is less than zero."));return function(n,t){if(!(t>=0))throw fu(ie("Requested element count "+t+" is less than zero."));if(0===t)return pt();if(Ue(n,Ti)){if(t>=n.k())return Rn(n);if(1===t)return gr(function(n){if(Ue(n,Ei))return Dn(n);var t=n.f();if(!t.g())throw mu("Collection is empty.");return t.h()}(n))}var r=0,i=Nr(),e=n.f();n:for(;e.g();){var u=e.h();if(i.d(u),(r=r+1|0)===t)break n}return mt(i)}(n,Wn(n.k()-t|0,0))}function Un(n,t){if(!(t>=0))throw fu(ie("Requested element count "+t+" is less than zero."));if(0===t)return pt();var r=n.k();if(t>=r)return Rn(n);if(1===t)return gr(Qn(n));var i=Nr();if(Ue(n,li)){var e=r-t|0;if(e<r)do{var u=e;e=e+1|0,i.d(n.j(u))}while(e<r)}else for(var o=n.l(r-t|0);o.g();){var f=o.h();i.d(f)}return i}function Vn(n){return Ue(n,Ti)?Hn(n):Zn(n,Lr())}function Qn(n){if(n.i())throw mu("List is empty.");return n.j(kt(n))}function Zn(n,t){for(var r=n.f();r.g();){var i=r.h();t.d(i)}return t}function Yn(n){this.n_1=n}function Wn(n,t){return n<t?t:n}function Kn(n,t){return n>t?t:n}function Xn(n,t){return Ut().q(n,t,-1)}function Jn(n,t){return new Et(n,t)}function nt(n){var t=n.f();if(!t.g())return pt();var r=t.h();if(!t.g())return gr(r);var i=Lr();for(i.d(r);t.g();)i.d(t.h());return i}function tt(n){this.r_1=n}function rt(n,t){this.s_1=n,this.t_1=t}function it(){}function et(n){this.x_1=n,this.w_1=0}function ut(n,t){this.a1_1=n,et.call(this,n),ft().b1(t,this.a1_1.k()),this.w_1=t}function ot(){t=this}function ft(){return null==t&&new ot,t}function st(){ft(),it.call(this)}function ct(n){this.h1_1=n}function at(n,t){return t===n?"(this Map)":Oi(t)}function ht(n,t){var r;n:{for(var i=n.o().f();i.g();){var e=i.h();if(oe(e.j1(),t)){r=e;break n}}r=null}return r}function lt(){r=this}function _t(){return null==r&&new lt,r}function vt(n){this.q1_1=n,it.call(this)}function dt(){_t(),this.n1_1=null,this.o1_1=null}function gt(){i=this}function wt(){return null==i&&new gt,i}function bt(n){return n.length>0?nu(n):pt()}function pt(){return null==e&&nLine truncated
//# sourceMappingURL=configuration-cache-report.js.map
</script>
</body>
</html>
+12
View File
@@ -1,3 +1,15 @@
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
# This builtInKotlin flag was added automatically by Flutter migrator
android.builtInKotlin=false
# This newDsl flag was added automatically by Flutter migrator
android.newDsl=false
# AGP 9.0.1 predates API 37 but builds against it correctly; suppress its
# informational compatibility warning until Flutter ships a newer AGP template.
android.suppressUnsupportedCompileSdk=37,37.0
# U-Verify ships obfuscated verification bytecode that AGP 9/R8 cannot fully
# analyse. Keep app shrinking enabled, but route this vendor SDK family through
# D8 just as the verified reference project does.
systemProp.com.android.tools.r8.experimentalPartialShrinkingIncludePatterns=**
systemProp.com.android.tools.r8.experimentalPartialShrinkingExcludePatterns=com.mobile.auth.**,com.nirvana.**,com.cmic.**,com.umeng.umverify.**,com.unicom.**,com.a.a.**
+1 -1
View File
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-all.zip
-4
View File
@@ -1,4 +0,0 @@
storePassword=jinzhi123
keyPassword=jinzhi123
keyAlias=jinzhi
storeFile=files/jinzhi.jks
+2 -2
View File
@@ -19,8 +19,8 @@ pluginManagement {
plugins { plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0" id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "8.9.1" apply false id("com.android.application") version "9.0.1" apply false
id("org.jetbrains.kotlin.android") version "2.1.0" apply false id("org.jetbrains.kotlin.android") version "2.3.20" apply false
} }
include(":app") include(":app")
-6
View File
@@ -1,6 +0,0 @@
# .env file
# UMENG keys for Muzhi environment (replace with actual keys later)
UMENG_ANDROID_APP_KEY=6a27b1f46f259537c7b616be
UMENG_IOS_APP_KEY=6a27b24e6f259537c7b617a8
UMENG_ANDROID_PUSH_SECRET=xxx
# UMENG_CHANNEL is usually set via build flavors or defaults, but can be here if needed.
@@ -0,0 +1,6 @@
<svg preserveAspectRatio="none" overflow="visible" style="display: block;" width="20" height="26.9924" viewBox="0 0 20 26.9924" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="&#232;&#163;&#133;&#233;&#165;&#176;&#230;&#152;&#159;&#230;&#152;&#159;">
<path id="Vector" d="M7.7027 26.5261L8.41064 24.9055C9.02993 23.4731 10.1634 22.3247 11.5875 21.6867L13.5356 20.8223C14.1548 20.5473 14.1548 19.6467 13.5356 19.3709L11.6488 18.534C10.1882 17.879 9.03458 16.6885 8.42596 15.2079L7.70835 13.4808C7.65191 13.3389 7.55418 13.2173 7.42782 13.1315C7.30147 13.0458 7.15229 13 6.9996 13C6.84691 13 6.69773 13.0458 6.57137 13.1315C6.44501 13.2173 6.34729 13.3389 6.29085 13.4808L5.57404 15.2079C4.96542 16.6885 3.81184 17.879 2.35121 18.534L0.464436 19.3717C-0.154812 19.6459 -0.154812 20.5473 0.464436 20.8223L2.41168 21.6867C3.83568 22.3245 4.9691 23.4726 5.58855 24.9047L6.29649 26.5253C6.35471 26.6638 6.45248 26.7819 6.57756 26.865C6.70263 26.9481 6.84944 26.9924 6.9996 26.9924C7.14975 26.9924 7.29656 26.9481 7.42164 26.865C7.54671 26.7819 7.64448 26.6646 7.7027 26.5261Z" fill="white"/>
<path id="Vector_2" d="M16.4666 7.6867L16.7133 7.12119C17.1465 6.12115 17.9381 5.31928 18.9324 4.87314L19.6918 4.53443C19.7838 4.49211 19.8617 4.4243 19.9163 4.33903C19.971 4.25376 20 4.15462 20 4.05335C20 3.95208 19.971 3.85294 19.9163 3.76767C19.8617 3.6824 19.7838 3.61459 19.6918 3.57226L18.9754 3.25354C17.9551 2.79573 17.1494 1.9639 16.7243 0.929556L16.4706 0.319085C16.433 0.224921 16.3681 0.144177 16.2842 0.0872928C16.2003 0.0304083 16.1013 0 16 0C15.8986 0 15.7996 0.0304083 15.7157 0.0872928C15.6318 0.144177 15.5669 0.224921 15.5294 0.319085L15.2756 0.928557C14.8507 1.96328 14.045 2.7955 13.0245 3.25354L12.3072 3.57327C12.2154 3.61571 12.1378 3.68351 12.0833 3.76867C12.0289 3.85383 12 3.95278 12 4.05385C12 4.15491 12.0289 4.25387 12.0833 4.33903C12.1378 4.42419 12.2154 4.49199 12.3072 4.53443L13.0665 4.87214C14.0614 5.31832 14.8533 6.1206 15.2866 7.12119L15.5334 7.6867C15.7132 8.10034 16.2867 8.10034 16.4666 7.6867Z" fill="white"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

@@ -0,0 +1,7 @@
<svg preserveAspectRatio="none" overflow="visible" style="display: block;" width="72" height="64" viewBox="0 0 72 64" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="Frame">
<path id="Vector" d="M52 35.0088V49.0088C52 49.5393 51.7893 50.048 51.4142 50.4231C51.0391 50.7981 50.5304 51.0088 50 51.0088H22C21.4696 51.0088 20.9609 50.7981 20.5858 50.4231C20.2107 50.048 20 49.5393 20 49.0088V35.0088H52ZM41 13.0088C42.181 13.0086 43.3429 13.3072 44.3775 13.8768C45.4121 14.4464 46.2858 15.2685 46.9171 16.2666C47.5485 17.2647 47.9171 18.4063 47.9886 19.5851C48.0601 20.764 47.8322 21.9418 47.326 23.0088H54C54.5304 23.0088 55.0391 23.2196 55.4142 23.5946C55.7893 23.9697 56 24.4784 56 25.0088V31.0088C56 31.5393 55.7893 32.048 55.4142 32.4231C55.0391 32.7981 54.5304 33.0088 54 33.0088H18C17.4696 33.0088 16.9609 32.7981 16.5858 32.4231C16.2107 32.048 16 31.5393 16 31.0088V25.0088C16 24.4784 16.2107 23.9697 16.5858 23.5946C16.9609 23.2196 17.4696 23.0088 18 23.0088H24.674C23.9615 21.5122 23.8033 19.8113 24.2274 18.2088C24.6515 16.6064 25.6306 15.2065 26.9902 14.2583C28.3498 13.3102 30.0018 12.8752 31.6521 13.031C33.3023 13.1867 34.8438 13.923 36.002 15.1088C36.6522 14.4423 37.4296 13.9129 38.2881 13.5522C39.1466 13.1915 40.0688 13.0067 41 13.0088ZM31 17.0088C30.2294 17.0087 29.4883 17.3051 28.9303 17.8366C28.3723 18.3681 28.0403 19.094 28.003 19.8637C27.9657 20.6334 28.226 21.3879 28.73 21.9709C29.234 22.5538 29.943 22.9205 30.71 22.9948L31 23.0088H34V20.0088C34 19.2631 33.7222 18.5441 33.2208 17.992C32.7194 17.44 32.0303 17.0944 31.288 17.0228L31 17.0088ZM41 17.0088L40.71 17.0228C40.0178 17.0901 39.3704 17.3957 38.8786 17.8875C38.3869 18.3793 38.0812 19.0266 38.014 19.7188L38 20.0088V23.0088H41L41.288 22.9948C42.0301 22.9229 42.7187 22.5772 43.2198 22.0252C43.7209 21.4732 43.9985 20.7544 43.9985 20.0088C43.9985 19.2633 43.7209 18.5445 43.2198 17.9925C42.7187 17.4404 42.0301 17.0948 41.288 17.0228L41 17.0088Z" fill="black"/>
<path id="Vector_2" d="M7.36867 18.1835L7.954 16.8435C8.46603 15.6592 9.40317 14.7097 10.5807 14.1822L12.1913 13.4675C12.7033 13.2402 12.7033 12.4955 12.1913 12.2675L10.6313 11.5755C9.42367 11.034 8.46988 10.0497 7.96667 8.82555L7.37333 7.39755C7.32667 7.28024 7.24587 7.17964 7.1414 7.10877C7.03692 7.03789 6.91358 7 6.78733 7C6.66109 7 6.53775 7.03789 6.43327 7.10877C6.3288 7.17964 6.248 7.28024 6.20133 7.39755L5.60867 8.82555C5.10546 10.0497 4.15166 11.034 2.944 11.5755L1.384 12.2682C0.872 12.4949 0.872 13.2402 1.384 13.4675L2.994 14.1822C4.17138 14.7096 5.1085 15.6588 5.62067 16.8429L6.206 18.1829C6.25414 18.2973 6.33497 18.395 6.43839 18.4637C6.5418 18.5324 6.66319 18.569 6.78733 18.569C6.91148 18.569 7.03287 18.5324 7.13628 18.4637C7.23969 18.395 7.32053 18.298 7.36867 18.1835Z" fill="black"/>
<path id="Vector_3" d="M65.9606 51.2578L66.2899 50.5031C66.868 49.1686 67.9243 48.0985 69.2512 47.5031L70.2646 47.0512C70.3873 46.9947 70.4914 46.9042 70.5643 46.7904C70.6372 46.6766 70.6759 46.5443 70.6759 46.4092C70.6759 46.274 70.6372 46.1417 70.5643 46.0279C70.4914 45.9141 70.3873 45.8236 70.2646 45.7671L69.3086 45.3418C67.947 44.7309 66.8718 43.6208 66.3046 42.2405L65.9659 41.4258C65.9158 41.3002 65.8292 41.1924 65.7173 41.1165C65.6053 41.0406 65.4732 41 65.3379 41C65.2026 41 65.0705 41.0406 64.9585 41.1165C64.8466 41.1924 64.76 41.3002 64.7099 41.4258L64.3712 42.2391C63.8043 43.62 62.729 44.7306 61.3672 45.3418L60.4099 45.7685C60.2875 45.8251 60.1839 45.9156 60.1112 46.0292C60.0386 46.1429 60 46.2749 60 46.4098C60 46.5447 60.0386 46.6767 60.1112 46.7904C60.1839 46.904 60.2875 46.9945 60.4099 47.0512L61.4232 47.5018C62.7509 48.0972 63.8077 49.1679 64.3859 50.5031L64.7152 51.2578C64.9552 51.8098 65.7206 51.8098 65.9606 51.2578Z" fill="black"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.6 KiB

@@ -0,0 +1,3 @@
<svg preserveAspectRatio="none" overflow="visible" style="display: block;" width="18" height="16" viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path id="Vector 1" d="M8.74286 16L0 0H18L8.74286 16Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 243 B

-20
View File
@@ -1,20 +0,0 @@
应用名称:
金值
iOS平台
Bundle ID
公钥
证书SHA-1指纹
Android
包名:
com.jinzhi.butler
MD5:
bf875d2980f09f3acca3614b10aa0463
公钥(16进制)
a61ce1268140ae32cd7aeb43dfb2324a1bb04aba5c7cd5879e6f3b3e052f926ef80b9eccfc53b057a6a01d7dadf573ac19bf4bcfa9c4296fae20a0e1f4f598685321e4b3767bbc3a98d6afd056a522194528c3df1fed3872c697c49bc40fdc963071018ec644233e19e78bae9d3b5e5925e925322c5211f12fb079aa19464abd44bb782d81a30cc55c1b090f691d18aeb73beb26a710f45bb31a605ccf6519fe17e03130666e787bd2de0ceb8fd4bb66f2fd706af34db7840a504da090bb37f50e06153a84c3215ab1e6cbbb225b681baa84d90f97f1e245664d3fb6a1072506f4ba0548a4c28d84b239ed8500b0eb914bd3585565658e964317b48c0d84791b
签名证书SHA-1指纹
70 A8 9B 61 BE 5C 51 0A B8 42 78 2A FE 66 3A 4D 55 B9 10 4F
+1 -1
View File
@@ -21,6 +21,6 @@
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1.0</string> <string>1.0</string>
<key>MinimumOSVersion</key> <key>MinimumOSVersion</key>
<string>13.0</string> <string>15.0</string>
</dict> </dict>
</plist> </plist>
+5 -4
View File
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project # Uncomment this line to define a global platform for your project
# platform :ios, '13.0' platform :ios, '15.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency. # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true' ENV['COCOAPODS_DISABLE_STATS'] = 'true'
@@ -39,12 +39,13 @@ end
post_install do |installer| post_install do |installer|
installer.pods_project.targets.each do |target| installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target) flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config| target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.0'
# 对齐研听:permission_handler 的通知策略默认不编译,必须显式开启;
# 否则 Permission.notification.request() 是空实现,iOS 不会有系统通知项。
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [ config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)', '$(inherited)',
'PERMISSION_CAMERA=1', 'PERMISSION_NOTIFICATIONS=1',
'PERMISSION_PHOTOS=1',
] ]
end end
end end
+44 -107
View File
@@ -1,125 +1,62 @@
PODS: PODS:
- device_info_plus (0.0.1):
- Flutter
- Flutter (1.0.0) - Flutter (1.0.0)
- flutter_native_splash (2.4.3): - UMCCommonLog (2.0.2)
- UMCommon (7.6.4):
- UMDevice
- UMDevice (3.6.0)
- umeng_common_sdk (0.0.1):
- Flutter - Flutter
- flutter_paid (0.0.1): - UMCommon
- UMDevice
- umeng_push_sdk (0.0.1):
- Flutter - Flutter
- flutter_secure_storage_darwin (10.0.0): - UMCCommonLog
- UMCommon
- UMDevice
- UMPush
- umeng_verify_sdk (2.1.0):
- Flutter - Flutter
- FlutterMacOS - UMVerify (>= 3.3.0)
- fluttertoast (0.0.2): - UMPush (4.1.4):
- Flutter - UMCommon
- gal (1.0.0): - UMVerify (4.0.0):
- Flutter - UMCommon
- FlutterMacOS
- image_picker_ios (0.0.1):
- Flutter
- package_info_plus (0.4.5):
- Flutter
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- permission_handler_apple (9.4.8):
- Flutter
- photo_manager (3.9.0):
- Flutter
- FlutterMacOS
- platform_metadata (0.0.1):
- Flutter
- share_plus (0.0.1):
- Flutter
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- sqflite_darwin (0.0.4):
- Flutter
- FlutterMacOS
- url_launcher_ios (0.0.1):
- Flutter
- video_player_avfoundation (0.0.1):
- Flutter
- FlutterMacOS
DEPENDENCIES: DEPENDENCIES:
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- Flutter (from `Flutter`) - Flutter (from `Flutter`)
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`) - umeng_common_sdk (from `.symlinks/plugins/umeng_common_sdk/ios`)
- flutter_paid (from `.symlinks/plugins/flutter_paid/ios`) - umeng_push_sdk (from `.symlinks/plugins/umeng_push_sdk/ios`)
- flutter_secure_storage_darwin (from `.symlinks/plugins/flutter_secure_storage_darwin/darwin`) - umeng_verify_sdk (from `.symlinks/plugins/umeng_verify_sdk/ios`)
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
- gal (from `.symlinks/plugins/gal/darwin`) SPEC REPOS:
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) trunk:
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) - UMCCommonLog
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) - UMCommon
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) - UMDevice
- photo_manager (from `.symlinks/plugins/photo_manager/darwin`) - UMPush
- platform_metadata (from `.symlinks/plugins/platform_metadata/ios`) - UMVerify
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/darwin`)
EXTERNAL SOURCES: EXTERNAL SOURCES:
device_info_plus:
:path: ".symlinks/plugins/device_info_plus/ios"
Flutter: Flutter:
:path: Flutter :path: Flutter
flutter_native_splash: umeng_common_sdk:
:path: ".symlinks/plugins/flutter_native_splash/ios" :path: ".symlinks/plugins/umeng_common_sdk/ios"
flutter_paid: umeng_push_sdk:
:path: ".symlinks/plugins/flutter_paid/ios" :path: ".symlinks/plugins/umeng_push_sdk/ios"
flutter_secure_storage_darwin: umeng_verify_sdk:
:path: ".symlinks/plugins/flutter_secure_storage_darwin/darwin" :path: ".symlinks/plugins/umeng_verify_sdk/ios"
fluttertoast:
:path: ".symlinks/plugins/fluttertoast/ios"
gal:
:path: ".symlinks/plugins/gal/darwin"
image_picker_ios:
:path: ".symlinks/plugins/image_picker_ios/ios"
package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
permission_handler_apple:
:path: ".symlinks/plugins/permission_handler_apple/ios"
photo_manager:
:path: ".symlinks/plugins/photo_manager/darwin"
platform_metadata:
:path: ".symlinks/plugins/platform_metadata/ios"
share_plus:
:path: ".symlinks/plugins/share_plus/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
sqflite_darwin:
:path: ".symlinks/plugins/sqflite_darwin/darwin"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
video_player_avfoundation:
:path: ".symlinks/plugins/video_player_avfoundation/darwin"
SPEC CHECKSUMS: SPEC CHECKSUMS:
device_info_plus: 21fcca2080fbcd348be798aa36c3e5ed849eefbe
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467 Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
flutter_native_splash: c32d145d68aeda5502d5f543ee38c192065986cf UMCCommonLog: bea707e50c85cef4b0eb47cc5c7226bb843245ca
flutter_paid: 6055d15f439071fefb849e3cebc279915ed70db5 UMCommon: 001691e59cb7961ec21d3312687499c8516dddc6
flutter_secure_storage_darwin: acdb3f316ed05a3e68f856e0353b133eec373a23 UMDevice: 20b7b3c37a36b2c5c7ca8b5a54386ff9ed2b3b19
fluttertoast: 2c67e14dce98bbdb200df9e1acf610d7a6264ea1 umeng_common_sdk: 095b63e6f83b71548725a7c03a6c17b23be6674b
gal: baecd024ebfd13c441269ca7404792a7152fde89 umeng_push_sdk: 557ebb6834df105bd828b86eeb8ae0b80959ee79
image_picker_ios: e0ece4aa2a75771a7de3fa735d26d90817041326 umeng_verify_sdk: 64a823bd4528bf46c40759c613d6ab34935b8293
package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499 UMPush: e9e81f259799b2b238ee21cc152e4cea31909604
path_provider_foundation: bb55f6dbba17d0dccd6737fe6f7f34fbd0376880 UMVerify: d961ffe2e4b9f00ad578c373e420ad17f72a1f7c
permission_handler_apple: 92d754bbaa7361d436db2d6c3c1c2a0fdcec462e
photo_manager: 25fd77df14f4f0ba5ef99e2c61814dde77e2bceb
platform_metadata: a4d1e9569219bb2dcbb54510554611df032ea023
share_plus: 50da8cb520a8f0f65671c6c6a99b3617ed10a58a
shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb
sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0
url_launcher_ios: 7a95fa5b60cc718a708b8f2966718e93db0cef1b
video_player_avfoundation: dd410b52df6d2466a42d28550e33e4146928280a
PODFILE CHECKSUM: b6c30c22d7ac3adf21bf40601823fcf685f5b3d6 PODFILE CHECKSUM: c5e833ba06eec2784e07140760ce1599fc8e3bfc
COCOAPODS: 1.16.2 COCOAPODS: 1.16.2
+57 -44
View File
@@ -12,6 +12,8 @@
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
7884E8682EC3CC0700C636F2 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7884E8672EC3CC0400C636F2 /* SceneDelegate.swift */; };
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; };
7F35478B9E4F74858F78DFCF /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C52A653951E0B42558DD134A /* Pods_Runner.framework */; }; 7F35478B9E4F74858F78DFCF /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C52A653951E0B42558DD134A /* Pods_Runner.framework */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
@@ -53,6 +55,8 @@
738C53128F0E1E92C051CFBA /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; }; 738C53128F0E1E92C051CFBA /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7884E8672EC3CC0400C636F2 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
8EB9610D6597FC7A482D1606 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = "<group>"; }; 8EB9610D6597FC7A482D1606 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
@@ -80,6 +84,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */,
7F35478B9E4F74858F78DFCF /* Pods_Runner.framework in Frameworks */, 7F35478B9E4F74858F78DFCF /* Pods_Runner.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
@@ -107,6 +112,7 @@
9740EEB11CF90186004384FC /* Flutter */ = { 9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */,
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
9740EEB21CF90195004384FC /* Debug.xcconfig */, 9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
@@ -146,6 +152,7 @@
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
7884E8672EC3CC0400C636F2 /* SceneDelegate.swift */,
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
); );
path = Runner; path = Runner;
@@ -197,14 +204,16 @@
97C146EC1CF9000F007C117D /* Resources */, 97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */, 9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
38380B0F0A71332BD02F1E6B /* [CP] Embed Pods Frameworks */, 90B1F719ECC32B8C9ADF27D1 /* [CP] Copy Pods Resources */,
EA4FE8E3948A035FEE08B35D /* [CP] Copy Pods Resources */,
); );
buildRules = ( buildRules = (
); );
dependencies = ( dependencies = (
); );
name = Runner; name = Runner;
packageProductDependencies = (
78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */,
);
productName = Runner; productName = Runner;
productReference = 97C146EE1CF9000F007C117D /* Runner.app */; productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
productType = "com.apple.product-type.application"; productType = "com.apple.product-type.application";
@@ -238,6 +247,9 @@
Base, Base,
); );
mainGroup = 97C146E51CF9000F007C117D; mainGroup = 97C146E51CF9000F007C117D;
packageReferences = (
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */,
);
productRefGroup = 97C146EF1CF9000F007C117D /* Products */; productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
projectDirPath = ""; projectDirPath = "";
projectRoot = ""; projectRoot = "";
@@ -292,23 +304,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
38380B0F0A71332BD02F1E6B /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1; alwaysOutOfDate = 1;
@@ -347,22 +342,7 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
9740EEB61CF901F6004384FC /* Run Script */ = { 90B1F719ECC32B8C9ADF27D1 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
EA4FE8E3948A035FEE08B35D /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
@@ -379,6 +359,21 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */
@@ -395,6 +390,7 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
7884E8682EC3CC0700C636F2 /* SceneDelegate.swift in Sources */,
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
@@ -472,7 +468,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0; IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos; SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos; SUPPORTED_PLATFORMS = iphoneos;
@@ -487,17 +483,18 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = F38D68G8T6; DEVELOPMENT_TEAM = 3QMFZJWPLS;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
PRODUCT_BUNDLE_IDENTIFIER = com.jinzhi.app; PRODUCT_BUNDLE_IDENTIFIER = com.jinzhi.butler;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -605,7 +602,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0; IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = YES; MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos; SDKROOT = iphoneos;
@@ -656,7 +653,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0; IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos; SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos; SUPPORTED_PLATFORMS = iphoneos;
@@ -673,17 +670,18 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = F38D68G8T6; DEVELOPMENT_TEAM = 3QMFZJWPLS;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
PRODUCT_BUNDLE_IDENTIFIER = com.jinzhi.app; PRODUCT_BUNDLE_IDENTIFIER = com.jinzhi.butler;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -699,17 +697,18 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = F38D68G8T6; DEVELOPMENT_TEAM = 3QMFZJWPLS;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
PRODUCT_BUNDLE_IDENTIFIER = com.jinzhi.app; PRODUCT_BUNDLE_IDENTIFIER = com.jinzhi.butler;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -752,6 +751,20 @@
defaultConfigurationName = Release; defaultConfigurationName = Release;
}; };
/* End XCConfigurationList section */ /* End XCConfigurationList section */
/* Begin XCLocalSwiftPackageReference section */
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */ = {
isa = XCLocalSwiftPackageReference;
relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage;
};
/* End XCLocalSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */
78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = {
isa = XCSwiftPackageProductDependency;
productName = FlutterGeneratedPluginSwiftPackage;
};
/* End XCSwiftPackageProductDependency section */
}; };
rootObject = 97C146E61CF9000F007C117D /* Project object */; rootObject = 97C146E61CF9000F007C117D /* Project object */;
} }
@@ -5,6 +5,24 @@
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"> buildImplicitDependencies = "YES">
<PreActions>
<ExecutionAction
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent
title = "Run Prepare Flutter Framework Script"
scriptText = "/bin/sh &quot;$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh&quot; prepare&#10;">
<EnvironmentBuildable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</EnvironmentBuildable>
</ActionContent>
</ExecutionAction>
</PreActions>
<BuildActionEntries> <BuildActionEntries>
<BuildActionEntry <BuildActionEntry
buildForTesting = "YES" buildForTesting = "YES"
+5 -2
View File
@@ -2,12 +2,15 @@ import Flutter
import UIKit import UIKit
@main @main
@objc class AppDelegate: FlutterAppDelegate { @objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate {
override func application( override func application(
_ application: UIApplication, _ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool { ) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions) return super.application(application, didFinishLaunchingWithOptions: launchOptions)
} }
func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) {
GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry)
}
} }
@@ -0,0 +1 @@
{"images":[{"filename":"jinzhi_onetap_back.png","idiom":"universal","scale":"1x"},{"idiom":"universal","scale":"2x"},{"idiom":"universal","scale":"3x"}],"info":{"author":"xcode","version":1}}
Binary file not shown.

After

Width:  |  Height:  |  Size: 394 B

@@ -0,0 +1,8 @@
{
"images" : [
{ "filename" : "jinzhi_onetap_back_day.png", "idiom" : "universal", "scale" : "1x" },
{ "filename" : "jinzhi_onetap_back_day@2x.png", "idiom" : "universal", "scale" : "2x" },
{ "filename" : "jinzhi_onetap_back_day@3x.png", "idiom" : "universal", "scale" : "3x" }
],
"info" : { "author" : "xcode", "version" : 1 }
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

@@ -0,0 +1,8 @@
{
"images" : [
{ "filename" : "jinzhi_onetap_back_night.png", "idiom" : "universal", "scale" : "1x" },
{ "filename" : "jinzhi_onetap_back_night@2x.png", "idiom" : "universal", "scale" : "2x" },
{ "filename" : "jinzhi_onetap_back_night@3x.png", "idiom" : "universal", "scale" : "3x" }
],
"info" : { "author" : "xcode", "version" : 1 }
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 598 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

@@ -0,0 +1,8 @@
{
"images" : [
{ "filename" : "jinzhi_onetap_button.png", "idiom" : "universal", "scale" : "1x" },
{ "filename" : "jinzhi_onetap_button@2x.png", "idiom" : "universal", "scale" : "2x" },
{ "filename" : "jinzhi_onetap_button@3x.png", "idiom" : "universal", "scale" : "3x" }
],
"info" : { "author" : "xcode", "version" : 1 }
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

@@ -0,0 +1,8 @@
{
"images" : [
{ "filename" : "jinzhi_onetap_button_pressed.png", "idiom" : "universal", "scale" : "1x" },
{ "filename" : "jinzhi_onetap_button_pressed@2x.png", "idiom" : "universal", "scale" : "2x" },
{ "filename" : "jinzhi_onetap_button_pressed@3x.png", "idiom" : "universal", "scale" : "3x" }
],
"info" : { "author" : "xcode", "version" : 1 }
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

@@ -0,0 +1 @@
{"images":[{"filename":"jinzhi_onetap_checked.png","idiom":"universal","scale":"1x"},{"idiom":"universal","scale":"2x"},{"idiom":"universal","scale":"3x"}],"info":{"author":"xcode","version":1}}
Binary file not shown.

After

Width:  |  Height:  |  Size: 479 B

@@ -0,0 +1 @@
{"images":[{"filename":"jinzhi_onetap_unchecked.png","idiom":"universal","scale":"1x"},{"idiom":"universal","scale":"2x"},{"idiom":"universal","scale":"3x"}],"info":{"author":"xcode","version":1}}
Binary file not shown.

After

Width:  |  Height:  |  Size: 369 B

+44 -10
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CADisableMinimumFrameDurationOnPhone</key> <key>CADisableMinimumFrameDurationOnPhone</key>
<true/> <true/>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
@@ -22,10 +22,40 @@
<string>$(FLUTTER_BUILD_NAME)</string> <string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>jinzhi</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string> <string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneClassName</key>
<string>UIWindowScene</string>
<key>UISceneConfigurationName</key>
<string>flutter</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict>
<key>NSAppTransportSecurity</key> <key>NSAppTransportSecurity</key>
<dict> <dict>
<key>NSAllowsArbitraryLoads</key> <key>NSAllowsArbitraryLoads</key>
@@ -33,12 +63,24 @@
<key>NSAllowsArbitraryLoadsInWebContent</key> <key>NSAllowsArbitraryLoadsInWebContent</key>
<true/> <true/>
</dict> </dict>
<key>NSCameraUsageDescription</key>
<string>用于在商城客服中拍摄图片或视频并发送给客服。</string>
<key>NSMicrophoneUsageDescription</key>
<string>用于在商城客服中录制语音或视频并发送给客服。</string>
<key>NSUserTrackingUsageDescription</key>
<string>用于衡量广告投放效果并提供更相关的内容。</string>
<key>UIApplicationSupportsIndirectInputEvents</key> <key>UIApplicationSupportsIndirectInputEvents</key>
<true/> <true/>
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key> <key>UILaunchStoryboardName</key>
<string>LaunchScreen</string> <string>LaunchScreen</string>
<key>UIMainStoryboardFile</key> <key>UIMainStoryboardFile</key>
<string>Main</string> <string>Main</string>
<key>UIStatusBarHidden</key>
<true/>
<key>UISupportedInterfaceOrientations</key> <key>UISupportedInterfaceOrientations</key>
<array> <array>
<string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortrait</string>
@@ -52,15 +94,7 @@
<string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string> <string>UIInterfaceOrientationLandscapeRight</string>
</array> </array>
<key>UIStatusBarHidden</key>
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false/>
<key>NSCameraUsageDescription</key> </dict>
<string>用于为贵金属持仓添加发票、证书及实物照片。</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>用于为贵金属持仓添加发票、证书及实物照片。</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>用于为贵金属持仓添加发票、证书及实物照片。</string>
</dict>
</plist> </plist>
@@ -2,7 +2,7 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>IDEDidComputeMac32BitWarning</key> <key>aps-environment</key>
<true/> <string>$(APS_ENVIRONMENT)</string>
</dict> </dict>
</plist> </plist>
+4
View File
@@ -0,0 +1,4 @@
import Flutter
import UIKit
class SceneDelegate: FlutterSceneDelegate {}
+125 -18
View File
@@ -1,34 +1,142 @@
import 'dart:async';
import 'package:app_links/app_links.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shadcn_ui/shadcn_ui.dart'; import 'package:shadcn_ui/shadcn_ui.dart';
import '../common/router/app_router.dart'; import '../common/router/app_router.dart';
import '../common/lifecycle/refresh_coordinator.dart';
import '../common/push/device_push_registrar.dart';
import '../common/push/umeng_push_service.dart';
import '../common/theme/jinzhi_theme.dart'; import '../common/theme/jinzhi_theme.dart';
import '../common/theme/spacing.dart'; import '../common/theme/spacing.dart';
import '../common/theme/theme_controller.dart'; import '../common/theme/theme_controller.dart';
import '../common/widgets/smart_refresh.dart'; import '../features/ads/application/ad_config_foreground_refresher.dart';
import '../features/settings/application/update_foreground_service.dart';
import '../features/web/application/mall_web_host_controller.dart';
import '../features/auth/application/auth_controller.dart';
import '../features/auth/application/auth_session_coordinator.dart';
import '../features/auth/data/auth_models.dart';
import '../features/assets/application/asset_portfolio_controller.dart';
import '../common/router/deep_link_service.dart';
import '../common/services/device_header_service.dart';
class JinzhiApp extends ConsumerWidget { class JinzhiApp extends ConsumerStatefulWidget {
const JinzhiApp({super.key}); const JinzhiApp({super.key});
@override @override
Widget build(BuildContext context, WidgetRef ref) { ConsumerState<JinzhiApp> createState() => _JinzhiAppState();
}
class _JinzhiAppState extends ConsumerState<JinzhiApp>
with WidgetsBindingObserver {
late final DevicePushRegistrar _pushRegistrar;
ProviderSubscription<AsyncValue<AuthState>>? _authSubscription;
StreamSubscription<Uri>? _appLinkSubscription;
late final SessionEndListener _sessionEndListener;
@override
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
_pushRegistrar = DevicePushRegistrar(ref.read)..start();
_sessionEndListener = (reason) {
if (reason == SessionEndReason.accountDeleted) {
ref.read(assetPortfolioControllerProvider.notifier).clearHoldings();
}
};
ref.read(authSessionCoordinatorProvider).addListener(_sessionEndListener);
_authSubscription = ref.listenManual<AsyncValue<AuthState>>(authProvider, (
previous,
next,
) {
final oldUser = previous?.value is LoggedInAuthState
? (previous!.value! as LoggedInAuthState).user.id
: null;
final newUser = next.value is LoggedInAuthState
? (next.value! as LoggedInAuthState).user.id
: null;
if (oldUser != newUser) _pushRegistrar.forceRegisterCurrentToken();
DeepLinkService.notifyAuthChanged();
});
UmengPushService.configureNotificationOpen(DeepLinkService.handle);
unawaited(_startAppLinks());
WidgetsBinding.instance.addPostFrameCallback((_) {
DeepLinkService.attachRouter((location) {
final context = rootNavigatorKey.currentContext;
if (context == null) return false;
context.go(location);
return true;
}, authGuard: (_) => !ref.read(authProvider).isLoading);
// 首次 iOS 启动在欢迎页点击进入后才注册 APNs,确保系统弹窗不被启动页
// 或其他 Overlay 吞掉;后续启动和 Android 保持原有自动初始化。
if (!DeviceHeaderService.to.iosStartupRequired) {
unawaited(UmengPushService.startIfAllowed());
}
});
}
Future<void> _startAppLinks() async {
try {
final appLinks = AppLinks();
final initial = await appLinks.getInitialLink();
if (initial != null) DeepLinkService.handleUri(initial);
_appLinkSubscription = appLinks.uriLinkStream.listen(
DeepLinkService.handleUri,
onError: (_) {},
);
} catch (_) {
// Desktop tests and unsupported platforms may not register the plugin.
}
}
@override
void dispose() {
unawaited(_pushRegistrar.stop());
_authSubscription?.close();
ref
.read(authSessionCoordinatorProvider)
.removeListener(_sessionEndListener);
unawaited(_appLinkSubscription?.cancel());
DeepLinkService.detachRouter();
WidgetsBinding.instance.removeObserver(this);
super.dispose();
}
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
if (state == AppLifecycleState.resumed) {
unawaited(_pushRegistrar.refresh());
unawaited(
ref
.read(adConfigForegroundRefresherProvider)
.refresh(
refreshMallTabConfig:
!MallWebHostController.instance.state.value.visible,
),
);
final context = rootNavigatorKey.currentContext;
if (context != null) {
unawaited(UpdateForegroundService.check(context, ref));
}
}
}
@override
Widget build(BuildContext context) {
// Keep the app-wide foreground refresh coordinator alive. Features opt in
// by registering only while their screen is visible.
ref.watch(refreshCoordinatorProvider);
final router = ref.watch(routerProvider); final router = ref.watch(routerProvider);
final mode = ref.watch(themeModeControllerProvider); final mode = ref.watch(themeModeControllerProvider);
final textTheme = ShadTextTheme(); // DM Sans 作主字体(拉丁/数字),中文走系统级联(iOS 苹方 / Android 厂商
return RefreshConfiguration( // 中文字体)——主流做法,不显式点名、不内置字体。
springDescription: const SpringDescription( final dmSansFamily = GoogleFonts.dmSans().fontFamily;
mass: 1, final textTheme = ShadTextTheme(family: dmSansFamily);
stiffness: 364.718677686, return ShadApp.router(
damping: 35.2,
),
headerBuilder: () => const MaterialClassicHeader(),
footerBuilder: () => jinzhiClassicFooter,
hideFooterWhenNotFull: true,
headerTriggerDistance: 60,
maxOverScrollExtent: 100,
child: ShadApp.router(
title: '金值', title: '金值',
themeMode: mode, themeMode: mode,
theme: ShadThemeData( theme: ShadThemeData(
@@ -44,7 +152,6 @@ class JinzhiApp extends ConsumerWidget {
radius: BorderRadius.circular(Spacing.radiusBase), radius: BorderRadius.circular(Spacing.radiusBase),
), ),
routerConfig: router, routerConfig: router,
),
); );
} }
} }
+11 -4
View File
@@ -1,14 +1,20 @@
import 'dart:async';
import 'dart:io' show Platform; import 'dart:io' show Platform;
import 'package:flutter/foundation.dart' show kIsWeb; import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import '../common/services/device_header_service.dart'; import '../common/services/device_header_service.dart';
import '../common/config/shorebird_service.dart';
import '../common/config/umeng_config.dart';
import '../common/storage/storage_service.dart'; import '../common/storage/storage_service.dart';
import '../common/widgets/easy_refresh_localization.dart';
import 'app.dart'; import 'app.dart';
Future<Widget> bootstrap() async { Future<Widget> bootstrap() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
configureEasyRefreshChineseLocalization();
await UmengConfig.load();
await StorageService.instance; await StorageService.instance;
if (!kIsWeb) { if (!kIsWeb) {
if (Platform.isAndroid) { if (Platform.isAndroid) {
@@ -19,9 +25,10 @@ Future<Widget> bootstrap() async {
await DeviceHeaderService.to.ensureInitialized(); await DeviceHeaderService.to.ensureInitialized();
} }
} }
// if (!kIsWeb) { if (!kIsWeb) {
// await ShorebirdService.instance.initCurrentPatch(); // Shorebird's native updater performs the automatic launch-time update.
// ShorebirdService.instance.checkForUpdateInBackground(); // Reading the running patch is diagnostic state and must not delay startup.
// } unawaited(ShorebirdService.instance.initCurrentPatch());
}
return const JinzhiApp(); return const JinzhiApp();
} }
+4
View File
@@ -4,7 +4,11 @@ class AppConfig {
factory AppConfig.fromEnvironment() { factory AppConfig.fromEnvironment() {
const url = String.fromEnvironment( const url = String.fromEnvironment(
'JINZHI_API_BASE_URL', 'JINZHI_API_BASE_URL',
// defaultValue: 'http://localhost:8088',
// defaultValue: 'https://jince.api.xianlin88.top',
defaultValue: 'https://jinzhi.api.yqzhice.top', defaultValue: 'https://jinzhi.api.yqzhice.top',
// defaultValue: 'http://8.153.17.57',可测试ip
); );
return const AppConfig(apiBaseUrl: url); return const AppConfig(apiBaseUrl: url);
} }
+11 -1
View File
@@ -6,7 +6,12 @@ class UmengConfig {
static String _androidAppKey = static String _androidAppKey =
'6a27b1f46f259537c7b616be'; // Default placeholder '6a27b1f46f259537c7b616be'; // Default placeholder
static String _iosAppKey = '6a27b24e6f259537c7b617a8'; // Default placeholder static String _iosAppKey = '6a27b24e6f259537c7b617a8'; // Default placeholder
static String _androidPushSecret = 'xxx'; // Default placeholder static String _androidPushSecret =
'261fc7656f0c34f4cf122a3c2c81f704'; // Default placeholder
static String _androidLoginSecret =
'oNaEhNEwZGQHvngXI4kyxR90tavJRDHMyDDQhkQouty+SAUb66szdNQivqE99ZIQO+QyNabsyyTJ7CN8iA3vb8EgPwLF/iSUHMWpGVacHpukG1sqySo1cwbRmDpOFcdNzaO8PavGfqkkCse/oRPNFBW40LhCjSJaI/roAEVNGpepMXvufJtjnyB4OX6sav+isHU/Lsz84bcdwnzD6fFyDSyE+YqN9gjUoUOv8Ghcy3H1FXUMvw4iD9nD+tE4jODLXvvzlpVbHYknn6Y2UAj5dvGvNUszocXqGAr4j3z8naKPBhz7Liofog==';
static String _iosLoginSecret =
'vcutZmDFJ2HBdFk7herCz2M9dPHuoa303NPGrm8c9gkzu/Lr5njFa85y33w7htgp0cx9JCMbsk3ecrREhVd8yeq73kFFiVqgkk/BMzCQ6VG55gSATEoiRaLnqXkKvuv6X4kcnSqANMI07up5rTPdAtVQ5JGPh9ts7LUBzRZWQRnDvdX8pjPy8LKxXJKoNagz4sHd5m9MbX0o0uep2OaFFFBTOyI+g4vjK1oZkpaUnIKGU8cTH+wvL8qwp5BLtkc6XCXe5PXqClU=';
static Future<void> load() async { static Future<void> load() async {
await dotenv.load( await dotenv.load(
@@ -17,9 +22,14 @@ class UmengConfig {
_iosAppKey = dotenv.env['UMENG_IOS_APP_KEY'] ?? _iosAppKey; _iosAppKey = dotenv.env['UMENG_IOS_APP_KEY'] ?? _iosAppKey;
_androidPushSecret = _androidPushSecret =
dotenv.env['UMENG_ANDROID_PUSH_SECRET'] ?? _androidPushSecret; dotenv.env['UMENG_ANDROID_PUSH_SECRET'] ?? _androidPushSecret;
_androidLoginSecret =
dotenv.env['UMENG_ANDROID_LOGIN_SECRET'] ?? _androidLoginSecret;
_iosLoginSecret = dotenv.env['UMENG_IOS_LOGIN_SECRET'] ?? _iosLoginSecret;
} }
static String get androidAppKey => _androidAppKey; static String get androidAppKey => _androidAppKey;
static String get iosAppKey => _iosAppKey; static String get iosAppKey => _iosAppKey;
static String get androidPushSecret => _androidPushSecret; static String get androidPushSecret => _androidPushSecret;
static String get androidLoginSecret => _androidLoginSecret;
static String get iosLoginSecret => _iosLoginSecret;
} }
@@ -0,0 +1,84 @@
import 'dart:async';
import 'package:flutter/widgets.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
typedef RefreshCallback = FutureOr<void> Function();
/// Coordinates safe refresh points without owning any feature data.
///
/// A screen registers its callback while it is visible. Registered callbacks
/// run when the app returns to the foreground; callers can also request a
/// manual refresh through the returned handle.
class RefreshCoordinator with WidgetsBindingObserver {
RefreshCoordinator() {
WidgetsBinding.instance.addObserver(this);
}
final Set<_RefreshRegistration> _registrations = {};
AppLifecycleState _lifecycleState = AppLifecycleState.resumed;
bool get isForeground => _lifecycleState == AppLifecycleState.resumed;
RefreshRegistration register({
required RefreshCallback onRefresh,
bool active = true,
}) {
final registration = _RefreshRegistration(onRefresh, active);
_registrations.add(registration);
return RefreshRegistration._(this, registration);
}
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
_lifecycleState = state;
if (state == AppLifecycleState.resumed) refreshVisible();
}
void refreshVisible() {
for (final registration in _registrations) {
if (registration.active) unawaited(_run(registration));
}
}
Future<void> _run(_RefreshRegistration registration) async {
try {
await registration.onRefresh();
} catch (_) {
// Refresh failures belong to the owning feature's state/UI.
}
}
void dispose() {
WidgetsBinding.instance.removeObserver(this);
_registrations.clear();
}
}
class RefreshRegistration {
RefreshRegistration._(this._coordinator, this._registration);
final RefreshCoordinator _coordinator;
final _RefreshRegistration _registration;
bool get active => _registration.active;
set active(bool value) => _registration.active = value;
void refreshNow() => _coordinator._run(_registration);
void dispose() => _coordinator._registrations.remove(_registration);
}
class _RefreshRegistration {
_RefreshRegistration(this.onRefresh, this.active);
final RefreshCallback onRefresh;
bool active;
}
final refreshCoordinatorProvider = Provider<RefreshCoordinator>((ref) {
final coordinator = RefreshCoordinator();
ref.onDispose(coordinator.dispose);
return coordinator;
});
+13 -9
View File
@@ -1,20 +1,24 @@
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'api_exception.dart';
String? kratosReason(Object e) { String? kratosReason(Object e) {
if (e is! DioException) return null; if (e is DioException || e is ApiException || e is FormatException) {
final body = e.response?.data; return ApiException.from(e).reason;
if (body is Map && body['reason'] is String) return body['reason'] as String; }
return null; return null;
} }
String kratosDisplayMessage(Object e, {required String fallback}) { String kratosDisplayMessage(Object e, {required String fallback}) {
if (kratosReason(e) == 'INTERNAL_ERROR') return fallback; if (kratosReason(e) == 'INTERNAL_ERROR') return fallback;
if (e is DioException) { final exception = ApiException.from(e);
final body = e.response?.data; if (exception.serverMessage case final message? when message.isNotEmpty) {
if (body is Map && body['message'] is String) { return message;
final m = body['message'] as String;
if (m.isNotEmpty) return m;
}
} }
return fallback; return fallback;
} }
abstract final class ErrorMessageMapper {
static String message(Object error, {required String fallback}) =>
kratosDisplayMessage(error, fallback: fallback);
}
+123
View File
@@ -0,0 +1,123 @@
import 'package:dio/dio.dart';
import '../../models/pb/errors/errors.pb.dart' as kerrors;
enum ApiExceptionKind { transport, http, backend, decode, cancelled }
/// The single network failure shape exposed to application code.
class ApiException implements Exception {
const ApiException({
required this.kind,
this.httpStatus,
this.backendCode,
this.reason,
this.serverMessage,
this.requestOptions,
this.cause,
});
final ApiExceptionKind kind;
final int? httpStatus;
final int? backendCode;
final String? reason;
final String? serverMessage;
final RequestOptions? requestOptions;
final Object? cause;
bool get isUnauthorized =>
httpStatus == 401 ||
const {'INVALID_TOKEN', 'TOKEN_EXPIRED'}.contains(reason?.toUpperCase());
bool get isRetryable {
if (kind == ApiExceptionKind.transport) return true;
final status = httpStatus;
return status == 408 || status == 429 || (status != null && status >= 500);
}
int? get sessionGeneration =>
requestOptions?.extra[authSessionGenerationExtra] as int?;
static ApiException from(Object error, {StackTrace? stackTrace}) {
if (error is ApiException) return error;
if (error is DioException) {
if (error.error is ApiException) return error.error! as ApiException;
return fromDio(error);
}
if (error is FormatException) {
return ApiException(kind: ApiExceptionKind.decode, cause: error);
}
return ApiException(kind: ApiExceptionKind.decode, cause: error);
}
static ApiException fromDio(DioException error) {
final response = error.response;
final status = response?.statusCode;
final kratos = parseKratosError(response?.data);
if (error.type == DioExceptionType.cancel) {
return ApiException(
kind: ApiExceptionKind.cancelled,
httpStatus: status,
requestOptions: error.requestOptions,
cause: error,
);
}
final kind = kratos != null
? ApiExceptionKind.backend
: status != null
? ApiExceptionKind.http
: ApiExceptionKind.transport;
return ApiException(
kind: kind,
httpStatus: status,
backendCode: kratos?.code,
reason: _normalized(kratos?.reason),
serverMessage: _normalized(kratos?.message),
requestOptions: error.requestOptions,
cause: error,
);
}
@override
String toString() =>
'ApiException($kind, status: $httpStatus, code: $backendCode, '
'reason: $reason, message: $serverMessage)';
}
const authSessionGenerationExtra = 'authSessionGeneration';
kerrors.Status? parseKratosError(Object? raw) {
if (raw is List<int> && raw.isNotEmpty) {
try {
final status = kerrors.Status.fromBuffer(raw);
if (status.code != 0 || status.reason.isNotEmpty) return status;
} catch (_) {
return null;
}
}
if (raw is Map) {
final code = raw['code'];
final reason = '${raw['reason'] ?? ''}';
final message = '${raw['message'] ?? ''}';
if (code is num || reason.isNotEmpty || message.isNotEmpty) {
return kerrors.Status(
code: code is num ? code.toInt() : 0,
reason: reason,
message: message,
);
}
}
return null;
}
String? _normalized(String? value) {
final result = value?.trim() ?? '';
return result.isEmpty ? null : result;
}
class ApiExceptionInterceptor extends Interceptor {
@override
void onError(DioException err, ErrorInterceptorHandler handler) {
final apiException = ApiException.fromDio(err);
handler.next(err.copyWith(error: apiException));
}
}
+45 -8
View File
@@ -1,28 +1,65 @@
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import '../services/device_header_service.dart'; import '../services/device_header_service.dart';
import '../storage/secure_identity_storage.dart';
import '../storage/preferences_storage.dart';
import '../storage/storage_service.dart';
import 'api_exception.dart';
const _kJwtKey = 'jwt_token'; final _defaultIdentityStorage = SecureIdentityStorage(
const _storage = FlutterSecureStorage(); PreferencesStorage(StorageService.to.preferences),
);
Future<void> saveJwt(String token) => Future<void> saveJwt(String token) => _defaultIdentityStorage.saveJwt(token);
_storage.write(key: _kJwtKey, value: token); Future<void> clearJwt() => _defaultIdentityStorage.clearJwt();
Future<void> clearJwt() => _storage.delete(key: _kJwtKey); Future<String?> loadJwt() => _defaultIdentityStorage.readJwt();
Future<String?> loadJwt() => _storage.read(key: _kJwtKey);
class AuthInterceptor extends Interceptor { class AuthInterceptor extends Interceptor {
AuthInterceptor(this._sessionStorage, {required Uri backendOrigin})
: _backendOrigin = backendOrigin;
final AuthSessionStorage _sessionStorage;
final Uri _backendOrigin;
@override @override
Future<void> onRequest( Future<void> onRequest(
RequestOptions options, RequestOptions options,
RequestInterceptorHandler handler, RequestInterceptorHandler handler,
) async { ) async {
if (!_sameOrigin(options.uri, _backendOrigin)) {
_stripSensitiveHeaders(options.headers);
handler.next(options);
return;
}
await DeviceHeaderService.to.ensureInitialized(); await DeviceHeaderService.to.ensureInitialized();
options.headers.addAll(DeviceHeaderService.to.commonHeaders()); options.headers.addAll(DeviceHeaderService.to.commonHeaders());
options.headers.addAll(DeviceHeaderService.to.platformIdentityHeaders()); options.headers.addAll(DeviceHeaderService.to.platformIdentityHeaders());
final jwt = await loadJwt(); final jwt = _sessionStorage.accessToken ?? await _sessionStorage.restore();
if (jwt != null && jwt.isNotEmpty) { if (jwt != null && jwt.isNotEmpty) {
options.headers['Authorization'] = 'Bearer $jwt'; options.headers['Authorization'] = 'Bearer $jwt';
} }
options.extra[authSessionGenerationExtra] = _sessionStorage.generation;
handler.next(options); handler.next(options);
} }
} }
bool _sameOrigin(Uri request, Uri backend) =>
request.scheme.toLowerCase() == backend.scheme.toLowerCase() &&
request.host.toLowerCase() == backend.host.toLowerCase() &&
request.port == backend.port;
void _stripSensitiveHeaders(Map<String, dynamic> headers) {
const sensitive = {
'authorization',
'x-device-id',
'user-devicetoken',
'user-android-id',
'user-android-oaid',
'user-android-imei',
'user-android-mac',
'user-ios-idfv',
'user-ios-idfa',
'user-ios-paid',
};
headers.removeWhere((key, _) => sensitive.contains(key.toLowerCase()));
}
+61 -2
View File
@@ -5,6 +5,9 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';
import '../config/app_config.dart'; import '../config/app_config.dart';
import '../storage/secure_identity_storage.dart';
import '../../features/auth/application/auth_session_coordinator.dart';
import 'api_exception.dart';
import 'auth_interceptor.dart'; import 'auth_interceptor.dart';
import 'kratos_error_interceptor.dart'; import 'kratos_error_interceptor.dart';
@@ -12,12 +15,22 @@ part 'dio_provider.g.dart';
const _protobufContentType = 'application/x-protobuf'; const _protobufContentType = 'application/x-protobuf';
/// Per-request override for native protobuf-over-HTTP endpoints.
Options protobufOptions() => Options(
responseType: ResponseType.bytes,
contentType: _protobufContentType,
headers: const {'Accept': _protobufContentType},
);
@Riverpod(keepAlive: true) @Riverpod(keepAlive: true)
AppConfig appConfig(Ref ref) => AppConfig.fromEnvironment(); AppConfig appConfig(Ref ref) => AppConfig.fromEnvironment();
@Riverpod(keepAlive: true) @Riverpod(keepAlive: true)
Dio dio(Ref ref) { Dio dio(Ref ref) {
final config = ref.watch(appConfigProvider); final config = ref.watch(appConfigProvider);
final sessionStorage = ref.watch(authSessionStorageProvider);
final coordinator = ref.watch(authSessionCoordinatorProvider);
final backendOrigin = Uri.parse(config.apiBaseUrl);
final d = Dio( final d = Dio(
BaseOptions( BaseOptions(
baseUrl: config.apiBaseUrl, baseUrl: config.apiBaseUrl,
@@ -31,11 +44,57 @@ Dio dio(Ref ref) {
}, },
), ),
); );
d.interceptors.add(AuthInterceptor()); d.interceptors.add(
AuthInterceptor(sessionStorage, backendOrigin: backendOrigin),
);
d.interceptors.add(KratosErrorInterceptor()); d.interceptors.add(KratosErrorInterceptor());
d.interceptors.add(_SessionExpiryInterceptor(coordinator));
if (!kReleaseMode) { if (!kReleaseMode) {
d.interceptors.add(LogInterceptor(requestBody: false, responseBody: false)); d.interceptors.add(LogInterceptor(requestBody: false, responseBody: false));
}
d.interceptors.add(FancyDioInterceptor()); d.interceptors.add(FancyDioInterceptor());
}
return d; return d;
} }
/// Explicit name for new code. [dioProvider] remains as a compatibility alias
/// while existing feature clients are migrated incrementally.
final backendDioProvider = dioProvider;
@Riverpod(keepAlive: true)
Dio publicDio(Ref ref) => Dio(
BaseOptions(
connectTimeout: const Duration(seconds: 15),
receiveTimeout: const Duration(seconds: 30),
),
);
class _SessionExpiryInterceptor extends Interceptor {
_SessionExpiryInterceptor(this._coordinator);
final AuthSessionCoordinator _coordinator;
@override
Future<void> onError(
DioException err,
ErrorInterceptorHandler handler,
) async {
final exception = ApiException.from(err);
if (exception.isUnauthorized) {
// Network code only emits the session event. Navigation and presentation
// observe AuthState elsewhere.
try {
await _coordinator.expireIfNeeded(exception);
} catch (error, stackTrace) {
FlutterError.reportError(
FlutterErrorDetails(
exception: error,
stack: stackTrace,
library: 'jinzhi network',
context: ErrorDescription('while expiring an unauthorized session'),
),
);
}
}
handler.next(err);
}
}
@@ -1,8 +1,16 @@
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'api_exception.dart';
class KratosErrorInterceptor extends Interceptor { class KratosErrorInterceptor extends Interceptor {
@override @override
void onError(DioException err, ErrorInterceptorHandler handler) { void onError(DioException err, ErrorInterceptorHandler handler) {
if (err.error is ApiException) {
handler.next(err); handler.next(err);
return;
}
// Preserve response.data for diagnostics and retries. The parsed error is
// carried as DioException.error and normalized by ApiException.from().
handler.next(err.copyWith(error: ApiException.fromDio(err)));
} }
} }
@@ -0,0 +1,58 @@
import 'dart:convert';
/// Minimal reader retained only for endpoints that do not have an
/// authoritative generated protobuf model yet.
class ProtobufWireMessage {
ProtobufWireMessage(this.bytes);
final List<int> bytes;
Map<int, List<Object>>? _cache;
Map<int, List<Object>> get _fields => _cache ??= _read();
int integer(int tag) => (_fields[tag]?.lastOrNull as int?) ?? 0;
String string(int tag) {
final value = _fields[tag]?.lastOrNull;
return value is List<int> ? utf8.decode(value, allowMalformed: true) : '';
}
Map<int, List<Object>> _read() {
final result = <int, List<Object>>{};
var index = 0;
int varint() {
var value = 0;
var shift = 0;
while (index < bytes.length) {
final byte = bytes[index++];
value |= (byte & 127) << shift;
if (byte < 128) return value;
shift += 7;
}
throw const FormatException('Invalid protobuf');
}
while (index < bytes.length) {
final key = varint();
final tag = key >> 3;
final Object field;
if ((key & 7) == 0) {
field = varint();
} else if ((key & 7) == 2) {
final length = varint();
final end = index + length;
if (end > bytes.length) throw const FormatException('Invalid protobuf');
field = bytes.sublist(index, end);
index = end;
} else {
throw const FormatException('Unsupported protobuf');
}
(result[tag] ??= []).add(field);
}
return result;
}
}
extension on List<Object> {
Object? get lastOrNull => isEmpty ? null : last;
}
+9
View File
@@ -0,0 +1,9 @@
import 'package:flutter/foundation.dart';
/// Android requires explicit privacy consent before collecting device
/// identifiers. iOS follows its existing startup flow instead.
bool requiresAndroidPrivacyConsent({
required bool isWeb,
required TargetPlatform platform,
required bool privacyAgreed,
}) => !isWeb && platform == TargetPlatform.android && !privacyAgreed;
@@ -0,0 +1,11 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
abstract final class UmengPrivacyConsent {
static const _channel = MethodChannel('jinzhi/privacy');
static Future<void> submitGranted() async {
if (kIsWeb || defaultTargetPlatform != TargetPlatform.android) return;
await _channel.invokeMethod<void>('submitUmengPrivacyGranted');
}
}
@@ -0,0 +1,66 @@
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:hooks_riverpod/misc.dart';
import 'package:package_info_plus/package_info_plus.dart';
import '../../models/pb/jinzhi/v1/push.pb.dart' as pb;
import '../network/api_exception.dart';
import 'notification_permission.dart';
import 'push_api_client.dart';
import 'umeng_push_service.dart';
class DevicePushRegistrar {
DevicePushRegistrar(this._read);
final T Function<T>(ProviderListenable<T>) _read;
StreamSubscription<String>? _subscription;
String? _lastToken;
bool? _lastPermission;
Future<void> _registrationQueue = Future.value();
void start() {
_subscription ??= UmengPushService.onDeviceToken.listen(_enqueue);
UmengPushService.emitCachedToken();
}
Future<void> stop() async => _subscription?.cancel();
Future<void> refresh() => UmengPushService.refreshDeviceToken();
void forceRegisterCurrentToken() {
// BLOCKED(server contract): guest registration is intentionally preserved.
// Do not add a client-side unbind call until the backend confirms whether
// guest registration reliably clears the previous user binding.
_lastToken = null;
_lastPermission = null;
UmengPushService.emitCachedToken();
}
void _enqueue(String token) {
_registrationQueue = _registrationQueue
.catchError((_) {})
.then((_) => _register(token));
}
Future<void> _register(String token) async {
final permission = await NotificationPermission.isGranted();
if (token == _lastToken && permission == _lastPermission) return;
final package = await PackageInfo.fromPlatform();
final request = pb.RegisterPushDeviceRequest(
umengDeviceToken: token,
platform: defaultTargetPlatform == TargetPlatform.iOS
? pb.Platform.PLATFORM_IOS
: pb.Platform.PLATFORM_ANDROID,
appVersion: package.version,
permissionGranted: permission,
);
for (var attempt = 0; attempt < 4; attempt++) {
try {
await _read(pushApiClientProvider).registerDevice(request);
_lastToken = token;
_lastPermission = permission;
return;
} catch (error) {
if (attempt == 3 || !ApiException.from(error).isRetryable) return;
await Future<void>.delayed(Duration(seconds: 1 << attempt));
}
}
}
}
@@ -0,0 +1,47 @@
import 'package:flutter/foundation.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/material.dart';
import 'package:permission_handler/permission_handler.dart';
import '../storage/storage_keys.dart';
import '../storage/storage_service.dart';
import '../widgets/notification_permission_tip.dart';
abstract final class NotificationPermission {
static Future<bool> isGranted() async =>
!kIsWeb && (await Permission.notification.status).isGranted;
/// 对齐研听:Android 13+ 由应用解释后主动申请;iOS 由 U-Push 注册 APNs
/// 时触发系统授权,绝不展示 Android 的自定义顶部提示。
static Future<bool> requestIfNeeded(BuildContext context) async {
if (kIsWeb || defaultTargetPlatform != TargetPlatform.android) {
return isGranted();
}
final android = await DeviceInfoPlugin().androidInfo;
if (android.version.sdkInt < 33 ||
StorageService.to.getBool(storagePushPermissionPrompted)) {
return isGranted();
}
if (await isGranted() || !context.mounted) return true;
final tip = showNotificationPermissionTip(context);
await StorageService.to.setBool(storagePushPermissionPrompted, true);
try {
// Match the legacy app's persistent top snackbar: keep the in-app
// explanation on screen until the system authorization dialog closes.
return (await Permission.notification.request()).isGranted;
} finally {
tip.remove();
}
}
/// 设置页不使用顶部说明;iOS/Android 都直接请求系统授权。
static Future<bool> requestFromSettings() async {
if (kIsWeb) return false;
final current = await Permission.notification.status;
if (current.isGranted) return true;
await StorageService.to.setBool(storagePushPermissionPrompted, true);
return (await Permission.notification.request()).isGranted;
}
static Future<bool> openSystemSettings() => openAppSettings();
}
+24
View File
@@ -0,0 +1,24 @@
import 'package:dio/dio.dart';
// ignore: unused_import — compute() is referenced by generated Retrofit code.
import 'package:flutter/foundation.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:retrofit/retrofit.dart';
import '../../models/pb/jinzhi/v1/push.pb.dart';
import '../network/dio_provider.dart';
part 'push_api_client.g.dart';
@RestApi()
abstract class PushApiClient {
factory PushApiClient(Dio dio, {String? baseUrl}) = _PushApiClient;
@POST('/api/v1/push/devices')
Future<RegisterPushDeviceReply> registerDevice(
@Body() RegisterPushDeviceRequest request,
);
}
final pushApiClientProvider = Provider<PushApiClient>(
(ref) => PushApiClient(ref.watch(backendDioProvider)),
);
+90
View File
@@ -0,0 +1,90 @@
import 'dart:async';
import 'dart:io' show Platform;
import 'package:flutter/foundation.dart';
import 'package:umeng_common_sdk/umeng_common_sdk.dart';
import 'package:umeng_push_sdk/umeng_push_sdk.dart';
import '../config/umeng_config.dart';
import '../privacy/privacy_gate.dart';
import '../services/device_header_service.dart';
import '../storage/storage_keys.dart';
import '../storage/storage_service.dart';
abstract final class UmengPushService {
static const _maxPendingNotificationOpens = 20;
static final _tokens = StreamController<String>.broadcast();
static Future<void>? _starting;
static bool _started = false;
static void Function(String payload)? _onNotificationOpen;
static final List<String> _pendingNotificationOpens = [];
static Stream<String> get onDeviceToken => _tokens.stream;
static void configureNotificationOpen(
void Function(String payload) callback,
) {
_onNotificationOpen = callback;
final pending = List<String>.of(_pendingNotificationOpens);
_pendingNotificationOpens.clear();
for (final payload in pending) {
callback(payload);
}
}
static Future<void> startIfAllowed() {
if (kIsWeb ||
_started ||
requiresAndroidPrivacyConsent(
isWeb: kIsWeb,
platform: defaultTargetPlatform,
privacyAgreed: StorageService.to.getBool(storagePrivacyAgreed),
)) {
return Future.value();
}
return _starting ??= _start().whenComplete(() => _starting = null);
}
static Future<void> _start() async {
await DeviceHeaderService.to.ensureInitialized();
await UmengCommonSdk.initCommon(
UmengConfig.androidAppKey,
UmengConfig.iosAppKey,
DeviceHeaderService.to.commonHeaders()['User-Channel'] ?? 'test',
UmengConfig.androidPushSecret,
);
UmengPushSdk.setTokenCallback(_emit);
UmengPushSdk.setNotificationCallback((_) {}, (payload) {
final callback = _onNotificationOpen;
if (callback == null) {
if (_pendingNotificationOpens.length == _maxPendingNotificationOpens) {
_pendingNotificationOpens.removeAt(0);
}
_pendingNotificationOpens.add(payload);
} else {
callback(payload);
}
});
await UmengPushSdk.register(
UmengConfig.iosAppKey,
DeviceHeaderService.to.commonHeaders()['User-Channel'] ?? 'test',
);
if (Platform.isAndroid) await UmengPushSdk.setPushEnable(true);
_started = true;
await refreshDeviceToken();
}
static Future<void> refreshDeviceToken() async {
if (!_started || kIsWeb) return;
_emit(await UmengPushSdk.getRegisteredId());
}
static void emitCachedToken() =>
_emit(StorageService.to.getString(storageDeviceToken));
static void _emit(String? token) {
if (token == null || token.isEmpty) return;
_tokens.add(token);
unawaited(StorageService.to.setString(storageDeviceToken, token));
}
}
+44 -159
View File
@@ -2,10 +2,7 @@ import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart';
import '../../features/assets/presentation/asset_add_page.dart';
import '../../features/assets/presentation/asset_edit_page.dart';
import '../../features/assets/presentation/assets_page.dart'; import '../../features/assets/presentation/assets_page.dart';
import '../../features/assets/presentation/holding_detail_page.dart';
import '../../features/auth/presentation/delete_account_page.dart'; import '../../features/auth/presentation/delete_account_page.dart';
import '../../features/auth/presentation/login_page.dart'; import '../../features/auth/presentation/login_page.dart';
import '../../features/debug/presentation/debug_info_page.dart'; import '../../features/debug/presentation/debug_info_page.dart';
@@ -14,37 +11,20 @@ import '../../features/debug/presentation/debug_shorebird_page.dart';
import '../../features/debug/presentation/fancy_dio_inspector_page.dart'; import '../../features/debug/presentation/fancy_dio_inspector_page.dart';
import '../../features/debug/presentation/typography_test_page.dart'; import '../../features/debug/presentation/typography_test_page.dart';
import '../../features/market/presentation/market_page.dart'; import '../../features/market/presentation/market_page.dart';
import '../../features/market/presentation/market_kline_page.dart';
import '../../features/news/presentation/news_page.dart'; import '../../features/news/presentation/news_page.dart';
import '../../features/news/presentation/news_detail_page.dart';
import '../../features/profile/presentation/profile_page.dart'; import '../../features/profile/presentation/profile_page.dart';
import '../../features/profile/presentation/profile_action_pages.dart';
import '../../features/settings/presentation/settings_page.dart'; import '../../features/settings/presentation/settings_page.dart';
import '../../features/settings/presentation/privacy_consent_page.dart'; import '../../features/settings/presentation/privacy_consent_page.dart';
import '../../features/web/presentation/web_page.dart';
import '../services/device_header_service.dart'; import '../services/device_header_service.dart';
import 'tab_shell.dart'; import 'tab_shell.dart';
import 'route_error_page.dart';
abstract final class AppRoutes { abstract final class AppRoutes {
static const assets = '/assets'; static const assets = '/assets';
static const assetAdd = '/assets/add';
static const assetEdit = '/assets/edit';
static const market = '/market'; static const market = '/market';
static const marketKline = '/market/kline';
static const news = '/news'; static const news = '/news';
static const newsDetail = '/news/detail';
static const profile = '/profile'; static const profile = '/profile';
static const profileInvite = '/profile/invite';
static const profileShare = '/profile/share';
static const profileLocalBackup = '/profile/local-backup';
static const profileCloudBackup = '/profile/cloud-backup';
static const profileWidget = '/profile/widget';
static const profilePurity = '/profile/purity';
static const profileRecycle = '/profile/recycle';
static const profilePriceColor = '/profile/price-color';
static const profileCurrency = '/profile/currency';
static const profileDisclaimer = '/profile/disclaimer';
static const profileAbout = '/profile/about';
static const assetDetail = '/assets/detail';
static const login = '/login'; static const login = '/login';
static const settings = '/settings'; static const settings = '/settings';
static const deleteAccount = '/delete-account'; static const deleteAccount = '/delete-account';
@@ -55,13 +35,18 @@ abstract final class AppRoutes {
static const debugTypography = '/debug/typography'; static const debugTypography = '/debug/typography';
static const fancyDioInspector = '/debug/fancy_dio_inspector'; static const fancyDioInspector = '/debug/fancy_dio_inspector';
static const privacyConsent = '/privacy-consent'; static const privacyConsent = '/privacy-consent';
static const web = '/web';
} }
final rootNavigatorKey = GlobalKey<NavigatorState>();
final routerProvider = Provider<GoRouter>((ref) { final routerProvider = Provider<GoRouter>((ref) {
final startupListenable = ValueNotifier<int>(0); final startupListenable = ValueNotifier<int>(0);
return GoRouter( return GoRouter(
navigatorKey: rootNavigatorKey,
initialLocation: AppRoutes.assets, initialLocation: AppRoutes.assets,
refreshListenable: startupListenable, refreshListenable: startupListenable,
errorBuilder: (_, state) => RouteErrorPage(error: state.error),
redirect: (context, state) { redirect: (context, state) {
final loc = state.matchedLocation; final loc = state.matchedLocation;
final onConsent = loc == AppRoutes.privacyConsent; final onConsent = loc == AppRoutes.privacyConsent;
@@ -76,106 +61,45 @@ final routerProvider = Provider<GoRouter>((ref) {
return null; return null;
}, },
routes: [ routes: [
ShellRoute( StatefulShellRoute.indexedStack(
builder: (context, state, child) => builder: (context, state, navigationShell) => TabShell(
TabShell(location: state.matchedLocation, child: child), location: state.matchedLocation,
navigationShell: navigationShell,
),
branches: [
StatefulShellBranch(
routes: [ routes: [
GoRoute( GoRoute(
path: AppRoutes.assets, path: AppRoutes.assets,
builder: (ctx, s) => const AssetsPage(), builder: (ctx, s) => const AssetsPage(),
), ),
],
),
StatefulShellBranch(
routes: [
GoRoute( GoRoute(
path: AppRoutes.market, path: AppRoutes.market,
builder: (ctx, s) => const MarketPage(), builder: (ctx, s) => const MarketPage(),
), ),
GoRoute(path: AppRoutes.news, builder: (ctx, s) => const NewsPage()), ],
),
StatefulShellBranch(
routes: [
GoRoute(
path: AppRoutes.news,
builder: (ctx, s) => const NewsPage(),
),
],
),
StatefulShellBranch(
routes: [
GoRoute( GoRoute(
path: AppRoutes.profile, path: AppRoutes.profile,
builder: (ctx, s) => const ProfilePage(), builder: (ctx, s) => const ProfilePage(),
), ),
], ],
), ),
GoRoute( ],
path: AppRoutes.assetDetail,
builder: (ctx, s) => HoldingDetailPage(id: s.uri.queryParameters['id']),
),
GoRoute(
path: AppRoutes.assetAdd,
pageBuilder: (ctx, s) =>
_rightToLeftPage(state: s, child: const AssetAddPage()),
),
GoRoute(
path: AppRoutes.assetEdit,
pageBuilder: (ctx, s) => _rightToLeftPage(
state: s,
child: AssetEditPage(id: s.uri.queryParameters['id'] ?? ''),
),
),
GoRoute(
path: AppRoutes.marketKline,
builder: (ctx, s) => MarketKlinePage(
metalId: s.uri.queryParameters['metal'],
periodId: s.uri.queryParameters['period'],
),
),
GoRoute(
path: AppRoutes.newsDetail,
builder: (ctx, s) => NewsDetailPage(id: s.uri.queryParameters['id']),
),
GoRoute(
path: AppRoutes.profileInvite,
pageBuilder: (ctx, s) =>
_bottomUpPage(state: s, child: const InviteRewardPage()),
),
GoRoute(
path: AppRoutes.profileShare,
pageBuilder: (ctx, s) =>
_bottomUpPage(state: s, child: const ShareCardPage()),
),
GoRoute(
path: AppRoutes.profileLocalBackup,
pageBuilder: (ctx, s) =>
_bottomUpPage(state: s, child: const LocalBackupPage()),
),
GoRoute(
path: AppRoutes.profileCloudBackup,
pageBuilder: (ctx, s) =>
_bottomUpPage(state: s, child: const CloudBackupPage()),
),
GoRoute(
path: AppRoutes.profileWidget,
pageBuilder: (ctx, s) =>
_bottomUpPage(state: s, child: const WidgetSettingsPage()),
),
GoRoute(
path: AppRoutes.profilePurity,
pageBuilder: (ctx, s) =>
_bottomUpPage(state: s, child: const PuritySettingsPage()),
),
GoRoute(
path: AppRoutes.profileRecycle,
pageBuilder: (ctx, s) =>
_bottomUpPage(state: s, child: const RecycleDiscountPage()),
),
GoRoute(
path: AppRoutes.profilePriceColor,
pageBuilder: (ctx, s) =>
_bottomUpPage(state: s, child: const PriceColorPage()),
),
GoRoute(
path: AppRoutes.profileCurrency,
pageBuilder: (ctx, s) =>
_bottomUpPage(state: s, child: const CurrencyPage()),
),
GoRoute(
path: AppRoutes.profileDisclaimer,
pageBuilder: (ctx, s) =>
_rightToLeftPage(state: s, child: const DisclaimerPage()),
),
GoRoute(
path: AppRoutes.profileAbout,
pageBuilder: (ctx, s) =>
_bottomUpPage(state: s, child: const AboutPage()),
), ),
GoRoute(path: AppRoutes.debug, builder: (_, s) => const DebugPage()), GoRoute(path: AppRoutes.debug, builder: (_, s) => const DebugPage()),
GoRoute( GoRoute(
@@ -214,58 +138,19 @@ final routerProvider = Provider<GoRouter>((ref) {
path: AppRoutes.privacyConsent, path: AppRoutes.privacyConsent,
builder: (_, s) => const PrivacyConsentPage(), builder: (_, s) => const PrivacyConsentPage(),
), ),
GoRoute(
path: AppRoutes.web,
builder: (_, state) {
final uri = parseSafeWebUri(state.uri.queryParameters['url']);
if (uri == null) {
return const Scaffold(body: Center(child: Text('页面地址不可用')));
}
return AppWebPage(
initialUri: uri,
hideTitle: state.uri.queryParameters['hideTitle'] == '1',
);
},
),
], ],
); );
}); });
CustomTransitionPage<T> _bottomUpPage<T>({
required GoRouterState state,
required Widget child,
}) {
return CustomTransitionPage<T>(
key: state.pageKey,
transitionDuration: const Duration(milliseconds: 260),
reverseTransitionDuration: const Duration(milliseconds: 220),
child: child,
transitionsBuilder: (context, animation, secondaryAnimation, pageChild) {
final curved = CurvedAnimation(
parent: animation,
curve: Curves.easeOutCubic,
reverseCurve: Curves.easeInCubic,
);
return SlideTransition(
position: Tween<Offset>(
begin: const Offset(0, 0.08),
end: Offset.zero,
).animate(curved),
child: FadeTransition(opacity: curved, child: pageChild),
);
},
);
}
CustomTransitionPage<T> _rightToLeftPage<T>({
required GoRouterState state,
required Widget child,
}) {
return CustomTransitionPage<T>(
key: state.pageKey,
transitionDuration: const Duration(milliseconds: 260),
reverseTransitionDuration: const Duration(milliseconds: 220),
child: child,
transitionsBuilder: (context, animation, secondaryAnimation, pageChild) {
final curved = CurvedAnimation(
parent: animation,
curve: Curves.easeOutCubic,
reverseCurve: Curves.easeInCubic,
);
return SlideTransition(
position: Tween<Offset>(
begin: const Offset(1, 0),
end: Offset.zero,
).animate(curved),
child: FadeTransition(opacity: curved, child: pageChild),
);
},
);
}
+192
View File
@@ -0,0 +1,192 @@
import 'dart:convert';
enum DeepLinkSource { push, appLink, universalLink, customScheme }
typedef DeepLinkNavigator = bool Function(String location);
typedef DeepLinkAuthGuard = bool Function(String location);
class DeepLinkEvent {
const DeepLinkEvent({
required this.raw,
required this.source,
required this.receivedAt,
this.eventId,
});
final String raw;
final DeepLinkSource source;
final DateTime receivedAt;
final String? eventId;
}
/// Source adapters feed one parser and a bounded FIFO. Navigation starts only
/// after GoRouter has a context and the auth guard accepts the target.
abstract final class DeepLinkService {
static const maxPending = 20;
static const expiry = Duration(minutes: 15);
static const _environmentHosts = String.fromEnvironment(
'JINZHI_DEEP_LINK_HOSTS',
);
static final List<DeepLinkEvent> _pending = [];
static final Set<String> _pendingEventIds = {};
static final Map<String, DateTime> _seenEventIds = {};
static final Set<String> _configuredHttpsHosts = _normalizedHosts(
_environmentHosts.split(','),
);
static Set<String> _trustedHttpsHosts = {..._configuredHttpsHosts};
static DeepLinkNavigator? _navigator;
static DeepLinkAuthGuard _authGuard = (_) => true;
static int get pendingCount => _pending.length;
static void handle(String raw) => enqueue(raw, source: DeepLinkSource.push);
static void handleUri(Uri uri) => enqueue(
uri.toString(),
source: uri.scheme.toLowerCase() == 'jinzhi'
? DeepLinkSource.customScheme
: DeepLinkSource.universalLink,
);
static void enqueue(
String raw, {
required DeepLinkSource source,
DateTime? receivedAt,
}) {
final normalized = raw.trim();
if (normalized.isEmpty) return;
final event = DeepLinkEvent(
raw: normalized,
source: source,
receivedAt: receivedAt ?? DateTime.now(),
eventId: _eventId(normalized),
);
_discardExpired(event.receivedAt);
_seenEventIds.removeWhere(
(_, seenAt) => event.receivedAt.difference(seenAt) > expiry,
);
if (event.eventId case final id? when _seenEventIds.containsKey(id)) return;
if (_pending.length == maxPending) _removeAt(0);
_pending.add(event);
if (event.eventId case final id?) {
_pendingEventIds.add(id);
_seenEventIds[id] = event.receivedAt;
}
_drain();
}
static void attachRouter(
DeepLinkNavigator navigator, {
DeepLinkAuthGuard? authGuard,
}) {
_navigator = navigator;
_authGuard = authGuard ?? (_) => true;
_drain();
}
static void notifyAuthChanged() => _drain();
static void detachRouter() => _navigator = null;
/// Universal/App Link domains are supplied by the release environment. An
/// empty allowlist intentionally disables HTTPS deep links until the native
/// association domain is confirmed.
static void configureTrustedHttpsHosts(Iterable<String> hosts) {
_trustedHttpsHosts = _normalizedHosts(hosts);
}
static void resetForTest() {
_pending.clear();
_pendingEventIds.clear();
_seenEventIds.clear();
_trustedHttpsHosts = {..._configuredHttpsHosts};
_navigator = null;
_authGuard = (_) => true;
}
static void _drain() {
final navigator = _navigator;
if (navigator == null) return;
_discardExpired(DateTime.now());
while (_pending.isNotEmpty) {
final event = _pending.first;
final target = _route(event.raw);
if (target == null) {
_removeAt(0);
continue;
}
if (!_authGuard(target) || !navigator(target)) return;
_removeAt(0);
}
}
static void _discardExpired(DateTime now) {
while (_pending.isNotEmpty &&
now.difference(_pending.first.receivedAt) > expiry) {
_removeAt(0);
}
}
static void _removeAt(int index) {
final removed = _pending.removeAt(index);
if (removed.eventId case final id?) _pendingEventIds.remove(id);
}
static String? _eventId(String raw) {
try {
final decoded = jsonDecode(raw);
if (decoded is Map) {
final id = '${decoded['event_id'] ?? decoded['eventId'] ?? ''}'.trim();
if (id.isNotEmpty) return id;
}
} catch (_) {}
final uri = Uri.tryParse(raw);
final id = uri?.queryParameters['event_id']?.trim();
return id == null || id.isEmpty ? null : id;
}
static String? _route(String raw) {
var source = raw.trim();
try {
final decoded = jsonDecode(source);
if (decoded is Map) {
source =
'${decoded['deep_link'] ?? decoded['url'] ?? decoded['link'] ?? ''}';
}
} catch (_) {}
final uri = Uri.tryParse(source);
if (uri == null) return null;
if (uri.scheme.toLowerCase() == 'jinzhi') {
final path = uri.path.isNotEmpty
? uri.path
: uri.host.isNotEmpty
? '/${uri.host}'
: '/assets';
return _allowed(path)
? '$path${uri.hasQuery ? '?${uri.query}' : ''}'
: null;
}
if (uri.scheme.toLowerCase() == 'https' &&
uri.port == 443 &&
uri.userInfo.isEmpty &&
_trustedHttpsHosts.contains(uri.host.toLowerCase()) &&
_allowed(uri.path)) {
return '${uri.path}${uri.hasQuery ? '?${uri.query}' : ''}';
}
return null;
}
static bool _allowed(String path) => const {
'/assets',
'/market',
'/news',
'/profile',
'/settings',
}.contains(path);
static Set<String> _normalizedHosts(Iterable<String> hosts) => {
for (final host in hosts)
if (host.trim().isNotEmpty) host.trim().toLowerCase(),
};
}
+28
View File
@@ -0,0 +1,28 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
class RouteErrorPage extends StatelessWidget {
const RouteErrorPage({super.key, required this.error});
final Object? error;
@override
Widget build(BuildContext context) => Scaffold(
body: Center(
child: Padding(
padding: const EdgeInsets.all(24),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(Icons.explore_off_outlined, size: 40),
const SizedBox(height: 14),
const Text('页面不存在或已失效'),
const SizedBox(height: 12),
FilledButton(
onPressed: () => context.go('/assets'),
child: const Text('回到首页'),
),
],
),
),
),
);
}
+852 -69
View File
@@ -1,44 +1,256 @@
import 'dart:async';
import 'dart:ui';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:shadcn_ui/shadcn_ui.dart'; import 'package:shadcn_ui/shadcn_ui.dart';
import '../../features/mall/application/mall_entry_controller.dart';
import '../../features/mall/application/mall_entry_promo_store.dart';
import '../../features/mall/application/mall_tab_config.dart';
import '../../features/mall/presentation/widgets/mall_entry_promo.dart';
import '../../features/ads/application/startup_ad_service.dart';
import '../../features/web/application/mall_bridge_state.dart';
import '../../features/web/application/mall_web_host_controller.dart';
import '../../features/web/presentation/mall_web_host.dart';
import '../theme/app_icons.dart'; import '../theme/app_icons.dart';
import '../widgets/app_toast.dart';
import 'app_router.dart';
import '../storage/preferences_storage.dart';
class TabShell extends StatefulWidget { class TabShell extends ConsumerStatefulWidget {
const TabShell({super.key, required this.child, required this.location}); const TabShell({
super.key,
required this.navigationShell,
required this.location,
});
final Widget child; final StatefulNavigationShell navigationShell;
final String location; final String location;
@override @override
State<TabShell> createState() => _TabShellState(); ConsumerState<TabShell> createState() => _TabShellState();
} }
class _TabShellState extends State<TabShell> { class _TabShellState extends ConsumerState<TabShell>
with TickerProviderStateMixin {
static const double _compactHeaderThreshold = 34; static const double _compactHeaderThreshold = 34;
static const double _scrollVisibilityThreshold = 16;
static const double _topRevealEpsilon = 1;
static const Curve _expandSpring = Cubic(0.32, -0.9, 0.28, 1);
bool _showCompactHeader = false; bool _showCompactHeader = false;
Brightness? _mallBrightness;
bool _mallPresented = false;
bool _mallActive = false;
late final AnimationController _minimizeController;
late final CurvedAnimation _minimizeFactor;
late final AnimationController _mallTransition;
late final CurvedAnimation _mallProgress;
late final ProviderSubscription<MallTabConfig> _mallConfigSubscription;
late final MallEntryPromoStore _mallEntryPromoStore;
late bool _mallEntryTipConsumed;
late bool _mallHomeBadgeSeen;
bool _showMallHomeBadgeForPresentation = false;
bool _userScrollSession = false;
ScrollDirection _userScrollDirection = ScrollDirection.idle;
double _directionAccum = 0;
bool _barMinimized = false;
static const _tabs = ['/assets', '/market', '/news', '/profile']; int get _index => widget.navigationShell.currentIndex;
int get _index => @override
_tabs.indexWhere((t) => widget.location.startsWith(t)).clamp(0, 3); void initState() {
super.initState();
_mallEntryPromoStore = MallEntryPromoStore(
ref.read(preferencesStorageProvider),
);
_mallEntryTipConsumed = _mallEntryPromoStore.hasOpenedMall;
_mallHomeBadgeSeen = _mallEntryPromoStore.hasSeenHomeBadge;
MallWebHostController.instance.state.addListener(_syncMallHost);
MallBridgeController.instance.state.addListener(_refreshMallDock);
_minimizeController = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 260),
reverseDuration: const Duration(milliseconds: 380),
);
_minimizeFactor = CurvedAnimation(
parent: _minimizeController,
curve: Curves.easeOutCubic,
reverseCurve: _expandSpring,
);
_mallTransition = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 520),
reverseDuration: const Duration(milliseconds: 520),
);
_mallProgress = CurvedAnimation(
parent: _mallTransition,
curve: const Cubic(0.8, 0.05, 0.2, 0.95),
reverseCurve: const Cubic(0.8, 0.05, 0.2, 0.95),
);
final initialMallState = MallWebHostController.instance.state.value;
_mallPresented = initialMallState.url != null;
_mallActive = initialMallState.visible;
_mallTransition.value = _mallActive ? 1 : 0;
_mallConfigSubscription = ref.listenManual<MallTabConfig>(
mallTabConfigProvider,
(_, next) {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) _preloadMall(next);
});
},
fireImmediately: true,
);
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
final brightness = Theme.of(context).brightness;
if (_mallBrightness == brightness) return;
_mallBrightness = brightness;
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) _preloadMall(ref.read(mallTabConfigProvider));
});
}
void _preloadMall(MallTabConfig config) {
if (!config.isVisible) return;
final uri = config.attributedUri(
clickId: '',
isDark: Theme.of(context).brightness == Brightness.dark,
);
if (uri != null) MallWebHostController.instance.preload(uri);
}
@override
void dispose() {
MallWebHostController.instance.state.removeListener(_syncMallHost);
MallBridgeController.instance.state.removeListener(_refreshMallDock);
_mallConfigSubscription.close();
_minimizeFactor.dispose();
_minimizeController.dispose();
_mallProgress.dispose();
_mallTransition.dispose();
super.dispose();
}
void _syncMallHost() {
final state = MallWebHostController.instance.state.value;
if (!mounted) return;
final changed = _mallActive != state.visible;
final showHomeBadge =
changed &&
state.visible &&
!_mallHomeBadgeSeen &&
ref.read(mallTabConfigProvider).showsEntryBadge;
setState(() {
_mallPresented |= state.url != null;
_mallActive = state.visible;
if (changed) {
_showMallHomeBadgeForPresentation = showHomeBadge;
if (showHomeBadge) _mallHomeBadgeSeen = true;
}
});
if (showHomeBadge) {
unawaited(_mallEntryPromoStore.markHomeBadgeSeen());
}
if (changed) {
if (state.visible) {
_mallTransition.forward();
} else {
_mallTransition.reverse();
}
}
}
void _refreshMallDock() {
if (mounted && _mallActive) setState(() {});
}
Future<void> _openMall(MallTabConfig config) async {
await _consumeMallEntryTip(config);
if (!mounted) return;
final result = await ref
.read(mallEntryControllerProvider)
.open(context, initialConfig: config);
if (!mounted) return;
if (result == MallEntryOpenResult.unavailable) {
toastInfo(msg: '商城暂未开放');
} else if (result == MallEntryOpenResult.failed) {
toastInfo(msg: '商城打开失败,请稍后重试');
}
}
Future<void> _consumeMallEntryTip(MallTabConfig config) async {
if (!config.showsEntryTip || _mallEntryTipConsumed) return;
setState(() => _mallEntryTipConsumed = true);
await _mallEntryPromoStore.markMallOpened();
}
bool get _isPrimaryTabRoot => switch (widget.location) {
AppRoutes.assets ||
AppRoutes.market ||
AppRoutes.news ||
AppRoutes.profile => true,
_ => false,
};
@override @override
void didUpdateWidget(covariant TabShell oldWidget) { void didUpdateWidget(covariant TabShell oldWidget) {
super.didUpdateWidget(oldWidget); super.didUpdateWidget(oldWidget);
if (oldWidget.location != widget.location && _showCompactHeader) { if (oldWidget.location != widget.location) {
_showCompactHeader = false; _expandBar(spring: false);
_resetScrollTracking();
if (_showCompactHeader) _showCompactHeader = false;
} }
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final cs = ShadTheme.of(context).colorScheme; final cs = ShadTheme.of(context).colorScheme;
final mall = ref.watch(mallTabConfigProvider);
final startupAdResolved = ref.watch(startupAdResolvedProvider);
final isQiyuKeyboardActive =
MallWebHostController.instance.state.value.isQiyuKeyboardActive;
final header = _headerForPath(widget.location); final header = _headerForPath(widget.location);
final canPop = GoRouter.of(context).canPop(); final canPop = GoRouter.of(context).canPop();
final isAndroid =
!kIsWeb && defaultTargetPlatform == TargetPlatform.android;
return Scaffold( return Scaffold(
backgroundColor: cs.background,
// The resident mall stays visually fixed for ordinary pages. Qiyu is
// different: its WebView editor must receive the resized Android body
// when the IME opens, otherwise its delayed focus-scroll ends below the
// keyboard.
resizeToAvoidBottomInset: _mallActive && isQiyuKeyboardActive,
body: Stack(
children: [
AnimatedBuilder(
animation: _mallProgress,
builder: (context, child) => Transform.translate(
offset: Offset(
-MediaQuery.sizeOf(context).width * _mallProgress.value,
0,
),
child: child,
),
child: IgnorePointer(
ignoring: _mallActive,
child: PopScope(
canPop: !isAndroid || !_mallActive,
onPopInvokedWithResult: (didPop, _) {
if (!didPop && isAndroid && _mallActive) {
MallWebHostController.instance.handleSystemBack();
}
},
child: Scaffold(
extendBody: true,
backgroundColor: cs.background, backgroundColor: cs.background,
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
appBar: AppBar( appBar: AppBar(
@@ -96,96 +308,660 @@ class _TabShellState extends State<TabShell> {
color: cs.background, color: cs.background,
child: NotificationListener<ScrollNotification>( child: NotificationListener<ScrollNotification>(
onNotification: _handleScrollNotification, onNotification: _handleScrollNotification,
child: Stack(children: [Positioned.fill(child: widget.child)]), child: widget.navigationShell,
), ),
), ),
bottomNavigationBar: DecoratedBox(
decoration: BoxDecoration(
color: Colors.white,
border: Border(top: BorderSide(color: cs.border, width: 1)),
), ),
child: SafeArea( ),
top: false, ),
child: SizedBox( ),
height: 62, if (_mallPresented &&
child: Row( MallWebHostController.instance.state.value.url != null)
children: [ Positioned.fill(
for (var i = 0; i < _tabs.length; i++) child: AnimatedBuilder(
Expanded( animation: _mallProgress,
child: _TabButton( builder: (context, child) => Transform.translate(
icon: i == _index ? _filledIcons[i] : _outlineIcons[i], offset: Offset(
label: _labels[i], MediaQuery.sizeOf(context).width *
selected: i == _index, (1 - _mallProgress.value),
onTap: () => context.go(_tabs[i]), 0,
),
child: child,
),
child: IgnorePointer(
ignoring: !_mallActive,
child: MallWebHost(
url: MallWebHostController.instance.state.value.url!,
visible: _mallActive,
onRequestExit: MallWebHostController.instance.dismiss,
),
),
),
),
if (!(_mallActive &&
(MallBridgeController.instance.state.value.canGoBack ||
MallWebHostController
.instance
.state
.value
.isShowingQiyuPage)))
Positioned(
left: 0,
right: 0,
bottom: 0,
child: _MorphingNavigationDock(
progress: _mallProgress,
minimize: _minimizeFactor,
currentIndex: _index,
mall: mall,
showMallEntryTip:
startupAdResolved &&
_isPrimaryTabRoot &&
!_mallActive &&
!_mallEntryTipConsumed &&
mall.showsEntryTip,
showMallHomeBadge:
_showMallHomeBadgeForPresentation && mall.showsEntryBadge,
onTabTap: (index) => widget.navigationShell.goBranch(
index,
initialLocation: index == _index,
),
onMallTap: () => _openMall(mall),
),
),
if (!kReleaseMode)
Positioned(
right: 16,
bottom: 88,
child: FilledButton(
onPressed: () => context.push(AppRoutes.fancyDioInspector),
style: FilledButton.styleFrom(
backgroundColor: cs.primary,
foregroundColor: cs.primaryForeground,
minimumSize: const Size(60, 60),
shape: const CircleBorder(),
padding: EdgeInsets.zero,
),
child: const Text('请求'),
), ),
), ),
], ],
), ),
);
}
void _resetScrollTracking() {
_userScrollSession = false;
_userScrollDirection = ScrollDirection.idle;
_directionAccum = 0;
}
void _expandBar({bool immediate = false, bool spring = true}) {
if (!_barMinimized && _minimizeController.value == 0) return;
_barMinimized = false;
if (immediate) {
_minimizeController.value = 0;
return;
}
final alreadyReversing =
_minimizeController.isAnimating &&
_minimizeController.status == AnimationStatus.reverse;
if (!alreadyReversing) {
_minimizeFactor.reverseCurve = spring
? _expandSpring
: Curves.easeOutCubic;
}
unawaited(_minimizeController.reverse());
}
void _minimizeBar() {
if (_barMinimized && _minimizeController.value == 1) return;
_barMinimized = true;
unawaited(_minimizeController.forward());
}
bool _handleScrollNotification(ScrollNotification notification) {
final metrics = notification.metrics;
if (metrics.axis != Axis.vertical) return false;
final next = notification.metrics.pixels > _compactHeaderThreshold;
if (next != _showCompactHeader && mounted) {
setState(() => _showCompactHeader = next);
}
if (notification.depth != 0) return false;
if (notification is UserScrollNotification) {
_userScrollDirection = notification.direction;
_userScrollSession = notification.direction != ScrollDirection.idle;
return false;
}
if (notification is ScrollStartNotification) {
if (notification.dragDetails != null) {
_userScrollSession = true;
_directionAccum = 0;
}
return false;
}
final atTop = metrics.pixels <= metrics.minScrollExtent + _topRevealEpsilon;
if (atTop) {
_directionAccum = 0;
if (_barMinimized || _minimizeController.value > 0) _expandBar();
return false;
}
if (notification is! ScrollUpdateNotification) return false;
if (notification.dragDetails != null) _userScrollSession = true;
if (!_userScrollSession && _userScrollDirection == ScrollDirection.idle) {
return false;
}
final delta = notification.scrollDelta;
if (delta == null || delta == 0) return false;
final direction = _userScrollDirection != ScrollDirection.idle
? _userScrollDirection
: delta > 0
? ScrollDirection.reverse
: ScrollDirection.forward;
if (direction == ScrollDirection.reverse) {
if (_directionAccum < 0) _directionAccum = 0;
_directionAccum += delta.abs();
if (_directionAccum >= _scrollVisibilityThreshold) {
_directionAccum = 0;
_minimizeBar();
}
} else if (direction == ScrollDirection.forward) {
if (_directionAccum > 0) _directionAccum = 0;
_directionAccum -= delta.abs();
if (_directionAccum <= -_scrollVisibilityThreshold) {
_directionAccum = 0;
_expandBar();
}
}
return false;
}
}
class _MorphingNavigationDock extends StatelessWidget {
const _MorphingNavigationDock({
required this.progress,
required this.minimize,
required this.currentIndex,
required this.mall,
required this.showMallEntryTip,
required this.showMallHomeBadge,
required this.onTabTap,
required this.onMallTap,
});
final Animation<double> progress;
final Animation<double> minimize;
final int currentIndex;
final MallTabConfig mall;
final bool showMallEntryTip;
final bool showMallHomeBadge;
final ValueChanged<int> onTabTap;
final VoidCallback onMallTap;
@override
Widget build(BuildContext context) {
final bottomInset = MediaQuery.viewPaddingOf(context).bottom;
final cs = ShadTheme.of(context).colorScheme;
final bridge = MallBridgeController.instance.state.value;
final nativeItems = [
for (var index = 0; index < _labels.length; index++)
_DockTabItem(
label: _labels[index],
outline: _outlineIcons[index],
filled: _filledIcons[index],
symbol: _nativeSymbols[index],
),
];
final mallItems = [
for (final item in _MallNavigationDock.tabs)
_DockTabItem(label: item.$4, outline: item.$2, filled: item.$3),
];
return AnimatedBuilder(
animation: Listenable.merge([progress, minimize]),
builder: (context, _) {
final t = progress.value.clamp(0.0, 1.0);
final minimized = minimize.value * (1 - t);
return SizedBox(
height: 84 + bottomInset,
child: Align(
alignment: Alignment.bottomCenter,
child: LayoutBuilder(
builder: (context, constraints) {
const side = 16.0;
const gap = 12.0;
const circle = 64.0;
final pill = mall.isVisible
? constraints.maxWidth - side * 2 - gap - circle
: constraints.maxWidth - side * 2;
final leftWidth = mall.isVisible
? lerpDouble(pill, circle, t)!
: pill;
final rightWidth = lerpDouble(circle, pill, t)!;
return Padding(
padding: EdgeInsets.fromLTRB(side, 8, side, 10 + bottomInset),
child: Transform.scale(
scale: lerpDouble(1, 0.86, minimized)!,
alignment: Alignment.bottomCenter,
child: Row(
children: [
_MallDockSurface(
width: leftWidth,
height: circle,
child: Stack(
fit: StackFit.expand,
children: [
IgnorePointer(
ignoring: t > 0.5,
child: Opacity(
opacity: (1 - t * 2).clamp(0.0, 1.0),
child: _ExpandingDockTabStrip(
items: nativeItems,
selectedIndex: currentIndex,
minimize: minimized,
onTap: onTabTap,
),
),
),
IgnorePointer(
ignoring: t < 0.5,
child: Opacity(
opacity: ((t - 0.5) * 2).clamp(0.0, 1.0),
child: IconButton(
tooltip: '返回',
onPressed:
MallWebHostController.instance.dismiss,
icon: Icon(
AppIcons.arrowLeft,
size: 30,
color: cs.primary,
),
),
),
),
],
),
),
if (mall.isVisible) ...[
const SizedBox(width: gap),
_MallDockSurface(
width: rightWidth,
height: circle,
child: Stack(
fit: StackFit.expand,
children: [
IgnorePointer(
ignoring: t > 0.5,
child: Opacity(
opacity: (1 - t * 2).clamp(0.0, 1.0),
child: _MallLauncherButton(
mall: mall,
showPromoTip: showMallEntryTip,
onTap: onMallTap,
),
),
),
IgnorePointer(
ignoring: t < 0.5,
child: Opacity(
opacity: ((t - 0.5) * 2).clamp(0.0, 1.0),
child: _ExpandingDockTabStrip(
items: mallItems,
selectedIndex: _MallNavigationDock.tabs
.indexWhere(
(item) =>
item.$1 == bridge.activeTab,
),
onTap: (index) => MallBridgeController
.instance
.activate(
_MallNavigationDock.tabs[index].$1,
reselect:
bridge.activeTab ==
_MallNavigationDock
.tabs[index]
.$1,
),
promoBadgeIndex: 0,
promoBadgeVisible: showMallHomeBadge,
promoBadgeLabel: mall.entryBadgeText,
),
),
),
],
),
),
],
],
),
),
);
},
),
),
);
},
);
}
}
class _MallLauncherButton extends StatelessWidget {
const _MallLauncherButton({
required this.mall,
required this.showPromoTip,
required this.onTap,
});
final MallTabConfig mall;
final bool showPromoTip;
final VoidCallback onTap;
@override
Widget build(BuildContext context) {
final cs = ShadTheme.of(context).colorScheme;
return MallEntryPromoTooltip(
visible: showPromoTip,
title: mall.entryTipTitle,
body: mall.entryTipBody,
onCardTap: onTap,
child: Semantics(
button: true,
label: mall.title,
child: DecoratedBox(
decoration: BoxDecoration(
shape: BoxShape.circle,
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [cs.primary.withValues(alpha: 0.78), cs.primary],
),
),
child: Material(
color: Colors.transparent,
shape: const CircleBorder(),
clipBehavior: Clip.antiAlias,
child: InkWell(
onTap: onTap,
child: Center(
child: Icon(
Icons.shopping_bag,
size: 25,
color: cs.primaryForeground,
),
),
),
), ),
), ),
), ),
); );
} }
}
bool _handleScrollNotification(ScrollNotification notification) { class _DockTabItem {
if (notification.metrics.axis != Axis.vertical) { const _DockTabItem({
return false; required this.label,
} required this.outline,
final next = notification.metrics.pixels > _compactHeaderThreshold; required this.filled,
if (next != _showCompactHeader && mounted) { this.symbol,
setState(() => _showCompactHeader = next); });
}
return false; final String label;
final IconData outline;
final IconData filled;
final AppBottomTabSymbol? symbol;
}
class _ExpandingDockTabStrip extends StatelessWidget {
const _ExpandingDockTabStrip({
required this.items,
required this.selectedIndex,
required this.onTap,
this.minimize = 0,
this.promoBadgeIndex,
this.promoBadgeVisible = false,
this.promoBadgeLabel = '',
});
static const double _inset = 6;
static const double _selectedWidth = 92;
final List<_DockTabItem> items;
final int selectedIndex;
final ValueChanged<int> onTap;
final double minimize;
final int? promoBadgeIndex;
final bool promoBadgeVisible;
final String promoBadgeLabel;
@override
Widget build(BuildContext context) {
final safeIndex = selectedIndex.clamp(0, items.length - 1);
return LayoutBuilder(
builder: (context, constraints) {
final trackWidth = constraints.maxWidth - _inset * 2;
final selectedWidth = lerpDouble(
_selectedWidth.clamp(52.0, trackWidth).toDouble(),
52,
minimize.clamp(0.0, 1.0),
)!;
final compactWidth = (trackWidth - selectedWidth) / (items.length - 1);
final indicatorLeft = _inset + safeIndex * compactWidth;
return Stack(
fit: StackFit.expand,
clipBehavior: Clip.none,
children: [
AnimatedPositioned(
duration: const Duration(milliseconds: 260),
curve: Curves.easeOutCubic,
left: indicatorLeft,
top: _inset,
bottom: _inset,
width: selectedWidth,
child: _DockSelectionHighlight(
key: ValueKey('dock-selection-${items[safeIndex].label}'),
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: _inset),
child: Row(
children: [
for (var index = 0; index < items.length; index++)
AnimatedContainer(
duration: const Duration(milliseconds: 260),
curve: Curves.easeOutCubic,
width: index == safeIndex ? selectedWidth : compactWidth,
child: MallEntryPromoBadge(
visible: index == promoBadgeIndex && promoBadgeVisible,
label: promoBadgeLabel,
top: -2,
right: 0,
child: _ExpandingDockTab(
item: items[index],
selected: index == safeIndex,
labelFactor: index == safeIndex
? (1 - minimize).clamp(0.0, 1.0)
: 0,
onTap: () => onTap(index),
),
),
),
],
),
),
],
);
},
);
} }
} }
class _TabButton extends StatelessWidget { class _DockSelectionHighlight extends StatelessWidget {
const _TabButton({ const _DockSelectionHighlight({super.key});
required this.icon,
required this.label, @override
Widget build(BuildContext context) {
final cs = ShadTheme.of(context).colorScheme;
return DecoratedBox(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(26),
color: cs.primary.withValues(alpha: 0.14),
),
);
}
}
class _ExpandingDockTab extends StatelessWidget {
const _ExpandingDockTab({
required this.item,
required this.selected, required this.selected,
required this.labelFactor,
required this.onTap, required this.onTap,
}); });
final IconData icon; final _DockTabItem item;
final String label;
final bool selected; final bool selected;
final double labelFactor;
final VoidCallback onTap; final VoidCallback onTap;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final cs = ShadTheme.of(context).colorScheme; final cs = ShadTheme.of(context).colorScheme;
final color = selected ? cs.primary : cs.mutedForeground; return Semantics(
return InkWell( button: true,
selected: selected,
label: item.label,
child: InkWell(
onTap: onTap, onTap: onTap,
child: Column( borderRadius: BorderRadius.circular(26),
mainAxisAlignment: MainAxisAlignment.center, splashFactory: NoSplash.splashFactory,
overlayColor: const WidgetStatePropertyAll(Colors.transparent),
child: LayoutBuilder(
builder: (context, constraints) {
// `AnimatedContainer` changes a tab's width during a tab switch.
// Derive text room from this animation frame's *actual* width,
// not the target selected width, as Purse's tab button does.
final maxLabelWidth = (constraints.maxWidth - 31)
.clamp(0.0, 64.0)
.toDouble();
return Center(
child: Row(
mainAxisSize: MainAxisSize.min,
children: [ children: [
// if (selected) if (item.symbol case final symbol?)
// Container( AppBottomTabIcon(
// width: 22, symbol: symbol,
// height: 2.5, selected: selected,
// margin: const EdgeInsets.only(bottom: 6), size: 24,
// decoration: BoxDecoration( unselectedColor: cs.mutedForeground,
// color: cs.primary, selectedColor: cs.primary,
// borderRadius: const BorderRadius.vertical( )
// bottom: Radius.circular(3), else
// ), Icon(
// ), selected ? item.filled : item.outline,
// ) size: 24,
// else color: selected ? cs.primary : cs.mutedForeground,
// const SizedBox(height: 8.5), ),
Icon(icon, size: 22, color: color), if (selected)
const SizedBox(height: 4), ClipRect(
Text( child: Align(
label, alignment: Alignment.centerLeft,
widthFactor: labelFactor,
child: Opacity(
opacity: labelFactor,
child: Padding(
padding: const EdgeInsets.only(left: 7),
child: ConstrainedBox(
constraints: BoxConstraints(
maxWidth: maxLabelWidth,
),
child: Text(
item.label,
maxLines: 1,
overflow: TextOverflow.clip,
softWrap: false,
style: TextStyle( style: TextStyle(
fontSize: 11, color: cs.primary,
fontWeight: selected ? FontWeight.w600 : FontWeight.w400, fontSize: 16,
color: color, height: 1.1,
letterSpacing: 0, fontWeight: FontWeight.w600,
), ),
), ),
),
),
),
),
),
],
),
);
},
),
),
);
}
}
abstract final class _MallNavigationDock {
static const tabs = <(MallBridgeTab, IconData, IconData, String)>[
(MallBridgeTab.home, Icons.shopping_bag_outlined, Icons.shopping_bag, '首页'),
(MallBridgeTab.market, Icons.show_chart, Icons.insert_chart, '行情'),
(
MallBridgeTab.orders,
Icons.receipt_long_outlined,
Icons.receipt_long,
'订单',
),
(MallBridgeTab.profile, Icons.person_outline, Icons.person, '我的'),
];
}
class _MallDockSurface extends StatelessWidget {
const _MallDockSurface({this.width, this.height = 56, required this.child});
final double? width;
final double height;
final Widget child;
@override
Widget build(BuildContext context) {
final cs = ShadTheme.of(context).colorScheme;
return Container(
width: width,
height: height,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(height / 2),
boxShadow: [
BoxShadow(
color: Colors.black.withValues(alpha: 0.12),
blurRadius: 18,
offset: const Offset(0, 6),
),
],
),
child: Stack(
clipBehavior: Clip.none,
children: [
Positioned.fill(
// Clip only the frosted background. The mall promotion badge is
// intentionally positioned above the pill and must remain visible.
child: ClipRRect(
borderRadius: BorderRadius.circular(height / 2),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 18, sigmaY: 18),
child: DecoratedBox(
decoration: BoxDecoration(
color: cs.background.withValues(alpha: 0.82),
borderRadius: BorderRadius.circular(height / 2),
border: Border.all(color: cs.border.withValues(alpha: 0.8)),
),
),
),
),
),
Positioned.fill(child: child),
], ],
), ),
); );
@@ -206,6 +982,13 @@ const _outlineIcons = [
AppIcons.meLine, AppIcons.meLine,
]; ];
const _nativeSymbols = [
AppBottomTabSymbol.assets,
AppBottomTabSymbol.market,
AppBottomTabSymbol.news,
AppBottomTabSymbol.profile,
];
const _labels = ['资产', '行情', '资讯', '我的']; const _labels = ['资产', '行情', '资讯', '我的'];
_ShellHeader _headerForPath(String path) { _ShellHeader _headerForPath(String path) {
@@ -0,0 +1,42 @@
import 'dart:io' show Platform;
import 'package:android_intent_plus/android_intent.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:package_info_plus/package_info_plus.dart';
import '../../features/web/application/mall_web_host_controller.dart';
import '../storage/storage_service.dart';
import '../storage/preferences_storage.dart';
/// Clears only disposable presentation data. Credentials and user preferences
/// deliberately remain outside this service.
class CacheClearService {
const CacheClearService._();
static Future<void> clear() async {
await DefaultCacheManager().emptyCache();
await MallWebHostController.instance.clear();
await SplashAdControllerPlaceholder.clear();
}
static bool get requiresSystemSettings => !kIsWeb && Platform.isAndroid;
static Future<void> openAndroidSystemSettings() async {
final packageName = (await PackageInfo.fromPlatform()).packageName;
await AndroidIntent(
action: 'android.settings.APPLICATION_DETAILS_SETTINGS',
data: 'package:$packageName',
).launch();
}
}
/// CacheClearService is used outside Riverpod; the splash entry itself lives
/// in SharedPreferences and is removed here without touching user data.
abstract final class SplashAdControllerPlaceholder {
static Future<void> clear() async {
final preferences = PreferencesStorage(StorageService.to.preferences);
await preferences.remove('ads.splash.entry');
await preferences.remove('ads.splash.daily');
}
}
+28 -29
View File
@@ -3,15 +3,17 @@ import 'dart:io' show Platform;
import 'package:android_id/android_id.dart'; import 'package:android_id/android_id.dart';
import 'package:android_oaid/android_oaid.dart'; import 'package:android_oaid/android_oaid.dart';
import 'package:device_info_plus/device_info_plus.dart'; import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/foundation.dart' show kIsWeb; import 'package:flutter/foundation.dart' show defaultTargetPlatform, kIsWeb;
import 'package:flutter_paid/flutter_paid.dart'; import 'package:flutter_paid/flutter_paid.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:package_info_plus/package_info_plus.dart'; import 'package:package_info_plus/package_info_plus.dart';
import 'package:platform_metadata/platform_metadata.dart'; import 'package:platform_metadata/platform_metadata.dart';
import 'package:uuid/uuid.dart'; import 'package:uuid/uuid.dart';
import '../storage/storage_keys.dart'; import '../storage/storage_keys.dart';
import '../storage/storage_service.dart'; import '../storage/storage_service.dart';
import '../storage/preferences_storage.dart';
import '../storage/secure_identity_storage.dart';
import '../privacy/privacy_gate.dart';
/// 请求公共 + 平台身份 header 来源(完全对齐研值契约)。 /// 请求公共 + 平台身份 header 来源(完全对齐研值契约)。
/// AuthInterceptor 每个请求注入 commonHeaders() + platformIdentityHeaders(), /// AuthInterceptor 每个请求注入 commonHeaders() + platformIdentityHeaders(),
@@ -25,14 +27,13 @@ import '../storage/storage_service.dart';
class DeviceHeaderService { class DeviceHeaderService {
DeviceHeaderService._(); DeviceHeaderService._();
static final DeviceHeaderService to = DeviceHeaderService._(); static final DeviceHeaderService to = DeviceHeaderService._();
static const _storage = FlutterSecureStorage();
static const _kDeviceIdKey = 'device_id';
// static const _platformMetadataChannel = MethodChannel('platform_metadata'); // static const _platformMetadataChannel = MethodChannel('platform_metadata');
// 渠道:优先编译期 --dart-define=UMENG_CHANNEL=xxx;Android 其次读 manifest, // 渠道:优先编译期 --dart-define=UMENG_CHANNEL=xxx;Android 其次读 manifest,
static const _umengChannel = String.fromEnvironment('UMENG_CHANNEL'); static const _umengChannel = String.fromEnvironment('UMENG_CHANNEL');
String _deviceId = ''; String _deviceId = '';
String _packageName = '';
String _version = ''; String _version = '';
String _build = ''; String _build = '';
String _deviceModel = ''; String _deviceModel = '';
@@ -43,20 +44,23 @@ class DeviceHeaderService {
String _androidOaid = ''; String _androidOaid = '';
String _androidImei = ''; String _androidImei = '';
String _androidMac = ''; String _androidMac = '';
IosDeviceInfo? iosDeviceInfo;
AndroidDeviceInfo? androidDeviceInfo;
Future<void>? _baseInitialization; Future<void>? _baseInitialization;
Future<void>? _identityInitialization; Future<void>? _identityInitialization;
SecureIdentityStorage get _identityStorage =>
SecureIdentityStorage(PreferencesStorage(StorageService.to.preferences));
Future<void> ensureInitialized() async { Future<void> ensureInitialized() async {
_baseInitialization ??= _initializeBase(); _baseInitialization ??= _initializeBase();
await _baseInitialization; await _baseInitialization;
// Align with tradingagents-flutter-app: Android only initializes device // Align with tradingagents-flutter-app: Android only initializes device
// information after the user has accepted the privacy policy. // information after the user has accepted the privacy policy.
if (!kIsWeb && if (requiresAndroidPrivacyConsent(
Platform.isAndroid && isWeb: kIsWeb,
!StorageService.to.getBool(storagePrivacyAgreed)) { platform: defaultTargetPlatform,
privacyAgreed: StorageService.to.getBool(storagePrivacyAgreed),
)) {
return; return;
} }
@@ -67,6 +71,7 @@ class DeviceHeaderService {
Future<void> _initializeBase() async { Future<void> _initializeBase() async {
try { try {
final info = await PackageInfo.fromPlatform(); final info = await PackageInfo.fromPlatform();
_packageName = info.packageName.trim();
_version = info.version; _version = info.version;
_build = info.buildNumber; _build = info.buildNumber;
} catch (_) {} } catch (_) {}
@@ -86,14 +91,14 @@ class DeviceHeaderService {
/// X-Device-Id:iOS 优先 IDFV(per-vendor 稳定),否则 UUIDv4; /// X-Device-Id:iOS 优先 IDFV(per-vendor 稳定),否则 UUIDv4;
/// 首次生成后写入 secure_storage,后续复用。 /// 首次生成后写入 secure_storage,后续复用。
Future<String> _resolveDeviceId() async { Future<String> _resolveDeviceId() async {
final stored = await _storage.read(key: _kDeviceIdKey); final stored = await _identityStorage.readDeviceId();
if (stored != null && stored.isNotEmpty) return stored; if (stored != null && stored.isNotEmpty) return stored;
var id = ''; var id = '';
if (!kIsWeb && Platform.isIOS) { if (!kIsWeb && Platform.isIOS) {
id = await _resolveIdfv(); id = await _resolveIdfv();
} }
if (id.isEmpty) id = const Uuid().v4(); if (id.isEmpty) id = const Uuid().v4();
await _storage.write(key: _kDeviceIdKey, value: id); await _identityStorage.saveDeviceId(id);
return id; return id;
} }
@@ -122,23 +127,9 @@ class DeviceHeaderService {
_iosIdfv = await _resolveIdfv(); _iosIdfv = await _resolveIdfv();
await _collectIosPaidIfMissing(); await _collectIosPaidIfMissing();
} }
await getDeviceInfo();
} catch (_) {} } catch (_) {}
} }
Future<void> getDeviceInfo() async {
try {
final deviceInfoPlugin = DeviceInfoPlugin();
if (Platform.isIOS) {
iosDeviceInfo = await deviceInfoPlugin.iosInfo;
} else if (Platform.isAndroid) {
androidDeviceInfo = await deviceInfoPlugin.androidInfo;
}
} catch (e) {
print('$e');
}
}
Future<void> _collectAndroidIdIfAgreed() async { Future<void> _collectAndroidIdIfAgreed() async {
if (_androidId.isNotEmpty) return; if (_androidId.isNotEmpty) return;
if (!StorageService.to.getBool(storagePrivacyAgreed)) return; // 隐私同意后才采集 if (!StorageService.to.getBool(storagePrivacyAgreed)) return; // 隐私同意后才采集
@@ -198,12 +189,19 @@ class DeviceHeaderService {
await StorageService.to.setBool(storagePrivacyAgreed, true); await StorageService.to.setBool(storagePrivacyAgreed, true);
} }
/// ATT 授权后写入 IDFA;后续请求通过 platformIdentityHeaders 自动带上。
Future<void> saveIosIdfa(String value) async {
if (value.trim().isEmpty) return;
await StorageService.to.setString(storageIosIdfa, value.trim());
}
/// 是否需要首启隐私合规确认。**仅 Android**(合规要求:同意前不得采集设备 /// 是否需要首启隐私合规确认。**仅 Android**(合规要求:同意前不得采集设备
/// 标识)。由 go_router redirect 调用,未同意则强制跳隐私页。 /// 标识)。由 go_router redirect 调用,未同意则强制跳隐私页。
bool get privacyConsentRequired => bool get privacyConsentRequired => requiresAndroidPrivacyConsent(
!kIsWeb && isWeb: kIsWeb,
Platform.isAndroid && platform: defaultTargetPlatform,
!StorageService.to.getBool(storagePrivacyAgreed); privacyAgreed: StorageService.to.getBool(storagePrivacyAgreed),
);
/// iOS 首次启动页:仅在首次安装后展示一次。 /// iOS 首次启动页:仅在首次安装后展示一次。
bool get iosStartupRequired => bool get iosStartupRequired =>
@@ -250,6 +248,7 @@ class DeviceHeaderService {
/// 公共 header(不含 token)。11 /// 公共 header(不含 token)。11
Map<String, String> commonHeaders() => _compact({ Map<String, String> commonHeaders() => _compact({
'X-Device-Id': _deviceId, 'X-Device-Id': _deviceId,
'pkg': _packageName,
'User-Version': _version, 'User-Version': _version,
'User-BuildID': _build, 'User-BuildID': _build,
'User-Platform': _platform(), 'User-Platform': _platform(),
@@ -0,0 +1,29 @@
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'storage_service.dart';
/// Typed boundary for non-sensitive preferences and display caches.
///
/// Feature code depends on this class instead of constructing or retaining a
/// [SharedPreferences] instance.
class PreferencesStorage {
const PreferencesStorage(this._preferences);
final SharedPreferences _preferences;
bool getBool(String key, {bool defaultValue = false}) =>
_preferences.getBool(key) ?? defaultValue;
String? getString(String key) => _preferences.getString(key);
bool containsKey(String key) => _preferences.containsKey(key);
Future<void> setBool(String key, bool value) =>
_preferences.setBool(key, value);
Future<void> setString(String key, String value) =>
_preferences.setString(key, value);
Future<void> remove(String key) => _preferences.remove(key);
}
final preferencesStorageProvider = Provider<PreferencesStorage>(
(ref) => PreferencesStorage(StorageService.to.preferences),
);
@@ -0,0 +1,185 @@
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'preferences_storage.dart';
import 'storage_keys.dart';
abstract interface class SecureKeyValueStorage {
Future<String?> read(String key);
Future<void> write(String key, String value);
Future<void> delete(String key);
}
class FlutterSecureKeyValueStorage implements SecureKeyValueStorage {
const FlutterSecureKeyValueStorage();
static const _storage = FlutterSecureStorage();
@override
Future<String?> read(String key) => _storage.read(key: key);
@override
Future<void> write(String key, String value) =>
_storage.write(key: key, value: value);
@override
Future<void> delete(String key) => _storage.delete(key: key);
}
/// Sensitive identity values stay behind one injectable storage boundary.
/// Legacy plaintext preferences are migrated only after a secure write works.
class SecureIdentityStorage {
SecureIdentityStorage(
this._preferences, {
SecureKeyValueStorage secureStorage = const FlutterSecureKeyValueStorage(),
}) : _storage = secureStorage;
final PreferencesStorage _preferences;
final SecureKeyValueStorage _storage;
Future<String?> restoreAccessToken() async {
final legacyPreferences = _normalized(
_preferences.getString(storageLegacyAccessToken),
);
final hasInstallSession = _preferences.getBool(storageAuthSessionActive);
// A plaintext token proves that this installation predates secure storage
// migration. A Keychain token by itself does not: iOS may retain it after
// uninstall while SharedPreferences (including this marker) is reset.
if (!hasInstallSession && legacyPreferences == null) {
await _deleteAllAuthCredentials();
await _preferences.remove(storageAuthSessionActive);
return null;
}
final current = _normalized(await _storage.read(secureAccessToken));
final legacySecure = current == null
? _normalized(await _storage.read(secureLegacyJwtToken))
: null;
final token = current ?? legacyPreferences ?? legacySecure;
if (current == null && token != null) {
await _storage.write(secureAccessToken, token);
}
await _storage.delete(secureLegacyJwtToken);
await _preferences.remove(storageLegacyAccessToken);
if (token == null) {
await _preferences.remove(storageAuthSessionActive);
} else {
await _preferences.setBool(storageAuthSessionActive, true);
}
return token;
}
Future<String?> readJwt() async {
if (!_preferences.getBool(storageAuthSessionActive) ||
_preferences.containsKey(storageLegacyAccessToken)) {
return restoreAccessToken();
}
final token = _normalized(await _storage.read(secureAccessToken));
if (token == null) await _preferences.remove(storageAuthSessionActive);
return token;
}
Future<void> saveJwt(String token) async {
final normalized = _normalized(token);
if (normalized == null) {
throw ArgumentError.value(token, 'token', 'must not be empty');
}
await _storage.write(secureAccessToken, normalized);
await _storage.delete(secureLegacyJwtToken);
await _preferences.remove(storageLegacyAccessToken);
await _preferences.setBool(storageAuthSessionActive, true);
}
Future<void> clearJwt() async {
await _deleteAllAuthCredentials();
await _preferences.remove(storageLegacyAccessToken);
await _preferences.remove(storageAuthSessionActive);
}
Future<void> clearSessionCredentials() async {
await clearJwt();
await _storage.delete(secureMallCredential);
await _storage.delete(secureRefreshToken);
}
Future<void> clearAccountCredentials() async {
await clearSessionCredentials();
await _storage.delete(secureBiometricCredential);
}
Future<String?> readDeviceId() => _storage.read(secureDeviceId);
Future<void> saveDeviceId(String deviceId) =>
_storage.write(secureDeviceId, deviceId);
Future<void> _deleteAllAuthCredentials() async {
await _storage.delete(secureAccessToken);
await _storage.delete(secureLegacyJwtToken);
}
}
final secureIdentityStorageProvider = Provider<SecureIdentityStorage>(
(ref) => SecureIdentityStorage(ref.watch(preferencesStorageProvider)),
);
/// Process-memory session snapshot. Interceptors read this synchronously;
/// secure storage is touched only when a session starts, restores, or ends.
class AuthSessionStorage {
AuthSessionStorage(this._identityStorage);
final SecureIdentityStorage _identityStorage;
String? _accessToken;
int _generation = 0;
Future<String?>? _restoreFuture;
Future<void> _operationTail = Future<void>.value();
String? get accessToken => _accessToken;
int get generation => _generation;
Future<String?> restore() => _restoreFuture ??= _serialize(_restore);
Future<String?> _restore() async {
_accessToken = await _identityStorage.restoreAccessToken();
_generation++;
return _accessToken;
}
Future<void> save(String token) async {
await _serialize(() async {
await _identityStorage.saveJwt(token);
_accessToken = token.trim();
_generation++;
_restoreFuture = Future<String?>.value(_accessToken);
});
}
Future<void> clear({bool accountDeleted = false}) async {
await _serialize(() async {
if (accountDeleted) {
await _identityStorage.clearAccountCredentials();
} else {
await _identityStorage.clearSessionCredentials();
}
_accessToken = null;
_generation++;
_restoreFuture = Future<String?>.value();
});
}
Future<T> _serialize<T>(Future<T> Function() operation) {
final result = _operationTail.then((_) => operation());
_operationTail = result.then<void>(
(_) {},
onError: (Object _, StackTrace _) {},
);
return result;
}
}
final authSessionStorageProvider = Provider<AuthSessionStorage>(
(ref) => AuthSessionStorage(ref.watch(secureIdentityStorageProvider)),
);
String? _normalized(String? value) {
final normalized = value?.trim() ?? '';
return normalized.isEmpty ? null : normalized;
}
+22 -1
View File
@@ -2,11 +2,32 @@ const storageThemeMode = 'theme_mode';
const storagePrivacyAgreed = 'privacy_agreed'; // Android 首启隐私同意(设备采集门控) const storagePrivacyAgreed = 'privacy_agreed'; // Android 首启隐私同意(设备采集门控)
const storageIosStartupSeen = 'ios_startup_seen'; // iOS 首次启动页已展示 const storageIosStartupSeen = 'ios_startup_seen'; // iOS 首次启动页已展示
const storageJinzhiHoldings = 'jinzhi_holdings'; const storageJinzhiHoldings = 'jinzhi_holdings';
const storageJinzhiHoldingsDeleted = 'jinzhi_holdings_deleted';
const storageJinzhiAmountHidden = 'jinzhi_amount_hidden'; const storageJinzhiAmountHidden = 'jinzhi_amount_hidden';
const storageJinzhiRecycleDiscounts = 'jinzhi_recycle_discounts'; const storageJinzhiRecycleDiscounts = 'jinzhi_recycle_discounts';
const storageJinzhiPurityPresets = 'jinzhi_purity_presets'; const storageJinzhiPurityPresets = 'jinzhi_purity_presets';
const storageJinzhiPriceColorMode = 'jinzhi_price_color_mode'; const storageJinzhiPriceColorMode = 'jinzhi_price_color_mode';
const storageJinzhiMockLoggedIn = 'jinzhi_mock_logged_in'; const storageUserId = 'jinzhi_user_id';
const storageUserPhone = 'jinzhi_user_phone';
const storageUserCreatedAt = 'jinzhi_user_created_at';
const storagePushPermissionPrompted = 'push_permission_prompted';
const storageMallEntryPromoOpened = 'jinzhi_mall_entry_promo_opened';
const storageMallHomeBadgeSeen = 'jinzhi_mall_home_badge_seen';
// Previous builds could persist credentials in SharedPreferences. These keys
// exist only for one-time migration into secure storage.
const storageLegacyAccessToken = 'access_token';
const storageAuthSessionActive = 'auth_session_active';
// Account-scoped secure values. They are intentionally listed even before
// every feature is implemented so account deletion has one complete cleanup
// boundary. Access tokens must never be reused as biometric credentials.
const secureAccessToken = 'access_token';
const secureLegacyJwtToken = 'jwt_token';
const secureDeviceId = 'device_id';
const secureMallCredential = 'mall_credential';
const secureRefreshToken = 'refresh_token';
const secureBiometricCredential = 'biometric_credential';
// 设备/广告标识。由各自的 SDK/ATT 流程写入,DeviceHeaderService 读出注入 // 设备/广告标识。由各自的 SDK/ATT 流程写入,DeviceHeaderService 读出注入
// header;未写入则为空、注入时被过滤。 // header;未写入则为空、注入时被过滤。
+4
View File
@@ -6,6 +6,8 @@ class StorageService {
static StorageService? _instance; static StorageService? _instance;
static StorageService get to => _instance!; static StorageService get to => _instance!;
SharedPreferences get preferences => _prefs;
static Future<StorageService> get instance async { static Future<StorageService> get instance async {
if (_instance != null) return _instance!; if (_instance != null) return _instance!;
final prefs = await SharedPreferences.getInstance(); final prefs = await SharedPreferences.getInstance();
@@ -17,4 +19,6 @@ class StorageService {
Future<void> setBool(String key, bool v) => _prefs.setBool(key, v); Future<void> setBool(String key, bool v) => _prefs.setBool(key, v);
String? getString(String key) => _prefs.getString(key); String? getString(String key) => _prefs.getString(key);
Future<void> setString(String key, String v) => _prefs.setString(key, v); Future<void> setString(String key, String v) => _prefs.setString(key, v);
bool containsKey(String key) => _prefs.containsKey(key);
Future<void> remove(String key) => _prefs.remove(key);
} }
+184
View File
@@ -1,4 +1,8 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_remix/flutter_remix.dart'; import 'package:flutter_remix/flutter_remix.dart';
import 'package:not_static_icons/not_static_icons.dart' as nsi;
// flutter_remix 0.0.3: icon class is FlutterRemix // flutter_remix 0.0.3: icon class is FlutterRemix
class AppIcons { class AppIcons {
@@ -13,3 +17,183 @@ class AppIcons {
static const arrowRight = FlutterRemix.arrow_right_s_line; static const arrowRight = FlutterRemix.arrow_right_s_line;
static const arrowLeft = FlutterRemix.arrow_left_s_line; static const arrowLeft = FlutterRemix.arrow_left_s_line;
} }
enum AppBottomTabSymbol { assets, market, news, profile }
class AppBottomTabIcon extends StatefulWidget {
const AppBottomTabIcon({
required this.symbol,
required this.selected,
required this.unselectedColor,
required this.selectedColor,
this.size = 24,
super.key,
});
final AppBottomTabSymbol symbol;
final bool selected;
final Color unselectedColor;
final Color selectedColor;
final double size;
@override
State<AppBottomTabIcon> createState() => _AppBottomTabIconState();
}
class _AppBottomTabIconState extends State<AppBottomTabIcon>
with TickerProviderStateMixin {
static const _iconMotionDuration = Duration(milliseconds: 420);
static const _selectionDuration = Duration(milliseconds: 140);
static const _popDuration = Duration(milliseconds: 260);
static const _scalePeak = 1.06;
final nsi.AnimatedIconController _iconController =
nsi.AnimatedIconController();
late final AnimationController _selectionController = AnimationController(
vsync: this,
duration: _selectionDuration,
reverseDuration: _selectionDuration,
value: widget.selected ? 1 : 0,
);
late final AnimationController _popController = AnimationController(
vsync: this,
duration: _popDuration,
);
late final CurvedAnimation _colorProgress = CurvedAnimation(
parent: _selectionController,
curve: Curves.easeOutCubic,
reverseCurve: Curves.easeOutCubic,
);
late final Animation<double> _scaleAnimation = TweenSequence<double>([
TweenSequenceItem(
tween: Tween(
begin: 1.0,
end: _scalePeak,
).chain(CurveTween(curve: Curves.easeOutBack)),
weight: 55,
),
TweenSequenceItem(
tween: Tween(
begin: _scalePeak,
end: 1.0,
).chain(CurveTween(curve: Curves.easeOutCubic)),
weight: 45,
),
]).animate(_popController);
bool get _reduceMotion => MediaQuery.disableAnimationsOf(context);
@override
void initState() {
super.initState();
if (widget.selected) {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted && !_reduceMotion) _iconController.animate();
});
}
}
@override
void didUpdateWidget(covariant AppBottomTabIcon oldWidget) {
super.didUpdateWidget(oldWidget);
if (widget.selected == oldWidget.selected) return;
if (widget.selected) {
if (_reduceMotion) {
_selectionController.value = 1;
_popController.value = 0;
} else {
unawaited(_selectionController.forward(from: 0));
unawaited(_popController.forward(from: 0));
_iconController.animate();
}
} else {
if (_reduceMotion) {
_selectionController.value = 0;
} else {
unawaited(_selectionController.reverse());
}
_popController.value = 0;
_iconController.reset();
}
}
@override
void dispose() {
_colorProgress.dispose();
_selectionController.dispose();
_popController.dispose();
_iconController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final reduceMotion = _reduceMotion;
return SizedBox.square(
dimension: widget.size,
child: AnimatedBuilder(
animation: Listenable.merge([_selectionController, _popController]),
builder: (context, _) {
final color = Color.lerp(
widget.unselectedColor,
widget.selectedColor,
reduceMotion ? (widget.selected ? 1 : 0) : _colorProgress.value,
)!;
return Transform.scale(
scale: reduceMotion ? 1 : _scaleAnimation.value,
child: _buildBottomTabIcon(
widget.symbol,
size: widget.size,
color: color,
controller: _iconController,
),
);
},
),
);
}
}
Widget _buildBottomTabIcon(
AppBottomTabSymbol symbol, {
required double size,
required Color color,
required nsi.AnimatedIconController controller,
}) {
const strokeWidth = 2.05;
const duration = _AppBottomTabIconState._iconMotionDuration;
return switch (symbol) {
AppBottomTabSymbol.assets => nsi.CoinsIcon(
size: size,
color: color,
animationDuration: duration,
strokeWidth: strokeWidth,
interactive: false,
controller: controller,
),
AppBottomTabSymbol.market => nsi.ChartCandlestickIcon(
size: size,
color: color,
animationDuration: duration,
strokeWidth: strokeWidth,
interactive: false,
controller: controller,
),
AppBottomTabSymbol.news => nsi.BookOpenTextIcon(
size: size,
color: color,
animationDuration: duration,
strokeWidth: strokeWidth,
interactive: false,
controller: controller,
),
AppBottomTabSymbol.profile => nsi.CircleUserIcon(
size: size,
color: color,
animationDuration: duration,
strokeWidth: strokeWidth,
interactive: false,
controller: controller,
),
};
}
+82
View File
@@ -0,0 +1,82 @@
import 'dart:async';
import 'dart:io';
import 'package:app_tracking_transparency/app_tracking_transparency.dart';
import 'package:flutter/foundation.dart';
import 'package:umeng_common_sdk/umeng_common_sdk.dart';
import 'package:umeng_verify_sdk/umeng_verify_sdk.dart';
import '../config/umeng_config.dart';
import '../services/device_header_service.dart';
import '../storage/storage_keys.dart';
import '../storage/storage_service.dart';
/// 合规门禁后的友盟公共初始化入口;运营商认证只可由显式登录动作触发。
abstract final class UmengService {
static Future<void>? _initializing;
static bool _ready = false;
static Future<void>? _oneKeyInitializing;
static bool _oneKeyReady = false;
static Future<void> initIfAllowed() {
if (_ready || kIsWeb) return Future.value();
if (Platform.isAndroid &&
!StorageService.to.getBool(storagePrivacyAgreed)) {
return Future.value();
}
return _initializing ??= _init().whenComplete(() => _initializing = null);
}
static Future<void> _init() async {
await DeviceHeaderService.to.ensureInitialized();
// Keep the carrier-login launch path independent of UMeng Common's
// network initialization. Waiting for this future is what left the login
// overlay spinning forever in the base project; U-Verify is configured
// immediately below by initOneKeyLoginIfAllowed.
unawaited(
UmengCommonSdk.initCommon(
UmengConfig.androidAppKey,
UmengConfig.iosAppKey,
DeviceHeaderService.to.commonHeaders()['User-Channel'] ?? 'default',
UmengConfig.androidPushSecret,
).catchError((Object _) {}),
);
_ready = true;
}
/// 研听最新合规策略:禁止启动、隐私同意、推送注册等路径预取运营商认证。
/// 该方法仅允许在用户明确点按登录后由 [OneKeyLoginService] 调用。
static Future<void> initOneKeyLoginIfAllowed() async {
if (_oneKeyReady || kIsWeb) return;
if (Platform.isAndroid &&
!StorageService.to.getBool(storagePrivacyAgreed)) {
return;
}
await initIfAllowed();
return _oneKeyInitializing ??= _initOneKey().whenComplete(
() => _oneKeyInitializing = null,
);
}
static Future<void> _initOneKey() async {
if (Platform.isAndroid) UmengVerifySdk.register_android();
await UmengVerifySdk.setVerifySDKInfo(
UmengConfig.androidLoginSecret,
UmengConfig.iosLoginSecret,
);
_oneKeyReady = true;
}
static Future<void> requestTrackingAuthorizationIfNeeded() async {
if (kIsWeb || !Platform.isIOS) return;
try {
final status =
await AppTrackingTransparency.requestTrackingAuthorization();
if (status != TrackingStatus.authorized) return;
final idfa = await AppTrackingTransparency.getAdvertisingIdentifier();
await DeviceHeaderService.to.saveIosIdfa(idfa);
} catch (_) {
// ATT 拒绝/不可用不能阻断启动。
}
}
}
-20
View File
@@ -1,20 +0,0 @@
import '../../features/assets/data/asset_models.dart';
class UploadRepository {
const UploadRepository();
Future<UploadResult> uploadAssetImage(AssetImage image) async {
// TODO: Connect to upload backend.
return UploadResult(
remoteUrl: image.remoteUrl,
thumbnailUrl: image.thumbnailUrl,
);
}
}
class UploadResult {
const UploadResult({this.remoteUrl, this.thumbnailUrl});
final String? remoteUrl;
final String? thumbnailUrl;
}
-13
View File
@@ -1,13 +0,0 @@
import '../../features/assets/data/asset_models.dart';
import 'upload_repository.dart';
class UploadService {
const UploadService({required this.repository});
final UploadRepository repository;
Future<UploadResult> uploadAssetImage(AssetImage image) async {
// Placeholder: future implementation will upload the file and return URLs.
return repository.uploadAssetImage(image);
}
}
+60
View File
@@ -0,0 +1,60 @@
import 'dart:io' show Platform;
import 'package:android_intent_plus/android_intent.dart';
import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:url_launcher/url_launcher.dart';
typedef AndroidIntentLauncher = Future<void> Function(AndroidIntent intent);
abstract final class AppLinkUtil {
static final _androidPackageNamePattern = RegExp(
r'^[A-Za-z][A-Za-z0-9_]*(?:\.[A-Za-z][A-Za-z0-9_]*)+$',
);
static String targetAppFromUrl(String urlString) {
final value = Uri.tryParse(urlString)?.queryParameters['targetApp']?.trim();
if (value == null || !_androidPackageNamePattern.hasMatch(value)) return '';
return value;
}
static Future<bool> openExternal(Uri uri, {String packageName = ''}) =>
AppLinkLauncher(
isAndroid: () => !kIsWeb && Platform.isAndroid,
launchAndroidIntent: (intent) => intent.launch(),
).openExternal(uri, packageName: packageName);
}
class AppLinkLauncher {
const AppLinkLauncher({
required this.isAndroid,
required this.launchAndroidIntent,
this.launchExternal,
});
final bool Function() isAndroid;
final AndroidIntentLauncher launchAndroidIntent;
final Future<bool> Function(Uri uri)? launchExternal;
Future<bool> openExternal(Uri uri, {String packageName = ''}) async {
if (uri.host.isEmpty ||
(uri.scheme.toLowerCase() != 'http' &&
uri.scheme.toLowerCase() != 'https')) {
return false;
}
if (isAndroid() && packageName.trim().isNotEmpty) {
try {
await launchAndroidIntent(
AndroidIntent(
action: 'action_view',
data: uri.toString(),
package: packageName.trim(),
),
);
return true;
} catch (_) {}
}
final launcher = launchExternal;
if (launcher != null) return launcher(uri);
return launchUrl(uri, mode: LaunchMode.externalApplication);
}
}
-119
View File
@@ -1,119 +0,0 @@
import 'dart:io';
import 'dart:ui' as ui;
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:gal/gal.dart';
import 'package:http/http.dart' as http;
import 'package:jinzhi_flutter_app/common/services/device_header_service.dart';
import 'package:permission_handler/permission_handler.dart';
class ImageUtil {
static const String _albumName = 'jinzhi';
static Stream<FileResponse> downloadImage(String url, String key) {
return DefaultCacheManager().getFileStream(
url,
key: key,
withProgress: true,
);
}
static Future<String> downloadImageInFile(String url, String key) async {
final file = await DefaultCacheManager().getSingleFile(url, key: key);
return file.path;
}
static Future<bool> requestForImagePermission() async {
if (Platform.isIOS) {
PermissionStatus photoStatus = await Permission.photosAddOnly.status;
if (photoStatus != PermissionStatus.granted) {
photoStatus = await Permission.photosAddOnly.request();
if (photoStatus != PermissionStatus.granted) {
return false;
}
}
} else if (Platform.isAndroid) {
int? sdkInt = DeviceHeaderService.to.androidDeviceInfo?.version.sdkInt;
if (sdkInt != null && sdkInt >= 33) {
// ✅ Android 13+ 不需要读权限,直接返回 true
// gal 插件内部通过 MediaStore 写入
return true;
} else {
// ✅ Android 10-12 仍可能需要 storage 权限
final status = await Permission.storage.request();
return status.isGranted;
}
} else {
return false;
}
return true;
}
static Future<void> saveImage(FileInfo fileInfo) async {
await Gal.putImage(fileInfo.file.path, album: _albumName);
}
static Future<void> saveImageData(ByteData byteData) async {
Uint8List imageBytes = byteData.buffer.asUint8List();
await Gal.putImageBytes(
imageBytes,
name: 'XWallpaper_share',
album: _albumName,
);
}
static Future<void> saveImageUint8List(Uint8List imageBytes) async {
await Gal.putImageBytes(
imageBytes,
name: 'XWallpaper_share',
album: _albumName,
);
}
static Future<void> saveUIImageData(ui.Image image) async {
final byteData = await image.toByteData(format: ui.ImageByteFormat.png);
Uint8List imageBytes = byteData!.buffer.asUint8List();
await Gal.putImageBytes(
imageBytes,
name: 'XWallpaper_share',
album: _albumName,
);
}
static Future<Uint8List> createTransparentImage(double aspectRatio) async {
double minSize = 100;
double width = minSize * aspectRatio;
double height = minSize;
final recorder = PictureRecorder();
final canvas = Canvas(
recorder,
Rect.fromLTWH(0, 0, width.toDouble(), height.toDouble()),
);
final paint = Paint()..color = Colors.transparent;
canvas.drawRect(
Rect.fromLTWH(0.0, 0.0, width.toDouble(), height.toDouble()),
paint,
);
final picture = recorder.endRecording();
final img = await picture.toImage(width.toInt(), height.toInt());
final pngBytes = await img.toByteData(format: ImageByteFormat.png);
return pngBytes!.buffer.asUint8List();
}
// 下载图片并返回 Uint8List(简单实现)
static Future<Uint8List?> fetchThumbBytes(String? url) async {
if (url == null || url.isEmpty) return null;
try {
final resp = await http.get(Uri.parse(url));
if (resp.statusCode == 200) return resp.bodyBytes;
} catch (_) {}
return null;
}
}
-74
View File
@@ -1,74 +0,0 @@
// ignore_for_file: use_build_context_synchronously
import 'dart:typed_data';
import 'dart:ui' as ui;
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'package:share_plus/share_plus.dart';
ui.Rect? shareOriginForContext(BuildContext context) {
final renderObject = context.findRenderObject();
if (renderObject is! RenderBox || !renderObject.hasSize) {
return null;
}
return renderObject.localToGlobal(Offset.zero) & renderObject.size;
}
Future<Uint8List> captureWidgetPng(
GlobalKey key, {
double pixelRatio = 3.0,
}) async {
await WidgetsBinding.instance.endOfFrame;
final context = key.currentContext;
if (context == null) {
throw StateError('share target is not mounted');
}
final renderObject = context.findRenderObject();
if (renderObject is! RenderRepaintBoundary) {
throw StateError('share target is not a repaint boundary');
}
final image = await renderObject.toImage(pixelRatio: pixelRatio);
final byteData = await image.toByteData(format: ui.ImageByteFormat.png);
if (byteData == null) {
throw StateError('failed to convert share image');
}
return byteData.buffer.asUint8List();
}
Future<void> sharePngFromBoundary(
GlobalKey key, {
required String fileName,
String? text,
String? subject,
ui.Rect? sharePositionOrigin,
double pixelRatio = 3.0,
}) async {
final bytes = await captureWidgetPng(key, pixelRatio: pixelRatio);
final xFile = XFile.fromData(bytes, mimeType: 'image/png', name: fileName);
await SharePlus.instance.share(
ShareParams(
files: [xFile],
text: text,
subject: subject,
sharePositionOrigin: sharePositionOrigin,
),
);
}
Future<void> sharePlainText({
required String text,
String? subject,
ui.Rect? sharePositionOrigin,
}) async {
await SharePlus.instance.share(
ShareParams(
text: text,
subject: subject,
sharePositionOrigin: sharePositionOrigin,
),
);
}
+101
View File
@@ -0,0 +1,101 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:shadcn_ui/shadcn_ui.dart';
/// 金值统一的网络图片入口。
///
/// 图片会自动使用 [CachedNetworkImage] 的磁盘缓存;业务页面不应直接创建
/// `Image.network`,以保证加载和失败状态的视觉及缓存策略一致。
class AppNetworkImage extends StatelessWidget {
const AppNetworkImage({
super.key,
required this.imageUrl,
this.width,
this.height,
this.fit = BoxFit.cover,
this.alignment = Alignment.center,
this.borderRadius,
this.cacheKey,
this.placeholder,
this.errorWidget,
this.semanticLabel,
});
final String imageUrl;
final double? width;
final double? height;
final BoxFit fit;
final Alignment alignment;
final BorderRadius? borderRadius;
final String? cacheKey;
final Widget? placeholder;
final Widget? errorWidget;
final String? semanticLabel;
@override
Widget build(BuildContext context) {
final child = imageUrl.trim().isEmpty
? _ImageFallback(errorWidget: errorWidget)
: CachedNetworkImage(
imageUrl: imageUrl,
cacheKey: cacheKey,
width: width,
height: height,
fit: fit,
alignment: alignment,
fadeInDuration: const Duration(milliseconds: 150),
placeholder: (_, _) =>
placeholder ?? const _ImageLoadingPlaceholder(),
errorWidget: (_, _, _) => _ImageFallback(errorWidget: errorWidget),
);
final clipped = borderRadius == null
? child
: ClipRRect(borderRadius: borderRadius!, child: child);
if (semanticLabel == null) return clipped;
return Semantics(image: true, label: semanticLabel, child: clipped);
}
}
class _ImageLoadingPlaceholder extends StatelessWidget {
const _ImageLoadingPlaceholder();
@override
Widget build(BuildContext context) {
final colors = ShadTheme.of(context).colorScheme;
return ColoredBox(
color: colors.muted,
child: Center(
child: SizedBox(
width: 20,
height: 20,
child: CircularProgressIndicator(
strokeWidth: 2,
color: colors.mutedForeground,
),
),
),
);
}
}
class _ImageFallback extends StatelessWidget {
const _ImageFallback({required this.errorWidget});
final Widget? errorWidget;
@override
Widget build(BuildContext context) {
if (errorWidget != null) return errorWidget!;
final colors = ShadTheme.of(context).colorScheme;
return ColoredBox(
color: colors.muted,
child: Center(
child: Icon(
Icons.image_not_supported_outlined,
color: colors.mutedForeground,
),
),
);
}
}
+28
View File
@@ -0,0 +1,28 @@
import 'package:easy_refresh/easy_refresh.dart';
import 'package:flutter/widgets.dart';
typedef RefreshAction = Future<void> Function();
/// Shared pull-to-refresh and load-more wrapper for future list features.
class AppRefresh extends StatelessWidget {
const AppRefresh({
super.key,
required this.child,
this.onRefresh,
this.onLoad,
this.controller,
});
final Widget child;
final RefreshAction? onRefresh;
final RefreshAction? onLoad;
final EasyRefreshController? controller;
@override
Widget build(BuildContext context) => EasyRefresh(
controller: controller,
onRefresh: onRefresh,
onLoad: onLoad,
child: child,
);
}
+104
View File
@@ -0,0 +1,104 @@
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import '../network/api_error_message.dart';
import 'app_state_card.dart';
/// Shared loading, failure and empty-state contract for feature pages.
class AsyncStateView<T> extends StatelessWidget {
const AsyncStateView({
super.key,
required this.state,
required this.data,
this.isEmpty,
this.empty,
this.loading,
this.onRetry,
this.errorTitle = '加载失败',
this.errorSubtitle = '请检查网络后重试',
this.emptyIcon = Icons.inbox_outlined,
this.emptyTitle = '暂无内容',
this.emptySubtitle = '暂时没有可展示的数据',
});
final AsyncValue<T> state;
final Widget Function(T value) data;
final bool Function(T value)? isEmpty;
final Widget Function()? empty;
final Widget? loading;
final VoidCallback? onRetry;
final String errorTitle;
final String errorSubtitle;
final IconData emptyIcon;
final String emptyTitle;
final String emptySubtitle;
@override
Widget build(BuildContext context) {
return state.when(
loading: () =>
loading ?? const Center(child: CircularProgressIndicator()),
error: (error, _) => Center(
child: AppStateCard(
icon: Icons.error_outline,
title: errorTitle,
subtitle: ErrorMessageMapper.message(error, fallback: errorSubtitle),
buttonLabel: onRetry == null ? null : '重试',
onButtonPressed: onRetry,
buttonStyle: AppStateButtonStyle.filled,
),
),
data: (value) => isEmpty?.call(value) == true
? empty?.call() ??
Center(
child: AppStateCard(
icon: emptyIcon,
title: emptyTitle,
subtitle: emptySubtitle,
),
)
: data(value),
);
}
}
/// Sliver counterpart for CustomScrollView pages without forcing one global
/// card layout on successful feature content.
class SliverAsyncState<T> extends StatelessWidget {
const SliverAsyncState({
super.key,
required this.state,
required this.data,
this.loading,
this.onRetry,
this.errorSubtitle = '请检查网络后重试',
});
final AsyncValue<T> state;
final Widget Function(T value) data;
final Widget? loading;
final VoidCallback? onRetry;
final String errorSubtitle;
@override
Widget build(BuildContext context) => state.when(
data: data,
loading: () => SliverFillRemaining(
hasScrollBody: false,
child: loading ?? const Center(child: CircularProgressIndicator()),
),
error: (error, _) => SliverFillRemaining(
hasScrollBody: false,
child: Center(
child: AppStateCard(
icon: Icons.error_outline,
title: '加载失败',
subtitle: ErrorMessageMapper.message(error, fallback: errorSubtitle),
buttonLabel: onRetry == null ? null : '重试',
onButtonPressed: onRetry,
buttonStyle: AppStateButtonStyle.filled,
),
),
),
);
}
@@ -0,0 +1,25 @@
import 'package:easy_refresh/easy_refresh.dart';
/// Applies one Chinese copy set to every pull-to-refresh/list-load control.
void configureEasyRefreshChineseLocalization() {
EasyRefresh.defaultHeaderBuilder = () => const ClassicHeader(
dragText: '下拉刷新',
armedText: '松开刷新',
readyText: '刷新中...',
processingText: '刷新中...',
processedText: '刷新成功',
noMoreText: '没有更多了',
failedText: '刷新失败',
messageText: '上次更新于 %T',
);
EasyRefresh.defaultFooterBuilder = () => const ClassicFooter(
dragText: '上拉加载',
armedText: '松开加载更多',
readyText: '加载中...',
processingText: '加载中...',
processedText: '加载完成',
noMoreText: '没有更多了',
failedText: '加载失败',
messageText: '上次更新于 %T',
);
}
Loaded 100 of 304 files, more files were not shown because too many files have changed in this diff. Show more