Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
improve the usage agent string for the cli client
Browse files Browse the repository at this point in the history
  • Loading branch information
devoncarew committed May 14, 2016
1 parent e9bde46 commit f175846
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
18 changes: 13 additions & 5 deletions lib/src/usage_impl_io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,19 @@ class AnalyticsIO extends AnalyticsImpl {
}

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() {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion test/usage_impl_io_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class MockHttpClientRequest implements HttpClientRequest {
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();
}
Expand Down

0 comments on commit f175846

Please sign in to comment.