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

View file

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

View file

@ -983,8 +983,7 @@ public class SignalAccount implements Closeable {
} }
public boolean isDiscoverableByPhoneNumber() { public boolean isDiscoverableByPhoneNumber() {
// TODO make configurable return configurationStore.getPhoneNumberUnlisted() == null || !configurationStore.getPhoneNumberUnlisted();
return true;
} }
public void finishRegistration(final ACI aci, final MasterKey masterKey, final String pin) { 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 unidentifiedDeliveryIndicators;
private Boolean typingIndicators; private Boolean typingIndicators;
private Boolean linkPreviews; private Boolean linkPreviews;
private Boolean phoneNumberUnlisted;
private PhoneNumberSharingMode phoneNumberSharingMode; private PhoneNumberSharingMode phoneNumberSharingMode;
public ConfigurationStore(final Saver saver) { public ConfigurationStore(final Saver saver) {
@ -62,6 +63,15 @@ public class ConfigurationStore {
saver.save(toStorage()); saver.save(toStorage());
} }
public Boolean getPhoneNumberUnlisted() {
return phoneNumberUnlisted;
}
public void setPhoneNumberUnlisted(final boolean phoneNumberUnlisted) {
this.phoneNumberUnlisted = phoneNumberUnlisted;
saver.save(toStorage());
}
public PhoneNumberSharingMode getPhoneNumberSharingMode() { public PhoneNumberSharingMode getPhoneNumberSharingMode() {
return phoneNumberSharingMode; return phoneNumberSharingMode;
} }
@ -76,6 +86,7 @@ public class ConfigurationStore {
unidentifiedDeliveryIndicators, unidentifiedDeliveryIndicators,
typingIndicators, typingIndicators,
linkPreviews, linkPreviews,
phoneNumberUnlisted,
phoneNumberSharingMode); phoneNumberSharingMode);
} }
@ -84,6 +95,7 @@ public class ConfigurationStore {
Boolean unidentifiedDeliveryIndicators, Boolean unidentifiedDeliveryIndicators,
Boolean typingIndicators, Boolean typingIndicators,
Boolean linkPreviews, Boolean linkPreviews,
Boolean phoneNumberUnlisted,
PhoneNumberSharingMode phoneNumberSharingMode PhoneNumberSharingMode phoneNumberSharingMode
) {} ) {}