mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Add parameter to configure phone number privacy
This commit is contained in:
parent
25258db55d
commit
6cd57312a1
11 changed files with 60 additions and 8 deletions
|
@ -90,7 +90,12 @@ public interface Manager extends Closeable {
|
|||
*/
|
||||
Map<String, UserStatus> getUserStatus(Set<String> numbers) throws IOException, RateLimitException;
|
||||
|
||||
void updateAccountAttributes(String deviceName, Boolean unrestrictedUnidentifiedSender) throws IOException;
|
||||
void updateAccountAttributes(
|
||||
String deviceName,
|
||||
Boolean unrestrictedUnidentifiedSender,
|
||||
final Boolean discoverableByNumber,
|
||||
final Boolean numberSharing
|
||||
) throws IOException;
|
||||
|
||||
Configuration getConfiguration();
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ import org.asamk.signal.manager.api.NotAGroupMemberException;
|
|||
import org.asamk.signal.manager.api.NotPrimaryDeviceException;
|
||||
import org.asamk.signal.manager.api.Pair;
|
||||
import org.asamk.signal.manager.api.PendingAdminApprovalException;
|
||||
import org.asamk.signal.manager.api.PhoneNumberSharingMode;
|
||||
import org.asamk.signal.manager.api.PinLockedException;
|
||||
import org.asamk.signal.manager.api.Profile;
|
||||
import org.asamk.signal.manager.api.RateLimitException;
|
||||
|
@ -277,13 +278,27 @@ public class ManagerImpl implements Manager {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateAccountAttributes(String deviceName, Boolean unrestrictedUnidentifiedSender) throws IOException {
|
||||
public void updateAccountAttributes(
|
||||
String deviceName,
|
||||
Boolean unrestrictedUnidentifiedSender,
|
||||
final Boolean discoverableByNumber,
|
||||
final Boolean numberSharing
|
||||
) throws IOException {
|
||||
if (deviceName != null) {
|
||||
context.getAccountHelper().setDeviceName(deviceName);
|
||||
}
|
||||
if (unrestrictedUnidentifiedSender != null) {
|
||||
account.setUnrestrictedUnidentifiedAccess(unrestrictedUnidentifiedSender);
|
||||
}
|
||||
if (discoverableByNumber != null) {
|
||||
account.getConfigurationStore().setPhoneNumberUnlisted(!discoverableByNumber);
|
||||
}
|
||||
if (numberSharing != null) {
|
||||
account.getConfigurationStore()
|
||||
.setPhoneNumberSharingMode(numberSharing
|
||||
? PhoneNumberSharingMode.EVERYBODY
|
||||
: PhoneNumberSharingMode.NOBODY);
|
||||
}
|
||||
context.getAccountHelper().updateAccountAttributes();
|
||||
context.getAccountHelper().checkWhoAmiI();
|
||||
}
|
||||
|
|
|
@ -118,7 +118,6 @@ public class AccountRecordProcessor extends DefaultStorageRecordProcessor<Signal
|
|||
.setLinkPreviewsEnabled(linkPreviews)
|
||||
.setUnlistedPhoneNumber(unlisted)
|
||||
.setPhoneNumberSharingMode(phoneNumberSharingMode)
|
||||
.setUnlistedPhoneNumber(unlisted)
|
||||
.setPinnedConversations(pinnedConversations)
|
||||
.setPreferContactAvatars(preferContactAvatars)
|
||||
.setPayments(payments.isEnabled(), payments.getEntropy().orElse(null))
|
||||
|
|
|
@ -62,7 +62,7 @@ public final class StorageSyncModels {
|
|||
.setSealedSenderIndicatorsEnabled(Optional.ofNullable(configStore.getUnidentifiedDeliveryIndicators())
|
||||
.orElse(true))
|
||||
.setLinkPreviewsEnabled(Optional.ofNullable(configStore.getLinkPreviews()).orElse(true))
|
||||
.setUnlistedPhoneNumber(Optional.ofNullable(configStore.getPhoneNumberUnlisted()).orElse(true))
|
||||
.setUnlistedPhoneNumber(Optional.ofNullable(configStore.getPhoneNumberUnlisted()).orElse(false))
|
||||
.setPhoneNumberSharingMode(localToRemote(Optional.ofNullable(configStore.getPhoneNumberSharingMode())
|
||||
.orElse(PhoneNumberSharingMode.EVERYBODY)))
|
||||
.setE164(self.getAddress().number().orElse(""))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue