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 Space Switcher avatars #7306

Merged
merged 1 commit into from
Jan 26, 2023
Merged

Fix Space Switcher avatars #7306

merged 1 commit into from
Jan 26, 2023

Conversation

pixlwave
Copy link
Member

@pixlwave pixlwave commented Jan 26, 2023

Fixes #7305. The view model is now injected at a top level and shared across multiple avatars so no longer works with the state being held within the model. As this is a lightweight component it seems reasonable to me to move it to an @State variable within the view itself.

Note: Also fixes the same bug in user suggestions and possibly elsewhere in SwiftUI.

Before After
Simulator Screen Shot - iPhone 14 - 2023-01-26 at 12 02 13 Simulator Screen Shot - iPhone 14 - 2023-01-26 at 11 56 40

@@ -22,14 +22,22 @@ import Foundation
final class AvatarViewModel: ObservableObject {
Copy link
Member Author

@pixlwave pixlwave Jan 26, 2023

Choose a reason for hiding this comment

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

Maybe at this stage we should rename this to AvatarLoader/AvatarProvider?

@codecov
Copy link

codecov bot commented Jan 26, 2023

Codecov Report

Base: 11.97% // Head: 11.98% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (4f61755) compared to base (06c572e).
Patch coverage: 73.33% of modified lines in pull request are covered.

Additional details and impacted files
@@              Coverage Diff               @@
##           hotfix/1.9.16    #7306   +/-   ##
==============================================
  Coverage          11.97%   11.98%           
==============================================
  Files               1634     1634           
  Lines             161034   161045   +11     
  Branches           65131    65159   +28     
==============================================
+ Hits               19291    19301   +10     
- Misses            141101   141102    +1     
  Partials             642      642           
Flag Coverage Δ
uitests 55.36% <73.33%> (+0.02%) ⬆️
unittests 5.95% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
.../Modules/Common/Avatar/View/SpaceAvatarImage.swift 39.72% <54.54%> (+1.49%) ⬆️
...ules/Common/Avatar/ViewModel/AvatarViewModel.swift 90.00% <90.90%> (-2.86%) ⬇️
...iftUI/Modules/Common/Avatar/View/AvatarImage.swift 71.42% <91.66%> (+0.24%) ⬆️
...ingViewer/LiveLocationSharingViewerViewModel.swift 54.38% <0.00%> (+1.75%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@alfogrillo alfogrillo left a comment

Choose a reason for hiding this comment

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

LGTM! 🎉

I'm not sure why we need both SpaceAvatarImage and AvatarImage.
But it isn't really related with this PR.

@pixlwave pixlwave merged commit 487347a into hotfix/1.9.16 Jan 26, 2023
@pixlwave pixlwave deleted the doug/space-switcher branch January 26, 2023 16:16
@pixlwave
Copy link
Member Author

I'm not sure why we need both SpaceAvatarImage and AvatarImage. But it isn't really related with this PR.

Yeah they could share more code for sure - at a component level its because space avatars are square and normal ones are round though.

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.

2 participants