diff --git a/app/src/main/java/com/gswxxn/restoresplashscreen/data/DataConst.kt b/app/src/main/java/com/gswxxn/restoresplashscreen/data/DataConst.kt
index b8e4b78..9e4cfbc 100644
--- a/app/src/main/java/com/gswxxn/restoresplashscreen/data/DataConst.kt
+++ b/app/src/main/java/com/gswxxn/restoresplashscreen/data/DataConst.kt
@@ -10,6 +10,7 @@ import com.highcapable.yukihookapi.hook.xposed.prefs.data.PrefsData
object DataConst {
val ENABLE_NEW_SYSTEM_UI_HOOKER = PrefsData("enable_new_system_ui_hooker", true)
val ENABLE_LOG = PrefsData("enable_log", false)
+ val ENABLE_LOG_TIMESTAMP = PrefsData("enable_log_timestamp", 0L)
val ENABLE_CUSTOM_SCOPE = PrefsData("enable_custom_scope", false)
val IS_CUSTOM_SCOPE_EXCEPTION_MODE = PrefsData("is_custom_scope_exception_mode", true)
val IS_REMOVE_BRANDING_IMAGE_EXCEPTION_MODE = PrefsData("is_remove_branding_image_exception_mode", false)
diff --git a/app/src/main/java/com/gswxxn/restoresplashscreen/ui/subsettings/BasicSettings.kt b/app/src/main/java/com/gswxxn/restoresplashscreen/ui/subsettings/BasicSettings.kt
index 00fe078..16be809 100644
--- a/app/src/main/java/com/gswxxn/restoresplashscreen/ui/subsettings/BasicSettings.kt
+++ b/app/src/main/java/com/gswxxn/restoresplashscreen/ui/subsettings/BasicSettings.kt
@@ -17,6 +17,7 @@ import com.gswxxn.restoresplashscreen.ui.`interface`.ISubSettings
import com.gswxxn.restoresplashscreen.utils.BackupUtils
import com.gswxxn.restoresplashscreen.view.BlockMIUIItemData
import com.gswxxn.restoresplashscreen.view.SwitchView
+import com.highcapable.yukihookapi.hook.factory.prefs
/**
* 基础设置 界面
@@ -27,7 +28,17 @@ object BasicSettings : ISubSettings {
override fun create(context: SubSettings, binding: ActivitySubSettingsBinding): BlockMIUIItemData.() -> Unit = {
// 启用日志
- TextSummaryWithSwitch(TextSummaryV(textId = R.string.enable_log), SwitchView(DataConst.ENABLE_LOG))
+ if (System.currentTimeMillis() - context.prefs().get(DataConst.ENABLE_LOG_TIMESTAMP) > 86400000) {
+ context.prefs().edit().put(DataConst.ENABLE_LOG, false).commit()
+ }
+ TextSummaryWithSwitch(
+ TextSummaryV(textId = R.string.enable_log, tipsId = R.string.enable_log_tips),
+ SwitchView(DataConst.ENABLE_LOG) {
+ if (it) {
+ context.prefs().edit { put(DataConst.ENABLE_LOG_TIMESTAMP, System.currentTimeMillis()) }
+ }
+ }
+ )
// 隐藏桌面图标
TextSummaryWithSwitch(TextSummaryV(textId = R.string.hide_icon), SwitchView(DataConst.ENABLE_HIDE_ICON) {
diff --git a/app/src/main/java/com/gswxxn/restoresplashscreen/utils/YukiHelper.kt b/app/src/main/java/com/gswxxn/restoresplashscreen/utils/YukiHelper.kt
index f338800..e83b11a 100644
--- a/app/src/main/java/com/gswxxn/restoresplashscreen/utils/YukiHelper.kt
+++ b/app/src/main/java/com/gswxxn/restoresplashscreen/utils/YukiHelper.kt
@@ -14,6 +14,7 @@ import com.highcapable.yukihookapi.hook.factory.hasClass
import com.highcapable.yukihookapi.hook.factory.method
import com.highcapable.yukihookapi.hook.log.YLog
import com.highcapable.yukihookapi.hook.type.java.StringClass
+import com.highcapable.yukihookapi.hook.xposed.prefs.YukiHookPrefsBridge
import com.highcapable.yukihookapi.hook.xposed.prefs.data.PrefsData
/**
@@ -84,17 +85,21 @@ object YukiHelper {
/**
* 打印日志
*/
- fun YukiBaseHooker.printLog(vararg msg: String) {
- if (prefs.get(DataConst.ENABLE_LOG)) msg.forEach { YLog.info(it) }
- }
+ fun YukiBaseHooker.printLog(vararg msg: String) = printLog(prefs, *msg)
/**
* 打印日志
*/
- fun BaseHookHandler.printLog(vararg msg: String) {
- if (prefs.get(DataConst.ENABLE_LOG)) msg.forEach { YLog.info(it) }
- }
+ fun BaseHookHandler.printLog(vararg msg: String) = printLog(prefs, *msg)
+ /**
+ * 打印日志
+ */
+ fun printLog(prefs: YukiHookPrefsBridge, vararg msg: String) {
+ if (!prefs.get(DataConst.ENABLE_LOG)) return
+ if (System.currentTimeMillis() - prefs.get(DataConst.ENABLE_LOG_TIMESTAMP) > 86400000) return
+ msg.forEach { YLog.info(it) }
+ }
/**
* 当前设备是否是 MIUI 定制 Android 系统
* @return [Boolean] 是否符合条件
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 5bc305e..eabe904 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -39,6 +39,7 @@
请确保模块已激活再进行配置
启用日志
+ 启用日志 24 小时后自动关闭
隐藏桌面图标
遮罩最小持续时长
注意:设置此参数会拖慢应用启动时间。如无特殊需求,则不应配置此项。