Read phone number unlisted state from storage

This commit is contained in:
AsamK 2021-11-10 14:43:03 +01:00
parent 4baf0849a6
commit 62dd5a169f
4 changed files with 33 additions and 2 deletions

View file

@ -212,6 +212,7 @@ public class StorageHelper {
default -> PhoneNumberSharingMode.CONTACTS;
});
}
account.getConfigurationStore().setPhoneNumberUnlisted(accountRecord.isPhoneNumberUnlisted());
if (accountRecord.getProfileKey().isPresent()) {
ProfileKey profileKey;

View file

@ -983,8 +983,7 @@ public class SignalAccount implements Closeable {
}
public boolean isDiscoverableByPhoneNumber() {
// TODO make configurable
return true;
return configurationStore.getPhoneNumberUnlisted() == null || !configurationStore.getPhoneNumberUnlisted();
}
public void finishRegistration(final ACI aci, final MasterKey masterKey, final String pin) {

View file

@ -10,6 +10,7 @@ public class ConfigurationStore {
private Boolean unidentifiedDeliveryIndicators;
private Boolean typingIndicators;
private Boolean linkPreviews;
private Boolean phoneNumberUnlisted;
private PhoneNumberSharingMode phoneNumberSharingMode;
public ConfigurationStore(final Saver saver) {
@ -62,6 +63,15 @@ public class ConfigurationStore {
saver.save(toStorage());
}
public Boolean getPhoneNumberUnlisted() {
return phoneNumberUnlisted;
}
public void setPhoneNumberUnlisted(final boolean phoneNumberUnlisted) {
this.phoneNumberUnlisted = phoneNumberUnlisted;
saver.save(toStorage());
}
public PhoneNumberSharingMode getPhoneNumberSharingMode() {
return phoneNumberSharingMode;
}
@ -76,6 +86,7 @@ public class ConfigurationStore {
unidentifiedDeliveryIndicators,
typingIndicators,
linkPreviews,
phoneNumberUnlisted,
phoneNumberSharingMode);
}
@ -84,6 +95,7 @@ public class ConfigurationStore {
Boolean unidentifiedDeliveryIndicators,
Boolean typingIndicators,
Boolean linkPreviews,
Boolean phoneNumberUnlisted,
PhoneNumberSharingMode phoneNumberSharingMode
) {}