diff --git a/apps/wallet/api/src/main/java/com/tonapps/wallet/api/internal/InternalApi.kt b/apps/wallet/api/src/main/java/com/tonapps/wallet/api/internal/InternalApi.kt index fb298a9e7..a2bc5fe4a 100644 --- a/apps/wallet/api/src/main/java/com/tonapps/wallet/api/internal/InternalApi.kt +++ b/apps/wallet/api/src/main/java/com/tonapps/wallet/api/internal/InternalApi.kt @@ -39,6 +39,7 @@ internal class InternalApi( .appendQueryParameter("build", build) .appendQueryParameter("platform", platform) .appendQueryParameter("chainName", if (testnet) "testnet" else "mainnet") + return builder.build().toString() } diff --git a/apps/wallet/data/browser/src/main/java/com/tonapps/wallet/data/browser/BrowserRepository.kt b/apps/wallet/data/browser/src/main/java/com/tonapps/wallet/data/browser/BrowserRepository.kt index fe05f7fe0..77302b629 100644 --- a/apps/wallet/data/browser/src/main/java/com/tonapps/wallet/data/browser/BrowserRepository.kt +++ b/apps/wallet/data/browser/src/main/java/com/tonapps/wallet/data/browser/BrowserRepository.kt @@ -44,7 +44,7 @@ class BrowserRepository(context: Context, api: API) { locale: Locale ) = flow { loadLocal(country, locale)?.let { emit(it) } - load(country, testnet, locale)?.let { emit(it) } + loadRemote(country, testnet, locale)?.let { emit(it) } } suspend fun load(country: String, testnet: Boolean, locale: Locale): BrowserDataEntity? = withContext(Dispatchers.IO) { diff --git a/apps/wallet/data/browser/src/main/java/com/tonapps/wallet/data/browser/entities/BrowserAppEntity.kt b/apps/wallet/data/browser/src/main/java/com/tonapps/wallet/data/browser/entities/BrowserAppEntity.kt index 4b6c9b337..7dcd5a8da 100644 --- a/apps/wallet/data/browser/src/main/java/com/tonapps/wallet/data/browser/entities/BrowserAppEntity.kt +++ b/apps/wallet/data/browser/src/main/java/com/tonapps/wallet/data/browser/entities/BrowserAppEntity.kt @@ -3,6 +3,7 @@ package com.tonapps.wallet.data.browser.entities import android.graphics.Color import android.net.Uri import android.os.Parcelable +import com.tonapps.extensions.toUriOrNull import kotlinx.parcelize.Parcelize import org.json.JSONArray import org.json.JSONObject @@ -37,7 +38,7 @@ data class BrowserAppEntity( description = json.getString("description"), icon = Uri.parse(json.getString("icon")), poster = json.optString("poster")?.let { Uri.parse(it) }, - url = Uri.parse(json.getString("url")), + url = json.optString("url").toUriOrNull() ?: Uri.EMPTY, textColor = Color.parseColor(json.optString("textColor", "#ffffff")), button = json.optJSONObject("button")?.let { Button(it) } ) diff --git a/apps/wallet/data/browser/src/main/java/com/tonapps/wallet/data/browser/entities/BrowserDataEntity.kt b/apps/wallet/data/browser/src/main/java/com/tonapps/wallet/data/browser/entities/BrowserDataEntity.kt index cf768ffba..71577a4dc 100644 --- a/apps/wallet/data/browser/src/main/java/com/tonapps/wallet/data/browser/entities/BrowserDataEntity.kt +++ b/apps/wallet/data/browser/src/main/java/com/tonapps/wallet/data/browser/entities/BrowserDataEntity.kt @@ -1,6 +1,7 @@ package com.tonapps.wallet.data.browser.entities import android.os.Parcelable +import android.util.Log import kotlinx.parcelize.Parcelize import org.json.JSONObject diff --git a/apps/wallet/data/browser/src/main/java/com/tonapps/wallet/data/browser/source/RemoteDataSource.kt b/apps/wallet/data/browser/src/main/java/com/tonapps/wallet/data/browser/source/RemoteDataSource.kt index 1e2a54902..3d09b8b9c 100644 --- a/apps/wallet/data/browser/src/main/java/com/tonapps/wallet/data/browser/source/RemoteDataSource.kt +++ b/apps/wallet/data/browser/src/main/java/com/tonapps/wallet/data/browser/source/RemoteDataSource.kt @@ -1,5 +1,6 @@ package com.tonapps.wallet.data.browser.source +import android.util.Log import com.google.firebase.crashlytics.FirebaseCrashlytics import com.tonapps.wallet.api.API import com.tonapps.wallet.data.browser.entities.BrowserDataEntity diff --git a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/manager/tonconnect/TonConnectManager.kt b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/manager/tonconnect/TonConnectManager.kt index 4e4295c0a..eaed98bd3 100644 --- a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/manager/tonconnect/TonConnectManager.kt +++ b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/manager/tonconnect/TonConnectManager.kt @@ -294,8 +294,10 @@ class TonConnectManager( val clientId = tonConnect.clientId try { + val targetWallet = if (wallet != null && wallet.isTonConnectSupported) wallet else null + val app = readManifest(tonConnect.manifestUrl) - if (isScam(activity, wallet ?: WalletEntity.EMPTY, app.iconUrl.toUri(), app.url)) { + if (isScam(activity, targetWallet ?: WalletEntity.EMPTY, app.iconUrl.toUri(), app.url)) { return@withContext JsonBuilder.connectEventError(BridgeError.badRequest("client error")) } @@ -303,7 +305,7 @@ class TonConnectManager( app = app, proofPayload = tonConnect.proofPayload, returnUri = tonConnect.returnUri, - wallet = wallet, + wallet = targetWallet, fromPackageName = tonConnect.fromPackageName ) val bundle = activity.addForResult(screen) diff --git a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/browser/main/BrowserMainScreen.kt b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/browser/main/BrowserMainScreen.kt index 06f1f8ad8..9032f755e 100644 --- a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/browser/main/BrowserMainScreen.kt +++ b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/browser/main/BrowserMainScreen.kt @@ -110,7 +110,7 @@ class BrowserMainScreen(wallet: WalletEntity): WalletContextScreen(R.layout.frag spanSizeLookup = object : SpanSizeLookup() { override fun getSpanSize(position: Int): Int { return when (exploreAdapter.getItemViewType(position)) { - ExploreItem.TYPE_TITLE, ExploreItem.TYPE_BANNERS -> 4 + ExploreItem.TYPE_TITLE, ExploreItem.TYPE_BANNERS, ExploreItem.TYPE_ADS -> 4 else -> 1 } } diff --git a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/browser/main/BrowserMainViewModel.kt b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/browser/main/BrowserMainViewModel.kt index 27b279218..f27fd0ab6 100644 --- a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/browser/main/BrowserMainViewModel.kt +++ b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/browser/main/BrowserMainViewModel.kt @@ -1,6 +1,7 @@ package com.tonapps.tonkeeper.ui.screen.browser.main import android.app.Application +import android.util.Log import androidx.lifecycle.viewModelScope import com.tonapps.extensions.MutableEffectFlow import com.tonapps.extensions.mapList diff --git a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/browser/main/list/explore/list/holder/ExploreTitleExploreHolder.kt b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/browser/main/list/explore/list/holder/ExploreTitleExploreHolder.kt index 864a33984..408ed266d 100644 --- a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/browser/main/list/explore/list/holder/ExploreTitleExploreHolder.kt +++ b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/browser/main/list/explore/list/holder/ExploreTitleExploreHolder.kt @@ -11,11 +11,11 @@ class ExploreTitleExploreHolder( ): ExploreHolder(parent, R.layout.view_browser_title) { private val titleView = findViewById(R.id.title) - private val allView = findViewById(R.id.all) + // private val allView = findViewById(R.id.all) override fun onBind(item: ExploreItem.Title) { titleView.text = item.title - allView.setOnClickListener { + itemView.setOnClickListener { onMoreClick(item.id) } } diff --git a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/browser/more/BrowserMoreViewModel.kt b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/browser/more/BrowserMoreViewModel.kt index d1ddee8dd..dd21aa64b 100644 --- a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/browser/more/BrowserMoreViewModel.kt +++ b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/browser/more/BrowserMoreViewModel.kt @@ -12,7 +12,6 @@ import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.stateIn -import uikit.extensions.collectFlow class BrowserMoreViewModel( application: Application, diff --git a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/root/RootViewModel.kt b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/root/RootViewModel.kt index bb1d82d68..9c237a16b 100644 --- a/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/root/RootViewModel.kt +++ b/apps/wallet/instance/app/src/main/java/com/tonapps/tonkeeper/ui/screen/root/RootViewModel.kt @@ -53,6 +53,7 @@ import com.tonapps.tonkeeper.manager.tonconnect.TonConnectManager import com.tonapps.tonkeeper.manager.tonconnect.bridge.model.BridgeError import com.tonapps.tonkeeper.ui.base.BaseWalletVM import com.tonapps.tonkeeper.ui.component.UpdateAvailableDialog +import com.tonapps.tonkeeper.ui.screen.add.AddWalletScreen import com.tonapps.tonkeeper.ui.screen.backup.main.BackupScreen import com.tonapps.tonkeeper.ui.screen.battery.BatteryScreen import com.tonapps.tonkeeper.ui.screen.browser.dapp.DAppScreen @@ -486,7 +487,11 @@ class RootViewModel( private suspend fun processDeepLink(wallet: WalletEntity, deeplink: DeepLink, fromPackageName: String?) { val route = deeplink.route - if (route is DeepLinkRoute.TonConnect && !wallet.isWatchOnly) { + if (route is DeepLinkRoute.TonConnect) { + if (!wallet.isTonConnectSupported && accountRepository.getWallets().count { it.isTonConnectSupported } == 0) { + openScreen(AddWalletScreen.newInstance(true)) + return + } processTonConnectDeepLink(deeplink, fromPackageName) } else if (route is DeepLinkRoute.Story) { showStory(route.id, "deep-link") diff --git a/apps/wallet/instance/app/src/main/res/layout/view_browser_ads.xml b/apps/wallet/instance/app/src/main/res/layout/view_browser_ads.xml index be7bff5e7..939c94259 100644 --- a/apps/wallet/instance/app/src/main/res/layout/view_browser_ads.xml +++ b/apps/wallet/instance/app/src/main/res/layout/view_browser_ads.xml @@ -3,12 +3,16 @@ android:layout_width="match_parent" android:layout_height="76dp" xmlns:app="http://schemas.android.com/apk/res-auto" - android:padding="@dimen/offsetMedium"> + android:padding="@dimen/offsetMedium" + android:layout_marginHorizontal="@dimen/offsetMedium" + android:layout_marginBottom="@dimen/offsetMedium" + android:background="@drawable/bg_content"> + android:paddingHorizontal="@dimen/offsetMedium"> + android:paddingHorizontal="8dp"/> \ No newline at end of file