mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-20 05:08:03 +01:00
Add a utility method for getting client platform tags from UA strings for metrics.
This commit is contained in:
committed by
Jon Chambers
parent
7ba689aaeb
commit
e524ff965d
@@ -64,6 +64,18 @@ public class UserAgentTagUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static Tag getPlatformTag(final String userAgentString) {
|
||||
String platform;
|
||||
|
||||
try {
|
||||
platform = UserAgentUtil.parseUserAgentString(userAgentString).getPlatform().name().toLowerCase();
|
||||
} catch (final UnrecognizedUserAgentException e) {
|
||||
platform = "unrecognized";
|
||||
}
|
||||
|
||||
return Tag.of(PLATFORM_TAG, platform);
|
||||
}
|
||||
|
||||
private static boolean allowVersion(final ClientPlatform platform, final Semver version) {
|
||||
final Pair<ClientPlatform, Semver> platformAndVersion = new Pair<>(platform, version);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user