Browse Source

simplify replying to stories

no need to create thread before sending
renovate/org.robolectric-robolectric-4.x
Austin Huang 4 years ago
parent
commit
a45844b50e
No known key found for this signature in database GPG Key ID: 84C23AA04587A91F
  1. 21
      app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java

21
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(
.setPositiveButton(R.string.confirm, (d, w) -> directMessagesService.broadcastStoryReply(
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(
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();

Loading…
Cancel
Save