2023-09-20 05:33:02 +02:00
|
|
|
package app.revanced.patches.youtube.layout.returnyoutubedislike
|
2022-08-22 01:59:43 +02:00
|
|
|
|
2022-10-05 04:03:10 +02:00
|
|
|
import app.revanced.patcher.data.ResourceContext
|
|
|
|
import app.revanced.patcher.patch.ResourcePatch
|
2023-09-20 05:33:02 +02:00
|
|
|
import app.revanced.patcher.patch.annotation.Patch
|
|
|
|
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
|
2022-12-10 12:53:40 +01:00
|
|
|
import app.revanced.patches.shared.settings.preference.impl.Preference
|
|
|
|
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
2023-09-20 05:33:02 +02:00
|
|
|
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
2022-12-10 12:53:40 +01:00
|
|
|
import app.revanced.util.resources.ResourceUtils.mergeStrings
|
2022-08-22 01:59:43 +02:00
|
|
|
|
2023-09-20 05:33:02 +02:00
|
|
|
@Patch(
|
|
|
|
dependencies = [SettingsPatch::class]
|
|
|
|
)
|
|
|
|
object ReturnYouTubeDislikeResourcePatch : ResourcePatch() {
|
|
|
|
internal var oldUIDislikeId: Long = -1
|
2023-04-30 21:41:29 +02:00
|
|
|
|
2023-08-27 21:40:49 +02:00
|
|
|
override fun execute(context: ResourceContext) {
|
2022-08-22 01:59:43 +02:00
|
|
|
SettingsPatch.addPreference(
|
|
|
|
Preference(
|
|
|
|
StringResource("revanced_ryd_settings_title", "Return YouTube Dislike"),
|
2023-05-15 09:51:43 +02:00
|
|
|
StringResource("revanced_ryd_settings_summary", "Settings for Return YouTube Dislike"),
|
2023-05-19 22:45:12 +02:00
|
|
|
SettingsPatch.createReVancedSettingsIntent("ryd_settings")
|
2022-08-22 01:59:43 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
// merge strings
|
2022-10-05 04:03:10 +02:00
|
|
|
context.mergeStrings("returnyoutubedislike/host/values/strings.xml")
|
2022-08-22 01:59:43 +02:00
|
|
|
|
2023-04-30 21:41:29 +02:00
|
|
|
oldUIDislikeId = ResourceMappingPatch.resourceMappings.single {
|
|
|
|
it.type == "id" && it.name == "dislike_button"
|
|
|
|
}.id
|
2022-08-22 01:59:43 +02:00
|
|
|
}
|
|
|
|
}
|