Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust authored and AnGgIt86 committed Sep 23, 2024
1 parent cf7f0f3 commit d93adf9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion app/src/main/kotlin/com/neko/v2ray/extension/_Ext.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,6 @@ val URLConnection.responseLength: Long
val URI.idnHost: String
get() = host?.replace("[", "")?.replace("]", "").orEmpty()

fun String.removeWhiteSpace(): String = replace("\\s+".toRegex(), "")
fun String.removeWhiteSpace(): String = replace("\\s+".toRegex(), "")

fun String.toLongEx(): Long = toLongOrNull() ?: 0
7 changes: 4 additions & 3 deletions app/src/main/kotlin/com/neko/v2ray/ui/SettingsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import com.tencent.mmkv.MMKV
import com.neko.v2ray.AngApplication
import com.neko.v2ray.AppConfig
import com.neko.v2ray.R
import com.neko.v2ray.extension.toLongEx
import com.neko.v2ray.service.SubscriptionUpdater
import com.neko.v2ray.util.MmkvManager
import com.neko.v2ray.util.Utils
Expand Down Expand Up @@ -139,7 +140,7 @@ class SettingsActivity : BaseActivity() {
val value = newValue as Boolean
autoUpdateCheck?.isChecked = value
autoUpdateInterval?.isEnabled = value
autoUpdateInterval?.text?.toLong()?.let {
autoUpdateInterval?.text?.toLongEx()?.let {
if (newValue) configureUpdateTask(it) else cancelUpdateTask()
}
true
Expand All @@ -149,9 +150,9 @@ class SettingsActivity : BaseActivity() {

// It must be greater than 15 minutes because WorkManager couldn't run tasks under 15 minutes intervals
nval =
if (TextUtils.isEmpty(nval) || nval.toLong() < 15) AppConfig.SUBSCRIPTION_DEFAULT_UPDATE_INTERVAL else nval
if (TextUtils.isEmpty(nval) || nval.toLongEx() < 15) AppConfig.SUBSCRIPTION_DEFAULT_UPDATE_INTERVAL else nval
autoUpdateInterval?.summary = nval
configureUpdateTask(nval.toLong())
configureUpdateTask(nval.toLongEx())
true
}
socksPort?.setOnPreferenceChangeListener { _, any ->
Expand Down

0 comments on commit d93adf9

Please sign in to comment.