-
-
Notifications
You must be signed in to change notification settings - Fork 287
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
fix: Add a nudge in home for people still using org.openfoodfact.app fixes #2979 #3030
fix: Add a nudge in home for people still using org.openfoodfact.app fixes #2979 #3030
Conversation
format updated
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 @juliethangeldeveloper!
Please have a look at my comments.
"depricatedHeader": "You are using a deprecated version of the app.", | ||
"@depricatedHeader": { | ||
"description": "Confirmation, that the user can upgrade to new version of the app" | ||
}, | ||
"clickHereToDownload": "Click here to download", | ||
"@clickHereToDownload": { | ||
"description": "Confirmation button to download new version of the app" | ||
}, |
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.
"depricatedHeader": "You are using a deprecated version of the app.", | |
"@depricatedHeader": { | |
"description": "Confirmation, that the user can upgrade to new version of the app" | |
}, | |
"clickHereToDownload": "Click here to download", | |
"@clickHereToDownload": { | |
"description": "Confirmation button to download new version of the app" | |
}, | |
"deprecated_header": "You are using a deprecated version of the app.", | |
"@deprecated_header": { | |
"description": "Confirmation, that the user can upgrade to new version of the app" | |
}, | |
"click_here_to_download": "Click here to download", | |
"@click_here_to_download": { | |
"description": "Confirmation button to download new version of the app" | |
}, |
I believe that most (all?) tags use a lower_case style.
|
||
/// We fetch first if the app is deprecated, then try to get the tagline | ||
/// Will return [false] if the app is deprecated or a [TagLineItem] | ||
Future<dynamic> _fetchData() async { |
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.
Future<dynamic> _fetchData() async { | |
Future<TagLineItem?> _fetchData() async { |
dynamic
is ugly; please return null
if deprecated. I may be wrong but that shouldn't be a problem.
color: Theme.of(context).colorScheme.primary, | ||
), | ||
), | ||
return FutureBuilder<dynamic>( |
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.
return FutureBuilder<dynamic>( | |
return FutureBuilder<TagLineItem?>( |
return FutureBuilder<dynamic>( | ||
future: _fetchData(), | ||
builder: (BuildContext context, AsyncSnapshot<dynamic> data) { | ||
if (data.data != null && data.data is! TagLineItem) { |
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.
Please use instead something like data.connectionState == ConnectionState.done && data.data == null
.
The is
syntax should be avoided.
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.
@g123k reviewing the comment from the code you sent me.
style: const | ||
TextStyle( | ||
color: Colors.red, | ||
),)), |
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.
),)), | |
),),), |
child: Text( | ||
'${localizations.depricatedHeader} ${localizations.clickHereToDownload}', |
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.
It would make more sense to have the header as a Text
and then the "click!" as a TextButton
.
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 did try it first like this but would involve more lines of code but I agree would be better for the user. In the request of the issue, the line on the UI requested was all in one line. So I added it to the whole text as a TextButton.
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.
Again, not sure if that looks good: please attach a screenshot.
if (data.data != null && data.data is! TagLineItem) { | ||
return const _SearchCardTagLineDeprecatedAppText(); | ||
} else if (data is TagLineItem) { | ||
return _SearchCardTagLineText( |
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.
No strong added value to move that code into a separate widget: please think about the poor developer that will review your code ;)
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.
@g123k review the comment from the code you sent me
} | ||
|
||
/// Opens the App Store or Google Play of the production app | ||
Future<bool> _openAppStore() async { |
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.
Future<bool> _openAppStore() async { | |
Future<void> _openAppStore() async { |
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.
It looks like you're OK with this suggestion, so please implement it.
…or the rest of the code changes
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 @juliethangeldeveloper!
Still some things to fix; please have a look at my comments.
"@deprecated_header": { | ||
"description": "Confirmation, that the user can upgrade to new version of the app" | ||
}, | ||
"click_here_to_download": "Click here to download", |
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.
"click_here_to_download": "Click here to download", | |
"click_here_to_download": "Download the new version of the app", |
), | ||
), | ||
future: _fetchData(), | ||
builder: (BuildContext context, AsyncSnapshot<dynamic> data) { |
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.
builder: (BuildContext context, AsyncSnapshot<dynamic> data) { | |
builder: (BuildContext context, AsyncSnapshot<TagLineItem?> data) { |
builder: (BuildContext context, AsyncSnapshot<dynamic> data) { | ||
if (data.connectionState == ConnectionState.done && data.data == null) { | ||
return const _SearchCardTagLineDeprecatedAppText(); | ||
} else if (data is TagLineItem) { |
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.
Please avoid the data is TagLineItem
syntax.
Here it would be data.connectionState == ConnectionState.done
.
child: Text( | ||
'${localizations.depricatedHeader} ${localizations.clickHereToDownload}', |
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.
Again, not sure if that looks good: please attach a screenshot.
} | ||
|
||
/// Opens the App Store or Google Play of the production app | ||
Future<bool> _openAppStore() async { |
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.
It looks like you're OK with this suggestion, so please implement it.
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 @juliethangeldeveloper!
The code is improving but there are still things to fix.
Beyond my detailed remarks, let me suggest:
- to find in Android Studio (or the tool you're using) how to have the code formatted (something like Ctrl-S)
- to attach a screenshot
color: Colors.red, | ||
),),), | ||
child: | ||
SizedBox( height: 50, |
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.
We don't need the SizedBox
, do we?
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.
yes because some devices would not alow the click here to happen
textAlign: TextAlign.center, | ||
style: const | ||
TextStyle( | ||
color: Colors.red, |
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.
It's very hard to read Text
s in red. Just don't specify a color.
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.
That is the color of the text in the image
style: const TextStyle( | ||
color: Colors.red, | ||
),), | ||
TextButton( |
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.
Again, it's hard to read red Text
s.
For this specific case, I suggest a SmoothSimpleButton
with red background and white text.
"click_here": "Click here", | ||
"@click_here": { | ||
"description": "Confirmation click to download new version of the app" | ||
}, |
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.
"click_here": "Click here", | |
"@click_here": { | |
"description": "Confirmation click to download new version of the app" | |
}, |
Text( | ||
localizations.download_new_version, | ||
textAlign: TextAlign.center, | ||
style: const TextStyle( | ||
color: Colors.red, | ||
),), |
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.
Text( | |
localizations.download_new_version, | |
textAlign: TextAlign.center, | |
style: const TextStyle( | |
color: Colors.red, | |
),), |
We don't need 2 texts and a button. We can get rid of the least interesting "Click here".
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.
you asked me to add that
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 asked you to put one text and one button. I suppose that a "download the new version!" label in an elevated button will be explicit enough, we don't need a "click here" label (and we don't have that much space).
_openAppStore(); | ||
}, | ||
child: Text( | ||
localizations.click_here, |
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.
localizations.click_here, | |
localizations.download_new_version, |
it seems the original photo example is not what is wanted so it needs to be updated for me to make the correct changes in this PR |
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.
Heyy @juliethangeldeveloper the code looks good to me. We mostly don't use the as
keyword here as we have everything strong typed but thats ok here.
I think what @monsieurtanuki means is to make a button out of the "Click here to download" but leave the disclaimer as a text, I agree that a button is better for usability but as this will only be seen by people using a wrong listing or a fake variant of the app thats fine.
In germany we have a saying which would translate to "That was a rough birth" thats applicable here. Still thanks for your effort @juliethangeldeveloper 🥳 |
@M123-dev Just to add on to make sure I clarify most of the code was provided for me when I join the open source talks. In this code, the keyboard |
What
Old deprecated app fix
Screenshot
Fixes bug(s)
https://github.com/orgs/openfoodfacts/projects/61/views/1
Part of