feat(YouTube - Settings): Add App name, App version and Patched date to patch information

This commit is contained in:
inotia00 2025-03-31 21:16:29 +09:00
parent 56b713b0db
commit 5162dccecc
7 changed files with 57 additions and 21 deletions

View File

@ -9,6 +9,11 @@ public class PatchStatus {
return false;
}
// Modified by a patch. Do not touch.
public static boolean OldSeekbarThumbnailsDefaultBoolean() {
return false;
}
public static boolean OldSplashAnimation() {
// Replace this with true if the Restore old splash animation (Custom branding icon) succeeds
return false;
@ -40,23 +45,22 @@ public class PatchStatus {
return false;
}
public static String SpoofAppVersionDefaultString() {
return "18.17.43";
}
public static boolean ToolBarComponents() {
// Replace this with true if the Toolbar components patch succeeds
return false;
}
public static long PatchedTime() {
return 0L;
}
public static String SpoofAppVersionDefaultString() {
return "18.17.43";
}
// Modified by a patch. Do not touch.
public static String RVXMusicPackageName() {
return "com.google.android.apps.youtube.music";
}
// Modified by a patch. Do not touch.
public static boolean OldSeekbarThumbnailsDefaultBoolean() {
return false;
}
}

View File

@ -6,6 +6,8 @@ import static app.revanced.extension.shared.utils.Utils.isSDKAbove;
import android.preference.Preference;
import android.preference.SwitchPreference;
import java.util.Date;
import app.revanced.extension.shared.settings.Setting;
import app.revanced.extension.youtube.patches.general.ChangeFormFactorPatch;
import app.revanced.extension.youtube.patches.utils.PatchStatus;
@ -44,6 +46,7 @@ public class ReVancedSettingsPreference extends ReVancedPreferenceFragment {
AmbientModePreferenceLinks();
FullScreenPanelPreferenceLinks();
NavigationPreferenceLinks();
PatchInformationPreferenceLinks();
RYDPreferenceLinks();
SeekBarPreferenceLinks();
ShortsPreferenceLinks();
@ -143,6 +146,26 @@ public class ReVancedSettingsPreference extends ReVancedPreferenceFragment {
);
}
/**
* Set patch information preference summary
*/
private static void PatchInformationPreferenceLinks() {
Preference appNamePreference = mPreferenceManager.findPreference("revanced_app_name");
if (appNamePreference != null) {
appNamePreference.setSummary(ExtendedUtils.getAppLabel());
}
Preference appVersionPreference = mPreferenceManager.findPreference("revanced_app_version");
if (appVersionPreference != null) {
appVersionPreference.setSummary(ExtendedUtils.getAppVersionName());
}
Preference patchedDatePreference = mPreferenceManager.findPreference("revanced_patched_date");
if (patchedDatePreference != null) {
long patchedTime = PatchStatus.PatchedTime();
Date date = new Date(patchedTime);
patchedDatePreference.setSummary(date.toLocaleString());
}
}
/**
* Enable/Disable Preference related to RYD settings
*/

View File

@ -4,7 +4,6 @@ import app.revanced.patcher.patch.resourcePatch
import app.revanced.patcher.patch.stringOption
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
import app.revanced.patches.youtube.utils.patch.PatchList.CUSTOM_BRANDING_NAME_FOR_YOUTUBE
import app.revanced.patches.youtube.utils.settings.ResourceUtils.updatePatchStatusLabel
import app.revanced.patches.youtube.utils.settings.settingsPatch
import app.revanced.util.removeStringsElements
import app.revanced.util.valueOrThrow
@ -53,7 +52,5 @@ val customBrandingNamePatch = resourcePatch(
.appendChild(stringElement)
}
updatePatchStatusLabel(appName)
}
}

View File

@ -88,9 +88,6 @@ internal object ResourceUtils {
updatePatchStatusSettings("Icon", "@string/revanced_icon_$iconName")
}
fun updatePatchStatusLabel(appName: String) =
updatePatchStatusSettings("Label", appName)
fun updatePatchStatusTheme(themeName: String) =
updatePatchStatusSettings("Theme", themeName)

View File

