mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +00:00
parent
ec63f7014e
commit
ec922704f4
@ -41,7 +41,7 @@ public class SmsListener extends BroadcastReceiver {
|
|||||||
private static final String SMS_RECEIVED_ACTION = Telephony.Sms.Intents.SMS_RECEIVED_ACTION;
|
private static final String SMS_RECEIVED_ACTION = Telephony.Sms.Intents.SMS_RECEIVED_ACTION;
|
||||||
private static final String SMS_DELIVERED_ACTION = Telephony.Sms.Intents.SMS_DELIVER_ACTION;
|
private static final String SMS_DELIVERED_ACTION = Telephony.Sms.Intents.SMS_DELIVER_ACTION;
|
||||||
|
|
||||||
private static final Pattern CHALLENGE_PATTERN = Pattern.compile(".*Your TextSecure verification code: ([0-9]{3,4})-([0-9]{3,4}).*", Pattern.DOTALL);
|
private static final Pattern CHALLENGE_PATTERN = Pattern.compile(".*Your (Signal|TextSecure) verification code: ([0-9]{3,4})-([0-9]{3,4}).*", Pattern.DOTALL);
|
||||||
|
|
||||||
private boolean isExemption(SmsMessage message, String messageBody) {
|
private boolean isExemption(SmsMessage message, String messageBody) {
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ public class SmsListener extends BroadcastReceiver {
|
|||||||
throw new AssertionError("Expression should match.");
|
throw new AssertionError("Expression should match.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return challengeMatcher.group(1) + challengeMatcher.group(2);
|
return challengeMatcher.group(2) + challengeMatcher.group(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,6 +24,14 @@ public class SmsListenerTest extends BaseUnitTest {
|
|||||||
put("Your TextSecure verification code: 1337-1337", "13371337");
|
put("Your TextSecure verification code: 1337-1337", "13371337");
|
||||||
put("XXXYour TextSecure verification code: 1337-1337", "13371337");
|
put("XXXYour TextSecure verification code: 1337-1337", "13371337");
|
||||||
put("Your TextSecure verification code: 1337-1337XXX", "13371337");
|
put("Your TextSecure verification code: 1337-1337XXX", "13371337");
|
||||||
|
|
||||||
|
put("Your Signal verification code: 337-337", "337337");
|
||||||
|
put("XXX\nYour Signal verification code: 1337-1337", "13371337");
|
||||||
|
put("Your Signal verification code: 337-1337", "3371337");
|
||||||
|
put("Your Signal verification code: 1337-337", "1337337");
|
||||||
|
put("Your Signal verification code: 1337-1337", "13371337");
|
||||||
|
put("XXXYour Signal verification code: 1337-1337", "13371337");
|
||||||
|
put("Your Signal verification code: 1337-1337XXX", "13371337");
|
||||||
}};
|
}};
|
||||||
|
|
||||||
private SmsListener listener;
|
private SmsListener listener;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user