Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove nft gallery and old token details #5016

Merged
merged 25 commits into from
Mar 6, 2024
Merged

chore: remove nft gallery and old token details #5016

merged 25 commits into from
Mar 6, 2024

Conversation

MuckT
Copy link
Collaborator

@MuckT MuckT commented Feb 29, 2024

Description

Cleanup of old Nft Gallery feature now handled in Assets and of the old token balances screen also now handled in assets. Additionally the following feature flags which have been rolled out to 100% were removed: show_in_app_nft_gallery, show_in_app_nft_viewer, view_nft_home_assets and show_asset_details_screen.

Test plan

  • Tested locally on iOS
  • E2E tests passing

Related issues

Backwards compatibility

Yes

Network scalability

Yes

}

return (
<View style={styles.container} testID="FiatExchangeTokenBalance">
<View style={styles.titleExchange}>
<View style={styles.row}>
{tokenBalances.length > 1 ? (
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This behavior was updated because the tests were coupled together. Now the behavior of the home token balances and the fiat exchange token balances matches.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be updated? Seems like the original intent is to not make it a touchable because there's only one token and there's no need for the user to go to the assets screen to view the breakdown
image
If we want to change this behavior, I'd do this in a separate PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behavior is different when show_asset_details_screen was set to true which is 100%. If we want to keep the behavior of the existing FiatExchangeTokenBalance some tests will need to be updated. Due to the coupled testing it was unclear if we ever expected these two components to diverge in behavior like they have.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the FiatExchangeTokenBalance behavior has always been different from the HomeTokenBalance behavior.
FiatExchangeTokenBalance shows the ViewBalances touchable if num tokens > 1 both before and after the asset details change. HomeTokenBalance before asset details only included the ViewBalances touchable if num tokens >= 1 and after asset details, it is always included (since we also show tokens with zero balance in the assets screen).

I think we had coupled tests prior just because the case for 0 tokens overlapped. Can't we just drop the it.each and just keep the test for FiatExchangeTokenBalance and keep this test for HomeTokenBalance and just remove the feature gate in the name and mocks? No new tests need to be added as part of this change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 62c8ea5 and tests updated in 99c38dc!

.mockImplementation(
(featureGate) => featureGate !== StatsigFeatureGates.SHOW_ASSET_DETAILS_SCREEN
)
jest.mocked(getFeatureGate).mockImplementation(() => true)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is controlling multiple features flags. Open to other options on how to handle this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the TokenBalance.tsx only references SHOW_HIDE_HOME_BALANCES_TOGGLE gate now that the SHOW_ASSET_DETAILS_SCREEN gate is removed?
Could change this and all below references to this (and just update true / false appropriately)

Suggested change
jest.mocked(getFeatureGate).mockImplementation(() => true)
jest.mocked(getFeatureGate).mockReturnValue(true)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 6fb2c1d!

@MuckT MuckT marked this pull request as ready for review March 1, 2024 21:17
Copy link

emerge-tools bot commented Mar 1, 2024

1 build decreased size

Name Version Download Change Install Change Approval
Celo (test)
org.celo.mobile.test
1.79.0 (144) 24.2 MB ⬇️ 2.6 kB (-0.01%) 60.3 MB ⬇️ 12.3 kB (-0.02%) N/A

Celo (test) 1.79.0 (144)
org.celo.mobile.test

⚖️ Compare build
📦 Install build
⏱️ Analyze build performance

Total install size change: ⬇️ 12.3 kB (-0.02%)
Total download size change: ⬇️ 2.6 kB (-0.01%)

Largest size changes

Item Install Size Change
main.jsbundle ⬇️ -12.3 kB

🛸 Powered by Emerge Tools

Copy link

codecov bot commented Mar 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.46%. Comparing base (363f7f6) to head (0459fa9).
Report is 8 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5016      +/-   ##
==========================================
- Coverage   85.48%   85.46%   -0.03%     
==========================================
  Files         723      719       -4     
  Lines       29437    29199     -238     
  Branches     5099     5038      -61     
==========================================
- Hits        25165    24955     -210     
+ Misses       4037     4014      -23     
+ Partials      235      230       -5     
Files Coverage Δ
src/analytics/Events.tsx 100.00% <ø> (ø)
src/analytics/Properties.tsx 100.00% <ø> (ø)
src/components/TokenBalance.tsx 97.88% <100.00%> (-0.16%) ⬇️
src/navigator/DrawerNavigator.tsx 93.79% <ø> (+1.15%) ⬆️
src/navigator/Screens.tsx 100.00% <ø> (ø)
src/nfts/saga.ts 91.30% <ø> (-0.48%) ⬇️
src/nfts/types.ts 100.00% <ø> (ø)
src/statsig/constants.ts 100.00% <ø> (ø)
src/statsig/types.ts 100.00% <ø> (ø)
src/transactions/feed/NftFeedItem.tsx 88.23% <100.00%> (-7.12%) ⬇️

... and 7 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 363f7f6...0459fa9. Read the comment docs.

.mockImplementation(
(featureGate) => featureGate !== StatsigFeatureGates.SHOW_ASSET_DETAILS_SCREEN
)
jest.mocked(getFeatureGate).mockImplementation(() => true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the TokenBalance.tsx only references SHOW_HIDE_HOME_BALANCES_TOGGLE gate now that the SHOW_ASSET_DETAILS_SCREEN gate is removed?
Could change this and all below references to this (and just update true / false appropriately)

Suggested change
jest.mocked(getFeatureGate).mockImplementation(() => true)
jest.mocked(getFeatureGate).mockReturnValue(true)

}

return (
<View style={styles.container} testID="FiatExchangeTokenBalance">
<View style={styles.titleExchange}>
<View style={styles.row}>
{tokenBalances.length > 1 ? (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be updated? Seems like the original intent is to not make it a touchable because there's only one token and there's no need for the user to go to the assets screen to view the breakdown
image
If we want to change this behavior, I'd do this in a separate PR.

src/navigator/Screens.tsx Show resolved Hide resolved
)

it.each([HomeTokenBalance, FiatExchangeTokenBalance])(
it.each([HomeTokenBalance])(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this applies to only home token balance, can we move this to its own
describe section? This would also allow us to change the it.each to a
describe.each so we don't end up adding tests in this section that
only applies to one of them?

Copy link
Collaborator Author

@MuckT MuckT Mar 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 047325d!

describe('FiatExchangeTokenBalance', () => {
beforeEach(() => {
jest.clearAllMocks()
jest.mocked(getFeatureGate).mockReturnValue(true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this required? this component doesn't use a feature gate right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This started failing when I removed the feature gate.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, looks like this is needed for positions to be included. I think we also need this for the describe('FiatExchangeTokenBalance and HomeTokenBalance') section too. I think they currently pass from a stray mock from another describe. We should add that back, because I think running them standalone would fail

Copy link
Contributor

@satish-ravi satish-ravi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A once getFeatureGate mock is added

describe('FiatExchangeTokenBalance', () => {
beforeEach(() => {
jest.clearAllMocks()
jest.mocked(getFeatureGate).mockReturnValue(true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, looks like this is needed for positions to be included. I think we also need this for the describe('FiatExchangeTokenBalance and HomeTokenBalance') section too. I think they currently pass from a stray mock from another describe. We should add that back, because I think running them standalone would fail

@@ -737,6 +419,262 @@ describe('FiatExchangeTokenBalance and HomeTokenBalance', () => {
})
})

describe('FiatExchangeTokenBalance and HomeTokenBalance', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we just do a describe.each and drop the it.each everywhere else?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 0459fa9!

@MuckT MuckT enabled auto-merge March 6, 2024 19:21
@MuckT MuckT added this pull request to the merge queue Mar 6, 2024
Merged via the queue into main with commit 4df1078 Mar 6, 2024
16 checks passed
@MuckT MuckT deleted the tomm/act-1074 branch March 6, 2024 20:00
shottah pushed a commit to zed-io/kolektivo that referenced this pull request May 15, 2024
### Description

Cleanup of old Nft Gallery feature now handled in Assets and of the old
token balances screen also now handled in assets. Additionally the
following feature flags which have been rolled out to 100% were removed:
`show_in_app_nft_gallery`, `show_in_app_nft_viewer`,
`view_nft_home_assets` and `show_asset_details_screen`.

### Test plan

- Tested locally on iOS
- E2E tests passing

### Related issues

- Fixes ACT-1074

### Backwards compatibility

Yes

### Network scalability

Yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants