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: web account deletion #3416

Merged

Conversation

Pierre-Monier
Copy link
Contributor

What

  • Add a webview for account deletion
  • Write test to verify behaviour
  • Update Android CompiledSdk version to 33 (because of flutter_webview dependency)
  • Add parameter to UserManagementProvider.mountCredentials, to easily mock global user for test

Screenshot

Screenshot 2022-12-07 at 17 39 40

Fixes bug(s)

@codecov-commenter
Copy link

codecov-commenter commented Dec 7, 2022

Codecov Report

Merging #3416 (5c5091f) into develop (7f0b0d3) will increase coverage by 1.03%.
The diff coverage is 88.57%.

@@             Coverage Diff             @@
##           develop    #3416      +/-   ##
===========================================
+ Coverage    10.32%   11.36%   +1.03%     
===========================================
  Files          260      260              
  Lines        12596    12559      -37     
===========================================
+ Hits          1301     1427     +126     
+ Misses       11295    11132     -163     
Impacted Files Coverage Δ
..._app/lib/data_models/user_management_provider.dart 5.26% <50.00%> (+5.26%) ⬆️
...ib/pages/preferences/account_deletion_webview.dart 92.59% <92.59%> (ø)
...ib/pages/preferences/user_preferences_account.dart 60.89% <100.00%> (+43.75%) ⬆️
packages/smooth_app/lib/pages/image_crop_page.dart 0.00% <0.00%> (-1.36%) ⬇️
...ckages/smooth_app/lib/tmp_crop_image/rotation.dart 2.50% <0.00%> (-0.36%) ⬇️
...s/smooth_app/lib/tmp_crop_image/new_crop_page.dart 0.00% <0.00%> (ø)
...mooth_app/lib/pages/product/simple_input_page.dart 0.00% <0.00%> (ø)
...th_app/lib/pages/product/product_image_viewer.dart 0.00% <0.00%> (ø)
...pp/lib/tmp_crop_image/rotated_crop_controller.dart 0.00% <0.00%> (ø)
...b/pages/preferences/user_preferences_dev_mode.dart 0.00% <0.00%> (ø)
... and 13 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@teolemon teolemon requested a review from M123-dev December 8, 2022 16:42
@VaiTon
Copy link
Member

VaiTon commented Dec 9, 2022

Just an idea, but maybe it's better if we hide the app bar (the one at the bottom), @teolemon ?

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 and thanks @Pierre-Monier the code looks good. Just one little code related comment.

The others are more general especially openfoodfacts/openfoodfacts-server#7825 is somewhat not good. If I'm not the only one expierencing this problem we should probably comment out the localization and just always use the englisch version. That shouldn't be a problem because of the autofill.

Besides that everything looks great 🥳

AccountDeletionWebviewState createState() => AccountDeletionWebviewState();
}

class AccountDeletionWebviewState extends State<AccountDeletionWebview> {
Copy link
Member

Choose a reason for hiding this comment

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

This class should be private

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep the english version looks like the only one work, stick to english smarter ^^

},
"account_deletion_path_segment": "account-deletion",
"@account_deletion_path_segment": {
"description": "Path segment of the url open in a webview open when the user wants to delete his account"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"description": "Path segment of the url open in a webview open when the user wants to delete his account"
"description": "Path segment of the url open in a webview open when the user wants to delete his account, go to "https://blog.openfoodfacts.org/en/account-deletion" and choose your language on the top right. Use the text behind the last "/"

Comment on lines +45 to +49
'your-subject': subject,
if (userId != null && userId.isEmail)
'your-mail': userId
else if (userId != null)
'your-name': userId
Copy link
Member

Choose a reason for hiding this comment

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

I wanted to check if they need to be localized too, (hopefully not) though it seems the account deletion form is currently only available in english

Comment on lines 61 to 63
body: WebView(
initialUrl: _getUrl(userPreferences),
),
Copy link
Member

Choose a reason for hiding this comment

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

What happens when the user deleted his account. The webview stay open?

Copy link
Contributor Author

@Pierre-Monier Pierre-Monier Dec 9, 2022

Choose a reason for hiding this comment

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

Currently yes, I think it's hard to detect when the user has delete his account. The page doesn't switch url when deletion is done. So the only way is to watch html content but this is clearly overkill. Note that the form doesn't directly delete the account.

One good question is if the user delete his account, it should be remove from localStorage, I think it's not the case now (but I havn't check deeply)

@monsieurtanuki
Copy link
Contributor

Just an idea, but maybe it's better if we hide the app bar (the one at the bottom), @teolemon ?

@VaiTon cf. #3337

@teolemon
Copy link
Member

teolemon commented Dec 9, 2022

yeah, why not ?

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.

Looks good, thanks for the quick iteration @Pierre-Monier

I agree we don't need the app bar but as it's really not that simple to remove it lets just keep it like that

@M123-dev M123-dev merged commit 61d9f39 into openfoodfacts:develop Dec 9, 2022
@monsieurtanuki
Copy link
Contributor

Hi @Pierre-Monier!

Just curious: was there a specific need for a WebView, instead of just letting the app open an URL in whatever browser is available?

I'm asking because

  1. I don't see the added-value (but I could live with that)
  2. That's the only place in the app where we use WebView, so we embed a additional packages with different behavior in iOS and android for an allegedly useless reason in a very very rare case
  3. With the upgrade to flutter 3.7, there were some breaking changes in WebView (but I guess we could fix that) (not me currently, but that's another story)

@M123-dev
Copy link
Member

M123-dev commented Feb 3, 2023

@monsieurtanuki it was tangling around with Apple. They force to provide a native way to delete the account. We were near an update block until we provided that 😬

@monsieurtanuki
Copy link
Contributor

Thank you @M123-dev for your answer!

Not very convinced we have a good solution now, as we cannot pre-populate the language and the first 3 fields are a bit mysterious:
Capture d’écran 2023-02-04 à 14 09 25

I would prefer a flutter solution to android and ios solutions. That said, that's not a priority.
What is a priority is setting the right init parameters for WebView in packages/smooth_app/lib/pages/preferences/account_deletion_webview.dart since my recent PR (#3666).
@M123-dev Could you please have a look at it?

@M123-dev
Copy link
Member

M123-dev commented Feb 4, 2023

I can, though first mid next week

Could you create a small issue just to keep track

@teolemon teolemon added the 👥 User management Account login, signup, signout label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Turn account deletion into a web experience
7 participants