@ -1,15 +1,18 @@
package app.revanced.patches.youtube.utils.settings
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatchContext
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patcher.patch.resourcePatch
import app.revanced.patcher.patch.stringOption
import app.revanced.patcher.util.proxy.mutableTypes.encodedValue.MutableLongEncodedValue
import app.revanced.patches.shared.extension.Constants.EXTENSION_UTILS_CLASS_DESCRIPTOR
import app.revanced.patches.shared.extension.Constants.EXTENSION_UTILS_PATH
import app.revanced.patches.shared.mainactivity.injectConstructorMethodCall
import app.revanced.patches.shared.mainactivity.injectOnCreateMethodCall
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
import app.revanced.patches.youtube.utils.extension.Constants.PATCH_STATUS_CLASS_DESCRIPTOR
import app.revanced.patches.youtube.utils.extension.Constants.UTILS_PATH
import app.revanced.patches.youtube.utils.extension.sharedExtensionPatch
import app.revanced.patches.youtube.utils.fix.attributes.themeAttributesPatch
@ -25,11 +28,13 @@ import app.revanced.util.addInstructionsAtControlFlowLabel
import app.revanced.util.copyResources
import app.revanced.util.copyXmlNode
import app.revanced.util.findInstructionIndicesReversedOrThrow
import app.revanced.util.findMethodOrThrow
import app.revanced.util.fingerprint.methodOrThrow
import app.revanced.util.removeStringsElements
import app.revanced.util.valueOrThrow
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import com.android.tools.smali.dexlib2.immutable.value.ImmutableLongEncodedValue
import org.w3c.dom.Element
import java.nio.file.Files
import java.util.jar.Manifest
@ -81,6 +86,13 @@ private val settingsBytecodePatch = bytecodePatch(
EXTENSION_UTILS_CLASS_DESCRIPTOR,
"setActivity"
)
findMethodOrThrow(PATCH_STATUS_CLASS_DESCRIPTOR) {
name == "PatchedTime"
}.replaceInstruction(
0,
"const-wide v0, ${MutableLongEncodedValue(ImmutableLongEncodedValue(System.currentTimeMillis()))}L"
)
}
}

View File

@ -2303,8 +2303,11 @@ Click to see more information."</string>
<string name="revanced_preference_screen_patch_information_title">Patch information</string>
<string name="revanced_preference_screen_patch_information_summary">Information about applied patches.</string>
<!-- PreferenceScreen: Miscellaneous, PreferenceCategory: Miscellaneous, PreferenceScreen: Patch information, PreferenceCategory: Tool used -->
<string name="revanced_preference_category_tool_used">Tool used</string>
<!-- PreferenceScreen: Miscellaneous, PreferenceCategory: Miscellaneous, PreferenceScreen: Patch information, PreferenceCategory: App info -->
<string name="revanced_preference_category_app_info">App info</string>
<string name="revanced_app_name_title">App name</string>
<string name="revanced_app_version_title">App version</string>
<string name="revanced_patched_date_title">Patched date</string>
<!-- PreferenceScreen: Miscellaneous, PreferenceCategory: Miscellaneous, PreferenceScreen: Patch information, PreferenceCategory: Others -->
<string name="revanced_preference_category_others">Others</string>
@ -2316,7 +2319,6 @@ Click to see more information."</string>
<string name="revanced_icon_revancify_blue">Revancify Blue</string>
<string name="revanced_icon_revancify_red">Revancify Red</string>
<string name="revanced_icon_youtube">YouTube</string>
<string name="revanced_label_default">Stock</string>
<string name="revanced_patches_excluded">Excluded</string>
<string name="revanced_patches_included">Included</string>
<string name="revanced_theme_default">Stock</string>

View File

@ -912,10 +912,12 @@
<PreferenceCategory android:title="@string/revanced_preference_category_patch_information" android:layout="@layout/revanced_settings_preferences_category"/>
<PreferenceScreen android:title="@string/revanced_preference_screen_patch_information_title" android:key="revanced_preference_screen_patch_information" android:summary="@string/revanced_preference_screen_patch_information_summary" >
<PreferenceCategory android:title="@string/revanced_preference_category_tool_used" android:layout="@layout/revanced_settings_preferences_category" >
<PreferenceCategory android:title="@string/revanced_preference_category_app_info" android:layout="@layout/revanced_settings_preferences_category" >
<Preference android:title="@string/revanced_app_name_title" android:key="revanced_app_name" android:selectable="false" />
<Preference android:title="@string/revanced_app_version_title" android:key="revanced_app_version" android:selectable="false" />
<Preference android:title="ReVanced Patches" android:selectable="false" android:summary="" />
<Preference android:title="@string/revanced_patched_date_title" android:key="revanced_patched_date" android:selectable="false" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/revanced_preference_screen_ads_title" android:layout="@layout/revanced_settings_preferences_category">
<Preference android:title="Hide ads" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
</PreferenceCategory>
@ -999,7 +1001,6 @@
<Preference android:title="Hide Shorts dimming" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Hide shortcuts" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Icon" android:summary="@string/revanced_icon_default" android:selectable="false"/>
<Preference android:title="Label" android:summary="@string/revanced_label_default" android:selectable="false"/>
<Preference android:title="Return YouTube Dislike" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Return YouTube Username" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="SponsorBlock" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>