mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-21 22:27:29 +00:00
expand broadcasting rich message by 1 argument
for stories and post children
This commit is contained in:
parent
70472dea14
commit
10447cd633
@ -68,20 +68,21 @@ object DirectMessagesManager {
|
||||
|
||||
suspend fun createThread(userPk: Long): DirectThread = DirectMessagesService.createThread(csrfToken, viewerId, deviceUuid, listOf(userPk), null)
|
||||
|
||||
fun sendMedia(recipient: RankedRecipient, mediaId: String, itemType: BroadcastItemType, scope: CoroutineScope) {
|
||||
sendMedia(setOf(recipient), mediaId, itemType, scope)
|
||||
fun sendMedia(recipient: RankedRecipient, mediaId: String, secondId: String?, itemType: BroadcastItemType, scope: CoroutineScope) {
|
||||
sendMedia(setOf(recipient), mediaId, secondId, itemType, scope)
|
||||
}
|
||||
|
||||
fun sendMedia(
|
||||
recipients: Set<RankedRecipient>,
|
||||
mediaId: String,
|
||||
secondId: String?,
|
||||
itemType: BroadcastItemType,
|
||||
scope: CoroutineScope,
|
||||
) {
|
||||
val threadIds = recipients.mapNotNull{ it.thread?.threadId }
|
||||
val userIdsTemp = recipients.mapNotNull{ it.user?.pk }
|
||||
val userIds = userIdsTemp.map{ listOf(it.toString(10)) }
|
||||
sendMedia(threadIds, userIds, mediaId, itemType, scope) {
|
||||
sendMedia(threadIds, userIds, mediaId, secondId, itemType, scope) {
|
||||
inboxManager.refresh(scope)
|
||||
}
|
||||
}
|
||||
@ -90,6 +91,7 @@ object DirectMessagesManager {
|
||||
threadIds: List<String>,
|
||||
userIds: List<List<String>>,
|
||||
mediaId: String,
|
||||
secondId: String?,
|
||||
itemType: BroadcastItemType,
|
||||
scope: CoroutineScope,
|
||||
callback: (() -> Unit)?,
|
||||
|
@ -336,7 +336,7 @@ class PostViewV2ViewModel : ViewModel() {
|
||||
messageManager = DirectMessagesManager
|
||||
}
|
||||
val mediaId = media.id ?: return
|
||||
messageManager?.sendMedia(result, mediaId, BroadcastItemType.MEDIA_SHARE, viewModelScope)
|
||||
messageManager?.sendMedia(result, mediaId, null, BroadcastItemType.MEDIA_SHARE, viewModelScope)
|
||||
}
|
||||
|
||||
fun shareDm(recipients: Set<RankedRecipient>) {
|
||||
@ -344,6 +344,6 @@ class PostViewV2ViewModel : ViewModel() {
|
||||
messageManager = DirectMessagesManager
|
||||
}
|
||||
val mediaId = media.id ?: return
|
||||
messageManager?.sendMedia(recipients, mediaId, BroadcastItemType.MEDIA_SHARE, viewModelScope)
|
||||
messageManager?.sendMedia(recipients, mediaId, null, BroadcastItemType.MEDIA_SHARE, viewModelScope)
|
||||
}
|
||||
}
|
@ -214,7 +214,7 @@ class ProfileFragmentViewModel(
|
||||
messageManager = DirectMessagesManager
|
||||
}
|
||||
val mediaId = profile.value?.data?.pk ?: return
|
||||
messageManager?.sendMedia(result, mediaId.toString(10), BroadcastItemType.PROFILE, viewModelScope)
|
||||
messageManager?.sendMedia(result, mediaId.toString(10), null, BroadcastItemType.PROFILE, viewModelScope)
|
||||
}
|
||||
|
||||
fun shareDm(recipients: Set<RankedRecipient>) {
|
||||
@ -222,7 +222,7 @@ class ProfileFragmentViewModel(
|
||||
messageManager = DirectMessagesManager
|
||||
}
|
||||
val mediaId = profile.value?.data?.pk ?: return
|
||||
messageManager?.sendMedia(recipients, mediaId.toString(10), BroadcastItemType.PROFILE, viewModelScope)
|
||||
messageManager?.sendMedia(recipients, mediaId.toString(10), null, BroadcastItemType.PROFILE, viewModelScope)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user