Skip to content

Commit

Permalink
IOS-8044 Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
tureck1y committed Sep 27, 2024
1 parent dc332d3 commit 60cfbe2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class CommonUserWalletRepository: UserWalletRepository {
config.cardName,
names: models.map(\.name)
)

let userWalletModel = CommonUserWalletModelFactory().makeModel(cardInfo: cardInfo)
if let userWalletModel {
initializeServices(for: userWalletModel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ final class MultiWalletMainContentViewModel: ObservableObject {
private var isUpdating = false

private var bag = Set<AnyCancellable>()
private var tokenListSyncSubscription: AnyCancellable?

init(
userWalletModel: UserWalletModel,
Expand Down Expand Up @@ -274,12 +273,14 @@ final class MultiWalletMainContentViewModel: ObservableObject {
let sectionsPublisher = sectionsPublisher
.replaceEmpty(with: [])

var tokenListSyncSubscription: AnyCancellable?
tokenListSyncSubscription = Publishers.Zip(tokenListSyncPublisher, sectionsPublisher)
.prefix(1)
.receive(on: DispatchQueue.main)
.withWeakCaptureOf(self)
.sink { viewModel, _ in
viewModel.isLoadingTokenList = false
viewModel.tokenListSyncSubscription = nil
withExtendedLifetime(tokenListSyncSubscription) {}
}
}

Expand Down

0 comments on commit 60cfbe2

Please sign in to comment.