mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
Compare commits
7 Commits
beta-1.5.8
...
fix-screen
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3bb148b2d0 | ||
|
|
a0e2458568 | ||
|
|
e79487599b | ||
|
|
c75d16452e | ||
|
|
56fcdf7535 | ||
|
|
de36197eb5 | ||
|
|
346ec83ed4 |
@@ -15,4 +15,7 @@
|
||||
-keep class junit.** { *; }
|
||||
-dontwarn junit.**
|
||||
|
||||
-keep class org.jmock.** { *; }
|
||||
-dontwarn org.jmock.**
|
||||
|
||||
-dontwarn org.briarproject.briar.android.**
|
||||
|
||||
@@ -4,7 +4,9 @@ import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
|
||||
import org.briarproject.bramble.api.account.AccountManager;
|
||||
import org.briarproject.bramble.api.db.DbException;
|
||||
import org.briarproject.bramble.api.lifecycle.LifecycleManager;
|
||||
import org.briarproject.bramble.api.settings.Settings;
|
||||
import org.briarproject.bramble.api.settings.SettingsManager;
|
||||
import org.briarproject.briar.R;
|
||||
import org.briarproject.nullsafety.NotNullByDefault;
|
||||
@@ -16,6 +18,11 @@ import androidx.test.espresso.intent.rule.IntentsTestRule;
|
||||
|
||||
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
|
||||
import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.SETTINGS_NAMESPACE;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.SHOW_ONBOARDING_IMAGE;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.SHOW_ONBOARDING_INTRODUCTION;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.SHOW_ONBOARDING_REVEAL_CONTACTS;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.SHOW_ONBOARDING_TRANSPORTS;
|
||||
|
||||
|
||||
@SuppressWarnings("WeakerAccess")
|
||||
@@ -49,6 +56,19 @@ public abstract class UiTest {
|
||||
getApplicationContext().startActivity(i);
|
||||
}
|
||||
|
||||
protected void disableOnboarding() {
|
||||
try {
|
||||
Settings settings = new Settings();
|
||||
settings.putBoolean(SHOW_ONBOARDING_TRANSPORTS, false);
|
||||
settings.putBoolean(SHOW_ONBOARDING_IMAGE, false);
|
||||
settings.putBoolean(SHOW_ONBOARDING_INTRODUCTION, false);
|
||||
settings.putBoolean(SHOW_ONBOARDING_REVEAL_CONTACTS, false);
|
||||
settingsManager.mergeSettings(settings, SETTINGS_NAMESPACE);
|
||||
} catch (DbException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNullByDefault
|
||||
protected class CleanAccountTestRule<A extends Activity>
|
||||
extends IntentsTestRule<A> {
|
||||
@@ -70,7 +90,7 @@ public abstract class UiTest {
|
||||
} catch (InterruptedException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
disableOnboarding();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ import static androidx.test.espresso.Espresso.onView;
|
||||
import static androidx.test.espresso.action.ViewActions.click;
|
||||
import static androidx.test.espresso.action.ViewActions.closeSoftKeyboard;
|
||||
import static androidx.test.espresso.action.ViewActions.replaceText;
|
||||
import static androidx.test.espresso.action.ViewActions.scrollTo;
|
||||
import static androidx.test.espresso.assertion.ViewAssertions.matches;
|
||||
import static androidx.test.espresso.contrib.RecyclerViewActions.actionOnItemAtPosition;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
|
||||
@@ -63,7 +62,7 @@ public class PromoVideoTest extends ScreenshotTest {
|
||||
new ActivityScenarioRule<>(SplashScreenActivity.class);
|
||||
|
||||
@Inject
|
||||
protected ContactManager contactManager;
|
||||
ContactManager contactManager;
|
||||
|
||||
private OverlayView overlayView;
|
||||
|
||||
@@ -181,7 +180,6 @@ public class PromoVideoTest extends ScreenshotTest {
|
||||
sleep(DELAY_SMALL);
|
||||
|
||||
// add pending contact
|
||||
onView(withId(R.id.addButton)).perform(scrollTo());
|
||||
doClick(withId(R.id.addButton));
|
||||
sleep(DELAY_LONG);
|
||||
|
||||
@@ -214,7 +212,7 @@ public class PromoVideoTest extends ScreenshotTest {
|
||||
}
|
||||
|
||||
// click on new contact
|
||||
doItemClick(withId(R.id.recyclerView), 0);
|
||||
doItemClick(withId(R.id.recyclerView));
|
||||
|
||||
sleep(DELAY_MEDIUM);
|
||||
|
||||
@@ -265,15 +263,14 @@ public class PromoVideoTest extends ScreenshotTest {
|
||||
.perform(click());
|
||||
}
|
||||
|
||||
private void doItemClick(final Matcher<View> viewMatcher, int pos)
|
||||
private void doItemClick(final Matcher<View> viewMatcher)
|
||||
throws InterruptedException {
|
||||
if (isFilming) {
|
||||
onView(viewMatcher).perform(
|
||||
actionOnItemAtPosition(pos, visualClick(overlayView)));
|
||||
actionOnItemAtPosition(0, visualClick(overlayView)));
|
||||
sleep(500);
|
||||
}
|
||||
onView(viewMatcher).perform(
|
||||
actionOnItemAtPosition(pos, click()));
|
||||
onView(viewMatcher).perform(actionOnItemAtPosition(0, click()));
|
||||
}
|
||||
|
||||
private void closeKeyboard(final Matcher<View> viewMatcher)
|
||||
|
||||
@@ -23,13 +23,13 @@ public abstract class ScreenshotTest extends UiTest {
|
||||
public static final LocaleTestRule localeTestRule = new LocaleTestRule();
|
||||
|
||||
@Inject
|
||||
protected TestDataCreator testDataCreator;
|
||||
TestDataCreator testDataCreator;
|
||||
@Inject
|
||||
protected ConnectionRegistry connectionRegistry;
|
||||
ConnectionRegistry connectionRegistry;
|
||||
@Inject
|
||||
protected Clock clock;
|
||||
Clock clock;
|
||||
|
||||
protected void screenshot(String name, ActivityScenarioRule<?> rule) {
|
||||
void screenshot(String name, ActivityScenarioRule<?> rule) {
|
||||
rule.getScenario().onActivity(activity -> screenshot(name, activity));
|
||||
}
|
||||
|
||||
@@ -47,9 +47,4 @@ public abstract class ScreenshotTest extends UiTest {
|
||||
Log.w("Screengrab", "Permission to write screenshot is missing.");
|
||||
}
|
||||
}
|
||||
|
||||
protected long getMinutesAgo(int minutes) {
|
||||
return clock.currentTimeMillis() - minutes * 60 * 1000;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.briarproject.briar.android.settings;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.view.Gravity;
|
||||
|
||||
import org.briarproject.briar.R;
|
||||
@@ -16,6 +15,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
|
||||
import static androidx.test.espresso.Espresso.onView;
|
||||
import static androidx.test.espresso.Espresso.pressBack;
|
||||
import static androidx.test.espresso.action.ViewActions.click;
|
||||
import static androidx.test.espresso.assertion.ViewAssertions.matches;
|
||||
import static androidx.test.espresso.contrib.DrawerMatchers.isClosed;
|
||||
@@ -31,9 +31,11 @@ import static org.junit.Assume.assumeTrue;
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class SettingsActivityScreenshotTest extends ScreenshotTest {
|
||||
|
||||
// Start from the nav drawer activity so we can go back to it and take
|
||||
// screenshots showing the effects of changing settings
|
||||
@Rule
|
||||
public CleanAccountTestRule<SettingsActivity> testRule =
|
||||
new CleanAccountTestRule<>(SettingsActivity.class);
|
||||
public CleanAccountTestRule<NavDrawerActivity> testRule =
|
||||
new CleanAccountTestRule<>(NavDrawerActivity.class);
|
||||
|
||||
@Override
|
||||
protected void inject(BriarUiTestComponent component) {
|
||||
@@ -42,8 +44,10 @@ public class SettingsActivityScreenshotTest extends ScreenshotTest {
|
||||
|
||||
@Test
|
||||
public void changeTheme() {
|
||||
openNavDrawer();
|
||||
onView(withText(R.string.settings_button))
|
||||
.check(matches(isDisplayed()));
|
||||
.check(matches(isDisplayed()))
|
||||
.perform(click());
|
||||
|
||||
onView(withText(R.string.display_settings_title))
|
||||
.perform(waitUntilMatches(isDisplayed()))
|
||||
@@ -59,6 +63,8 @@ public class SettingsActivityScreenshotTest extends ScreenshotTest {
|
||||
.check(matches(isDisplayed()))
|
||||
.perform(click());
|
||||
|
||||
pressBack();
|
||||
pressBack();
|
||||
openNavDrawer();
|
||||
|
||||
screenshot("manual_dark_theme_nav_drawer", testRule.getActivity());
|
||||
@@ -68,8 +74,8 @@ public class SettingsActivityScreenshotTest extends ScreenshotTest {
|
||||
.check(matches(isDisplayed()))
|
||||
.perform(click());
|
||||
onView(withText(R.string.display_settings_title))
|
||||
.check(matches(isDisplayed()))
|
||||
.perform(click());
|
||||
.perform(waitUntilMatches(isDisplayed()))
|
||||
.perform(click(), click());
|
||||
onView(withText(R.string.pref_theme_title))
|
||||
.check(matches(isDisplayed()))
|
||||
.perform(click());
|
||||
@@ -83,6 +89,11 @@ public class SettingsActivityScreenshotTest extends ScreenshotTest {
|
||||
assumeTrue("device has no screen lock",
|
||||
hasScreenLock(getApplicationContext()));
|
||||
|
||||
openNavDrawer();
|
||||
onView(withText(R.string.settings_button))
|
||||
.check(matches(isDisplayed()))
|
||||
.perform(click());
|
||||
|
||||
onView(withText(R.string.security_settings_title))
|
||||
.perform(waitUntilMatches(isDisplayed()))
|
||||
.perform(click(), click());
|
||||
@@ -98,6 +109,8 @@ public class SettingsActivityScreenshotTest extends ScreenshotTest {
|
||||
|
||||
screenshot("manual_app_lock", testRule.getActivity());
|
||||
|
||||
pressBack();
|
||||
pressBack();
|
||||
openNavDrawer();
|
||||
|
||||
screenshot("manual_app_lock_nav_drawer", testRule.getActivity());
|
||||
@@ -105,6 +118,11 @@ public class SettingsActivityScreenshotTest extends ScreenshotTest {
|
||||
|
||||
@Test
|
||||
public void torSettings() {
|
||||
openNavDrawer();
|
||||
onView(withText(R.string.settings_button))
|
||||
.check(matches(isDisplayed()))
|
||||
.perform(click());
|
||||
|
||||
// click network/connections settings
|
||||
onView(withText(R.string.network_settings_title))
|
||||
.perform(waitUntilMatches(isDisplayed()))
|
||||
@@ -119,15 +137,8 @@ public class SettingsActivityScreenshotTest extends ScreenshotTest {
|
||||
}
|
||||
|
||||
private void openNavDrawer() {
|
||||
// start main activity
|
||||
Intent i =
|
||||
new Intent(testRule.getActivity(), NavDrawerActivity.class);
|
||||
testRule.getActivity().startActivity(i);
|
||||
|
||||
// open navigation drawer
|
||||
onView(withId(R.id.drawer_layout))
|
||||
.check(matches(isClosed(Gravity.START)))
|
||||
.perform(DrawerActions.open());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -92,7 +92,14 @@ import static org.briarproject.briar.android.navdrawer.NavDrawerActivity.CONTACT
|
||||
import static org.briarproject.briar.android.navdrawer.NavDrawerActivity.CONTACT_URI;
|
||||
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.api.android.SettingsConstants.PREF_NOTIFY_BLOG;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.PREF_NOTIFY_FORUM;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.PREF_NOTIFY_GROUP;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.PREF_NOTIFY_PRIVATE;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.PREF_NOTIFY_RINGTONE_URI;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.PREF_NOTIFY_SOUND;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.PREF_NOTIFY_VIBRATION;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.SETTINGS_NAMESPACE;
|
||||
|
||||
@ThreadSafe
|
||||
@MethodsNotNullByDefault
|
||||
|
||||
@@ -26,7 +26,8 @@ import javax.inject.Inject;
|
||||
|
||||
import static java.util.logging.Level.WARNING;
|
||||
import static org.briarproject.bramble.util.LogUtils.logException;
|
||||
import static org.briarproject.briar.android.settings.SettingsFragment.SETTINGS_NAMESPACE;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.EMOJI_LRU_PREFERENCE;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.SETTINGS_NAMESPACE;
|
||||
|
||||
@MethodsNotNullByDefault
|
||||
@ParametersNotNullByDefault
|
||||
@@ -35,7 +36,6 @@ class RecentEmojiImpl implements RecentEmoji, OpenDatabaseHook {
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(RecentEmojiImpl.class.getName());
|
||||
|
||||
private static final String EMOJI_LRU_PREFERENCE = "pref_emoji_recent2";
|
||||
private static final int EMOJI_LRU_SIZE = 50;
|
||||
|
||||
// UI thread
|
||||
|
||||
@@ -41,10 +41,10 @@ import static java.util.concurrent.TimeUnit.MINUTES;
|
||||
import static java.util.logging.Level.WARNING;
|
||||
import static org.briarproject.bramble.util.AndroidUtils.getImmutableFlags;
|
||||
import static org.briarproject.bramble.util.LogUtils.logException;
|
||||
import static org.briarproject.briar.android.settings.SecurityFragment.PREF_SCREEN_LOCK;
|
||||
import static org.briarproject.briar.android.settings.SecurityFragment.PREF_SCREEN_LOCK_TIMEOUT;
|
||||
import static org.briarproject.briar.android.settings.SettingsFragment.SETTINGS_NAMESPACE;
|
||||
import static org.briarproject.briar.android.util.UiUtils.hasScreenLock;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.PREF_SCREEN_LOCK;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.PREF_SCREEN_LOCK_TIMEOUT;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.SETTINGS_NAMESPACE;
|
||||
|
||||
@ThreadSafe
|
||||
@MethodsNotNullByDefault
|
||||
|
||||
@@ -30,7 +30,8 @@ import static java.util.logging.Logger.getLogger;
|
||||
import static org.briarproject.android.dontkillmelib.DozeUtils.needsDozeWhitelisting;
|
||||
import static org.briarproject.bramble.api.lifecycle.LifecycleManager.LifecycleState.STARTING_SERVICES;
|
||||
import static org.briarproject.bramble.util.LogUtils.logException;
|
||||
import static org.briarproject.briar.android.settings.SettingsFragment.SETTINGS_NAMESPACE;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.DOZE_ASK_AGAIN;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.SETTINGS_NAMESPACE;
|
||||
|
||||
@NotNullByDefault
|
||||
public class BriarControllerImpl implements BriarController {
|
||||
@@ -38,8 +39,6 @@ public class BriarControllerImpl implements BriarController {
|
||||
private static final Logger LOG =
|
||||
getLogger(BriarControllerImpl.class.getName());
|
||||
|
||||
public static final String DOZE_ASK_AGAIN = "dozeAskAgain";
|
||||
|
||||
private final BriarServiceConnection serviceConnection;
|
||||
private final AccountManager accountManager;
|
||||
private final LifecycleManager lifecycleManager;
|
||||
|
||||
@@ -68,11 +68,13 @@ import static java.util.logging.Logger.getLogger;
|
||||
import static org.briarproject.bramble.util.LogUtils.logDuration;
|
||||
import static org.briarproject.bramble.util.LogUtils.logException;
|
||||
import static org.briarproject.bramble.util.LogUtils.now;
|
||||
import static org.briarproject.briar.android.settings.SettingsFragment.SETTINGS_NAMESPACE;
|
||||
import static org.briarproject.briar.android.util.UiUtils.observeForeverOnce;
|
||||
import static org.briarproject.briar.android.view.TextSendController.SendState.ERROR;
|
||||
import static org.briarproject.briar.android.view.TextSendController.SendState.SENT;
|
||||
import static org.briarproject.briar.android.view.TextSendController.SendState.UNEXPECTED_TIMER;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.SETTINGS_NAMESPACE;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.SHOW_ONBOARDING_IMAGE;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.SHOW_ONBOARDING_INTRODUCTION;
|
||||
import static org.briarproject.briar.api.autodelete.AutoDeleteConstants.NO_AUTO_DELETE_TIMER;
|
||||
import static org.briarproject.briar.api.autodelete.AutoDeleteManager.DEFAULT_TIMER_DURATION;
|
||||
import static org.briarproject.briar.api.messaging.PrivateMessageFormat.TEXT_IMAGES;
|
||||
@@ -85,11 +87,6 @@ public class ConversationViewModel extends DbViewModel
|
||||
private static final Logger LOG =
|
||||
getLogger(ConversationViewModel.class.getName());
|
||||
|
||||
private static final String SHOW_ONBOARDING_IMAGE =
|
||||
"showOnboardingImage";
|
||||
private static final String SHOW_ONBOARDING_INTRODUCTION =
|
||||
"showOnboardingIntroduction";
|
||||
|
||||
private final TransactionManager db;
|
||||
private final EventBus eventBus;
|
||||
private final MessagingManager messagingManager;
|
||||
|
||||
@@ -28,8 +28,10 @@ import static java.util.logging.Logger.getLogger;
|
||||
import static org.briarproject.android.dontkillmelib.DozeUtils.needsDozeWhitelisting;
|
||||
import static org.briarproject.bramble.util.LogUtils.logException;
|
||||
import static org.briarproject.briar.android.TestingConstants.EXPIRY_DATE;
|
||||
import static org.briarproject.briar.android.controller.BriarControllerImpl.DOZE_ASK_AGAIN;
|
||||
import static org.briarproject.briar.android.settings.SettingsFragment.SETTINGS_NAMESPACE;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.DOZE_ASK_AGAIN;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.EXPIRY_DATE_WARNING;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.SETTINGS_NAMESPACE;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.SHOW_ONBOARDING_TRANSPORTS;
|
||||
|
||||
@NotNullByDefault
|
||||
public class NavDrawerViewModel extends DbViewModel {
|
||||
@@ -37,10 +39,6 @@ public class NavDrawerViewModel extends DbViewModel {
|
||||
private static final Logger LOG =
|
||||
getLogger(NavDrawerViewModel.class.getName());
|
||||
|
||||
private static final String EXPIRY_DATE_WARNING = "expiryDateWarning";
|
||||
private static final String SHOW_TRANSPORTS_ONBOARDING =
|
||||
"showTransportsOnboarding";
|
||||
|
||||
private final SettingsManager settingsManager;
|
||||
|
||||
private final MutableLiveData<Boolean> showExpiryWarning =
|
||||
@@ -153,7 +151,7 @@ public class NavDrawerViewModel extends DbViewModel {
|
||||
Settings settings =
|
||||
settingsManager.getSettings(SETTINGS_NAMESPACE);
|
||||
boolean show =
|
||||
settings.getBoolean(SHOW_TRANSPORTS_ONBOARDING, true);
|
||||
settings.getBoolean(SHOW_ONBOARDING_TRANSPORTS, true);
|
||||
showTransportsOnboarding.postValue(show);
|
||||
} catch (DbException e) {
|
||||
handleException(e);
|
||||
@@ -167,7 +165,7 @@ public class NavDrawerViewModel extends DbViewModel {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
Settings settings = new Settings();
|
||||
settings.putBoolean(SHOW_TRANSPORTS_ONBOARDING, false);
|
||||
settings.putBoolean(SHOW_ONBOARDING_TRANSPORTS, false);
|
||||
settingsManager.mergeSettings(settings, SETTINGS_NAMESPACE);
|
||||
} catch (DbException e) {
|
||||
handleException(e);
|
||||
|
||||
@@ -31,7 +31,8 @@ import javax.inject.Inject;
|
||||
import static java.util.logging.Level.INFO;
|
||||
import static java.util.logging.Level.WARNING;
|
||||
import static org.briarproject.bramble.util.LogUtils.logException;
|
||||
import static org.briarproject.briar.android.settings.SettingsFragment.SETTINGS_NAMESPACE;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.SETTINGS_NAMESPACE;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.SHOW_ONBOARDING_REVEAL_CONTACTS;
|
||||
import static org.briarproject.briar.api.privategroup.Visibility.INVISIBLE;
|
||||
|
||||
@Immutable
|
||||
@@ -41,8 +42,6 @@ class RevealContactsControllerImpl extends DbControllerImpl
|
||||
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(RevealContactsControllerImpl.class.getName());
|
||||
private static final String SHOW_ONBOARDING_REVEAL_CONTACTS =
|
||||
"showOnboardingRevealContacts";
|
||||
|
||||
private final PrivateGroupManager groupManager;
|
||||
private final GroupInvitationManager groupInvitationManager;
|
||||
|
||||
@@ -47,12 +47,12 @@ import static org.briarproject.briar.api.android.AndroidNotificationManager.BLOG
|
||||
import static org.briarproject.briar.api.android.AndroidNotificationManager.CONTACT_CHANNEL_ID;
|
||||
import static org.briarproject.briar.api.android.AndroidNotificationManager.FORUM_CHANNEL_ID;
|
||||
import static org.briarproject.briar.api.android.AndroidNotificationManager.GROUP_CHANNEL_ID;
|
||||
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_BLOG;
|
||||
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_FORUM;
|
||||
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_GROUP;
|
||||
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_PRIVATE;
|
||||
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_SOUND;
|
||||
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_VIBRATION;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.PREF_NOTIFY_BLOG;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.PREF_NOTIFY_FORUM;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.PREF_NOTIFY_GROUP;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.PREF_NOTIFY_PRIVATE;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.PREF_NOTIFY_SOUND;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.PREF_NOTIFY_VIBRATION;
|
||||
|
||||
@MethodsNotNullByDefault
|
||||
@ParametersNotNullByDefault
|
||||
|
||||
@@ -27,15 +27,15 @@ import static java.util.logging.Logger.getLogger;
|
||||
import static org.briarproject.bramble.util.LogUtils.logDuration;
|
||||
import static org.briarproject.bramble.util.LogUtils.logException;
|
||||
import static org.briarproject.bramble.util.LogUtils.now;
|
||||
import static org.briarproject.briar.android.settings.SettingsFragment.SETTINGS_NAMESPACE;
|
||||
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_BLOG;
|
||||
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_FORUM;
|
||||
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_GROUP;
|
||||
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_PRIVATE;
|
||||
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_RINGTONE_NAME;
|
||||
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_RINGTONE_URI;
|
||||
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_SOUND;
|
||||
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_VIBRATION;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.PREF_NOTIFY_BLOG;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.PREF_NOTIFY_FORUM;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.PREF_NOTIFY_GROUP;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.PREF_NOTIFY_PRIVATE;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.PREF_NOTIFY_RINGTONE_NAME;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.PREF_NOTIFY_RINGTONE_URI;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.PREF_NOTIFY_SOUND;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.PREF_NOTIFY_VIBRATION;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.SETTINGS_NAMESPACE;
|
||||
|
||||
@MethodsNotNullByDefault
|
||||
@ParametersNotNullByDefault
|
||||
|
||||
@@ -22,15 +22,13 @@ import static java.util.Objects.requireNonNull;
|
||||
import static org.briarproject.briar.android.AppModule.getAndroidComponent;
|
||||
import static org.briarproject.briar.android.settings.SettingsActivity.enableAndPersist;
|
||||
import static org.briarproject.briar.android.util.UiUtils.hasScreenLock;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.PREF_SCREEN_LOCK;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.PREF_SCREEN_LOCK_TIMEOUT;
|
||||
|
||||
@MethodsNotNullByDefault
|
||||
@ParametersNotNullByDefault
|
||||
public class SecurityFragment extends PreferenceFragmentCompat {
|
||||
|
||||
public static final String PREF_SCREEN_LOCK = "pref_key_lock";
|
||||
public static final String PREF_SCREEN_LOCK_TIMEOUT =
|
||||
"pref_key_lock_timeout";
|
||||
|
||||
@Inject
|
||||
ViewModelProvider.Factory viewModelFactory;
|
||||
|
||||
|
||||
@@ -37,8 +37,6 @@ import static org.briarproject.briar.android.util.UiUtils.tryToStartActivity;
|
||||
@ParametersNotNullByDefault
|
||||
public class SettingsFragment extends PreferenceFragmentCompat {
|
||||
|
||||
public static final String SETTINGS_NAMESPACE = "android-ui";
|
||||
|
||||
private static final String PREF_KEY_AVATAR = "pref_key_avatar";
|
||||
private static final String PREF_KEY_SHARE_LINK = "pref_key_share_app_link";
|
||||
private static final String PREF_KEY_FEEDBACK = "pref_key_send_feedback";
|
||||
|
||||
@@ -54,9 +54,9 @@ import static org.briarproject.bramble.util.AndroidUtils.getSupportedImageConten
|
||||
import static org.briarproject.bramble.util.LogUtils.logDuration;
|
||||
import static org.briarproject.bramble.util.LogUtils.logException;
|
||||
import static org.briarproject.bramble.util.LogUtils.now;
|
||||
import static org.briarproject.briar.android.settings.SecurityFragment.PREF_SCREEN_LOCK;
|
||||
import static org.briarproject.briar.android.settings.SecurityFragment.PREF_SCREEN_LOCK_TIMEOUT;
|
||||
import static org.briarproject.briar.android.settings.SettingsFragment.SETTINGS_NAMESPACE;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.PREF_SCREEN_LOCK;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.PREF_SCREEN_LOCK_TIMEOUT;
|
||||
import static org.briarproject.briar.api.android.SettingsConstants.SETTINGS_NAMESPACE;
|
||||
|
||||
@MethodsNotNullByDefault
|
||||
@ParametersNotNullByDefault
|
||||
|
||||
@@ -11,17 +11,6 @@ import org.briarproject.bramble.api.sync.GroupId;
|
||||
*/
|
||||
public interface AndroidNotificationManager {
|
||||
|
||||
// Keys for notification preferences
|
||||
String PREF_NOTIFY_PRIVATE = "notifyPrivateMessages";
|
||||
String PREF_NOTIFY_GROUP = "notifyGroupMessages";
|
||||
String PREF_NOTIFY_FORUM = "notifyForumPosts";
|
||||
String PREF_NOTIFY_BLOG = "notifyBlogPosts";
|
||||
|
||||
String PREF_NOTIFY_SOUND = "notifySound";
|
||||
String PREF_NOTIFY_RINGTONE_NAME = "notifyRingtoneName";
|
||||
String PREF_NOTIFY_RINGTONE_URI = "notifyRingtoneUri";
|
||||
String PREF_NOTIFY_VIBRATION = "notifyVibration";
|
||||
|
||||
// Notification IDs
|
||||
int ONGOING_NOTIFICATION_ID = 1;
|
||||
int REMINDER_NOTIFICATION_ID = 3;
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package org.briarproject.briar.api.android;
|
||||
|
||||
import org.briarproject.nullsafety.NotNullByDefault;
|
||||
|
||||
@NotNullByDefault
|
||||
public interface SettingsConstants {
|
||||
|
||||
// Namespace for Android-specific settings
|
||||
String SETTINGS_NAMESPACE = "android-ui";
|
||||
|
||||
// Key for time when expiry warning was last shown
|
||||
String EXPIRY_DATE_WARNING = "expiryDateWarning";
|
||||
|
||||
// Key for doze mode exemption warning
|
||||
String DOZE_ASK_AGAIN = "dozeAskAgain";
|
||||
|
||||
// Keys for onboarding
|
||||
String SHOW_ONBOARDING_TRANSPORTS = "showTransportsOnboarding";
|
||||
String SHOW_ONBOARDING_IMAGE = "showOnboardingImage";
|
||||
String SHOW_ONBOARDING_INTRODUCTION = "showOnboardingIntroduction";
|
||||
String SHOW_ONBOARDING_REVEAL_CONTACTS = "showOnboardingRevealContacts";
|
||||
|
||||
// Keys for notification preferences
|
||||
String PREF_NOTIFY_PRIVATE = "notifyPrivateMessages";
|
||||
String PREF_NOTIFY_GROUP = "notifyGroupMessages";
|
||||
String PREF_NOTIFY_FORUM = "notifyForumPosts";
|
||||
String PREF_NOTIFY_BLOG = "notifyBlogPosts";
|
||||
String PREF_NOTIFY_SOUND = "notifySound";
|
||||
String PREF_NOTIFY_RINGTONE_NAME = "notifyRingtoneName";
|
||||
String PREF_NOTIFY_RINGTONE_URI = "notifyRingtoneUri";
|
||||
String PREF_NOTIFY_VIBRATION = "notifyVibration";
|
||||
|
||||
// Key for recently used emoji
|
||||
String EMOJI_LRU_PREFERENCE = "pref_emoji_recent2";
|
||||
|
||||
// Keys for screen lock
|
||||
String PREF_SCREEN_LOCK = "pref_key_lock";
|
||||
String PREF_SCREEN_LOCK_TIMEOUT = "pref_key_lock_timeout";
|
||||
}
|
||||
Reference in New Issue
Block a user