mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 00:59:49 +01:00
Enable split pane UI for new call screen.
This commit is contained in:
committed by
Michelle Tang
parent
75346c3f6b
commit
a96a0a7009
@@ -308,14 +308,16 @@ private fun NewConversationRecipientPicker(
|
||||
searchQuery = uiState.searchQuery,
|
||||
isRefreshing = uiState.isRefreshingContacts,
|
||||
shouldResetContactsList = uiState.shouldResetContactsList,
|
||||
callbacks = RecipientPickerCallbacks(
|
||||
listActions = callbacks,
|
||||
refresh = callbacks,
|
||||
contextMenu = callbacks,
|
||||
newConversation = callbacks,
|
||||
findByUsername = callbacks,
|
||||
findByPhoneNumber = callbacks
|
||||
),
|
||||
callbacks = remember(callbacks) {
|
||||
RecipientPickerCallbacks(
|
||||
listActions = callbacks,
|
||||
refresh = callbacks,
|
||||
contextMenu = callbacks,
|
||||
newConversation = callbacks,
|
||||
findByUsername = callbacks,
|
||||
findByPhoneNumber = callbacks
|
||||
)
|
||||
},
|
||||
modifier = modifier.fillMaxSize()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -147,6 +147,10 @@ class NewConversationViewModel : ViewModel() {
|
||||
}
|
||||
|
||||
fun refresh() {
|
||||
if (internalUiState.value.isRefreshingContacts) {
|
||||
return
|
||||
}
|
||||
|
||||
viewModelScope.launch {
|
||||
internalUiState.update { it.copy(isRefreshingContacts = true) }
|
||||
|
||||
|
||||
@@ -142,6 +142,7 @@ private fun RecipientSearchResultsList(
|
||||
enableCreateNewGroup = callbacks.newConversation != null,
|
||||
enableFindByUsername = callbacks.findByUsername != null,
|
||||
enableFindByPhoneNumber = callbacks.findByPhoneNumber != null,
|
||||
showCallButtons = callbacks.newCall != null,
|
||||
selectionLimits = selectionLimits,
|
||||
recyclerPadBottom = with(LocalDensity.current) { bottomPadding?.toPx()?.toInt() ?: ContactSelectionArguments.Defaults.RECYCLER_PADDING_BOTTOM },
|
||||
recyclerChildClipping = clipListToPadding
|
||||
@@ -228,6 +229,12 @@ private fun ContactSelectionListFragment.setUpCallbacks(
|
||||
fragment.setNewConversationCallback(null)
|
||||
}
|
||||
|
||||
if (callbacks.newCall != null) {
|
||||
fragment.setNewCallCallback { callbacks.newCall.onInviteToSignal() }
|
||||
} else {
|
||||
fragment.setNewCallCallback(null)
|
||||
}
|
||||
|
||||
if (callbacks.findByUsername != null || callbacks.findByPhoneNumber != null) {
|
||||
fragment.setFindByCallback(object : ContactSelectionListFragment.FindByCallback {
|
||||
override fun onFindByUsername() = callbacks.findByUsername?.onFindByUsername() ?: Unit
|
||||
@@ -371,11 +378,12 @@ private fun RecipientPickerPreview() {
|
||||
)
|
||||
}
|
||||
|
||||
data class RecipientPickerCallbacks(
|
||||
class RecipientPickerCallbacks(
|
||||
val listActions: ListActions,
|
||||
val refresh: Refresh? = null,
|
||||
val contextMenu: ContextMenu? = null,
|
||||
val newConversation: NewConversation? = null,
|
||||
val newCall: NewCall? = null,
|
||||
val findByUsername: FindByUsername? = null,
|
||||
val findByPhoneNumber: FindByPhoneNumber? = null
|
||||
) {
|
||||
@@ -418,6 +426,10 @@ data class RecipientPickerCallbacks(
|
||||
fun onInviteToSignal()
|
||||
}
|
||||
|
||||
interface NewCall {
|
||||
fun onInviteToSignal()
|
||||
}
|
||||
|
||||
interface FindByUsername {
|
||||
fun onFindByUsername()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user