fix test build

This commit is contained in:
djoeni 2022-06-18 09:49:00 +07:00
parent 46519a6cf8
commit 968e25bc6b
3 changed files with 1 additions and 33 deletions

View File

@ -5,15 +5,12 @@ import com.github.kr328.clash.core.Clash
import com.github.kr328.clash.core.model.Proxy import com.github.kr328.clash.core.model.Proxy
import com.github.kr328.clash.design.ProxyDesign import com.github.kr328.clash.design.ProxyDesign
import com.github.kr328.clash.design.model.ProxyState import com.github.kr328.clash.design.model.ProxyState
import com.github.kr328.clash.store.TipsStore
import com.github.kr328.clash.util.withClash import com.github.kr328.clash.util.withClash
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.isActive import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.selects.select import kotlinx.coroutines.selects.select
import kotlinx.coroutines.sync.Semaphore import kotlinx.coroutines.sync.Semaphore
import kotlinx.coroutines.sync.withPermit import kotlinx.coroutines.sync.withPermit
import java.util.concurrent.TimeUnit
class ProxyActivity : BaseActivity<ProxyDesign>() { class ProxyActivity : BaseActivity<ProxyDesign>() {
override suspend fun main() { override suspend fun main() {
@ -22,7 +19,6 @@ class ProxyActivity : BaseActivity<ProxyDesign>() {
val states = List(names.size) { ProxyState("?") } val states = List(names.size) { ProxyState("?") }
val unorderedStates = names.indices.map { names[it] to states[it] }.toMap() val unorderedStates = names.indices.map { names[it] to states[it] }.toMap()
val reloadLock = Semaphore(10) val reloadLock = Semaphore(10)
val tips = TipsStore(this)
val design = ProxyDesign( val design = ProxyDesign(
this, this,
@ -33,17 +29,6 @@ class ProxyActivity : BaseActivity<ProxyDesign>() {
setContentDesign(design) setContentDesign(design)
launch(Dispatchers.IO) {
val pkg = packageManager.getPackageInfo(packageName, 0)
val validate = System.currentTimeMillis() - pkg.firstInstallTime > TimeUnit.DAYS.toMillis(5)
if (tips.requestDonate && validate) {
tips.requestDonate = false
design.requestDonate()
}
}
design.requests.send(ProxyDesign.Request.ReloadAll) design.requests.send(ProxyDesign.Request.ReloadAll)
while (isActive) { while (isActive) {

View File

@ -99,7 +99,7 @@ subprojects {
keystore.inputStream().use(this::load) keystore.inputStream().use(this::load)
} }
storeFile = rootProject.file(prop.getProperty("keystore.path")!!) storeFile = rootProject.file("release.keystore")
storePassword = prop.getProperty("keystore.password")!! storePassword = prop.getProperty("keystore.password")!!
keyAlias = prop.getProperty("key.alias")!! keyAlias = prop.getProperty("key.alias")!!
keyPassword = prop.getProperty("key.password")!! keyPassword = prop.getProperty("key.password")!!

View File

@ -18,7 +18,6 @@ import com.github.kr328.clash.design.util.applyFrom
import com.github.kr328.clash.design.util.layoutInflater import com.github.kr328.clash.design.util.layoutInflater
import com.github.kr328.clash.design.util.resolveThemedColor import com.github.kr328.clash.design.util.resolveThemedColor
import com.github.kr328.clash.design.util.root import com.github.kr328.clash.design.util.root
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.tabs.TabLayoutMediator import com.google.android.material.tabs.TabLayoutMediator
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
@ -84,22 +83,6 @@ class ProxyDesign(
} }
} }
suspend fun requestDonate() {
withContext(Dispatchers.Main) {
val title = context.getText(R.string.request_donate)
val message = context.getText(R.string.request_donate_tips)
if (title.isNotEmpty() && message.isNotEmpty()) {
MaterialAlertDialogBuilder(context)
.setTitle(R.string.request_donate)
.setMessage(R.string.request_donate_tips)
.setPositiveButton(R.string.ok) { _, _ -> }
.setCancelable(true)
.show()
}
}
}
suspend fun showModeSwitchTips() { suspend fun showModeSwitchTips() {
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
Toast.makeText(context, R.string.mode_switch_tips, Toast.LENGTH_LONG).show() Toast.makeText(context, R.string.mode_switch_tips, Toast.LENGTH_LONG).show()