|
@ -102,8 +102,8 @@ object DirectMessagesManager { |
|
|
data.postValue(loading(null)) |
|
|
data.postValue(loading(null)) |
|
|
scope.launch(Dispatchers.IO) { |
|
|
scope.launch(Dispatchers.IO) { |
|
|
try { |
|
|
try { |
|
|
if (itemType == BroadcastItemType.MEDIA_SHARE) |
|
|
|
|
|
directMessagesRepository.broadcastMediaShare( |
|
|
|
|
|
|
|
|
when (itemType) { |
|
|
|
|
|
BroadcastItemType.MEDIA_SHARE -> directMessagesRepository.broadcastMediaShare( |
|
|
csrfToken, |
|
|
csrfToken, |
|
|
viewerId, |
|
|
viewerId, |
|
|
deviceUuid, |
|
|
deviceUuid, |
|
@ -112,8 +112,7 @@ object DirectMessagesManager { |
|
|
mediaId, |
|
|
mediaId, |
|
|
secondId |
|
|
secondId |
|
|
) |
|
|
) |
|
|
if (itemType == BroadcastItemType.PROFILE) |
|
|
|
|
|
directMessagesRepository.broadcastProfile( |
|
|
|
|
|
|
|
|
BroadcastItemType.PROFILE -> directMessagesRepository.broadcastProfile( |
|
|
csrfToken, |
|
|
csrfToken, |
|
|
viewerId, |
|
|
viewerId, |
|
|
deviceUuid, |
|
|
deviceUuid, |
|
@ -121,6 +120,16 @@ object DirectMessagesManager { |
|
|
ThreadIdsOrUserIds(threadIds, userIds), |
|
|
ThreadIdsOrUserIds(threadIds, userIds), |
|
|
mediaId |
|
|
mediaId |
|
|
) |
|
|
) |
|
|
|
|
|
BroadcastItemType.STORY -> directMessagesRepository.broadcastStory( |
|
|
|
|
|
csrfToken, |
|
|
|
|
|
viewerId, |
|
|
|
|
|
deviceUuid, |
|
|
|
|
|
UUID.randomUUID().toString(), |
|
|
|
|
|
ThreadIdsOrUserIds(threadIds, userIds), |
|
|
|
|
|
mediaId, |
|
|
|
|
|
secondId!! |
|
|
|
|
|
) |
|
|
|
|
|
} |
|
|
data.postValue(success(Any())) |
|
|
data.postValue(success(Any())) |
|
|
callback?.invoke() |
|
|
callback?.invoke() |
|
|
} catch (e: Exception) { |
|
|
} catch (e: Exception) { |
|
@ -132,6 +141,42 @@ object DirectMessagesManager { |
|
|
return data |
|
|
return data |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun replyToStory( |
|
|
|
|
|
recipientId: Long?, |
|
|
|
|
|
reelId: String?, |
|
|
|
|
|
mediaId: String?, |
|
|
|
|
|
text: String, |
|
|
|
|
|
scope: CoroutineScope |
|
|
|
|
|
): LiveData<Resource<Any?>> { |
|
|
|
|
|
Log.d("austin_debug", "replying") |
|
|
|
|
|
val data = MutableLiveData<Resource<Any?>>() |
|
|
|
|
|
data.postValue(loading(null)) |
|
|
|
|
|
if (recipientId == null || reelId == null || mediaId == null) { |
|
|
|
|
|
data.postValue(error("arguments are null", null)) |
|
|
|
|
|
return data |
|
|
|
|
|
} |
|
|
|
|
|
scope.launch(Dispatchers.IO) { |
|
|
|
|
|
try { |
|
|
|
|
|
directMessagesRepository.broadcastStoryReply( |
|
|
|
|
|
csrfToken, |
|
|
|
|
|
viewerId, |
|
|
|
|
|
deviceUuid, |
|
|
|
|
|
ThreadIdsOrUserIds.Companion.ofOneUser(recipientId.toString(10)), |
|
|
|
|
|
text, |
|
|
|
|
|
mediaId, |
|
|
|
|
|
reelId |
|
|
|
|
|
) |
|
|
|
|
|
inboxManager.refresh(scope) |
|
|
|
|
|
data.postValue(success(null)) |
|
|
|
|
|
} |
|
|
|
|
|
catch (e: Exception) { |
|
|
|
|
|
Log.e(TAG, "story reply: ", e) |
|
|
|
|
|
data.postValue(error(e.message, null)) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return data |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
init { |
|
|
init { |
|
|
val cookie = Utils.settingsHelper.getString(Constants.COOKIE) |
|
|
val cookie = Utils.settingsHelper.getString(Constants.COOKIE) |
|
|
viewerId = getUserIdFromCookie(cookie) |
|
|
viewerId = getUserIdFromCookie(cookie) |
|
|