mirror of
https://github.com/fankes/ColorOSNotifyIcon.git
synced 2025-09-05 10:15:33 +08:00
Revert "feat: Custom GitHub Proxy (#68)"
This reverts commit 1b0fcdfce6
.
This commit is contained in:
@@ -50,9 +50,6 @@ object IconRuleSourceSyncType {
|
|||||||
/** GitHub Raw (代理 - 7ED Services) */
|
/** GitHub Raw (代理 - 7ED Services) */
|
||||||
const val GITHUB_RAW_PROXY_2 = 1000
|
const val GITHUB_RAW_PROXY_2 = 1000
|
||||||
|
|
||||||
/** GitHub Raw (自定义) */
|
|
||||||
const val GITHUB_RAW_PROXY = 4000
|
|
||||||
|
|
||||||
/** GitHub Raw (直连) */
|
/** GitHub Raw (直连) */
|
||||||
const val GITHUB_RAW_DIRECT = 2000
|
const val GITHUB_RAW_DIRECT = 2000
|
||||||
|
|
||||||
|
@@ -100,9 +100,6 @@ object ConfigData {
|
|||||||
/** 通知图标优化名单同步地址 */
|
/** 通知图标优化名单同步地址 */
|
||||||
val ICON_RULE_SOURCE_SYNC_CUSTOM_URL = PrefsData("_rule_source_sync_way_custom_url", "")
|
val ICON_RULE_SOURCE_SYNC_CUSTOM_URL = PrefsData("_rule_source_sync_way_custom_url", "")
|
||||||
|
|
||||||
/** 通知图标优化名单同步镜像地址 */
|
|
||||||
val ICON_RULE_SOURCE_SYNC_PROXY_URL = PrefsData("_rule_source_sync_way_proxy_url", "")
|
|
||||||
|
|
||||||
/** 当前实例 - [Context] or [PackageParam] */
|
/** 当前实例 - [Context] or [PackageParam] */
|
||||||
private var instance: Any? = null
|
private var instance: Any? = null
|
||||||
|
|
||||||
@@ -389,14 +386,4 @@ object ConfigData {
|
|||||||
set(value) {
|
set(value) {
|
||||||
putString(ICON_RULE_SOURCE_SYNC_CUSTOM_URL, value)
|
putString(ICON_RULE_SOURCE_SYNC_CUSTOM_URL, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 通知图标优化名单同步镜像地址
|
|
||||||
* @return [String]
|
|
||||||
*/
|
|
||||||
var iconRuleSourceSyncProxyUrl
|
|
||||||
get() = getString(ICON_RULE_SOURCE_SYNC_PROXY_URL)
|
|
||||||
set(value) {
|
|
||||||
putString(ICON_RULE_SOURCE_SYNC_PROXY_URL, value)
|
|
||||||
}
|
|
||||||
}
|
}
|
@@ -110,7 +110,6 @@ object IconRuleManagerTool {
|
|||||||
title = "同步列表"
|
title = "同步列表"
|
||||||
var sourceType = ConfigData.iconRuleSourceSyncType
|
var sourceType = ConfigData.iconRuleSourceSyncType
|
||||||
var customUrl = ConfigData.iconRuleSourceSyncCustomUrl
|
var customUrl = ConfigData.iconRuleSourceSyncCustomUrl
|
||||||
var proxyUrl = ConfigData.iconRuleSourceSyncProxyUrl
|
|
||||||
binding.sourceUrlEdit.apply {
|
binding.sourceUrlEdit.apply {
|
||||||
if (customUrl.isNotBlank()) {
|
if (customUrl.isNotBlank()) {
|
||||||
setText(customUrl)
|
setText(customUrl)
|
||||||
@@ -118,48 +117,29 @@ object IconRuleManagerTool {
|
|||||||
}
|
}
|
||||||
doOnTextChanged { text, _, _, _ -> customUrl = text.toString() }
|
doOnTextChanged { text, _, _, _ -> customUrl = text.toString() }
|
||||||
}
|
}
|
||||||
binding.sourceUrlEditProxy.apply {
|
|
||||||
if (proxyUrl.isNotBlank()) {
|
|
||||||
setText(proxyUrl)
|
|
||||||
setSelection(proxyUrl.length)
|
|
||||||
}
|
|
||||||
doOnTextChanged { text, _, _, _ -> proxyUrl = text.toString() }
|
|
||||||
}
|
|
||||||
binding.sourceFromTextLin.isVisible = sourceType == IconRuleSourceSyncType.CUSTOM_URL
|
binding.sourceFromTextLin.isVisible = sourceType == IconRuleSourceSyncType.CUSTOM_URL
|
||||||
binding.sourceFromTextLinProxy.isVisible = sourceType == IconRuleSourceSyncType.GITHUB_RAW_PROXY
|
|
||||||
binding.sourceTravelerLin.isVisible = sourceType != IconRuleSourceSyncType.CUSTOM_URL
|
binding.sourceTravelerLin.isVisible = sourceType != IconRuleSourceSyncType.CUSTOM_URL
|
||||||
binding.sourceRadio0.isChecked = sourceType == IconRuleSourceSyncType.GITHUB_RAW_PROXY_1
|
binding.sourceRadio0.isChecked = sourceType == IconRuleSourceSyncType.GITHUB_RAW_PROXY_1
|
||||||
binding.sourceRadio1.isChecked = sourceType == IconRuleSourceSyncType.GITHUB_RAW_PROXY_2
|
binding.sourceRadio1.isChecked = sourceType == IconRuleSourceSyncType.GITHUB_RAW_PROXY_2
|
||||||
binding.sourceRadio2.isChecked = sourceType == IconRuleSourceSyncType.GITHUB_RAW_DIRECT
|
binding.sourceRadio2.isChecked = sourceType == IconRuleSourceSyncType.GITHUB_RAW_DIRECT
|
||||||
binding.sourceRadio3.isChecked = sourceType == IconRuleSourceSyncType.GITHUB_RAW_PROXY
|
binding.sourceRadio3.isChecked = sourceType == IconRuleSourceSyncType.CUSTOM_URL
|
||||||
binding.sourceRadio4.isChecked = sourceType == IconRuleSourceSyncType.CUSTOM_URL
|
|
||||||
binding.sourceRadio0.setOnClickListener {
|
binding.sourceRadio0.setOnClickListener {
|
||||||
binding.sourceFromTextLin.isVisible = false
|
binding.sourceFromTextLin.isVisible = false
|
||||||
binding.sourceFromTextLinProxy.isVisible = false
|
|
||||||
binding.sourceTravelerLin.isVisible = true
|
binding.sourceTravelerLin.isVisible = true
|
||||||
sourceType = IconRuleSourceSyncType.GITHUB_RAW_PROXY_1
|
sourceType = IconRuleSourceSyncType.GITHUB_RAW_PROXY_1
|
||||||
}
|
}
|
||||||
binding.sourceRadio1.setOnClickListener {
|
binding.sourceRadio1.setOnClickListener {
|
||||||
binding.sourceFromTextLin.isVisible = false
|
binding.sourceFromTextLin.isVisible = false
|
||||||
binding.sourceFromTextLinProxy.isVisible = false
|
|
||||||
binding.sourceTravelerLin.isVisible = true
|
binding.sourceTravelerLin.isVisible = true
|
||||||
sourceType = IconRuleSourceSyncType.GITHUB_RAW_PROXY_2
|
sourceType = IconRuleSourceSyncType.GITHUB_RAW_PROXY_2
|
||||||
}
|
}
|
||||||
binding.sourceRadio2.setOnClickListener {
|
binding.sourceRadio2.setOnClickListener {
|
||||||
binding.sourceFromTextLin.isVisible = false
|
binding.sourceFromTextLin.isVisible = false
|
||||||
binding.sourceFromTextLinProxy.isVisible = false
|
|
||||||
binding.sourceTravelerLin.isVisible = true
|
binding.sourceTravelerLin.isVisible = true
|
||||||
sourceType = IconRuleSourceSyncType.GITHUB_RAW_DIRECT
|
sourceType = IconRuleSourceSyncType.GITHUB_RAW_DIRECT
|
||||||
}
|
}
|
||||||
binding.sourceRadio3.setOnClickListener {
|
binding.sourceRadio3.setOnClickListener {
|
||||||
binding.sourceFromTextLin.isVisible = false
|
|
||||||
binding.sourceFromTextLinProxy.isVisible = true
|
|
||||||
binding.sourceTravelerLin.isVisible = true
|
|
||||||
sourceType = IconRuleSourceSyncType.GITHUB_RAW_PROXY
|
|
||||||
}
|
|
||||||
binding.sourceRadio4.setOnClickListener {
|
|
||||||
binding.sourceFromTextLin.isVisible = true
|
binding.sourceFromTextLin.isVisible = true
|
||||||
binding.sourceFromTextLinProxy.isVisible = false
|
|
||||||
binding.sourceTravelerLin.isVisible = false
|
binding.sourceTravelerLin.isVisible = false
|
||||||
sourceType = IconRuleSourceSyncType.CUSTOM_URL
|
sourceType = IconRuleSourceSyncType.CUSTOM_URL
|
||||||
}
|
}
|
||||||
@@ -168,8 +148,7 @@ object IconRuleManagerTool {
|
|||||||
confirmButton {
|
confirmButton {
|
||||||
ConfigData.iconRuleSourceSyncType = sourceType
|
ConfigData.iconRuleSourceSyncType = sourceType
|
||||||
ConfigData.iconRuleSourceSyncCustomUrl = customUrl
|
ConfigData.iconRuleSourceSyncCustomUrl = customUrl
|
||||||
ConfigData.iconRuleSourceSyncProxyUrl = proxyUrl
|
sync(context, sourceType, customUrl, callback)
|
||||||
sync(context, sourceType, customUrl, proxyUrl, callback)
|
|
||||||
}
|
}
|
||||||
cancelButton()
|
cancelButton()
|
||||||
neutralButton(text = "自定义规则") {
|
neutralButton(text = "自定义规则") {
|
||||||
@@ -228,13 +207,11 @@ object IconRuleManagerTool {
|
|||||||
context: Context,
|
context: Context,
|
||||||
sourceType: Int = ConfigData.iconRuleSourceSyncType,
|
sourceType: Int = ConfigData.iconRuleSourceSyncType,
|
||||||
customUrl: String = ConfigData.iconRuleSourceSyncCustomUrl,
|
customUrl: String = ConfigData.iconRuleSourceSyncCustomUrl,
|
||||||
proxyUrl: String = ConfigData.iconRuleSourceSyncProxyUrl,
|
|
||||||
callback: () -> Unit
|
callback: () -> Unit
|
||||||
) {
|
) {
|
||||||
when (sourceType) {
|
when (sourceType) {
|
||||||
IconRuleSourceSyncType.GITHUB_RAW_PROXY_1 -> onRefreshing(context, SYNC_PROXY_1_URL, callback)
|
IconRuleSourceSyncType.GITHUB_RAW_PROXY_1 -> onRefreshing(context, SYNC_PROXY_1_URL, callback)
|
||||||
IconRuleSourceSyncType.GITHUB_RAW_PROXY_2 -> onRefreshing(context, SYNC_PROXY_2_URL, callback)
|
IconRuleSourceSyncType.GITHUB_RAW_PROXY_2 -> onRefreshing(context, SYNC_PROXY_2_URL, callback)
|
||||||
IconRuleSourceSyncType.GITHUB_RAW_PROXY -> onRefreshing(context, "$proxyUrl/$SYNC_DIRECT_URL", callback)
|
|
||||||
IconRuleSourceSyncType.GITHUB_RAW_DIRECT -> onRefreshing(context, SYNC_DIRECT_URL, callback)
|
IconRuleSourceSyncType.GITHUB_RAW_DIRECT -> onRefreshing(context, SYNC_DIRECT_URL, callback)
|
||||||
IconRuleSourceSyncType.CUSTOM_URL ->
|
IconRuleSourceSyncType.CUSTOM_URL ->
|
||||||
if (customUrl.isNotBlank())
|
if (customUrl.isNotBlank())
|
||||||
|
@@ -49,13 +49,6 @@
|
|||||||
android:id="@+id/source_radio_3"
|
android:id="@+id/source_radio_3"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="GitHub Proxy (自定义)"
|
|
||||||
app:buttonTint="@color/colorPrimaryAccent" />
|
|
||||||
|
|
||||||
<com.google.android.material.radiobutton.MaterialRadioButton
|
|
||||||
android:id="@+id/source_radio_4"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="从自定义地址获取"
|
android:text="从自定义地址获取"
|
||||||
app:buttonTint="@color/colorPrimaryAccent" />
|
app:buttonTint="@color/colorPrimaryAccent" />
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
@@ -76,22 +69,6 @@
|
|||||||
android:singleLine="true" />
|
android:singleLine="true" />
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
|
||||||
android:id="@+id/source_from_text_lin_proxy"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:visibility="gone">
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
|
||||||
android:id="@+id/source_url_edit_proxy"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:hint="请输入 GitHub Proxy URL"
|
|
||||||
android:singleLine="true" />
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/source_traveler_lin"
|
android:id="@+id/source_traveler_lin"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -145,4 +122,4 @@
|
|||||||
android:textSize="15sp" />
|
android:textSize="15sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
Reference in New Issue
Block a user