Skip to content

Commit b7f77a8

Browse files
Don't show custom branding patch finishing last
1 parent b10a762 commit b7f77a8

File tree

1 file changed

+35
-33
lines changed

1 file changed

+35
-33
lines changed

patches/src/main/kotlin/app/revanced/patches/shared/layout/branding/BaseCustomBrandingPatch.kt

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -165,43 +165,45 @@ internal fun baseCustomBrandingPatch(
165165
}
166166
}
167167
}
168-
}
169-
)
170-
171-
finalize {
172-
val useCustomName = customName != null
173-
val useCustomIcon = customIcon != null
168+
},
169+
resourcePatch {
170+
// Use a second resource patch so patching doesn't show custom branding finishing last.
171+
finalize {
172+
val useCustomName = customName != null
173+
val useCustomIcon = customIcon != null
174+
175+
if (setOrGetFallbackPackageName(originalAppPackageName) == originalAppPackageName) {
176+
if (useCustomName || useCustomIcon) {
177+
Logger.getLogger(this::class.java.name).warning(
178+
"Custom branding does not work with root installation. No changes applied."
179+
)
180+
}
181+
return@finalize
182+
}
174183

175-
if (setOrGetFallbackPackageName(originalAppPackageName) == originalAppPackageName) {
176-
if (useCustomName || useCustomIcon) {
177-
Logger.getLogger(this::class.java.name).warning(
178-
"Custom branding does not work with root installation. No changes applied."
184+
preferenceScreen.addPreferences(
185+
if (useCustomName) {
186+
ListPreference(
187+
key = "revanced_custom_branding_name",
188+
entriesKey = "revanced_custom_branding_name_custom_entries",
189+
entryValuesKey = "revanced_custom_branding_name_custom_entry_values"
190+
)
191+
} else {
192+
ListPreference("revanced_custom_branding_name")
193+
},
194+
if (useCustomIcon) {
195+
ListPreference(
196+
key = "revanced_custom_branding_icon",
197+
entriesKey = "revanced_custom_branding_icon_custom_entries",
198+
entryValuesKey = "revanced_custom_branding_icon_custom_entry_values"
199+
)
200+
} else {
201+
ListPreference("revanced_custom_branding_icon")
202+
}
179203
)
180204
}
181-
return@finalize
182205
}
183-
184-
preferenceScreen.addPreferences(
185-
if (useCustomName) {
186-
ListPreference(
187-
key = "revanced_custom_branding_name",
188-
entriesKey = "revanced_custom_branding_name_custom_entries",
189-
entryValuesKey = "revanced_custom_branding_name_custom_entry_values"
190-
)
191-
} else {
192-
ListPreference("revanced_custom_branding_name")
193-
},
194-
if (useCustomIcon) {
195-
ListPreference(
196-
key = "revanced_custom_branding_icon",
197-
entriesKey = "revanced_custom_branding_icon_custom_entries",
198-
entryValuesKey = "revanced_custom_branding_icon_custom_entry_values"
199-
)
200-
} else {
201-
ListPreference("revanced_custom_branding_icon")
202-
}
203-
)
204-
}
206+
)
205207

206208
execute {
207209
addResources("shared", "layout.branding.baseCustomBrandingPatch")

0 commit comments

Comments
 (0)