refactor(YouTube - Check watch history domain name resolution): Do not show redundant dialog cancel button

This commit is contained in:
LisoUseInAIKyrios
2025-09-30 12:11:06 +04:00
parent 328c9b6bbe
commit 6961babee9
@@ -46,7 +46,7 @@ public class CheckWatchHistoryDomainNameResolutionPatch {
/** /**
* Injection point. * Injection point.
* *
* Checks if s.youtube.com is blacklisted and playback history will fail to work. * Checks if YouTube watch history endpoint cannot be reached.
*/ */
public static void checkDnsResolver(Activity context) { public static void checkDnsResolver(Activity context) {
if (!Utils.isNetworkConnected() || !BaseSettings.CHECK_WATCH_HISTORY_DOMAIN_NAME.get()) return; if (!Utils.isNetworkConnected() || !BaseSettings.CHECK_WATCH_HISTORY_DOMAIN_NAME.get()) return;
@@ -67,8 +67,6 @@ public class CheckWatchHistoryDomainNameResolutionPatch {
} }
Utils.runOnMainThread(() -> { Utils.runOnMainThread(() -> {
try {
// Create the custom dialog.
Pair<Dialog, LinearLayout> dialogPair = CustomDialog.create( Pair<Dialog, LinearLayout> dialogPair = CustomDialog.create(
context, context,
str("revanced_check_watch_history_domain_name_dialog_title"), // Title. str("revanced_check_watch_history_domain_name_dialog_title"), // Title.
@@ -76,19 +74,13 @@ public class CheckWatchHistoryDomainNameResolutionPatch {
null, // No EditText. null, // No EditText.
null, // OK button text. null, // OK button text.
() -> {}, // OK button action (just dismiss). () -> {}, // OK button action (just dismiss).
() -> {}, // Cancel button action (just dismiss). null, // No cancel button.
str("revanced_check_watch_history_domain_name_dialog_ignore"), // Neutral button text. str("revanced_check_watch_history_domain_name_dialog_ignore"), // Neutral button text.
() -> BaseSettings.CHECK_WATCH_HISTORY_DOMAIN_NAME.save(false), // Neutral button action (Ignore). () -> BaseSettings.CHECK_WATCH_HISTORY_DOMAIN_NAME.save(false), // Neutral button action (Ignore).
true // Dismiss dialog on Neutral button click. true // Dismiss dialog on Neutral button click.
); );
// Show the dialog. Utils.showDialog(context, dialogPair.first, false, null);
Dialog dialog = dialogPair.first;
Utils.showDialog(context, dialog, false, null);
} catch (Exception ex) {
Logger.printException(() -> "checkDnsResolver dialog creation failure", ex);
}
}); });
} catch (Exception ex) { } catch (Exception ex) {
Logger.printException(() -> "checkDnsResolver failure", ex); Logger.printException(() -> "checkDnsResolver failure", ex);