-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Self-hosted user UI #21275
Merged
Merged
Self-hosted user UI #21275
Changes from 70 commits
Commits
Show all changes
71 commits
Select commit
Hold shift + click to select a range
b877d80
First pass at copying users from rs example app
nbradbury 7ecfd02
First pass at user list screen
nbradbury d51bc76
First pass at user list screen
nbradbury e2d80b2
Minor tweaks
nbradbury 027adcf
Changed to FeatureConfig
nbradbury 876f567
Use isEnabled
nbradbury 14d6da5
Added activity to manifest
nbradbury cc4e2c7
Added test account
nbradbury 5c8da51
Updated from prior branch
nbradbury eb703ed
Fleshed out viewModel and user list screen
nbradbury 05caacf
Fleshed out viewModel and user list screen
nbradbury 5dffecc
Temporarily removed test account data
nbradbury b6f083e
Added user icon
nbradbury 0d2c70b
Renamed val
nbradbury 09b88e8
Expand sample user list
nbradbury defb4b1
Mimic existing people layour
nbradbury 6feee8b
Added dividers
nbradbury 0fafc7b
Moved avatar to it's own composable
nbradbury c9fe06a
Converted to use LazyRow
nbradbury ba74377
Added even more sample users
nbradbury a59abb3
Reworked sample users to resolve SonarCloud warnings
nbradbury d3ef147
Added third sample user with multiple roles
nbradbury 7434664
Merge branch 'trunk' into issue/self-hosted-userlist
nbradbury 9e85e4a
Merge remote-tracking branch 'origin/issue/self-hosted-userlist' into…
nbradbury 16e28ae
Fixed detekt warnings
nbradbury 1e1ba0e
Fixed failing test
nbradbury fdc882e
Assign unique IDs
nbradbury 80111cb
Added getSampleUserById
nbradbury a307286
Simplified onCloseClick
nbradbury 10c9a0b
Added onUserClick
nbradbury 2079e24
Refined onUserClick
nbradbury 1f87535
Created UserComposables for re-using Composables
nbradbury 374aeb6
Minor tweaks
nbradbury 224f6ee
Merge branch 'issue/self-hosted-userlist' of https://github.com/wordp…
nbradbury d5f646b
Resolved conflicts
nbradbury 8b5414c
Reworked self hosted user screen to make future screens easier to add
nbradbury 54469ea
Updated manifest
nbradbury f87c7b4
Merge branch 'issue/self-hosted-userlist' of https://github.com/wordp…
nbradbury 3835a7b
Added user click event
nbradbury 68d12ee
Handle onUserClick
nbradbury fc5422d
Use separate close icon for detail, go back to user list when leaving…
nbradbury 4f5adeb
First pass at detail
nbradbury fb003fb
Second pass at detail
nbradbury 5cc702d
Third pass at detail
nbradbury ae58458
Merge branch 'trunk' into issue/self-hosted-user-detail
nbradbury 6207191
Added offline view
nbradbury 6355c5e
Added large avatar view
nbradbury aeab663
Don't handle avatar clicks in list view
nbradbury e918bf2
Enable scrolling detail screen
nbradbury 282e451
Don't enable scrolling empty list screen
nbradbury a6d9dec
Merge branch 'issue/self-hosted-user-avatar' of https://github.com/wo…
nbradbury 55be759
Show large avatar when clicked
nbradbury ef49726
Added comments to view model
nbradbury 8b2f1b3
Moved var
nbradbury b528d7c
Imported SelfHostedUsersViewModel.SelfHostedUserState to shorten refe…
nbradbury 4f54cbc
Don't pass user to avatar composables
nbradbury 48b4a5b
Simplified empty/offline views
nbradbury 5eed1ac
Simplified modifier on composable Screen
nbradbury 093c07c
Don't handle clicks on empty avatar
nbradbury 7e8dbe4
Make full list row clickable
nbradbury 59585ca
Added comments
nbradbury 1dfd403
Merge branch 'trunk' into issue/self-hosted-user-ui
nbradbury 8564766
Renamed & removed composable functions for better re-usability
nbradbury c7e3017
Made previews private, added offline preview
nbradbury 0ea0d7e
Make content the last param on ScreenWithTopBar
nbradbury 79e3246
Added crossfade animation
nbradbury 8db998b
Merge branch 'trunk' into issue/self-hosted-user-ui
nbradbury 452106d
Increased crossfade animation duration
nbradbury 5bc4ea5
Fixed logic for showing empty list
nbradbury 2575d0e
Merge branch 'trunk' into issue/self-hosted-user-ui
nbradbury f53dcf6
Removed avatar from preview
nbradbury 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 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 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 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 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 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 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 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 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
90 changes: 90 additions & 0 deletions
90
WordPress/src/main/java/org/wordpress/android/ui/selfhostedusers/SampleUsers.kt
This file contains 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 |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package org.wordpress.android.ui.selfhostedusers | ||
|
||
import uniffi.wp_api.UserWithEditContext | ||
|
||
/** | ||
* This is a temporary object to supply a list of users for the self-hosted user list. | ||
* It will be removed once the network request to retrieve users is implemented. | ||
*/ | ||
@Suppress("MaxLineLength") | ||
object SampleUsers { | ||
private val sampleUserList = ArrayList<UserWithEditContext>() | ||
|
||
private val sampleUser1 = UserWithEditContext( | ||
id = 1, | ||
username = "@sampleUser", | ||
avatarUrls = emptyMap(), | ||
capabilities = emptyMap(), | ||
email = "[email protected]", | ||
extraCapabilities = emptyMap(), | ||
firstName = "Sample", | ||
lastName = "User", | ||
link = "example.com", | ||
locale = "en-US", | ||
name = "Sample User", | ||
nickname = "User nickname", | ||
registeredDate = "2023-01-01", | ||
roles = listOf("admin"), | ||
slug = "sample-user", | ||
url = "example.com", | ||
description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam non quam viverra, viverra est vel, interdum felis. Pellentesque interdum libero quis metus pharetra ullamcorper. Morbi nec libero ligula. Quisque consectetur, purus sit amet lobortis porttitor, ligula ex imperdiet massa, in ullamcorper augue odio sit amet metus. In sollicitudin mauris et risus mollis commodo. Aliquam vel vehicula ante, nec blandit erat. Aenean non turpis porttitor orci fringilla fringilla nec ac nunc. Nulla ultrices urna ut ipsum posuere blandit. Phasellus mauris nulla, tincidunt at leo at, auctor interdum felis. Sed pharetra risus a ullamcorper dictum. Suspendisse pharetra justo molestie risus lobortis facilisis.", | ||
) | ||
|
||
// TODO remove the avatar url | ||
private val sampleUser2 = UserWithEditContext( | ||
id = 2, | ||
username = "@sampleUserWithALongUserName", | ||
avatarUrls = mapOf("sampleUserTwo" to "https://nickbradbury.com/wp-content/uploads/2022/03/1394-2.jpg"), | ||
capabilities = emptyMap(), | ||
description = "User description", | ||
email = "[email protected]", | ||
extraCapabilities = emptyMap(), | ||
firstName = "Sample", | ||
lastName = "User", | ||
link = "example.com", | ||
locale = "en-US", | ||
name = "Sample User", | ||
nickname = "User nickname", | ||
registeredDate = "2023-01-01", | ||
roles = listOf("contributor"), | ||
slug = "sample-user", | ||
url = "example.com", | ||
) | ||
|
||
private val sampleUser3 = UserWithEditContext( | ||
id = 3, | ||
username = "@sampleUser", | ||
avatarUrls = emptyMap(), | ||
capabilities = emptyMap(), | ||
description = "User description", | ||
email = "[email protected]", | ||
extraCapabilities = emptyMap(), | ||
firstName = "Sample", | ||
lastName = "User", | ||
link = "example.com", | ||
locale = "en-US", | ||
name = "Sample User", | ||
nickname = "User nickname", | ||
registeredDate = "2023-01-01", | ||
roles = listOf("contributor", "editor", "subscriber"), | ||
slug = "sample-user", | ||
url = "example.com", | ||
) | ||
|
||
@Suppress("MagicNumber") | ||
fun getSampleUsers(): ArrayList<UserWithEditContext> { | ||
fun addWithId(user: UserWithEditContext) { | ||
sampleUserList.add( | ||
user.copy(id = sampleUserList.size) | ||
) | ||
} | ||
if (sampleUserList.isEmpty()) { | ||
repeat(25) { | ||
addWithId(sampleUser1) | ||
addWithId(sampleUser2) | ||
addWithId(sampleUser3) | ||
} | ||
} | ||
return sampleUserList | ||
} | ||
} |
Oops, something went wrong.
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.
Check notice
Code scanning / Android Lint
Nullable/NonNull annotation missing on method parameter Note