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: account removal reason issue #2585 #3258

Merged
merged 9 commits into from Nov 14, 2022

Conversation

Akashsri3bi
Copy link
Contributor

What

When user delete an account it should be asked the reason why it needs to be deleted.

###Fix
When user deletes an account a dialog asking the reason to delete the account that reason will then be pushed to mail that be sent .

@Akashsri3bi Akashsri3bi requested a review from a team as a code owner November 3, 2022 07:41
@AshAman999
Copy link
Member

Can you attach a screenshot or a video @Akashsri3bi ?

@Akashsri3bi
Copy link
Contributor Author

Yes sure !

@Akashsri3bi
Copy link
Contributor Author

Akashsri3bi commented Nov 3, 2022

@AshAman999 !

Screenshot_2022-11-03-15-36-35-95 1

Copy link
Member

@AshAman999 AshAman999 left a comment

Choose a reason for hiding this comment

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

Just a few changes @Akashsri3bi

type: TextFieldTypes.PLAIN_TEXT,
textInputType: TextInputType.text,
controller: reasonController,
hintText: 'Reasons'),
Copy link
Member

Choose a reason for hiding this comment

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

if you add the translations plz?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@AshAman999 from where can I add ?

crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
const Text(
'Are you sure you want to delete your account? \n Is there a specific reason share below '),
Copy link
Member

Choose a reason for hiding this comment

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

translations /

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes sure !

Copy link
Collaborator

Choose a reason for hiding this comment

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

  • Please remove unused spaces (at the beginning / end of each sentences)

