From a45844b50eb5e92693e4e3641589bfd6d85d5095 Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Mon, 14 Jun 2021 21:13:12 -0400 Subject: [PATCH] simplify replying to stories no need to create thread before sending --- .../fragments/StoryViewerFragment.java | 21 +++---------------- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java b/app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java index 077ee54c..b89ed891 100644 --- a/app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java @@ -86,7 +86,7 @@ import awais.instagrabber.models.stickers.SliderModel; import awais.instagrabber.models.stickers.SwipeUpModel; import awais.instagrabber.repositories.requests.StoryViewerOptions; import awais.instagrabber.repositories.requests.StoryViewerOptions.Type; -import awais.instagrabber.repositories.requests.directmessages.ThreadIdOrUserIds; +import awais.instagrabber.repositories.requests.directmessages.ThreadIdsOrUserIds; import awais.instagrabber.utils.AppExecutors; import awais.instagrabber.utils.Constants; import awais.instagrabber.utils.CookieUtils; @@ -221,23 +221,11 @@ public class StoryViewerFragment extends Fragment { final AlertDialog ad = new AlertDialog.Builder(context) .setTitle(R.string.reply_story) .setView(input) - .setPositiveButton(R.string.confirm, (d, w) -> directMessagesService.createThread( - csrfToken, - userId, - deviceId, - Collections.singletonList(currentStory.getUserId()), - null, - CoroutineUtilsKt.getContinuation((thread, throwable) -> AppExecutors.INSTANCE.getMainThread().execute(() -> { - if (throwable != null) { - Log.e(TAG, "onOptionsItemSelected: ", throwable); - Toast.makeText(context, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show(); - return; - } - directMessagesService.broadcastStoryReply( + .setPositiveButton(R.string.confirm, (d, w) -> directMessagesService.broadcastStoryReply( csrfToken, userId, deviceId, - ThreadIdOrUserIds.of(thread.getThreadId()), + ThreadIdsOrUserIds.Companion.ofOneUser(String.valueOf(currentStory.getUserId())), input.getText().toString(), currentStory.getStoryMediaId(), String.valueOf(currentStory.getUserId()), @@ -251,9 +239,6 @@ public class StoryViewerFragment extends Fragment { Toast.makeText(context, R.string.answered_story, Toast.LENGTH_SHORT).show(); }), Dispatchers.getIO() ) - - ); - }), Dispatchers.getIO()) )) .setNegativeButton(R.string.cancel, null) .show();