parent
834d24193a
commit
3040fcfcc2
|
|
@ -15,7 +15,7 @@ dependencies {
|
|||
implementation(fileTree(mapOf("dir" to "src/main/libs", "include" to listOf("*.aar"))))
|
||||
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
|
||||
implementation("com.google.firebase:firebase-crashlytics-buildtools:3.0.2")
|
||||
implementation(files("src/main/libs/openinstall.jar"))
|
||||
// implementation(files("src/main/libs/openinstall.jar"))
|
||||
|
||||
// compileOnly(project(":hideapi"))
|
||||
// implementation(project(":core"))
|
||||
|
|
|
|||
|
|
@ -34,9 +34,16 @@
|
|||
|
||||
# 避免混淆Annotation、内部类、泛型、匿名类
|
||||
-keepattributes *Annotation*,InnerClasses,Signature,EnclosingMethod
|
||||
|
||||
# 抛出异常时保留代码行号
|
||||
-keepattributes SourceFile,LineNumberTable
|
||||
# seeds.txt文件列出未混淆的类和成员
|
||||
-printseeds seeds.txt
|
||||
# usage.txt文件列出从apk中删除的代码
|
||||
-printusage unused.txt
|
||||
# mapping文件列出混淆前后的映射
|
||||
-printmapping mapping.txt
|
||||
# 忽略警告 不加的话某些情况下打包会报错中断
|
||||
-ignorewarnings
|
||||
|
||||
# 保持四大组件
|
||||
-keep public class * extends android.app.Activity
|
||||
|
|
@ -277,3 +284,6 @@
|
|||
-keep class com.journeyapps.barcodescanner.** { *; }
|
||||
-keep class com.afollestad.materialdialogs.** { *; }
|
||||
-keep class com.yingmao.clash.net.http.entity.** { *; }
|
||||
-keep class com.yingmao.clash.entity.** { *; }
|
||||
-keep class com.stripe.** { *; }
|
||||
-keep class kotlin.coroutines.Continuation
|
||||
|
|
|
|||
|
|
@ -30,9 +30,6 @@ import com.afollestad.materialdialogs.MaterialDialog
|
|||
import com.afollestad.materialdialogs.customview.customView
|
||||
import com.afollestad.materialdialogs.customview.getCustomView
|
||||
import com.airbnb.lottie.LottieAnimationView
|
||||
import com.fm.openinstall.OpenInstall
|
||||
import com.fm.openinstall.listener.AppInstallListener
|
||||
import com.fm.openinstall.model.AppData
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.JsonArray
|
||||
import com.google.gson.JsonObject
|
||||
|
|
|
|||
|
|
@ -389,7 +389,7 @@ class UIMainActivity : BaseActivity() {
|
|||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.MMKV_KEY_CURRENT_NODE)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.NODE_SELECTED_NAME_KEY)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.MMKV_KEY_VPN_UserCommand)
|
||||
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.NODE_All_ITEM_NAME_KEY)
|
||||
Log.d("cleanUserInfo clashRunning==>${clashRunning}")
|
||||
if (clashRunning) {
|
||||
fragments.filterIsInstance<HomeFragment>().forEach { it.stopClash() }
|
||||
|
|
@ -548,6 +548,10 @@ class UIMainActivity : BaseActivity() {
|
|||
intent.putExtra("url", rcURL)
|
||||
startActivityForResult(intent, REQUEST_CODE_PAY_WEB_VIEW_ACTIVITY)
|
||||
}
|
||||
|
||||
public fun goCheckLogin() {
|
||||
mainAtyVM.checkLogin()
|
||||
}
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
|
|
@ -556,7 +560,8 @@ class UIMainActivity : BaseActivity() {
|
|||
if (activityDialog != null) {
|
||||
activityDialog?.dismiss()
|
||||
}
|
||||
showPayResultDialog()
|
||||
goCheckLogin()
|
||||
showBindAccount()
|
||||
}
|
||||
}
|
||||
override fun onDestroy() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.yingmao.clash.app
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Application
|
||||
import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
|
|
@ -8,34 +9,31 @@ import android.content.Intent
|
|||
import android.content.res.Configuration
|
||||
import android.os.Build
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.app.NotificationChannelCompat
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import androidx.core.content.getSystemService
|
||||
import com.fm.openinstall.OpenInstall
|
||||
import com.github.gzuliyujiang.oaid.DeviceIdentifier
|
||||
import com.orhanobut.logger.Logger
|
||||
import com.tencent.mmkv.MMKV
|
||||
import com.yingmao.clash.R
|
||||
import com.yingmao.clash.act.SplashActivity
|
||||
|
||||
import com.cncat.vpn.common.Global
|
||||
import com.cncat.vpn.common.compat.currentProcessName
|
||||
import com.cncat.vpn.common.log.Log
|
||||
import com.github.gzuliyujiang.oaid.DeviceID
|
||||
import com.github.gzuliyujiang.oaid.DeviceIdentifier
|
||||
import com.github.gzuliyujiang.oaid.IGetter
|
||||
import com.orhanobut.logger.Logger
|
||||
import com.stripe.android.PaymentConfiguration
|
||||
import com.tencent.mmkv.MMKV
|
||||
import com.yingmao.clash.R
|
||||
import com.yingmao.clash.act.SplashActivity
|
||||
import com.yingmao.clash.conf.BZYConstants
|
||||
import com.yingmao.clash.entity.CheckLoginRsp
|
||||
import com.yingmao.clash.entity.UserData
|
||||
import com.yingmao.clash.util.CrashCatchHandler
|
||||
|
||||
import com.yingmao.clash.util.clashDir
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
import java.util.Locale
|
||||
|
||||
|
||||
class MainApplication : Application() {
|
||||
companion object {
|
||||
private lateinit var mApp: MainApplication
|
||||
private var userBean: UserData?=null
|
||||
private var userBean: UserData? = null
|
||||
|
||||
fun getApp(): MainApplication? {
|
||||
return mApp
|
||||
|
|
@ -45,6 +43,8 @@ class MainApplication : Application() {
|
|||
private const val STATUS_CHANNEL = "profile_status_channel"
|
||||
private const val RESULT_CHANNEL = "profile_result_channel"
|
||||
|
||||
public var OAID = ""
|
||||
|
||||
fun getUserInfo(): UserData? {
|
||||
return userBean
|
||||
}
|
||||
|
|
@ -59,11 +59,12 @@ class MainApplication : Application() {
|
|||
super.attachBaseContext(base)
|
||||
}
|
||||
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
mApp = this
|
||||
// if (privacyPolicyAgreed) {
|
||||
// DeviceIdentifier.register(this);
|
||||
DeviceIdentifier.register(mApp);
|
||||
// }
|
||||
Global.init(this)
|
||||
val processName = currentProcessName
|
||||
|
|
@ -76,7 +77,7 @@ class MainApplication : Application() {
|
|||
// Log.d("sendServiceRecreated")
|
||||
// sendServiceRecreated()
|
||||
// }
|
||||
val MMKVRootDir = MMKV.initialize(this)
|
||||
val MMKVRootDir = MMKV.initialize(applicationContext)
|
||||
Logger.i("MMKV_ROOT_DIR:$MMKVRootDir")
|
||||
updateNotificationChannels()
|
||||
/*
|
||||
|
|
@ -85,6 +86,24 @@ class MainApplication : Application() {
|
|||
val crashCatchHandler: CrashCatchHandler = CrashCatchHandler.getInstance() //获得单例
|
||||
crashCatchHandler.init(applicationContext) //初始化,传入context
|
||||
|
||||
if (DeviceID.supportedOAID(applicationContext)){
|
||||
// 获取OAID/AAID,异步回调
|
||||
DeviceID.getOAID(applicationContext, object : IGetter {
|
||||
override fun onOAIDGetComplete(result: String) {
|
||||
// 不同厂商的OAID/AAID格式是不一样的,可进行MD5、SHA1之类的哈希运算统一
|
||||
Log.d("onOAIDGetComplete ${result}")
|
||||
OAID = result
|
||||
}
|
||||
|
||||
override fun onOAIDGetError(error: Exception) {
|
||||
// 获取OAID/AAID失败
|
||||
error.printStackTrace()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
//openinstall
|
||||
// OpenInstall.init(applicationContext);
|
||||
PaymentConfiguration.init(
|
||||
|
|
@ -92,13 +111,14 @@ class MainApplication : Application() {
|
|||
"pk_live_51Nkl6vLWP3xWXY4LfXtdMtXzHazv6pav2rH1p1BfICeh5meGGjglExiw4GgmSzWO7NptEM1c549Fe11zRy9nCfxs009zEwLpXP"
|
||||
)
|
||||
}
|
||||
fun updateActivity(language:String,locale: Locale){
|
||||
|
||||
fun updateActivity(language: String, locale: Locale) {
|
||||
MMKV.defaultMMKV().encode(BZYConstants.languageInfo, language)
|
||||
val resources =this.resources
|
||||
val resources = this.resources
|
||||
val metrics = resources.displayMetrics
|
||||
val config = resources.configuration
|
||||
config.locale=locale
|
||||
resources.updateConfiguration(config,metrics)
|
||||
config.locale = locale
|
||||
resources.updateConfiguration(config, metrics)
|
||||
//设置好选择的语言以后,需要清除任务栈中的所有activity,打开首页,确保以后进入的页面都是当前选择的语言
|
||||
val intent = Intent(this, SplashActivity::class.java)
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK)
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue