import java.io.File;
import java.io.IOException;
import java.net.URI;
+import java.time.Duration;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
-import java.util.stream.Collectors;
public interface Manager extends Closeable {
var account = SignalAccount.load(pathConfig.dataPath(), number, true, trustNewIdentity);
if (!account.isRegistered()) {
+ account.close();
throw new NotRegisteredException();
}
return PhoneNumberFormatter.isValidNumber(e164Number, countryCode);
}
- static List<String> getAllLocalNumbers(File settingsPath) {
+ static List<String> getAllLocalAccountNumbers(File settingsPath) {
var pathConfig = PathConfig.createDefault(settingsPath);
final var dataPath = pathConfig.dataPath();
final var files = dataPath.listFiles();
.filter(File::isFile)
.map(File::getName)
.filter(file -> PhoneNumberFormatter.isValidNumber(file, null))
- .collect(Collectors.toList());
+ .toList();
}
String getSelfNumber();
GroupInviteLinkUrl inviteLinkUrl
) throws IOException, InactiveGroupLinkException;
- void sendTypingMessage(
+ SendMessageResults sendTypingMessage(
TypingAction action, Set<RecipientIdentifier> recipients
- ) throws IOException, UntrustedIdentityException, NotAGroupMemberException, GroupNotFoundException, GroupSendingNotAllowedException;
+ ) throws IOException, NotAGroupMemberException, GroupNotFoundException, GroupSendingNotAllowedException;
- void sendReadReceipt(
+ SendMessageResults sendReadReceipt(
RecipientIdentifier.Single sender, List<Long> messageIds
- ) throws IOException, UntrustedIdentityException;
+ ) throws IOException;
- void sendViewedReceipt(
+ SendMessageResults sendViewedReceipt(
RecipientIdentifier.Single sender, List<Long> messageIds
- ) throws IOException, UntrustedIdentityException;
+ ) throws IOException;
SendMessageResults sendMessage(
Message message, Set<RecipientIdentifier> recipients
SendMessageResults sendEndSessionMessage(Set<RecipientIdentifier.Single> recipients) throws IOException;
+ void deleteRecipient(RecipientIdentifier.Single recipient) throws IOException;
+
+ void deleteContact(RecipientIdentifier.Single recipient) throws IOException;
+
void setContactName(
RecipientIdentifier.Single recipient, String name
) throws NotMasterDeviceException, IOException;
/**
* Receive new messages from server, returns if no new message arrive in a timespan of timeout.
*/
- void receiveMessages(long timeout, TimeUnit unit, ReceiveMessageHandler handler) throws IOException;
+ void receiveMessages(Duration timeout, ReceiveMessageHandler handler) throws IOException;
/**
* Receive new messages from server, returns only if the thread is interrupted.
boolean trustIdentityAllKeys(RecipientIdentifier.Single recipient);
+ void addClosedListener(Runnable listener);
+
@Override
void close() throws IOException;