fix(YouTube - Hide ads): Do not show error toast and hide full screen ads (#569)

This commit is contained in:
LisoUseInAIKyrios 2024-02-13 20:08:57 +04:00 committed by GitHub
parent b866036715
commit 0b0d46f518
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 2 deletions

View File

@ -14,7 +14,7 @@ import app.revanced.integrations.youtube.StringTrieSearch;
@SuppressWarnings("unused")
public final class AdsFilter extends Filter {
// region Fullscreen ad
private static long lastTimeClosedFullscreenAd = 0;
private static volatile long lastTimeClosedFullscreenAd;
private static final Instrumentation instrumentation = new Instrumentation();
private final StringFilterGroup fullscreenAd;
@ -168,6 +168,9 @@ public final class AdsFilter extends Filter {
Logger.printDebug(() -> "Closing fullscreen ad");
Utils.runOnMainThreadDelayed(() -> instrumentation.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK), 1000);
Utils.runOnMainThreadDelayed(() -> {
// Must run off main thread (Odd, but whatever).
Utils.runOnBackgroundThread(() -> instrumentation.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK));
}, 1000);
}
}