mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-03 01:39:18 +02:00
Merge pull request #3888 from deltachat/adb/issue-3853
fix direct share shortcuts
This commit is contained in:
commit
152360d94a
3 changed files with 14 additions and 2 deletions
|
@ -3,7 +3,8 @@
|
|||
## Unreleased
|
||||
|
||||
* target Android 15
|
||||
* Improve readability of info messages in dark mode
|
||||
* improve readability of info messages in dark mode
|
||||
* fix Direct Share shortcuts
|
||||
|
||||
## v2.11.0
|
||||
2025-08
|
||||
|
|
|
@ -32,6 +32,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.content.pm.ShortcutManagerCompat;
|
||||
|
||||
import com.b44t.messenger.DcContext;
|
||||
|
||||
|
@ -209,6 +210,16 @@ public class ShareActivity extends PassphraseRequiredActionBarActivity implement
|
|||
int accId = intent.getIntExtra(EXTRA_ACC_ID, -1);
|
||||
int chatId = intent.getIntExtra(EXTRA_CHAT_ID, -1);
|
||||
|
||||
// the intent coming from shortcuts in the share selector might not include the custom extras but the shortcut ID
|
||||
String shortcutId = intent.getStringExtra(ShortcutManagerCompat.EXTRA_SHORTCUT_ID);
|
||||
if ((chatId == -1 || accId == -1) && shortcutId != null && shortcutId.startsWith("chat-")) {
|
||||
String[] args = shortcutId.split("-");
|
||||
if (args.length == 3) {
|
||||
accId = Integer.parseInt(args[1]);
|
||||
chatId = Integer.parseInt(args[2]);
|
||||
}
|
||||
}
|
||||
|
||||
String[] extraEmail = getIntent().getStringArrayExtra(Intent.EXTRA_EMAIL);
|
||||
/*
|
||||
usually, external app will try to start "e-mail sharing" intent, providing it:
|
||||
|
|
|
@ -128,7 +128,7 @@ public class DirectShareUtil {
|
|||
|
||||
Recipient recipient = new Recipient(context, chat);
|
||||
Bitmap avatar = getIconForShortcut(context, recipient);
|
||||
results.add(new ShortcutInfoCompat.Builder(context, Integer.toString(chat.getId()))
|
||||
results.add(new ShortcutInfoCompat.Builder(context, "chat-" + dcContext.getAccountId() + "-" + chat.getId())
|
||||
.setShortLabel(chat.getName())
|
||||
.setLongLived(true)
|
||||
.setRank(i+1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue