mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 06:37:30 +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)
|
suspend fun createThread(userPk: Long): DirectThread = DirectMessagesService.createThread(csrfToken, viewerId, deviceUuid, listOf(userPk), null)
|
||||||
|
|
||||||
fun sendMedia(recipient: RankedRecipient, mediaId: String, itemType: BroadcastItemType, scope: CoroutineScope) {
|
fun sendMedia(recipient: RankedRecipient, mediaId: String, secondId: String?, itemType: BroadcastItemType, scope: CoroutineScope) {
|
||||||
sendMedia(setOf(recipient), mediaId, itemType, scope)
|
sendMedia(setOf(recipient), mediaId, secondId, itemType, scope)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun sendMedia(
|
fun sendMedia(
|
||||||
recipients: Set<RankedRecipient>,
|
recipients: Set<RankedRecipient>,
|
||||||
mediaId: String,
|
mediaId: String,
|
||||||
|
secondId: String?,
|
||||||
itemType: BroadcastItemType,
|
itemType: BroadcastItemType,
|
||||||
scope: CoroutineScope,
|
scope: CoroutineScope,
|
||||||
) {
|
) {
|
||||||
val threadIds = recipients.mapNotNull{ it.thread?.threadId }
|
val threadIds = recipients.mapNotNull{ it.thread?.threadId }
|
||||||
val userIdsTemp = recipients.mapNotNull{ it.user?.pk }
|
val userIdsTemp = recipients.mapNotNull{ it.user?.pk }
|
||||||
val userIds = userIdsTemp.map{ listOf(it.toString(10)) }
|
val userIds = userIdsTemp.map{ listOf(it.toString(10)) }
|
||||||
sendMedia(threadIds, userIds, mediaId, itemType, scope) {
|
sendMedia(threadIds, userIds, mediaId, secondId, itemType, scope) {
|
||||||
inboxManager.refresh(scope)
|
inboxManager.refresh(scope)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,6 +91,7 @@ object DirectMessagesManager {
|
|||||||
threadIds: List<String>,
|
threadIds: List<String>,
|
||||||
userIds: List<List<String>>,
|
userIds: List<List<String>>,
|
||||||
mediaId: String,
|
mediaId: String,
|
||||||
|
secondId: String?,
|
||||||
itemType: BroadcastItemType,
|
itemType: BroadcastItemType,
|
||||||
scope: CoroutineScope,
|
scope: CoroutineScope,
|
||||||
callback: (() -> Unit)?,
|
callback: (() -> Unit)?,
|
||||||
|
@ -336,7 +336,7 @@ class PostViewV2ViewModel : ViewModel() {
|
|||||||
messageManager = DirectMessagesManager
|
messageManager = DirectMessagesManager
|
||||||
}
|
}
|
||||||
val mediaId = media.id ?: return
|
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>) {
|
fun shareDm(recipients: Set<RankedRecipient>) {
|
||||||
@ -344,6 +344,6 @@ class PostViewV2ViewModel : ViewModel() {
|
|||||||
messageManager = DirectMessagesManager
|
messageManager = DirectMessagesManager
|
||||||
}
|
}
|
||||||
val mediaId = media.id ?: return
|
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
|
messageManager = DirectMessagesManager
|
||||||
}
|
}
|
||||||
val mediaId = profile.value?.data?.pk ?: return
|
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>) {
|
fun shareDm(recipients: Set<RankedRecipient>) {
|
||||||
@ -222,7 +222,7 @@ class ProfileFragmentViewModel(
|
|||||||
messageManager = DirectMessagesManager
|
messageManager = DirectMessagesManager
|
||||||
}
|
}
|
||||||
val mediaId = profile.value?.data?.pk ?: return
|
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