Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
Add debug mode switch
Browse files Browse the repository at this point in the history
  • Loading branch information
kmod-midori committed Jan 25, 2017
1 parent 84501c3 commit cf75de4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ class GeneralPreferenceFragment : PreferenceFragmentCompat(), SharedPreferences.
pref_alipay.setOnPreferenceClickListener {
val qrcode = URLEncoder.encode("https://qr.alipay.com/a6x04349f12rwyb6webwlb7", "utf-8")
val alipayqr = "alipayqr://platformapi/startapp?saId=10000007&clientVersion=3.7.0.0718&qrcode=$qrcode"
val intent = Intent()
intent.action = Intent.ACTION_VIEW
intent.data = Uri.parse("$alipayqr&%3F_s%3Dweb-other&_t=${System.currentTimeMillis()}")
val uri = Uri.parse("$alipayqr&%3F_s%3Dweb-other&_t=${System.currentTimeMillis()}")
val intent = Intent(Intent.ACTION_VIEW, uri)
try {
context.startActivity(intent)
} catch (e: Exception) {
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/kotlin/moe/reimu/weiboxposed/Module.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class Module : IXposedHookInitPackageResources, IXposedHookLoadPackage, IXposedH

lateinit private var prefs: XSharedPreferences
private var remove_hot = false
private var debug_mode = false
private val enabled_feature = arrayListOf("Night_Mode")
private val disabled_feature = arrayListOf<String>()
private var content_keyword = listOf<String>()
Expand Down Expand Up @@ -150,7 +151,7 @@ class Module : IXposedHookInitPackageResources, IXposedHookLoadPackage, IXposedH
}

private fun logd(text: String) {
if (BuildConfig.DEBUG) XposedBridge.log("[WeiboXposed] " + text)
if (debug_mode) XposedBridge.log("[WeiboXposed] " + text)
}

private val removeAD = object : XC_MethodHook() {
Expand Down Expand Up @@ -297,7 +298,8 @@ class Module : IXposedHookInitPackageResources, IXposedHookLoadPackage, IXposedH
private fun reloadPrefs() {
prefs.reload()
log("loaded")
if (BuildConfig.DEBUG) {
debug_mode = prefs.getBoolean("debug_mode", false)
if (debug_mode) {
dumpPrefs()
}

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<string name="pref_title_user_keyword">用户名关键字</string>
<string name="pref_donate_title">捐赠</string>
<string name="pref_title_alipay">支付宝</string>
<string name="pref_title_debug_mode">调试模式</string>

<string name="restart_weibo">配置已保存,强行停止微博或重启设备后生效</string>
<string name="module_not_enabled">无法正常调用Xposed框架的功能,请确认Xposed已经加载且此模块已启用。如果问题仍然存在,请尝试禁用并重新启用此模块。</string>
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/xml/pref_general.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
android:defaultValue="false"
android:key="disable_new_message_flow"
android:title="@string/pref_title_disable_new_message_flow"/>

<android.support.v7.preference.SwitchPreferenceCompat
android:defaultValue="false"
android:key="debug_mode"
android:title="@string/pref_title_debug_mode"/>
</android.support.v7.preference.PreferenceCategory>

<android.support.v7.preference.PreferenceCategory
Expand Down

0 comments on commit cf75de4

Please sign in to comment.