Merge branch 'remove-beta-build-flag' into 'master'

Remove beta build flag

Closes #1527

See merge request briar/briar!1196
This commit is contained in:
Torsten Grote
2019-11-06 17:53:02 +00:00
7 changed files with 34 additions and 64 deletions

View File

@@ -54,7 +54,6 @@ import static org.acra.ReportField.REPORT_ID;
import static org.acra.ReportField.STACK_TRACE;
import static org.acra.ReportField.USER_APP_START_DATE;
import static org.acra.ReportField.USER_CRASH_DATE;
import static org.briarproject.briar.android.TestingConstants.IS_BETA_BUILD;
import static org.briarproject.briar.android.TestingConstants.IS_DEBUG_BUILD;
@ReportsCrashes(
@@ -111,7 +110,7 @@ public class BriarApplicationImpl extends Application
Handler[] handlers = rootLogger.getHandlers();
// Disable the Android logger for release builds
for (Handler handler : handlers) rootLogger.removeHandler(handler);
if (IS_DEBUG_BUILD || IS_BETA_BUILD) {
if (IS_DEBUG_BUILD) {
// We can't set the level of the Android logger at runtime, so
// raise records to the logger's default level
rootLogger.addHandler(new LevelRaisingHandler(FINE, INFO));
@@ -119,7 +118,7 @@ public class BriarApplicationImpl extends Application
for (Handler handler : handlers) rootLogger.addHandler(handler);
}
rootLogger.addHandler(logHandler);
rootLogger.setLevel(IS_DEBUG_BUILD || IS_BETA_BUILD ? FINE : INFO);
rootLogger.setLevel(IS_DEBUG_BUILD ? FINE : INFO);
LOG.info("Created");

View File

@@ -2,6 +2,8 @@ package org.briarproject.briar.android;
import org.briarproject.briar.BuildConfig;
import static java.util.concurrent.TimeUnit.DAYS;
public interface TestingConstants {
/**
@@ -9,12 +11,6 @@ public interface TestingConstants {
*/
boolean IS_DEBUG_BUILD = BuildConfig.DEBUG;
/**
* Whether this is a beta build. This should be set to false for final
* release builds.
*/
boolean IS_BETA_BUILD = false;
/**
* Whether to prevent screenshots from being taken. Setting this to true
* prevents Recent Apps from storing screenshots of private information.
@@ -24,10 +20,9 @@ public interface TestingConstants {
boolean PREVENT_SCREENSHOTS = !IS_DEBUG_BUILD;
/**
* Debug and beta builds expire after 90 days. Final release builds expire
* after 292 million years.
* Debug builds expire after 90 days. Release builds expire after 292
* million years.
*/
long EXPIRY_DATE = IS_DEBUG_BUILD || IS_BETA_BUILD ?
BuildConfig.BuildTimestamp + 90 * 24 * 60 * 60 * 1000L :
Long.MAX_VALUE;
long EXPIRY_DATE = IS_DEBUG_BUILD ?
BuildConfig.BuildTimestamp + DAYS.toMillis(90) : Long.MAX_VALUE;
}

View File

@@ -45,7 +45,6 @@ import org.briarproject.briar.android.forum.ForumListFragment;
import org.briarproject.briar.android.fragment.BaseFragment;
import org.briarproject.briar.android.fragment.BaseFragment.BaseFragmentListener;
import org.briarproject.briar.android.logout.SignOutFragment;
import org.briarproject.briar.android.navdrawer.NavDrawerController.ExpiryWarning;
import org.briarproject.briar.android.privategroup.list.GroupListFragment;
import org.briarproject.briar.android.settings.SettingsActivity;
@@ -66,8 +65,6 @@ import static org.briarproject.bramble.api.lifecycle.LifecycleManager.LifecycleS
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.navdrawer.IntentRouter.handleExternalIntent;
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.util.UiUtils.getDaysUntilExpiry;
@MethodsNotNullByDefault
@@ -155,10 +152,10 @@ public class NavDrawerActivity extends BriarActivity implements
super.onStart();
updateTransports();
lockManager.checkIfLockable();
controller.showExpiryWarning(new UiResultHandler<ExpiryWarning>(this) {
controller.showExpiryWarning(new UiResultHandler<Boolean>(this) {
@Override
public void onResultUi(ExpiryWarning expiry) {
if (expiry != NO) showExpiryWarning(expiry);
public void onResultUi(Boolean expiry) {
if (expiry) showExpiryWarning();
}
});
}
@@ -347,7 +344,7 @@ public class NavDrawerActivity extends BriarActivity implements
if (item != null) item.setVisible(visible);
}
private void showExpiryWarning(ExpiryWarning expiry) {
private void showExpiryWarning() {
int daysUntilExpiry = getDaysUntilExpiry();
if (daysUntilExpiry < 0) signOut();
@@ -359,21 +356,9 @@ public class NavDrawerActivity extends BriarActivity implements
ImageView expiryWarningClose =
expiryWarning.findViewById(R.id.expiryWarningClose);
// show a different snackbar in green if this is an update
if (expiry == UPDATE) {
expiryWarning.setBackgroundColor(
ContextCompat.getColor(this, R.color.briar_green_light));
expiryWarningText.setText(
getString(R.string.expiry_update, daysUntilExpiry));
expiryWarningText.setTextColor(
ContextCompat.getColor(this, android.R.color.black));
expiryWarningClose.setColorFilter(
ContextCompat.getColor(this, android.R.color.black));
} else {
expiryWarningText.setText(getResources()
.getQuantityString(R.plurals.expiry_warning,
daysUntilExpiry, daysUntilExpiry));
}
expiryWarningText.setText(getResources()
.getQuantityString(R.plurals.expiry_warning,
daysUntilExpiry, daysUntilExpiry));
expiryWarningClose.setOnClickListener(v -> {
controller.expiryWarningDismissed();

View File

@@ -10,11 +10,9 @@ import org.briarproject.briar.android.controller.handler.ResultHandler;
@NotNullByDefault
public interface NavDrawerController extends ActivityLifecycleController {
enum ExpiryWarning { SHOW, NO, UPDATE }
boolean isTransportRunning(TransportId transportId);
void showExpiryWarning(ResultHandler<ExpiryWarning> handler);
void showExpiryWarning(ResultHandler<Boolean> handler);
void expiryWarningDismissed();

View File

@@ -26,16 +26,14 @@ import java.util.logging.Logger;
import javax.inject.Inject;
import static java.util.concurrent.TimeUnit.DAYS;
import static java.util.logging.Level.INFO;
import static java.util.logging.Level.WARNING;
import static java.util.logging.Logger.getLogger;
import static org.briarproject.bramble.util.LogUtils.logException;
import static org.briarproject.briar.android.TestingConstants.EXPIRY_DATE;
import static org.briarproject.briar.android.TestingConstants.IS_BETA_BUILD;
import static org.briarproject.briar.android.TestingConstants.IS_DEBUG_BUILD;
import static org.briarproject.briar.android.controller.BriarControllerImpl.DOZE_ASK_AGAIN;
import static org.briarproject.briar.android.navdrawer.NavDrawerController.ExpiryWarning.NO;
import static org.briarproject.briar.android.navdrawer.NavDrawerController.ExpiryWarning.SHOW;
import static org.briarproject.briar.android.navdrawer.NavDrawerController.ExpiryWarning.UPDATE;
import static org.briarproject.briar.android.settings.SettingsFragment.SETTINGS_NAMESPACE;
import static org.briarproject.briar.android.util.UiUtils.needsDozeWhitelisting;
@@ -45,9 +43,9 @@ public class NavDrawerControllerImpl extends DbControllerImpl
implements NavDrawerController, EventListener {
private static final Logger LOG =
Logger.getLogger(NavDrawerControllerImpl.class.getName());
getLogger(NavDrawerControllerImpl.class.getName());
private static final String EXPIRY_DATE_WARNING = "expiryDateWarning";
private static final String EXPIRY_SHOW_UPDATE = "expiryShowUpdate";
private final PluginManager pluginManager;
private final SettingsManager settingsManager;
@@ -103,9 +101,9 @@ public class NavDrawerControllerImpl extends DbControllerImpl
}
@Override
public void showExpiryWarning(ResultHandler<ExpiryWarning> handler) {
if (!IS_DEBUG_BUILD && !IS_BETA_BUILD) {
handler.onResult(NO);
public void showExpiryWarning(ResultHandler<Boolean> handler) {
if (!IS_DEBUG_BUILD) {
handler.onResult(false);
return;
}
runOnDbThread(() -> {
@@ -113,29 +111,25 @@ public class NavDrawerControllerImpl extends DbControllerImpl
Settings settings =
settingsManager.getSettings(SETTINGS_NAMESPACE);
int warningInt = settings.getInt(EXPIRY_DATE_WARNING, 0);
boolean showUpdate =
settings.getBoolean(EXPIRY_SHOW_UPDATE, true);
if (warningInt == 0) {
// we have not warned before
handler.onResult(SHOW);
handler.onResult(true);
} else {
long warningLong = warningInt * 1000L;
long now = System.currentTimeMillis();
long daysSinceLastWarning =
(now - warningLong) / 1000 / 60 / 60 / 24;
(now - warningLong) / DAYS.toMillis(1);
long daysBeforeExpiry =
(EXPIRY_DATE - now) / 1000 / 60 / 60 / 24;
(EXPIRY_DATE - now) / DAYS.toMillis(1);
if (showUpdate) {
handler.onResult(UPDATE);
} else if (daysSinceLastWarning >= 30) {
handler.onResult(SHOW);
if (daysSinceLastWarning >= 30) {
handler.onResult(true);
} else if (daysBeforeExpiry <= 3 &&
daysSinceLastWarning > 0) {
handler.onResult(SHOW);
handler.onResult(true);
} else {
handler.onResult(NO);
handler.onResult(false);
}
}
} catch (DbException e) {
@@ -151,7 +145,6 @@ public class NavDrawerControllerImpl extends DbControllerImpl
Settings settings = new Settings();
int date = (int) (System.currentTimeMillis() / 1000L);
settings.putInt(EXPIRY_DATE_WARNING, date);
settings.putBoolean(EXPIRY_SHOW_UPDATE, false);
settingsManager.mergeSettings(settings, SETTINGS_NAMESPACE);
} catch (DbException e) {
logException(LOG, WARNING, e);

View File

@@ -80,6 +80,7 @@ import static android.view.KeyEvent.KEYCODE_ENTER;
import static android.view.inputmethod.EditorInfo.IME_NULL;
import static android.view.inputmethod.InputMethodManager.SHOW_IMPLICIT;
import static java.util.Objects.requireNonNull;
import static java.util.concurrent.TimeUnit.DAYS;
import static org.briarproject.briar.BuildConfig.APPLICATION_ID;
import static org.briarproject.briar.android.TestingConstants.EXPIRY_DATE;
@@ -151,7 +152,7 @@ public class UiUtils {
public static int getDaysUntilExpiry() {
long now = System.currentTimeMillis();
long daysBeforeExpiry = (EXPIRY_DATE - now) / 1000 / 60 / 60 / 24;
long daysBeforeExpiry = (EXPIRY_DATE - now) / DAYS.toMillis(1);
return (int) daysBeforeExpiry;
}

View File

@@ -47,11 +47,10 @@
<item quantity="one">This is a test version of Briar. Your account will expire in %d day and cannot be renewed.</item>
<item quantity="other">This is a test version of Briar. Your account will expire in %d days and cannot be renewed.</item>
</plurals>
<string name="expiry_update">The testing expiry date has been extended. Your account will now expire in %d days.</string>
<string name="expiry_date_reached">This software has expired.\nThank you for testing!</string>
<string name="download_briar">To continue using Briar, please download version 1.0.</string>
<string name="download_briar">To continue using Briar, please download the latest release.</string>
<string name="create_new_account">You will need to create a new account, but you can use the same nickname.</string>
<string name="download_briar_button">Download Briar 1.0</string>
<string name="download_briar_button">Download Latest Release</string>
<string name="startup_open_database">Decrypting Database…</string>
<string name="startup_migrate_database">Upgrading Database…</string>
<string name="startup_compact_database">Compacting Database…</string>