mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-18 19:19:33 +01:00
hide already selected participants
Signed-off-by: Marcel Hibbe <dev@mhibbe.de> Signed-off-by: github-actions <github-actions@github.com>
This commit is contained in:
parent
1fa0496b94
commit
743d4a0a4e
@ -18,6 +18,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import autodagger.AutoInjector
|
||||
import com.nextcloud.talk.activities.BaseActivity
|
||||
import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||
import com.nextcloud.talk.contacts.CompanionClass.Companion.KEY_HIDE_ALREADY_EXISTING_PARTICIPANTS
|
||||
import com.nextcloud.talk.extensions.getParcelableArrayListExtraProvider
|
||||
import com.nextcloud.talk.components.SetupSystemBars
|
||||
import com.nextcloud.talk.models.json.autocomplete.AutocompleteUser
|
||||
@ -38,7 +39,9 @@ class ContactsActivity : BaseActivity() {
|
||||
contactsViewModel = ViewModelProvider(this, viewModelFactory)[ContactsViewModel::class.java]
|
||||
setContent {
|
||||
val isAddParticipants = intent.getBooleanExtra(BundleKeys.KEY_ADD_PARTICIPANTS, false)
|
||||
val hideAlreadyAddedParticipants = intent.getBooleanExtra(KEY_HIDE_ALREADY_EXISTING_PARTICIPANTS, false)
|
||||
contactsViewModel.updateIsAddParticipants(isAddParticipants)
|
||||
contactsViewModel.hideAlreadyAddedParticipants(hideAlreadyAddedParticipants)
|
||||
if (isAddParticipants) {
|
||||
contactsViewModel.updateShareTypes(
|
||||
listOf(
|
||||
@ -75,5 +78,6 @@ class CompanionClass {
|
||||
companion object {
|
||||
internal val TAG = ContactsActivity::class.simpleName
|
||||
internal const val ROOM_TYPE_ONE_ONE = "1"
|
||||
const val KEY_HIDE_ALREADY_EXISTING_PARTICIPANTS: String = "KEY_HIDE_ALREADY_EXISTING_PARTICIPANTS"
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,8 @@ class ContactsViewModel @Inject constructor(
|
||||
private val _isAddParticipantsView = MutableStateFlow(false)
|
||||
val isAddParticipantsView: StateFlow<Boolean> = _isAddParticipantsView
|
||||
|
||||
private var hideAlreadyAddedParticipants: Boolean = false
|
||||
|
||||
init {
|
||||
getContactsFromSearchParams()
|
||||
}
|
||||
@ -69,6 +71,10 @@ class ContactsViewModel @Inject constructor(
|
||||
_isAddParticipantsView.value = value
|
||||
}
|
||||
|
||||
fun hideAlreadyAddedParticipants(value: Boolean) {
|
||||
hideAlreadyAddedParticipants = value
|
||||
}
|
||||
|
||||
@Suppress("Detekt.TooGenericExceptionCaught")
|
||||
fun getContactsFromSearchParams() {
|
||||
_contactsViewState.value = ContactsUiState.Loading
|
||||
@ -78,7 +84,12 @@ class ContactsViewModel @Inject constructor(
|
||||
searchQuery.value,
|
||||
shareTypeList
|
||||
)
|
||||
val contactsList: List<AutocompleteUser>? = contacts.ocs!!.data
|
||||
val contactsList: MutableList<AutocompleteUser>? = contacts.ocs!!.data?.toMutableList()
|
||||
|
||||
if (hideAlreadyAddedParticipants) {
|
||||
contactsList?.removeAll(selectedParticipants.value)
|
||||
}
|
||||
|
||||
_contactsViewState.value = ContactsUiState.Success(contactsList)
|
||||
} catch (exception: Exception) {
|
||||
_contactsViewState.value = ContactsUiState.Error(exception.message ?: "")
|
||||
|
@ -53,6 +53,7 @@ import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||
import com.nextcloud.talk.bottomsheet.items.BasicListItemWithImage
|
||||
import com.nextcloud.talk.bottomsheet.items.listItemsWithImage
|
||||
import com.nextcloud.talk.chat.ChatActivity
|
||||
import com.nextcloud.talk.contacts.CompanionClass.Companion.KEY_HIDE_ALREADY_EXISTING_PARTICIPANTS
|
||||
import com.nextcloud.talk.contacts.ContactsActivity
|
||||
import com.nextcloud.talk.conversationinfo.viewmodel.ConversationInfoViewModel
|
||||
import com.nextcloud.talk.conversationinfoedit.ConversationInfoEditActivity
|
||||
@ -151,7 +152,6 @@ class ConversationInfoActivity :
|
||||
data.putLong(BundleKeys.KEY_INTERNAL_USER_ID, conversationUser.id!!)
|
||||
return data.build()
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
@ -339,7 +339,7 @@ class ConversationInfoActivity :
|
||||
fun showOptionsMenu() {
|
||||
if (::optionsMenu.isInitialized) {
|
||||
optionsMenu.clear()
|
||||
if (CapabilitiesUtil.hasSpreedFeatureCapability(spreedCapabilities, SpreedFeatures.AVATAR)) {
|
||||
if (hasSpreedFeatureCapability(spreedCapabilities, SpreedFeatures.AVATAR)) {
|
||||
menuInflater.inflate(R.menu.menu_conversation_info, optionsMenu)
|
||||
}
|
||||
}
|
||||
@ -403,7 +403,7 @@ class ConversationInfoActivity :
|
||||
}
|
||||
|
||||
private fun setupWebinaryView() {
|
||||
if (CapabilitiesUtil.hasSpreedFeatureCapability(spreedCapabilities, SpreedFeatures.WEBINARY_LOBBY) &&
|
||||
if (hasSpreedFeatureCapability(spreedCapabilities, SpreedFeatures.WEBINARY_LOBBY) &&
|
||||
webinaryRoomType(conversation!!) &&
|
||||
ConversationUtils.canModerate(conversation!!, spreedCapabilities)
|
||||
) {
|
||||
@ -682,16 +682,22 @@ class ConversationInfoActivity :
|
||||
|
||||
private fun selectParticipantsToAdd() {
|
||||
val bundle = Bundle()
|
||||
val existingParticipantsId = arrayListOf<String>()
|
||||
val existingParticipants = ArrayList<AutocompleteUser>()
|
||||
|
||||
for (userItem in userItems) {
|
||||
if (userItem.model.calculatedActorType == USERS) {
|
||||
existingParticipantsId.add(userItem.model.calculatedActorId!!)
|
||||
val user = AutocompleteUser(
|
||||
userItem.model.calculatedActorId!!,
|
||||
userItem.model.displayName,
|
||||
userItem.model.calculatedActorType.name.lowercase()
|
||||
)
|
||||
existingParticipants.add(user)
|
||||
}
|
||||
}
|
||||
|
||||
bundle.putBoolean(BundleKeys.KEY_ADD_PARTICIPANTS, true)
|
||||
bundle.putStringArrayList(BundleKeys.KEY_EXISTING_PARTICIPANTS, existingParticipantsId)
|
||||
bundle.putParcelableArrayList("selectedParticipants", existingParticipants)
|
||||
bundle.putBoolean(KEY_HIDE_ALREADY_EXISTING_PARTICIPANTS, true)
|
||||
bundle.putString(BundleKeys.KEY_TOKEN, conversation!!.token)
|
||||
|
||||
val intent = Intent(this, ContactsActivity::class.java)
|
||||
@ -851,7 +857,7 @@ class ConversationInfoActivity :
|
||||
|
||||
setUpNotificationSettings(databaseStorageModule!!)
|
||||
|
||||
if (CapabilitiesUtil.hasSpreedFeatureCapability(spreedCapabilities, SpreedFeatures.RICH_OBJECT_LIST_MEDIA) &&
|
||||
if (hasSpreedFeatureCapability(spreedCapabilities, SpreedFeatures.RICH_OBJECT_LIST_MEDIA) &&
|
||||
conversationCopy.remoteServer.isNullOrEmpty()
|
||||
) {
|
||||
binding.sharedItemsButton.setOnClickListener { showSharedItems() }
|
||||
@ -861,7 +867,7 @@ class ConversationInfoActivity :
|
||||
|
||||
if (ConversationUtils.canModerate(conversationCopy, spreedCapabilities)) {
|
||||
binding.addParticipantsAction.visibility = VISIBLE
|
||||
if (CapabilitiesUtil.hasSpreedFeatureCapability(
|
||||
if (hasSpreedFeatureCapability(
|
||||
spreedCapabilities,
|
||||
SpreedFeatures.CLEAR_HISTORY
|
||||
) && conversationCopy.canDeleteConversation
|
||||
@ -1093,7 +1099,7 @@ class ConversationInfoActivity :
|
||||
|
||||
private fun initExpiringMessageOption() {
|
||||
if (ConversationUtils.isParticipantOwnerOrModerator(conversation!!) &&
|
||||
CapabilitiesUtil.hasSpreedFeatureCapability(spreedCapabilities, SpreedFeatures.MESSAGE_EXPIRATION)
|
||||
hasSpreedFeatureCapability(spreedCapabilities, SpreedFeatures.MESSAGE_EXPIRATION)
|
||||
) {
|
||||
databaseStorageModule?.setMessageExpiration(conversation!!.messageExpiration)
|
||||
val value = databaseStorageModule!!.getString("conversation_settings_dropdown", "")
|
||||
@ -1116,7 +1122,7 @@ class ConversationInfoActivity :
|
||||
|
||||
private fun adjustNotificationLevelUI() {
|
||||
if (conversation != null) {
|
||||
if (CapabilitiesUtil.hasSpreedFeatureCapability(spreedCapabilities, SpreedFeatures.NOTIFICATION_LEVELS)) {
|
||||
if (hasSpreedFeatureCapability(spreedCapabilities, SpreedFeatures.NOTIFICATION_LEVELS)) {
|
||||
binding.notificationSettingsView.conversationInfoMessageNotificationsDropdown.isEnabled = true
|
||||
binding.notificationSettingsView.conversationInfoMessageNotificationsDropdown.alpha = 1.0f
|
||||
|
||||
@ -1151,7 +1157,7 @@ class ConversationInfoActivity :
|
||||
|
||||
private fun setProperNotificationValue(conversation: ConversationModel?) {
|
||||
if (conversation!!.type == ConversationEnums.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL) {
|
||||
if (CapabilitiesUtil.hasSpreedFeatureCapability(spreedCapabilities, SpreedFeatures.MENTION_FLAG)) {
|
||||
if (hasSpreedFeatureCapability(spreedCapabilities, SpreedFeatures.MENTION_FLAG)) {
|
||||
binding.notificationSettingsView.conversationInfoMessageNotificationsDropdown.setText(
|
||||
resources.getString(R.string.nc_notify_me_always)
|
||||
)
|
||||
|
@ -477,6 +477,7 @@ How to translate with transifex:
|
||||
<string name="nc_teams">Teams</string>
|
||||
<string name="nc_participants">Participants</string>
|
||||
<string name="nc_participants_add">Add participants</string>
|
||||
<string name="nc_start_group_chat">Start group chat</string>
|
||||
|
||||
<string name="nc_owner">Owner</string>
|
||||
<string name="nc_moderator">Moderator</string>
|
||||
|
@ -1,2 +1,2 @@
|
||||
DO NOT TOUCH; GENERATED BY DRONE
|
||||
<span class="mdl-layout-title">Lint Report: 9 errors and 100 warnings</span>
|
||||
<span class="mdl-layout-title">Lint Report: 9 errors and 98 warnings</span>
|
||||
|
Loading…
Reference in New Issue
Block a user