-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Display CIP8 profile info in Transaction Feed #37
Conversation
7e46eb3
to
9b752fc
Compare
64bafd3
to
6ba7a7f
Compare
…rg/wallet into isabellewei/displayTransactionProfiles
…rg/wallet into isabellewei/displayTransactionProfiles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really excited for this changes to land 🙌
I tried building to see this in action but got some errors:
- When running
yarn build:wallet
from the repo root I get a bunch of errors and it gets stuck there. - After that, I install the ios pods manually but when I run
yarn dev:ios
or try to install from XCode I get the following errors:/Users/repoDirectory/wallet/node_modules/react-native-geth/ios/RNGeth.swift:462:39: Value of type 'GethKeyStore' has no member 'computeECDHSharedSecret'
/Users/repoDirectory/wallet/node_modules/react-native-geth/ios/RNGeth.swift:486:37: Value of type 'GethKeyStore' has no member 'decrypt'
Do you know what may be the cause or how to fix it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow this is looking great! 👍
Thanks for the big effort on this.
And I'm so glad we are using TypeScript 😄
// TODO: decide what recipient info to collect, now that RecipientKind doesn't exist | ||
usedSearchBar: boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
export function getE164Number(e164Number?: string, recipient?: Recipient) { | ||
return e164Number || (recipient && recipient.e164PhoneNumber) | ||
export function getE164Number(recipient: Recipient, e164Number?: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the outside, the ordering of the parameters seems to indicate the recipient number would be used first.
But the implementation does the opposite.
Can we keep the existing ordering?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The order of the parameters has to be recipient first, because it's a required parameter. I flipped the OR statement instead
@@ -52,9 +38,8 @@ function ContactCircle({ contact, size, thumbnailPath, name, address, style }: P | |||
} | |||
|
|||
const fontColor = getAddressForegroundColor(address || '0x0') | |||
// Mobile # is what default display name when contact isn't saved | |||
if (displayName && displayName !== 'Mobile #') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this case still handled somewhere else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah! This is just checking that we don't have an actual name for the recipient, because the name field used to be mandatory and we would save display info in the name variable. Now we can directly check if the name variable exists or not
const nameA = a.name!.toUpperCase() | ||
const nameB = b.name!.toUpperCase() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any way to avoid the !
?
packages/mobile/src/paymentRequest/IncomingPaymentRequestListItem.tsx
Outdated
Show resolved
Hide resolved
…P8valoraIntegration
…rg/wallet into isabellewei/displayTransactionProfiles
Added the |
No currently you can still only look up the recipient from their address |
…rg/wallet into isabellewei/displayTransactionProfiles
…splayTransactionProfiles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work on this!
There is one more issue which is that when a user creates an account if they don't verify their phone number they don't have any funds so they can't register their DEK and therefore a user sending them money won't be able to give them access.
There's no perfect way around this I think but I guess it's just something to keep in mind.
@@ -272,7 +272,8 @@ export interface TransferItemFragment { | |||
type: TokenTransactionType | |||
hash: string | |||
timestamp: number | |||
address: string | |||
address: string // wallet address (EOA) | |||
account: string // account address (MTW) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This naming from the blockchain-api
is really confusing 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha definitely, hopefully these comments help
name?: string | ||
contactId?: string // unique ID given by phone OS | ||
thumbnailPath?: string | ||
displayNumber?: string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we also add to the inner recipient
e164PhoneNumber?: string
address?: string
It will allow us to query using recipient.address
or recipient. e164PhoneNumber
and will still require one of address
and e164PhoneNumber
to be present.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh this is a great solution, thanks!
function* addProfile(transaction: TransferItemFragment) { | ||
const address = transaction.account | ||
const newProfile: AddressToRecipient = {} | ||
if (transaction.type === TokenTransactionType.Received) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have many incoming transactions from the same address we will fetch their profile info many times. Something we could do is to add a timestamp to the recipient with the date that the data was last refreshed and only read again of more than X time has passed (an hour? a day?)
What do you think? Also, do you think it makes sense to do it in this PR or create a new issue for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filed an issue! :) #300
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing job with this!
Hey @isabellewei I have verified this issue using latest released Android internal build V1.14.0 (1004294350) & Test Flight build V1.14.0(58) & observed following:
Verified On Devices: iPhone SE (14.2), Redmi Note 8 (9.0) Can you please take a look & let us know if unchecked points are expected or we need to raise tickets for same ? |
migrated from celo-org/celo-monorepo#6605
Description
This PR includes a refactor of how we handle recipients. When handling recipient info, the paradigm is to put all information into a Recipient object which is passed between components/functions. This parameter is made mandatory, instead of individually passing address/number/name/thumbnail variables individually.
When a user sends a transaction, it uploads symmetric keys which grants the recipient permission to access their profile information. When the recipient receives the transaction, it downloads and decrypts this profile info, saving it in redux.
Transactions in the feed displays CIP8 profile information if it is available for the recipient. This PR does not handle contact list and send flow UI.
Other/Drive-by Changes
Removed recipients from the persist blacklist, because I want to persist valoraRecipientsCache. Previously the only variable in the recipients reducer was the recipientCache (renamed to phoneRecipientCache ), which I guess was blacklisted because we reconstruct it at the start of each app session. Not sure what the impact of this is
Tested
Sending transactions between Android device and iOS emulator
Related issues
Fixes #18 partially