Skip to content

Remove dependency on package:intl #589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkgs/unified_analytics/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 6.1.4-wip

- Fix formatting and remove dependency on `package:intl`.

## 6.1.3

- Require Dart 3.4.
Expand Down
5 changes: 0 additions & 5 deletions pkgs/unified_analytics/lib/src/analytics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pkgs/unified_analytics/lib/src/config_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -226,7 +226,7 @@ class ToolInfo {
@override
String toString() {
return json.encode(<String, Object?>{
'lastRun': DateFormat('yyyy-MM-dd').format(lastRun),
'lastRun': FixedDateTimeFormatter('YYYY-MM-DD').encode(lastRun),
'versionNumber': versionNumber,
});
}
Expand Down
2 changes: 1 addition & 1 deletion pkgs/unified_analytics/lib/src/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions pkgs/unified_analytics/lib/src/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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.
Expand Down
6 changes: 4 additions & 2 deletions pkgs/unified_analytics/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@ name: unified_analytics
description: >-
A package for logging analytics for all Dart and Flutter related tooling
to Google Analytics.
# LINT.IfChange
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there tooling supporting these style comments?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, not yet (I see this as a feature request to the PR health bot ;) )

I wrote this just for more visual noise, as I overlooked this at first and thought this might help with this not happening again.

# 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
# LINT.ThenChange(lib/src/constants.dart)
repository: https://github.com/dart-lang/tools/tree/main/pkgs/unified_analytics

environment:
sdk: ^3.4.0

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

Expand Down