From 247ddae6dc4e54585fd8f4ac033e3ee90e8a97b5 Mon Sep 17 00:00:00 2001 From: Moritz Date: Mon, 23 Sep 2024 15:50:02 -0400 Subject: [PATCH 1/3] Remove dependency on `package:intl` --- pkgs/unified_analytics/lib/src/analytics.dart | 5 ----- pkgs/unified_analytics/lib/src/config_handler.dart | 4 ++-- pkgs/unified_analytics/lib/src/utils.dart | 4 ++-- pkgs/unified_analytics/pubspec.yaml | 2 +- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/pkgs/unified_analytics/lib/src/analytics.dart b/pkgs/unified_analytics/lib/src/analytics.dart index e0f3de962..de2c89ed5 100644 --- a/pkgs/unified_analytics/lib/src/analytics.dart +++ b/pkgs/unified_analytics/lib/src/analytics.dart @@ -8,7 +8,6 @@ import 'package:file/file.dart'; import 'package:file/local.dart'; import 'package:file/memory.dart'; import 'package:http/http.dart'; -import 'package:intl/date_symbol_data_local.dart'; import 'package:meta/meta.dart'; import 'package:path/path.dart' as p; @@ -436,10 +435,6 @@ class AnalyticsImpl implements Analytics { kLogFileName, )), ) { - // Initialize date formatting for `package:intl` within constructor - // so clients using this package won't need to - initializeDateFormatting(); - // This initializer class will let the instance know // if it was the first run; if it is, nothing will be sent // on the first run diff --git a/pkgs/unified_analytics/lib/src/config_handler.dart b/pkgs/unified_analytics/lib/src/config_handler.dart index ea6f51ff6..1cead48fb 100644 --- a/pkgs/unified_analytics/lib/src/config_handler.dart +++ b/pkgs/unified_analytics/lib/src/config_handler.dart @@ -5,8 +5,8 @@ import 'dart:convert'; import 'package:clock/clock.dart'; +import 'package:convert/convert.dart'; import 'package:file/file.dart'; -import 'package:intl/intl.dart'; import 'package:path/path.dart' as p; import 'constants.dart'; @@ -226,7 +226,7 @@ class ToolInfo { @override String toString() { return json.encode({ - 'lastRun': DateFormat('yyyy-MM-dd').format(lastRun), + 'lastRun': FixedDateTimeFormatter('YYYY-MM-DD').encode(lastRun), 'versionNumber': versionNumber, }); } diff --git a/pkgs/unified_analytics/lib/src/utils.dart b/pkgs/unified_analytics/lib/src/utils.dart index 2bd0c79ed..9d694ed1f 100644 --- a/pkgs/unified_analytics/lib/src/utils.dart +++ b/pkgs/unified_analytics/lib/src/utils.dart @@ -7,8 +7,8 @@ import 'dart:io' as io; import 'dart:math' show Random; import 'package:clock/clock.dart'; +import 'package:convert/convert.dart'; import 'package:file/file.dart'; -import 'package:intl/intl.dart'; import 'package:path/path.dart' as p; import 'enums.dart'; @@ -21,7 +21,7 @@ import 'user_property.dart'; /// yyyy-MM-dd (2023-01-09) /// ``` String get dateStamp { - return DateFormat('yyyy-MM-dd').format(clock.now()); + return FixedDateTimeFormatter('YYYY-MM-DD').encode(clock.now()); } /// Reads in a directory and returns `true` if write permissions are enabled. diff --git a/pkgs/unified_analytics/pubspec.yaml b/pkgs/unified_analytics/pubspec.yaml index 237b4fa37..99f3a777a 100644 --- a/pkgs/unified_analytics/pubspec.yaml +++ b/pkgs/unified_analytics/pubspec.yaml @@ -12,9 +12,9 @@ environment: dependencies: clock: ^1.1.1 + convert: ^3.1.1 file: '>=6.1.4 <8.0.0' http: '>=0.13.5 <2.0.0' - intl: '>=0.18.0 <0.20.0' meta: ^1.9.0 path: ^1.8.0 From 992fcff422a045cc54b70aaf63dec5f27b020a7c Mon Sep 17 00:00:00 2001 From: Moritz Date: Mon, 23 Sep 2024 15:51:15 -0400 Subject: [PATCH 2/3] Add changelog --- pkgs/unified_analytics/CHANGELOG.md | 4 ++++ pkgs/unified_analytics/pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/unified_analytics/CHANGELOG.md b/pkgs/unified_analytics/CHANGELOG.md index 999068baa..4b2638256 100644 --- a/pkgs/unified_analytics/CHANGELOG.md +++ b/pkgs/unified_analytics/CHANGELOG.md @@ -1,3 +1,7 @@ +## 6.1.4-wip + +- Fix formatting and remove dependency on `package:intl`. + ## 6.1.3 - Require Dart 3.4. diff --git a/pkgs/unified_analytics/pubspec.yaml b/pkgs/unified_analytics/pubspec.yaml index 99f3a777a..cdd1eb2cd 100644 --- a/pkgs/unified_analytics/pubspec.yaml +++ b/pkgs/unified_analytics/pubspec.yaml @@ -4,7 +4,7 @@ description: >- to Google Analytics. # When updating this, keep the version consistent with the changelog and the # value in lib/src/constants.dart. -version: 6.1.3 +version: 6.1.4-wip repository: https://github.com/dart-lang/tools/tree/main/pkgs/unified_analytics environment: From de9ca3a412051a4a6a60030caeed176392496a14 Mon Sep 17 00:00:00 2001 From: Moritz Date: Mon, 23 Sep 2024 15:55:08 -0400 Subject: [PATCH 3/3] Fix constants.dart --- pkgs/unified_analytics/lib/src/constants.dart | 2 +- pkgs/unified_analytics/pubspec.yaml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/unified_analytics/lib/src/constants.dart b/pkgs/unified_analytics/lib/src/constants.dart index 5cef5743f..fefa5413b 100644 --- a/pkgs/unified_analytics/lib/src/constants.dart +++ b/pkgs/unified_analytics/lib/src/constants.dart @@ -87,7 +87,7 @@ const int kMaxLogFileSize = 25 * (1 << 20); const String kLogFileName = 'dart-flutter-telemetry.log'; /// The current version of the package, should be in line with pubspec version. -const String kPackageVersion = '6.1.3'; +const String kPackageVersion = '6.1.4-wip'; /// The minimum length for a session. const int kSessionDurationMinutes = 30; diff --git a/pkgs/unified_analytics/pubspec.yaml b/pkgs/unified_analytics/pubspec.yaml index cdd1eb2cd..2dc65c18d 100644 --- a/pkgs/unified_analytics/pubspec.yaml +++ b/pkgs/unified_analytics/pubspec.yaml @@ -2,9 +2,11 @@ name: unified_analytics description: >- A package for logging analytics for all Dart and Flutter related tooling to Google Analytics. +# LINT.IfChange # When updating this, keep the version consistent with the changelog and the # value in lib/src/constants.dart. version: 6.1.4-wip +# LINT.ThenChange(lib/src/constants.dart) repository: https://github.com/dart-lang/tools/tree/main/pkgs/unified_analytics environment: