mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-08 22:38:37 +00:00
Fix an issue where the add profile prompt wasn't dismissed.
This commit is contained in:
parent
34159fc9da
commit
b80c339c5a
@ -407,7 +407,7 @@ public class ConversationFragment extends Fragment {
|
||||
|
||||
this.recipient = Recipient.live(getActivity().getIntent().getParcelableExtra(ConversationActivity.RECIPIENT_EXTRA));
|
||||
this.threadId = this.getActivity().getIntent().getLongExtra(ConversationActivity.THREAD_ID_EXTRA, -1);
|
||||
this.unknownSenderView = new UnknownSenderView(getActivity(), recipient.get(), threadId);
|
||||
this.unknownSenderView = new UnknownSenderView(getActivity(), recipient.get(), threadId, () -> clearHeaderIfNotTyping(getListAdapter()));
|
||||
|
||||
conversationViewModel.onConversationDataAvailable(threadId, startingPosition);
|
||||
|
||||
|
@ -17,11 +17,13 @@ public class UnknownSenderView extends FrameLayout {
|
||||
|
||||
private final @NonNull Recipient recipient;
|
||||
private final long threadId;
|
||||
private final Listener listener;
|
||||
|
||||
public UnknownSenderView(@NonNull Context context, @NonNull Recipient recipient, long threadId) {
|
||||
public UnknownSenderView(@NonNull Context context, @NonNull Recipient recipient, long threadId, @NonNull Listener listener) {
|
||||
super(context);
|
||||
this.recipient = recipient;
|
||||
this.threadId = threadId;
|
||||
this.listener = listener;
|
||||
|
||||
inflate(context, R.layout.unknown_sender_view, this);
|
||||
setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
|
||||
@ -48,6 +50,7 @@ public class UnknownSenderView extends FrameLayout {
|
||||
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);
|
||||
@ -59,6 +62,7 @@ public class UnknownSenderView extends FrameLayout {
|
||||
private void handleAdd() {
|
||||
getContext().startActivity(RecipientExporter.export(recipient).asAddContactIntent());
|
||||
if (threadId != -1) DatabaseFactory.getThreadDatabase(getContext()).setHasSent(threadId, true);
|
||||
listener.onActionTaken();
|
||||
}
|
||||
|
||||
private void handleProfileAccess() {
|
||||
@ -74,6 +78,7 @@ public class UnknownSenderView extends FrameLayout {
|
||||
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);
|
||||
@ -81,4 +86,8 @@ public class UnknownSenderView extends FrameLayout {
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.show();
|
||||
}
|
||||
|
||||
public interface Listener {
|
||||
void onActionTaken();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user