mirror of
https://github.com/revanced/revanced-integrations.git
synced 2025-01-31 14:17:31 +01:00
fix(YouTube - Check environment patch): Show if patched apk is too old, if the install source is not Manager or ADB
This commit is contained in:
parent
dffe7f6c34
commit
18048f3324
@ -188,6 +188,7 @@ public final class CheckEnvironmentPatch {
|
|||||||
*/
|
*/
|
||||||
long durationBetweenPatchingAndInstallation;
|
long durationBetweenPatchingAndInstallation;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
protected Boolean check() {
|
protected Boolean check() {
|
||||||
try {
|
try {
|
||||||
@ -213,8 +214,7 @@ public final class CheckEnvironmentPatch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// User installed more than 30 minutes after patching.
|
// User installed more than 30 minutes after patching.
|
||||||
// Don't fail this, to allow adb install of older patched apps.
|
return false;
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -271,34 +271,33 @@ public final class CheckEnvironmentPatch {
|
|||||||
failedChecks.add(sameHardware);
|
failedChecks.add(sameHardware);
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckIsNearPatchTime nearPatchTime = new CheckIsNearPatchTime();
|
CheckExpectedInstaller installerCheck = new CheckExpectedInstaller();
|
||||||
Boolean timeCheckPassed = nearPatchTime.check();
|
if (installerCheck.check() && !DEBUG_ALWAYS_SHOW_CHECK_FAILED_DIALOG) {
|
||||||
if (timeCheckPassed != null) {
|
// If the installer package is Manager but this code is reached,
|
||||||
if (timeCheckPassed && !DEBUG_ALWAYS_SHOW_CHECK_FAILED_DIALOG) {
|
// that means it must not be the right Manager otherwise the hardware hash
|
||||||
if (failedChecks.isEmpty()) {
|
// signatures would be present and this check would not have run.
|
||||||
// Recently patched and installed. No further checks are needed.
|
if (installerCheck.installerFound == InstallationType.MANAGER) {
|
||||||
// Stopping here also prevents showing warnings if patching and installing with Termux.
|
failedChecks.add(installerCheck);
|
||||||
|
// Also could not have been patched on this device.
|
||||||
|
failedChecks.add(sameHardware);
|
||||||
|
} else if (failedChecks.isEmpty()) {
|
||||||
|
// ADB install of CLI build. Allow even if patched a long time ago.
|
||||||
Check.disableForever();
|
Check.disableForever();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
failedChecks.add(nearPatchTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CheckExpectedInstaller installerCheck = new CheckExpectedInstaller();
|
|
||||||
// If the installer package is Manager but this code is reached,
|
|
||||||
// that means it must not be the right Manager otherwise the hardware hash
|
|
||||||
// signatures would be present and this check would not have run.
|
|
||||||
final boolean isManagerInstall = installerCheck.installerFound == InstallationType.MANAGER;
|
|
||||||
if (!installerCheck.check() || isManagerInstall) {
|
|
||||||
failedChecks.add(installerCheck);
|
failedChecks.add(installerCheck);
|
||||||
|
|
||||||
if (isManagerInstall) {
|
|
||||||
// If using Manager and reached here, then this must
|
|
||||||
// have been patched on a different device.
|
|
||||||
failedChecks.add(sameHardware);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CheckIsNearPatchTime nearPatchTime = new CheckIsNearPatchTime();
|
||||||
|
Boolean timeCheckPassed = nearPatchTime.check();
|
||||||
|
if (timeCheckPassed && !DEBUG_ALWAYS_SHOW_CHECK_FAILED_DIALOG) {
|
||||||
|
// Allow installing recently patched apks,
|
||||||
|
// even if the install source is not Manager or ADB.
|
||||||
|
Check.disableForever();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
failedChecks.add(nearPatchTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DEBUG_ALWAYS_SHOW_CHECK_FAILED_DIALOG) {
|
if (DEBUG_ALWAYS_SHOW_CHECK_FAILED_DIALOG) {
|
||||||
@ -310,11 +309,6 @@ public final class CheckEnvironmentPatch {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (failedChecks.isEmpty()) {
|
|
||||||
Check.disableForever();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//noinspection ComparatorCombinators
|
//noinspection ComparatorCombinators
|
||||||
Collections.sort(failedChecks, (o1, o2) -> o1.uiSortingValue() - o2.uiSortingValue());
|
Collections.sort(failedChecks, (o1, o2) -> o1.uiSortingValue() - o2.uiSortingValue());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user