Skip to content

Commit

Permalink
Fix crash with UnknownSenderView.
Browse files Browse the repository at this point in the history
The listener was being called on a background thread, but it was doing
UI work.
  • Loading branch information
greyson-signal committed Jul 30, 2020
1 parent 8b29bb8 commit aff74cf
Showing 1 changed file with 13 additions and 4 deletions.
Expand Up @@ -12,6 +12,7 @@
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.recipients.RecipientExporter;
import org.thoughtcrime.securesms.util.ViewUtil;
import org.thoughtcrime.securesms.util.concurrent.SignalExecutors;

public class UnknownSenderView extends FrameLayout {

Expand Down Expand Up @@ -50,10 +51,14 @@ private void handleBlock() {
protected Void doInBackground(Void... params) {
DatabaseFactory.getRecipientDatabase(context).setBlocked(recipient.getId(), true);
if (threadId != -1) DatabaseFactory.getThreadDatabase(context).setHasSent(threadId, true);
listener.onActionTaken();
return null;
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);

@Override
protected void onPostExecute(Void aVoid) {
listener.onActionTaken();
}
}.executeOnExecutor(SignalExecutors.BOUNDED);
})
.setNegativeButton(android.R.string.cancel, null)
.show();
Expand All @@ -78,10 +83,14 @@ private void handleProfileAccess() {
protected Void doInBackground(Void... params) {
DatabaseFactory.getRecipientDatabase(context).setProfileSharing(recipient.getId(), true);
if (threadId != -1) DatabaseFactory.getThreadDatabase(context).setHasSent(threadId, true);
listener.onActionTaken();
return null;
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);

@Override
protected void onPostExecute(Void aVoid) {
listener.onActionTaken();
}
}.executeOnExecutor(SignalExecutors.BOUNDED);
})
.setNegativeButton(android.R.string.cancel, null)
.show();
Expand Down

0 comments on commit aff74cf

Please sign in to comment.