mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-03 09:49:21 +02:00
Rework how activities interact when forwarding/sharing (#2549)
This commit is contained in:
parent
aa3e7195b2
commit
0e27d445ee
14 changed files with 186 additions and 123 deletions
|
@ -162,8 +162,17 @@
|
||||||
|
|
||||||
<activity android:name=".ConversationActivity"
|
<activity android:name=".ConversationActivity"
|
||||||
android:windowSoftInputMode="stateUnchanged"
|
android:windowSoftInputMode="stateUnchanged"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:relinquishTaskIdentity="true"
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
|
||||||
android:parentActivityName=".ConversationListActivity">
|
android:parentActivityName=".ConversationListActivity">
|
||||||
|
<!--
|
||||||
|
Without relinquishTaskIdentity="true", we would have the following bug:
|
||||||
|
- Directly open a chat via shortcut (by long-pressing on the DeltaChat icon in the launcher)
|
||||||
|
- Press back twice
|
||||||
|
- Reopen DeltaChat from recent apps
|
||||||
|
- Expected: ConversationList shown. Actual: The chat from the beginning is shown again.
|
||||||
|
-->
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value="org.thoughtcrime.securesms.ConversationListActivity" />
|
android:value="org.thoughtcrime.securesms.ConversationListActivity" />
|
||||||
|
|
|
@ -10,6 +10,7 @@ import androidx.test.filters.LargeTest;
|
||||||
import com.b44t.messenger.TestUtils;
|
import com.b44t.messenger.TestUtils;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
import org.junit.Ignore;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
@ -25,7 +26,7 @@ import static androidx.test.espresso.matcher.ViewMatchers.withHint;
|
||||||
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||||
import static androidx.test.espresso.matcher.ViewMatchers.withText;
|
import static androidx.test.espresso.matcher.ViewMatchers.withText;
|
||||||
|
|
||||||
|
@Ignore("This is not a test, but a benchmark. Remove the @Ignore to run it.")
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
@LargeTest
|
@LargeTest
|
||||||
public class EnterChatsBenchmark {
|
public class EnterChatsBenchmark {
|
||||||
|
|
|
@ -88,9 +88,6 @@ public class ForwardingTest {
|
||||||
onView(withText(android.R.string.ok)).perform(click());
|
onView(withText(android.R.string.ok)).perform(click());
|
||||||
onView(withId(R.id.title)).check(matches(withText("group")));
|
onView(withId(R.id.title)).check(matches(withText("group")));
|
||||||
|
|
||||||
pressBack();
|
|
||||||
onView(withId(R.id.title)).check(matches(withText(R.string.saved_messages)));
|
|
||||||
|
|
||||||
pressBack();
|
pressBack();
|
||||||
onView(withId(R.id.toolbar_title)).check(matches(withText(R.string.connectivity_not_connected)));
|
onView(withId(R.id.toolbar_title)).check(matches(withText(R.string.connectivity_not_connected)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import org.thoughtcrime.securesms.ConversationListActivity;
|
||||||
import org.thoughtcrime.securesms.R;
|
import org.thoughtcrime.securesms.R;
|
||||||
import org.thoughtcrime.securesms.ShareActivity;
|
import org.thoughtcrime.securesms.ShareActivity;
|
||||||
import org.thoughtcrime.securesms.connect.DcHelper;
|
import org.thoughtcrime.securesms.connect.DcHelper;
|
||||||
|
import org.thoughtcrime.securesms.util.Util;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
@ -29,7 +30,9 @@ import static androidx.test.espresso.Espresso.onView;
|
||||||
import static androidx.test.espresso.Espresso.pressBack;
|
import static androidx.test.espresso.Espresso.pressBack;
|
||||||
import static androidx.test.espresso.action.ViewActions.click;
|
import static androidx.test.espresso.action.ViewActions.click;
|
||||||
import static androidx.test.espresso.assertion.ViewAssertions.matches;
|
import static androidx.test.espresso.assertion.ViewAssertions.matches;
|
||||||
|
import static androidx.test.espresso.matcher.ViewMatchers.hasDescendant;
|
||||||
import static androidx.test.espresso.matcher.ViewMatchers.isClickable;
|
import static androidx.test.espresso.matcher.ViewMatchers.isClickable;
|
||||||
|
import static androidx.test.espresso.matcher.ViewMatchers.withChild;
|
||||||
import static androidx.test.espresso.matcher.ViewMatchers.withHint;
|
import static androidx.test.espresso.matcher.ViewMatchers.withHint;
|
||||||
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||||
import static androidx.test.espresso.matcher.ViewMatchers.withText;
|
import static androidx.test.espresso.matcher.ViewMatchers.withText;
|
||||||
|
@ -46,6 +49,7 @@ public class SharingTest {
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private final static String TAG = SharingTest.class.getSimpleName();
|
private final static String TAG = SharingTest.class.getSimpleName();
|
||||||
private static int createdGroupId;
|
private static int createdGroupId;
|
||||||
|
private static int createdSingleChatId;
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public ActivityScenarioRule<ConversationListActivity> activityRule = TestUtils.getOfflineActivityRule(false);
|
public ActivityScenarioRule<ConversationListActivity> activityRule = TestUtils.getOfflineActivityRule(false);
|
||||||
|
@ -55,6 +59,14 @@ public class SharingTest {
|
||||||
activityRule.getScenario().onActivity(a -> createdGroupId = DcHelper.getContext(a).createGroupChat(false, "group"));
|
activityRule.getScenario().onActivity(a -> createdGroupId = DcHelper.getContext(a).createGroupChat(false, "group"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void createSingleChat() {
|
||||||
|
activityRule.getScenario().onActivity(a -> {
|
||||||
|
int contactId = DcHelper.getContext(a).createContact("", "abc@example.org");
|
||||||
|
createdSingleChatId = DcHelper.getContext(a).createChatByContactId(contactId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNormalSharing() {
|
public void testNormalSharing() {
|
||||||
Intent i = new Intent(Intent.ACTION_SEND);
|
Intent i = new Intent(Intent.ACTION_SEND);
|
||||||
|
@ -71,7 +83,7 @@ public class SharingTest {
|
||||||
/**
|
/**
|
||||||
* Test direct sharing from a screenshot.
|
* Test direct sharing from a screenshot.
|
||||||
* Also, this is the regression test for https://github.com/deltachat/deltachat-android/issues/2040
|
* Also, this is the regression test for https://github.com/deltachat/deltachat-android/issues/2040
|
||||||
* where network changes during sharing lead to
|
* where network changes during sharing lead to a bug
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testShareFromScreenshot() {
|
public void testShareFromScreenshot() {
|
||||||
|
@ -112,7 +124,90 @@ public class SharingTest {
|
||||||
onView(withId(R.id.fab)).check(matches(isClickable()));
|
onView(withId(R.id.fab)).check(matches(isClickable()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO test other things from https://github.com/deltachat/interface/blob/master/user-testing/mailto-links.md
|
/**
|
||||||
|
* Tests https://github.com/deltachat/interface/blob/master/user-testing/mailto-links.md#mailto-links:
|
||||||
|
*
|
||||||
|
* <ul dir="auto">
|
||||||
|
* <li><a href="mailto:abc@example.org">Just an email address</a> - should open a chat with <code>abc@example.org</code> (and maybe ask whether a chat should be created if it does not exist already)</li>
|
||||||
|
* <li><a href="mailto:abc@example.org?subject=testing%20mailto%20uris">email address with subject</a> - should open a chat with <code>abc@example.org</code> and fill <code>testing mailto uris</code>; as we created the chat in the previous step, it should not ask <code>Chat with …</code> but directly open the chat</li>
|
||||||
|
* <li><a href="mailto:abc@example.org?body=this%20is%20a%20test">email address with body</a> - should open a chat with <code>abc@example.org</code>, draft <code>this is a test</code></li>
|
||||||
|
* <li><a href="mailto:abc@example.org?subject=testing%20mailto%20uris&body=this%20is%20a%20test">email address with subject and body</a> - should open a chat with <code>abc@example.org</code>, draft <code>testing mailto uris</code> <newline> <code>this is a test</code></li>
|
||||||
|
* <li><a href="mailto:%20info@example.org">HTML encoding</a> - should open a chat with <code>info@example.org</code></li>
|
||||||
|
* <li><a href="mailto:simplebot@example.org?body=!web%20https%3A%2F%2Fduckduckgo.com%2Flite%3Fq%3Dduck%2520it">more HTML encoding</a> - should open a chat with <code>simplebot@example.org</code>, draft <code>!web https://duckduckgo.com/lite?q=duck%20it</code></li>
|
||||||
|
* <li><a href="mailto:?subject=bla&body=blub">no email, just subject&body</a> - this should let you choose a chat and create a draft <code>bla</code> <newline> <code>blub</code> there</li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testShareFromLink() {
|
||||||
|
openLink("mailto:abc@example.org");
|
||||||
|
onView(withId(R.id.subtitle)).check(matches(withText("abc@example.org")));
|
||||||
|
|
||||||
|
openLink("mailto:abc@example.org?subject=testing%20mailto%20uris");
|
||||||
|
onView(withId(R.id.subtitle)).check(matches(withText("abc@example.org")));
|
||||||
|
onView(withHint(R.string.chat_input_placeholder)).check(matches(withText("testing mailto uris")));
|
||||||
|
|
||||||
|
openLink("mailto:abc@example.org?body=this%20is%20a%20test");
|
||||||
|
onView(withId(R.id.subtitle)).check(matches(withText("abc@example.org")));
|
||||||
|
onView(withHint(R.string.chat_input_placeholder)).check(matches(withText("this is a test")));
|
||||||
|
|
||||||
|
openLink("mailto:abc@example.org?subject=testing%20mailto%20uris&body=this%20is%20a%20test");
|
||||||
|
onView(withId(R.id.subtitle)).check(matches(withText("abc@example.org")));
|
||||||
|
onView(withHint(R.string.chat_input_placeholder)).check(matches(withText("testing mailto uris\nthis is a test")));
|
||||||
|
|
||||||
|
openLink("mailto:%20abc@example.org");
|
||||||
|
onView(withId(R.id.subtitle)).check(matches(withText("abc@example.org")));
|
||||||
|
|
||||||
|
openLink("mailto:abc@example.org?body=!web%20https%3A%2F%2Fduckduckgo.com%2Flite%3Fq%3Dduck%2520it");
|
||||||
|
onView(withId(R.id.subtitle)).check(matches(withText("abc@example.org")));
|
||||||
|
onView(withHint(R.string.chat_input_placeholder)).check(matches(withText("!web https://duckduckgo.com/lite?q=duck%20it")));
|
||||||
|
|
||||||
|
openLink("mailto:?subject=bla&body=blub");
|
||||||
|
onView(withId(R.id.list)).perform(RecyclerViewActions.actionOnItem(hasDescendant(withText("abc@example.org")), click()));
|
||||||
|
onView(withId(R.id.subtitle)).check(matches(withText("abc@example.org")));
|
||||||
|
onView(withHint(R.string.chat_input_placeholder)).check(matches(withText("bla\nblub")));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void openLink(String link) {
|
||||||
|
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(link));
|
||||||
|
i.setPackage(getInstrumentation().getTargetContext().getPackageName());
|
||||||
|
activityRule.getScenario().onActivity(a -> a.startActivity(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <ul dir="auto">
|
||||||
|
* <li>Open Saved Messages chat (could be any other chat too)</li>
|
||||||
|
* <li>Go to another app and share some text to DC</li>
|
||||||
|
* <li>In DC select Saved Messages. Edit the shared text if you like. <em>Don't</em> hit the Send button.</li>
|
||||||
|
* <li>Leave DC</li>
|
||||||
|
* <li>Open DC again from the "Recent apps"</li>
|
||||||
|
* <li>Check that your draft is still there</li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testOpenAgainFromRecents() {
|
||||||
|
// Open a chat
|
||||||
|
onView(withId(R.id.list)).perform(RecyclerViewActions.actionOnItem(hasDescendant(withText("abc@example.org")), click()));
|
||||||
|
|
||||||
|
// Share some text to DC
|
||||||
|
Intent i = new Intent(Intent.ACTION_SEND);
|
||||||
|
i.putExtra(Intent.EXTRA_TEXT, "Veeery important draft");
|
||||||
|
i.setComponent(new ComponentName(getInstrumentation().getTargetContext().getApplicationContext(), ShareActivity.class));
|
||||||
|
activityRule.getScenario().onActivity(a -> a.startActivity(i));
|
||||||
|
|
||||||
|
// In DC, select the same chat you opened before
|
||||||
|
onView(withId(R.id.list)).perform(RecyclerViewActions.actionOnItem(hasDescendant(withText("abc@example.org")), click()));
|
||||||
|
|
||||||
|
// Leave DC and go back to the previous activity
|
||||||
|
pressBack();
|
||||||
|
|
||||||
|
// Here, we can't exactly replicate the "steps to reproduce". Previously, the other activity
|
||||||
|
// stayed open in the background, but since it doesn't anymore, we need to open it again:
|
||||||
|
onView(withId(R.id.list)).perform(RecyclerViewActions.actionOnItem(hasDescendant(withText("abc@example.org")), click()));
|
||||||
|
|
||||||
|
// Check that the draft is still there
|
||||||
|
// Util.sleep(2000); // Uncomment for debugging
|
||||||
|
onView(withHint(R.string.chat_input_placeholder)).check(matches(withText("Veeery important draft")));
|
||||||
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void cleanup() {
|
public void cleanup() {
|
||||||
|
|
|
@ -47,7 +47,6 @@ import android.view.View.OnFocusChangeListener;
|
||||||
import android.view.View.OnKeyListener;
|
import android.view.View.OnKeyListener;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.webkit.MimeTypeMap;
|
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
@ -132,11 +131,9 @@ import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
import static org.thoughtcrime.securesms.NewConversationActivity.MAILTO;
|
|
||||||
import static org.thoughtcrime.securesms.TransportOption.Type;
|
import static org.thoughtcrime.securesms.TransportOption.Type;
|
||||||
import static org.thoughtcrime.securesms.util.RelayUtil.getSharedText;
|
import static org.thoughtcrime.securesms.util.RelayUtil.getSharedText;
|
||||||
import static org.thoughtcrime.securesms.util.RelayUtil.isForwarding;
|
import static org.thoughtcrime.securesms.util.RelayUtil.isForwarding;
|
||||||
import static org.thoughtcrime.securesms.util.RelayUtil.isRelayingMessageContent;
|
|
||||||
import static org.thoughtcrime.securesms.util.RelayUtil.isSharing;
|
import static org.thoughtcrime.securesms.util.RelayUtil.isSharing;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -175,17 +172,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||||
private static final int PICK_LOCATION = 9; // TODO: i think, this can be deleted
|
private static final int PICK_LOCATION = 9; // TODO: i think, this can be deleted
|
||||||
private static final int SMS_DEFAULT = 11; // TODO: i think, this can be deleted
|
private static final int SMS_DEFAULT = 11; // TODO: i think, this can be deleted
|
||||||
|
|
||||||
/**
|
|
||||||
* If the user opens a chat, goes to another app, and shares some content to the same chat, we will have two ConversationActivity's
|
|
||||||
* with the same chat (because sharing uses startActivityForResult() and all activities started this way will be created a second time,
|
|
||||||
* without affecting the existing activity). So, when the sharing ConversationActivity closes, it sets this variable to `true` so that
|
|
||||||
* the still-running-currently-in-background ConversationActivity re-initializes the draft.
|
|
||||||
* There is always only one still-running-currently-in-background ConversationActivity, which is the one started normally (i.e. with
|
|
||||||
* `startActivity()`). Therefore, after reinitializing the draft in one activity, we can safely set this variable to `false`.
|
|
||||||
* See https://github.com/deltachat/deltachat-android/pull/1770
|
|
||||||
*/
|
|
||||||
private static boolean doReinitializeDraft;
|
|
||||||
|
|
||||||
private GlideRequests glideRequests;
|
private GlideRequests glideRequests;
|
||||||
protected ComposeText composeText;
|
protected ComposeText composeText;
|
||||||
private AnimatingToggle buttonToggle;
|
private AnimatingToggle buttonToggle;
|
||||||
|
@ -214,8 +200,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||||
private final boolean isSecureText = true;
|
private final boolean isSecureText = true;
|
||||||
private boolean isDefaultSms = true;
|
private boolean isDefaultSms = true;
|
||||||
private boolean isSecurityInitialized = false;
|
private boolean isSecurityInitialized = false;
|
||||||
private boolean isShareDraftInitialized = false;
|
|
||||||
|
|
||||||
private boolean successfulForwardingAttempt = false;
|
private boolean successfulForwardingAttempt = false;
|
||||||
|
|
||||||
|
|
||||||
|
@ -279,11 +263,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||||
eventCenter.addObserver(DcContext.DC_EVENT_MSG_DELIVERED, this);
|
eventCenter.addObserver(DcContext.DC_EVENT_MSG_DELIVERED, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isForwarding(this)) {
|
handleRelaying();
|
||||||
handleForwarding();
|
|
||||||
} else if (isSharing(this)) {
|
|
||||||
handleSharing();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -309,11 +289,23 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
handleRelaying();
|
||||||
|
|
||||||
if (fragment != null) {
|
if (fragment != null) {
|
||||||
fragment.onNewIntent();
|
fragment.onNewIntent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleRelaying() {
|
||||||
|
if (isForwarding(this)) {
|
||||||
|
handleForwarding();
|
||||||
|
} else if (isSharing(this)) {
|
||||||
|
handleSharing();
|
||||||
|
}
|
||||||
|
|
||||||
|
ConversationListRelayingActivity.finishActivity();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
@ -333,11 +325,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||||
|
|
||||||
DcHelper.getNotificationCenter(this).updateVisibleChat(dcContext.getAccountId(), chatId);
|
DcHelper.getNotificationCenter(this).updateVisibleChat(dcContext.getAccountId(), chatId);
|
||||||
|
|
||||||
if (doReinitializeDraft) {
|
|
||||||
initializeDraft();
|
|
||||||
doReinitializeDraft = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
attachmentManager.onResume();
|
attachmentManager.onResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,10 +333,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||||
super.onPause();
|
super.onPause();
|
||||||
|
|
||||||
processComposeControls(ACTION_SAVE_DRAFT);
|
processComposeControls(ACTION_SAVE_DRAFT);
|
||||||
if (getCallingActivity() != null) {
|
|
||||||
// `getCallingActivity() != null` finds out whether the activity was started using `startActivityForResult()`.
|
|
||||||
doReinitializeDraft = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
DcHelper.getNotificationCenter(this).clearVisibleChat();
|
DcHelper.getNotificationCenter(this).clearVisibleChat();
|
||||||
if (isFinishing()) overridePendingTransition(R.anim.fade_scale_in, R.anim.slide_to_right);
|
if (isFinishing()) overridePendingTransition(R.anim.fade_scale_in, R.anim.slide_to_right);
|
||||||
|
@ -439,7 +422,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||||
break;
|
break;
|
||||||
case ScribbleActivity.SCRIBBLE_REQUEST_CODE:
|
case ScribbleActivity.SCRIBBLE_REQUEST_CODE:
|
||||||
setMedia(data.getData(), MediaType.IMAGE);
|
setMedia(data.getData(), MediaType.IMAGE);
|
||||||
doReinitializeDraft = false;
|
|
||||||
break;
|
break;
|
||||||
case SMS_DEFAULT:
|
case SMS_DEFAULT:
|
||||||
initializeSecurity(isSecureText, isDefaultSms);
|
initializeSecurity(isSecureText, isDefaultSms);
|
||||||
|
@ -614,17 +596,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleReturnToConversationList(@Nullable Bundle extras) {
|
private void handleReturnToConversationList(@Nullable Bundle extras) {
|
||||||
if (isRelayingMessageContent(this) || successfulForwardingAttempt) {
|
|
||||||
if (isSharing(this)) {
|
|
||||||
// we're allowing only 1 try to share, going back to the conversation list will
|
|
||||||
// close the conversation list in activtyForResult() as well, so that the user
|
|
||||||
// comes back to the external app's share menu
|
|
||||||
setResult(RESULT_OK);
|
|
||||||
}
|
|
||||||
finish();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean archived = getIntent().getBooleanExtra(FROM_ARCHIVED_CHATS_EXTRA, false);
|
boolean archived = getIntent().getBooleanExtra(FROM_ARCHIVED_CHATS_EXTRA, false);
|
||||||
Intent intent = new Intent(this, (archived ? ConversationListArchiveActivity.class : ConversationListActivity.class));
|
Intent intent = new Intent(this, (archived ? ConversationListArchiveActivity.class : ConversationListActivity.class));
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
@ -749,12 +720,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||||
} else {
|
} else {
|
||||||
dcContext.setDraft(chatId, SendRelayedMessageUtil.createMessage(this, uriList.get(0), getSharedText(this)));
|
dcContext.setDraft(chatId, SendRelayedMessageUtil.createMessage(this, uriList.get(0), getSharedText(this)));
|
||||||
}
|
}
|
||||||
initializeDraft().addListener(new AssertedSuccessListener<Boolean>() {
|
initializeDraft();
|
||||||
@Override
|
|
||||||
public void onSuccess(Boolean result) {
|
|
||||||
isShareDraftInitialized = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1209,11 +1175,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||||
|
|
||||||
fragment.scrollToBottom();
|
fragment.scrollToBottom();
|
||||||
attachmentManager.cleanup();
|
attachmentManager.cleanup();
|
||||||
|
|
||||||
if (isShareDraftInitialized) {
|
|
||||||
isShareDraftInitialized = false;
|
|
||||||
setResult(RESULT_OK);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -281,6 +281,9 @@ public class ConversationFragment extends MessageSelectorFragment
|
||||||
ConversationAdapter adapter = new ConversationAdapter(getActivity(), this.recipient.getChat(), GlideApp.with(this), locale, selectionClickListener, this.recipient);
|
ConversationAdapter adapter = new ConversationAdapter(getActivity(), this.recipient.getChat(), GlideApp.with(this), locale, selectionClickListener, this.recipient);
|
||||||
list.setAdapter(adapter);
|
list.setAdapter(adapter);
|
||||||
|
|
||||||
|
if (dateDecoration != null) {
|
||||||
|
list.removeItemDecoration(dateDecoration);
|
||||||
|
}
|
||||||
dateDecoration = new StickyHeaderDecoration(adapter, false, false);
|
dateDecoration = new StickyHeaderDecoration(adapter, false, false);
|
||||||
list.addItemDecoration(dateDecoration);
|
list.addItemDecoration(dateDecoration);
|
||||||
|
|
||||||
|
@ -295,11 +298,11 @@ public class ConversationFragment extends MessageSelectorFragment
|
||||||
reloadList();
|
reloadList();
|
||||||
updateLocationButton();
|
updateLocationButton();
|
||||||
|
|
||||||
if (freshMsgs > 0) {
|
|
||||||
getListAdapter().setLastSeenPosition(freshMsgs - 1);
|
|
||||||
if (lastSeenDecoration != null) {
|
if (lastSeenDecoration != null) {
|
||||||
list.removeItemDecoration(lastSeenDecoration);
|
list.removeItemDecoration(lastSeenDecoration);
|
||||||
}
|
}
|
||||||
|
if (freshMsgs > 0) {
|
||||||
|
getListAdapter().setLastSeenPosition(freshMsgs - 1);
|
||||||
lastSeenDecoration = new ConversationAdapter.LastSeenHeader(getListAdapter());
|
lastSeenDecoration = new ConversationAdapter.LastSeenHeader(getListAdapter());
|
||||||
list.addItemDecoration(lastSeenDecoration);
|
list.addItemDecoration(lastSeenDecoration);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.thoughtcrime.securesms;
|
||||||
import static org.thoughtcrime.securesms.ConversationActivity.CHAT_ID_EXTRA;
|
import static org.thoughtcrime.securesms.ConversationActivity.CHAT_ID_EXTRA;
|
||||||
import static org.thoughtcrime.securesms.ConversationActivity.STARTING_POSITION_EXTRA;
|
import static org.thoughtcrime.securesms.ConversationActivity.STARTING_POSITION_EXTRA;
|
||||||
import static org.thoughtcrime.securesms.map.MapDataManager.ALL_CHATS_GLOBAL_MAP;
|
import static org.thoughtcrime.securesms.map.MapDataManager.ALL_CHATS_GLOBAL_MAP;
|
||||||
import static org.thoughtcrime.securesms.util.RelayUtil.REQUEST_RELAY;
|
|
||||||
import static org.thoughtcrime.securesms.util.RelayUtil.acquireRelayMessageContent;
|
import static org.thoughtcrime.securesms.util.RelayUtil.acquireRelayMessageContent;
|
||||||
import static org.thoughtcrime.securesms.util.RelayUtil.getDirectSharingChatId;
|
import static org.thoughtcrime.securesms.util.RelayUtil.getDirectSharingChatId;
|
||||||
import static org.thoughtcrime.securesms.util.RelayUtil.isDirectSharing;
|
import static org.thoughtcrime.securesms.util.RelayUtil.isDirectSharing;
|
||||||
|
@ -66,6 +65,7 @@ import org.thoughtcrime.securesms.util.DynamicLanguage;
|
||||||
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme;
|
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme;
|
||||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||||
import org.thoughtcrime.securesms.util.Prefs;
|
import org.thoughtcrime.securesms.util.Prefs;
|
||||||
|
import org.thoughtcrime.securesms.util.RelayUtil;
|
||||||
import org.thoughtcrime.securesms.util.SendRelayedMessageUtil;
|
import org.thoughtcrime.securesms.util.SendRelayedMessageUtil;
|
||||||
|
|
||||||
public class ConversationListActivity extends PassphraseRequiredActionBarActivity
|
public class ConversationListActivity extends PassphraseRequiredActionBarActivity
|
||||||
|
@ -212,10 +212,6 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
|
||||||
if (isDirectSharing(this)) {
|
if (isDirectSharing(this)) {
|
||||||
openConversation(getDirectSharingChatId(this), -1);
|
openConversation(getDirectSharingChatId(this), -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isDirectSharing(this)) {
|
|
||||||
openConversation(getDirectSharingChatId(this), -1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshTitle() {
|
public void refreshTitle() {
|
||||||
|
@ -395,10 +391,8 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
|
||||||
intent.putExtra(STARTING_POSITION_EXTRA, startingPosition);
|
intent.putExtra(STARTING_POSITION_EXTRA, startingPosition);
|
||||||
if (isRelayingMessageContent(this)) {
|
if (isRelayingMessageContent(this)) {
|
||||||
acquireRelayMessageContent(this, intent);
|
acquireRelayMessageContent(this, intent);
|
||||||
startActivityForResult(intent, REQUEST_RELAY);
|
|
||||||
} else {
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
}
|
||||||
|
startActivity(intent);
|
||||||
|
|
||||||
overridePendingTransition(R.anim.slide_from_right, R.anim.fade_scale_out);
|
overridePendingTransition(R.anim.slide_from_right, R.anim.fade_scale_out);
|
||||||
}
|
}
|
||||||
|
@ -409,10 +403,8 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
|
||||||
Intent intent = new Intent(this, ConversationListArchiveActivity.class);
|
Intent intent = new Intent(this, ConversationListArchiveActivity.class);
|
||||||
if (isRelayingMessageContent(this)) {
|
if (isRelayingMessageContent(this)) {
|
||||||
acquireRelayMessageContent(this, intent);
|
acquireRelayMessageContent(this, intent);
|
||||||
startActivityForResult(intent, REQUEST_RELAY);
|
|
||||||
} else {
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
}
|
||||||
|
startActivity(intent);
|
||||||
overridePendingTransition(R.anim.slide_from_right, R.anim.fade_scale_out);
|
overridePendingTransition(R.anim.slide_from_right, R.anim.fade_scale_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -429,10 +421,8 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
|
||||||
Intent intent = new Intent(this, NewConversationActivity.class);
|
Intent intent = new Intent(this, NewConversationActivity.class);
|
||||||
if (isRelayingMessageContent(this)) {
|
if (isRelayingMessageContent(this)) {
|
||||||
acquireRelayMessageContent(this, intent);
|
acquireRelayMessageContent(this, intent);
|
||||||
startActivityForResult(intent, REQUEST_RELAY);
|
|
||||||
} else {
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
}
|
||||||
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -444,13 +434,6 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
|
||||||
QrCodeHandler qrCodeHandler = new QrCodeHandler(this);
|
QrCodeHandler qrCodeHandler = new QrCodeHandler(this);
|
||||||
qrCodeHandler.onScanPerformed(scanResult);
|
qrCodeHandler.onScanPerformed(scanResult);
|
||||||
break;
|
break;
|
||||||
case REQUEST_RELAY:
|
|
||||||
if (resultCode == RESULT_OK) {
|
|
||||||
handleResetRelaying();
|
|
||||||
setResult(RESULT_OK);
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||||
|
|
||||||
import static org.thoughtcrime.securesms.ConversationActivity.CHAT_ID_EXTRA;
|
import static org.thoughtcrime.securesms.ConversationActivity.CHAT_ID_EXTRA;
|
||||||
import static org.thoughtcrime.securesms.ConversationActivity.FROM_ARCHIVED_CHATS_EXTRA;
|
import static org.thoughtcrime.securesms.ConversationActivity.FROM_ARCHIVED_CHATS_EXTRA;
|
||||||
import static org.thoughtcrime.securesms.util.RelayUtil.REQUEST_RELAY;
|
|
||||||
import static org.thoughtcrime.securesms.util.RelayUtil.acquireRelayMessageContent;
|
import static org.thoughtcrime.securesms.util.RelayUtil.acquireRelayMessageContent;
|
||||||
import static org.thoughtcrime.securesms.util.RelayUtil.isRelayingMessageContent;
|
import static org.thoughtcrime.securesms.util.RelayUtil.isRelayingMessageContent;
|
||||||
import static org.thoughtcrime.securesms.util.RelayUtil.isSharing;
|
import static org.thoughtcrime.securesms.util.RelayUtil.isSharing;
|
||||||
|
@ -84,7 +83,7 @@ public class ConversationListArchiveActivity extends PassphraseRequiredActionBar
|
||||||
|
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case android.R.id.home:
|
case android.R.id.home:
|
||||||
super.onBackPressed();
|
onBackPressed();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case R.id.mark_as_read:
|
case R.id.mark_as_read:
|
||||||
|
@ -95,6 +94,20 @@ public class ConversationListArchiveActivity extends PassphraseRequiredActionBar
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
if (isRelayingMessageContent(this)) {
|
||||||
|
// Go back to the ConversationListRelayingActivity
|
||||||
|
super.onBackPressed();
|
||||||
|
} else {
|
||||||
|
// Load the ConversationListActivity in case it's not existent for some reason
|
||||||
|
Intent intent = new Intent(this, ConversationListActivity.class);
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateConversation(int chatId) {
|
public void onCreateConversation(int chatId) {
|
||||||
Intent intent = new Intent(this, ConversationActivity.class);
|
Intent intent = new Intent(this, ConversationActivity.class);
|
||||||
|
@ -102,10 +115,13 @@ public class ConversationListArchiveActivity extends PassphraseRequiredActionBar
|
||||||
intent.putExtra(FROM_ARCHIVED_CHATS_EXTRA, true);
|
intent.putExtra(FROM_ARCHIVED_CHATS_EXTRA, true);
|
||||||
if (isRelayingMessageContent(this)) {
|
if (isRelayingMessageContent(this)) {
|
||||||
acquireRelayMessageContent(this, intent);
|
acquireRelayMessageContent(this, intent);
|
||||||
startActivityForResult(intent, REQUEST_RELAY);
|
|
||||||
} else {
|
// Just finish instead of updating the title and so on. This is not user-visible
|
||||||
startActivity(intent);
|
// because the ConversationActivity will restart the ConversationListArchiveActivity
|
||||||
|
// after the user left.
|
||||||
|
finish();
|
||||||
}
|
}
|
||||||
|
startActivity(intent);
|
||||||
|
|
||||||
overridePendingTransition(R.anim.slide_from_right, R.anim.fade_scale_out);
|
overridePendingTransition(R.anim.slide_from_right, R.anim.fade_scale_out);
|
||||||
}
|
}
|
||||||
|
@ -114,13 +130,4 @@ public class ConversationListArchiveActivity extends PassphraseRequiredActionBar
|
||||||
public void onSwitchToArchive() {
|
public void onSwitchToArchive() {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
|
||||||
if (requestCode == REQUEST_RELAY && resultCode == RESULT_OK) {
|
|
||||||
setResult(RESULT_OK);
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,6 @@ import java.util.Set;
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
|
||||||
import static org.thoughtcrime.securesms.util.RelayUtil.REQUEST_RELAY;
|
|
||||||
import static org.thoughtcrime.securesms.util.RelayUtil.acquireRelayMessageContent;
|
import static org.thoughtcrime.securesms.util.RelayUtil.acquireRelayMessageContent;
|
||||||
import static org.thoughtcrime.securesms.util.RelayUtil.getSharedText;
|
import static org.thoughtcrime.securesms.util.RelayUtil.getSharedText;
|
||||||
import static org.thoughtcrime.securesms.util.RelayUtil.getSharedUris;
|
import static org.thoughtcrime.securesms.util.RelayUtil.getSharedUris;
|
||||||
|
@ -232,7 +231,7 @@ public class ConversationListFragment extends Fragment
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
acquireRelayMessageContent(getActivity(), intent);
|
acquireRelayMessageContent(getActivity(), intent);
|
||||||
fab.setOnClickListener(v -> getActivity().startActivityForResult(intent, REQUEST_RELAY));
|
fab.setOnClickListener(v -> getActivity().startActivity(intent));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fab.setOnClickListener(v -> startActivity(intent));
|
fab.setOnClickListener(v -> startActivity(intent));
|
||||||
|
@ -597,13 +596,13 @@ public class ConversationListFragment extends Fragment
|
||||||
public void handleEvent(@NonNull DcEvent event) {
|
public void handleEvent(@NonNull DcEvent event) {
|
||||||
if (event.getId() == DcContext.DC_EVENT_CONNECTIVITY_CHANGED) {
|
if (event.getId() == DcContext.DC_EVENT_CONNECTIVITY_CHANGED) {
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
if (activity != null) {
|
if (activity instanceof ConversationListActivity) {
|
||||||
((ConversationListActivity) activity).refreshTitle();
|
((ConversationListActivity) activity).refreshTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (event.getId() == DcContext.DC_EVENT_SELFAVATAR_CHANGED) {
|
} else if (event.getId() == DcContext.DC_EVENT_SELFAVATAR_CHANGED) {
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
if (activity != null) {
|
if (activity instanceof ConversationListActivity) {
|
||||||
((ConversationListActivity) activity).refreshAvatar();
|
((ConversationListActivity) activity).refreshAvatar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package org.thoughtcrime.securesms;
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
import static org.thoughtcrime.securesms.util.RelayUtil.REQUEST_RELAY;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "Relaying" means "Forwarding or Sharing".
|
* "Relaying" means "Forwarding or Sharing".
|
||||||
*
|
*
|
||||||
|
@ -25,13 +26,34 @@ import androidx.fragment.app.Fragment;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ConversationListRelayingActivity extends ConversationListActivity {
|
public class ConversationListRelayingActivity extends ConversationListActivity {
|
||||||
|
static WeakReference<ConversationListRelayingActivity> INSTANCE = null;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle icicle, boolean ready) {
|
||||||
|
super.onCreate(icicle, ready);
|
||||||
|
INSTANCE = new WeakReference<>(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
INSTANCE = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// =================== Static Methods ===================
|
||||||
public static void start(Fragment fragment, Intent intent) {
|
public static void start(Fragment fragment, Intent intent) {
|
||||||
intent.setComponent(new ComponentName(fragment.getContext(), ConversationListRelayingActivity.class));
|
intent.setComponent(new ComponentName(fragment.getContext(), ConversationListRelayingActivity.class));
|
||||||
fragment.startActivityForResult(intent, REQUEST_RELAY);
|
fragment.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void start(Activity activity, Intent intent) {
|
public static void start(Activity activity, Intent intent) {
|
||||||
intent.setComponent(new ComponentName(activity, ConversationListRelayingActivity.class));
|
intent.setComponent(new ComponentName(activity, ConversationListRelayingActivity.class));
|
||||||
activity.startActivityForResult(intent, REQUEST_RELAY);
|
activity.startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void finishActivity() {
|
||||||
|
if (INSTANCE != null && INSTANCE.get() != null) {
|
||||||
|
INSTANCE.get().finish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,6 @@ import java.util.Map;
|
||||||
|
|
||||||
import static org.thoughtcrime.securesms.ConversationActivity.CHAT_ID_EXTRA;
|
import static org.thoughtcrime.securesms.ConversationActivity.CHAT_ID_EXTRA;
|
||||||
import static org.thoughtcrime.securesms.ConversationActivity.TEXT_EXTRA;
|
import static org.thoughtcrime.securesms.ConversationActivity.TEXT_EXTRA;
|
||||||
import static org.thoughtcrime.securesms.util.RelayUtil.REQUEST_RELAY;
|
|
||||||
import static org.thoughtcrime.securesms.util.RelayUtil.acquireRelayMessageContent;
|
import static org.thoughtcrime.securesms.util.RelayUtil.acquireRelayMessageContent;
|
||||||
import static org.thoughtcrime.securesms.util.RelayUtil.isRelayingMessageContent;
|
import static org.thoughtcrime.securesms.util.RelayUtil.isRelayingMessageContent;
|
||||||
|
|
||||||
|
@ -182,12 +181,10 @@ public class NewConversationActivity extends ContactSelectionActivity {
|
||||||
intent.putExtra(CHAT_ID_EXTRA, chatId);
|
intent.putExtra(CHAT_ID_EXTRA, chatId);
|
||||||
if (isRelayingMessageContent(this)) {
|
if (isRelayingMessageContent(this)) {
|
||||||
acquireRelayMessageContent(this, intent);
|
acquireRelayMessageContent(this, intent);
|
||||||
startActivityForResult(intent, REQUEST_RELAY);
|
}
|
||||||
} else {
|
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
@ -211,13 +208,4 @@ public class NewConversationActivity extends ContactSelectionActivity {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
|
||||||
if (requestCode == REQUEST_RELAY && resultCode == RESULT_OK) {
|
|
||||||
setResult(RESULT_OK);
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,8 +269,6 @@ public class ShareActivity extends PassphraseRequiredActionBarActivity implement
|
||||||
RelayUtil.setSharedUris(composeIntent, resolvedExtras);
|
RelayUtil.setSharedUris(composeIntent, resolvedExtras);
|
||||||
ConversationListRelayingActivity.start(this, composeIntent);
|
ConversationListRelayingActivity.start(this, composeIntent);
|
||||||
}
|
}
|
||||||
// We use startActivityForResult() here so that the conversations list is correctly updated. (hide "Device messages", ...)a
|
|
||||||
// With startActivity() the list was not always updated before and after sharing and incorrectly showed or did not show the device talk.
|
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ public class RelayUtil {
|
||||||
private static final String FORWARDED_MESSAGE_IDS = "forwarded_message_ids";
|
private static final String FORWARDED_MESSAGE_IDS = "forwarded_message_ids";
|
||||||
private static final String SHARED_URIS = "shared_uris";
|
private static final String SHARED_URIS = "shared_uris";
|
||||||
private static final String IS_SHARING = "is_sharing";
|
private static final String IS_SHARING = "is_sharing";
|
||||||
public static final int REQUEST_RELAY = 100;
|
|
||||||
private static final String DIRECT_SHARING_CHAT_ID = "direct_sharing_chat_id";
|
private static final String DIRECT_SHARING_CHAT_ID = "direct_sharing_chat_id";
|
||||||
|
|
||||||
public static boolean isRelayingMessageContent(Activity activity) {
|
public static boolean isRelayingMessageContent(Activity activity) {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import android.util.Log;
|
||||||
import com.b44t.messenger.DcContext;
|
import com.b44t.messenger.DcContext;
|
||||||
import com.b44t.messenger.DcMsg;
|
import com.b44t.messenger.DcMsg;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.ConversationListRelayingActivity;
|
||||||
import org.thoughtcrime.securesms.connect.DcHelper;
|
import org.thoughtcrime.securesms.connect.DcHelper;
|
||||||
import org.thoughtcrime.securesms.mms.PartAuthority;
|
import org.thoughtcrime.securesms.mms.PartAuthority;
|
||||||
import org.thoughtcrime.securesms.providers.PersistentBlobProvider;
|
import org.thoughtcrime.securesms.providers.PersistentBlobProvider;
|
||||||
|
@ -33,7 +34,7 @@ public class SendRelayedMessageUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void immediatelyRelay(Activity activity, final Long[] chatIds) {
|
public static void immediatelyRelay(Activity activity, final Long[] chatIds) {
|
||||||
activity.setResult(RESULT_OK);
|
ConversationListRelayingActivity.finishActivity();
|
||||||
if (isForwarding(activity)) {
|
if (isForwarding(activity)) {
|
||||||
int[] forwardedMessageIDs = getForwardedMessageIDs(activity);
|
int[] forwardedMessageIDs = getForwardedMessageIDs(activity);
|
||||||
resetRelayingMessageContent(activity);
|
resetRelayingMessageContent(activity);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue