mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-08 02:24:35 +02:00
feat(shared-resource-id) If the target resource ID is not found, empty index is returned instead of generating patch exception
This commit is contained in:
parent
1b5eb0561f
commit
6686088fc8
@ -1,7 +1,6 @@
|
||||
package app.revanced.patches.music.utils.resourceid.patch
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
|
||||
@ -37,7 +36,7 @@ class SharedResourceIdPatch : ResourcePatch {
|
||||
fun find(resourceType: ResourceType, resourceName: String) = ResourceMappingPatch
|
||||
.resourceMappings
|
||||
.find { it.type == resourceType.value && it.name == resourceName }?.id
|
||||
?: throw PatchException("Failed to find resource id : $resourceName")
|
||||
?: -1
|
||||
|
||||
ActionsContainer = find(ID, "actions_container")
|
||||
ButtonIconPaddingMedium = find(DIMEN, "button_icon_padding_medium")
|
||||
|
@ -1,7 +1,6 @@
|
||||
package app.revanced.patches.reddit.utils.resourceid.patch
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
|
||||
@ -19,7 +18,7 @@ class SharedResourceIdPatch : ResourcePatch {
|
||||
fun find(resourceType: ResourceType, resourceName: String) = ResourceMappingPatch
|
||||
.resourceMappings
|
||||
.find { it.type == resourceType.value && it.name == resourceName }?.id
|
||||
?: throw PatchException("Failed to find resource id : $resourceName")
|
||||
?: -1
|
||||
|
||||
ScreenShotShareBanner = find(STRING, "screenshot_share_banner_title")
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package app.revanced.patches.youtube.utils.resourceid.patch
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
|
||||
@ -89,7 +88,7 @@ class SharedResourceIdPatch : ResourcePatch {
|
||||
fun find(resourceType: ResourceType, resourceName: String) = ResourceMappingPatch
|
||||
.resourceMappings
|
||||
.find { it.type == resourceType.value && it.name == resourceName }?.id
|
||||
?: throw PatchException("Failed to find resource id : $resourceName")
|
||||
?: -1
|
||||
|
||||
AccountSwitcherAccessibility = find(STRING, "account_switcher_accessibility_label")
|
||||
AccessibilityCaptionsButtonName = find(STRING, "accessibility_captions_button_name")
|
||||
|
Loading…
x
Reference in New Issue
Block a user