Use java.util.Optional in Manager interface

This commit is contained in:
AsamK 2021-10-31 18:01:17 +01:00
parent f39983f78a
commit 1e87240db8
8 changed files with 19 additions and 16 deletions

View file

@ -24,7 +24,6 @@ import org.asamk.signal.manager.storage.recipients.Profile;
import org.asamk.signal.manager.storage.recipients.RecipientAddress;
import org.whispersystems.libsignal.InvalidKeyException;
import org.whispersystems.libsignal.util.Pair;
import org.whispersystems.libsignal.util.guava.Optional;
import org.whispersystems.signalservice.api.groupsv2.GroupLinkNotActiveException;
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentRemoteId;
import org.whispersystems.signalservice.api.messages.SignalServiceContent;
@ -41,6 +40,7 @@ import java.net.URI;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.TimeUnit;

View file

@ -358,9 +358,13 @@ public class ManagerImpl implements Manager {
*/
@Override
public void setProfile(
String givenName, final String familyName, String about, String aboutEmoji, Optional<File> avatar
String givenName, final String familyName, String about, String aboutEmoji, java.util.Optional<File> avatar
) throws IOException {
profileHelper.setProfile(givenName, familyName, about, aboutEmoji, avatar);
profileHelper.setProfile(givenName,
familyName,
about,
aboutEmoji,
avatar == null ? null : Optional.fromNullable(avatar.orElse(null)));
syncHelper.sendSyncFetchProfileMessage();
}
@ -443,7 +447,7 @@ public class ManagerImpl implements Manager {
}
@Override
public void setRegistrationLockPin(Optional<String> pin) throws IOException, UnauthenticatedResponseException {
public void setRegistrationLockPin(java.util.Optional<String> pin) throws IOException, UnauthenticatedResponseException {
if (!account.isMasterDevice()) {
throw new RuntimeException("Only master device can set a PIN");
}