mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-14 02:37:30 +00:00
sending dm media shares with exact child
https://t.me/barinsta_app/21890
This commit is contained in:
parent
bf1a05a38c
commit
3f6ed5f78b
@ -152,7 +152,7 @@ public class PostViewV2Fragment extends Fragment implements EditTextDialogFragme
|
||||
if (context != null) {
|
||||
Toast.makeText(context, R.string.sending, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
viewModel.shareDm((RankedRecipient) result);
|
||||
viewModel.shareDm((RankedRecipient) result, sliderPosition);
|
||||
} else if ((result instanceof Set)) {
|
||||
try {
|
||||
// Log.d(TAG, "result: " + result);
|
||||
@ -161,7 +161,7 @@ public class PostViewV2Fragment extends Fragment implements EditTextDialogFragme
|
||||
Toast.makeText(context, R.string.sending, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
//noinspection unchecked
|
||||
viewModel.shareDm((Set<RankedRecipient>) result);
|
||||
viewModel.shareDm((Set<RankedRecipient>) result, sliderPosition);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "share: ", e);
|
||||
}
|
||||
|
@ -107,7 +107,8 @@ object DirectMessagesManager {
|
||||
deviceUuid,
|
||||
UUID.randomUUID().toString(),
|
||||
ThreadIdsOrUserIds(threadIds, userIds),
|
||||
mediaId
|
||||
mediaId,
|
||||
secondId
|
||||
)
|
||||
if (itemType == BroadcastItemType.PROFILE)
|
||||
DirectMessagesService.broadcastProfile(
|
||||
|
@ -5,12 +5,16 @@ import awais.instagrabber.models.enums.BroadcastItemType
|
||||
class MediaShareBroadcastOptions(
|
||||
clientContext: String,
|
||||
threadIdsOrUserIds: ThreadIdsOrUserIds,
|
||||
val mediaId: String
|
||||
val mediaId: String,
|
||||
val childId: String?
|
||||
) : BroadcastOptions(
|
||||
clientContext,
|
||||
threadIdsOrUserIds,
|
||||
BroadcastItemType.MEDIA_SHARE
|
||||
) {
|
||||
override val formMap: Map<String, String>
|
||||
get() = mapOf("media_id" to mediaId)
|
||||
get() = listOfNotNull(
|
||||
"media_id" to mediaId,
|
||||
if (childId != null) "carousel_share_child_media_id" to childId else null
|
||||
).toMap()
|
||||
}
|
@ -331,19 +331,21 @@ class PostViewV2ViewModel : ViewModel() {
|
||||
return data
|
||||
}
|
||||
|
||||
fun shareDm(result: RankedRecipient) {
|
||||
fun shareDm(result: RankedRecipient, child: Int) {
|
||||
if (messageManager == null) {
|
||||
messageManager = DirectMessagesManager
|
||||
}
|
||||
val mediaId = media.id ?: return
|
||||
messageManager?.sendMedia(result, mediaId, null, BroadcastItemType.MEDIA_SHARE, viewModelScope)
|
||||
val childId = if (child == -1) null else media.carouselMedia?.get(child)?.id
|
||||
messageManager?.sendMedia(result, mediaId, childId, BroadcastItemType.MEDIA_SHARE, viewModelScope)
|
||||
}
|
||||
|
||||
fun shareDm(recipients: Set<RankedRecipient>) {
|
||||
fun shareDm(recipients: Set<RankedRecipient>, child: Int) {
|
||||
if (messageManager == null) {
|
||||
messageManager = DirectMessagesManager
|
||||
}
|
||||
val mediaId = media.id ?: return
|
||||
messageManager?.sendMedia(recipients, mediaId, null, BroadcastItemType.MEDIA_SHARE, viewModelScope)
|
||||
val childId = if (child == -1) null else media.carouselMedia?.get(child)?.id
|
||||
messageManager?.sendMedia(recipients, mediaId, childId, BroadcastItemType.MEDIA_SHARE, viewModelScope)
|
||||
}
|
||||
}
|
@ -164,8 +164,9 @@ object DirectMessagesService {
|
||||
clientContext: String,
|
||||
threadIdsOrUserIds: ThreadIdsOrUserIds,
|
||||
mediaId: String,
|
||||
childId: String?,
|
||||
): DirectThreadBroadcastResponse =
|
||||
broadcast(csrfToken, userId, deviceUuid, MediaShareBroadcastOptions(clientContext, threadIdsOrUserIds, mediaId))
|
||||
broadcast(csrfToken, userId, deviceUuid, MediaShareBroadcastOptions(clientContext, threadIdsOrUserIds, mediaId, childId))
|
||||
|
||||
suspend fun broadcastProfile(
|
||||
csrfToken: String,
|
||||
|
Loading…
Reference in New Issue
Block a user