-
Notifications
You must be signed in to change notification settings - Fork 9
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
[ABW-3254] Account resources background refresh #1194
[ABW-3254] Account resources background refresh #1194
Conversation
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.
Looking great! one small comment only on the code.
One thing I had discussed with @kugel3 in the past is that we have many reducers that could probably be removed. For example, each of the children displayed on the AssetsView
(FungibleAssetList
, NonFungibleAssetList
, StakeUnitList
& PoolUnitsList
) have its own reducer and state, and in 3 of these cases they are just about displaying data and calling delegate when selected.
The reason I am bringing this up is because now that we want to perform updates on the parent (AssetsView
), it makes even less sense to have the children with their state allowing a mutating func from given class. It would make more sense in my opinion to just handle the updates in one place.
|
||
private func scheduleFetchAccountPortfolioTimer(_ state: State) -> Effect<Action> { | ||
.run { [address = state.account.address] _ in | ||
await withTaskCancellation(id: CancellableId.fetchAccountPortfolio, cancelInFlight: true) { |
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 there any difference between this withTaskCancellation
and adding .cancellable(id: CancellableId.fetchAccountPortfolio, cancelInFlight: true)
to the .run
effect?
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.
It does the same thing, and yes, .cancellable
looks cleaner. Updated
for sectionID: Section.State.ID | ||
) -> FungibleAssetList.Section.Row.State? { | ||
guard | ||
let xrdSection = sections.first(where: { $0.id == sectionID }), |
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 should probably be named section
since it doesn't need to be for XRD
@matiasbzurovski Yes, we could remove those reducers, but since we plan to add UITableView here, it’s probably not worth refactoring right now. However, I did some refactoring and split the |
RadixWallet/Features/AccountDetailsFeature/Coordinator/AccountDetails+Reducer.swift
Show resolved
Hide resolved
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.
LGTM!
nice and much awaited improvement.
Jira ticket: ABW-3254
Description
This PR implements the logic for background refresh of account resources on the Home screen and Account Details screen.
The following reload use cases were added:
How to test
The refresh interval can be decreased by adjusting the values of
accountPortfoliosRefreshIntervalInSeconds
andaccountPortfolioRefreshIntervalInSeconds
.