File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed
src/main/java/org/thoughtcrime/securesms Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 3
3
## Unreleased
4
4
5
5
* target Android 15
6
- * Improve readability of info messages in dark mode
6
+ * improve readability of info messages in dark mode
7
+ * fix Direct Share shortcuts
7
8
8
9
## v2.11.0
9
10
2025-08
Original file line number Diff line number Diff line change 32
32
import androidx .annotation .Nullable ;
33
33
import androidx .appcompat .app .ActionBar ;
34
34
import androidx .appcompat .widget .Toolbar ;
35
+ import androidx .core .content .pm .ShortcutManagerCompat ;
35
36
36
37
import com .b44t .messenger .DcContext ;
37
38
@@ -209,6 +210,16 @@ private void handleResolvedMedia(Intent intent) {
209
210
int accId = intent .getIntExtra (EXTRA_ACC_ID , -1 );
210
211
int chatId = intent .getIntExtra (EXTRA_CHAT_ID , -1 );
211
212
213
+ // the intent coming from shortcuts in the share selector might not include the custom extras but the shortcut ID
214
+ String shortcutId = intent .getStringExtra (ShortcutManagerCompat .EXTRA_SHORTCUT_ID );
215
+ if ((chatId == -1 || accId == -1 ) && shortcutId != null && shortcutId .startsWith ("chat-" )) {
216
+ String [] args = shortcutId .split ("-" );
217
+ if (args .length == 3 ) {
218
+ accId = Integer .parseInt (args [1 ]);
219
+ chatId = Integer .parseInt (args [2 ]);
220
+ }
221
+ }
222
+
212
223
String [] extraEmail = getIntent ().getStringArrayExtra (Intent .EXTRA_EMAIL );
213
224
/*
214
225
usually, external app will try to start "e-mail sharing" intent, providing it:
Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ private static List<ShortcutInfoCompat> getChooserTargets(Context context) {
128
128
129
129
Recipient recipient = new Recipient (context , chat );
130
130
Bitmap avatar = getIconForShortcut (context , recipient );
131
- results .add (new ShortcutInfoCompat .Builder (context , Integer . toString ( chat .getId () ))
131
+ results .add (new ShortcutInfoCompat .Builder (context , "chat-" + dcContext . getAccountId () + "-" + chat .getId ())
132
132
.setShortLabel (chat .getName ())
133
133
.setLongLived (true )
134
134
.setRank (i +1 )
You can’t perform that action at this time.
0 commit comments