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: Contribute to your country link #5874

Open
wants to merge 24 commits into
base: develop
Choose a base branch
from

Conversation

jnnabugwu
Copy link
Contributor

@jnnabugwu jnnabugwu commented Nov 17, 2024

What

feat: Added a method and map to get the correct country locale for the corresponding wiki page. 

Screenshot

Simulator Screenshot - iPhone 15 Pro - 2024-11-17 at 16 58 16

Fixes bug(s)

Part of

jnnabugwu and others added 22 commits July 23, 2024 18:34
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 26.66667% with 11 lines in your changes missing coverage. Please review.

Project coverage is 6.85%. Comparing base (4d9c7fc) to head (eca3816).
Report is 481 commits behind head on develop.

Files with missing lines Patch % Lines
...pages/preferences/user_preferences_contribute.dart 26.66% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           develop   #5874      +/-   ##
==========================================
- Coverage     9.54%   6.85%   -2.70%     
==========================================
  Files          325     428     +103     
  Lines        16411   23598    +7187     
==========================================
+ Hits          1567    1617      +50     
- Misses       14844   21981    +7137     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@monsieurtanuki monsieurtanuki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jnnabugwu!
Please have a look at my comments!

@@ -319,6 +335,19 @@ class UserPreferencesContribute extends AbstractUserPreferences {
builder: (_) => tile,
);
}

Future<String> returnCountry(BuildContext context) async {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove that method, we don't need it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops yeah thats my bad

@@ -0,0 +1,25 @@
// TODO(monsieurtanuki): the code is to be moved to openfoodfacts-dart
class TmpCountryWikiLinks {
final Map<String, String> wikiLinks = <String, String>{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
final Map<String, String> wikiLinks = <String, String>{
static final Map<OpenFoodFactsCountry, String> wikiLinks = <OpenFoodFactsCountry, String>{

@@ -94,6 +96,20 @@ class UserPreferencesContribute extends AbstractUserPreferences {
() async => _share(appLocalizations.contribute_share_content),
Icons.adaptive.share,
),
_getListTile(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We display nothing if the country has no wiki links.

_getListTile(
appLocalizations.help_improve_country,
() async {
final String country = await returnCountry(context);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use ProductQuery.getCountry() instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 💬 To discuss and validate
Development

Successfully merging this pull request may close these issues.

Create a "Contribute to your country" link
4 participants