-
Notifications
You must be signed in to change notification settings - Fork 3.1k
[FEATURE REQUEST] Show members of a space #4728
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
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
104d07c
feat: add members option in bottom sheet dialog
joragua 54a76cc
feat: create new layout for space members
joragua c579dd9
feat: implement methods to fetch all space members information
joragua 5d0443a
feat: display space members list in the new layout
joragua 3db20a1
test: adapt existing tests to the new space permission response
joragua 57eb6e7
test: add new tests for OCRemoteSpacesDataSourceTest and OCSpacesRepo…
joragua 4fc2acf
feat: add release note
joragua d9dddd4
chore: add calens file
joragua f90bd84
refactor: use Locale.ROOT instead of default locale when displaying e…
joragua 7ccd678
refactor: remove unnecessary XML elements and auxiliary method for ob…
joragua c0c86b1
feat: add support to fetch platform roles from server
joragua 1689c48
feat: display correct role for each space member in the list
joragua 39e2a06
test: create tests for OCRemoteRolesDataSource and OCRolesRepository
joragua ab3c816
docs: calens changelog updated
ownclouders 65e343b
refactor: remove duplicated code from GetRemoteRolesOperation
joragua eb243ad
fix: initialize roles with empty list to prevent crashes in landscape
joragua 3245c2f
fix: ellipsize member names in UI if too long
joragua cb10366
feat: improve content descriptions for space members (names and expir…
joragua 02353fc
fix: observe roles flow before space members to avoid empty roles in …
joragua 83785f2
fix: parse link response to show member option in all spaces
joragua 9c06876
test: adapt existing test models to the new link response
joragua 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| Enhancement: Show members of a space | ||
|
|
||
| A new option to view all members of a space has been added to the bottom sheet, available when the three-dot menu button is tapped. | ||
| This new option opens a new view that shows information like member names, roles, and expiration dates (if available). | ||
|
|
||
| https://github.com/owncloud/android/issues/4612 | ||
| https://github.com/owncloud/android/pull/4728 |
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
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
67 changes: 67 additions & 0 deletions
67
...pp/src/main/java/com/owncloud/android/presentation/spaces/members/SpaceMembersActivity.kt
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 |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| /** | ||
| * ownCloud Android client application | ||
| * | ||
| * @author Jorge Aguado Recio | ||
| * | ||
| * Copyright (C) 2025 ownCloud GmbH. | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License version 2, | ||
| * as published by the Free Software Foundation. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| package com.owncloud.android.presentation.spaces.members | ||
|
|
||
| import android.os.Bundle | ||
| import android.view.Menu | ||
| import android.view.MenuItem | ||
| import androidx.fragment.app.transaction | ||
| import com.owncloud.android.R | ||
| import com.owncloud.android.domain.spaces.model.OCSpace | ||
| import com.owncloud.android.ui.activity.FileActivity | ||
|
|
||
| class SpaceMembersActivity: FileActivity() { | ||
|
|
||
| override fun onCreate(savedInstanceState: Bundle?) { | ||
| super.onCreate(savedInstanceState) | ||
|
|
||
| setContentView(R.layout.members_activity) | ||
|
|
||
| setupStandardToolbar(title = null, displayHomeAsUpEnabled = true, homeButtonEnabled = true, displayShowTitleEnabled = true) | ||
|
|
||
| supportActionBar?.setHomeActionContentDescription(R.string.common_back) | ||
|
|
||
| val currentSpace = intent.getParcelableExtra<OCSpace>(EXTRA_SPACE) | ||
|
|
||
| supportFragmentManager.transaction { | ||
| if (savedInstanceState == null && currentSpace != null) { | ||
| val fragment = SpaceMembersFragment.newInstance(account.name, currentSpace) | ||
| replace(R.id.members_fragment_container, fragment, TAG_SPACE_MEMBERS_FRAGMENT) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| override fun onCreateOptionsMenu(menu: Menu): Boolean = false | ||
|
|
||
| override fun onOptionsItemSelected(item: MenuItem): Boolean = | ||
| if (item.itemId == android.R.id.home && !supportFragmentManager.popBackStackImmediate()) { | ||
| finish() | ||
| true | ||
| } else { | ||
| super.onOptionsItemSelected(item) | ||
| } | ||
|
|
||
| companion object { | ||
| private const val TAG_SPACE_MEMBERS_FRAGMENT = "SPACE_MEMBERS_FRAGMENT" | ||
| const val EXTRA_SPACE = "EXTRA_SPACE" | ||
| } | ||
|
|
||
| } | ||
87 changes: 87 additions & 0 deletions
87
...App/src/main/java/com/owncloud/android/presentation/spaces/members/SpaceMembersAdapter.kt
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 |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| /** | ||
| * ownCloud Android client application | ||
| * | ||
| * @author Jorge Aguado Recio | ||
| * | ||
| * Copyright (C) 2025 ownCloud GmbH. | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License version 2, | ||
| * as published by the Free Software Foundation. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| package com.owncloud.android.presentation.spaces.members | ||
|
|
||
| import android.view.LayoutInflater | ||
| import android.view.View | ||
| import android.view.ViewGroup | ||
| import androidx.recyclerview.widget.RecyclerView | ||
| import com.owncloud.android.R | ||
| import com.owncloud.android.databinding.MemberItemBinding | ||
| import com.owncloud.android.domain.roles.model.OCRole | ||
| import com.owncloud.android.domain.spaces.model.SpaceMember | ||
| import com.owncloud.android.domain.spaces.model.SpaceMembers | ||
| import com.owncloud.android.utils.DisplayUtils | ||
| import com.owncloud.android.utils.PreferenceUtils | ||
|
|
||
| class SpaceMembersAdapter: RecyclerView.Adapter<SpaceMembersAdapter.SpaceMembersViewHolder>() { | ||
|
|
||
| private var members: List<SpaceMember> = emptyList() | ||
| private var rolesMap: Map<String, String> = emptyMap() | ||
|
|
||
| override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SpaceMembersViewHolder { | ||
| val inflater = LayoutInflater.from(parent.context) | ||
|
|
||
| val view = inflater.inflate(R.layout.member_item, parent, false) | ||
| view.filterTouchesWhenObscured = PreferenceUtils.shouldDisallowTouchesWithOtherVisibleWindows(parent.context) | ||
|
|
||
| return SpaceMembersViewHolder(view) | ||
| } | ||
|
|
||
| override fun onBindViewHolder(holder: SpaceMembersViewHolder, position: Int) { | ||
| val member = members[position] | ||
| val roleNames = member.roles.mapNotNull { rolesMap[it] } | ||
|
|
||
| holder.binding.apply { | ||
| val isGroup = member.id.startsWith(GROUP_PREFIX) | ||
| memberIcon.setImageResource(if (isGroup) R.drawable.ic_group else R.drawable.ic_user) | ||
| memberName.text = member.displayName | ||
| memberName.contentDescription = holder.itemView.context.getString( | ||
| if (isGroup) R.string.content_description_member_group else R.string.content_description_member_user, member.displayName | ||
| ) | ||
| memberRole.text = roleNames.joinToString(", ") | ||
jesmrec marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| member.expirationDateTime?.let { | ||
| expirationCalendarIcon.visibility = View.VISIBLE | ||
| expirationDate.visibility = View.VISIBLE | ||
jesmrec marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| expirationDate.text = DisplayUtils.displayDateToHumanReadable(it) | ||
| expirationDate.contentDescription = | ||
| holder.itemView.context.getString(R.string.content_description_member_expiration_date, expirationDate.text) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| override fun getItemCount(): Int = members.size | ||
|
|
||
| fun setSpaceMembers(spaceMembers: SpaceMembers, roles: List<OCRole>) { | ||
| this.rolesMap = roles.associate { it.id to it.displayName } | ||
| this.members = spaceMembers.members.sortedByDescending { member -> roles.indexOfFirst { it.id in member.roles } } | ||
| notifyDataSetChanged() | ||
jesmrec marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| class SpaceMembersViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { | ||
| val binding = MemberItemBinding.bind(itemView) | ||
| } | ||
|
|
||
| companion object { | ||
| const val GROUP_PREFIX = "g:" | ||
| } | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.