Skip to content

Commit 6961bab

Browse files
refactor(YouTube - Check watch history domain name resolution): Do not show redundant dialog cancel button
1 parent 328c9b6 commit 6961bab

File tree

1 file changed

+14
-22
lines changed

1 file changed

+14
-22
lines changed

extensions/shared/library/src/main/java/app/revanced/extension/shared/patches/CheckWatchHistoryDomainNameResolutionPatch.java

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ private static boolean domainResolvesToValidIP(String host) {
4646
/**
4747
* Injection point.
4848
*
49-
* Checks if s.youtube.com is blacklisted and playback history will fail to work.
49+
* Checks if YouTube watch history endpoint cannot be reached.
5050
*/
5151
public static void checkDnsResolver(Activity context) {
5252
if (!Utils.isNetworkConnected() || !BaseSettings.CHECK_WATCH_HISTORY_DOMAIN_NAME.get()) return;
@@ -67,28 +67,20 @@ public static void checkDnsResolver(Activity context) {
6767
}
6868

6969
Utils.runOnMainThread(() -> {
70-
try {
71-
// Create the custom dialog.
72-
Pair<Dialog, LinearLayout> dialogPair = CustomDialog.create(
73-
context,
74-
str("revanced_check_watch_history_domain_name_dialog_title"), // Title.
75-
Html.fromHtml(str("revanced_check_watch_history_domain_name_dialog_message")), // Message (HTML).
76-
null, // No EditText.
77-
null, // OK button text.
78-
() -> {}, // OK button action (just dismiss).
79-
() -> {}, // Cancel button action (just dismiss).
80-
str("revanced_check_watch_history_domain_name_dialog_ignore"), // Neutral button text.
81-
() -> BaseSettings.CHECK_WATCH_HISTORY_DOMAIN_NAME.save(false), // Neutral button action (Ignore).
82-
true // Dismiss dialog on Neutral button click.
83-
);
70+
Pair<Dialog, LinearLayout> dialogPair = CustomDialog.create(
71+
context,
72+
str("revanced_check_watch_history_domain_name_dialog_title"), // Title.
73+
Html.fromHtml(str("revanced_check_watch_history_domain_name_dialog_message")), // Message (HTML).
74+
null, // No EditText.
75+
null, // OK button text.
76+
() -> {}, // OK button action (just dismiss).
77+
null, // No cancel button.
78+
str("revanced_check_watch_history_domain_name_dialog_ignore"), // Neutral button text.
79+
() -> BaseSettings.CHECK_WATCH_HISTORY_DOMAIN_NAME.save(false), // Neutral button action (Ignore).
80+
true // Dismiss dialog on Neutral button click.
81+
);
8482

85-
// Show the dialog.
86-
Dialog dialog = dialogPair.first;
87-
88-
Utils.showDialog(context, dialog, false, null);
89-
} catch (Exception ex) {
90-
Logger.printException(() -> "checkDnsResolver dialog creation failure", ex);
91-
}
83+
Utils.showDialog(context, dialogPair.first, false, null);
9284
});
9385
} catch (Exception ex) {
9486
Logger.printException(() -> "checkDnsResolver failure", ex);

0 commit comments

Comments
 (0)