-
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 invitee from contact list in home feed, rather than "unknown" #2265
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2265 +/- ##
==========================================
+ Coverage 77.70% 77.75% +0.04%
==========================================
Files 588 588
Lines 21452 21484 +32
Branches 3944 3953 +9
==========================================
+ Hits 16670 16705 +35
+ Misses 4717 4714 -3
Partials 65 65
Continue to review full report at Codecov.
|
@@ -44,7 +44,6 @@ export const recipientsReducer = createReducer(initialState, (builder) => { | |||
...initialState, | |||
...state, | |||
...hydrated, | |||
phoneRecipientCache: initialState.phoneRecipientCache, |
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 was causing the cache to be lost after every app restart which is undesirable for a cache i think...
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.
ah yes the reason is partially in this comment in #37:
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
Now I guess it broke further because we're not anymore importing contacts during app init.
This change seems good then 👍
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.
Awesome work! 💯
This regression had been bothering me for a while. Great to see it fixed!!
@@ -44,7 +44,6 @@ export const recipientsReducer = createReducer(initialState, (builder) => { | |||
...initialState, | |||
...state, | |||
...hydrated, | |||
phoneRecipientCache: initialState.phoneRecipientCache, |
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.
ah yes the reason is partially in this comment in #37:
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
Now I guess it broke further because we're not anymore importing contacts during app init.
This change seems good then 👍
expectDisplay({ | ||
getByTestId, | ||
expectedTitleSections: [ | ||
`feedItemEscrowSentTitle, {"context":null,"nameOrNumber":"${contactName}"}`, |
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.
nit: it's better to have hardcoded expectations to minimize room for errors:
`feedItemEscrowSentTitle, {"context":null,"nameOrNumber":"${contactName}"}`, | |
`feedItemEscrowSentTitle, {"context":null,"nameOrNumber":"Kate Bell"}`, |
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.
fair enough, I updated!
@@ -220,6 +282,7 @@ function* addRecipientProfiles({ transactions }: NewTransactionsInFeedAction) { | |||
function* watchNewFeedTransactions() { | |||
yield takeEvery(Actions.NEW_TRANSACTIONS_IN_FEED, cleanupStandbyTransactionsLegacy) | |||
yield takeEvery(Actions.UPDATE_TRANSACTIONS, cleanupStandbyTransactions) | |||
yield takeLatest(Actions.UPDATE_TRANSACTIONS, getInviteTransactionsDetails) |
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.
Why not takeEvery
?
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.
hum good question...i was thinking that there shouldn't be multiple UPDATE_TRANSACTIONS actions dispatched in quick succession/in parallel, and if there are then the most recent action would contain the information from previous actions (e.g. the transactions fetched at 10:01am would contain the same transactions fetched at 10:00am) so it's safe to take only the latest action...
but now as i am typing this, i remember that we have paginated transaction feed coming soon so maybe it is safer to do takeEvery after all...
!existingInviteTransactions[transaction.transactionHash] | ||
) | ||
|
||
if (newInviteTransactions.length > 0) { |
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.
nit: it's nice to return early to avoid extra indentation.
if (newInviteTransactions.length > 0) { | |
if (newInviteTransactions.length <= 0) { return: } |
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.
that's true, updated
@@ -82,6 +88,62 @@ function* cleanupStandbyTransactions({ transactions }: UpdateTransactionsAction) | |||
} | |||
} | |||
|
|||
function* getInviteTransactionDetails(txHash: string, blockNumber: 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.
Nothing to do now, but it seems it could be nice if blockchain-api would get this information for the client directly, right?
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 i also was thinking about this...but would we then need to query the escrow contract a lot more often? with this client side approach, we only need to query the escrow contract once per invite and we can store the invite details locally for display the next time. but if we want this to be returned in the transaction feed query, would the BE have to fetch this information every time because the api is stateless? maybe @gnardini you have some thoughts on this
…#2265) Currently the transaction item for an invite sent displays as from "Unknown" because the transaction is going to the escrow contract address instead of a known contact address. In this PR: - add redux variable to track invitation transaction details. due to the transaction feed being updated regularly, it is nice to keep this persisted redux variable separately so that we don't need to refresh the invite details - if the transaction feed item is a sent invite, get the recipient info from the escrow contract - when displaying the transaction feed item, use the fetched recipient details from the escrow contract <img width="437" alt="Screenshot 2022-03-29 at 16 24 51" src="https://user-images.githubusercontent.com/20150449/160633963-a8206771-32e6-47b4-865b-d3afb36775cb.png"> Note: we still rely on the contacts cache to display the invitee name, this cache is only refreshed when the user accesses their contacts (e.g. when on the send screen) - this means the invitee will still display as "Unknown" if the user has reinstalled the app/has not accessed their contacts list yet. N/A Manually, unit tests to come Send an invitation, then observe the transaction item on the home feed should display the correct invitee name for the transaction - Fixes #2215 Yes
Hey @MuckT, We have verified above task on Latest Android Internal Release build & Latest Test Flight Release build V1.30.1 and updated status in test rails. Observation:
Test rail link: CC: @kathaypacific Thanks..!! |
Hey @MuckT, We have verified above task on Latest Test Flight Release build V1.30.1, Android Internal Release Build V1.30.1 and updated status in test rails.
Test rail link: Devices: iPhone 12(14.7.1), Redmi Note 5 Pro (9.0) CC: @kathaypacific |
Description
Currently the transaction item for an invite sent displays as from "Unknown" because the transaction is going to the escrow contract address instead of a known contact address.
In this PR:
Note: we still rely on the contacts cache to display the invitee name, this cache is only refreshed when the user accesses their contacts (e.g. when on the send screen) - this means the invitee will still display as "Unknown" if the user has reinstalled the app/has not accessed their contacts list yet.
Other changes
N/A
Tested
Manually, unit tests to come
How others should test
Send an invitation, then observe the transaction item on the home feed should display the correct invitee name for the transaction
Related issues
Backwards compatibility
Yes