mirror of
https://github.com/fankes/MIUINativeNotifyIcon.git
synced 2025-09-05 10:15:31 +08:00
Revert "feat: custom GitHub Proxy (#208)"
This reverts commit a601739679
.
This commit is contained in:
@@ -50,9 +50,6 @@ object IconRuleSourceSyncType {
|
|||||||
/** GitHub Raw (直连) */
|
/** GitHub Raw (直连) */
|
||||||
const val GITHUB_RAW_DIRECT = 2000
|
const val GITHUB_RAW_DIRECT = 2000
|
||||||
|
|
||||||
/** GitHub Raw (自定义) */
|
|
||||||
const val GITHUB_RAW_PROXY = 4000
|
|
||||||
|
|
||||||
/** 自定义地址 */
|
/** 自定义地址 */
|
||||||
const val CUSTOM_URL = 3000
|
const val CUSTOM_URL = 3000
|
||||||
}
|
}
|
||||||
|
@@ -93,9 +93,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", "")
|
|
||||||
|
|
||||||
/** 忽略 Android 版本过低提示 */
|
/** 忽略 Android 版本过低提示 */
|
||||||
val IGNORED_ANDROID_VERSION_TO_LOW = PrefsData("_ignored_android_version_to_low", false)
|
val IGNORED_ANDROID_VERSION_TO_LOW = PrefsData("_ignored_android_version_to_low", false)
|
||||||
|
|
||||||
@@ -366,16 +363,6 @@ object ConfigData {
|
|||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否忽略 Android 版本过低提示
|
* 是否忽略 Android 版本过低提示
|
||||||
* @return [Boolean]
|
* @return [Boolean]
|
||||||
|
@@ -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,14 +207,12 @@ 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_DIRECT -> onRefreshing(context, SYNC_DIRECT_URL, callback)
|
IconRuleSourceSyncType.GITHUB_RAW_DIRECT -> onRefreshing(context, SYNC_DIRECT_URL, callback)
|
||||||
IconRuleSourceSyncType.GITHUB_RAW_PROXY -> onRefreshing(context, "$proxyUrl/$SYNC_DIRECT_URL", callback)
|
|
||||||
IconRuleSourceSyncType.CUSTOM_URL ->
|
IconRuleSourceSyncType.CUSTOM_URL ->
|
||||||
if (customUrl.isNotBlank())
|
if (customUrl.isNotBlank())
|
||||||
if (customUrl.startsWith("http://") || customUrl.startsWith("https://"))
|
if (customUrl.startsWith("http://") || customUrl.startsWith("https://"))
|
||||||
|
@@ -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