Set theme based on master device userAgent
// FREEBIE
This commit is contained in:
parent
2fec5ee867
commit
b1afb79a14
5 changed files with 22 additions and 6 deletions
|
@ -118,6 +118,9 @@
|
||||||
SERVER_URL, SERVER_PORTS, USERNAME, PASSWORD, ATTACHMENT_SERVER_URL
|
SERVER_URL, SERVER_PORTS, USERNAME, PASSWORD, ATTACHMENT_SERVER_URL
|
||||||
);
|
);
|
||||||
if (firstRun === true && textsecure.storage.user.getDeviceId() != '1') {
|
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);
|
var syncRequest = new textsecure.SyncRequest(textsecure.messaging, messageReceiver);
|
||||||
syncRequest.addEventListener('success', function() {
|
syncRequest.addEventListener('success', function() {
|
||||||
console.log('sync successful');
|
console.log('sync successful');
|
||||||
|
|
|
@ -37941,7 +37941,8 @@ var TextSecureServer = (function() {
|
||||||
provisionMessage.number,
|
provisionMessage.number,
|
||||||
provisionMessage.provisioningCode,
|
provisionMessage.provisioningCode,
|
||||||
provisionMessage.identityKeyPair,
|
provisionMessage.identityKeyPair,
|
||||||
deviceName
|
deviceName,
|
||||||
|
provisionMessage.userAgent
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
@ -37965,7 +37966,7 @@ var TextSecureServer = (function() {
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
},
|
},
|
||||||
createAccount: function(number, verificationCode, identityKeyPair, deviceName) {
|
createAccount: function(number, verificationCode, identityKeyPair, deviceName, userAgent) {
|
||||||
var signalingKey = libsignal.crypto.getRandomBytes(32 + 20);
|
var signalingKey = libsignal.crypto.getRandomBytes(32 + 20);
|
||||||
var password = btoa(getString(libsignal.crypto.getRandomBytes(16)));
|
var password = btoa(getString(libsignal.crypto.getRandomBytes(16)));
|
||||||
password = password.substring(0, password.length - 2);
|
password = password.substring(0, password.length - 2);
|
||||||
|
@ -37982,6 +37983,7 @@ var TextSecureServer = (function() {
|
||||||
textsecure.storage.remove('number_id');
|
textsecure.storage.remove('number_id');
|
||||||
textsecure.storage.remove('device_name');
|
textsecure.storage.remove('device_name');
|
||||||
textsecure.storage.remove('regionCode');
|
textsecure.storage.remove('regionCode');
|
||||||
|
textsecure.storage.remove('userAgent');
|
||||||
|
|
||||||
// update our own identity key, which may have changed
|
// update our own identity key, which may have changed
|
||||||
// if we're relinking after a reinstall on the master device
|
// 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('signaling_key', signalingKey);
|
||||||
textsecure.storage.put('password', password);
|
textsecure.storage.put('password', password);
|
||||||
textsecure.storage.put('registrationId', registrationId);
|
textsecure.storage.put('registrationId', registrationId);
|
||||||
|
if (userAgent) {
|
||||||
|
textsecure.storage.put('userAgent', userAgent);
|
||||||
|
}
|
||||||
|
|
||||||
textsecure.storage.user.setNumberAndDeviceId(number, response.deviceId || 1, deviceName);
|
textsecure.storage.user.setNumberAndDeviceId(number, response.deviceId || 1, deviceName);
|
||||||
textsecure.storage.put('regionCode', libphonenumber.util.getRegionCodeForNumber(number));
|
textsecure.storage.put('regionCode', libphonenumber.util.getRegionCodeForNumber(number));
|
||||||
|
@ -39404,7 +39409,8 @@ ProvisioningCipher.prototype = {
|
||||||
return {
|
return {
|
||||||
identityKeyPair : keyPair,
|
identityKeyPair : keyPair,
|
||||||
number : provisionMessage.number,
|
number : provisionMessage.number,
|
||||||
provisioningCode : provisionMessage.provisioningCode
|
provisioningCode : provisionMessage.provisioningCode,
|
||||||
|
userAgent : provisionMessage.userAgent
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -34,7 +34,8 @@ ProvisioningCipher.prototype = {
|
||||||
return {
|
return {
|
||||||
identityKeyPair : keyPair,
|
identityKeyPair : keyPair,
|
||||||
number : provisionMessage.number,
|
number : provisionMessage.number,
|
||||||
provisioningCode : provisionMessage.provisioningCode
|
provisioningCode : provisionMessage.provisioningCode,
|
||||||
|
userAgent : provisionMessage.userAgent
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -66,7 +66,8 @@
|
||||||
provisionMessage.number,
|
provisionMessage.number,
|
||||||
provisionMessage.provisioningCode,
|
provisionMessage.provisioningCode,
|
||||||
provisionMessage.identityKeyPair,
|
provisionMessage.identityKeyPair,
|
||||||
deviceName
|
deviceName,
|
||||||
|
provisionMessage.userAgent
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
@ -90,7 +91,7 @@
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
},
|
},
|
||||||
createAccount: function(number, verificationCode, identityKeyPair, deviceName) {
|
createAccount: function(number, verificationCode, identityKeyPair, deviceName, userAgent) {
|
||||||
var signalingKey = libsignal.crypto.getRandomBytes(32 + 20);
|
var signalingKey = libsignal.crypto.getRandomBytes(32 + 20);
|
||||||
var password = btoa(getString(libsignal.crypto.getRandomBytes(16)));
|
var password = btoa(getString(libsignal.crypto.getRandomBytes(16)));
|
||||||
password = password.substring(0, password.length - 2);
|
password = password.substring(0, password.length - 2);
|
||||||
|
@ -107,6 +108,7 @@
|
||||||
textsecure.storage.remove('number_id');
|
textsecure.storage.remove('number_id');
|
||||||
textsecure.storage.remove('device_name');
|
textsecure.storage.remove('device_name');
|
||||||
textsecure.storage.remove('regionCode');
|
textsecure.storage.remove('regionCode');
|
||||||
|
textsecure.storage.remove('userAgent');
|
||||||
|
|
||||||
// update our own identity key, which may have changed
|
// update our own identity key, which may have changed
|
||||||
// if we're relinking after a reinstall on the master device
|
// if we're relinking after a reinstall on the master device
|
||||||
|
@ -119,6 +121,9 @@
|
||||||
textsecure.storage.put('signaling_key', signalingKey);
|
textsecure.storage.put('signaling_key', signalingKey);
|
||||||
textsecure.storage.put('password', password);
|
textsecure.storage.put('password', password);
|
||||||
textsecure.storage.put('registrationId', registrationId);
|
textsecure.storage.put('registrationId', registrationId);
|
||||||
|
if (userAgent) {
|
||||||
|
textsecure.storage.put('userAgent', userAgent);
|
||||||
|
}
|
||||||
|
|
||||||
textsecure.storage.user.setNumberAndDeviceId(number, response.deviceId || 1, deviceName);
|
textsecure.storage.user.setNumberAndDeviceId(number, response.deviceId || 1, deviceName);
|
||||||
textsecure.storage.put('regionCode', libphonenumber.util.getRegionCodeForNumber(number));
|
textsecure.storage.put('regionCode', libphonenumber.util.getRegionCodeForNumber(number));
|
||||||
|
|
|
@ -14,4 +14,5 @@ message ProvisionMessage {
|
||||||
optional bytes identityKeyPrivate = 2;
|
optional bytes identityKeyPrivate = 2;
|
||||||
optional string number = 3;
|
optional string number = 3;
|
||||||
optional string provisioningCode = 4;
|
optional string provisioningCode = 4;
|
||||||
|
optional string userAgent = 5;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue