Skip to content

Commit

Permalink
WhisperPush: Add all possible variants of WP registration number.
Browse files Browse the repository at this point in the history
  Some networks will show incoming sms as properly formatted, other
  networks (mainly Verizon) will trim the leading country code (1).

Change-Id: I99613d760325b35bf5a531ffff00e692c59d3b6d
  • Loading branch information
Adnan committed Dec 18, 2014
1 parent 111512a commit b4ce89b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion res/values/config.xml
Expand Up @@ -17,5 +17,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="default_registration_number">12064893444</string>
<string-array name="default_registration_numbers">
<item>+12064893444</item>
<item>12064893444</item>
<item>2064893444</item>
</string-array>
</resources>
Expand Up @@ -45,6 +45,7 @@
import org.whispersystems.whisperpush.WhisperPush;

import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService;
Expand Down Expand Up @@ -100,7 +101,12 @@ public void onCreate() {
// Add registration number to whitelist
TelephonyManager tm =
(TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
tm.addProtectedSmsAddress(getString(R.string.default_registration_number));

List<String> regNumbers = Arrays
.asList(getResources().getStringArray(R.array.default_registration_numbers));
for (String number : regNumbers) {
tm.addProtectedSmsAddress(number);
}

registrationStateNotifier = new RegistrationStateNotifier(this);
registrationTimerHandler = new RegistrationTimerHandler();
Expand Down

0 comments on commit b4ce89b

Please sign in to comment.