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

@ -385,6 +385,11 @@
"allDeclaredMethods":true,
"allDeclaredClasses":true}
,
{
"name":"org.asamk.Signal$Configuration",
"allDeclaredClasses":true,
"queryAllDeclaredMethods":true}
,
{
"name":"org.asamk.Signal$Device",
"allDeclaredMethods":true,
@ -400,11 +405,19 @@
"allDeclaredConstructors":true,
"allPublicConstructors":true}
,
{
"name":"org.asamk.Signal$MessageReceivedV2",
"queryAllPublicConstructors":true}
,
{
"name":"org.asamk.Signal$ReceiptReceived",
"allDeclaredConstructors":true,
"allPublicConstructors":true}
,
{
"name":"org.asamk.Signal$ReceiptReceivedV2",
"queryAllPublicConstructors":true}
,
{
"name":"org.asamk.Signal$StructDevice",
"allDeclaredFields":true}
@ -418,6 +431,10 @@
"allDeclaredConstructors":true,
"allPublicConstructors":true}
,
{
"name":"org.asamk.Signal$SyncMessageReceivedV2",
"queryAllPublicConstructors":true}
,
{
"name":"org.asamk.SignalControl",
"allDeclaredMethods":true,
@ -673,9 +690,11 @@
"queryAllDeclaredMethods":true,
"queryAllDeclaredConstructors":true,
"methods":[
{"name":"<init>","parameterTypes":["java.lang.Boolean","java.lang.Boolean","java.lang.Boolean","java.lang.Boolean","java.lang.Boolean","org.asamk.signal.manager.api.PhoneNumberSharingMode"] },
{"name":"<init>","parameterTypes":["java.lang.Boolean","java.lang.Boolean","java.lang.Boolean","java.lang.Boolean","org.asamk.signal.manager.api.PhoneNumberSharingMode"] },
{"name":"linkPreviews","parameterTypes":[] },
{"name":"phoneNumberSharingMode","parameterTypes":[] },
{"name":"phoneNumberUnlisted","parameterTypes":[] },
{"name":"readReceipts","parameterTypes":[] },
{"name":"typingIndicators","parameterTypes":[] },
{"name":"unidentifiedDeliveryIndicators","parameterTypes":[] }

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
) {}