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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use PreferenceKeys file to manage SharedPreferences keys. #891

Merged
merged 8 commits into from Jun 30, 2020

Conversation

Skrilltrax
Copy link
Member

@Skrilltrax Skrilltrax commented Jun 27, 2020

馃摙 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates

馃摐 Description

Let's just stop using raw strings :)

馃挕 Motivation and Context

Less chances of breaking code due to mistakes in typing strings again

馃挌 How did you test it?

Ran the app and changed a few settings. Still needs one more round of testing though.

馃摑 Checklist

  • I formatted the code with the IDE's reformat action (Ctrl + Shift + L/Cmd + Shift + L)
  • I reviewed submitted code
  • I added a CHANGELOG entry if applicable

馃敭 Next steps

Port viscerion's application preferences.

馃摳 Screenshots / GIFs

@Skrilltrax Skrilltrax changed the title Use PreferenceKeys file to manage SharedPreferences keys. WIP: Use PreferenceKeys file to manage SharedPreferences keys. Jun 27, 2020
msfjarvis
msfjarvis previously approved these changes Jun 27, 2020
@msfjarvis msfjarvis added the code label Jun 27, 2020
@msfjarvis msfjarvis added this to the 1.10.0 milestone Jun 27, 2020
@Skrilltrax Skrilltrax changed the title WIP: Use PreferenceKeys file to manage SharedPreferences keys. Use PreferenceKeys file to manage SharedPreferences keys. Jun 27, 2020
@Skrilltrax
Copy link
Member Author

I think I've updated all the references of the keys. I've updated the PreferenceKeys with region and endregion, do let me know if you don't like it in the codebase.

@msfjarvis
Copy link
Member

I think I've updated all the references of the keys. I've updated the PreferenceKeys with region and endregion, do let me know if you don't like it in the codebase.

I'm not a huge fan of the comments so I'd prefer reverting it. Also bring your branch up-to-date with develop since that's enforced by branch protection.

@msfjarvis
Copy link
Member

Completely missed some files, and PasswordStore.kt has a PREFERENCE_SEEN_AUTOFILL_ONBOARDING field that needs to go into PreferenceKeys as well.

app/src/main/java/com/zeapo/pwdstore/Application.kt:        AppCompatDelegate.setDefaultNightMode(when (prefs?.getString("app_theme", getString(R.string.app_theme_def))) {
app/src/main/java/com/zeapo/pwdstore/crypto/DecryptActivity.kt:                            val showPassword = settings.getBoolean("show_password", true)
app/src/main/java/com/zeapo/pwdstore/crypto/DecryptActivity.kt:                            val showExtraContent = settings.getBoolean("show_extra_content", true)
app/src/main/java/com/zeapo/pwdstore/crypto/DecryptActivity.kt:                            if (settings.getBoolean("copy_on_decrypt", true)) {
app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.kt:        val defValue = if (settings!!.getBoolean(PreferenceKeys.AUTOFILL_DEFAULT, true)) "/first" else "/never"
app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.kt:        // if autofill_default is checked and prefs.getString DNE, 'Automatically match with password'/"first" otherwise "never"
app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.kt:        val defValue = if (settings!!.getBoolean("autofill_default", true)) "/first" else "/never"
app/src/main/java/com/zeapo/pwdstore/autofill/AutofillService.kt:                        val ttl = Integer.parseInt(settings!!.getString(PreferenceKeys.GENERAL_SHOW_TIME, "45")!!)

@Skrilltrax
Copy link
Member Author

Oh thanks, I'll revisit all the files again. IntelliJ's search results aren't that good when you have 100+ matching items.

Signed-off-by: Aditya Wasan <adityawasan55@gmail.com>
Signed-off-by: Aditya Wasan <adityawasan55@gmail.com>
Signed-off-by: Aditya Wasan <adityawasan55@gmail.com>
Signed-off-by: Aditya Wasan <adityawasan55@gmail.com>
Signed-off-by: Aditya Wasan <adityawasan55@gmail.com>
Signed-off-by: Aditya Wasan <adityawasan55@gmail.com>
msfjarvis
msfjarvis previously approved these changes Jun 30, 2020
Copy link
Member

@msfjarvis msfjarvis left a comment

Choose a reason for hiding this comment

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

LGTM

@msfjarvis msfjarvis self-requested a review June 30, 2020 17:36
Signed-off-by: Aditya Wasan <adityawasan55@gmail.com>
fmeum
fmeum previously approved these changes Jun 30, 2020
Signed-off-by: Aditya Wasan <adityawasan55@gmail.com>
@msfjarvis msfjarvis merged commit 82a9a61 into develop Jun 30, 2020
@msfjarvis msfjarvis deleted the refactor/prefs-keys branch June 30, 2020 18:30
msfjarvis added a commit that referenced this pull request Jul 1, 2020
* develop:
  Scroll to files and enter folders when created (#909)
  Run a treewide reformat (#908)
  Improve how secrets and stored and used (#907)
  Improve and refactor Autofill heuristics (#905)
  Use PreferenceKeys file to manage SharedPreferences keys. (#891)
  Bump version
  Prepare release 1.9.2
  update changelog
  Workaround to prevent crash on first run (#898)
  build: bump version
  Prepare release 1.9.1
  Backport Actions fixes (#894)
  Remove API 30 from pull request test matrix (#879)
  CHANGELOG: reword to better clarify fixes
  Prevent cached passwords from being wiped (#884)
  Use remembered credential even if it is empty (#880)
  Reset SSH passphrase after SSH key import (#885)
  Add relnotes for #871 (#872)
  Add org.gnu.icecat as a trusted multi-origin browser (#871)
msfjarvis added a commit to fmeum/Android-Password-Store that referenced this pull request Jul 1, 2020
* develop: (62 commits)
  Scroll to files and enter folders when created (android-password-store#909)
  Run a treewide reformat (android-password-store#908)
  Improve how secrets and stored and used (android-password-store#907)
  Improve and refactor Autofill heuristics (android-password-store#905)
  Use PreferenceKeys file to manage SharedPreferences keys. (android-password-store#891)
  Revert "Support directly importing secrets" (android-password-store#904)
  Allow importing TOTP configuration through QR codes (android-password-store#903)
  Bump version
  Prepare release 1.9.2
  update changelog
  Workaround to prevent crash on first run (android-password-store#898)
  Workaround to prevent crash on first run (android-password-store#898)
  Offer TOTP Autofill for OTP fields (android-password-store#899)
  Merge SshKeyGenFragment into its activity (android-password-store#897)
  Reintroduce TOTP support (android-password-store#890)
  Sync with release branch (android-password-store#896)
  build: bump version
  Prepare release 1.9.1
  Backport Actions fixes (android-password-store#894)
  Rework GitHub Actions (android-password-store#893)
  ...
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.

None yet

3 participants