Remove unnecessary null check from keywordFilter (#3737)
* Remove unnecessary null check from keywordFilter - Replaced `keywordFilter.isNullOrEmpty()` with `keywordFilter.isEmpty()` since `keywordFilter` is guaranteed to never be null. - Simplified the logic by removing the redundant null check, improving code readability. * Remove unnecessary null check from keywordFilter - Replaced `keywordFilter.isNullOrEmpty()` with `keywordFilter.isEmpty()` since `keywordFilter` is guaranteed to never be null. - Simplified the logic by removing the redundant null check, improving code readability.
This commit is contained in:
@@ -163,7 +163,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
||||
|
||||
fun exportAllServer(): Int {
|
||||
val serverListCopy =
|
||||
if (subscriptionId.isEmpty() && keywordFilter.isNullOrEmpty()) {
|
||||
if (subscriptionId.isEmpty() && keywordFilter.isEmpty()) {
|
||||
serverList
|
||||
} else {
|
||||
serversCache.map { it.guid }.toList()
|
||||
@@ -281,7 +281,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
||||
}
|
||||
|
||||
fun removeAllServer() {
|
||||
if (subscriptionId.isEmpty() && keywordFilter.isNullOrEmpty()) {
|
||||
if (subscriptionId.isEmpty() && keywordFilter.isEmpty()) {
|
||||
MmkvManager.removeAllServer()
|
||||
} else {
|
||||
val serversCopy = serversCache.toList()
|
||||
@@ -292,7 +292,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
|
||||
}
|
||||
|
||||
fun removeInvalidServer() {
|
||||
if (subscriptionId.isEmpty() && keywordFilter.isNullOrEmpty()) {
|
||||
if (subscriptionId.isEmpty() && keywordFilter.isEmpty()) {
|
||||
MmkvManager.removeInvalidServer("")
|
||||
} else {
|
||||
val serversCopy = serversCache.toList()
|
||||
|
||||
Reference in New Issue
Block a user