From 35f5bd378fe0d5cc6175f307fc1c49039e391436 Mon Sep 17 00:00:00 2001 From: abdrasulov Date: Thu, 28 Nov 2024 13:23:26 +0600 Subject: [PATCH] Update ton-connect-kit --- app/build.gradle | 2 +- app/src/main/AndroidManifest.xml | 11 +++++++++++ .../java/io/horizontalsystems/bankwallet/core/App.kt | 7 ++++++- .../bankwallet/core/managers/TonConnectManager.kt | 9 +++++++-- .../bankwallet/modules/balance/BalanceViewModel.kt | 5 ++++- .../bankwallet/modules/main/MainViewModel.kt | 1 + 6 files changed, 30 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index e2ee3c1d4f..fe7c9519ae 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -281,7 +281,7 @@ dependencies { debugImplementation leakCanary // Wallet kits - implementation 'com.github.horizontalsystems:ton-kit-android:763a5c3' + implementation 'com.github.horizontalsystems:ton-kit-android:969fe77' implementation 'com.github.horizontalsystems:bitcoin-kit-android:ced5801' implementation 'com.github.horizontalsystems:ethereum-kit-android:a5eff38' implementation 'com.github.horizontalsystems:blockchain-fee-rate-kit-android:1d3bd49' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 12249789a4..c3f947f63f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -85,6 +85,7 @@ + @@ -123,6 +124,7 @@ + @@ -161,6 +163,7 @@ + @@ -199,6 +202,7 @@ + @@ -237,6 +241,7 @@ + @@ -275,6 +280,7 @@ + @@ -313,6 +319,7 @@ + @@ -351,6 +358,7 @@ + @@ -389,6 +397,7 @@ + @@ -427,6 +436,7 @@ + @@ -465,6 +475,7 @@ + diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/core/App.kt b/app/src/main/java/io/horizontalsystems/bankwallet/core/App.kt index af88305552..63b5c3d3d2 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/core/App.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/core/App.kt @@ -453,7 +453,12 @@ class App : CoreApp(), WorkConfiguration.Provider, ImageLoaderFactory { spamManager = SpamManager(localStorage) - tonConnectManager = TonConnectManager(this, adapterFactory) + tonConnectManager = TonConnectManager( + context = this, + adapterFactory = adapterFactory, + appName = "Unstoppable Wallet", + appVersion = appConfigProvider.appVersion + ) tonConnectManager.start() startTasks() diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/core/managers/TonConnectManager.kt b/app/src/main/java/io/horizontalsystems/bankwallet/core/managers/TonConnectManager.kt index 084fea65f1..8a1ea618aa 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/core/managers/TonConnectManager.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/core/managers/TonConnectManager.kt @@ -9,8 +9,13 @@ import io.horizontalsystems.tonkit.tonconnect.TonConnectKit import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.asSharedFlow -class TonConnectManager(context: Context, val adapterFactory: AdapterFactory) { - val kit = TonConnectKit.getInstance(context) +class TonConnectManager( + context: Context, + val adapterFactory: AdapterFactory, + appName: String, + appVersion: String, +) { + val kit = TonConnectKit.getInstance(context, appName, appVersion) val transactionSigner = TonKit.getTransactionSigner(TonKit.getTonApi(Network.MainNet)) val sendRequestFlow by kit::sendRequestFlow diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/balance/BalanceViewModel.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/balance/BalanceViewModel.kt index 9116a3d977..315e774d03 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/balance/BalanceViewModel.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/balance/BalanceViewModel.kt @@ -243,7 +243,10 @@ class BalanceViewModel( fun handleScannedData(scannedText: String) { viewModelScope.launch { - if (scannedText.startsWith("tc:")) { + if ( + scannedText.startsWith("tc:") || + scannedText.startsWith("https://unstoppable.money/ton-connect") + ) { App.tonConnectManager.handle(scannedText) } else { val wcUriVersion = WalletConnectListModule.getVersionFromUri(scannedText) diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/main/MainViewModel.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/main/MainViewModel.kt index d0c20a7392..b82b3bad01 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/main/MainViewModel.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/main/MainViewModel.kt @@ -328,6 +328,7 @@ class MainViewModel( } } + deeplinkString.startsWith("unstoppable.money:") || deeplinkString.startsWith("tc:") -> { deeplinkPage = DeeplinkPage(R.id.tcListFragment, TonConnectMainFragment.Input(deeplinkString)) tab = MainNavigation.Settings