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

fix: Add a nudge in home for people still using org.openfoodfact.app fixes #2979 #3030

Merged
merged 7 commits into from
Oct 3, 2022

Conversation

juliethangeldeveloper
Copy link
Collaborator

What

Old deprecated app fix

  • added the code to check if a user is using an older version of the app and a button to update the app

Screenshot

Screenshot_1663364156

Fixes bug(s)

https://github.com/orgs/openfoodfacts/projects/61/views/1

  • Fixes: People who were still using the org.openfoodfact.app

Part of

@juliethangeldeveloper juliethangeldeveloper requested a review from a team as a code owner September 16, 2022 22:43
@juliethangeldeveloper juliethangeldeveloper changed the title Deprecated app fix #2979 fix deprecated app fix #2979 Sep 16, 2022
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 @juliethangeldeveloper!
Please have a look at my comments.

Comment on lines 559 to 566
"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"
},
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
"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 {
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
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>(
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
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) {
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 instead something like data.connectionState == ConnectionState.done && data.data == null.
The is syntax should be avoided.

Copy link
Collaborator Author

@juliethangeldeveloper juliethangeldeveloper Sep 17, 2022

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,
),)),
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
),)),
),),),

Comment on lines 347 to 348
child: Text(
'${localizations.depricatedHeader} ${localizations.clickHereToDownload}',
Copy link
Contributor

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.

Copy link
Collaborator Author

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.

Copy link
Contributor

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(
Copy link
Contributor

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 ;)

Copy link
Collaborator Author

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 {
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
Future<bool> _openAppStore() async {
Future<void> _openAppStore() async {

Copy link
Contributor

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.

@teolemon teolemon changed the title fix deprecated app fix #2979 fix: Add a nudge in home for people still using org.openfoodfact.app fixes #2979 Sep 26, 2022
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 @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",
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
"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) {
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
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) {
Copy link
Contributor

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.

Comment on lines 347 to 348
child: Text(
'${localizations.depricatedHeader} ${localizations.clickHereToDownload}',
Copy link
Contributor

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 {
Copy link
Contributor

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.

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 @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,
Copy link
Contributor

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?

Copy link
Collaborator Author

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,
Copy link
Contributor

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 Texts in red. Just don't specify a color.

Copy link
Collaborator Author

@juliethangeldeveloper juliethangeldeveloper Oct 2, 2022

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(
Copy link
Contributor

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 Texts.
For this specific case, I suggest a SmoothSimpleButton with red background and white text.

Comment on lines +563 to +566
"click_here": "Click here",
"@click_here": {
"description": "Confirmation click to download new version of the app"
},
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
"click_here": "Click here",
"@click_here": {
"description": "Confirmation click to download new version of the app"
},

Comment on lines 346 to 351
Text(
localizations.download_new_version,
textAlign: TextAlign.center,
style: const TextStyle(
color: Colors.red,
),),
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
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".

Copy link
Collaborator Author

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

Copy link
Contributor

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,
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
localizations.click_here,
localizations.download_new_version,

@juliethangeldeveloper
Copy link
Collaborator Author

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

Copy link
Member

@M123-dev M123-dev left a 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.

@M123-dev M123-dev merged commit 74cb804 into openfoodfacts:develop Oct 3, 2022
@M123-dev
Copy link
Member

M123-dev commented Oct 3, 2022

In germany we have a saying which would translate to "That was a rough birth" thats applicable here. Still thanks for your effort @juliethangeldeveloper 🥳

@juliethangeldeveloper
Copy link
Collaborator Author

@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 as was in there and I just added to display on the screen. That's why all the comments did not make sense. Thanks for closing it and resolving the issues

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.

5 participants