Skip to content
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

feat: 5205 - added 4 links to prices app #5329

Merged
merged 1 commit into from
Jun 2, 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
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