Skip to content

Commit

Permalink
feat: 5205 - added 4 links to prices app (#5329)
Browse files Browse the repository at this point in the history
  • Loading branch information
monsieurtanuki authored Jun 2, 2024
1 parent d5d466a commit 27259c0
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 12 deletions.
16 changes: 16 additions & 0 deletions packages/smooth_app/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -1767,6 +1767,22 @@
"@user_search_prices_title": {
"description": "User prices: list tile title"
},
"all_search_prices_latest_title": "Latest Prices added",
"@all_search_prices_latest_title": {
"description": "Latest prices: list tile title"
},
"all_search_prices_top_user_title": "Top price contributors",
"@all_search_prices_top_user_title": {
"description": "Top price users: list tile title"
},
"all_search_prices_top_location_title": "Stores with the most prices",
"@all_search_prices_top_location_title": {
"description": "Top price locations: list tile title"
},
"all_search_prices_top_product_title": "Products with the most prices",
"@all_search_prices_top_product_title": {
"description": "Top price products: list tile title"
},
"all_search_to_be_completed_title": "All to-be-completed products",
"@all_search_to_be_completed_title": {
"description": "All products to be completed: list tile title"
Expand Down
16 changes: 16 additions & 0 deletions packages/smooth_app/lib/l10n/app_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -1767,6 +1767,22 @@
"@user_search_prices_title": {
"description": "User prices: list tile title"
},
"all_search_prices_latest_title": "Derniers prix ajoutés",
"@all_search_prices_latest_title": {
"description": "Latest prices: list tile title"
},
"all_search_prices_top_user_title": "Top contributeurs",
"@all_search_prices_top_user_title": {
"description": "Top price users: list tile title"
},
"all_search_prices_top_location_title": "Top lieux",
"@all_search_prices_top_location_title": {
"description": "Top price locations: list tile title"
},
"all_search_prices_top_product_title": "Top produits",
"@all_search_prices_top_product_title": {
"description": "Top price products: list tile title"
},
"all_search_to_be_completed_title": "Tous les produits à compléter",
"@all_search_to_be_completed_title": {
"description": "All products to be completed: list tile title"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,21 +210,27 @@ class UserPreferencesAccount extends AbstractUserPreferences {
localDatabase: localDatabase,
myCount: _getMyCount(UserSearchType.TO_BE_COMPLETED),
),
_getListTile(
_getPriceListTile(
appLocalizations.user_search_prices_title,
() async {
final UriProductHelper uriProductHelper =
ProductQuery.uriProductHelper;
final Uri uri = Uri(
scheme: uriProductHelper.scheme,
host: uriProductHelper.getHost('prices'),
path: 'app/dashboard/prices',
);
return LaunchUrlHelper.launchURL(uri.toString());
},
Icons.open_in_new,
'app/dashboard/prices',
myCount: _getMyPricesCount(),
),
_getPriceListTile(
appLocalizations.all_search_prices_latest_title,
'app/prices',
),
_getPriceListTile(
appLocalizations.all_search_prices_top_user_title,
'app/users',
),
_getPriceListTile(
appLocalizations.all_search_prices_top_location_title,
'app/locations',
),
_getPriceListTile(
appLocalizations.all_search_prices_top_product_title,
'app/products',
),
_buildProductQueryTile(
productQuery: PagedToBeCompletedProductQuery(),
title: appLocalizations.all_search_to_be_completed_title,
Expand Down Expand Up @@ -276,6 +282,28 @@ class UserPreferencesAccount extends AbstractUserPreferences {
];
}

UserPreferencesItem _getPriceListTile(
final String title,
final String path, {
final Future<int?>? myCount,
}) =>
_getListTile(
title,
() async => LaunchUrlHelper.launchURL(_getPriceUrl(path)),
Icons.open_in_new,
myCount: myCount,
);

String _getPriceUrl(final String path) {
final UriProductHelper uriProductHelper = ProductQuery.uriProductHelper;
final Uri uri = Uri(
scheme: uriProductHelper.scheme,
host: uriProductHelper.getHost('prices'),
path: path,
);
return uri.toString();
}

Future<bool?> _confirmLogout() async => showDialog<bool>(
context: context,
builder: (BuildContext context) {
Expand Down

0 comments on commit 27259c0

Please sign in to comment.