Add sharing information to toolbar subtitle of blogs

The toolbar subtitle shows information about how many contacts the
current blog is shared with and how many of those are online.
This commit is contained in:
Torsten Grote
2016-12-05 16:39:34 -02:00
parent 7df6abbcbe
commit d04dda1566
13 changed files with 411 additions and 13 deletions

View File

@@ -357,7 +357,8 @@ class BlogSharingManagerImpl extends
throw new IllegalStateException("No responseId");
BlogInvitationResponse response =
new BlogInvitationResponse(responseId,
localState.getSessionId(), localState.getGroupId(),
localState.getSessionId(),
localState.getShareableId(),
localState.getContactId(), accept, time, false,
false, false, false);
return new BlogInvitationResponseReceivedEvent(c, response);

View File

@@ -287,8 +287,8 @@ class ForumSharingManagerImpl extends
throw new IllegalStateException("No responseId");
ForumInvitationResponse response = new ForumInvitationResponse(
responseId, localState.getSessionId(),
localState.getGroupId(), localState.getContactId(), accept,
time, false, false, false, false);
localState.getShareableId(), localState.getContactId(),
accept, time, false, false, false, false);
return new ForumInvitationResponseReceivedEvent(name, c, response);
}
}

View File

@@ -3,8 +3,10 @@ package org.briarproject.briar.sharing;
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import org.briarproject.briar.api.sharing.event.InvitationRequestReceivedEvent;
import javax.annotation.Nullable;
@NotNullByDefault
interface InvitationReceivedEventFactory<IS extends InviteeSessionState, IR extends InvitationRequestReceivedEvent> {
IR build(IS localState, long time, String msg);
IR build(IS localState, long time, @Nullable String msg);
}

View File

@@ -39,6 +39,7 @@ import org.briarproject.briar.api.sharing.SharingInvitationItem;
import org.briarproject.briar.api.sharing.SharingManager;
import org.briarproject.briar.api.sharing.event.InvitationRequestReceivedEvent;
import org.briarproject.briar.api.sharing.event.InvitationResponseReceivedEvent;
import org.briarproject.briar.api.sharing.event.ShareableLeftEvent;
import org.briarproject.briar.client.ConversationClientImpl;
import java.io.IOException;
@@ -897,9 +898,15 @@ abstract class SharingManagerImpl<S extends Shareable, I extends Invitation, IS
} else if (task == TASK_UNSHARE_SHAREABLE_SHARED_BY_US) {
db.setGroupVisibility(txn, contactId, f.getId(), INVISIBLE);
removeFromList(txn, groupId, SHARED_BY_US, f);
// broadcast event informing UI that contact has left the group
ShareableLeftEvent e = new ShareableLeftEvent(f.getId(), contactId);
txn.attach(e);
} else if (task == TASK_UNSHARE_SHAREABLE_SHARED_WITH_US) {
db.setGroupVisibility(txn, contactId, f.getId(), INVISIBLE);
removeFromList(txn, groupId, SHARED_WITH_US, f);
// broadcast event informing UI that contact has left the group
ShareableLeftEvent e = new ShareableLeftEvent(f.getId(), contactId);
txn.attach(e);
}
}