mirror of
https://github.com/revanced/revanced-integrations.git
synced 2025-01-17 07:17:31 +01:00
fix(YouTube - Check watch history domain name resolution): Do not show warning if network connection is flaky (#702)
This commit is contained in:
parent
87749ee879
commit
80482df3fa
@ -386,10 +386,10 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ignore this class. It must be public to satisfy Android requirement.
|
* Ignore this class. It must be public to satisfy Android requirements.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static class DialogFragmentWrapper extends DialogFragment {
|
public static final class DialogFragmentWrapper extends DialogFragment {
|
||||||
|
|
||||||
private Dialog dialog;
|
private Dialog dialog;
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -20,7 +20,6 @@ public class CheckWatchHistoryDomainNameResolutionPatch {
|
|||||||
private static final String SINKHOLE_IPV4 = "0.0.0.0";
|
private static final String SINKHOLE_IPV4 = "0.0.0.0";
|
||||||
private static final String SINKHOLE_IPV6 = "::";
|
private static final String SINKHOLE_IPV6 = "::";
|
||||||
|
|
||||||
/** @noinspection SameParameterValue */
|
|
||||||
private static boolean domainResolvesToValidIP(String host) {
|
private static boolean domainResolvesToValidIP(String host) {
|
||||||
try {
|
try {
|
||||||
InetAddress address = InetAddress.getByName(host);
|
InetAddress address = InetAddress.getByName(host);
|
||||||
@ -50,7 +49,16 @@ public class CheckWatchHistoryDomainNameResolutionPatch {
|
|||||||
|
|
||||||
Utils.runOnBackgroundThread(() -> {
|
Utils.runOnBackgroundThread(() -> {
|
||||||
try {
|
try {
|
||||||
if (domainResolvesToValidIP(HISTORY_TRACKING_ENDPOINT)) {
|
// If the user has a flaky DNS server, or they just lost internet connectivity
|
||||||
|
// and the isNetworkConnected() check has not detected it yet (it can take a few
|
||||||
|
// seconds after losing connection), then the history tracking endpoint will
|
||||||
|
// show a resolving error but it's actually an internet connection problem.
|
||||||
|
//
|
||||||
|
// Prevent this false positive by verify youtube.com resolves.
|
||||||
|
// If youtube.com does not resolve, then it's not a watch history domain resolving error
|
||||||
|
// because the entire app will not work since no domains are resolving.
|
||||||
|
if (domainResolvesToValidIP(HISTORY_TRACKING_ENDPOINT)
|
||||||
|
|| !domainResolvesToValidIP("youtube.com")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user