8000 [BITAU-149] Add Setting to Turn On Authenticator Syncing for an Account by brant-livefront · Pull Request #957 · bitwarden/ios · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[BITAU-149] Add Setting to Turn On Authenticator Syncing for an Account #957

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

Merged
merged 8 commits into from
Sep 26, 2024

Conversation

brant-livefront
Copy link
Collaborator

🎟️ Tracking

[BITAU-149]

📔 Objective

This PR adds a syncToAuthenticator setting that will allow the sync to be turned on/off for specific accounts in the BW PM app. It was very closely modeled after all of the connectToWatch pieces. There is no UI to turn this on (that will be added last), but putting this in now allows us to begin hooking off the setting when doing the sync.

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

Copy link
Contributor
github-actions bot commented Sep 20, 2024

Logo
Checkmarx One – Scan Summary & Details80f09778-0fae-4148-b346-1eb4a7cd166d

No New Or Fixed Issues Found

Copy link
codecov bot commented Sep 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.77%. Comparing base (ad3cf96) to head (74c1de8).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #957   +/-   ##
=======================================
  Coverage   88.76%   88.77%           
=======================================
  Files         638      638           
  Lines       40087    40129   +42     
=======================================
+ Hits        35585    35625   +40     
- Misses       4502     4504    +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator
@victor-livefront victor-livefront left a comment

Choose a reason for hiding this comment

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

This looks good to me!

Comment on lines +1826 to +1829
XCTAssertEqual(publishedValues[0].userId, "1")
XCTAssertEqual(publishedValues[0].shouldSync, true)
XCTAssertEqual(publishedValues[1].userId, "1")
XCTAssertEqual(publishedValues[1].shouldSync, false)
Copy link
Member

Choose a reason for hiding this comment

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

🎨 You can use == operator to reduce this a bit more:

Suggested change
XCTAssertEqual(publishedValues[0].userId, "1")
XCTAssertEqual(publishedValues[0].shouldSync, true)
XCTAssertEqual(publishedValues[1].userId, "1")
XCTAssertEqual(publishedValues[1].shouldSync, false)
XCTAssertTrue(publishedValues[0] == (userId: "1", shouldSync: false))
XCTAssertTrue(publishedValues[1] == (userId: "1", shouldSync: true))

Copy link
Contributor

Choose a reason for hiding this comment

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

The downside of doing XCTAssertTrue( == ) is that the failure message just says "they're not equal", whereas if you use XCTAssertEqual the failure message indicates the value of the variable, so you can better figure out why a test might be failing. IMO you should aim for the XCTAssertEquals, XCTAssertLessThan, and XCTAssertGreaterThan functions as much as possible for this reason.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, good call. Update all of them to this style in latest. 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry, didn't see @KatherineInCode's comment when I updated. Let me know which one y'all prefer. I'm good either way.

Copy link
Contributor

Choose a reason for hiding this comment

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

@brant-livefront Let's go with the XCTAssertEquals approach. Depending on how often we need to check the tuple in tests, a custom assertion function might also be helpful.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@KatherineInCode Sounds good, I'll roll back to using explicit XCTAssertEquals.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@KatherineInCode this is updated in the latest commit. 👍

@brant-livefront
Copy link
Collaborator Author

@fedemkr @KatherineInCode Just a reminder to let me know which direction you want to go on this (XCTAssertTrue vs XCTAssertEqual). I have another PR that I'd like to put up, but it's dependent on the stuff in this PR. So I'm waiting to put that up until we solve this. Thanks!

Copy link
Collaborator
@victor-livefront victor-livefront left a comment

Choose a reason for hiding this comment

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

Updates look good to me.

@brant-livefront brant-livefront merged commit c20c8b3 into main Sep 26, 2024
9 checks passed
@brant-livefront brant-livefront deleted the brant/add-authenticator-sync-setting branch September 26, 2024 13:41
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.

4 participants
0