mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-28 02:37:46 +00:00
Correctly store destination SMS state.
This commit is contained in:
parent
51b9affe90
commit
44d59d0fd1
@ -109,7 +109,7 @@ public class Directory {
|
||||
values.put(TOKEN, token.getToken());
|
||||
values.put(RELAY, token.getRelay());
|
||||
values.put(REGISTERED, active ? 1 : 0);
|
||||
values.put(SUPPORTS_SMS, token.isSupportsSms());
|
||||
values.put(SUPPORTS_SMS, token.isSupportsSms() ? 1 : 0);
|
||||
values.put(TIMESTAMP, System.currentTimeMillis());
|
||||
db.replace(TABLE_NAME, null, values);
|
||||
}
|
||||
@ -127,6 +127,7 @@ public class Directory {
|
||||
values.put(REGISTERED, 1);
|
||||
values.put(TIMESTAMP, timestamp);
|
||||
values.put(RELAY, token.getRelay());
|
||||
values.put(SUPPORTS_SMS, token.isSupportsSms() ? 1 : 0);
|
||||
db.replace(TABLE_NAME, null, values);
|
||||
}
|
||||
|
||||
|
@ -23,9 +23,9 @@ public class PushDestination {
|
||||
return relay;
|
||||
}
|
||||
|
||||
public static PushDestination getInstance(Context context,
|
||||
PushServiceSocket.PushCredentials credentials,
|
||||
String destinationNumber)
|
||||
public static PushDestination create(Context context,
|
||||
PushServiceSocket.PushCredentials credentials,
|
||||
String destinationNumber)
|
||||
{
|
||||
String e164destination = PhoneNumberFormatter.formatNumber(destinationNumber, credentials.getLocalNumber(context));
|
||||
String relay = Directory.getInstance(context).getRelay(e164destination);
|
||||
|
@ -59,8 +59,8 @@ public class PushTransport extends BaseTransport {
|
||||
TextSecurePushCredentials credentials = TextSecurePushCredentials.getInstance();
|
||||
Recipient recipient = message.getIndividualRecipient();
|
||||
PushServiceSocket socket = new PushServiceSocket(context, credentials);
|
||||
PushDestination destination = PushDestination.getInstance(context, credentials,
|
||||
recipient.getNumber());
|
||||
PushDestination destination = PushDestination.create(context, credentials,
|
||||
recipient.getNumber());
|
||||
|
||||
String plaintextBody = message.getBody().getBody();
|
||||
byte[] plaintext = PushMessageContent.newBuilder()
|
||||
|
@ -104,19 +104,19 @@ public class UniversalTransport {
|
||||
|
||||
if (mediaMessage.getTo() != null) {
|
||||
for (EncodedStringValue to : mediaMessage.getTo()) {
|
||||
destinations.add(PushDestination.getInstance(context, credentials, to.getString()));
|
||||
destinations.add(PushDestination.create(context, credentials, to.getString()));
|
||||
}
|
||||
}
|
||||
|
||||
if (mediaMessage.getCc() != null) {
|
||||
for (EncodedStringValue cc : mediaMessage.getCc()) {
|
||||
destinations.add(PushDestination.getInstance(context, credentials, cc.getString()));
|
||||
destinations.add(PushDestination.create(context, credentials, cc.getString()));
|
||||
}
|
||||
}
|
||||
|
||||
if (mediaMessage.getBcc() != null) {
|
||||
for (EncodedStringValue bcc : mediaMessage.getBcc()) {
|
||||
destinations.add(PushDestination.getInstance(context, credentials, bcc.getString()));
|
||||
destinations.add(PushDestination.create(context, credentials, bcc.getString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user