diff --git a/app/src/main/java/io/github/lsposed/manager/ui/activity/base/BaseActivity.java b/app/src/main/java/io/github/lsposed/manager/ui/activity/base/BaseActivity.java index 6165d731..c25f7ba0 100644 --- a/app/src/main/java/io/github/lsposed/manager/ui/activity/base/BaseActivity.java +++ b/app/src/main/java/io/github/lsposed/manager/ui/activity/base/BaseActivity.java @@ -36,7 +36,6 @@ import io.github.lsposed.manager.BuildConfig; 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.Version; import io.github.lsposed.manager.util.theme.ThemeUtil; import rikka.core.res.ResourcesKt; import rikka.material.app.MaterialActivity; @@ -56,9 +55,7 @@ public class BaseActivity extends MaterialActivity { // make sure the versions are consistent String coreVersionStr = Constants.getXposedVersion(); if (coreVersionStr != null) { - Version managerVersion = new Version(BuildConfig.VERSION_NAME); - Version coreVersion = new Version(coreVersionStr); - if (!managerVersion.equals(coreVersion)) { + if (!BuildConfig.VERSION_NAME.equals(coreVersionStr)) { new AlertDialog.Builder(this) .setMessage(R.string.outdated_manager) .setPositiveButton(R.string.ok, (dialog, id) -> { diff --git a/app/src/main/java/io/github/lsposed/manager/util/Version.java b/app/src/main/java/io/github/lsposed/manager/util/Version.java deleted file mode 100644 index a83e8fac..00000000 --- a/app/src/main/java/io/github/lsposed/manager/util/Version.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * This file is part of LSPosed. - * - * LSPosed is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * LSPosed is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with LSPosed. If not, see . - * - * Copyright (C) 2020 EdXposed Contributors - * Copyright (C) 2021 LSPosed Contributors - */ - -package io.github.lsposed.manager.util; - -// https://stackoverflow.com/a/11024200 -public class Version implements Comparable { - - private final String version; - - public final String get() { - return this.version; - } - - public Version(String version) { - if (version == null) - throw new IllegalArgumentException("Version can not be null"); - if (!version.matches("v[0-9]+(\\.[0-9]+)*")) - throw new IllegalArgumentException("Invalid version format"); - this.version = version.substring(1); // v - } - - @Override - public int compareTo(Version that) { - if (that == null) - return 1; - String[] thisParts = this.get().split("\\."); - String[] thatParts = that.get().split("\\."); - int length = Math.max(thisParts.length, thatParts.length); - for (int i = 0; i < length; i++) { - int thisPart = i < thisParts.length ? - Integer.parseInt(thisParts[i]) : 0; - int thatPart = i < thatParts.length ? - Integer.parseInt(thatParts[i]) : 0; - if (thisPart < thatPart) - return -1; - if (thisPart > thatPart) - return 1; - } - return 0; - } - - @Override - public boolean equals(Object that) { - if (this == that) - return true; - if (that == null) - return false; - if (this.getClass() != that.getClass()) - return false; - return this.compareTo((Version) that) == 0; - } - -}