mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
pass account ID in chat shortcuts and properly switch to account
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -206,13 +207,9 @@ public class ShareActivity extends PassphraseRequiredActionBarActivity implement
|
||||
}
|
||||
|
||||
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:
|
||||
@@ -262,9 +259,10 @@ public class ShareActivity extends PassphraseRequiredActionBarActivity implement
|
||||
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 {
|
||||
|
||||
@@ -125,6 +125,7 @@ public class DirectShareUtil {
|
||||
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user