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: #833 - dev mode #834

Merged
merged 6 commits into from
Jan 4, 2022

Conversation

monsieurtanuki
Copy link
Contributor

New file:

  • user_preferences_dev_mode.dart: Collapsed/expanded display of "dev mode" for the preferences page.

Impacted files:

  • forgot_password_page.dart: added a system to trigger the dev mode (click 10 times on the action button)
  • user_preferences.dart: added a getter/setter for dev mode
  • user_preferences_page.dart: display the dev mode options - if activated

Simulator Screen Shot - iPhone 8 Plus - 2022-01-03 at 18 25 52

New file:
* `user_preferences_dev_mode.dart`: Collapsed/expanded display of "dev mode" for the preferences page.

Impacted files:
* `forgot_password_page.dart`: added a system to trigger the dev mode (click 10 times on the action button)
* `user_preferences.dart`: added a getter/setter for dev mode
* `user_preferences_page.dart`: display the dev mode options - if activated
@teolemon
Copy link
Member

teolemon commented Jan 3, 2022

info • The import of 'package:flutter/cupertino.dart' is unnecessary because all of the used elements are also provided by the import of 'package:flutter/material.dart' • packages/smooth_app/lib/pages/user_management/forgot_password_page.dart:1:8 • unnecessary_import

@@ -1,7 +1,9 @@
import 'package:flutter/cupertino.dart';
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
import 'package:flutter/cupertino.dart';

Impacted files:
* `attributes_card_helper.dart`
* `forgot_password_page.dart`
* `product_cards_helper.dart`
* `score_card_helper.dart`
* `smooth_reveal_animation.dart`
* `svg_icon_chip.dart`
@monsieurtanuki
Copy link
Contributor Author

No more useless cupertino imports now!

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 @monsieurtanuki. that is definitely something we can build on later.

Comment on lines 96 to 99
set devMode(final int value) =>
_sharedPreferences.setInt(_TAG_DEV_MODE, value);

int get devMode => _sharedPreferences.getInt(_TAG_DEV_MODE) ?? 0;
Copy link
Member

@M123-dev M123-dev Jan 3, 2022

Choose a reason for hiding this comment

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

For consistency please either all get/set or all methods

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Too bad the dart setter syntax does not work with async.

Comment on lines 96 to 99
set devMode(final int value) =>
_sharedPreferences.setInt(_TAG_DEV_MODE, value);

int get devMode => _sharedPreferences.getInt(_TAG_DEV_MODE) ?? 0;
Copy link
Member

@M123-dev M123-dev Jan 3, 2022

Choose a reason for hiding this comment

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

Why not a bool instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Of course a bool would do the job in a first approach, but in my experience I noticed that sometimes we're stuck with a bool when we want to upgrade the app to something more elaborate. An int is safer.

Impacted files:
* `forgot_password_page.dart`
* `user_preferences.dart`
* `user_preferences_dev_mode.dart`
@monsieurtanuki monsieurtanuki merged commit 0a267d8 into openfoodfacts:develop Jan 4, 2022
@monsieurtanuki
Copy link
Contributor Author

Thank you @M123-dev for your code review!
Now we're ready to fix (at least) #826 #812 #782.

@monsieurtanuki monsieurtanuki mentioned this pull request Jan 4, 2022
@teolemon teolemon mentioned this pull request Jan 4, 2022
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.

3 participants