[app] Add old hook method to show version mismatched dialog (#160)

This commit is contained in:
tehcneko 2021-02-22 20:26:04 +08:00 committed by GitHub
parent 37b5e6a896
commit a10e882a39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -23,8 +23,15 @@ package io.github.lsposed.manager;
import android.widget.Toast;
public class Constants {
@SuppressWarnings("FieldMayBeFinal")
private static String xposedVersion = null;
public static void showErrorToast(int type) {
Toast.makeText(App.getInstance(), R.string.app_destroyed, Toast.LENGTH_LONG).show();
}
// for showing the version mismatch dialog
public static String getXposedVersion() {
return xposedVersion;
}
}

View File

@ -34,6 +34,7 @@ import androidx.appcompat.app.AlertDialog;
import io.github.lsposed.manager.App;
import io.github.lsposed.manager.BuildConfig;
import io.github.lsposed.manager.ConfigManager;
import io.github.lsposed.manager.Constants;
import io.github.lsposed.manager.R;
import io.github.lsposed.manager.util.NavUtil;
import io.github.lsposed.manager.util.theme.ThemeUtil;
@ -54,6 +55,10 @@ public class BaseActivity extends MaterialActivity {
// make sure the versions are consistent
String coreVersionStr = ConfigManager.getXposedVersionName();
// for showing the version mismatch dialog
if (coreVersionStr == null) {
coreVersionStr = Constants.getXposedVersion();
}
if (coreVersionStr != null) {
if (!BuildConfig.VERSION_NAME.equals(coreVersionStr)) {
new AlertDialog.Builder(this)