Skip to content

Commit

Permalink
chore: upgraded flutter_map to 6.0.1 (#4757)
Browse files Browse the repository at this point in the history
* chore: upgraded flutter_map to 6.0.1

Impacted files:
* `add_new_product_page.dart`: matomo upgrade
* `analytics_helper.dart`: matomo upgrade
* `camera_scan_page.dart`: matomo upgrade
* `forgot_password_page.dart`: matomo upgrade
* `knowledge_panel_page.dart`: matomo upgrade
* `knowledge_panel_world_map_card.dart`: flutter_map upgrade
* `login_page.dart`: matomo upgrade
* `main.dart`: matomo upgrade
* `new_product_page.dart`: matomo upgrade
* `personalized_ranking_page.dart`: matomo upgrade
* `product_list_page.dart`: matomo upgrade
* `product_query_page.dart`: matomo upgrade
* `pubspec.lock`: wtf
* `pubspec.yaml`: upgraded flutter_map to 6.0.1 (+ domino effect)
* `question_page.dart`: matomo upgrade
* `sign_up_page.dart`: matomo upgrade
* `user_preferences_page.dart`: matomo upgrade

* chore: upgrade flutter_map to 6.0.1

Impacted file:
* `mocks.dart`: matomo upgrade

* chore: unit test fix

* pubspec upgrade
  • Loading branch information
monsieurtanuki authored Nov 17, 2023
1 parent a91a360 commit 0ddd5c6
Show file tree
Hide file tree
Showing 19 changed files with 92 additions and 112 deletions.
32 changes: 19 additions & 13 deletions packages/smooth_app/lib/helpers/analytics_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,12 @@ class AnalyticsHelper {
String? barcode,
}) =>
MatomoTracker.instance.trackEvent(
eventName: msg.name,
eventCategory: msg.category.tag,
action: msg.name,
eventValue: eventValue ?? _formatBarcode(barcode),
eventInfo: EventInfo(
name: msg.name,
category: msg.category.tag,
action: msg.name,
value: eventValue ?? _formatBarcode(barcode),
),
);

// Used by code which is outside of the core:smooth_app code
Expand All @@ -314,20 +316,24 @@ class AnalyticsHelper {
String? barcode,
}) =>
MatomoTracker.instance.trackEvent(
eventName: msg,
eventCategory: category,
action: msg,
eventValue: eventValue ?? _formatBarcode(barcode),
eventInfo: EventInfo(
name: msg,
category: category,
action: msg,
value: eventValue ?? _formatBarcode(barcode),
),
);

static void trackProductEdit(
AnalyticsEditEvents editEventName, String barcode,
[bool saved = false]) =>
MatomoTracker.instance.trackEvent(
eventName: saved ? '${editEventName.name}-saved' : editEventName.name,
eventCategory: AnalyticsCategory.productEdit.tag,
action: editEventName.name,
eventValue: _formatBarcode(barcode),
eventInfo: EventInfo(
name: saved ? '${editEventName.name}-saved' : editEventName.name,
category: AnalyticsCategory.productEdit.tag,
action: editEventName.name,
value: _formatBarcode(barcode),
),
);

