Skip to content

Commit

Permalink
Integrate listener for TonKit
Browse files Browse the repository at this point in the history
  • Loading branch information
ealymbaev committed Sep 6, 2024
1 parent 7bc9026 commit bc2b823
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12874,7 +12874,7 @@
repositoryURL = "https://github.com/horizontalsystems/TonKit.Swift";
requirement = {
kind = exactVersion;
version = 1.0.2;
version = 1.0.4;
};
};
6BF66DD82BA1A73300963242 /* XCRemoteSwiftPackageReference "ObjectMapper" */ = {
Expand Down
3 changes: 2 additions & 1 deletion UnstoppableWallet/UnstoppableWallet/Core/App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,8 @@ class App {
balanceHiddenManager: balanceHiddenManager,
statManager: statManager,
walletConnectSocketConnectionService: walletConnectSocketConnectionService,
nftMetadataSyncer: nftMetadataSyncer
nftMetadataSyncer: nftMetadataSyncer,
tonKitManager: tonKitManager
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ extension AdapterManager {
}

self.tronKitManager.tronKitWrapper?.tronKit.refresh()
self.tonKitManager.tonKit?.refresh()
self.tonKitManager.tonKit?.sync()
}
}

Expand All @@ -174,6 +174,8 @@ extension AdapterManager {
self.evmBlockchainManager.evmKitManager(blockchainType: blockchainType).evmKitWrapper?.evmKit.refresh()
} else if wallet.token.blockchainType == .tron {
self.tronKitManager.tronKitWrapper?.tronKit.refresh()
} else if wallet.token.blockchainType == .ton {
self.tonKitManager.tonKit?.sync()
} else {
self._adapterData.adapterMap[wallet]?.refresh()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class AppManager {
private let statManager: StatManager
private let walletConnectSocketConnectionService: WalletConnectSocketConnectionService
private let nftMetadataSyncer: NftMetadataSyncer
private let tonKitManager: TonKitManager

private let didBecomeActiveSubject = PublishSubject<Void>()
private let willEnterForegroundSubjectOld = PublishSubject<Void>()
Expand All @@ -35,7 +36,7 @@ class AppManager {
appVersionManager: AppVersionManager, rateAppManager: RateAppManager,
logRecordManager: LogRecordManager,
deepLinkManager: DeepLinkManager, evmLabelManager: EvmLabelManager, balanceHiddenManager: BalanceHiddenManager, statManager: StatManager,
walletConnectSocketConnectionService: WalletConnectSocketConnectionService, nftMetadataSyncer: NftMetadataSyncer)
walletConnectSocketConnectionService: WalletConnectSocketConnectionService, nftMetadataSyncer: NftMetadataSyncer, tonKitManager: TonKitManager)
{
self.accountManager = accountManager
self.walletManager = walletManager
Expand All @@ -55,6 +56,7 @@ class AppManager {
self.statManager = statManager
self.walletConnectSocketConnectionService = walletConnectSocketConnectionService
self.nftMetadataSyncer = nftMetadataSyncer
self.tonKitManager = tonKitManager
}

private func warmUp() {
Expand Down Expand Up @@ -103,6 +105,8 @@ extension AppManager {
lockManager.didEnterBackground()
walletConnectSocketConnectionService.didEnterBackground()
balanceHiddenManager.didEnterBackground()

tonKitManager.tonKit?.stopListener()
}

func willEnterForeground() {
Expand All @@ -123,6 +127,8 @@ extension AppManager {

nftMetadataSyncer.sync()

tonKitManager.tonKit?.startListener()

AppWidgetConstants.allKinds.forEach { WidgetCenter.shared.reloadTimelines(ofKind: $0) }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ class TonKitManager {
minLogLevel: .error
)

tonKit.refresh()
tonKit.sync()
tonKit.startListener()

_tonKit = tonKit
currentAccount = account
Expand Down

0 comments on commit bc2b823

Please sign in to comment.