feat: Modernize restart app logic (#3343)
This commit is contained in:
parent
c73df2527c
commit
3897647321
|
@ -25,18 +25,6 @@ abstract class AbstractSettingsResourcePatch(
|
||||||
private val sourceDirectory: String,
|
private val sourceDirectory: String,
|
||||||
) : ResourcePatch(), Closeable {
|
) : ResourcePatch(), Closeable {
|
||||||
override fun execute(context: ResourceContext) {
|
override fun execute(context: ResourceContext) {
|
||||||
/*
|
|
||||||
* used for self-restart
|
|
||||||
* TODO: do this only, when necessary
|
|
||||||
*/
|
|
||||||
context.xmlEditor["AndroidManifest.xml"].use { editor ->
|
|
||||||
editor.file.getElementsByTagName("manifest").item(0).also {
|
|
||||||
it.appendChild(it.ownerDocument.createElement("uses-permission").also { element ->
|
|
||||||
element.setAttribute("android:name", "android.permission.SCHEDULE_EXACT_ALARM")
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* copy preference template from source dir */
|
/* copy preference template from source dir */
|
||||||
context.copyResources(
|
context.copyResources(
|
||||||
sourceDirectory,
|
sourceDirectory,
|
||||||
|
|
|
@ -111,7 +111,6 @@ object SettingsPatch : BytecodePatch(
|
||||||
addString("revanced_settings", "ReVanced Settings", false)
|
addString("revanced_settings", "ReVanced Settings", false)
|
||||||
addString("revanced_reboot_message", "Twitch needs to restart to apply your changes. Restart now?", false)
|
addString("revanced_reboot_message", "Twitch needs to restart to apply your changes. Restart now?", false)
|
||||||
addString("revanced_reboot", "Restart", false)
|
addString("revanced_reboot", "Restart", false)
|
||||||
addString("revanced_cancel", "Cancel", false)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addString(identifier: String, value: String, formatted: Boolean = true) =
|
fun addString(identifier: String, value: String, formatted: Boolean = true) =
|
||||||
|
|
Loading…
Reference in a new issue