From b16a27c2498b609b8b6d21894ac5b95fa52791ae Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Wed, 14 Dec 2016 16:17:42 -0800 Subject: [PATCH] Update libsignal-service Fixes #5928 // FREEBIE --- build.gradle | 8 ++--- .../util/PhoneNumberFormatterTest.java | 36 +++++++++++-------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/build.gradle b/build.gradle index 060bda4eb8..b169c55f20 100644 --- a/build.gradle +++ b/build.gradle @@ -73,7 +73,7 @@ dependencies { compile 'org.whispersystems:jobmanager:1.0.2' compile 'org.whispersystems:libpastelog:1.0.7' compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1' - compile 'org.whispersystems:signal-service-android:2.4.1' + compile 'org.whispersystems:signal-service-android:2.4.2' compile 'com.h6ah4i.android.compat:mulsellistprefcompat:1.0.0' compile 'com.google.zxing:core:3.2.1' @@ -131,7 +131,7 @@ dependencyVerification { 'org.whispersystems:jobmanager:506f679fc2fcf7bb6d10f00f41d6f6ea0abf75c70dc95b913398661ad538a181', 'org.whispersystems:libpastelog:bb331d9a98240fc139101128ba836c1edec3c40e000597cdbb29ebf4cbf34d88', 'com.amulyakhare:com.amulyakhare.textdrawable:54c92b5fba38cfd316a07e5a30528068f45ce8515a6890f1297df4c401af5dcb', - 'org.whispersystems:signal-service-android:b5449d6d74c16256591f675e599b1e588d13342ec8f52e2e598af0fa1e919259', + 'org.whispersystems:signal-service-android:c86041f97294f8ad701cdfe0c84e5558cdb856933753aaa4b8223b0fff25809f', 'com.h6ah4i.android.compat:mulsellistprefcompat:47167c5cb796de1a854788e9ff318358e36c8fb88123baaa6e38fb78511dfabe', 'com.google.zxing:core:b4d82452e7a6bf6ec2698904b332431717ed8f9a850224f295aec89de80f2259', 'cn.carbswang.android:NumberPickerView:18b3c316d62c7c277978a8d4ed57a5b8f4e943762264960f579a8a549c756729', @@ -143,11 +143,11 @@ dependencyVerification { 'javax.inject:javax.inject:91c77044a50c481636c32d916fd89c9118a72195390452c81065080f957de7ff', 'com.madgag.spongycastle:core:8d6240b974b0aca4d3da9c7dd44d42339d8a374358aca5fc98e50a995764511f', 'org.whispersystems:signal-protocol-android:1b4b9d557c8eaf861797ff683990d482d4aa8e9f23d9b17ff0cc67a02f38cb19', - 'org.whispersystems:signal-service-java:4a55341f3a340a59c541d06fb80638a770d7ba9c2eac727757bea42c0a341ec5', + 'org.whispersystems:signal-service-java:18ac4595da7ad24b4dae3d277ba0ab624440343490c164a0ed3cc00307388d8b', 'com.google.android.gms:play-services-basement:e1d29b21e02fd2a63e5a31807415cbb17a59568e27e3254181c01ffae10659bf', 'org.whispersystems:curve25519-android:bf6c34223d45d2f2813a8efcab9923caf99115115c760c9acea680bcb42d23c0', 'org.whispersystems:signal-protocol-java:a835cd0609cf116a74651bd0aa748db9392bba48c2d2af787757b8a1b50d131c', - 'com.googlecode.libphonenumber:libphonenumber:9625de9d2270e9a280ff4e6d9ef3106573fb4828773fd32c9b7614f4e17d2811', + 'com.googlecode.libphonenumber:libphonenumber:7214dc6dfc6243e34fb1a3e02ad15331bfff6ab902d679e3ba337695265c21ca', 'com.google.protobuf:protobuf-java:e0c1c64575c005601725e7c6a02cebf9e1285e888f756b2a1d73ffa8d725cc74', 'com.squareup.okhttp:okhttp:89b7f63e2e5b6c410266abc14f50fe52ea8d2d8a57260829e499b1cd9f0e61af', 'com.fasterxml.jackson.core:jackson-databind:835097bcdd11f5bc8a08378c70d4c8054dfa4b911691cc2752063c75534d198d', diff --git a/test/unitTest/java/org/thoughtcrime/securesms/util/PhoneNumberFormatterTest.java b/test/unitTest/java/org/thoughtcrime/securesms/util/PhoneNumberFormatterTest.java index 2260d3f6c9..469df3c6cd 100644 --- a/test/unitTest/java/org/thoughtcrime/securesms/util/PhoneNumberFormatterTest.java +++ b/test/unitTest/java/org/thoughtcrime/securesms/util/PhoneNumberFormatterTest.java @@ -38,24 +38,30 @@ public class PhoneNumberFormatterTest extends BaseUnitTest { @Test public void testFormatNumberE164() throws Exception, InvalidNumberException { - assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_UK, "(020) 7946 0018").equals(NUMBER_UK)); - assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_UK, "044 20 7946 0018").equals(NUMBER_UK)); - assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_UK, "+442079460018").equals(NUMBER_UK)); + assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_UK, "(020) 7946 0018")).isEqualTo(NUMBER_UK); +// assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_UK, "044 20 7946 0018")).isEqualTo(NUMBER_UK); + assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_UK, "+442079460018")).isEqualTo(NUMBER_UK); - assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_CH, "+41 44 668 18 00").equals(NUMBER_CH)); - assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_CH, "+41 (044) 6681800").equals(NUMBER_CH)); + assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_CH, "+41 44 668 18 00")).isEqualTo(NUMBER_CH); + assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_CH, "+41 (044) 6681800")).isEqualTo(NUMBER_CH); - assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_DE, "0049 030 123456").equals(NUMBER_DE)); - assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_DE, "0049 (0)30123456").equals(NUMBER_DE)); - assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_DE, "0049((0)30)123456").equals(NUMBER_DE)); - assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_DE, "+49 (0) 30 1 2 3 45 6 ").equals(NUMBER_DE)); - assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_DE, "030 123456").equals(NUMBER_DE)); + assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_DE, "0049 030 123456")).isEqualTo(NUMBER_DE); + assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_DE, "0049 (0)30123456")).isEqualTo(NUMBER_DE); + assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_DE, "0049((0)30)123456")).isEqualTo(NUMBER_DE); + assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_DE, "+49 (0) 30 1 2 3 45 6 ")).isEqualTo(NUMBER_DE); + assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_DE, "030 123456")).isEqualTo(NUMBER_DE); - assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_DE, "0171123456").equals(NUMBER_MOBILE_DE)); - assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_DE, "0171/123456").equals(NUMBER_MOBILE_DE)); - assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_DE, "+490171/123456").equals(NUMBER_MOBILE_DE)); - assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_DE, "00490171/123456").equals(NUMBER_MOBILE_DE)); - assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_DE, "0049171/123456").equals(NUMBER_MOBILE_DE)); + assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_DE, "0171123456")).isEqualTo(NUMBER_MOBILE_DE); + assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_DE, "0171/123456")).isEqualTo(NUMBER_MOBILE_DE); + assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_DE, "+490171/123456")).isEqualTo(NUMBER_MOBILE_DE); + assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_DE, "00490171/123456")).isEqualTo(NUMBER_MOBILE_DE); + assertThat(PhoneNumberFormatter.formatE164(COUNTRY_CODE_DE, "0049171/123456")).isEqualTo(NUMBER_MOBILE_DE); } + @Test + public void testFormatRemoteNumberE164() throws Exception, InvalidNumberException { + assertThat(PhoneNumberFormatter.formatNumber("+4402079460018", LOCAL_NUMBER_US)).isEqualTo(NUMBER_UK); + } + + }