children: <Widget>[
const Text(
'Are you sure you want to delete your account? \n Is there a specific reason share below '),
const SizedBox(
Copy link
Member

Choose a reason for hiding this comment

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

If you could avoid the hardcoded 5

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay I will see to it .

@teolemon
Copy link
Member

teolemon commented Nov 4, 2022

"Sharing the reason why gives us the opportunity to improve Open Food Facts for everyone"

crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
const Text(
'Are you sure you want to delete your account? \n Is there a specific reason share below '),
Copy link
Collaborator

Choose a reason for hiding this comment

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

  • Please remove unused spaces (at the beginning / end of each sentences)

final Email email = Email(
body: appLocalizations.email_body_account_deletion(userId),
body: appLocalizations.email_body_account_deletion(userId) +
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please concatenate the strings using this annotation: "${var1} ${var2}"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay @g123k !!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can someone tell from where to add translations ? @AshAman999 @g123k

Copy link
Member

Choose a reason for hiding this comment

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

app_en.arb

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay thanks !

Copy link
Contributor

Choose a reason for hiding this comment

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

Hot reload / hot restart refresh the appLocalizations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@monsieurtanuki I tried hot reload / restart but still can't access it

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess running flutter pub get should do the trick, too.

Copy link
Member

Choose a reason for hiding this comment

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

Otherwise flutter clean and then running the app

What I do in some cases is just commiting with it not working locally. When the tests pass this passes as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@teolemon teolemon added the 👥 User management Account login, signup, signout label Nov 6, 2022
@M123-dev M123-dev added this to the v4 milestone Nov 6, 2022
@github-actions github-actions bot added 🌐 l10n and removed 👥 User management Account login, signup, signout labels Nov 8, 2022
const SizedBox(
height: 5,
),
SmoothTextFormField(
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry to say that only now, but I don't think a one-line text field is appropriate to give the reason why you want to have your account deleted.
Given that we don't send emails but just open a new email on a mail app with pre-populated fields, I guess we would be better off pre-populating the email body with "Please give us the reason why you want your account to be deleted: ...", and let the user write inside the mail app (instead of a one-line text field).
Just my 2 cents. We can try with that one-line text-field, it's not such a common use case (at least I hope).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What needs to be done on my side ? Is the issue closed

Copy link
Member

Choose a reason for hiding this comment

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

I agree with you @monsieurtanuki , we open the email app anyways,
What you suggested makes more sense

What needs to be done on my side ? Is the issue closed

Perhaps we will need other pr with the changes that is requested here ,

It's more like a ux problem ,
@M123-dev @teolemon

Copy link
Contributor

Choose a reason for hiding this comment

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

@AshAman999 That's why we should exchange about issues at the issues level ("Which solutions make sense?"), and then exchange about the code at the PRs level.

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 @Akashsri3bi!
There's a big UX problem here: you've forgotten the "cancel" button.

@@ -305,8 +307,35 @@ class _UserPreferencesPageState extends State<UserPreferencesSection> {
_getListTile(
appLocalizations.account_delete,
() async {
await showDialog<SmoothAlertDialog>(
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be final String? reason = await showDialog<String>(.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@monsieurtanuki So reason string will be used in email ?

Copy link
Contributor

Choose a reason for hiding this comment

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

@monsieurtanuki So reason string will be used in email ?

@Akashsri3bi It is already, isn't it? If we think about something more refined for this "delete account" feature, it will be in another issue and another PR.

Comment on lines 330 to 333
positiveAction: SmoothActionButton(
text: appLocalizations.okay,
onPressed: () => Navigator.maybePop(context),
),
Copy link
Contributor

Choose a reason for hiding this comment

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

There should be a cancel button.
In this specific case, the labels should be not confusing at all, like an obvious "Delete account" button.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@monsieurtanuki @AshAman999 listing fixes I need to work on for this issue :

  1. Cancel button for ux
  2. Should be final String? reason = await showDialog<String>(
  3. Is there something I left here ?

Copy link
Contributor

Choose a reason for hiding this comment

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

@Akashsri3bi Also:

  • replacing that lazy "Okay" button with something more aggressive, like account_delete
  • probably rendering account_delete and cancel buttons as vertical

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@teolemon teolemon added the 👥 User management Account login, signup, signout label Nov 11, 2022
@github-actions github-actions bot removed the 👥 User management Account login, signup, signout label Nov 13, 2022
@codecov-commenter
Copy link

Codecov Report

Merging #3258 (ef52891) into develop (768a04a) will decrease coverage by 0.05%.
The diff coverage is 0.00%.

@@             Coverage Diff             @@
##           develop    #3258      +/-   ##
===========================================
- Coverage    10.51%   10.46%   -0.06%     
===========================================
  Files          249      252       +3     
  Lines        12283    12351      +68     
===========================================
  Hits          1292     1292              
- Misses       10991    11059      +68     
Impacted Files Coverage Δ
...ib/pages/preferences/user_preferences_account.dart 17.24% <0.00%> (-1.75%) ⬇️
...th_app/lib/background/background_task_details.dart 0.00% <0.00%> (-1.76%) ⬇️
...ooth_app/lib/pages/hunger_games/question_page.dart 1.06% <0.00%> (-0.03%) ⬇️
...ckages/smooth_app/lib/database/local_database.dart 0.00% <0.00%> (ø)
...ges/smooth_app/lib/pages/product/summary_card.dart 0.00% <0.00%> (ø)
...es/smooth_app/lib/pages/hunger_games/congrats.dart 0.00% <0.00%> (ø)
...es/smooth_app/lib/query/barcode_product_query.dart 0.00% <0.00%> (ø)
...smooth_app/lib/pages/product/new_product_page.dart 0.00% <0.00%> (ø)
...mooth_app/lib/pages/product/simple_input_page.dart 0.00% <0.00%> (ø)
...th_app/lib/pages/product/add_new_product_page.dart 0.00% <0.00%> (ø)
... and 17 more

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

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 @Akashsri3bi!
I think await showDialog<SmoothAlertDialog> does not make any sense; it should be something like

final String? reason = await showDialog<String>(
//...
  positiveAction: SmoothActionButton(
    text: appLocalizations.account_delete,
    onPressed: () async => Navigator.pop(context, reasonController.text),
  ),
  negativeAction: SmoothActionButton(
    text: appLocalizations.cancel,
    onPressed: () async => Navigator.pop(context),
  ),
// ...
);
if (reason != null) {
  sendEmail(reason);
}

But it's (maybe) a matter of taste.

What is more problematic is that you don't close the dialog window when you click "delete account".

@Akashsri3bi
Copy link
Contributor Author

Hi @Akashsri3bi! I think await showDialog<SmoothAlertDialog> does not make any sense; it should be something like

final String? reason = await showDialog<String>(
//...
  positiveAction: SmoothActionButton(
    text: appLocalizations.account_delete,
    onPressed: () async => Navigator.pop(context, reasonController.text),
  ),
  negativeAction: SmoothActionButton(
    text: appLocalizations.cancel,
    onPressed: () async => Navigator.pop(context),
  ),
// ...
);
if (reason != null) {
  sendEmail(reason);
}

But it's (maybe) a matter of taste.

What is more problematic is that you don't close the dialog window when you click "delete account".

okay I will try to make it like that !

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.

Thank you @Akashsri3bi, that's good!

@Akashsri3bi
Copy link
Contributor Author

Thank you @Akashsri3bi, that's good!

Welcome @monsieurtanuki !

@Akashsri3bi Akashsri3bi deleted the ak3 branch November 15, 2022 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

7 participants