2023-09-20 05:33:02 +02:00
|
|
|
package app.revanced.patches.youtube.misc.debugging
|
2022-07-04 18:10:49 +02:00
|
|
|
|
2022-10-05 04:03:10 +02:00
|
|
|
import app.revanced.patcher.data.ResourceContext
|
2023-04-24 03:12:09 +02:00
|
|
|
import app.revanced.patcher.patch.ResourcePatch
|
2023-09-20 05:33:02 +02:00
|
|
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
|
|
|
import app.revanced.patcher.patch.annotation.Patch
|
2022-12-05 06:34:01 +01:00
|
|
|
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
|
|
|
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
2023-09-20 05:33:02 +02:00
|
|
|
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
|
|
|
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
2022-07-04 18:10:49 +02:00
|
|
|
|
2023-09-20 05:33:02 +02:00
|
|
|
@Patch(
|
|
|
|
name = "Enable debugging",
|
|
|
|
description = "Adds debugging options.",
|
|
|
|
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
|
|
|
|
compatiblePackages = [CompatiblePackage("com.google.android.youtube")]
|
|
|
|
)
|
|
|
|
@Suppress("unused")
|
|
|
|
object DebuggingPatch : ResourcePatch() {
|
2023-08-27 21:40:49 +02:00
|
|
|
override fun execute(context: ResourceContext) {
|
2022-08-27 03:21:53 +02:00
|
|
|
SettingsPatch.PreferenceScreen.MISC.addPreferences(
|
2022-12-05 06:34:01 +01:00
|
|
|
app.revanced.patches.shared.settings.preference.impl.PreferenceScreen(
|
2023-05-15 09:51:43 +02:00
|
|
|
"revanced_debug_preference_screen",
|
|
|
|
StringResource("revanced_debug_preference_screen_title", "Debugging"),
|
2022-12-05 06:34:01 +01:00
|
|
|
listOf(
|
|
|
|
SwitchPreference(
|
2023-05-15 09:51:43 +02:00
|
|
|
"revanced_debug",
|
|
|
|
StringResource("revanced_debug_title", "Debug logging"),
|
2022-12-05 06:34:01 +01:00
|
|
|
StringResource("revanced_debug_summary_on", "Debug logs are enabled"),
|
|
|
|
StringResource("revanced_debug_summary_off", "Debug logs are disabled")
|
|
|
|
),
|
2023-08-27 21:40:49 +02:00
|
|
|
SwitchPreference(
|
|
|
|
"revanced_debug_protobuffer",
|
|
|
|
StringResource(
|
|
|
|
"revanced_debug_protobuffer_title",
|
|
|
|
"Log protocol buffer"
|
|
|
|
),
|
|
|
|
StringResource("revanced_debug_protobuffer_summary_on", "Debug logs include proto buffer"),
|
|
|
|
StringResource("revanced_debug_protobuffer_summary_off", "Debug logs do not include proto buffer")
|
|
|
|
),
|
2022-12-05 06:34:01 +01:00
|
|
|
SwitchPreference(
|
2023-05-15 09:51:43 +02:00
|
|
|
"revanced_debug_stacktrace",
|
2022-12-05 06:34:01 +01:00
|
|
|
StringResource(
|
2023-05-15 09:51:43 +02:00
|
|
|
"revanced_debug_stacktrace_title",
|
2023-01-28 08:38:39 +01:00
|
|
|
"Log stack traces"
|
2022-12-05 06:34:01 +01:00
|
|
|
),
|
2023-01-28 08:38:39 +01:00
|
|
|
StringResource("revanced_debug_stacktrace_summary_on", "Debug logs include stack trace"),
|
|
|
|
StringResource("revanced_debug_stacktrace_summary_off", "Debug logs do not include stack trace")
|
|
|
|
),
|
|
|
|
SwitchPreference(
|
2023-05-15 09:51:43 +02:00
|
|
|
"revanced_debug_toast_on_error",
|
2023-01-28 08:38:39 +01:00
|
|
|
StringResource(
|
2023-05-15 09:51:43 +02:00
|
|
|
"revanced_debug_toast_on_error_title",
|
2023-01-28 08:38:39 +01:00
|
|
|
"Show toast on ReVanced error"
|
|
|
|
),
|
|
|
|
StringResource("revanced_debug_toast_on_error_summary_on", "Toast shown if error occurs"),
|
2023-04-05 10:25:12 +02:00
|
|
|
StringResource("revanced_debug_toast_on_error_summary_off", "Toast not shown if error occurs"),
|
|
|
|
StringResource("revanced_debug_toast_on_error_user_dialog_message",
|
2023-05-15 09:51:43 +02:00
|
|
|
"Turning off error toasts hides all ReVanced error notifications."
|
2023-05-16 08:29:24 +02:00
|
|
|
+ "\\n\\nYou will not be notified of any unexpected events."
|
2023-04-05 10:25:12 +02:00
|
|
|
)
|
2022-12-05 06:34:01 +01:00
|
|
|
),
|
|
|
|
),
|
2023-05-15 09:51:43 +02:00
|
|
|
StringResource("revanced_debug_preference_screen_summary", "Enable or disable debugging options")
|
2022-08-27 03:21:53 +02:00
|
|
|
)
|
|
|
|
)
|
2022-07-04 18:10:49 +02:00
|
|
|
}
|
2022-07-08 06:30:59 +02:00
|
|
|
}
|