Consistent behaviour independent on build host

This is required since Telegram starts a new contest to improve UI for calls, so guys with MacOS or Linux wouldn't be distracted by this.
This commit is contained in:
Alex Sokol 2023-02-18 00:45:46 +03:00 committed by GitHub
parent 9bc4ddd546
commit 002eb8c87c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -140,32 +140,9 @@ public class Utilities {
if (value == null) {
return 0;
}
if (BuildConfig.BUILD_HOST_IS_WINDOWS) {
Matcher matcher = pattern.matcher(value);
if (matcher.find()) {
return Integer.valueOf(matcher.group());
}
} else {
int val = 0;
try {
int start = -1, end;
for (end = 0; end < value.length(); ++end) {
char character = value.charAt(end);
boolean allowedChar = character == '-' || character >= '0' && character <= '9';
if (allowedChar && start < 0) {
start = end;
} else if (!allowedChar && start >= 0) {
end++;
break;
}
}
if (start >= 0) {
String str = value.subSequence(start, end).toString();
// val = parseInt(str);
val = Integer.parseInt(str);
}
} catch (Exception ignore) {}
return val;
Matcher matcher = pattern.matcher(value);
if (matcher.find()) {
return Integer.valueOf(matcher.group());
}
return 0;
}