mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
Compare commits
9 Commits
beta-0.16.
...
beta-0.16.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a9437f7985 | ||
|
|
8141a97fc9 | ||
|
|
db842bd7e4 | ||
|
|
6dbec3a864 | ||
|
|
29f658cf4d | ||
|
|
ca83744a84 | ||
|
|
d91a9e2be4 | ||
|
|
8408c3f467 | ||
|
|
544c83a64c |
@@ -78,8 +78,8 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 22
|
targetSdkVersion 22
|
||||||
versionCode 1604
|
versionCode 1605
|
||||||
versionName "0.16.4"
|
versionName "0.16.5"
|
||||||
applicationId "org.briarproject.briar.beta"
|
applicationId "org.briarproject.briar.beta"
|
||||||
resValue "string", "app_package", "org.briarproject.briar.beta"
|
resValue "string", "app_package", "org.briarproject.briar.beta"
|
||||||
buildConfigField "String", "GitHash", "\"${getGitHash()}\""
|
buildConfigField "String", "GitHash", "\"${getGitHash()}\""
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ package org.briarproject.briar.android;
|
|||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.os.StrictMode;
|
||||||
|
import android.os.StrictMode.ThreadPolicy;
|
||||||
|
import android.os.StrictMode.VmPolicy;
|
||||||
|
|
||||||
import org.acra.ACRA;
|
import org.acra.ACRA;
|
||||||
import org.acra.ReportingInteractionMode;
|
import org.acra.ReportingInteractionMode;
|
||||||
@@ -33,6 +36,8 @@ import static org.acra.ReportField.REPORT_ID;
|
|||||||
import static org.acra.ReportField.STACK_TRACE;
|
import static org.acra.ReportField.STACK_TRACE;
|
||||||
import static org.acra.ReportField.USER_APP_START_DATE;
|
import static org.acra.ReportField.USER_APP_START_DATE;
|
||||||
import static org.acra.ReportField.USER_CRASH_DATE;
|
import static org.acra.ReportField.USER_CRASH_DATE;
|
||||||
|
import static org.briarproject.briar.android.TestingConstants.DEFAULT_LOG_LEVEL;
|
||||||
|
import static org.briarproject.briar.android.TestingConstants.IS_DEBUG_BUILD;
|
||||||
|
|
||||||
@ReportsCrashes(
|
@ReportsCrashes(
|
||||||
reportPrimerClass = BriarReportPrimer.class,
|
reportPrimerClass = BriarReportPrimer.class,
|
||||||
@@ -72,6 +77,9 @@ public class BriarApplicationImpl extends Application
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
|
|
||||||
|
if (IS_DEBUG_BUILD) enableStrictMode();
|
||||||
|
Logger.getLogger("").setLevel(DEFAULT_LOG_LEVEL);
|
||||||
LOG.info("Created");
|
LOG.info("Created");
|
||||||
|
|
||||||
applicationComponent = DaggerAndroidComponent.builder()
|
applicationComponent = DaggerAndroidComponent.builder()
|
||||||
@@ -85,6 +93,17 @@ public class BriarApplicationImpl extends Application
|
|||||||
AndroidEagerSingletons.initEagerSingletons(applicationComponent);
|
AndroidEagerSingletons.initEagerSingletons(applicationComponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void enableStrictMode() {
|
||||||
|
ThreadPolicy.Builder threadPolicy = new ThreadPolicy.Builder();
|
||||||
|
threadPolicy.detectAll();
|
||||||
|
threadPolicy.penaltyLog();
|
||||||
|
StrictMode.setThreadPolicy(threadPolicy.build());
|
||||||
|
VmPolicy.Builder vmPolicy = new VmPolicy.Builder();
|
||||||
|
vmPolicy.detectAll();
|
||||||
|
vmPolicy.penaltyLog();
|
||||||
|
StrictMode.setVmPolicy(vmPolicy.build());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AndroidComponent getApplicationComponent() {
|
public AndroidComponent getApplicationComponent() {
|
||||||
return applicationComponent;
|
return applicationComponent;
|
||||||
|
|||||||
@@ -10,13 +10,21 @@ import static java.util.logging.Level.OFF;
|
|||||||
public interface TestingConstants {
|
public interface TestingConstants {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether this is an alpha or beta build. This should be set to false for
|
* Whether this is a debug build.
|
||||||
|
*/
|
||||||
|
boolean IS_DEBUG_BUILD = BuildConfig.DEBUG;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether this is a beta build. This should be set to false for final
|
||||||
* release builds.
|
* release builds.
|
||||||
*/
|
*/
|
||||||
boolean TESTING = BuildConfig.DEBUG;
|
boolean IS_BETA_BUILD = true;
|
||||||
|
|
||||||
/** Default log level. */
|
/**
|
||||||
Level DEFAULT_LOG_LEVEL = TESTING ? INFO : OFF;
|
* Default log level. Disable logging for final release builds.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("ConstantConditions")
|
||||||
|
Level DEFAULT_LOG_LEVEL = IS_DEBUG_BUILD || IS_BETA_BUILD ? INFO : OFF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether to prevent screenshots from being taken. Setting this to true
|
* Whether to prevent screenshots from being taken. Setting this to true
|
||||||
@@ -24,5 +32,5 @@ public interface TestingConstants {
|
|||||||
* Unfortunately this also prevents the user from taking screenshots
|
* Unfortunately this also prevents the user from taking screenshots
|
||||||
* intentionally.
|
* intentionally.
|
||||||
*/
|
*/
|
||||||
boolean PREVENT_SCREENSHOTS = !TESTING;
|
boolean PREVENT_SCREENSHOTS = !IS_DEBUG_BUILD;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,14 +8,16 @@ import org.briarproject.bramble.api.nullsafety.MethodsNotNullByDefault;
|
|||||||
import org.briarproject.bramble.api.nullsafety.ParametersNotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.ParametersNotNullByDefault;
|
||||||
import org.briarproject.bramble.api.sync.MessageId;
|
import org.briarproject.bramble.api.sync.MessageId;
|
||||||
import org.briarproject.briar.android.activity.ActivityComponent;
|
import org.briarproject.briar.android.activity.ActivityComponent;
|
||||||
|
import org.briarproject.briar.android.blog.BaseController.BlogListener;
|
||||||
import org.briarproject.briar.android.controller.handler.UiResultExceptionHandler;
|
import org.briarproject.briar.android.controller.handler.UiResultExceptionHandler;
|
||||||
|
import org.briarproject.briar.api.blog.BlogPostHeader;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
@UiThread
|
@UiThread
|
||||||
@MethodsNotNullByDefault
|
@MethodsNotNullByDefault
|
||||||
@ParametersNotNullByDefault
|
@ParametersNotNullByDefault
|
||||||
public class BlogPostFragment extends BasePostFragment {
|
public class BlogPostFragment extends BasePostFragment implements BlogListener {
|
||||||
|
|
||||||
private static final String TAG = BlogPostFragment.class.getName();
|
private static final String TAG = BlogPostFragment.class.getName();
|
||||||
|
|
||||||
@@ -40,6 +42,7 @@ public class BlogPostFragment extends BasePostFragment {
|
|||||||
@Override
|
@Override
|
||||||
public void injectFragment(ActivityComponent component) {
|
public void injectFragment(ActivityComponent component) {
|
||||||
component.inject(this);
|
component.inject(this);
|
||||||
|
blogController.setBlogListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -59,4 +62,15 @@ public class BlogPostFragment extends BasePostFragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBlogPostAdded(BlogPostHeader header, boolean local) {
|
||||||
|
// doesn't matter here
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBlogRemoved() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,6 @@ import android.content.Intent;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.StrictMode;
|
|
||||||
import android.os.StrictMode.ThreadPolicy;
|
|
||||||
import android.os.StrictMode.VmPolicy;
|
|
||||||
import android.support.v7.preference.PreferenceManager;
|
import android.support.v7.preference.PreferenceManager;
|
||||||
import android.transition.Fade;
|
import android.transition.Fade;
|
||||||
|
|
||||||
@@ -23,8 +20,6 @@ import java.util.logging.Logger;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import static org.briarproject.briar.android.BriarApplication.EXPIRY_DATE;
|
import static org.briarproject.briar.android.BriarApplication.EXPIRY_DATE;
|
||||||
import static org.briarproject.briar.android.TestingConstants.DEFAULT_LOG_LEVEL;
|
|
||||||
import static org.briarproject.briar.android.TestingConstants.TESTING;
|
|
||||||
|
|
||||||
public class SplashScreenActivity extends BaseActivity {
|
public class SplashScreenActivity extends BaseActivity {
|
||||||
|
|
||||||
@@ -36,11 +31,6 @@ public class SplashScreenActivity extends BaseActivity {
|
|||||||
@Inject
|
@Inject
|
||||||
protected AndroidExecutor androidExecutor;
|
protected AndroidExecutor androidExecutor;
|
||||||
|
|
||||||
public SplashScreenActivity() {
|
|
||||||
Logger.getLogger("").setLevel(DEFAULT_LOG_LEVEL);
|
|
||||||
enableStrictMode();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle state) {
|
public void onCreate(Bundle state) {
|
||||||
super.onCreate(state);
|
super.onCreate(state);
|
||||||
@@ -81,19 +71,6 @@ public class SplashScreenActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableStrictMode() {
|
|
||||||
if (TESTING) {
|
|
||||||
ThreadPolicy.Builder threadPolicy = new ThreadPolicy.Builder();
|
|
||||||
threadPolicy.detectAll();
|
|
||||||
threadPolicy.penaltyLog();
|
|
||||||
StrictMode.setThreadPolicy(threadPolicy.build());
|
|
||||||
VmPolicy.Builder vmPolicy = new VmPolicy.Builder();
|
|
||||||
vmPolicy.detectAll();
|
|
||||||
vmPolicy.penaltyLog();
|
|
||||||
StrictMode.setVmPolicy(vmPolicy.build());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setPreferencesDefaults() {
|
private void setPreferencesDefaults() {
|
||||||
androidExecutor.runOnBackgroundThread(new Runnable() {
|
androidExecutor.runOnBackgroundThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -104,8 +104,9 @@ public class EmojiPageView extends FrameLayout {
|
|||||||
emojiSize + 2 * pad));
|
emojiSize + 2 * pad));
|
||||||
view = emojiView;
|
view = emojiView;
|
||||||
}
|
}
|
||||||
|
String emoji = model.getEmoji()[position];
|
||||||
|
view.setEmoji(emoji);
|
||||||
|
|
||||||
view.setEmoji(model.getEmoji()[position]);
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class RecentEmojiPageModel implements EmojiPageModel {
|
|||||||
private static final Logger LOG =
|
private static final Logger LOG =
|
||||||
Logger.getLogger(RecentEmojiPageModel.class.getName());
|
Logger.getLogger(RecentEmojiPageModel.class.getName());
|
||||||
|
|
||||||
private static final String EMOJI_LRU_PREFERENCE = "pref_emoji_recent";
|
private static final String EMOJI_LRU_PREFERENCE = "pref_emoji_recent2";
|
||||||
private static final int EMOJI_LRU_SIZE = 50;
|
private static final int EMOJI_LRU_SIZE = 50;
|
||||||
|
|
||||||
private final LinkedHashSet<String> recentlyUsed; // UI thread
|
private final LinkedHashSet<String> recentlyUsed; // UI thread
|
||||||
@@ -98,12 +98,12 @@ public class RecentEmojiPageModel implements EmojiPageModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String serialize(LinkedHashSet<String> emojis) {
|
private String serialize(LinkedHashSet<String> emojis) {
|
||||||
return StringUtils.join(emojis, ";");
|
return StringUtils.join(emojis, "\t");
|
||||||
}
|
}
|
||||||
|
|
||||||
private LinkedHashSet<String> deserialize(@Nullable String serialized) {
|
private LinkedHashSet<String> deserialize(@Nullable String serialized) {
|
||||||
if (serialized == null) return new LinkedHashSet<>();
|
if (serialized == null) return new LinkedHashSet<>();
|
||||||
String[] list = serialized.split(";");
|
String[] list = serialized.split("\t");
|
||||||
LinkedHashSet<String> result = new LinkedHashSet<>(list.length);
|
LinkedHashSet<String> result = new LinkedHashSet<>(list.length);
|
||||||
Collections.addAll(result, list);
|
Collections.addAll(result, list);
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ import okhttp3.Dns;
|
|||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
|
import okhttp3.ResponseBody;
|
||||||
|
|
||||||
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||||
import static java.util.logging.Level.WARNING;
|
import static java.util.logging.Level.WARNING;
|
||||||
@@ -334,7 +335,9 @@ class FeedManagerImpl implements FeedManager, Client, EventListener,
|
|||||||
private SyndFeed fetchSyndFeed(String url)
|
private SyndFeed fetchSyndFeed(String url)
|
||||||
throws FeedException, IOException {
|
throws FeedException, IOException {
|
||||||
// fetch feed
|
// fetch feed
|
||||||
SyndFeed f = getSyndFeed(getFeedInputStream(url));
|
InputStream stream = getFeedInputStream(url);
|
||||||
|
SyndFeed f = getSyndFeed(stream);
|
||||||
|
stream.close();
|
||||||
|
|
||||||
if (f.getEntries().size() == 0)
|
if (f.getEntries().size() == 0)
|
||||||
throw new FeedException("Feed has no entries");
|
throw new FeedException("Feed has no entries");
|
||||||
@@ -387,7 +390,9 @@ class FeedManagerImpl implements FeedManager, Client, EventListener,
|
|||||||
|
|
||||||
// Execute Request
|
// Execute Request
|
||||||
Response response = client.newCall(request).execute();
|
Response response = client.newCall(request).execute();
|
||||||
return response.body().byteStream();
|
ResponseBody body = response.body();
|
||||||
|
if (body != null) return body.byteStream();
|
||||||
|
throw new IOException("Empty response body");
|
||||||
}
|
}
|
||||||
|
|
||||||
private SyndFeed getSyndFeed(InputStream stream)
|
private SyndFeed getSyndFeed(InputStream stream)
|
||||||
|
|||||||
Reference in New Issue
Block a user