宙连应用更改
This commit is contained in:
parent
e474d6bd57
commit
72dc23f4ed
|
|
@ -47,7 +47,7 @@ class ActivityActivity : BaseActivity() {
|
|||
private lateinit var expensesRecordRv: RecyclerView
|
||||
private lateinit var getActivityAdapter: GetActivityAdapter
|
||||
private lateinit var aiBack: AppCompatImageView
|
||||
private val mPageInfo = PageInfo()
|
||||
private val mPageInfo = ExpensesRecordActivity.PageInfo()
|
||||
|
||||
companion object {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import com.yingmao.clash.net.http.NetService
|
|||
|
||||
class ActivityAtyVM : PublicViewMode() {
|
||||
|
||||
fun getActivity(mPageInfo: PageInfo) {
|
||||
fun getActivity(mPageInfo: ExpensesRecordActivity.PageInfo) {
|
||||
val httpApi = NetService.instances.createHttps(HttpApi::class.java)
|
||||
val username =
|
||||
MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_REMEMBER_USERNAME, "")!!
|
||||
|
|
|
|||
|
|
@ -30,12 +30,14 @@ import com.stripe.android.model.StripeIntent
|
|||
import com.tencent.mmkv.MMKV
|
||||
import com.yingmao.clash.BuildConfig
|
||||
import com.yingmao.clash.R
|
||||
import com.yingmao.clash.act.NewMainActivity.Companion.profileBinder
|
||||
import com.yingmao.clash.app.MainApplication
|
||||
import com.yingmao.clash.base.BaseActivity
|
||||
import com.yingmao.clash.conf.BZYConstants
|
||||
import com.yingmao.clash.entity.CheckLoginRsp
|
||||
import com.yingmao.clash.entity.PayUploadParamData
|
||||
import com.yingmao.clash.entity.RechargeModelEntity
|
||||
import com.yingmao.clash.fragment.NewAccFragment.Companion.clashRunning
|
||||
import com.yingmao.clash.fragment.recharge.RechargeViewModel
|
||||
import com.yingmao.clash.fragment.recharge.adapter.RechargeModelAdapter
|
||||
import com.yingmao.clash.fragment.recharge.adapter.VIPRechargeAdapter
|
||||
|
|
@ -49,10 +51,13 @@ import com.yingmao.clash.net.http.entity.Trade
|
|||
import com.yingmao.clash.util.CommonUtils
|
||||
import com.yingmao.clash.util.PayUtils
|
||||
import com.yingmao.clash.util.ThreadUtils
|
||||
import com.yingmao.clash.util.stopClashService
|
||||
import com.yingmao.clash.view.RxToast
|
||||
import com.yingmao.clash.view.dialog.DialogDoMainChoose
|
||||
import com.yingmao.clash.view.dialog.RxDialogShapeLoading
|
||||
import com.yingmao.clash.vm.MainAtyVM
|
||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.MainScope
|
||||
import kotlinx.coroutines.launch
|
||||
|
|
@ -76,6 +81,8 @@ class MemberRechargeActivity : BaseActivity() {
|
|||
|
||||
//stripePay 支付
|
||||
private var paymentIntentClientSecret: String = ""
|
||||
private lateinit var mainAtyVM: MainAtyVM
|
||||
|
||||
private val stripe: Stripe by lazy {
|
||||
Stripe(
|
||||
this@MemberRechargeActivity,
|
||||
|
|
@ -92,6 +99,7 @@ class MemberRechargeActivity : BaseActivity() {
|
|||
}
|
||||
|
||||
private fun initData() {
|
||||
mainAtyVM = ViewModelProvider(this)[MainAtyVM::class.java]
|
||||
viewModel = ViewModelProvider(this)[RechargeViewModel::class.java]
|
||||
observe(this, viewModel)
|
||||
//获取充值列表
|
||||
|
|
@ -161,14 +169,21 @@ class MemberRechargeActivity : BaseActivity() {
|
|||
HttpReqType.GET_RECHARGE_INFO -> {
|
||||
Logger.d("获取充值续费信息请求成功")
|
||||
swipeLayout.isRefreshing = false
|
||||
(httpStatus.rsp as RechargeInfoRsp).let { it ->
|
||||
if (it.code != "1000") {
|
||||
RxToast.error(if (it.message.isNullOrBlank()) resources.getString(R.string.FailedRechargeList) + "(${it.code})" else "${it.code}:${it.message}")
|
||||
} else {
|
||||
(httpStatus.rsp as RechargeInfoRsp).let {
|
||||
when (it.code) {
|
||||
"1088" -> {
|
||||
RxToast.info(resources.getString(R.string.LoginOut))
|
||||
cleanUserInfo()
|
||||
}
|
||||
"1000" -> {
|
||||
it.data?.let { rechargeInfo ->
|
||||
initAdapter(rechargeInfo)
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
RxToast.error(if (it.message.isNullOrBlank())resources.getString(R.string.FailedRechargeList)+ "(${it.code})" else "${it.code}:${it.message}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -527,7 +542,6 @@ class MemberRechargeActivity : BaseActivity() {
|
|||
if (clashRunning) {
|
||||
stopClashService()
|
||||
}
|
||||
isSubbed =false
|
||||
mainAtyVM.stopHeartBeat()
|
||||
cleanProfile()
|
||||
val intent=Intent(CommonUtils.getApp(), LoginActivity::class.java)
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import android.widget.TextView
|
|||
import androidx.activity.result.contract.ActivityResultContracts.RequestPermission
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.FileProvider
|
||||
import androidx.core.view.GravityCompat
|
||||
|
|
@ -120,25 +121,79 @@ class NewMainActivity : BaseActivity() {
|
|||
private lateinit var tvNetStr:TextView
|
||||
private lateinit var tvTemporaryAccount:TextView
|
||||
private val mPageInfo = PageInfo()
|
||||
private var payResultLoading: RxDialogShapeLoading? = null
|
||||
private var timerJob: Job? = null
|
||||
private var loadingTimeoutNum = 3
|
||||
@SuppressLint("SimpleDateFormat")
|
||||
private val dateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
|
||||
|
||||
companion object {
|
||||
//记录心跳失败次数
|
||||
var HEART_BEAT_FAILURE_FREQUENCY = 0
|
||||
const val REQUEST_CODE_PAY_WEB_VIEW_ACTIVITY = 1000
|
||||
var isSubed = false
|
||||
var newUuid: String? = null
|
||||
var subUrl: String? = null
|
||||
|
||||
// private var profile: ProfileManager? = null
|
||||
// private var clashManager: ClashManager? = null
|
||||
var clashBinder: IClashManager? = null
|
||||
var profileBinder: IProfileManager? = null
|
||||
var newMainActGlo: Boolean = false
|
||||
var isUpload: Boolean = false
|
||||
var hostsMem: ArrayList<String> = ArrayList()
|
||||
|
||||
suspend fun setSub2(url: String) {
|
||||
profileBinder?.let { pm ->
|
||||
pm.queryAll().forEach { itemPro ->
|
||||
if (itemPro.name != Conf.getClashConfName(MainApplication.getApp()?.applicationContext)) {
|
||||
pm.delete(itemPro.uuid)
|
||||
}
|
||||
}
|
||||
val pro = pm.queryAll().find {
|
||||
it.name == Conf.getClashConfName(MainApplication.getApp()?.applicationContext)
|
||||
}
|
||||
pro?.let {
|
||||
pm.setActive(it)
|
||||
delay(500)
|
||||
//判断配置文件source
|
||||
if (!TextUtils.isEmpty(pro.source)) {
|
||||
Log.d("setSub2 pro.source==>${pro.source}, url==>${url}")
|
||||
//订阅链接不同就更换
|
||||
if (pro.source != url) {
|
||||
pm.patch(
|
||||
pro.uuid, pro.name,
|
||||
url, 1800000L
|
||||
)
|
||||
pm.commit(pro.uuid) { status ->
|
||||
android.util.Log.d(
|
||||
Conf.TAG,
|
||||
"new updateStatus: " + Gson().toJson(status.args) + ", pro==>" + status.progress
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
pm.update(it.uuid)
|
||||
newUuid = pro.uuid.toString()
|
||||
} ?: run {
|
||||
val uuid: UUID = pm.create(
|
||||
Profile.Type.Url,
|
||||
Conf.getClashConfName(MainApplication.getApp()?.applicationContext)
|
||||
)
|
||||
delay(500)
|
||||
pm.queryByUUID(uuid)?.let { qPro ->
|
||||
pm.setActive(qPro)
|
||||
pm.patch(
|
||||
qPro.uuid, qPro.name,
|
||||
url, 1800000L
|
||||
)
|
||||
pm.commit(qPro.uuid) { status ->
|
||||
android.util.Log.d(
|
||||
Conf.TAG,
|
||||
"new updateStatus: " + Gson().toJson(status.args) + ", pro==>" + status.progress
|
||||
)
|
||||
}
|
||||
newUuid = qPro.uuid.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val dateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
|
||||
fun addOrSendHost(host: String) {
|
||||
Log.d("hostsMem size==>${hostsMem.size}")
|
||||
if (!hostsMem.contains(host) && !isApiHost(host)) {
|
||||
|
|
@ -189,7 +244,6 @@ class NewMainActivity : BaseActivity() {
|
|||
}
|
||||
val httpApi = NetService.instances.createHttps(HttpApi::class.java)
|
||||
val hostsJsonArrayStr = hostsJsonArray.toString()
|
||||
// Log.d("hostsJsonArrayStr==>$hostsJsonArrayStr")
|
||||
val hostsJsonArrayStrObject = JsonObject()
|
||||
hostsJsonArrayStrObject.addProperty("requestLogs", hostsJsonArrayStr)
|
||||
val phToken = MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_PH_TOKEN, "")
|
||||
|
|
@ -229,21 +283,19 @@ class NewMainActivity : BaseActivity() {
|
|||
clashBinder = MainApplication.getApp()?.let { ClashManager(it).wrap() as IClashManager }
|
||||
|
||||
// 文件权限请求
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
// if (ContextCompat.checkSelfPermission(
|
||||
// this,
|
||||
// Manifest.permission.WRITE_EXTERNAL_STORAGE
|
||||
// ) != PackageManager.PERMISSION_GRANTED
|
||||
// ) {
|
||||
// ActivityCompat.requestPermissions(
|
||||
// this,
|
||||
// arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE),
|
||||
// REQUEST_CODE_WRITE_STORAGE
|
||||
// )
|
||||
// } else {
|
||||
//
|
||||
// }
|
||||
// }
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (ContextCompat.checkSelfPermission(
|
||||
this,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE
|
||||
) != PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
ActivityCompat.requestPermissions(
|
||||
this,
|
||||
arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE),
|
||||
REQUEST_CODE_WRITE_STORAGE
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
mainAtyVM = ViewModelProvider(this).get(MainAtyVM::class.java)
|
||||
observe(this, mainAtyVM)
|
||||
|
|
@ -567,10 +619,6 @@ class NewMainActivity : BaseActivity() {
|
|||
if (5 <= HEART_BEAT_FAILURE_FREQUENCY) {
|
||||
HEART_BEAT_FAILURE_FREQUENCY = 0
|
||||
Logger.d("心跳失败次数超过10次,退出登录")
|
||||
// MMKV.defaultMMKV().removeValueForKey(BZYConstants.MMKV_KEY_TOKEN)
|
||||
// startActivity(Intent(CommonUtils.getApp(), LoginActivity::class.java))
|
||||
// finish()
|
||||
// mainAtyVM.stopHeartBeat()
|
||||
cleanUserInfo()
|
||||
}
|
||||
HEART_BEAT_FAILURE_FREQUENCY++
|
||||
|
|
@ -585,6 +633,7 @@ class NewMainActivity : BaseActivity() {
|
|||
}
|
||||
|
||||
|
||||
|
||||
private fun initViews() {
|
||||
containerVP = findViewById(R.id.container)
|
||||
ivTor=findViewById(R.id.ivTor)
|
||||
|
|
@ -636,6 +685,7 @@ class NewMainActivity : BaseActivity() {
|
|||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.MMKV_KEY_VPN_UserCommand)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.NODE_All_ITEM_NAME_KEY)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.PROFILE_SUB_URL)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.MMKV_KEY_Switch_Finsh_Set)
|
||||
Log.d("cleanUserInfo clashRunning==>${clashRunning}")
|
||||
if (clashRunning) {
|
||||
fragments.filterIsInstance<NewAccFragment>().forEach { it.stopClash() }
|
||||
|
|
@ -819,10 +869,6 @@ class NewMainActivity : BaseActivity() {
|
|||
})
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
var payResultLoading: RxDialogShapeLoading? = null
|
||||
private var timerJob: Job? = null
|
||||
private var loadingTimeoutNum = 3
|
||||
private fun showLoadingDialog(msg: String) {
|
||||
payResultLoading = RxDialogShapeLoading(this)
|
||||
payResultLoading!!.setMessage(msg)
|
||||
|
|
@ -920,64 +966,6 @@ class NewMainActivity : BaseActivity() {
|
|||
|
||||
tv_expire_date.text = endTimeInfo
|
||||
}
|
||||
|
||||
private fun showUpdateDialog(url: String, illustrate: String, isForce: Boolean) {
|
||||
if (TextUtils.isEmpty(url)) {
|
||||
RxToast.error(resources.getString(R.string.downloadEmpty))
|
||||
return
|
||||
}
|
||||
var notice = illustrate
|
||||
if (TextUtils.isEmpty(illustrate)) {
|
||||
notice = resources.getString(R.string.NewVersion)
|
||||
}
|
||||
var isDownloaded = false;
|
||||
var isFinish = false;
|
||||
var downFilePath = "";
|
||||
|
||||
var dialog = DialogAppVersion(this@NewMainActivity,
|
||||
notice,
|
||||
url,
|
||||
isForce,
|
||||
object : DialogAppVersion.OnClickListener {
|
||||
override fun ok(tv_down: TextView, pb_down: ProgressBar) {
|
||||
if (isFinish) {
|
||||
installApk(downFilePath)
|
||||
return
|
||||
}
|
||||
if (isDownloaded) {
|
||||
RxToast.info(resources.getString(R.string.downloading))
|
||||
return
|
||||
}
|
||||
isDownloaded = true
|
||||
mainAtyVM.downLoadFile(url, object : DownLoadListener {
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun loading(progress: Int) {
|
||||
lifecycleScope.async {
|
||||
pb_down.progress = progress
|
||||
tv_down.text = resources.getString(R.string.download) + "$progress%"
|
||||
}
|
||||
}
|
||||
|
||||
override fun finish(path: String) {
|
||||
Log.d("down finish path==>$path")
|
||||
isFinish = true
|
||||
downFilePath = path
|
||||
installApk(path)
|
||||
}
|
||||
|
||||
override fun error(msg: String) {
|
||||
Log.d("down error msg==>$msg")
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
override fun cancel() {
|
||||
}
|
||||
})
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
override fun onRequestPermissionsResult(
|
||||
requestCode: Int, permissions: Array<out String>, grantResults: IntArray,
|
||||
) {
|
||||
|
|
@ -999,93 +987,6 @@ class NewMainActivity : BaseActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
fun installApk(filePath: String) {
|
||||
val file = File(filePath)
|
||||
val uri: Uri = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
FileProvider.getUriForFile(this, "${applicationContext.packageName}.fileprovider", file)
|
||||
} else {
|
||||
Uri.fromFile(file)
|
||||
}
|
||||
|
||||
val intent = Intent(Intent.ACTION_VIEW).apply {
|
||||
setDataAndType(uri, "application/vnd.android.package-archive")
|
||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||
}
|
||||
}
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
public suspend fun setSub2(url: String) {
|
||||
Log.d("setSub2 2")
|
||||
profileBinder?.let { pm ->
|
||||
Log.d("setSub2 3")
|
||||
pm.queryAll().forEach { itemPro ->
|
||||
Log.d("setSub2 itemPro ==>${itemPro}")
|
||||
if (itemPro.name != Conf.getClashConfName(this@NewMainActivity.applicationContext)) {
|
||||
Log.d("setSub2 delete ==>${itemPro.name}")
|
||||
pm.delete(itemPro.uuid)
|
||||
}
|
||||
}
|
||||
val pro = pm.queryActive()
|
||||
Log.d("setSub2 4")
|
||||
pro?.let {
|
||||
var actname = it.name
|
||||
Log.d("new main actname==>" + actname)
|
||||
Log.d("setSub2 pro 已存在 ==>")
|
||||
pm.setActive(it)
|
||||
delay(500)
|
||||
if (!TextUtils.isEmpty(pro.source)) {
|
||||
// Log.d("setSub2 pro.source==>${pro.source}, url==>${url}")
|
||||
if (pro.source != url) {
|
||||
Log.d("setSub2 patch")
|
||||
pm.patch(pro.uuid, pro.name, url, 1800000L)
|
||||
pm.commit(pro.uuid) { status ->
|
||||
Log.d("setSub2 updateStatus: " + Gson().toJson(status.args) + ", pro==>" + status.progress)
|
||||
}
|
||||
}
|
||||
}
|
||||
pm.update(it.uuid)
|
||||
|
||||
newUuid = pro.uuid.toString();
|
||||
isSubed = true
|
||||
Log.d("setSub2 setActive end")
|
||||
} ?: run {
|
||||
createMyProfile(pm, url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
suspend fun createMyProfile(pm: IProfileManager, url: String) {
|
||||
var uuid: UUID = pm.create(
|
||||
Profile.Type.Url, Conf.getClashConfName(this@NewMainActivity.applicationContext)
|
||||
)
|
||||
delay(500)
|
||||
pm.queryByUUID(uuid)?.let { qPro ->
|
||||
pm.setActive(qPro)
|
||||
pm.patch(
|
||||
qPro.uuid, qPro.name,
|
||||
// "https://mojie0201.xn--8stx8olrwkucjq3b.com/api/v1/client/subscribe?token=169110d2674c49604b7e5b5cea341579",
|
||||
// "https://www.otcopusapp.cc/lx3af288h5i8pz380/api/v1/client/subscribe?token=d6bc98c7ea53099fa5bd1a3ea415ebb6",
|
||||
// "https://reg.bazhuayujiasu.cc/api/v1/client/subscribe?token=7f0f025ab341bcec4822d2c90aadf8b0",
|
||||
url, 1800000L
|
||||
)
|
||||
// coroutineScope {
|
||||
pm.commit(qPro.uuid) { status ->
|
||||
android.util.Log.d(
|
||||
Conf.TAG,
|
||||
"new updateStatus: " + Gson().toJson(status.args) + ", pro==>" + status.progress
|
||||
)
|
||||
}
|
||||
newUuid = qPro.uuid.toString();
|
||||
isSubed = true
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ import com.hjq.permissions.XXPermissions
|
|||
import com.tencent.mmkv.MMKV
|
||||
import com.yingmao.clash.BuildConfig
|
||||
import com.yingmao.clash.R
|
||||
import com.yingmao.clash.act.NewMainActivity.Companion.isSubed
|
||||
import com.yingmao.clash.act.NewMainActivity.Companion.newUuid
|
||||
import com.yingmao.clash.act.NewMainActivity.Companion.profileBinder
|
||||
import com.yingmao.clash.app.MainApplication
|
||||
|
|
@ -449,7 +448,6 @@ class SettingActivity : BaseActivity() {
|
|||
// Log.d("setSub2 pro 已存在 ==>" + Gson().toJson(pro))
|
||||
pm.setActive(it)
|
||||
newUuid = pro.uuid.toString();
|
||||
isSubed = true
|
||||
Log.d("setSub2 setActive end")
|
||||
finishInit()
|
||||
} ?: run {
|
||||
|
|
@ -474,8 +472,6 @@ class SettingActivity : BaseActivity() {
|
|||
)
|
||||
}
|
||||
newUuid = qPro.uuid.toString();
|
||||
isSubed = true
|
||||
// }
|
||||
}
|
||||
finishInit()
|
||||
|
||||
|
|
|
|||
|
|
@ -120,31 +120,31 @@ class SplashActivity : BaseActivity() {
|
|||
pb_web = findViewById(R.id.pb_web)
|
||||
butSkip = findViewById(R.id.but_skip)
|
||||
butRegister = findViewById(R.id.but_register)
|
||||
val decodeBool =
|
||||
MMKV.defaultMMKV().decodeBool(BZYConstants.is_splash_first, false)
|
||||
if(!decodeBool){
|
||||
val splashDialog =
|
||||
SplashDialog(this)
|
||||
splashDialog.showDialog(this@SplashActivity)
|
||||
splashDialog.setOnDialogClickListener(object :SplashDialog.ActivityLinkListener{
|
||||
override fun onAgreeClickListener() {
|
||||
MMKV.defaultMMKV().encode(BZYConstants.is_splash_first, true)
|
||||
splashDialog.cancel()
|
||||
rlPb.visibility = View.VISIBLE
|
||||
// val decodeBool =
|
||||
// MMKV.defaultMMKV().decodeBool(BZYConstants.is_splash_first, false)
|
||||
// if(!decodeBool){
|
||||
// val splashDialog =
|
||||
// SplashDialog(this)
|
||||
// splashDialog.showDialog(this@SplashActivity)
|
||||
// splashDialog.setOnDialogClickListener(object :SplashDialog.ActivityLinkListener{
|
||||
// override fun onAgreeClickListener() {
|
||||
// MMKV.defaultMMKV().encode(BZYConstants.is_splash_first, true)
|
||||
// splashDialog.cancel()
|
||||
// rlPb.visibility = View.VISIBLE
|
||||
// initInto()
|
||||
// }
|
||||
// override fun onDisagreeClickListener() {
|
||||
// MMKV.defaultMMKV().encode(BZYConstants.is_splash_first, false)
|
||||
// splashDialog.cancel()
|
||||
// finish()
|
||||
// }
|
||||
//
|
||||
// })
|
||||
// }else{
|
||||
// initInto()
|
||||
// }
|
||||
initInto()
|
||||
}
|
||||
override fun onDisagreeClickListener() {
|
||||
MMKV.defaultMMKV().encode(BZYConstants.is_splash_first, false)
|
||||
splashDialog.cancel()
|
||||
finish()
|
||||
}
|
||||
|
||||
})
|
||||
}else{
|
||||
initInto()
|
||||
}
|
||||
|
||||
}
|
||||
private fun initInto(){
|
||||
serStore.isYM = BuildConfig.is_ym
|
||||
serStore.isBZY = true
|
||||
|
|
|
|||
|
|
@ -11,8 +11,6 @@ import android.content.res.Configuration
|
|||
import android.os.Build
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.content.getSystemService
|
||||
import com.baidu.mobads.action.BaiduAction
|
||||
import com.baidu.mobads.action.PrivacyStatus
|
||||
import com.cncat.vpn.common.Global
|
||||
import com.cncat.vpn.common.compat.currentProcessName
|
||||
import com.cncat.vpn.common.log.Log
|
||||
|
|
@ -26,7 +24,6 @@ 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.conf.Constants
|
||||
import com.yingmao.clash.entity.UserData
|
||||
import com.yingmao.clash.util.CrashCatchHandler
|
||||
import com.yingmao.clash.util.clashDir
|
||||
|
|
@ -38,8 +35,6 @@ import java.io.File
|
|||
import java.io.FileOutputStream
|
||||
import java.io.PrintWriter
|
||||
import java.io.StringWriter
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ import androidx.activity.result.contract.ActivityResultContracts
|
|||
import androidx.appcompat.app.AppCompatActivity.RESULT_OK
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.afollestad.materialdialogs.customview.customView
|
||||
import com.afollestad.materialdialogs.customview.getCustomView
|
||||
import com.airbnb.lottie.LottieAnimationView
|
||||
import com.cncat.vpn.common.constants.Intents
|
||||
import com.cncat.vpn.common.log.Log
|
||||
|
|
@ -30,7 +33,6 @@ import com.orhanobut.logger.Logger
|
|||
import com.tencent.mmkv.MMKV
|
||||
import com.yingmao.clash.R
|
||||
import com.yingmao.clash.act.NewMainActivity
|
||||
import com.yingmao.clash.act.NewMainActivity.Companion.isSubed
|
||||
import com.yingmao.clash.act.NewMainActivity.Companion.newUuid
|
||||
import com.yingmao.clash.act.NewMainActivity.Companion.profileBinder
|
||||
import com.yingmao.clash.conf.BZYConstants
|
||||
|
|
@ -74,7 +76,6 @@ class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatch
|
|||
const val Clash_Started = 11
|
||||
const val Clash_Starting = 22
|
||||
const val Clash_Stop = 33
|
||||
public var currNodeJsonA: String? = null
|
||||
var isGlo: Boolean = false
|
||||
var clashRunning: Boolean = false
|
||||
|
||||
|
|
@ -183,7 +184,27 @@ class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatch
|
|||
rxDialogSureCancel.show()
|
||||
|
||||
} else {
|
||||
startClash(false)
|
||||
if (checkExpire()) {
|
||||
if (isAdded) {
|
||||
MaterialDialog(requireContext()).show {
|
||||
this.cancelable(false)
|
||||
cornerRadius(res = R.dimen.dp_10)
|
||||
customView(
|
||||
R.layout.expired_recharge__layout,
|
||||
scrollable = false,
|
||||
noVerticalPadding = true,
|
||||
horizontalPadding = false
|
||||
)
|
||||
getCustomView().findViewById<TextView>(R.id.tv_pay_finish).setOnClickListener {
|
||||
goNewRecharge()
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
return@setOnClickListener
|
||||
}
|
||||
showLoading(resources.getString(R.string.Starting), requireContext())
|
||||
startClash(true)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -239,14 +260,12 @@ class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatch
|
|||
pm.setActive(profile)
|
||||
|
||||
newUuid = profile.uuid.toString();
|
||||
isSubed = true
|
||||
} ?: run {
|
||||
//为空的情况下选择第一个
|
||||
pm.queryAll().forEach { profile ->
|
||||
pm.setActive(profile)
|
||||
|
||||
newUuid = profile.uuid.toString()
|
||||
isSubed = true
|
||||
return@forEach
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:background="@drawable/bg_signin">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_title_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:visibility="visible"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="16dp"
|
||||
android:id="@+id/iv_back"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:src="@drawable/ic_s_back" />
|
||||
</RelativeLayout>
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@null"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/translate">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_title_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="@dimen/dp_10"
|
||||
android:paddingRight="@dimen/dp_10">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="21sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_back"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/ic_s_back"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/iv_more"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:textSize="14sp"
|
||||
android:src="@drawable/ic_s_back"
|
||||
android:textColor="@color/white"
|
||||
android:visibility="invisible" />
|
||||
</RelativeLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
|
|
@ -100,7 +100,7 @@ subprojects {
|
|||
}
|
||||
productFlavors {
|
||||
flavorDimensions("feature")
|
||||
create("9972") {
|
||||
create("9973") {
|
||||
isDefault = true
|
||||
dimension = flavorDimensionList[0]
|
||||
buildConfigField("boolean", "PREMIUM", "Boolean.parseBoolean(\"false\")")
|
||||
|
|
@ -111,7 +111,7 @@ subprojects {
|
|||
buildConfigField("String", "applicationId", "\"com.yingmao.clash\"")
|
||||
buildConfigField("String", "service_url", "\"https://api.ymvpnpro.cc:8700\"")
|
||||
buildConfigField("boolean", "is_free", "false")
|
||||
buildConfigField("String", "productId", "\"9972\"")
|
||||
buildConfigField("String", "productId", "\"9973\"")
|
||||
manifestPlaceholders(
|
||||
mapOf(
|
||||
"APP_NAME" to "@string/zl",
|
||||
|
|
@ -121,7 +121,7 @@ subprojects {
|
|||
}
|
||||
}
|
||||
sourceSets {
|
||||
getByName("9972") {
|
||||
getByName("9973") {
|
||||
java.srcDirs("src/foss/java")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue