From 836329b500bf93452ccbe44f659ff31c671d613e Mon Sep 17 00:00:00 2001 From: woudini Date: Fri, 4 Aug 2017 10:29:39 -0400 Subject: [PATCH] Revert "feat(Contacts): expose uuid function for iOS to override" This reverts commit e0d4ecf6ae02e1661dafa932825b77d1c348f7a2. --- src/contact.js | 4 +++- src/contacts.js | 12 ++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/contact.js b/src/contact.js index e819286c2..b112e8f0d 100644 --- a/src/contact.js +++ b/src/contact.js @@ -6,6 +6,7 @@ const Metadata = require('./metadata'); const assoc = require('ramda/src/assoc'); const prop = require('ramda/src/prop'); const map = require('ramda/src/map'); +const uuid = require('uuid'); const FacilitatedTx = require('./facilitatedTx'); class Contact { @@ -28,7 +29,8 @@ Contact.factory = function (o) { return new Contact(o); }; -Contact.new = function (o, id) { +Contact.new = function (o) { + const id = uuid(); const namedContact = assoc('id', id, o); return new Contact(namedContact); }; diff --git a/src/contacts.js b/src/contacts.js index d71d2b6b8..36f32fefa 100644 --- a/src/contacts.js +++ b/src/contacts.js @@ -50,15 +50,11 @@ Contacts.prototype.wipe = function () { }; Contacts.prototype.new = function (object) { - const c = Contact.new(object, this.uuid()); + const c = Contact.new(object); this.list = R.assoc(c.id, c, this.list); return c; }; -Contacts.prototype.uuid = function() { - return uuid(); -} - const fromNull = (str) => str || ''; const isContact = (uniqueId) => R.where({id: R.equals(uniqueId)}); const contains = R.curry((substr, key) => R.where(R.objOf(key, R.compose(R.contains(substr), fromNull)))); @@ -221,7 +217,7 @@ const cancelResponse = function (id) { // I want you to pay me Contacts.prototype.sendPR = function (userId, intendedAmount, id, note, initiatorSource) { // we should reserve the address (check buy-sell) - should probable be an argument - id = id ? id : this.uuid() + id = id ? id : uuid() const contact = this.get(userId); const account = initiatorSource != null ? MyWallet.wallet.hdwallet.accounts[initiatorSource] : MyWallet.wallet.hdwallet.defaultAccount; const address = account.receiveAddress; @@ -239,7 +235,7 @@ Contacts.prototype.sendPR = function (userId, intendedAmount, id, note, initiato // request payment request (step-1) Contacts.prototype.sendRPR = function (userId, intendedAmount, id, note) { - id = id ? id : this.uuid() + id = id ? id : uuid() const message = requestPaymentRequest(intendedAmount, id, note); const contact = this.get(userId); return this.sendMessage(userId, REQUEST_PAYMENT_REQUEST_TYPE, message) @@ -249,7 +245,7 @@ Contacts.prototype.sendRPR = function (userId, intendedAmount, id, note) { // payment request response Contacts.prototype.sendPRR = function (userId, txHash, id) { - id = id ? id : this.uuid() + id = id ? id : uuid() const message = paymentRequestResponse(id, txHash); const contact = this.get(userId); return this.sendMessage(userId, PAYMENT_REQUEST_RESPONSE_TYPE, message)