From a061614d8626ef21f9bcddf7b5faabec50b40c4b Mon Sep 17 00:00:00 2001 From: Canny <94744045+Canny1913@users.noreply.github.com> Date: Sat, 22 Oct 2022 13:44:26 +0300 Subject: [PATCH] refactor: remove getAppContext() (#180) --- .../settingsmenu/ReVancedSettingsFragment.java | 3 +-- .../app/revanced/integrations/utils/ReVancedUtils.java | 10 ---------- .../youtube/app/YouTubeTikTokRoot_Application.java | 10 ---------- 3 files changed, 1 insertion(+), 22 deletions(-) delete mode 100644 app/src/main/java/com/google/android/apps/youtube/app/YouTubeTikTokRoot_Application.java diff --git a/app/src/main/java/app/revanced/integrations/settingsmenu/ReVancedSettingsFragment.java b/app/src/main/java/app/revanced/integrations/settingsmenu/ReVancedSettingsFragment.java index 99d0b144..ca05cd8a 100644 --- a/app/src/main/java/app/revanced/integrations/settingsmenu/ReVancedSettingsFragment.java +++ b/app/src/main/java/app/revanced/integrations/settingsmenu/ReVancedSettingsFragment.java @@ -18,7 +18,6 @@ import android.preference.PreferenceFragment; 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; @@ -174,7 +173,7 @@ public class ReVancedSettingsFragment extends PreferenceFragment { */ private String getPackageName() { - Context context = YouTubeTikTokRoot_Application.getAppContext(); + Context context = ReVancedUtils.getContext(); if (context == null) { LogHelper.printException(ReVancedSettingsFragment.class, "Context is null, returning com.google.android.youtube!"); return "com.google.android.youtube"; diff --git a/app/src/main/java/app/revanced/integrations/utils/ReVancedUtils.java b/app/src/main/java/app/revanced/integrations/utils/ReVancedUtils.java index c58f16fa..f5ffb961 100644 --- a/app/src/main/java/app/revanced/integrations/utils/ReVancedUtils.java +++ b/app/src/main/java/app/revanced/integrations/utils/ReVancedUtils.java @@ -5,8 +5,6 @@ import android.content.res.Resources; 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 { @@ -17,13 +15,6 @@ 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); @@ -61,7 +52,6 @@ public class ReVancedUtils { } public static Context getContext() { - Context context = YouTubeTikTokRoot_Application.getAppContext(); if (context != null) { return context; } else { diff --git a/app/src/main/java/com/google/android/apps/youtube/app/YouTubeTikTokRoot_Application.java b/app/src/main/java/com/google/android/apps/youtube/app/YouTubeTikTokRoot_Application.java deleted file mode 100644 index 8da9aba8..00000000 --- a/app/src/main/java/com/google/android/apps/youtube/app/YouTubeTikTokRoot_Application.java +++ /dev/null @@ -1,10 +0,0 @@ -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; - } -}