Merging profiles.
This commit is contained in:
parent
3aa9bef803
commit
adf7115c9c
1 changed files with 16 additions and 1 deletions
|
|
@ -67,7 +67,22 @@ Profile.prototype.isDeviceChecked = function(ua) {
|
|||
* @param {Profile} other
|
||||
*/
|
||||
Profile.prototype.merge = function(other) {
|
||||
throw 'Profile merge not implemented.';
|
||||
|
||||
var newCredentials = [];
|
||||
|
||||
other.credentials.forEach(function(otherCredential) {
|
||||
var credentialExists = false;
|
||||
this.credentials.forEach(function(thisCredential) {
|
||||
if (otherCredential.walletId === thisCredential.walletId) {
|
||||
credentialExists = true;
|
||||
}
|
||||
});
|
||||
if (!credentialExists) {
|
||||
newCredentials.push(otherCredential);
|
||||
}
|
||||
});
|
||||
|
||||
Array.prototype.push.apply(this.credentials, newCredentials);
|
||||
};
|
||||
|
||||
Profile.prototype.setChecked = function(ua, walletId) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue