mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-11 18:29:05 +01:00
Last round of addressing review issues
This commit is contained in:
@@ -36,6 +36,7 @@ import org.briarproject.api.plugins.ConnectionRegistry;
|
||||
import org.briarproject.api.plugins.PluginManager;
|
||||
import org.briarproject.api.privategroup.PrivateGroupManager;
|
||||
import org.briarproject.api.settings.SettingsManager;
|
||||
import org.briarproject.api.system.Clock;
|
||||
import org.briarproject.plugins.AndroidPluginsModule;
|
||||
import org.briarproject.system.AndroidSystemModule;
|
||||
|
||||
@@ -121,6 +122,8 @@ public interface AndroidComponent extends CoreEagerSingletons {
|
||||
|
||||
FeedManager feedManager();
|
||||
|
||||
Clock clock();
|
||||
|
||||
@IoExecutor
|
||||
Executor ioExecutor();
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.briarproject.api.identity.IdentityManager;
|
||||
import org.briarproject.api.identity.LocalAuthor;
|
||||
import org.briarproject.api.lifecycle.LifecycleManager;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
import org.briarproject.api.system.Clock;
|
||||
import org.briarproject.util.StringUtils;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -41,9 +42,9 @@ public class ForumControllerImpl
|
||||
LifecycleManager lifecycleManager, IdentityManager identityManager,
|
||||
@CryptoExecutor Executor cryptoExecutor,
|
||||
ForumManager forumManager, EventBus eventBus,
|
||||
AndroidNotificationManager notificationManager) {
|
||||
AndroidNotificationManager notificationManager, Clock clock) {
|
||||
super(dbExecutor, lifecycleManager, identityManager, cryptoExecutor,
|
||||
eventBus, notificationManager);
|
||||
eventBus, notificationManager, clock);
|
||||
this.forumManager = forumManager;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.briarproject.api.privategroup.GroupMessageHeader;
|
||||
import org.briarproject.api.privategroup.PrivateGroup;
|
||||
import org.briarproject.api.privategroup.PrivateGroupManager;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
import org.briarproject.api.system.Clock;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.Executor;
|
||||
@@ -40,9 +41,9 @@ public class GroupControllerImpl
|
||||
LifecycleManager lifecycleManager, IdentityManager identityManager,
|
||||
@CryptoExecutor Executor cryptoExecutor,
|
||||
PrivateGroupManager privateGroupManager, EventBus eventBus,
|
||||
AndroidNotificationManager notificationManager) {
|
||||
AndroidNotificationManager notificationManager, Clock clock) {
|
||||
super(dbExecutor, lifecycleManager, identityManager, cryptoExecutor,
|
||||
eventBus, notificationManager);
|
||||
eventBus, notificationManager, clock);
|
||||
this.privateGroupManager = privateGroupManager;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,8 +52,6 @@ class GroupViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
void bindView(final Context ctx, final GroupItem group,
|
||||
@NotNull final OnGroupRemoveClickListener listener) {
|
||||
if (group == null) return;
|
||||
|
||||
// Avatar
|
||||
avatar.setText(group.getName().substring(0, 1));
|
||||
avatar.setBackgroundBytes(group.getId().getBytes());
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.briarproject.api.identity.LocalAuthor;
|
||||
import org.briarproject.api.lifecycle.LifecycleManager;
|
||||
import org.briarproject.api.sync.GroupId;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
import org.briarproject.api.system.Clock;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -46,6 +47,7 @@ public abstract class ThreadListControllerImpl<G extends NamedGroup, I extends T
|
||||
private final Executor cryptoExecutor;
|
||||
protected final AndroidNotificationManager notificationManager;
|
||||
private final EventBus eventBus;
|
||||
private final Clock clock;
|
||||
|
||||
private final Map<MessageId, String> bodyCache =
|
||||
new ConcurrentHashMap<>();
|
||||
@@ -57,12 +59,13 @@ public abstract class ThreadListControllerImpl<G extends NamedGroup, I extends T
|
||||
protected ThreadListControllerImpl(@DatabaseExecutor Executor dbExecutor,
|
||||
LifecycleManager lifecycleManager, IdentityManager identityManager,
|
||||
@CryptoExecutor Executor cryptoExecutor, EventBus eventBus,
|
||||
AndroidNotificationManager notificationManager) {
|
||||
AndroidNotificationManager notificationManager, Clock clock) {
|
||||
super(dbExecutor, lifecycleManager);
|
||||
this.identityManager = identityManager;
|
||||
this.cryptoExecutor = cryptoExecutor;
|
||||
this.eventBus = eventBus;
|
||||
this.notificationManager = notificationManager;
|
||||
this.clock = clock;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -250,7 +253,7 @@ public abstract class ThreadListControllerImpl<G extends NamedGroup, I extends T
|
||||
LocalAuthor author = identityManager.getLocalAuthor();
|
||||
long timestamp = getLatestTimestamp();
|
||||
timestamp =
|
||||
Math.max(timestamp, System.currentTimeMillis());
|
||||
Math.max(timestamp, clock.currentTimeMillis());
|
||||
createMessage(body, timestamp, parentId, author,
|
||||
handler);
|
||||
} catch (DbException e) {
|
||||
@@ -343,9 +346,6 @@ public abstract class ThreadListControllerImpl<G extends NamedGroup, I extends T
|
||||
return entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* When building the item, the body can be assumed to be cached
|
||||
*/
|
||||
protected abstract I buildItem(H header, String body);
|
||||
|
||||
protected GroupId getGroupId() {
|
||||
|
||||
Reference in New Issue
Block a user