mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-11 13:46:17 +00:00
refactor(YouTube - Check watch history domain name resolution): Do not show redundant dialog cancel button
This commit is contained in:
@@ -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,28 +67,20 @@ public class CheckWatchHistoryDomainNameResolutionPatch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Utils.runOnMainThread(() -> {
|
Utils.runOnMainThread(() -> {
|
||||||
try {
|
Pair<Dialog, LinearLayout> dialogPair = CustomDialog.create(
|
||||||
// Create the custom dialog.
|
context,
|
||||||
Pair<Dialog, LinearLayout> dialogPair = CustomDialog.create(
|
str("revanced_check_watch_history_domain_name_dialog_title"), // Title.
|
||||||
context,
|
Html.fromHtml(str("revanced_check_watch_history_domain_name_dialog_message")), // Message (HTML).
|
||||||
str("revanced_check_watch_history_domain_name_dialog_title"), // Title.
|
null, // No EditText.
|
||||||
Html.fromHtml(str("revanced_check_watch_history_domain_name_dialog_message")), // Message (HTML).
|
null, // OK button text.
|
||||||
null, // No EditText.
|
() -> {}, // OK button action (just dismiss).
|
||||||
null, // OK button text.
|
null, // No cancel button.
|
||||||
() -> {}, // OK button action (just dismiss).
|
str("revanced_check_watch_history_domain_name_dialog_ignore"), // Neutral button text.
|
||||||
() -> {}, // Cancel button action (just dismiss).
|
() -> BaseSettings.CHECK_WATCH_HISTORY_DOMAIN_NAME.save(false), // Neutral button action (Ignore).
|
||||||
str("revanced_check_watch_history_domain_name_dialog_ignore"), // Neutral button text.
|
true // Dismiss dialog on Neutral button click.
|
||||||
() -> BaseSettings.CHECK_WATCH_HISTORY_DOMAIN_NAME.save(false), // Neutral button action (Ignore).
|
);
|
||||||
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);
|
||||||
|
|||||||
Reference in New Issue
Block a user