Commit fb10ba58 authored by Torsten Grote's avatar Torsten Grote

[android] Receive external intents through NavDrawerActivity

This ensures that our main activity is on the task stack below the
activity opened by an external intent. So when the user navigates back,
they always get back to the main activity.
parent f31b85ac
This diff is collapsed.
...@@ -9,6 +9,7 @@ import android.app.PendingIntent; ...@@ -9,6 +9,7 @@ import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes; import android.support.annotation.StringRes;
import android.support.annotation.UiThread; import android.support.annotation.UiThread;
import android.support.v4.app.NotificationCompat; import android.support.v4.app.NotificationCompat;
...@@ -73,10 +74,11 @@ import static android.support.v4.app.NotificationCompat.VISIBILITY_SECRET; ...@@ -73,10 +74,11 @@ import static android.support.v4.app.NotificationCompat.VISIBILITY_SECRET;
import static android.support.v4.content.ContextCompat.getColor; import static android.support.v4.content.ContextCompat.getColor;
import static org.briarproject.briar.android.activity.BriarActivity.GROUP_ID; import static org.briarproject.briar.android.activity.BriarActivity.GROUP_ID;
import static org.briarproject.briar.android.conversation.ConversationActivity.CONTACT_ID; import static org.briarproject.briar.android.conversation.ConversationActivity.CONTACT_ID;
import static org.briarproject.briar.android.navdrawer.NavDrawerActivity.INTENT_BLOGS; import static org.briarproject.briar.android.navdrawer.NavDrawerActivity.BLOG_URI;
import static org.briarproject.briar.android.navdrawer.NavDrawerActivity.INTENT_CONTACTS; import static org.briarproject.briar.android.navdrawer.NavDrawerActivity.CONTACT_ADDED_URI;
import static org.briarproject.briar.android.navdrawer.NavDrawerActivity.INTENT_FORUMS; import static org.briarproject.briar.android.navdrawer.NavDrawerActivity.CONTACT_URI;
import static org.briarproject.briar.android.navdrawer.NavDrawerActivity.INTENT_GROUPS; import static org.briarproject.briar.android.navdrawer.NavDrawerActivity.FORUM_URI;
import static org.briarproject.briar.android.navdrawer.NavDrawerActivity.GROUP_URI;
import static org.briarproject.briar.android.settings.SettingsFragment.SETTINGS_NAMESPACE; import static org.briarproject.briar.android.settings.SettingsFragment.SETTINGS_NAMESPACE;
@ThreadSafe @ThreadSafe
...@@ -101,7 +103,9 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager, ...@@ -101,7 +103,9 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
private final Multiset<GroupId> blogCounts = new Multiset<>(); private final Multiset<GroupId> blogCounts = new Multiset<>();
private int contactAddedTotal = 0; private int contactAddedTotal = 0;
private int nextRequestId = 0; private int nextRequestId = 0;
@Nullable
private ContactId blockedContact = null; private ContactId blockedContact = null;
@Nullable
private GroupId blockedGroup = null; private GroupId blockedGroup = null;
private boolean blockSignInReminder = false; private boolean blockSignInReminder = false;
private boolean blockBlogs = false; private boolean blockBlogs = false;
...@@ -325,9 +329,8 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager, ...@@ -325,9 +329,8 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
} else { } else {
// Touching the notification shows the contact list // Touching the notification shows the contact list
Intent i = new Intent(appContext, NavDrawerActivity.class); Intent i = new Intent(appContext, NavDrawerActivity.class);
i.putExtra(INTENT_CONTACTS, true);
i.setFlags(FLAG_ACTIVITY_CLEAR_TOP); i.setFlags(FLAG_ACTIVITY_CLEAR_TOP);
i.setData(Uri.parse(CONTACT_URI)); i.setData(CONTACT_URI);
TaskStackBuilder t = TaskStackBuilder.create(appContext); TaskStackBuilder t = TaskStackBuilder.create(appContext);
t.addParentStack(NavDrawerActivity.class); t.addParentStack(NavDrawerActivity.class);
t.addNextIntent(i); t.addNextIntent(i);
...@@ -363,9 +366,9 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager, ...@@ -363,9 +366,9 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
return defaults; return defaults;
} }
private void setDeleteIntent(BriarNotificationBuilder b, String uri) { private void setDeleteIntent(BriarNotificationBuilder b, Uri uri) {
Intent i = new Intent(appContext, NotificationCleanupService.class); Intent i = new Intent(appContext, NotificationCleanupService.class);
i.setData(Uri.parse(uri)); i.setData(uri);
b.setDeleteIntent(PendingIntent.getService(appContext, nextRequestId++, b.setDeleteIntent(PendingIntent.getService(appContext, nextRequestId++,
i, 0)); i, 0));
} }
...@@ -425,9 +428,8 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager, ...@@ -425,9 +428,8 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
} else { } else {
// Touching the notification shows the group list // Touching the notification shows the group list
Intent i = new Intent(appContext, NavDrawerActivity.class); Intent i = new Intent(appContext, NavDrawerActivity.class);
i.putExtra(INTENT_GROUPS, true);
i.setFlags(FLAG_ACTIVITY_CLEAR_TOP); i.setFlags(FLAG_ACTIVITY_CLEAR_TOP);
i.setData(Uri.parse(GROUP_URI)); i.setData(GROUP_URI);
TaskStackBuilder t = TaskStackBuilder.create(appContext); TaskStackBuilder t = TaskStackBuilder.create(appContext);
t.addParentStack(NavDrawerActivity.class); t.addParentStack(NavDrawerActivity.class);
t.addNextIntent(i); t.addNextIntent(i);
...@@ -493,9 +495,8 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager, ...@@ -493,9 +495,8 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
} else { } else {
// Touching the notification shows the forum list // Touching the notification shows the forum list
Intent i = new Intent(appContext, NavDrawerActivity.class); Intent i = new Intent(appContext, NavDrawerActivity.class);
i.putExtra(INTENT_FORUMS, true);
i.setFlags(FLAG_ACTIVITY_CLEAR_TOP); i.setFlags(FLAG_ACTIVITY_CLEAR_TOP);
i.setData(Uri.parse(FORUM_URI)); i.setData(FORUM_URI);
TaskStackBuilder t = TaskStackBuilder.create(appContext); TaskStackBuilder t = TaskStackBuilder.create(appContext);
t.addParentStack(NavDrawerActivity.class); t.addParentStack(NavDrawerActivity.class);
t.addNextIntent(i); t.addNextIntent(i);
...@@ -546,9 +547,8 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager, ...@@ -546,9 +547,8 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
setDeleteIntent(b, BLOG_URI); setDeleteIntent(b, BLOG_URI);
// Touching the notification shows the combined blog feed // Touching the notification shows the combined blog feed
Intent i = new Intent(appContext, NavDrawerActivity.class); Intent i = new Intent(appContext, NavDrawerActivity.class);
i.putExtra(INTENT_BLOGS, true);
i.setFlags(FLAG_ACTIVITY_CLEAR_TOP); i.setFlags(FLAG_ACTIVITY_CLEAR_TOP);
i.setData(Uri.parse(BLOG_URI)); i.setData(BLOG_URI);
TaskStackBuilder t = TaskStackBuilder.create(appContext); TaskStackBuilder t = TaskStackBuilder.create(appContext);
t.addParentStack(NavDrawerActivity.class); t.addParentStack(NavDrawerActivity.class);
t.addNextIntent(i); t.addNextIntent(i);
...@@ -585,9 +585,8 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager, ...@@ -585,9 +585,8 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
setDeleteIntent(b, CONTACT_ADDED_URI); setDeleteIntent(b, CONTACT_ADDED_URI);
// Touching the notification shows the contact list // Touching the notification shows the contact list
Intent i = new Intent(appContext, NavDrawerActivity.class); Intent i = new Intent(appContext, NavDrawerActivity.class);
i.putExtra(INTENT_CONTACTS, true);
i.setFlags(FLAG_ACTIVITY_CLEAR_TOP); i.setFlags(FLAG_ACTIVITY_CLEAR_TOP);
i.setData(Uri.parse(CONTACT_URI)); i.setData(CONTACT_URI);
TaskStackBuilder t = TaskStackBuilder.create(appContext); TaskStackBuilder t = TaskStackBuilder.create(appContext);
t.addParentStack(NavDrawerActivity.class); t.addParentStack(NavDrawerActivity.class);
t.addNextIntent(i); t.addNextIntent(i);
......
...@@ -2,17 +2,18 @@ package org.briarproject.briar.android; ...@@ -2,17 +2,18 @@ package org.briarproject.briar.android;
import android.app.IntentService; import android.app.IntentService;
import android.content.Intent; import android.content.Intent;
import android.net.Uri;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import org.briarproject.briar.api.android.AndroidNotificationManager; import org.briarproject.briar.api.android.AndroidNotificationManager;
import javax.inject.Inject; import javax.inject.Inject;
import static org.briarproject.briar.api.android.AndroidNotificationManager.BLOG_URI; import static org.briarproject.briar.android.navdrawer.NavDrawerActivity.BLOG_URI;
import static org.briarproject.briar.api.android.AndroidNotificationManager.CONTACT_URI; import static org.briarproject.briar.android.navdrawer.NavDrawerActivity.CONTACT_ADDED_URI;
import static org.briarproject.briar.api.android.AndroidNotificationManager.FORUM_URI; import static org.briarproject.briar.android.navdrawer.NavDrawerActivity.CONTACT_URI;
import static org.briarproject.briar.api.android.AndroidNotificationManager.GROUP_URI; import static org.briarproject.briar.android.navdrawer.NavDrawerActivity.FORUM_URI;
import static org.briarproject.briar.api.android.AndroidNotificationManager.CONTACT_ADDED_URI; import static org.briarproject.briar.android.navdrawer.NavDrawerActivity.GROUP_URI;
public class NotificationCleanupService extends IntentService { public class NotificationCleanupService extends IntentService {
...@@ -37,7 +38,7 @@ public class NotificationCleanupService extends IntentService { ...@@ -37,7 +38,7 @@ public class NotificationCleanupService extends IntentService {
@Override @Override
protected void onHandleIntent(@Nullable Intent i) { protected void onHandleIntent(@Nullable Intent i) {
if (i == null || i.getData() == null) return; if (i == null || i.getData() == null) return;
String uri = i.getData().toString(); Uri uri = i.getData();
if (uri.equals(CONTACT_URI)) { if (uri.equals(CONTACT_URI)) {
notificationManager.clearAllContactNotifications(); notificationManager.clearAllContactNotifications();
} else if (uri.equals(GROUP_URI)) { } else if (uri.equals(GROUP_URI)) {
......
...@@ -12,11 +12,11 @@ import android.widget.CheckBox; ...@@ -12,11 +12,11 @@ import android.widget.CheckBox;
import org.briarproject.bramble.api.nullsafety.MethodsNotNullByDefault; import org.briarproject.bramble.api.nullsafety.MethodsNotNullByDefault;
import org.briarproject.bramble.api.nullsafety.ParametersNotNullByDefault; import org.briarproject.bramble.api.nullsafety.ParametersNotNullByDefault;
import org.briarproject.briar.R; import org.briarproject.briar.R;
import org.briarproject.briar.android.account.UnlockActivity;
import org.briarproject.briar.android.controller.BriarController; import org.briarproject.briar.android.controller.BriarController;
import org.briarproject.briar.android.controller.DbController; import org.briarproject.briar.android.controller.DbController;
import org.briarproject.briar.android.controller.handler.UiResultHandler; import org.briarproject.briar.android.controller.handler.UiResultHandler;
import org.briarproject.briar.android.login.StartupActivity; import org.briarproject.briar.android.login.StartupActivity;
import org.briarproject.briar.android.account.UnlockActivity;
import org.briarproject.briar.android.logout.ExitActivity; import org.briarproject.briar.android.logout.ExitActivity;
import org.briarproject.briar.api.android.LockManager; import org.briarproject.briar.api.android.LockManager;
...@@ -66,9 +66,7 @@ public abstract class BriarActivity extends BaseActivity { ...@@ -66,9 +66,7 @@ public abstract class BriarActivity extends BaseActivity {
@Nullable Intent data) { @Nullable Intent data) {
super.onActivityResult(request, result, data); super.onActivityResult(request, result, data);
if (request == REQUEST_PASSWORD) { if (request == REQUEST_PASSWORD) {
// The result can be RESULT_CANCELED if there's no account
if (result == RESULT_OK) briarController.startAndBindService(); if (result == RESULT_OK) briarController.startAndBindService();
else finish();
} else if (request == REQUEST_UNLOCK && result != RESULT_OK) { } else if (request == REQUEST_UNLOCK && result != RESULT_OK) {
// We arrive here, if the user presses 'back' // We arrive here, if the user presses 'back'
// in the Keyguard unlock screen, because UnlockActivity finishes. // in the Keyguard unlock screen, because UnlockActivity finishes.
......
...@@ -57,9 +57,9 @@ public class AddContactActivity extends BriarActivity implements ...@@ -57,9 +57,9 @@ public class AddContactActivity extends BriarActivity implements
}); });
Intent i = getIntent(); Intent i = getIntent();
if (i != null) { if (state == null && i != null) {
// do not react to the intent again when recreating the activity
onNewIntent(i); onNewIntent(i);
setIntent(null); // don't keep the intent for configuration changes
} }
if (state == null) { if (state == null) {
......
package org.briarproject.briar.android.navdrawer;
import android.content.Context;
import android.content.Intent;
import org.briarproject.briar.android.activity.BriarActivity;
import org.briarproject.briar.android.contact.add.remote.AddContactActivity;
import org.briarproject.briar.android.settings.SettingsActivity;
import static android.content.Intent.ACTION_MANAGE_NETWORK_USAGE;
import static android.content.Intent.ACTION_SEND;
import static android.content.Intent.ACTION_VIEW;
import static android.content.Intent.EXTRA_TEXT;
import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP;
import static org.briarproject.bramble.api.contact.HandshakeLinkConstants.LINK_REGEX;
class IntentRouter {
static void handleExternalIntent(Context ctx, Intent i) {
String action = i.getAction();
// add remote contact with clicked briar:// link
if (ACTION_VIEW.equals(action) && "briar".equals(i.getScheme())) {
redirect(ctx, i, AddContactActivity.class);
}
// add remote contact with shared briar:// link
else if (ACTION_SEND.equals(action) &&
"text/plain".equals(i.getType()) &&
i.getStringExtra(EXTRA_TEXT) != null &&
LINK_REGEX.matcher(i.getStringExtra(EXTRA_TEXT)).find()) {
redirect(ctx, i, AddContactActivity.class);
}
// network settings as launched from system settings app
else if (ACTION_MANAGE_NETWORK_USAGE.equals(action)) {
redirect(ctx, i, SettingsActivity.class);
}
}
private static void redirect(Context ctx, Intent i,
Class<? extends BriarActivity> activityClass) {
i.setClass(ctx, activityClass);
i.addFlags(FLAG_ACTIVITY_CLEAR_TOP);
ctx.startActivity(i);
}
}
...@@ -3,6 +3,7 @@ package org.briarproject.briar.android.navdrawer; ...@@ -3,6 +3,7 @@ package org.briarproject.briar.android.navdrawer;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Intent; import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
...@@ -60,9 +61,11 @@ import static android.support.v4.widget.DrawerLayout.LOCK_MODE_LOCKED_CLOSED; ...@@ -60,9 +61,11 @@ import static android.support.v4.widget.DrawerLayout.LOCK_MODE_LOCKED_CLOSED;
import static android.view.View.GONE; import static android.view.View.GONE;
import static android.view.View.VISIBLE; import static android.view.View.VISIBLE;
import static java.util.Objects.requireNonNull; import static java.util.Objects.requireNonNull;
import static java.util.logging.Logger.getLogger;
import static org.briarproject.bramble.api.lifecycle.LifecycleManager.LifecycleState.RUNNING; import static org.briarproject.bramble.api.lifecycle.LifecycleManager.LifecycleState.RUNNING;
import static org.briarproject.briar.android.BriarService.EXTRA_STARTUP_FAILED; import static org.briarproject.briar.android.BriarService.EXTRA_STARTUP_FAILED;
import static org.briarproject.briar.android.activity.RequestCodes.REQUEST_PASSWORD; import static org.briarproject.briar.android.activity.RequestCodes.REQUEST_PASSWORD;
import static org.briarproject.briar.android.navdrawer.IntentRouter.handleExternalIntent;
import static org.briarproject.briar.android.navdrawer.NavDrawerController.ExpiryWarning.NO; import static org.briarproject.briar.android.navdrawer.NavDrawerController.ExpiryWarning.NO;
import static org.briarproject.briar.android.navdrawer.NavDrawerController.ExpiryWarning.UPDATE; import static org.briarproject.briar.android.navdrawer.NavDrawerController.ExpiryWarning.UPDATE;
import static org.briarproject.briar.android.util.UiUtils.getDaysUntilExpiry; import static org.briarproject.briar.android.util.UiUtils.getDaysUntilExpiry;
...@@ -73,14 +76,21 @@ public class NavDrawerActivity extends BriarActivity implements ...@@ -73,14 +76,21 @@ public class NavDrawerActivity extends BriarActivity implements
BaseFragmentListener, TransportStateListener, BaseFragmentListener, TransportStateListener,
OnNavigationItemSelectedListener { OnNavigationItemSelectedListener {
public static final String INTENT_CONTACTS = "intent_contacts";
public static final String INTENT_GROUPS = "intent_groups";
public static final String INTENT_FORUMS = "intent_forums";
public static final String INTENT_BLOGS = "intent_blogs";
public static final String INTENT_SIGN_OUT = "intent_sign_out";
private static final Logger LOG = private static final Logger LOG =
Logger.getLogger(NavDrawerActivity.class.getName()); getLogger(NavDrawerActivity.class.getName());
public static Uri CONTACT_URI =
Uri.parse("briar-content://org.briarproject.briar/contact");
public static Uri GROUP_URI =
Uri.parse("briar-content://org.briarproject.briar/group");
public static Uri FORUM_URI =
Uri.parse("briar-content://org.briarproject.briar/forum");
public static Uri BLOG_URI =
Uri.parse("briar-content://org.briarproject.briar/blog");
public static Uri CONTACT_ADDED_URI =
Uri.parse("briar-content://org.briarproject.briar/contact/added");
public static Uri SIGN_OUT_URI =
Uri.parse("briar-content://org.briarproject.briar/sign-out");
private ActionBarDrawerToggle drawerToggle; private ActionBarDrawerToggle drawerToggle;
...@@ -95,26 +105,6 @@ public class NavDrawerActivity extends BriarActivity implements ...@@ -95,26 +105,6 @@ public class NavDrawerActivity extends BriarActivity implements
private List<Transport> transports; private List<Transport> transports;
private BaseAdapter transportsAdapter; private BaseAdapter transportsAdapter;
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
exitIfStartupFailed(intent);
// TODO don't create new instances if they are on the stack (#606)
if (intent.getBooleanExtra(INTENT_GROUPS, false)) {
startFragment(GroupListFragment.newInstance(), R.id.nav_btn_groups);
} else if (intent.getBooleanExtra(INTENT_FORUMS, false)) {
startFragment(ForumListFragment.newInstance(), R.id.nav_btn_forums);
} else if (intent.getBooleanExtra(INTENT_CONTACTS, false)) {
startFragment(ContactListFragment.newInstance(),
R.id.nav_btn_contacts);
} else if (intent.getBooleanExtra(INTENT_BLOGS, false)) {
startFragment(FeedFragment.newInstance(), R.id.nav_btn_blogs);
} else if (intent.getBooleanExtra(INTENT_SIGN_OUT, false)) {
signOut(false, false);
}
setIntent(null);
}
@Override @Override
public void injectActivity(ActivityComponent component) { public void injectActivity(ActivityComponent component) {
component.inject(this); component.inject(this);
...@@ -153,7 +143,8 @@ public class NavDrawerActivity extends BriarActivity implements ...@@ -153,7 +143,8 @@ public class NavDrawerActivity extends BriarActivity implements
startFragment(ContactListFragment.newInstance(), startFragment(ContactListFragment.newInstance(),
R.id.nav_btn_contacts); R.id.nav_btn_contacts);
} }
if (getIntent() != null) { if (state == null && getIntent() != null) {
// do not call this again when there's existing state
onNewIntent(getIntent()); onNewIntent(getIntent());
} }
} }
...@@ -190,6 +181,37 @@ public class NavDrawerActivity extends BriarActivity implements ...@@ -190,6 +181,37 @@ public class NavDrawerActivity extends BriarActivity implements
} }
} }
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
// will call System.exit()
exitIfStartupFailed(intent);
if ("briar-content".equals(intent.getScheme())) {
handleContentIntent(intent);
} else {
handleExternalIntent(this, intent);
}
}
private void handleContentIntent(Intent intent) {
Uri uri = intent.getData();
// TODO don't create new instances if they are on the stack (#606)
if (CONTACT_URI.equals(uri) || CONTACT_ADDED_URI.equals(uri)) {
startFragment(ContactListFragment.newInstance(),
R.id.nav_btn_contacts);
} else if (GROUP_URI.equals(uri)) {
startFragment(GroupListFragment.newInstance(), R.id.nav_btn_groups);
} else if (FORUM_URI.equals(uri)) {
startFragment(ForumListFragment.newInstance(), R.id.nav_btn_forums);
} else if (BLOG_URI.equals(uri)) {
startFragment(FeedFragment.newInstance(), R.id.nav_btn_blogs);
} else if (SIGN_OUT_URI.equals(uri)) {
signOut(false, false);
}
}
private void exitIfStartupFailed(Intent intent) { private void exitIfStartupFailed(Intent intent) {
if (intent.getBooleanExtra(EXTRA_STARTUP_FAILED, false)) { if (intent.getBooleanExtra(EXTRA_STARTUP_FAILED, false)) {
finish(); finish();
...@@ -325,7 +347,6 @@ public class NavDrawerActivity extends BriarActivity implements ...@@ -325,7 +347,6 @@ public class NavDrawerActivity extends BriarActivity implements
if (item != null) item.setVisible(visible); if (item != null) item.setVisible(visible);
} }
@SuppressWarnings("ConstantConditions")
private void showExpiryWarning(ExpiryWarning expiry) { private void showExpiryWarning(ExpiryWarning expiry) {
int daysUntilExpiry = getDaysUntilExpiry(); int daysUntilExpiry = getDaysUntilExpiry();
if (daysUntilExpiry < 0) signOut(); if (daysUntilExpiry < 0) signOut();
......
...@@ -79,10 +79,10 @@ import static org.briarproject.bramble.api.plugin.TorConstants.PREF_TOR_ONLY_WHE ...@@ -79,10 +79,10 @@ import static org.briarproject.bramble.api.plugin.TorConstants.PREF_TOR_ONLY_WHE
import static org.briarproject.bramble.util.LogUtils.logDuration; import static org.briarproject.bramble.util.LogUtils.logDuration;
import static org.briarproject.bramble.util.LogUtils.logException; import static org.briarproject.bramble.util.LogUtils.logException;
import static org.briarproject.bramble.util.LogUtils.now; import static org.briarproject.bramble.util.LogUtils.now;
import static org.briarproject.briar.android.TestingConstants.IS_DEBUG_BUILD;
import static org.briarproject.briar.android.BriarApplication.ENTRY_ACTIVITY; import static org.briarproject.briar.android.BriarApplication.ENTRY_ACTIVITY;
import static org.briarproject.briar.android.TestingConstants.IS_DEBUG_BUILD;
import static org.briarproject.briar.android.activity.RequestCodes.REQUEST_RINGTONE; import static org.briarproject.briar.android.activity.RequestCodes.REQUEST_RINGTONE;
import static org.briarproject.briar.android.navdrawer.NavDrawerActivity.INTENT_SIGN_OUT; import static org.briarproject.briar.android.navdrawer.NavDrawerActivity.SIGN_OUT_URI;
import static org.briarproject.briar.android.util.UiUtils.hasScreenLock; import static org.briarproject.briar.android.util.UiUtils.hasScreenLock;
import static org.briarproject.briar.android.util.UiUtils.triggerFeedback; import static org.briarproject.briar.android.util.UiUtils.triggerFeedback;
import static org.briarproject.briar.api.android.AndroidNotificationManager.BLOG_CHANNEL_ID; import static org.briarproject.briar.api.android.AndroidNotificationManager.BLOG_CHANNEL_ID;
...@@ -578,7 +578,7 @@ public class SettingsFragment extends PreferenceFragmentCompat ...@@ -578,7 +578,7 @@ public class SettingsFragment extends PreferenceFragmentCompat
language.setValue(newValue); language.setValue(newValue);
Intent intent = new Intent(getContext(), ENTRY_ACTIVITY); Intent intent = new Intent(getContext(), ENTRY_ACTIVITY);
intent.setFlags(FLAG_ACTIVITY_CLEAR_TOP); intent.setFlags(FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra(INTENT_SIGN_OUT, true); intent.setData(SIGN_OUT_URI);
requireActivity().startActivity(intent); requireActivity().startActivity(intent);
requireActivity().finish(); requireActivity().finish();
}); });
......
...@@ -43,13 +43,6 @@ public interface AndroidNotificationManager { ...@@ -43,13 +43,6 @@ public interface AndroidNotificationManager {
String FAILURE_CHANNEL_ID = "zStartupFailure"; String FAILURE_CHANNEL_ID = "zStartupFailure";
String REMINDER_CHANNEL_ID = "zSignInReminder"; String REMINDER_CHANNEL_ID = "zSignInReminder";
// Content URIs for pending intents
String CONTACT_URI = "content://org.briarproject.briar/contact";
String GROUP_URI = "content://org.briarproject.briar/group";
String FORUM_URI = "content://org.briarproject.briar/forum";
String BLOG_URI = "content://org.briarproject.briar/blog";
String CONTACT_ADDED_URI = "content://org.briarproject.briar/contact/added";
// Actions for pending intents // Actions for pending intents
String ACTION_DISMISS_REMINDER = "dismissReminder"; String ACTION_DISMISS_REMINDER = "dismissReminder";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment