[PR #2213] [MERGED] [EC-759] Add avatar header Apple Watch MVP #40522

Closed
opened 2026-04-23 19:20:46 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/2213
Author: @fedemkr
Created: 12/1/2022
Status: Merged
Merged: 12/1/2022
Merged by: @fedemkr

Base: feature/apple-watch-mvpHead: feature/EC-759-apple-watch-mvp-account-header


📝 Commits (1)

  • 6c479d4 EC-759 Added avatar row on cipher list header to display avatar icon and email

📊 Changes

6 files changed (+205 additions, -49 deletions)

View changed files

src/watchOS/bitwarden/bitwarden WatchKit Extension/Controls/AvatarView.swift (+85 -0)
📝 src/watchOS/bitwarden/bitwarden WatchKit Extension/Utilities/ColorUtils.swift (+49 -0)
📝 src/watchOS/bitwarden/bitwarden WatchKit Extension/Utilities/StringExtensions.swift (+9 -0)
📝 src/watchOS/bitwarden/bitwarden WatchKit Extension/ViewModels/CipherListViewModel.swift (+1 -1)
📝 src/watchOS/bitwarden/bitwarden WatchKit Extension/Views/CipherListView.swift (+57 -48)
📝 src/watchOS/bitwarden/bitwarden.xcodeproj/project.pbxproj (+4 -0)

📄 Description

Type of change

  • Bug fix
  • New feature development
  • Tech debt (refactoring, code cleanup, dependency upgrades, etc)
  • Build/deploy pipeline (DevOps)
  • Other

Objective

Add avatar header on Apple Watch

Code changes

  • AvatarView: Custom view to display the avatar icon (Circle with the letters inside)
  • ColorUtils: Some utils to init a Color from a hex string and also to get its RGBA components
  • StringExtensions: Added extension to add left padding on a string
  • CipherListViewModel: Fix issue on the state check
  • CipherListView: Removed outer VStack and added section for the user avatar header

Additional notes

AvatarView is an adaptation from AvatarImageSource of the iPhone application. One caveat to take into consideration was when dealing with bitwise operations and overflow c# handles it internally by going to an unchecked context while in swift you need to mark the operation explicitly.
So what in C# is:

(hash << 5) - hash

In swift we need to explicitly say how the overflow needs to be handled (More here in Overflow Operators):

(hash << 5) &- hash

Screenshots

Apple Watch Account Header

Before you submit

  • Please check for formatting errors (dotnet format --verify-no-changes) (required)
  • Please add unit tests where it makes sense to do so (encouraged but not required)
  • If this change requires a documentation update - notify the documentation team
  • If this change has particular deployment requirements - notify the DevOps team

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bitwarden/android/pull/2213 **Author:** [@fedemkr](https://github.com/fedemkr) **Created:** 12/1/2022 **Status:** ✅ Merged **Merged:** 12/1/2022 **Merged by:** [@fedemkr](https://github.com/fedemkr) **Base:** `feature/apple-watch-mvp` ← **Head:** `feature/EC-759-apple-watch-mvp-account-header` --- ### 📝 Commits (1) - [`6c479d4`](https://github.com/bitwarden/android/commit/6c479d4415dd98f6d703ae1ed4c198ce4eedb879) EC-759 Added avatar row on cipher list header to display avatar icon and email ### 📊 Changes **6 files changed** (+205 additions, -49 deletions) <details> <summary>View changed files</summary> ➕ `src/watchOS/bitwarden/bitwarden WatchKit Extension/Controls/AvatarView.swift` (+85 -0) 📝 `src/watchOS/bitwarden/bitwarden WatchKit Extension/Utilities/ColorUtils.swift` (+49 -0) 📝 `src/watchOS/bitwarden/bitwarden WatchKit Extension/Utilities/StringExtensions.swift` (+9 -0) 📝 `src/watchOS/bitwarden/bitwarden WatchKit Extension/ViewModels/CipherListViewModel.swift` (+1 -1) 📝 `src/watchOS/bitwarden/bitwarden WatchKit Extension/Views/CipherListView.swift` (+57 -48) 📝 `src/watchOS/bitwarden/bitwarden.xcodeproj/project.pbxproj` (+4 -0) </details> ### 📄 Description ## Type of change - [ ] Bug fix - [X] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [ ] Other ## Objective <!--Describe what the purpose of this PR is. For example: what bug you're fixing or what new feature you're adding--> Add avatar header on Apple Watch ## Code changes <!--Explain the changes you've made to each file or major component. This should help the reviewer understand your changes--> <!--Also refer to any related changes or PRs in other repositories--> * **AvatarView:** Custom view to display the avatar icon (Circle with the letters inside) * **ColorUtils:** Some utils to init a `Color` from a `hex` string and also to get its RGBA components * **StringExtensions:** Added extension to add left padding on a string * **CipherListViewModel:** Fix issue on the state check * **CipherListView:** Removed outer `VStack` and added section for the user avatar header ### Additional notes `AvatarView` is an adaptation from `AvatarImageSource` of the iPhone application. One caveat to take into consideration was when dealing with bitwise operations and overflow c# handles it [internally](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/statements/checked-and-unchecked#default-overflow-checking-context) by going to an `unchecked` context while in swift you need to mark the operation explicitly. So what in C# is: ```c# (hash << 5) - hash ``` In swift we need to explicitly say how the overflow needs to be handled (More [here](https://docs.swift.org/swift-book/LanguageGuide/AdvancedOperators.html) in Overflow Operators): ```swift (hash << 5) &- hash ``` ## Screenshots <!--Required for any UI changes. Delete if not applicable--> <img width="250" alt="Apple Watch Account Header" src="https://user-images.githubusercontent.com/15682323/205153956-10401177-4b1d-40b9-9f76-55ee949ec014.png"> ## Before you submit - Please check for formatting errors (`dotnet format --verify-no-changes`) (required) - Please add **unit tests** where it makes sense to do so (encouraged but not required) - If this change requires a **documentation update** - notify the documentation team - If this change has particular **deployment requirements** - notify the DevOps team --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-23 19:20:46 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#40522