Skip to content

Commit

Permalink
Update ton-connect-kit
Browse files Browse the repository at this point in the history
  • Loading branch information
abdrasulov committed Nov 28, 2024
1 parent 257dab3 commit 35f5bd3
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="tc" />
<data android:scheme="unstoppable.money" />
</intent-filter>
<intent-filter android:label="@string/App_Name">
<action android:name="android.intent.action.VIEW" />
Expand Down Expand Up @@ -123,6 +124,7 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="tc" />
<data android:scheme="unstoppable.money" />
</intent-filter>
<intent-filter android:label="@string/App_Name">
<action android:name="android.intent.action.VIEW" />
Expand Down Expand Up @@ -161,6 +163,7 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="tc" />
<data android:scheme="unstoppable.money" />
</intent-filter>
<intent-filter android:label="@string/App_Name">
<action android:name="android.intent.action.VIEW" />
Expand Down Expand Up @@ -199,6 +202,7 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="tc" />
<data android:scheme="unstoppable.money" />
</intent-filter>
<intent-filter android:label="@string/App_Name">
<action android:name="android.intent.action.VIEW" />
Expand Down Expand Up @@ -237,6 +241,7 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="tc" />
<data android:scheme="unstoppable.money" />
</intent-filter>
<intent-filter android:label="@string/App_Name">
<action android:name="android.intent.action.VIEW" />
Expand Down Expand Up @@ -275,6 +280,7 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="tc" />
<data android:scheme="unstoppable.money" />
</intent-filter>
<intent-filter android:label="@string/App_Name">
<action android:name="android.intent.action.VIEW" />
Expand Down Expand Up @@ -313,6 +319,7 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="tc" />
<data android:scheme="unstoppable.money" />
</intent-filter>
<intent-filter android:label="@string/App_Name">
<action android:name="android.intent.action.VIEW" />
Expand Down Expand Up @@ -351,6 +358,7 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="tc" />
<data android:scheme="unstoppable.money" />
</intent-filter>
<intent-filter android:label="@string/App_Name">
<action android:name="android.intent.action.VIEW" />
Expand Down Expand Up @@ -389,6 +397,7 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="tc" />
<data android:scheme="unstoppable.money" />
</intent-filter>
<intent-filter android:label="@string/App_Name">
<action android:name="android.intent.action.VIEW" />
Expand Down Expand Up @@ -427,6 +436,7 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="tc" />
<data android:scheme="unstoppable.money" />
</intent-filter>
<intent-filter android:label="@string/App_Name">
<action android:name="android.intent.action.VIEW" />
Expand Down Expand Up @@ -465,6 +475,7 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="tc" />
<data android:scheme="unstoppable.money" />
</intent-filter>
<intent-filter android:label="@string/App_Name">
<action android:name="android.intent.action.VIEW" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ class MainViewModel(
}
}

deeplinkString.startsWith("unstoppable.money:") ||
deeplinkString.startsWith("tc:") -> {
deeplinkPage = DeeplinkPage(R.id.tcListFragment, TonConnectMainFragment.Input(deeplinkString))
tab = MainNavigation.Settings
Expand Down

0 comments on commit 35f5bd3

Please sign in to comment.