Added always shows "Reopen App" options in MainActivity

This commit is contained in:
2022-06-21 07:00:40 +08:00
parent 00af888e0e
commit f4d68ce9ec
11 changed files with 49 additions and 5 deletions

View File

@@ -56,8 +56,6 @@ Added more features to app's crash dialog, fixed custom rom deleted dialog, the
此项目依然在开发中,正在开发的功能如下
- 是否始终允许错误对话框显示“重新打开”按钮 (计划中)
## License
- [AGPL-3.0](https://www.gnu.org/licenses/agpl-3.0.html)

View File

@@ -28,5 +28,6 @@ object DataConst {
val ENABLE_HIDE_ICON = PrefsData("_hide_icon", false)
val ENABLE_ONLY_SHOW_ERRORS_IN_FRONT = PrefsData("_enable_only_show_errors_in_front", false)
val ENABLE_ONLY_SHOW_ERRORS_IN_MAIN = PrefsData("_enable_only_show_errors_in_main", false)
val ENABLE_ALWAYS_SHOWS_REOPEN_APP_OPTIONS = PrefsData("_enable_always_shows_reopen_app_options", false)
val ENABLE_APP_CONFIG_TEMPLATE = PrefsData("_enable_app_config_template", false)
}

View File

@@ -211,6 +211,9 @@ object FrameworkHooker : YukiBaseHooker() {
/** 崩溃标题 */
val errorTitle = if (isRepeating) LocaleString.aerrRepeatedTitle(appName) else LocaleString.aerrTitle(appName)
/** 是否始终显示重新打开按钮 */
val isAlwaysShowsReopenApp = prefs.get(DataConst.ENABLE_ALWAYS_SHOWS_REOPEN_APP_OPTIONS)
/** 打印错误日志 */
if (isApp) loggerE(
msg = "App \"$packageName\"${if (packageName != processName) " --process \"$processName\"" else ""}" +
@@ -257,7 +260,8 @@ object FrameworkHooker : YukiBaseHooker() {
appName = appName,
title = errorTitle,
isShowAppInfoButton = isApp,
isShowReopenButton = isApp && isRepeating.not() && context.isAppCanOpened(packageName) && isMainProcess,
isShowReopenButton = isApp && (isRepeating.not() || isAlwaysShowsReopenApp)
&& context.isAppCanOpened(packageName) && isMainProcess,
isShowCloseAppButton = isApp
)
)

View File

@@ -56,6 +56,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
LocaleString.systemVersion("${Build.VERSION.RELEASE} (API ${Build.VERSION.SDK_INT}) ${Build.DISPLAY}")
binding.onlyShowErrorsInFrontSwitch.isChecked = modulePrefs.get(DataConst.ENABLE_ONLY_SHOW_ERRORS_IN_FRONT)
binding.onlyShowErrorsInMainProcessSwitch.isChecked = modulePrefs.get(DataConst.ENABLE_ONLY_SHOW_ERRORS_IN_MAIN)
binding.alwaysShowsReopenAppOptionsSwitch.isChecked = modulePrefs.get(DataConst.ENABLE_ALWAYS_SHOWS_REOPEN_APP_OPTIONS)
binding.enableAppsConfigsTemplateSwitch.isChecked = modulePrefs.get(DataConst.ENABLE_APP_CONFIG_TEMPLATE)
binding.hideIconInLauncherSwitch.isChecked = modulePrefs.get(DataConst.ENABLE_HIDE_ICON)
binding.mgrAppsConfigsTemplateButton.isVisible = modulePrefs.get(DataConst.ENABLE_APP_CONFIG_TEMPLATE)
@@ -76,6 +77,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
if (btn.isPressed.not()) return@setOnCheckedChangeListener
modulePrefs.put(DataConst.ENABLE_ONLY_SHOW_ERRORS_IN_MAIN, b)
}
binding.alwaysShowsReopenAppOptionsSwitch.setOnCheckedChangeListener { btn, b ->
if (btn.isPressed.not()) return@setOnCheckedChangeListener
modulePrefs.put(DataConst.ENABLE_ALWAYS_SHOWS_REOPEN_APP_OPTIONS, b)
}
binding.enableAppsConfigsTemplateSwitch.setOnCheckedChangeListener { btn, b ->
if (btn.isPressed.not()) return@setOnCheckedChangeListener
binding.mgrAppsConfigsTemplateButton.isVisible = b

View File

@@ -251,6 +251,30 @@
android:textColor="@color/colorTextDark"
android:textSize="12sp" />
<com.fankes.apperrorstracking.ui.view.MaterialSwitch
android:id="@+id/always_shows_reopen_app_options_switch"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginBottom="5dp"
android:text="@string/errors_dialog_always_show_reopen"
android:textAllCaps="false"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginBottom="10dp"
android:alpha="0.6"
android:lineSpacingExtra="6dp"
android:text="@string/errors_dialog_always_show_reopen_tip"
android:textColor="@color/colorTextDark"
android:textSize="12sp" />
<com.fankes.apperrorstracking.ui.view.MaterialSwitch
android:id="@+id/enable_apps_configs_template_switch"
android:layout_width="match_parent"

View File

@@ -113,4 +113,6 @@
<string name="app_errors_tip">アプリは未処理のエラーで崩壊しました。クリックして、アプリ開発者への詳細またはフィードバックを表示します。</string>
<string name="batch_operations">一括操作</string>
<string name="are_you_sure_apply_site_apps">一度に %1$s 個のアプリに設定を適用してもよろしいですか</string>
<string name="errors_dialog_always_show_reopen">エラーダイアログには常にリスタートが表示</string>
<string name="errors_dialog_always_show_reopen_tip">有効にした後、アプリが最初のエラーでない場合にも「アプリをリスタート」オプションが表示されます。現在のエラーがメインプロセスでない場合、またはアプリを開くことができない場合でも、このオプションは表示されません。</string>
</resources>

View File

@@ -113,4 +113,6 @@
<string name="app_errors_tip">应用发生了未处理的异常而崩溃,点击查看详情或反馈给应用开发者。</string>
<string name="batch_operations">批量操作</string>
<string name="are_you_sure_apply_site_apps">你确定要一次性应用设置给 %1$s 个应用吗?</string>
<string name="errors_dialog_always_show_reopen">错误对话框始终显示“重新打开”选项</string>
<string name="errors_dialog_always_show_reopen_tip">启用后,在应用非首次异常时也将显示“重新打开”选项,若当前异常非主进程或应用无法打开则依然不会显示此选项。</string>
</resources>

View File

@@ -113,4 +113,6 @@
<string name="app_errors_tip">程式發生了未處理的異常而崩潰,點擊查看詳情或反饋給程式開發者。</string>
<string name="batch_operations">批量操作</string>
<string name="are_you_sure_apply_site_apps">你確認要一次性應用設置給 %1$s 個程式嗎?</string>
<string name="errors_dialog_always_show_reopen">錯誤對話框始終顯示“重新開啟”選項</string>
<string name="errors_dialog_always_show_reopen_tip">啟用後,在程式非首次異常時也將顯示“重新開啟”選項,若當前異常非主進程或程式無法打開則依然不會顯示此選項。</string>
</resources>

View File

@@ -113,4 +113,6 @@
<string name="app_errors_tip">程式發生了未處理的異常而崩潰,點擊查看詳情或反饋給程式開發者。</string>
<string name="batch_operations">批量操作</string>
<string name="are_you_sure_apply_site_apps">你確認要一次性應用設置給 %1$s 個程式嗎?</string>
<string name="errors_dialog_always_show_reopen">錯誤對話框始終顯示“重新開啟”選項</string>
<string name="errors_dialog_always_show_reopen_tip">啟用後,在程式非首次異常時也將顯示“重新開啟”選項,若當前異常非主進程或程式無法打開則依然不會顯示此選項。</string>
</resources>

View File

@@ -113,4 +113,6 @@
<string name="app_errors_tip">程式發生了未處理的異常而崩潰,點擊查看詳情或反饋給程式開發者。</string>
<string name="batch_operations">批量操作</string>
<string name="are_you_sure_apply_site_apps">你確認要一次性應用設置給 %1$s 個程式嗎?</string>
<string name="errors_dialog_always_show_reopen">錯誤對話框始終顯示“重新開啟”選項</string>
<string name="errors_dialog_always_show_reopen_tip">啟用後,在程式非首次異常時也將顯示“重新開啟”選項,若當前異常非主進程或程式無法打開則依然不會顯示此選項。</string>
</resources>

View File

@@ -72,8 +72,8 @@
<string name="share_error_stack">Share error stack</string>
<string name="preference_settings">Preference Settings</string>
<string name="function_mgr">Function Management</string>
<string name="only_show_errors_in_front">Show error dialogs only for foreground apps</string>
<string name="only_show_errors_in_main_process">Show error dialogs only for main process apps</string>
<string name="only_show_errors_in_front">Show error dialogs only foreground apps</string>
<string name="only_show_errors_in_main_process">Show error dialogs only main process apps</string>
<string name="enable_apps_config_template">Enable apps config template</string>
<string name="mgr_apps_config_template">Management apps config template</string>
<string name="view_errors_record">View app errors record</string>
@@ -113,4 +113,6 @@
<string name="app_errors_tip">App collapses an unprocessed abnormality. Click to view details or feedback to the App developer.</string>
<string name="batch_operations">Batch operations</string>
<string name="are_you_sure_apply_site_apps">Are you sure you want to apply settings to %1$s apps at once?</string>
<string name="errors_dialog_always_show_reopen">Error dialog always shows \"Reopen App\"</string>
<string name="errors_dialog_always_show_reopen_tip">After enabling, the \"Reopen App\" option will also be shows when the app is not errors for the first time. If the current errors is not the main process or the app cannot be opened, this option will still not be showing.</string>
</resources>