-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Update user details view #23777
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
Update user details view #23777
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
89c5a55
Remove an unused API
crazytonyli bccddb7
Change argument from CGSize to CGFloat
crazytonyli eca4f44
Make UserProfileImage display circular avatar
crazytonyli 3d528a7
Display the largest avatar (96x96px)
crazytonyli 7764c6f
Add previews for loading and error state
crazytonyli 8ea5dc6
Set users list background color
crazytonyli f661694
Add UserListViewModel.onAppear to avoid repeatedly fetching users
crazytonyli 126f765
Use the `name` REST API field for "Display Name"
crazytonyli bf06766
Update user details view
crazytonyli f6c6f7c
Show 'Users' entry in the WordPress app
crazytonyli 904a8f2
Update an list search API
crazytonyli 40bed61
Replace deprecated sizeCategory with dynamicTypeSize
crazytonyli 86f7c54
Update users searchable strings
crazytonyli 82273ca
Add private(set) to some View Model properties
crazytonyli b0c1443
Remove an unnecessary os version check
crazytonyli 7f9b87c
Update localized string keys
crazytonyli 2caa0ae
Rename UserDetailView to UserDetailsView
crazytonyli c8778ba
Fix a typo
crazytonyli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,22 +52,17 @@ public struct DisplayUser: Identifiable, Codable { | |
| profilePhotoUrl: URL(string: "https://gravatar.com/avatar/58fc51586c9a1f9895ac70e3ca60886e?size=256"), | ||
| role: "administrator", | ||
| emailAddress: "[email protected]", | ||
| websiteUrl: "", | ||
| biography: "" | ||
| websiteUrl: "https://example.com", | ||
| biography: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat." | ||
| ) | ||
| } | ||
|
|
||
| extension DisplayUser: StringRankedSearchable { | ||
| public var searchString: String { | ||
|
|
||
| extension DisplayUser { | ||
| var searchString: String { | ||
| // These are in ranked order – the higher something is in the list, the more heavily it's weighted | ||
| [ | ||
| handle, | ||
| username, | ||
| firstName, | ||
| lastName, | ||
| emailAddress, | ||
| displayName, | ||
| username, | ||
| emailAddress, | ||
| ] | ||
| .compactMap { $0 } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please replace this with
AvatarView.AsyncImageshould basically never be used.AvatarVieworAsyncImageVieware currently unavailable inWordPressUIas they are part of the app target. ButUserProfile*don't belong toWordPressUIas it's designed for reusable components. It should be small and should compile fast as, in the long term, more modules will depend on it.I suggest the following changes:
WordPressMediaframework (or similar name) withImageDownloader– other media-related stuff could go there later too.AvatarViewandAsyncImageViewto eitherWordPressUIorWordPressMediaIf we keep adding everything to
WordPressUI, it will eventually stop working well for Xcode Previews as these tend to become unusable with 10K+ lines in a module. The only long-term option if we want to facilitate Xcode Previews is to create feature-based modules (aka app micro modules). Since we are now fully in the SPM world, it should be feasible, so it might be a good time to start.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I forgot to reply to your original comment about
AsyncImage.Shall I just move the new user management code to the app target for now? So that the
AvatarViewandImageDownloaderstuff (I don't think we need it for this particular feature) will be available. /cc @jkmasselThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's address it separately. I'm going to add the approval as is.