Skip to content

Commit

Permalink
Merge branch 'develop' into feat/5586_3
Browse files Browse the repository at this point in the history
  • Loading branch information
monsieurtanuki authored Oct 25, 2024
2 parents 618a135 + ccbe094 commit b8bdb0f
Show file tree
Hide file tree
Showing 8 changed files with 268 additions and 126 deletions.
20 changes: 12 additions & 8 deletions packages/smooth_app/android/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ GEM
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.984.0)
aws-sdk-core (3.209.1)
aws-partitions (1.992.0)
aws-sdk-core (3.210.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.94.0)
aws-sdk-core (~> 3, >= 3.207.0)
aws-sdk-kms (1.95.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.167.0)
aws-sdk-core (~> 3, >= 3.207.0)
aws-sdk-s3 (1.169.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
aws-sigv4 (1.10.0)
Expand Down Expand Up @@ -74,7 +74,7 @@ GEM
faraday_middleware (1.2.1)
faraday (~> 1.0)
fastimage (2.3.1)
fastlane (2.224.0)
fastlane (2.225.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
Expand All @@ -90,6 +90,7 @@ GEM
faraday-cookie_jar (~> 0.0.6)
faraday_middleware (~> 1.0)
fastimage (>= 2.1.0, < 3.0.0)
fastlane-sirp (>= 1.0.0)
gh_inspector (>= 1.1.2, < 2.0.0)
google-apis-androidpublisher_v3 (~> 0.3)
google-apis-playcustomapp_v1 (~> 0.1)
Expand Down Expand Up @@ -117,6 +118,8 @@ GEM
xcpretty-travis-formatter (>= 0.0.3, < 2.0.0)
fastlane-plugin-flutter_dart_version_manager (0.1.5)
fastlane-plugin-versioning (0.6.0)
fastlane-sirp (1.0.0)
sysrandom (~> 1.0)
gh_inspector (1.1.3)
google-apis-androidpublisher_v3 (0.54.0)
google-apis-core (>= 0.11.0, < 2.a)
Expand Down Expand Up @@ -192,6 +195,7 @@ GEM
simctl (1.6.10)
CFPropertyList
naturally
sysrandom (1.0.5)
terminal-notifier (2.0.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
Expand Down
2 changes: 2 additions & 0 deletions packages/smooth_app/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@
"@contribute_develop_text_2": {},
"contribute_develop_dev_mode_title": "DEV Mode?",
"contribute_develop_dev_mode_subtitle": "Activate the DEV Mode",
"contribute_donate_title": "Donate",
"@contribute_donate_title": {},
"contribute_donate_header": "Donate to Open Food Facts",
"@contribute_donate_header": {},
"contribute_enroll_alpha": "Enroll in internal alpha version",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:openfoodfacts/openfoodfacts.dart';
import 'package:provider/provider.dart';
Expand All @@ -17,12 +16,6 @@ import 'package:smooth_app/pages/preferences/lazy_counter_widget.dart';
import 'package:smooth_app/pages/preferences/user_preferences_item.dart';
import 'package:smooth_app/pages/preferences/user_preferences_list_tile.dart';
import 'package:smooth_app/pages/preferences/user_preferences_page.dart';
import 'package:smooth_app/pages/prices/get_prices_model.dart';
import 'package:smooth_app/pages/prices/price_user_button.dart';
import 'package:smooth_app/pages/prices/prices_page.dart';
import 'package:smooth_app/pages/prices/prices_proofs_page.dart';
import 'package:smooth_app/pages/prices/prices_users_page.dart';
import 'package:smooth_app/pages/prices/product_price_add_page.dart';
import 'package:smooth_app/pages/product/common/product_query_page_helper.dart';
import 'package:smooth_app/pages/user_management/login_page.dart';
import 'package:smooth_app/query/paged_product_query.dart';
Expand Down Expand Up @@ -217,92 +210,6 @@ class UserPreferencesAccount extends AbstractUserPreferences {
lazyCounter:
const LazyCounterUserSearch(UserSearchType.TO_BE_COMPLETED),
),
_getListTile(
PriceUserButton.showUserTitle(
user: ProductQuery.getWriteUser().userId,
context: context,
),
() async => PriceUserButton.showUserPrices(
user: ProductQuery.getWriteUser().userId,
context: context,
),
CupertinoIcons.money_dollar_circle,
lazyCounter: LazyCounterPrices(ProductQuery.getWriteUser().userId),
),
_getListTile(
appLocalizations.user_search_proofs_title,
() async => Navigator.of(context).push(
MaterialPageRoute<void>(
builder: (BuildContext context) => const PricesProofsPage(
selectProof: false,
),
),
),
Icons.receipt,
),
_getListTile(
appLocalizations.prices_add_a_receipt,
() async => ProductPriceAddPage.showProductPage(
context: context,
proofType: ProofType.receipt,
),
Icons.add_shopping_cart,
),
_getListTile(
appLocalizations.prices_add_price_tags,
() async => ProductPriceAddPage.showProductPage(
context: context,
proofType: ProofType.priceTag,
),
Icons.add_shopping_cart,
),
_getListTile(
appLocalizations.all_search_prices_latest_title,
() async => Navigator.of(context).push(
MaterialPageRoute<void>(
builder: (BuildContext context) => PricesPage(
GetPricesModel(
parameters: GetPricesParameters()
..orderBy = <OrderBy<GetPricesOrderField>>[
const OrderBy<GetPricesOrderField>(
field: GetPricesOrderField.created,
ascending: false,
),
]
..pageSize = GetPricesModel.pageSize
..pageNumber = 1,
displayOwner: true,
displayProduct: true,
uri: OpenPricesAPIClient.getUri(
path: 'prices',
uriHelper: ProductQuery.uriPricesHelper,
),
title: appLocalizations.all_search_prices_latest_title,
lazyCounterPrices: const LazyCounterPrices(null),
),
),
),
),
CupertinoIcons.money_dollar_circle,
lazyCounter: const LazyCounterPrices(null),
),
_getListTile(
appLocalizations.all_search_prices_top_user_title,
() async => Navigator.of(context).push(
MaterialPageRoute<void>(
builder: (BuildContext context) => const PricesUsersPage(),
),
),
Icons.account_box,
),
_getPriceListTile(
appLocalizations.all_search_prices_top_location_title,
'locations',
),
_getPriceListTile(
appLocalizations.all_search_prices_top_product_title,
'products',
),
_buildProductQueryTile(
productQuery: PagedToBeCompletedProductQuery(
productType: ProductType.food,
Expand Down Expand Up @@ -356,21 +263,6 @@ class UserPreferencesAccount extends AbstractUserPreferences {
];
}

UserPreferencesItem _getPriceListTile(
final String title,
final String path,
) =>
_getListTile(
title,
() async => LaunchUrlHelper.launchURL(
OpenPricesAPIClient.getUri(
path: path,
uriHelper: ProductQuery.uriPricesHelper,
).toString(),
),
Icons.open_in_new,
);

Future<bool?> _confirmLogout() async => showDialog<bool>(
context: context,
builder: (BuildContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,6 @@ class UserPreferencesContribute extends AbstractUserPreferences {
() async => _share(appLocalizations.contribute_share_content),
Icons.adaptive.share,
),
_getListTile(
appLocalizations.contribute_donate_header,
() async => LaunchUrlHelper.launchURL(
AppLocalizations.of(context).donate_url,
),
Icons.volunteer_activism,
icon:
UserPreferencesListTile.getTintedIcon(Icons.open_in_new, context),
externalLink: true,
),
if (GlobalVars.appStore.getEnrollInBetaURL() != null)
_getListTile(
appLocalizations.contribute_enroll_alpha,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import 'package:flutter/material.dart';
import 'package:smooth_app/helpers/launch_url_helper.dart';
import 'package:smooth_app/pages/preferences/abstract_user_preferences.dart';
import 'package:smooth_app/pages/preferences/user_preferences_item.dart';
import 'package:smooth_app/pages/preferences/user_preferences_list_tile.dart';
import 'package:smooth_app/pages/preferences/user_preferences_page.dart';

/// Display of "Donation" for the preferences page.
class UserPreferencesDonation extends AbstractUserPreferences {
UserPreferencesDonation({
required super.context,
required super.userPreferences,
required super.appLocalizations,
required super.themeData,
});

@override
PreferencePageType getPreferencePageType() => PreferencePageType.DONATION;

@override
String getTitleString() => appLocalizations.contribute_donate_title;

@override
String getSubtitleString() => appLocalizations.contribute_donate_header;

@override
IconData getLeadingIconData() => Icons.volunteer_activism;

@override
Icon? getForwardIcon() => UserPreferencesListTile.getTintedIcon(
Icons.open_in_new,
context,
);

@override
Future<void> runHeaderAction() async => LaunchUrlHelper.launchURL(
appLocalizations.donate_url,
);

@override
List<UserPreferencesItem> getChildren() => <UserPreferencesItem>[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ import 'package:smooth_app/pages/preferences/user_preferences_account.dart';
import 'package:smooth_app/pages/preferences/user_preferences_connect.dart';
import 'package:smooth_app/pages/preferences/user_preferences_contribute.dart';
import 'package:smooth_app/pages/preferences/user_preferences_dev_mode.dart';
import 'package:smooth_app/pages/preferences/user_preferences_donation.dart';
import 'package:smooth_app/pages/preferences/user_preferences_faq.dart';
import 'package:smooth_app/pages/preferences/user_preferences_food.dart';
import 'package:smooth_app/pages/preferences/user_preferences_item.dart';
import 'package:smooth_app/pages/preferences/user_preferences_prices.dart';
import 'package:smooth_app/pages/preferences/user_preferences_settings.dart';
import 'package:smooth_app/pages/preferences/user_preferences_widgets.dart';
import 'package:smooth_app/themes/theme_provider.dart';
Expand All @@ -34,6 +36,8 @@ enum PreferencePageType {
SETTINGS('settings'),
CONTRIBUTE('contribute'),
FAQ('faq'),
DONATION('donation'),
PRICES('prices'),
CONNECT('connect');

const PreferencePageType(this.tag);
Expand Down Expand Up @@ -101,6 +105,20 @@ enum PreferencePageType {
appLocalizations: appLocalizations,
themeData: themeData,
);
case PreferencePageType.DONATION:
return UserPreferencesDonation(
context: context,
userPreferences: userPreferences,
appLocalizations: appLocalizations,
themeData: themeData,
);
case PreferencePageType.PRICES:
return UserPreferencesPrices(
context: context,
userPreferences: userPreferences,
appLocalizations: appLocalizations,
themeData: themeData,
);
case PreferencePageType.CONNECT:
return UserPreferencesConnect(
context: context,
Expand All @@ -117,6 +135,8 @@ enum PreferencePageType {
<PreferencePageType>[
PreferencePageType.ACCOUNT,
PreferencePageType.FOOD,
PreferencePageType.PRICES,
PreferencePageType.DONATION,
PreferencePageType.SETTINGS,
PreferencePageType.CONTRIBUTE,
PreferencePageType.FAQ,
Expand Down
Loading

0 comments on commit b8bdb0f

Please sign in to comment.