Skip to content

Commit

Permalink
feat(YouTube - Navigation bar components): Bring back`Enable transluc…
Browse files Browse the repository at this point in the history
…ent navigation bar` setting
  • Loading branch information
anddea committed Dec 23, 2024
1 parent fed8915 commit 158f8da
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,10 @@ public static boolean useTranslucentNavigationStatusBar(boolean original) {
return original;
}

public static boolean enableTranslucentNavigationBar() {
return Settings.ENABLE_TRANSLUCENT_NAVIGATION_BAR.get();
}

private static final Boolean DISABLE_TRANSLUCENT_NAVIGATION_BAR_LIGHT
= Settings.DISABLE_TRANSLUCENT_NAVIGATION_BAR_LIGHT.get();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ public class Settings extends BaseSettings {
public static final BooleanSetting HIDE_NAVIGATION_SUBSCRIPTIONS_BUTTON = new BooleanSetting("revanced_hide_navigation_subscriptions_button", FALSE, true);
public static final BooleanSetting HIDE_NAVIGATION_LABEL = new BooleanSetting("revanced_hide_navigation_label", FALSE, true);
public static final BooleanSetting SWITCH_CREATE_WITH_NOTIFICATIONS_BUTTON = new BooleanSetting("revanced_switch_create_with_notifications_button", TRUE, true, "revanced_switch_create_with_notifications_button_user_dialog_message");
public static final BooleanSetting ENABLE_TRANSLUCENT_NAVIGATION_BAR = new BooleanSetting("revanced_enable_translucent_navigation_bar", FALSE, true);
public static final BooleanSetting DISABLE_TRANSLUCENT_NAVIGATION_BAR_LIGHT = new BooleanSetting("revanced_disable_translucent_navigation_bar_light", FALSE, true);
public static final BooleanSetting DISABLE_TRANSLUCENT_NAVIGATION_BAR_DARK = new BooleanSetting("revanced_disable_translucent_navigation_bar_dark", FALSE, true);
public static final BooleanSetting HIDE_NAVIGATION_BAR = new BooleanSetting("revanced_hide_navigation_bar", FALSE, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ private static void NavigationPreferenceLinks() {
);
enableDisablePreferences(
!isSDKAbove(33),
Settings.ENABLE_TRANSLUCENT_NAVIGATION_BAR,
Settings.DISABLE_TRANSLUCENT_NAVIGATION_BAR_LIGHT,
Settings.DISABLE_TRANSLUCENT_NAVIGATION_BAR_DARK
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ internal val setEnumMapFingerprint = legacyFingerprint(
literals = listOf(ytFillBell),
)

internal val translucentNavigationBarFingerprint = legacyFingerprint(
name = "translucentNavigationBarFingerprint",
literals = listOf(45630927L),
)

internal const val TRANSLUCENT_NAVIGATION_STATUS_BAR_FEATURE_FLAG = 45400535L

internal val translucentNavigationStatusBarFeatureFlagFingerprint = legacyFingerprint(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import app.revanced.patches.youtube.utils.navigation.addBottomBarContainerHook
import app.revanced.patches.youtube.utils.navigation.hookNavigationButtonCreated
import app.revanced.patches.youtube.utils.navigation.navigationBarHookPatch
import app.revanced.patches.youtube.utils.patch.PatchList.NAVIGATION_BAR_COMPONENTS
import app.revanced.patches.youtube.utils.playservice.is_19_23_or_greater
import app.revanced.patches.youtube.utils.playservice.is_19_25_or_greater
import app.revanced.patches.youtube.utils.playservice.is_19_28_or_greater
import app.revanced.patches.youtube.utils.playservice.versionCheckPatch
Expand Down Expand Up @@ -84,6 +85,15 @@ val navigationBarComponentsPatch = bytecodePatch(

// region patch for enable translucent navigation bar

if (is_19_23_or_greater) {
translucentNavigationBarFingerprint.injectLiteralInstructionBooleanCall(
45630927L,
"$GENERAL_CLASS_DESCRIPTOR->enableTranslucentNavigationBar()Z"
)

settingArray += "SETTINGS: TRANSLUCENT_NAVIGATION_BAR"
}

if (is_19_25_or_greater) {
arrayOf(
Triple(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
<PreferenceCategory android:title="@string/revanced_preference_category_experimental_flag" android:layout="@layout/revanced_settings_preferences_category"/>SETTINGS: HIDE_NAVIGATION_COMPONENTS -->

<!-- SETTINGS: TRANSLUCENT_NAVIGATION_BAR
<SwitchPreference android:title="@string/revanced_enable_translucent_navigation_bar_title" android:key="revanced_enable_translucent_navigation_bar" android:summaryOn="@string/revanced_enable_translucent_navigation_bar_summary_on" android:summaryOff="@string/revanced_enable_translucent_navigation_bar_summary_off" />
<SwitchPreference android:title="@string/revanced_disable_translucent_navigation_bar_light_title" android:key="revanced_disable_translucent_navigation_bar_light" android:summaryOn="@string/revanced_disable_translucent_navigation_bar_light_summary_on" android:summaryOff="@string/revanced_disable_translucent_navigation_bar_light_summary_off" />
<SwitchPreference android:title="@string/revanced_disable_translucent_navigation_bar_dark_title" android:key="revanced_disable_translucent_navigation_bar_dark" android:summaryOn="@string/revanced_disable_translucent_navigation_bar_dark_summary_on" android:summaryOff="@string/revanced_disable_translucent_navigation_bar_dark_summary_off" />SETTINGS: TRANSLUCENT_NAVIGATION_BAR -->

Expand Down

0 comments on commit 158f8da

Please sign in to comment.