Chore: Fix geox url setting

This commit is contained in:
djoeni 2022-06-22 18:37:13 +07:00
parent 7048c10f1d
commit fcbeec95e4
17 changed files with 47 additions and 112 deletions

View File

@ -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<MainDesign>() {
setContentDesign(design)
launch(Dispatchers.IO) {
showUpdatedTips(design)
}
design.fetch()
val ticker = ticker(TimeUnit.SECONDS.toMillis(1))
@ -75,20 +69,6 @@ class MainActivity : BaseActivity<MainDesign>() {
}
}
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)

View File

@ -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"

View File

@ -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

View File

@ -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=

View File

@ -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

View File

@ -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=

View File

@ -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)

View File

@ -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<MainDesign.Request>(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<MainDesign.Request>(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

View File

@ -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,

View File

@ -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,

View File

@ -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 -> {}
}
}

View File

@ -73,7 +73,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/launch_name"
android:text="@string/application_name"
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline6" />
</LinearLayout>

View File

@ -23,9 +23,6 @@
<item
android:id="@+id/rule_mode"
android:title="@string/rule_mode" />
<item
android:id="@+id/script_mode"
android:title="@string/script_mode" />
</group>
</menu>
</item>

View File

@ -90,7 +90,6 @@
<string name="deny_selected_apps">不允許已選擇的應用</string>
<string name="no_profile_selected">沒有選擇配置文件</string>
<string name="copied">已複製</string>
<string name="script_mode">腳本模式</string>
<string name="google_play">Google Play</string>
<string name="filter">過濾</string>
<string name="select_all">全選</string>

View File

@ -90,7 +90,6 @@
<string name="deny_selected_apps">不允許已選擇的應用</string>
<string name="no_profile_selected">未選擇設定檔</string>
<string name="copied">已複製</string>
<string name="script_mode">腳本模式</string>
<string name="google_play">Google Play</string>
<string name="filter">過濾</string>
<string name="select_all">全選</string>

View File

@ -91,7 +91,6 @@
<string name="deny_selected_apps">不允许已选择的应用</string>
<string name="no_profile_selected">没有选择配置文件</string>
<string name="copied">已复制</string>
<string name="script_mode">脚本模式</string>
<string name="google_play">Google Play</string>
<string name="filter">过滤</string>
<string name="select_all">全选</string>

View File

@ -11,7 +11,6 @@
<string name="direct_mode">Direct Mode</string>
<string name="rule_mode">Rule Mode</string>
<string name="global_mode">Global Mode</string>
<string name="script_mode">Script Mode</string>
<string name="proxy_empty_tips">No groups can be displayed</string>
<string name="profiles">Profiles</string>
@ -295,7 +294,7 @@
<string name="geox_geoip">GeoIp Url</string>
<string name="geox_mmdb">MMDB Url</string>
<string name="geox_geosite">Geosite Url</string>
<string name="geoip_url" translatable="false">https://ghproxy.com/https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/geoip.dat</string>
<string name="mmdb_url" translatable="false">https://ghproxy.com/https://raw.githubusercontent.com/Loyalsoldier/geoip/release/Country.mmdb</string>
<string name="geosite_url" translatable="false">https://ghproxy.com/https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/geosite.dat</string>
<string name="geoip_url" translatable="false">https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/geoip.dat</string>
<string name="mmdb_url" translatable="false">https://raw.githubusercontent.com/Loyalsoldier/geoip/release/Country.mmdb</string>
<string name="geosite_url" translatable="false">https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/geosite.dat</string>
</resources>