Skip to content

Commit

Permalink
Add TraceableClientMixin to prices pages
Browse files Browse the repository at this point in the history
  • Loading branch information
g123k committed Jun 24, 2024
1 parent 4499eef commit 214051a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:matomo_tracker/matomo_tracker.dart';
import 'package:openfoodfacts/openfoodfacts.dart';
import 'package:provider/provider.dart';
import 'package:smooth_app/data_models/fetched_product.dart';
Expand All @@ -26,13 +27,15 @@ class PriceProductSearchPage extends StatefulWidget {
});

final PriceMetaProduct? product;

// TODO(monsieurtanuki): as a parameter, add a list of barcodes already there: we're not supposed to select twice the same product

@override
State<PriceProductSearchPage> createState() => _PriceProductSearchPageState();
}

class _PriceProductSearchPageState extends State<PriceProductSearchPage> {
class _PriceProductSearchPageState extends State<PriceProductSearchPage>
with TraceableClientMixin {
final TextEditingController _controller = TextEditingController();

late PriceMetaProduct? _product = widget.product;
Expand Down
4 changes: 3 additions & 1 deletion packages/smooth_app/lib/pages/prices/prices_proofs_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:intl/intl.dart';
import 'package:matomo_tracker/matomo_tracker.dart';
import 'package:openfoodfacts/openfoodfacts.dart';
import 'package:smooth_app/generic_lib/design_constants.dart';
import 'package:smooth_app/generic_lib/widgets/images/smooth_image.dart';
Expand All @@ -21,7 +22,8 @@ class PricesProofsPage extends StatefulWidget {
State<PricesProofsPage> createState() => _PricesProofsPageState();
}

class _PricesProofsPageState extends State<PricesProofsPage> {
class _PricesProofsPageState extends State<PricesProofsPage>
with TraceableClientMixin {
late final Future<MaybeError<GetProofsResult>> _results = _download();

static const int _columns = 3;
Expand Down
4 changes: 3 additions & 1 deletion packages/smooth_app/lib/pages/prices/prices_users_page.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:matomo_tracker/matomo_tracker.dart';
import 'package:openfoodfacts/openfoodfacts.dart';
import 'package:smooth_app/generic_lib/design_constants.dart';
import 'package:smooth_app/generic_lib/widgets/smooth_back_button.dart';
Expand All @@ -20,7 +21,8 @@ class PricesUsersPage extends StatefulWidget {
State<PricesUsersPage> createState() => _PricesUsersPageState();
}

class _PricesUsersPageState extends State<PricesUsersPage> {
class _PricesUsersPageState extends State<PricesUsersPage>
with TraceableClientMixin {
late final Future<MaybeError<GetUsersResult>> _users = _showTopUsers();

// In this specific page, let's never try to go beyond the top 10.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:matomo_tracker/matomo_tracker.dart';
import 'package:openfoodfacts/openfoodfacts.dart';
import 'package:provider/provider.dart';
import 'package:smooth_app/data_models/preferences/user_preferences.dart';
Expand Down Expand Up @@ -56,6 +57,7 @@ class ProductPriceAddPage extends StatefulWidget {
if (!context.mounted) {
return;
}

await Navigator.of(context).push(
MaterialPageRoute<void>(
builder: (BuildContext context) => ProductPriceAddPage(
Expand All @@ -71,7 +73,8 @@ class ProductPriceAddPage extends StatefulWidget {
State<ProductPriceAddPage> createState() => _ProductPriceAddPageState();
}

class _ProductPriceAddPageState extends State<ProductPriceAddPage> {
class _ProductPriceAddPageState extends State<ProductPriceAddPage>
with TraceableClientMixin {
late final PriceModel _model = PriceModel(
proofType: widget.proofType,
locations: widget.latestOsmLocations,
Expand Down Expand Up @@ -244,4 +247,7 @@ class _ProductPriceAddPageState extends State<ProductPriceAddPage> {
}
return true;
}

@override
String get actionName => 'Opened price_page with ${widget.proofType.offTag}';
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:matomo_tracker/matomo_tracker.dart';
import 'package:openfoodfacts/openfoodfacts.dart';
import 'package:smooth_app/generic_lib/design_constants.dart';
import 'package:smooth_app/generic_lib/widgets/smooth_card.dart';
Expand All @@ -20,7 +21,8 @@ class ProductPricesList extends StatefulWidget {
State<ProductPricesList> createState() => _ProductPricesListState();
}

class _ProductPricesListState extends State<ProductPricesList> {
class _ProductPricesListState extends State<ProductPricesList>
with TraceableClientMixin {
late final Future<MaybeError<GetPricesResult>> _prices =
_showProductPrices(widget.model.parameters);

Expand Down

0 comments on commit 214051a

Please sign in to comment.