mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-21 09:18:27 +00:00
Add failsafe for invalid shortcuts.
Some launchers may create broken shortcuts, so we just want to have a smooth fallback in that scenario. Fixes #8109
This commit is contained in:
parent
3c6b8bcf9b
commit
c49b0348bd
@ -685,6 +685,9 @@
|
|||||||
<string name="SearchToolbar_search">Search</string>
|
<string name="SearchToolbar_search">Search</string>
|
||||||
<string name="SearchToolbar_search_for_conversations_contacts_and_messages">Search for conversations, contacts, and messages</string>
|
<string name="SearchToolbar_search_for_conversations_contacts_and_messages">Search for conversations, contacts, and messages</string>
|
||||||
|
|
||||||
|
<!-- ShortcutLauncherActivity -->
|
||||||
|
<string name="ShortcutLauncherActivity_invalid_shortcut">Invalid shortcut</string>
|
||||||
|
|
||||||
<!-- SingleRecipientNotificationBuilder -->
|
<!-- SingleRecipientNotificationBuilder -->
|
||||||
<string name="SingleRecipientNotificationBuilder_signal">Signal</string>
|
<string name="SingleRecipientNotificationBuilder_signal">Signal</string>
|
||||||
<string name="SingleRecipientNotificationBuilder_new_message">New message</string>
|
<string name="SingleRecipientNotificationBuilder_new_message">New message</string>
|
||||||
|
@ -8,6 +8,7 @@ import android.support.annotation.NonNull;
|
|||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.TaskStackBuilder;
|
import android.support.v4.app.TaskStackBuilder;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.database.Address;
|
import org.thoughtcrime.securesms.database.Address;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
@ -30,11 +31,19 @@ public class ShortcutLauncherActivity extends AppCompatActivity {
|
|||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
String serializedAddress = getIntent().getStringExtra(KEY_SERIALIZED_ADDRESS);
|
String serializedAddress = getIntent().getStringExtra(KEY_SERIALIZED_ADDRESS);
|
||||||
Address address = Address.fromSerialized(serializedAddress);
|
|
||||||
Recipient recipient = Recipient.from(this, address, true);
|
if (serializedAddress == null) {
|
||||||
TaskStackBuilder backStack = TaskStackBuilder.create(this)
|
Toast.makeText(this, R.string.ShortcutLauncherActivity_invalid_shortcut, Toast.LENGTH_SHORT).show();
|
||||||
.addNextIntent(new Intent(this, ConversationListActivity.class));
|
startActivity(new Intent(this, ConversationListActivity.class));
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Address address = Address.fromSerialized(serializedAddress);
|
||||||
|
Recipient recipient = Recipient.from(this, address, true);
|
||||||
|
TaskStackBuilder backStack = TaskStackBuilder.create(this)
|
||||||
|
.addNextIntent(new Intent(this, ConversationListActivity.class));
|
||||||
|
|
||||||
CommunicationActions.startConversation(this, recipient, null, backStack);
|
CommunicationActions.startConversation(this, recipient, null, backStack);
|
||||||
finish();
|
finish();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user