Fix subs id check (#3714)
* Fix subs id check Fix subs id check * Update MainViewModel.kt
This commit is contained in:
1 parent
daa0394960
commit
fe8b825c34
2 files changed
+6
-7
No files matched your search
@@ -43,7 +43,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
|||||||
var subscriptionId: String = MmkvManager.settingsStorage.decodeString(AppConfig.CACHE_SUBSCRIPTION_ID, "").orEmpty()
|
var subscriptionId: String = MmkvManager.settingsStorage.decodeString(AppConfig.CACHE_SUBSCRIPTION_ID, "").orEmpty()
|
||||||
|
|
||||||
//var keywordFilter: String = MmkvManager.settingsStorage.decodeString(AppConfig.CACHE_KEYWORD_FILTER, "")?:""
|
//var keywordFilter: String = MmkvManager.settingsStorage.decodeString(AppConfig.CACHE_KEYWORD_FILTER, "")?:""
|
||||||
var keywordFilter = ""
|
var keywordFilter = ""
|
||||||
val serversCache = mutableListOf<ServersCache>()
|
val serversCache = mutableListOf<ServersCache>()
|
||||||
val isRunning by lazy { MutableLiveData<Boolean>() }
|
val isRunning by lazy { MutableLiveData<Boolean>() }
|
||||||
val updateListAction by lazy { MutableLiveData<Int>() }
|
val updateListAction by lazy { MutableLiveData<Int>() }
|
||||||
@@ -153,7 +153,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun updateConfigViaSubAll(): Int {
|
fun updateConfigViaSubAll(): Int {
|
||||||
if (subscriptionId.isNullOrEmpty()) {
|
if (subscriptionId.isEmpty()) {
|
||||||
return AngConfigManager.updateConfigViaSubAll()
|
return AngConfigManager.updateConfigViaSubAll()
|
||||||
} else {
|
} else {
|
||||||
val subItem = MmkvManager.decodeSubscription(subscriptionId) ?: return 0
|
val subItem = MmkvManager.decodeSubscription(subscriptionId) ?: return 0
|
||||||
@@ -163,7 +163,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
|||||||
|
|
||||||
fun exportAllServer(): Int {
|
fun exportAllServer(): Int {
|
||||||
val serverListCopy =
|
val serverListCopy =
|
||||||
if (subscriptionId.isNullOrEmpty() && keywordFilter.isNullOrEmpty()) {
|
if (subscriptionId.isEmpty() && keywordFilter.isNullOrEmpty()) {
|
||||||
serverList
|
serverList
|
||||||
} else {
|
} else {
|
||||||
serversCache.map { it.guid }.toList()
|
serversCache.map { it.guid }.toList()
|
||||||
@@ -281,7 +281,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun removeAllServer() {
|
fun removeAllServer() {
|
||||||
if (subscriptionId.isNullOrEmpty() && keywordFilter.isNullOrEmpty()) {
|
if (subscriptionId.isEmpty() && keywordFilter.isNullOrEmpty()) {
|
||||||
MmkvManager.removeAllServer()
|
MmkvManager.removeAllServer()
|
||||||
} else {
|
} else {
|
||||||
val serversCopy = serversCache.toList()
|
val serversCopy = serversCache.toList()
|
||||||
@@ -292,7 +292,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun removeInvalidServer() {
|
fun removeInvalidServer() {
|
||||||
if (subscriptionId.isNullOrEmpty() && keywordFilter.isNullOrEmpty()) {
|
if (subscriptionId.isEmpty() && keywordFilter.isNullOrEmpty()) {
|
||||||
MmkvManager.removeInvalidServer("")
|
MmkvManager.removeInvalidServer("")
|
||||||
} else {
|
} else {
|
||||||
val serversCopy = serversCache.toList()
|
val serversCopy = serversCache.toList()
|
||||||
@@ -394,4 +394,4 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<style name="TabLayoutTextStyle" parent="TextAppearance.Design.Tab">
|
<style name="TabLayoutTextStyle" parent="TextAppearance.Design.Tab">
|
||||||
<item name="textAllCaps">false</item>
|
<item name="textAllCaps">false</item>
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in new issue
Block a user