Skip to content

Commit

Permalink
Load drafts from DB when opening conversation from notifications.
Browse files Browse the repository at this point in the history
  • Loading branch information
clark-signal authored and alex-signal committed Jan 11, 2023
1 parent aac1d0c commit 87c3662
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
public class ConversationIntents {

private static final String BUBBLE_AUTHORITY = "bubble";
private static final String NOTIFICATION_CUSTOM_SCHEME = "custom";
private static final String EXTRA_RECIPIENT = "recipient_id";
private static final String EXTRA_THREAD_ID = "thread_id";
private static final String EXTRA_TEXT = "draft_text";
Expand Down Expand Up @@ -89,6 +90,10 @@ static boolean isBubbleIntentUri(@Nullable Uri uri) {
return uri != null && Objects.equals(uri.getAuthority(), BUBBLE_AUTHORITY);
}

static boolean isNotificationIntentUri(@Nullable Uri uri) {
return uri != null && Objects.equals(uri.getScheme(), NOTIFICATION_CUSTOM_SCHEME);
}

final static class Args {
private final RecipientId recipientId;
private final long threadId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1684,7 +1684,7 @@ private ListenableFuture<Boolean> initializeDraft(@NonNull ConversationIntents.A
return setMedia(draftMedia, draftMediaType);
}

if (draftText == null && (draftMedia == null || ConversationIntents.isBubbleIntentUri(draftMedia)) && draftMediaType == null) {
if (draftText == null && (draftMedia == null || ConversationIntents.isBubbleIntentUri(draftMedia) || ConversationIntents.isNotificationIntentUri(draftMedia)) && draftMediaType == null) {
Log.d(TAG, "Initializing draft from database");
return initializeDraftFromDatabase();
} else {
Expand Down

0 comments on commit 87c3662

Please sign in to comment.