improve the usage agent string for the cli client
diff --git a/changelog.md b/changelog.md
index 2f01cb2..d9034de 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,8 @@
# Changelog
+## 2.2.1
+- improve the user agent string for the CLI client
+
## 2.2.0+1
- bug fix to prevent frequently changing the settings file
diff --git a/lib/src/usage_impl_io.dart b/lib/src/usage_impl_io.dart
index 2bb7efa..fff224a 100644
--- a/lib/src/usage_impl_io.dart
+++ b/lib/src/usage_impl_io.dart
@@ -39,11 +39,19 @@
}
String _createUserAgent() {
- // Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en)
- // Dart/1.8.0-edge.41170 (macos; macos; macos; null)
- String os = Platform.operatingSystem;
- String locale = Platform.environment['LANG'];
- return "Dart/${_dartVersion()} (${os}; ${os}; ${os}; ${locale})";
+ if (Platform.isMacOS) {
+ return 'Mozilla/5.0 (Macintosh; Intel Mac OS X)';
+ } else if (Platform.isMacOS) {
+ return 'Mozilla/5.0 (Windows; Windows)';
+ } else if (Platform.isLinux) {
+ return 'Mozilla/5.0 (Linux; Linux)';
+ } else {
+ // Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en)
+ // Dart/1.8.0-edge.41170 (macos; macos; macos; null)
+ String os = Platform.operatingSystem;
+ String locale = Platform.environment['LANG'];
+ return "Dart/${_dartVersion()} (${os}; ${os}; ${os}; ${locale})";
+ }
}
String _userHomeDir() {
diff --git a/pubspec.yaml b/pubspec.yaml
index e3a323b..5f55f75 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -3,7 +3,7 @@
# BSD-style license that can be found in the LICENSE file.
name: usage
-version: 2.2.0+1
+version: 2.2.1
description: A Google Analytics wrapper for both command-line, web, and Flutter apps.
homepage: https://github.com/dart-lang/usage
author: Dart Team <misc@dartlang.org>
diff --git a/test/usage_impl_io_test.dart b/test/usage_impl_io_test.dart
index e41f241..31e8ac8 100644
--- a/test/usage_impl_io_test.dart
+++ b/test/usage_impl_io_test.dart
@@ -68,7 +68,7 @@
class MockHttpClientResponse implements HttpClientResponse {
final MockHttpClient client;
MockHttpClientResponse(this.client);
- Future drain([var futureValue]) {
+ Future/*<E>*/ drain/*<E>*/([/*=E*/ futureValue]) {
client.sendCount++;
return new Future.value();
}