Skip to content

Commit

Permalink
fix: revert removing getAppContext()
Browse files Browse the repository at this point in the history
This reverts commit a061614.
  • Loading branch information
oSumAtrIX committed Oct 22, 2022
1 parent a061614 commit 0be0ffd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import android.preference.PreferenceScreen;
import android.preference.SwitchPreference;

import com.google.android.apps.youtube.app.YouTubeTikTokRoot_Application;
import com.google.android.apps.youtube.app.application.Shell_HomeActivity;

import java.util.List;
Expand Down Expand Up @@ -173,7 +174,7 @@ private void setCopyLinkListPreferenceData(ListPreference listPreference, String
*/

private String getPackageName() {
Context context = ReVancedUtils.getContext();
Context context = YouTubeTikTokRoot_Application.getAppContext();
if (context == null) {
LogHelper.printException(ReVancedSettingsFragment.class, "Context is null, returning com.google.android.youtube!");
return "com.google.android.youtube";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import android.os.Handler;
import android.os.Looper;

import com.google.android.apps.youtube.app.YouTubeTikTokRoot_Application;

import app.revanced.integrations.sponsorblock.player.PlayerType;

public class ReVancedUtils {
Expand All @@ -15,6 +17,13 @@ public class ReVancedUtils {
//Used by Integrations patch
public static Context context;
//Used by Integrations patch
public static Context getAppContext() {
if (context != null) {
return context;
}
LogHelper.printException(ReVancedUtils.class, "Context is null!");
return null;
}

public static void setNewVideo(boolean started) {
LogHelper.debug(ReVancedUtils.class, "New video started: " + started);
Expand Down Expand Up @@ -52,6 +61,7 @@ public static void runOnMainThread(Runnable runnable) {
}

public static Context getContext() {
Context context = YouTubeTikTokRoot_Application.getAppContext();
if (context != null) {
return context;
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.google.android.apps.youtube.app;

import android.app.Application;
import android.content.Context;

public class YouTubeTikTokRoot_Application extends Application {
public static Context getAppContext() {
return null;
}
}

0 comments on commit 0be0ffd

Please sign in to comment.