From fcbeec95e499f90fc13d799331056213a0401d30 Mon Sep 17 00:00:00 2001 From: djoeni Date: Wed, 22 Jun 2022 18:37:13 +0700 Subject: [PATCH] Chore: Fix geox url setting --- .../com/github/kr328/clash/MainActivity.kt | 20 ------- build.gradle.kts | 2 +- core/src/foss/golang/go.mod | 4 +- core/src/foss/golang/go.sum | 8 +-- core/src/main/golang/go.mod | 4 +- core/src/main/golang/go.sum | 8 +-- .../github/kr328/clash/design/HelpDesign.kt | 18 +++---- .../github/kr328/clash/design/MainDesign.kt | 13 +---- .../clash/design/MetaFeatureSettingsDesign.kt | 6 +-- .../clash/design/OverrideSettingsDesign.kt | 53 ++++++------------- .../kr328/clash/design/component/ProxyMenu.kt | 8 +-- design/src/main/res/layout/design_main.xml | 2 +- design/src/main/res/menu/menu_proxy.xml | 3 -- design/src/main/res/values-zh-rHK/strings.xml | 1 - design/src/main/res/values-zh-rTW/strings.xml | 1 - design/src/main/res/values-zh/strings.xml | 1 - design/src/main/res/values/strings.xml | 7 ++- 17 files changed, 47 insertions(+), 112 deletions(-) diff --git a/app/src/main/java/com/github/kr328/clash/MainActivity.kt b/app/src/main/java/com/github/kr328/clash/MainActivity.kt index 6f599f5b..555385da 100644 --- a/app/src/main/java/com/github/kr328/clash/MainActivity.kt +++ b/app/src/main/java/com/github/kr328/clash/MainActivity.kt @@ -5,14 +5,12 @@ import com.github.kr328.clash.common.util.intent import com.github.kr328.clash.common.util.ticker import com.github.kr328.clash.design.MainDesign import com.github.kr328.clash.design.ui.ToastDuration -import com.github.kr328.clash.store.TipsStore import com.github.kr328.clash.util.startClashService import com.github.kr328.clash.util.stopClashService import com.github.kr328.clash.util.withClash import com.github.kr328.clash.util.withProfile import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.isActive -import kotlinx.coroutines.launch import kotlinx.coroutines.selects.select import kotlinx.coroutines.withContext import java.util.concurrent.TimeUnit @@ -23,10 +21,6 @@ class MainActivity : BaseActivity() { setContentDesign(design) - launch(Dispatchers.IO) { - showUpdatedTips(design) - } - design.fetch() val ticker = ticker(TimeUnit.SECONDS.toMillis(1)) @@ -75,20 +69,6 @@ class MainActivity : BaseActivity() { } } - private suspend fun showUpdatedTips(design: MainDesign) { - val tips = TipsStore(this) - - if (tips.primaryVersion != TipsStore.CURRENT_PRIMARY_VERSION) { - tips.primaryVersion = TipsStore.CURRENT_PRIMARY_VERSION - - val pkg = packageManager.getPackageInfo(packageName, 0) - - if (pkg.firstInstallTime != pkg.lastUpdateTime) { - design.showUpdatedTips() - } - } - } - private suspend fun MainDesign.fetch() { setClashRunning(clashRunning) diff --git a/build.gradle.kts b/build.gradle.kts index 9ee371e6..0480d1d5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -77,7 +77,7 @@ subprojects { dimension = flavorDimensionList[0] versionNameSuffix = ".Meta-Alpha" - buildConfigField("boolean", "PREMIUM", "Boolean.parseBoolean(\"true\")") + buildConfigField("boolean", "PREMIUM", "Boolean.parseBoolean(\"false\")") if (isApp) { applicationIdSuffix = ".foss" diff --git a/core/src/foss/golang/go.mod b/core/src/foss/golang/go.mod index bd0866b3..69d19bfa 100644 --- a/core/src/foss/golang/go.mod +++ b/core/src/foss/golang/go.mod @@ -38,8 +38,8 @@ require ( github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.32.1 // indirect github.com/prometheus/procfs v0.7.3 // indirect - github.com/sagernet/sing v0.0.0-20220618024624-ab2a9e30e56b // indirect - github.com/sagernet/sing-shadowsocks v0.0.0-20220618022156-a4a11dea4c45 // indirect + github.com/sagernet/sing v0.0.0-20220619130320-8793fe5e067d // indirect + github.com/sagernet/sing-shadowsocks v0.0.0-20220619134218-830a2f478eb1 // indirect github.com/sagernet/sing-vmess v0.0.0-20220616051646-3d3fc5d01eec // indirect github.com/sirupsen/logrus v1.8.1 // indirect github.com/tobyxdd/hysteria v1.0.4 // indirect diff --git a/core/src/foss/golang/go.sum b/core/src/foss/golang/go.sum index a0f6566e..cc25b9d0 100644 --- a/core/src/foss/golang/go.sum +++ b/core/src/foss/golang/go.sum @@ -295,10 +295,10 @@ github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0 github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/sagernet/sing v0.0.0-20220618024624-ab2a9e30e56b h1:/OFgkJ8sSjvSFgxtB58afbwjSW8x8guv9C5qH+ngbyM= -github.com/sagernet/sing v0.0.0-20220618024624-ab2a9e30e56b/go.mod h1:I67R/q5f67xDExL2kL3RLIP7kGJBOPkYXkpRAykgC+E= -github.com/sagernet/sing-shadowsocks v0.0.0-20220618022156-a4a11dea4c45 h1:MdS2DR36cIGbda532LOldtKCFjagNWTjDu3eLD/kivY= -github.com/sagernet/sing-shadowsocks v0.0.0-20220618022156-a4a11dea4c45/go.mod h1:vjjnjochlqzYGbkxNODSBDUoh56JUp8Ri6aMJQ3/fhw= +github.com/sagernet/sing v0.0.0-20220619130320-8793fe5e067d h1:zr8y4wmNIxv6Kkvgqysx8Piy82ATAThEj1jaEf23YQs= +github.com/sagernet/sing v0.0.0-20220619130320-8793fe5e067d/go.mod h1:I67R/q5f67xDExL2kL3RLIP7kGJBOPkYXkpRAykgC+E= +github.com/sagernet/sing-shadowsocks v0.0.0-20220619134218-830a2f478eb1 h1:3GEdnWbuSX4XwSKnxLUB/1rMXUxSVKeyRhEeT7k7N1Q= +github.com/sagernet/sing-shadowsocks v0.0.0-20220619134218-830a2f478eb1/go.mod h1:xk8Hh1hQiTeiY6jHCQjaxxN8M6B94JoGaNx5q61naE8= github.com/sagernet/sing-vmess v0.0.0-20220616051646-3d3fc5d01eec h1:jUSfKmyL6K9O2TvIvcVacZ4eNXHYbNSfdph+DRPyVlU= github.com/sagernet/sing-vmess v0.0.0-20220616051646-3d3fc5d01eec/go.mod h1:jDZ8fJgOea7Y7MMHWgfqwLBVLnhtW2zuxS5wjtDaB84= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= diff --git a/core/src/main/golang/go.mod b/core/src/main/golang/go.mod index 33901901..71acebeb 100644 --- a/core/src/main/golang/go.mod +++ b/core/src/main/golang/go.mod @@ -8,7 +8,7 @@ require ( github.com/dlclark/regexp2 v1.4.0 github.com/miekg/dns v1.1.49 github.com/oschwald/geoip2-golang v1.7.0 - github.com/sagernet/sing v0.0.0-20220618024624-ab2a9e30e56b + github.com/sagernet/sing v0.0.0-20220619130320-8793fe5e067d golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f gopkg.in/yaml.v2 v2.4.0 ) @@ -47,7 +47,7 @@ require ( github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.32.1 // indirect github.com/prometheus/procfs v0.7.3 // indirect - github.com/sagernet/sing-shadowsocks v0.0.0-20220618022156-a4a11dea4c45 // indirect + github.com/sagernet/sing-shadowsocks v0.0.0-20220619134218-830a2f478eb1 // indirect github.com/sagernet/sing-vmess v0.0.0-20220616051646-3d3fc5d01eec // indirect github.com/sirupsen/logrus v1.8.1 // indirect github.com/tobyxdd/hysteria v1.0.4 // indirect diff --git a/core/src/main/golang/go.sum b/core/src/main/golang/go.sum index a0f6566e..cc25b9d0 100644 --- a/core/src/main/golang/go.sum +++ b/core/src/main/golang/go.sum @@ -295,10 +295,10 @@ github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0 github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/sagernet/sing v0.0.0-20220618024624-ab2a9e30e56b h1:/OFgkJ8sSjvSFgxtB58afbwjSW8x8guv9C5qH+ngbyM= -github.com/sagernet/sing v0.0.0-20220618024624-ab2a9e30e56b/go.mod h1:I67R/q5f67xDExL2kL3RLIP7kGJBOPkYXkpRAykgC+E= -github.com/sagernet/sing-shadowsocks v0.0.0-20220618022156-a4a11dea4c45 h1:MdS2DR36cIGbda532LOldtKCFjagNWTjDu3eLD/kivY= -github.com/sagernet/sing-shadowsocks v0.0.0-20220618022156-a4a11dea4c45/go.mod h1:vjjnjochlqzYGbkxNODSBDUoh56JUp8Ri6aMJQ3/fhw= +github.com/sagernet/sing v0.0.0-20220619130320-8793fe5e067d h1:zr8y4wmNIxv6Kkvgqysx8Piy82ATAThEj1jaEf23YQs= +github.com/sagernet/sing v0.0.0-20220619130320-8793fe5e067d/go.mod h1:I67R/q5f67xDExL2kL3RLIP7kGJBOPkYXkpRAykgC+E= +github.com/sagernet/sing-shadowsocks v0.0.0-20220619134218-830a2f478eb1 h1:3GEdnWbuSX4XwSKnxLUB/1rMXUxSVKeyRhEeT7k7N1Q= +github.com/sagernet/sing-shadowsocks v0.0.0-20220619134218-830a2f478eb1/go.mod h1:xk8Hh1hQiTeiY6jHCQjaxxN8M6B94JoGaNx5q61naE8= github.com/sagernet/sing-vmess v0.0.0-20220616051646-3d3fc5d01eec h1:jUSfKmyL6K9O2TvIvcVacZ4eNXHYbNSfdph+DRPyVlU= github.com/sagernet/sing-vmess v0.0.0-20220616051646-3d3fc5d01eec/go.mod h1:jDZ8fJgOea7Y7MMHWgfqwLBVLnhtW2zuxS5wjtDaB84= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= diff --git a/design/src/main/java/com/github/kr328/clash/design/HelpDesign.kt b/design/src/main/java/com/github/kr328/clash/design/HelpDesign.kt index 552ff3f3..6a3cc385 100644 --- a/design/src/main/java/com/github/kr328/clash/design/HelpDesign.kt +++ b/design/src/main/java/com/github/kr328/clash/design/HelpDesign.kt @@ -55,15 +55,6 @@ class HelpDesign( category(R.string.sources) - clickable( - title = R.string.clash_meta_for_android, - summary = R.string.meta_github_url - ) { - clicked { - openLink(Uri.parse(context.getString(R.string.meta_github_url))) - } - } - clickable( title = R.string.clash_meta_core, summary = R.string.clash_meta_core_url @@ -72,6 +63,15 @@ class HelpDesign( openLink(Uri.parse(context.getString(R.string.clash_meta_core_url))) } } + + clickable( + title = R.string.clash_meta_for_android, + summary = R.string.meta_github_url + ) { + clicked { + openLink(Uri.parse(context.getString(R.string.meta_github_url))) + } + } } binding.content.addView(screen.root) diff --git a/design/src/main/java/com/github/kr328/clash/design/MainDesign.kt b/design/src/main/java/com/github/kr328/clash/design/MainDesign.kt index b1e0180b..d86e0c51 100644 --- a/design/src/main/java/com/github/kr328/clash/design/MainDesign.kt +++ b/design/src/main/java/com/github/kr328/clash/design/MainDesign.kt @@ -10,7 +10,6 @@ import com.github.kr328.clash.design.databinding.DesignMainBinding import com.github.kr328.clash.design.util.layoutInflater import com.github.kr328.clash.design.util.resolveThemedColor import com.github.kr328.clash.design.util.root -import com.google.android.material.dialog.MaterialAlertDialogBuilder import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext @@ -56,7 +55,7 @@ class MainDesign(context: Context) : Design(context) { TunnelState.Mode.Direct -> context.getString(R.string.direct_mode) TunnelState.Mode.Global -> context.getString(R.string.global_mode) TunnelState.Mode.Rule -> context.getString(R.string.rule_mode) - TunnelState.Mode.Script -> context.getString(R.string.script_mode) + else -> context.getString(R.string.rule_mode) } } } @@ -79,16 +78,6 @@ class MainDesign(context: Context) : Design(context) { } } - suspend fun showUpdatedTips() { - withContext(Dispatchers.Main) { - MaterialAlertDialogBuilder(context) - .setTitle(R.string.version_updated) - .setMessage(R.string.version_updated_tips) - .setPositiveButton(R.string.ok) { _, _ -> } - .show() - } - } - init { binding.self = this diff --git a/design/src/main/java/com/github/kr328/clash/design/MetaFeatureSettingsDesign.kt b/design/src/main/java/com/github/kr328/clash/design/MetaFeatureSettingsDesign.kt index 81dab73a..e2b941a8 100644 --- a/design/src/main/java/com/github/kr328/clash/design/MetaFeatureSettingsDesign.kt +++ b/design/src/main/java/com/github/kr328/clash/design/MetaFeatureSettingsDesign.kt @@ -63,7 +63,7 @@ class MetaFeatureSettingsDesign( ) val screen = preferenceScreen(context) { - category(R.string.meta_features) + category(R.string.settings) selectableList( value = configuration::unifiedDelay, @@ -164,7 +164,7 @@ class MetaFeatureSettingsDesign( ) editableText( - value = configuration.geoxurl::geoip, + value = configuration.geoxurl::mmdb, adapter = NullableTextAdapter.String, title = R.string.geox_mmdb, placeholder = R.string.dont_modify, @@ -173,7 +173,7 @@ class MetaFeatureSettingsDesign( ) editableText( - value = configuration.geoxurl::geoip, + value = configuration.geoxurl::geosite, adapter = NullableTextAdapter.String, title = R.string.geox_geosite, placeholder = R.string.dont_modify, diff --git a/design/src/main/java/com/github/kr328/clash/design/OverrideSettingsDesign.kt b/design/src/main/java/com/github/kr328/clash/design/OverrideSettingsDesign.kt index ba91d6b4..72c6c95f 100644 --- a/design/src/main/java/com/github/kr328/clash/design/OverrideSettingsDesign.kt +++ b/design/src/main/java/com/github/kr328/clash/design/OverrideSettingsDesign.kt @@ -185,43 +185,22 @@ class OverrideSettingsDesign( empty = R.string.default_ ) - if (BuildConfig.PREMIUM) { - selectableList( - value = configuration::mode, - values = arrayOf( - null, - TunnelState.Mode.Direct, - TunnelState.Mode.Global, - TunnelState.Mode.Rule, - TunnelState.Mode.Script - ), - valuesText = arrayOf( - R.string.dont_modify, - R.string.direct_mode, - R.string.global_mode, - R.string.rule_mode, - R.string.script_mode - ), - title = R.string.mode - ) - } else { - selectableList( - value = configuration::mode, - values = arrayOf( - null, - TunnelState.Mode.Direct, - TunnelState.Mode.Global, - TunnelState.Mode.Rule - ), - valuesText = arrayOf( - R.string.dont_modify, - R.string.direct_mode, - R.string.global_mode, - R.string.rule_mode - ), - title = R.string.mode - ) - } + selectableList( + value = configuration::mode, + values = arrayOf( + null, + TunnelState.Mode.Direct, + TunnelState.Mode.Global, + TunnelState.Mode.Rule + ), + valuesText = arrayOf( + R.string.dont_modify, + R.string.direct_mode, + R.string.global_mode, + R.string.rule_mode + ), + title = R.string.mode + ) selectableList( value = configuration::logLevel, diff --git a/design/src/main/java/com/github/kr328/clash/design/component/ProxyMenu.kt b/design/src/main/java/com/github/kr328/clash/design/component/ProxyMenu.kt index bd05cdfc..1c785018 100644 --- a/design/src/main/java/com/github/kr328/clash/design/component/ProxyMenu.kt +++ b/design/src/main/java/com/github/kr328/clash/design/component/ProxyMenu.kt @@ -6,7 +6,6 @@ import android.view.View import androidx.appcompat.widget.PopupMenu import com.github.kr328.clash.core.model.ProxySort import com.github.kr328.clash.core.model.TunnelState -import com.github.kr328.clash.design.BuildConfig import com.github.kr328.clash.design.ProxyDesign import com.github.kr328.clash.design.R import com.github.kr328.clash.design.store.UiStore @@ -76,9 +75,6 @@ class ProxyMenu( R.id.rule_mode -> { requests.trySend(ProxyDesign.Request.PatchMode(TunnelState.Mode.Rule)) } - R.id.script_mode -> { - requests.trySend(ProxyDesign.Request.PatchMode(TunnelState.Mode.Script)) - } else -> return false } @@ -89,8 +85,6 @@ class ProxyMenu( menu.menuInflater.inflate(R.menu.menu_proxy, menu.menu) menu.menu.apply { - findItem(R.id.script_mode).isVisible = BuildConfig.PREMIUM - findItem(R.id.not_selectable).isChecked = uiStore.proxyExcludeNotSelectable if (uiStore.proxySingleLine) { @@ -110,7 +104,7 @@ class ProxyMenu( TunnelState.Mode.Direct -> findItem(R.id.direct_mode).isChecked = true TunnelState.Mode.Global -> findItem(R.id.global_mode).isChecked = true TunnelState.Mode.Rule -> findItem(R.id.rule_mode).isChecked = true - TunnelState.Mode.Script -> findItem(R.id.script_mode).isChecked = true + else -> {} } } diff --git a/design/src/main/res/layout/design_main.xml b/design/src/main/res/layout/design_main.xml index 12892b97..1d02d7b4 100644 --- a/design/src/main/res/layout/design_main.xml +++ b/design/src/main/res/layout/design_main.xml @@ -73,7 +73,7 @@ diff --git a/design/src/main/res/menu/menu_proxy.xml b/design/src/main/res/menu/menu_proxy.xml index 304be2ba..77725c9e 100644 --- a/design/src/main/res/menu/menu_proxy.xml +++ b/design/src/main/res/menu/menu_proxy.xml @@ -23,9 +23,6 @@ - diff --git a/design/src/main/res/values-zh-rHK/strings.xml b/design/src/main/res/values-zh-rHK/strings.xml index a24e5def..50db4af3 100644 --- a/design/src/main/res/values-zh-rHK/strings.xml +++ b/design/src/main/res/values-zh-rHK/strings.xml @@ -90,7 +90,6 @@ 不允許已選擇的應用 沒有選擇配置文件 已複製 - 腳本模式 Google Play 過濾 全選 diff --git a/design/src/main/res/values-zh-rTW/strings.xml b/design/src/main/res/values-zh-rTW/strings.xml index 7f277472..fd6fbdcc 100644 --- a/design/src/main/res/values-zh-rTW/strings.xml +++ b/design/src/main/res/values-zh-rTW/strings.xml @@ -90,7 +90,6 @@ 不允許已選擇的應用 未選擇設定檔 已複製 - 腳本模式 Google Play 過濾 全選 diff --git a/design/src/main/res/values-zh/strings.xml b/design/src/main/res/values-zh/strings.xml index 1dafb0b4..2b780f5b 100644 --- a/design/src/main/res/values-zh/strings.xml +++ b/design/src/main/res/values-zh/strings.xml @@ -91,7 +91,6 @@ 不允许已选择的应用 没有选择配置文件 已复制 - 脚本模式 Google Play 过滤 全选 diff --git a/design/src/main/res/values/strings.xml b/design/src/main/res/values/strings.xml index 3bbffeb3..576bc26e 100644 --- a/design/src/main/res/values/strings.xml +++ b/design/src/main/res/values/strings.xml @@ -11,7 +11,6 @@ Direct Mode Rule Mode Global Mode - Script Mode No groups can be displayed Profiles @@ -295,7 +294,7 @@ GeoIp Url MMDB Url Geosite Url - https://ghproxy.com/https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/geoip.dat - https://ghproxy.com/https://raw.githubusercontent.com/Loyalsoldier/geoip/release/Country.mmdb - https://ghproxy.com/https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/geosite.dat + https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/geoip.dat + https://raw.githubusercontent.com/Loyalsoldier/geoip/release/Country.mmdb + https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/geosite.dat