From 090d8e5f2bfc6d47b6e5293ccbcf5415ed03cde4 Mon Sep 17 00:00:00 2001 From: Fankesyooni Date: Tue, 22 Mar 2022 20:27:11 +0800 Subject: [PATCH] Merge code --- .../notify/utils/tool/IconRuleManagerTool.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/fankes/coloros/notify/utils/tool/IconRuleManagerTool.kt b/app/src/main/java/com/fankes/coloros/notify/utils/tool/IconRuleManagerTool.kt index fd89279..5e462f4 100644 --- a/app/src/main/java/com/fankes/coloros/notify/utils/tool/IconRuleManagerTool.kt +++ b/app/src/main/java/com/fankes/coloros/notify/utils/tool/IconRuleManagerTool.kt @@ -120,7 +120,7 @@ object IconRuleManagerTool { } } confirmButton { - sync(context) { + sync(context, sourceType, customUrl) { context.modulePrefs.putInt(SOURCE_SYNC_WAY, sourceType) it() } @@ -174,11 +174,16 @@ object IconRuleManagerTool { /** * 从在线地址同步规则 * @param context 实例 + * @param sourceType 同步地址类型 + * @param customUrl 自定义同步地址 * @param it 成功后回调 */ - fun sync(context: Context, it: () -> Unit) { - val sourceType = context.modulePrefs.getInt(SOURCE_SYNC_WAY, TYPE_SOURCE_SYNC_WAY_1) - val customUrl = context.modulePrefs.getString(SOURCE_SYNC_WAY_CUSTOM_URL) + fun sync( + context: Context, + sourceType: Int = context.modulePrefs.getInt(SOURCE_SYNC_WAY, TYPE_SOURCE_SYNC_WAY_1), + customUrl: String = context.modulePrefs.getString(SOURCE_SYNC_WAY_CUSTOM_URL), + it: () -> Unit + ) { when (sourceType) { TYPE_SOURCE_SYNC_WAY_1 -> onRefreshing(context, url = "https://raw.fastgit.org/fankes/AndroidNotifyIconAdapt/main", it)