-
-
Notifications
You must be signed in to change notification settings - Fork 306
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
feat: Add privacy policy link in app #5074
Conversation
Codecov ReportAttention:
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. |
There was a problem hiding this 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.
onPressed: () => LaunchUrlHelper.launchURL( | ||
'https://openfoodfacts.org/privacy', | ||
true, | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onPressed: () => LaunchUrlHelper.launchURL( | |
'https://openfoodfacts.org/privacy', | |
true, | |
), | |
onPressed: () async => LaunchUrlHelper.launchURL( | |
UriHelper.replaceSubdomain( | |
Uri.parse( | |
'https://world.openfoodfacts.org/privacy', | |
), | |
), | |
true, | |
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AshAman999 You're right!
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
Sorry I went through it too quickly. I just approved |
What
Screenshot
Fixes bug(s)
Part of