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: Add privacy policy link in app #5074

Merged
merged 1 commit into from
Feb 19, 2024

Conversation

AshAman999
Copy link
Member

What

  • Added the about privacy page section

Screenshot

image

Fixes bug(s)

Part of

@AshAman999 AshAman999 requested a review from a team as a code owner February 18, 2024 13:07
@codecov-commenter
Copy link

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (4d9c7fc) 9.54% compared to head (7fb24c2) 9.54%.
Report is 28 commits behind head on develop.

Files Patch % Lines
...pp/lib/pages/preferences/user_preferences_faq.dart 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           develop   #5074      +/-   ##
==========================================
- Coverage     9.54%   9.54%   -0.01%     
==========================================
  Files          325     326       +1     
  Lines        16411   16437      +26     
==========================================
+ Hits          1567    1569       +2     
- Misses       14844   14868      +24     

☔ 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 @AshAman999!
Looks relatively good to me.
Please consider localizing the URL as suggested, or merging anyway.

Comment on lines +285 to +288
onPressed: () => LaunchUrlHelper.launchURL(
'https://openfoodfacts.org/privacy',
true,
),
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
onPressed: () => LaunchUrlHelper.launchURL(
'https://openfoodfacts.org/privacy',
true,
),
onPressed: () async => LaunchUrlHelper.launchURL(
UriHelper.replaceSubdomain(
Uri.parse(
'https://world.openfoodfacts.org/privacy',
),
),
true,
),

Copy link
Member Author

Choose a reason for hiding this comment

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

@monsieurtanuki

I think LaunchUrlHelper.launchURL automatically does that if passed with true as Boolean, so in a way it gets localized.

Can you plz have a look once

Copy link
Contributor

Choose a reason for hiding this comment

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

@AshAman999 You're right!

Copy link
Member

Choose a reason for hiding this comment

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

The string should be made translatable / adapt to the language

Copy link
Contributor

Choose a reason for hiding this comment

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

@teolemon Actually in the code the URL is "localized", country-wise.
The true parameter is not very explicit, I'll give you that, and it only sets the country - not the language, e.g. https://be.openfoodfacts.org/privacy (and not https://be-fr.openfoodfacts.org/privacy or https://be.openfoodfacts.org/privacy)

Unfortunately there's some confusion between off-dart and Smoothie.

off-dart version, method replaceSubdomainWithCodes in UriHelper:

  /// Replaces the subdomain of an URI with specific country and language.
  ///
  /// No default language nor country: null means no parameter.
  /// For instance
  /// * https://world.xxx... would be standard
  /// * https://world-fr.xxx... would be "no country" in French
  /// * https://fr.xxx... would be France
  /// * https://fr-es.xxx... would be France in Spanish
  static Uri replaceSubdomainWithCodes(
    final Uri uri, {
    final String? languageCode,
    String? countryCode,
  }) {

Smoothie version, method _replaceSubdomainWithCodes in LaunchUrlHelper:

  static String _replaceSubdomainWithCodes(String url) {
    if (!url.contains('https://openfoodfacts.')) {
      throw 'Error do not use local identifier in url';
    }

    String? countryCode =
        PlatformDispatcher.instance.locale.countryCode?.toLowerCase();

    if (countryCode == null) {
      countryCode = 'world.';
    } else {
      countryCode = '$countryCode.';
    }

    url = url.replaceAll(
        'https://openfoodfacts.', 'https://${countryCode}openfoodfacts.');

    return url;
  }

  static Future<void> launchURL(String url, bool isOFF) async {
    if (isOFF) {
      url = _replaceSubdomainWithCodes(url);
    }
// ...
  }

@AshAman999 I guess @teolemon is right and we should use my code suggestion. And merge the PR.

Meanwhile, I'm about to open an issue about using slightly different replaceSubdomainWithCodes and _replaceSubdomainWithCodes methods.

@teolemon
Copy link
Member

Sorry I went through it too quickly. I just approved

@teolemon teolemon merged commit 494acb8 into openfoodfacts:develop Feb 19, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add the privacy policy page
4 participants