VersionUtils: move isPleroma method from Instance

main
Alibek Omarov 5 years ago
parent 0e5e0bea39
commit fd7740838a
  1. 4
      app/src/main/java/com/keylesspalace/tusky/entity/Instance.kt
  2. 5
      app/src/main/java/com/keylesspalace/tusky/util/VersionUtils.java

@ -43,10 +43,6 @@ data class Instance (
val instance = other as Instance? val instance = other as Instance?
return instance?.uri.equals(uri) return instance?.uri.equals(uri)
} }
fun isPleroma(): Boolean {
return version.contains(" (compatible; Pleroma ");
}
} }
data class PollLimits ( data class PollLimits (

@ -25,8 +25,10 @@ public class VersionUtils {
private int major; private int major;
private int minor; private int minor;
private int patch; private int patch;
private String versionString;
public VersionUtils(@NonNull String versionString) { public VersionUtils(@NonNull String versionString) {
this.versionString = versionString;
String regex = "([0-9]+)\\.([0-9]+)\\.([0-9]+).*"; String regex = "([0-9]+)\\.([0-9]+)\\.([0-9]+).*";
Pattern pattern = Pattern.compile(regex); Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(versionString); Matcher matcher = pattern.matcher(versionString);
@ -41,4 +43,7 @@ public class VersionUtils {
return (major == 2) ? ( (minor == 7) ? (patch >= 0) : (minor > 7) ) : (major > 2); return (major == 2) ? ( (minor == 7) ? (patch >= 0) : (minor > 7) ) : (major > 2);
} }
public boolean isPleroma() {
return versionString.contains(" (compatible; Pleroma ");
}
} }

Loading…
Cancel
Save