mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-03 09:02:19 +00:00
Fix invalid transportation options
1) Accounts in the directory that don't have supports_sms can't get encrypted SMS. 2) Push groups can't receive insecure SMS // FREEBIE Closes #2521
This commit is contained in:
committed by
Moxie Marlinspike
parent
ac0a1c0bc1
commit
fcde642563
@@ -115,6 +115,27 @@ public class DirectoryHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isSmsFallbackAllowed(Context context, Recipients recipients) {
|
||||
try {
|
||||
if (recipients == null || !recipients.isSingleRecipient() || recipients.isGroupRecipient()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final String number = recipients.getPrimaryRecipient().getNumber();
|
||||
|
||||
if (number == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final String e164number = Util.canonicalizeNumber(context, number);
|
||||
|
||||
return TextSecureDirectory.getInstance(context).isSmsFallbackSupported(e164number);
|
||||
} catch (InvalidNumberException e) {
|
||||
Log.w(TAG, e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static interface DirectoryUpdateFinishedListener {
|
||||
public void onUpdateFinished();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user