Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
weblate committed Jan 23, 2025
2 parents 1c9b597 + d75b2c2 commit 6649165
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/main/java/org/thoughtcrime/securesms/ShareActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public class ShareActivity extends PassphraseRequiredActionBarActivity implement
{
private static final String TAG = ShareActivity.class.getSimpleName();

public static final String EXTRA_ACC_ID = "acc_id";
public static final String EXTRA_CHAT_ID = "chat_id";
public static final String EXTRA_TITLE = "extra_title";

Expand Down Expand Up @@ -206,13 +207,9 @@ public void onMediaResolved(Uri uri) {
}

private void handleResolvedMedia(Intent intent) {
int accId = intent.getIntExtra(EXTRA_ACC_ID, -1);
int chatId = intent.getIntExtra(EXTRA_CHAT_ID, -1);

String shortcutId = intent.getStringExtra(ShortcutManagerCompat.EXTRA_SHORTCUT_ID);
if (chatId == -1 && shortcutId != null) {
chatId = Integer.parseInt(shortcutId);
}

String[] extraEmail = getIntent().getStringArrayExtra(Intent.EXTRA_EMAIL);
/*
usually, external app will try to start "e-mail sharing" intent, providing it:
Expand Down Expand Up @@ -262,9 +259,10 @@ private void handleResolvedMedia(Intent intent) {
chatId = dcContext.createChatByContactId(contactId);
}
Intent composeIntent;
if (chatId != -1) {
if (accId != -1 && chatId != -1) {
composeIntent = getBaseShareIntent(ConversationActivity.class);
composeIntent.putExtra(ConversationActivity.CHAT_ID_EXTRA, chatId);
composeIntent.putExtra(ConversationActivity.ACCOUNT_ID_EXTRA, accId);
RelayUtil.setSharedUris(composeIntent, resolvedExtras);
startActivity(composeIntent);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ private static List<ShortcutInfoCompat> getChooserTargets(Context context) {

Intent intent = new Intent(context, ShareActivity.class);
intent.setAction(Intent.ACTION_SEND);
intent.putExtra(ShareActivity.EXTRA_ACC_ID, dcContext.getAccountId());
intent.putExtra(ShareActivity.EXTRA_CHAT_ID, chat.getId());

Recipient recipient = new Recipient(context, chat);
Expand Down

0 comments on commit 6649165

Please sign in to comment.