fix some bugs

This commit is contained in:
Kr328 committed 2019-12-10 22:28:43 +08:00
1 parent 4b498d7dc7
commit a154230bca
6 files changed
+13 -10

No files matched your search

+2 -2
View File
@@ -13,8 +13,8 @@ android {
applicationId "com.github.kr328.clash"
minSdkVersion 24
targetSdkVersion 29
versionCode 10015
versionName "1.0.15-alpha"
versionCode 10016
versionName "1.0.16-alpha"
}
buildTypes {
release {
@@ -26,12 +26,11 @@ class MainApplication : Application() {
override fun onCreate() {
super.onCreate()
try {
runCatching {
FirebaseApp.initializeApp(this)
}
runCatching {
Fabric.with(this)
Log.i("Registered")
} catch (e: IllegalStateException) {
Log.i("Already registered")
}
Log.handler = object: Log.LogHandler {
@@ -189,7 +189,8 @@ class ProfilesActivity : BaseActivity() {
}
runOnUiThread {
dialog?.dismiss()
if ( dialog?.isShowing == true )
dialog?.dismiss()
}
}
}
@@ -78,7 +78,7 @@ class ProxyActivity : BaseActivity() {
runClash { clash ->
val packet = clash.queryAllProxies()
val proxies = packet.proxies
val order = (proxies["GLOBAL".hashCode()] ?: error("GLOBAL not found")).all
val order = (proxies["GLOBAL".hashCode()]?.all ?: emptyList())
.mapIndexed { index, i -> i to index }.toMap()
val listData = proxies
@@ -41,6 +41,9 @@ class TileService : TileService() {
}
private fun refreshStatus() {
if ( qsTile == null )
return
val current = getCurrentStatus()
when (current.first) {
@@ -8,7 +8,7 @@ import kotlinx.serialization.Serializable
@Serializable
data class ProxyPacket(val mode: String, val proxies: Map<Int, Proxy>): Parcelable {
@Serializable
data class Proxy(val name: String, val type: Type, val now: Int, val all: Set<Int>, val delay: Long)
data class Proxy(val name: String, val type: Type, val now: Int, val all: List<Int>, val delay: Long)
enum class Type {
SELECT,
@@ -78,7 +78,7 @@ data class ProxyPacket(val mode: String, val proxies: Map<Int, Proxy>): Parcelab
}
val now = hashed[entry.value.second.now]?.first ?: 0
val all = entry.value.second.all.mapNotNull { hashed[it]?.first }.toSet()
val all = entry.value.second.all.mapNotNull { hashed[it]?.first }
val delay = entry.value.second.history.firstOrNull()?.delay ?: 0
entry.value.first to Proxy(entry.key, type, now, all, delay)