From 9241cba307e9dd28ad4ed461912d964a447af8c9 Mon Sep 17 00:00:00 2001 From: Davide Quaranta <30431538+davquar@users.noreply.github.com> Date: Sat, 11 May 2024 18:25:11 +0200 Subject: [PATCH 1/4] Fix summary: rename "uniques" "visitors" This is to reflect the Umami API change of commit https://github.com/umami-software/umami/commit/dcf2457e450cb294c3a16f64a98718da21f3a80d Fixes #43 --- lib/l10n/app_en.arb | 6 +++--- lib/models/api/stats.dart | 6 +++--- lib/screens/website_statistics.dart | 5 +++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index c362e9a..8b85812 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -11,9 +11,9 @@ "@pageViews": { "description": "Page views card title and label" }, - "uniques": "Uniques", - "@uniques": { - "description": "Uniques" + "visitors": "Visitors", + "@visitors": { + "description": "Unique visitors" }, "bounces": "Bounces", "@bounces": { diff --git a/lib/models/api/stats.dart b/lib/models/api/stats.dart index 5b4923f..24cc5ce 100644 --- a/lib/models/api/stats.dart +++ b/lib/models/api/stats.dart @@ -1,16 +1,16 @@ import 'package:halfdot/models/api/common.dart'; class StatsResponse implements ApiModel { - StatsResponse(this.pageViews, this.uniques, this.bounces, this.totalTime); + StatsResponse(this.pageViews, this.visitors, this.bounces, this.totalTime); StatsResponse.fromJson(Map json) : pageViews = json['pageviews']['value'], - uniques = json['uniques']['value'], + visitors = json['visitors']['value'], bounces = json['bounces']['value'], totalTime = json['totaltime']['value']; final int pageViews; - final int uniques; + final int visitors; final int bounces; final int totalTime; } diff --git a/lib/screens/website_statistics.dart b/lib/screens/website_statistics.dart index 58ac7ea..606a138 100644 --- a/lib/screens/website_statistics.dart +++ b/lib/screens/website_statistics.dart @@ -117,12 +117,13 @@ class _WebsiteStatisticsPageState extends State { ), Column(children: [ Text( - snapshot.data!.uniques.toString(), + snapshot.data!.visitors.toString(), style: Theme.of(context) .textTheme .titleLarge, ), - Text(AppLocalizations.of(context)!.uniques), + Text( + AppLocalizations.of(context)!.visitors), ]), Column( children: [ From c65370df71cd23e381c0415e29bfd8a5e11f0e69 Mon Sep 17 00:00:00 2001 From: Davide Quaranta <30431538+davquar@users.noreply.github.com> Date: Sat, 11 May 2024 18:35:55 +0200 Subject: [PATCH 2/4] Add `visits` metric in summary --- lib/l10n/app_en.arb | 4 ++++ lib/models/api/stats.dart | 5 ++++- lib/screens/website_statistics.dart | 9 +++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 8b85812..3435849 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -15,6 +15,10 @@ "@visitors": { "description": "Unique visitors" }, + "visits": "Visits", + "@visitors": { + "description": "Unique sessions" + }, "bounces": "Bounces", "@bounces": { "description": "Bounces" diff --git a/lib/models/api/stats.dart b/lib/models/api/stats.dart index 24cc5ce..cbd7ca0 100644 --- a/lib/models/api/stats.dart +++ b/lib/models/api/stats.dart @@ -1,15 +1,18 @@ import 'package:halfdot/models/api/common.dart'; class StatsResponse implements ApiModel { - StatsResponse(this.pageViews, this.visitors, this.bounces, this.totalTime); + StatsResponse( + this.pageViews, this.visits, this.visitors, this.bounces, this.totalTime); StatsResponse.fromJson(Map json) : pageViews = json['pageviews']['value'], + visits = json['visits']['value'], visitors = json['visitors']['value'], bounces = json['bounces']['value'], totalTime = json['totaltime']['value']; final int pageViews; + final int visits; final int visitors; final int bounces; final int totalTime; diff --git a/lib/screens/website_statistics.dart b/lib/screens/website_statistics.dart index 606a138..9f6d516 100644 --- a/lib/screens/website_statistics.dart +++ b/lib/screens/website_statistics.dart @@ -115,6 +115,15 @@ class _WebsiteStatisticsPageState extends State { .pageViews), ], ), + Column(children: [ + Text( + snapshot.data!.visits.toString(), + style: Theme.of(context) + .textTheme + .titleLarge, + ), + Text(AppLocalizations.of(context)!.visits), + ]), Column(children: [ Text( snapshot.data!.visitors.toString(), From 3f83da7b853f87aabd0f491ad496568183cffd69 Mon Sep 17 00:00:00 2001 From: Davide Quaranta <30431538+davquar@users.noreply.github.com> Date: Sat, 11 May 2024 18:41:24 +0200 Subject: [PATCH 3/4] Bump to 2.1.2+8 and API 2.11.3 --- lib/screens/settings.dart | 2 +- pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/screens/settings.dart b/lib/screens/settings.dart index 74ed571..924a1ee 100644 --- a/lib/screens/settings.dart +++ b/lib/screens/settings.dart @@ -17,7 +17,7 @@ class SettingsPage extends StatefulWidget { class _SettingsPageState extends State { Storage storage = Storage.instance; - static const String _apiVersion = '2.7.0'; + static const String _apiVersion = '2.11.3'; static const String _repoUrl = 'https://github.com/davquar/halfdot'; static const String _license = 'MIT'; static const String _licenseUrl = diff --git a/pubspec.yaml b/pubspec.yaml index bebf820..582785a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 2.1.1+7 +version: 2.1.2+8 environment: sdk: '>=3.0.0 <=3.1.2' From d25b6e04e1ce3c65dec16ad019242156e9d1ea59 Mon Sep 17 00:00:00 2001 From: Davide Quaranta <30431538+davquar@users.noreply.github.com> Date: Sat, 11 May 2024 18:48:48 +0200 Subject: [PATCH 4/4] Specify version for subosito/flutter-action --- .github/workflows/code_check.yml | 1 + pubspec.lock | 2 +- pubspec.yaml | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/code_check.yml b/.github/workflows/code_check.yml index 06a3775..9c229cc 100644 --- a/.github/workflows/code_check.yml +++ b/.github/workflows/code_check.yml @@ -15,6 +15,7 @@ jobs: - uses: subosito/flutter-action@v2 with: channel: 'stable' + flutter-version-file: 'pubspec.yaml' - run: flutter --version - name: Install dependencies diff --git a/pubspec.lock b/pubspec.lock index d256b5d..93566ab 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -572,4 +572,4 @@ packages: version: "3.1.2" sdks: dart: ">=3.1.0 <=3.1.2" - flutter: ">=3.13.0" + flutter: ">=3.13.3" diff --git a/pubspec.yaml b/pubspec.yaml index 582785a..6fff128 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -21,6 +21,7 @@ version: 2.1.2+8 environment: sdk: '>=3.0.0 <=3.1.2' + flutter: '3.13.3' # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions