mirror of
https://github.com/revanced/revanced-patches
synced 2024-11-10 10:49:25 +01:00
refactor: move ResourceUtils.mergeStrings
to correct class
This commit is contained in:
parent
018606e983
commit
bb56037cda
@ -8,18 +8,14 @@ import app.revanced.patcher.patch.PatchResult
|
|||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.ResourcePatch
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
import app.revanced.patches.shared.settings.preference.impl.*
|
||||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
|
||||||
import app.revanced.patches.shared.settings.preference.impl.TextPreference
|
|
||||||
import app.revanced.patches.shared.settings.preference.impl.InputType
|
|
||||||
import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen
|
|
||||||
import app.revanced.patches.youtube.interaction.downloads.annotation.DownloadsCompatibility
|
import app.revanced.patches.youtube.interaction.downloads.annotation.DownloadsCompatibility
|
||||||
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||||
import app.revanced.patches.youtube.misc.playercontrols.resource.patch.BottomControlsResourcePatch
|
import app.revanced.patches.youtube.misc.playercontrols.resource.patch.BottomControlsResourcePatch
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
import app.revanced.util.resources.ResourceUtils
|
import app.revanced.util.resources.ResourceUtils
|
||||||
import app.revanced.util.resources.ResourceUtils.Settings.mergeStrings
|
|
||||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||||
|
import app.revanced.util.resources.ResourceUtils.mergeStrings
|
||||||
|
|
||||||
@Name("downloads-resource-patch")
|
@Name("downloads-resource-patch")
|
||||||
@DependsOn([BottomControlsResourcePatch::class, FixLocaleConfigErrorPatch::class, SettingsPatch::class])
|
@DependsOn([BottomControlsResourcePatch::class, FixLocaleConfigErrorPatch::class, SettingsPatch::class])
|
||||||
|
@ -8,12 +8,12 @@ import app.revanced.patcher.patch.PatchResult
|
|||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.ResourcePatch
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patches.shared.settings.preference.impl.Preference
|
||||||
|
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||||
import app.revanced.patches.youtube.layout.returnyoutubedislike.annotations.ReturnYouTubeDislikeCompatibility
|
import app.revanced.patches.youtube.layout.returnyoutubedislike.annotations.ReturnYouTubeDislikeCompatibility
|
||||||
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
import app.revanced.patches.shared.settings.preference.impl.Preference
|
import app.revanced.util.resources.ResourceUtils.mergeStrings
|
||||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
|
||||||
import app.revanced.util.resources.ResourceUtils.Settings.mergeStrings
|
|
||||||
|
|
||||||
@DependsOn([FixLocaleConfigErrorPatch::class, SettingsPatch::class])
|
@DependsOn([FixLocaleConfigErrorPatch::class, SettingsPatch::class])
|
||||||
@Name("return-youtube-dislike-resource-patch")
|
@Name("return-youtube-dislike-resource-patch")
|
||||||
|
@ -7,16 +7,16 @@ import app.revanced.patcher.patch.PatchResult
|
|||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.ResourcePatch
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlockCompatibility
|
|
||||||
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
|
||||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
|
||||||
import app.revanced.patches.shared.settings.preference.impl.Preference
|
import app.revanced.patches.shared.settings.preference.impl.Preference
|
||||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||||
|
import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlockCompatibility
|
||||||
|
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
import app.revanced.util.resources.ResourceUtils
|
import app.revanced.util.resources.ResourceUtils
|
||||||
import app.revanced.util.resources.ResourceUtils.Settings.mergeStrings
|
|
||||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||||
import app.revanced.util.resources.ResourceUtils.copyXmlNode
|
import app.revanced.util.resources.ResourceUtils.copyXmlNode
|
||||||
|
import app.revanced.util.resources.ResourceUtils.mergeStrings
|
||||||
|
|
||||||
@Name("sponsorblock-resource-patch")
|
@Name("sponsorblock-resource-patch")
|
||||||
@SponsorBlockCompatibility
|
@SponsorBlockCompatibility
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package app.revanced.util.microg
|
package app.revanced.util.microg
|
||||||
|
|
||||||
import app.revanced.patcher.data.ResourceContext
|
import app.revanced.patcher.data.ResourceContext
|
||||||
import app.revanced.util.resources.ResourceUtils.Settings.mergeStrings
|
import app.revanced.util.resources.ResourceUtils.mergeStrings
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper class for applying resource patches needed for the microg-support patches.
|
* Helper class for applying resource patches needed for the microg-support patches.
|
||||||
|
@ -2,8 +2,8 @@ package app.revanced.util.resources
|
|||||||
|
|
||||||
import app.revanced.patcher.data.DomFileEditor
|
import app.revanced.patcher.data.DomFileEditor
|
||||||
import app.revanced.patcher.data.ResourceContext
|
import app.revanced.patcher.data.ResourceContext
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
|
||||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||||
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
import org.w3c.dom.Node
|
import org.w3c.dom.Node
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import java.nio.file.StandardCopyOption
|
import java.nio.file.StandardCopyOption
|
||||||
@ -11,11 +11,7 @@ import java.nio.file.StandardCopyOption
|
|||||||
internal object ResourceUtils {
|
internal object ResourceUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings related utilities
|
* Merge strings. This manages [StringResource]s automatically.
|
||||||
*/
|
|
||||||
internal object Settings {
|
|
||||||
/**
|
|
||||||
* Merge strings. This handles [StringResource]s automatically.
|
|
||||||
* @param host The hosting xml resource. Needs to be a valid strings.xml resource.
|
* @param host The hosting xml resource. Needs to be a valid strings.xml resource.
|
||||||
*/
|
*/
|
||||||
internal fun ResourceContext.mergeStrings(host: String) {
|
internal fun ResourceContext.mergeStrings(host: String) {
|
||||||
@ -32,7 +28,6 @@ internal object ResourceUtils {
|
|||||||
SettingsPatch.addString(key, value, formatted)
|
SettingsPatch.addString(key, value, formatted)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy resources from the current class loader to the resource directory.
|
* Copy resources from the current class loader to the resource directory.
|
||||||
|
Loading…
Reference in New Issue
Block a user