static void trackSearch({
Expand All @@ -351,7 +357,7 @@ class AnalyticsHelper {
}

static void trackOutlink({required String url}) =>
MatomoTracker.instance.trackOutlink(url);
MatomoTracker.instance.trackOutlink(link: url);

static int? _formatBarcode(String? barcode) {
if (barcode == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ class KnowledgePanelPage extends StatefulWidget {
class _KnowledgePanelPageState extends State<KnowledgePanelPage>
with TraceableClientMixin, UpToDateMixin {
@override
String get traceTitle => 'knowledge_panel_page';

@override
String get traceName => 'Opened full knowledge panel page';
String get actionName => 'Opened full knowledge panel page';

@override
void initState() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map/plugin_api.dart';
import 'package:latlong2/latlong.dart';
import 'package:openfoodfacts/openfoodfacts.dart';
import 'package:smooth_app/generic_lib/design_constants.dart';
Expand All @@ -24,13 +23,18 @@ class KnowledgePanelWorldMapCard extends StatelessWidget {
child: FlutterMap(
options: MapOptions(
// The first pointer is used as the center of the map.
center: LatLng(
initialCenter: LatLng(
mapElement.pointers.first.geo!.lat,
mapElement.pointers.first.geo!.lng,
),
zoom: 6.0,
initialZoom: 6.0,
),
nonRotatedChildren: <Widget>[
children: <Widget>[
TileLayer(
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
userAgentPackageName: 'org.openfoodfacts.app',
),
MarkerLayer(markers: getMarkers(mapElement.pointers)),
RichAttributionWidget(
popupInitialDisplayDuration: const Duration(seconds: 5),
animationConfig: const ScaleRAWA(),
Expand All @@ -45,13 +49,6 @@ class KnowledgePanelWorldMapCard extends StatelessWidget {
],
),
],
children: <Widget>[
TileLayer(
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
userAgentPackageName: 'org.openfoodfacts.app',
),
MarkerLayer(markers: getMarkers(mapElement.pointers)),
],
),
),
);
Expand All @@ -66,7 +63,7 @@ class KnowledgePanelWorldMapCard extends StatelessWidget {
markers.add(
Marker(
point: LatLng(pointer.geo!.lat, pointer.geo!.lng),
builder: (BuildContext ctx) => const Icon(
child: const Icon(
Icons.pin_drop,
color: Colors.lightBlue,
),
Expand Down
6 changes: 5 additions & 1 deletion packages/smooth_app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart';
import 'package:matomo_tracker/matomo_tracker.dart';
import 'package:openfoodfacts/openfoodfacts.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart';
Expand Down Expand Up @@ -230,7 +231,10 @@ class _SmoothAppState extends State<SmoothApp> {
provide<PermissionListener>(_permissionListener),
],
child: AppNavigator(
observers: <NavigatorObserver>[SentryNavigatorObserver()],
observers: <NavigatorObserver>[
SentryNavigatorObserver(),
matomoObserver,
],
child: Builder(builder: _buildApp),
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,7 @@ class _QuestionPageState extends State<_QuestionPage>
}

@override
String get traceTitle => 'robotoff_question_page';

@override
String get traceName => 'Opened robotoff_question_page';
String get actionName => 'Opened robotoff_question_page';
}

sealed class _RobotoffQuestionState {
Expand Down
5 changes: 1 addition & 4 deletions packages/smooth_app/lib/pages/personalized_ranking_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ class PersonalizedRankingPage extends StatefulWidget {
class _PersonalizedRankingPageState extends State<PersonalizedRankingPage>
with TraceableClientMixin {
@override
String get traceName => 'Opened personalized ranking page'; // optional

@override
String get traceTitle => 'personalized_ranking_page';
String get actionName => 'Opened personalized ranking page';

static const int _backgroundAlpha = 51;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,7 @@ class _UserPreferencesPageState extends State<UserPreferencesPage>
final ScrollController _controller = ScrollController();

@override
String get traceTitle => 'user_preferences_page';

@override
String get traceName => 'Opened user_preferences_page';
String get actionName => 'Opened user_preferences_page';

@override
Widget build(BuildContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,7 @@ class _AddNewProductPageState extends State<AddNewProductPage>
bool _ecoscoreExpanded = false;

@override
String get traceName => 'Opened add_new_product_page';

@override
String get traceTitle => 'add_new_product_page';
String get actionName => 'Opened add_new_product_page';

@override
void initState() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ class _ProductListPageState extends State<ProductListPage>
bool _selectionMode = false;

@override
String get traceName => 'Opened list_page';

@override
String get traceTitle => 'list_page';
String get actionName => 'Opened list_page';

@override
void initState() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ class _ProductQueryPageState extends State<ProductQueryPage>
late final OpenFoodFactsCountry? _country;

@override
String get traceTitle => 'search_page';

@override
String get traceName => 'Opened search_page';
String get actionName => 'Opened search_page';

@override
void initState() {
Expand Down
5 changes: 1 addition & 4 deletions packages/smooth_app/lib/pages/product/new_product_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,7 @@ class _ProductPageState extends State<ProductPage>
double bottomPadding = 0.0;

@override
String get traceName => 'Opened product_page';

@override
String get traceTitle => 'product_page';
String get actionName => 'Opened product_page';

@override
void initState() {
Expand Down
5 changes: 1 addition & 4 deletions packages/smooth_app/lib/pages/scan/camera_scan_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@ class CameraScannerPageState extends State<CameraScannerPage>
}

@override
String get traceTitle => '${GlobalVars.barcodeScanner.getType()}_page';

@override
String get traceName => 'Opened ${GlobalVars.barcodeScanner.getType()}_page';
String get actionName => 'Opened ${GlobalVars.barcodeScanner.getType()}_page';

@override
Widget build(BuildContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ class _ForgotPasswordPageState extends State<ForgotPasswordPage>
}

@override
String get traceTitle => 'forgot_password_page';

@override
String get traceName => 'Opened forgot_password_page';
String get actionName => 'Opened forgot_password_page';

@override
void dispose() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,7 @@ class _LoginPageState extends State<LoginPage> with TraceableClientMixin {
}

@override
String get traceTitle => 'login_page';

@override
String get traceName => 'Opened login_page';
String get actionName => 'Opened login_page';

@override
void dispose() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ class _SignUpPageState extends State<SignUpPage> with TraceableClientMixin {
bool _disagreed = false;

@override
String get traceTitle => 'sign_up_page';

@override
String get traceName => 'Opened sign_up_page';
String get actionName => 'Opened sign_up_page';

@override
Widget build(BuildContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
InAppReviewPlugin.register(with: registry.registrar(forPlugin: "InAppReviewPlugin"))
MobileScannerPlugin.register(with: registry.registrar(forPlugin: "MobileScannerPlugin"))
FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
RivePlugin.register(with: registry.registrar(forPlugin: "RivePlugin"))
SentryFlutterPlugin.register(with: registry.registrar(forPlugin: "SentryFlutterPlugin"))
Expand Down
Loading

0 comments on commit 0ddd5c6

Please sign in to comment.