diff --git a/js/background.js b/js/background.js index 69721932..8a487093 100644 --- a/js/background.js +++ b/js/background.js @@ -118,6 +118,9 @@ SERVER_URL, SERVER_PORTS, USERNAME, PASSWORD, ATTACHMENT_SERVER_URL ); if (firstRun === true && textsecure.storage.user.getDeviceId() != '1') { + if (!storage.get('theme-setting') && textsecure.storage.get('userAgent') === 'OWI') { + storage.put('theme-setting', 'ios'); + } var syncRequest = new textsecure.SyncRequest(textsecure.messaging, messageReceiver); syncRequest.addEventListener('success', function() { console.log('sync successful'); diff --git a/js/libtextsecure.js b/js/libtextsecure.js index 790eb645..10c649da 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -37941,7 +37941,8 @@ var TextSecureServer = (function() { provisionMessage.number, provisionMessage.provisioningCode, provisionMessage.identityKeyPair, - deviceName + deviceName, + provisionMessage.userAgent ); }); })); @@ -37965,7 +37966,7 @@ var TextSecureServer = (function() { } }.bind(this)); }, - createAccount: function(number, verificationCode, identityKeyPair, deviceName) { + createAccount: function(number, verificationCode, identityKeyPair, deviceName, userAgent) { var signalingKey = libsignal.crypto.getRandomBytes(32 + 20); var password = btoa(getString(libsignal.crypto.getRandomBytes(16))); password = password.substring(0, password.length - 2); @@ -37982,6 +37983,7 @@ var TextSecureServer = (function() { textsecure.storage.remove('number_id'); textsecure.storage.remove('device_name'); textsecure.storage.remove('regionCode'); + textsecure.storage.remove('userAgent'); // update our own identity key, which may have changed // if we're relinking after a reinstall on the master device @@ -37994,6 +37996,9 @@ var TextSecureServer = (function() { textsecure.storage.put('signaling_key', signalingKey); textsecure.storage.put('password', password); textsecure.storage.put('registrationId', registrationId); + if (userAgent) { + textsecure.storage.put('userAgent', userAgent); + } textsecure.storage.user.setNumberAndDeviceId(number, response.deviceId || 1, deviceName); textsecure.storage.put('regionCode', libphonenumber.util.getRegionCodeForNumber(number)); @@ -39404,7 +39409,8 @@ ProvisioningCipher.prototype = { return { identityKeyPair : keyPair, number : provisionMessage.number, - provisioningCode : provisionMessage.provisioningCode + provisioningCode : provisionMessage.provisioningCode, + userAgent : provisionMessage.userAgent }; }); }); diff --git a/libtextsecure/ProvisioningCipher.js b/libtextsecure/ProvisioningCipher.js index ecee4e2a..3104189d 100644 --- a/libtextsecure/ProvisioningCipher.js +++ b/libtextsecure/ProvisioningCipher.js @@ -34,7 +34,8 @@ ProvisioningCipher.prototype = { return { identityKeyPair : keyPair, number : provisionMessage.number, - provisioningCode : provisionMessage.provisioningCode + provisioningCode : provisionMessage.provisioningCode, + userAgent : provisionMessage.userAgent }; }); }); diff --git a/libtextsecure/account_manager.js b/libtextsecure/account_manager.js index 3bd641e9..91b7068d 100644 --- a/libtextsecure/account_manager.js +++ b/libtextsecure/account_manager.js @@ -66,7 +66,8 @@ provisionMessage.number, provisionMessage.provisioningCode, provisionMessage.identityKeyPair, - deviceName + deviceName, + provisionMessage.userAgent ); }); })); @@ -90,7 +91,7 @@ } }.bind(this)); }, - createAccount: function(number, verificationCode, identityKeyPair, deviceName) { + createAccount: function(number, verificationCode, identityKeyPair, deviceName, userAgent) { var signalingKey = libsignal.crypto.getRandomBytes(32 + 20); var password = btoa(getString(libsignal.crypto.getRandomBytes(16))); password = password.substring(0, password.length - 2); @@ -107,6 +108,7 @@ textsecure.storage.remove('number_id'); textsecure.storage.remove('device_name'); textsecure.storage.remove('regionCode'); + textsecure.storage.remove('userAgent'); // update our own identity key, which may have changed // if we're relinking after a reinstall on the master device @@ -119,6 +121,9 @@ textsecure.storage.put('signaling_key', signalingKey); textsecure.storage.put('password', password); textsecure.storage.put('registrationId', registrationId); + if (userAgent) { + textsecure.storage.put('userAgent', userAgent); + } textsecure.storage.user.setNumberAndDeviceId(number, response.deviceId || 1, deviceName); textsecure.storage.put('regionCode', libphonenumber.util.getRegionCodeForNumber(number)); diff --git a/protos/DeviceMessages.proto b/protos/DeviceMessages.proto index 77717dd6..18721736 100644 --- a/protos/DeviceMessages.proto +++ b/protos/DeviceMessages.proto @@ -14,4 +14,5 @@ message ProvisionMessage { optional bytes identityKeyPrivate = 2; optional string number = 3; optional string provisioningCode = 4; + optional string userAgent = 5; }