mirror of
https://github.com/fankes/ColorOSNotifyIcon.git
synced 2025-09-04 01:35:22 +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) */
|
||||
const val GITHUB_RAW_PROXY_2 = 1000
|
||||
|
||||
/** GitHub Raw (自定义) */
|
||||
const val GITHUB_RAW_PROXY = 4000
|
||||
|
||||
/** GitHub Raw (直连) */
|
||||
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_PROXY_URL = PrefsData("_rule_source_sync_way_proxy_url", "")
|
||||
|
||||
/** 当前实例 - [Context] or [PackageParam] */
|
||||
private var instance: Any? = null
|
||||
|
||||
@@ -389,14 +386,4 @@ object ConfigData {
|
||||
set(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 = "同步列表"
|
||||
var sourceType = ConfigData.iconRuleSourceSyncType
|
||||
var customUrl = ConfigData.iconRuleSourceSyncCustomUrl
|
||||
var proxyUrl = ConfigData.iconRuleSourceSyncProxyUrl
|
||||
binding.sourceUrlEdit.apply {
|
||||
if (customUrl.isNotBlank()) {
|
||||
setText(customUrl)
|
||||
@@ -118,48 +117,29 @@ object IconRuleManagerTool {
|
||||
}
|
||||
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.sourceFromTextLinProxy.isVisible = sourceType == IconRuleSourceSyncType.GITHUB_RAW_PROXY
|
||||
binding.sourceTravelerLin.isVisible = sourceType != IconRuleSourceSyncType.CUSTOM_URL
|
||||
binding.sourceRadio0.isChecked = sourceType == IconRuleSourceSyncType.GITHUB_RAW_PROXY_1
|
||||
binding.sourceRadio1.isChecked = sourceType == IconRuleSourceSyncType.GITHUB_RAW_PROXY_2
|
||||
binding.sourceRadio2.isChecked = sourceType == IconRuleSourceSyncType.GITHUB_RAW_DIRECT
|
||||
binding.sourceRadio3.isChecked = sourceType == IconRuleSourceSyncType.GITHUB_RAW_PROXY
|
||||
binding.sourceRadio4.isChecked = sourceType == IconRuleSourceSyncType.CUSTOM_URL
|
||||
binding.sourceRadio3.isChecked = sourceType == IconRuleSourceSyncType.CUSTOM_URL
|
||||
binding.sourceRadio0.setOnClickListener {
|
||||
binding.sourceFromTextLin.isVisible = false
|
||||
binding.sourceFromTextLinProxy.isVisible = false
|
||||
binding.sourceTravelerLin.isVisible = true
|
||||
sourceType = IconRuleSourceSyncType.GITHUB_RAW_PROXY_1
|
||||
}
|
||||
binding.sourceRadio1.setOnClickListener {
|
||||
binding.sourceFromTextLin.isVisible = false
|
||||
binding.sourceFromTextLinProxy.isVisible = false
|
||||
binding.sourceTravelerLin.isVisible = true
|
||||
sourceType = IconRuleSourceSyncType.GITHUB_RAW_PROXY_2
|
||||
}
|
||||
binding.sourceRadio2.setOnClickListener {
|
||||
binding.sourceFromTextLin.isVisible = false
|
||||
binding.sourceFromTextLinProxy.isVisible = false
|
||||
binding.sourceTravelerLin.isVisible = true
|
||||
sourceType = IconRuleSourceSyncType.GITHUB_RAW_DIRECT
|
||||
}
|
||||
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.sourceFromTextLinProxy.isVisible = false
|
||||
binding.sourceTravelerLin.isVisible = false
|
||||
sourceType = IconRuleSourceSyncType.CUSTOM_URL
|
||||
}
|
||||
@@ -168,8 +148,7 @@ object IconRuleManagerTool {
|
||||
confirmButton {
|
||||
ConfigData.iconRuleSourceSyncType = sourceType
|
||||
ConfigData.iconRuleSourceSyncCustomUrl = customUrl
|
||||
ConfigData.iconRuleSourceSyncProxyUrl = proxyUrl
|
||||
sync(context, sourceType, customUrl, proxyUrl, callback)
|
||||
sync(context, sourceType, customUrl, callback)
|
||||
}
|
||||
cancelButton()
|
||||
neutralButton(text = "自定义规则") {
|
||||
@@ -228,13 +207,11 @@ object IconRuleManagerTool {
|
||||
context: Context,
|
||||
sourceType: Int = ConfigData.iconRuleSourceSyncType,
|
||||
customUrl: String = ConfigData.iconRuleSourceSyncCustomUrl,
|
||||
proxyUrl: String = ConfigData.iconRuleSourceSyncProxyUrl,
|
||||
callback: () -> Unit
|
||||
) {
|
||||
when (sourceType) {
|
||||
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 -> onRefreshing(context, "$proxyUrl/$SYNC_DIRECT_URL", callback)
|
||||
IconRuleSourceSyncType.GITHUB_RAW_DIRECT -> onRefreshing(context, SYNC_DIRECT_URL, callback)
|
||||
IconRuleSourceSyncType.CUSTOM_URL ->
|
||||
if (customUrl.isNotBlank())
|
||||
|
@@ -49,13 +49,6 @@
|
||||
android:id="@+id/source_radio_3"
|
||||
android:layout_width="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="从自定义地址获取"
|
||||
app:buttonTint="@color/colorPrimaryAccent" />
|
||||
</RadioGroup>
|
||||
@@ -76,22 +69,6 @@
|
||||
android:singleLine="true" />
|
||||
</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
|
||||
android:id="@+id/source_traveler_lin"
|
||||
android:layout_width="match_parent"
|
||||
@@ -145,4 +122,4 @@
|
||||
android:textSize="15sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
Reference in New Issue
Block a user