fix:第一轮跑
This commit is contained in:
1 parent
e834ec7586
commit
33235f450b
56 files changed
+4357
-210
No files matched your search
@@ -14,6 +14,16 @@ if (!androidSigningPropertiesFile.isFile) {
|
||||
}
|
||||
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 {
|
||||
val value = androidSigningProperties.getProperty(name)?.trim()
|
||||
if (value.isNullOrBlank()) {
|
||||
@@ -47,7 +57,9 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId = "com.jinzhi.app"
|
||||
// Temporary U-Verify test identity: the Yanting AppKey/login secret
|
||||
// loaded from assets/env/.env is registered against this package.
|
||||
applicationId = "com.yanting.read"
|
||||
// You can update the following values to match your application needs.
|
||||
// For more information, see: https://flutter.dev/to/review-gradle-config.
|
||||
minSdk = flutter.minSdkVersion
|
||||
@@ -55,15 +67,32 @@ android {
|
||||
versionCode = flutter.versionCode
|
||||
versionName = flutter.versionName
|
||||
|
||||
val umengChannel = System.getenv("UMENG_CHANNEL") ?: ""
|
||||
val umengChannel = umengBuildValue("UMENG_CHANNEL").ifBlank { "test" }
|
||||
manifestPlaceholders.putAll(
|
||||
mutableMapOf(
|
||||
"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 {
|
||||
debug {
|
||||
// U-Verify checks the app signing certificate. Use the same
|
||||
// registered signing identity as release, like Yanting does.
|
||||
signingConfig = signingConfigs.getByName("release")
|
||||
}
|
||||
release {
|
||||
signingConfig = signingConfigs.getByName("release")
|
||||
proguardFiles(
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<!-- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />-->
|
||||
<!-- <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />-->
|
||||
|
||||
|
||||
<application
|
||||
android:label="金值"
|
||||
android:name="${applicationName}"
|
||||
android:name=".JinzhiApplication"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:usesCleartextTraffic="false">
|
||||
@@ -31,6 +33,12 @@
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</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>
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
@@ -41,6 +49,12 @@
|
||||
<meta-data
|
||||
android:name="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}" />
|
||||
|
||||
</application>
|
||||
<!-- Required to query activities that can process text, see:
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.jinzhi.app
|
||||
|
||||
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,21 @@
|
||||
package com.jinzhi.app
|
||||
|
||||
import com.umeng.commonsdk.UMConfigure
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
import io.flutter.embedding.engine.FlutterEngine
|
||||
import io.flutter.plugin.common.MethodChannel
|
||||
|
||||
class MainActivity : FlutterActivity()
|
||||
class MainActivity : FlutterActivity() {
|
||||
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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user