Introduce more sharing states

This commit is contained in:
Torsten Grote
2023-01-16 14:44:13 -03:00
parent c5fb1416bd
commit 429bbe1275
10 changed files with 80 additions and 32 deletions

View File

@@ -84,6 +84,8 @@ public interface GroupInvitationManager extends ConversationClient {
* and {@link PrivateGroup} identified by the given {@link GroupId}.
* This indicates whether the {@link PrivateGroup} can be shared
* with the contact.
*
* @throws ProtocolStateException if {@link PrivateGroup} was already left.
*/
SharingStatus getSharingStatus(Contact c, GroupId g) throws DbException;
}

View File

@@ -5,6 +5,7 @@ import org.briarproject.bramble.api.contact.ContactId;
import org.briarproject.bramble.api.db.DbException;
import org.briarproject.bramble.api.db.Transaction;
import org.briarproject.bramble.api.sync.GroupId;
import org.briarproject.briar.api.client.ProtocolStateException;
import org.briarproject.briar.api.client.SessionId;
import org.briarproject.briar.api.conversation.ConversationManager.ConversationClient;
import org.briarproject.nullsafety.NotNullByDefault;
@@ -24,10 +25,14 @@ public interface SharingManager<S extends Shareable>
SHAREABLE,
/**
* The {@link Shareable} can not be shared with the requested contact,
* because of an ongoing sharing session.
* In most cases, this means that the contact was already invited.
* because the contact was already invited.
*/
INVITED,
INVITE_SENT,
/**
* The {@link Shareable} can not be shared with the requested contact,
* because the contact has already invited us.
*/
INVITE_RECEIVED,
/**
* The {@link Shareable} can not be shared with the requested contact,
* because it is already being shared.
@@ -38,7 +43,11 @@ public interface SharingManager<S extends Shareable>
* because it is not supported by that contact.
* This could be a missing or outdated client.
*/
NOT_SUPPORTED
NOT_SUPPORTED,
/**
* The sharing session has encountered an error.
*/
ERROR
}
/**
@@ -106,6 +115,8 @@ public interface SharingManager<S extends Shareable>
* and {@link Shareable} identified by the given {@link GroupId}.
* This indicates whether the {@link Shareable} can be shared
* with the contact.
*
* @throws ProtocolStateException if {@link Shareable} was already left.
*/
SharingStatus getSharingStatus(GroupId g, Contact c) throws DbException;
@@ -114,6 +125,8 @@ public interface SharingManager<S extends Shareable>
* and {@link Shareable} identified by the given {@link GroupId}.
* This indicates whether the {@link Shareable} can be shared
* with the contact.
*
* @throws ProtocolStateException if {@link Shareable} was already left.
*/
SharingStatus getSharingStatus(Transaction txn, GroupId g, Contact c)
throws DbException;