JSONObject in = new JSONObject(IOUtils.toString(new FileInputStream(getFileName())));
username = in.getString("username");
password = in.getString("password");
- signalingKey = in.getString("signalingKey");
+ if (in.has("signalingKey")) {
+ signalingKey = in.getString("signalingKey");
+ }
axolotlStore = new JsonAxolotlStore(in.getJSONObject("axolotlStore"));
registered = in.getBoolean("registered");
accountManager = new TextSecureAccountManager(URL, TRUST_STORE, username, password);
return registered;
}
- public void register() throws IOException {
+ public void register(boolean voiceVerication) throws IOException {
password = Util.getSecret(18);
accountManager = new TextSecureAccountManager(URL, TRUST_STORE, username, password);
- accountManager.requestSmsVerificationCode();
+ if (voiceVerication)
+ accountManager.requestVoiceVerificationCode();
+ else
+ accountManager.requestSmsVerificationCode();
+
registered = false;
}