Skip to content

Commit

Permalink
chore: sync
Browse files Browse the repository at this point in the history
  • Loading branch information
anddea committed Jun 23, 2024
1 parent 1914317 commit 5c7a132
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions api/revanced-patches.api
Original file line number Diff line number Diff line change
Expand Up @@ -1670,6 +1670,7 @@ public final class app/revanced/patches/youtube/utils/settings/ResourceUtils {
public final fun addEntryValues (Lapp/revanced/patcher/data/ResourceContext;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
public final fun addPreference (Lapp/revanced/patcher/data/ResourceContext;[Ljava/lang/String;)V
public final fun addPreferenceFragment (Lapp/revanced/patcher/data/ResourceContext;Ljava/lang/String;Ljava/lang/String;)V
public final fun getIconType ()Ljava/lang/String;
public final fun getYoutubePackageName ()Ljava/lang/String;
public final fun setYoutubePackageName (Ljava/lang/String;)V
public final fun updatePackageName (Lapp/revanced/patcher/data/ResourceContext;Ljava/lang/String;Ljava/lang/String;)V
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ object ResourceUtils {

var youtubePackageName = "com.google.android.youtube"

private var iconType = "default"
fun getIconType() = iconType

fun ResourceContext.updatePackageName(
fromPackageName: String,
toPackageName: String
Expand Down Expand Up @@ -72,6 +75,7 @@ object ResourceUtils {
}

fun ResourceContext.updatePatchStatusIcon(iconName: String) {
iconType = iconName
updatePatchStatusSettings("Icon", "@string/revanced_icon_$iconName")
}

Expand Down Expand Up @@ -111,7 +115,8 @@ object ResourceUtils {
doRecursively loop@{ node ->
if (node !is Element) return@loop // Skip if not an element

val attributeNode = node.getAttributeNode("android:key") ?: return@loop // Skip if no key attribute
val attributeNode = node.getAttributeNode("android:key")
?: return@loop // Skip if no key attribute
val currentKey = attributeNode.textContent

// Check if the current key has already been processed
Expand All @@ -128,14 +133,18 @@ object ResourceUtils {
setAttribute("android:title", "@string/${key}_title")
this.appendChild(
ownerDocument.createElement("intent").also { intentNode ->
intentNode.setAttribute("android:targetPackage", youtubePackageName)
intentNode.setAttribute(
"android:targetPackage",
youtubePackageName
)
intentNode.setAttribute("android:data", key + "_intent")
intentNode.setAttribute("android:targetClass", targetClass)
}
)
}
node.setAttribute("app:iconSpaceReserved", "true")
}

"true" -> {
attributeNode.textContent = "false"
}
Expand All @@ -144,4 +153,4 @@ object ResourceUtils {
}
}
}
}
}

0 comments on commit 5c7a132

Please sign in to comment.