Skip to content

Commit

Permalink
bug fixeds
Browse files Browse the repository at this point in the history
  • Loading branch information
polstianka committed Sep 12, 2024
1 parent c720462 commit d391a4b
Show file tree
Hide file tree
Showing 166 changed files with 1,702 additions and 958 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class KeyFragment: BaseFragment(R.layout.fragment_key), BaseFragment.SwipeBack {
}

exportTonkeeperWebView.setOnClickListener {
navigation?.openURL(TKDeepLink.buildLinkUriWeb(publicKey, name).toString(), true)
navigation?.openURL(TKDeepLink.buildLinkUriWeb(publicKey, name).toString())
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ class LegalFragment: BaseFragment(R.layout.fragment_legal), BaseFragment.SwipeBa

val termsView = view.findViewById<View>(R.id.terms)
termsView.setOnClickListener {
navigation?.openURL("https://tonkeeper.com/terms", true)
navigation?.openURL("https://tonkeeper.com/terms")
}

val privacyView = view.findViewById<View>(R.id.privacy)
privacyView.setOnClickListener {
navigation?.openURL("https://tonkeeper.com/privacy", true)
navigation?.openURL("https://tonkeeper.com/privacy")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class RootActivity: NavigationActivity() {
}
}

override fun openURL(url: String, external: Boolean) {
override fun openURL(url: String) {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(intent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class SignFragment: BaseFragment(R.layout.fragment_sign), BaseFragment.Modal {
if (qr) {
navigation?.add(EmulateFragment.newInstance(uri.toString()))
} else {
navigation?.openURL(uri.toString(), true)
navigation?.openURL(uri.toString())
}
}

Expand Down
27 changes: 15 additions & 12 deletions apps/wallet/api/src/main/java/com/tonapps/wallet/api/API.kt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class API(
createTonAPIHttpClient(
context = context,
tonApiV2Key = config.tonApiV2Key,
allowDomains = listOf(config.tonapiMainnetHost, config.tonapiTestnetHost)
allowDomains = listOf(config.tonapiMainnetHost, config.tonapiTestnetHost, "https://rt-testnet.tonapi.io", "https://rt.tonapi.io")
)
}

Expand Down Expand Up @@ -183,6 +183,14 @@ class API(
)
}

fun getTransactionByHash(
accountId: String,
hash: String,
testnet: Boolean
): AccountEvent? {
return withRetry { accounts(testnet).getAccountEvent(accountId, hash) }
}

fun getSingleEvent(
eventId: String,
testnet: Boolean
Expand Down Expand Up @@ -342,6 +350,12 @@ class API(
return tx
}

fun newRealtime(accountId: String, testnet: Boolean): Flow<SSEvent> {
val host = if (testnet) "rt-testnet.tonapi.io" else "rt.tonapi.io"
val url = "https://${host}/sse/transactions?account=$accountId"
return tonAPIHttpClient.sse(url)
}

fun tonconnectEvents(
publicKeys: List<String>,
lastEventId: String?
Expand Down Expand Up @@ -463,12 +477,6 @@ class API(
return emulate(cell.base64(), testnet, address, balance)
}

suspend fun sendToBlockchainWithBattery(
boc: Cell,
tonProofToken: String,
testnet: Boolean,
) = sendToBlockchainWithBattery(boc.base64(), tonProofToken, testnet)

suspend fun sendToBlockchainWithBattery(
boc: String,
tonProofToken: String,
Expand Down Expand Up @@ -501,11 +509,6 @@ class API(
} ?: SendBlockchainState.UNKNOWN_ERROR
}

suspend fun sendToBlockchain(
cell: Cell,
testnet: Boolean
) = sendToBlockchain(cell.base64(), testnet)

fun getAccountSeqno(
accountId: String,
testnet: Boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ data class ConfigEntity(
val batteryMaxInputAmount: String,
val batteryRefundEndpoint: String,
val batteryPromoDisabled: Boolean,
val stakingInfoUrl: String,
): Parcelable {

val swapUri: Uri
Expand Down Expand Up @@ -87,6 +88,7 @@ data class ConfigEntity(
batteryMaxInputAmount = json.optString("batteryMaxInputAmount", "3"),
batteryRefundEndpoint = json.optString("batteryRefundEndpoint", "https://battery-refund-app.vercel.app"),
batteryPromoDisabled = json.optBoolean("disable_battery_promo_module", true),
stakingInfoUrl = json.getString("stakingInfoUrl"),
)

constructor() : this(
Expand Down Expand Up @@ -123,6 +125,7 @@ data class ConfigEntity(
batteryMaxInputAmount = "3",
batteryRefundEndpoint = "https://battery-refund-app.vercel.app",
batteryPromoDisabled = false,
stakingInfoUrl = "https://ton.org/stake",
)

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ data class TokenEntity(
companion object {

val TON_ICON_URI = Uri.Builder().scheme("res").path(R.drawable.ic_ton_with_bg.toString()).build()
val USDT_ICON_URI = Uri.Builder().scheme("res").path(R.drawable.ic_usdt.toString()).build()
val USDT_ICON_URI = Uri.Builder().scheme("res").path(R.drawable.ic_usdt_with_bg.toString()).build()

val TON = TokenEntity(
address = "TON",
Expand Down
Binary file removed apps/wallet/api/src/main/res/drawable/ic_usdt.png
Binary file not shown.
13 changes: 13 additions & 0 deletions apps/wallet/api/src/main/res/drawable/ic_usdt_logo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="165dp"
android:height="165dp"
android:viewportWidth="165"
android:viewportHeight="165">
<path
android:pathData="M54.64,84.74C57.36,87.76 68.46,90.02 81.76,90.02C95.05,90.02 106.15,87.76 108.87,84.74C106.57,82.18 98.23,80.16 87.64,79.61V85.99C85.74,86.09 83.77,86.14 81.75,86.14C79.74,86.14 77.76,86.09 75.87,85.99V79.61C65.28,80.16 56.94,82.18 54.64,84.74Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M117.39,48.07L135.52,79.39V79.39C136.46,81.02 136.19,83.06 134.84,84.38L84.92,133.4C83.3,134.99 80.7,134.99 79.09,133.4L29.23,84.45C27.86,83.1 27.6,80.99 28.61,79.35L47.99,47.97C48.75,46.75 50.09,46 51.54,46H113.79C115.28,46 116.65,46.79 117.39,48.07ZM87.65,68.77V74.87H87.64C100.09,75.52 109.44,78.19 109.51,81.4V88.08C109.44,91.29 100.09,93.96 87.64,94.62V109.57H75.87V94.62C63.41,93.96 54.07,91.29 54,88.08V81.4C54.07,78.19 63.41,75.52 75.87,74.87V68.77H58.13V59.99H105.38V68.77H87.65Z"
android:fillColor="#ffffff"
android:fillType="evenOdd"/>
</vector>
19 changes: 19 additions & 0 deletions apps/wallet/api/src/main/res/drawable/ic_usdt_with_bg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="165dp"
android:height="165dp"
android:viewportWidth="165"
android:viewportHeight="165">

<path
android:pathData="M82.5,0C128.3,0 165,36.7 165,82.5C165,128.3 128.3,165 82.5,165C36.7,165 0,128.3 0,82.5C0,36.7 36.7,0 82.5,0z"
android:fillColor="#009393"/>

<path
android:pathData="M54.64,84.74C57.36,87.76 68.46,90.02 81.76,90.02C95.05,90.02 106.15,87.76 108.87,84.74C106.57,82.18 98.23,80.16 87.64,79.61V85.99C85.74,86.09 83.77,86.14 81.75,86.14C79.74,86.14 77.76,86.09 75.87,85.99V79.61C65.28,80.16 56.94,82.18 54.64,84.74Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M117.39,48.07L135.52,79.39V79.39C136.46,81.02 136.19,83.06 134.84,84.38L84.92,133.4C83.3,134.99 80.7,134.99 79.09,133.4L29.23,84.45C27.86,83.1 27.6,80.99 28.61,79.35L47.99,47.97C48.75,46.75 50.09,46 51.54,46H113.79C115.28,46 116.65,46.79 117.39,48.07ZM87.65,68.77V74.87H87.64C100.09,75.52 109.44,78.19 109.51,81.4V88.08C109.44,91.29 100.09,93.96 87.64,94.62V109.57H75.87V94.62C63.41,93.96 54.07,91.29 54,88.08V81.4C54.07,78.19 63.41,75.52 75.87,74.87V68.77H58.13V59.99H105.38V68.77H87.65Z"
android:fillColor="#ffffff"
android:fillType="evenOdd"/>

</vector>
17 changes: 1 addition & 16 deletions apps/wallet/data/account/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,26 +1,11 @@
plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
id("com.tonapps.wallet.data")
id("kotlin-parcelize")
kotlin("plugin.serialization") version "2.0.0"
}

android {
namespace = Build.namespacePrefix("wallet.data.account")
compileSdk = Build.compileSdkVersion

defaultConfig {
minSdk = Build.minSdkVersion
consumerProguardFiles("consumer-rules.pro")
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import org.ton.api.pub.PublicKeyEd25519
import org.ton.cell.Cell
import org.ton.contract.wallet.WalletTransfer


data class WalletEntity(
val id: String,
val publicKey: PublicKeyEd25519,
Expand Down Expand Up @@ -72,9 +73,6 @@ data class WalletEntity(
val hasPrivateKey: Boolean
get() = type == Wallet.Type.Default || type == Wallet.Type.Testnet || type == Wallet.Type.Lockup

val isSigner: Boolean
get() = type == Wallet.Type.Signer || type == Wallet.Type.SignerQR

val accountId: String = contract.address.toAccountId()

val address: String = contract.address.toWalletAddress(testnet)
Expand All @@ -85,6 +83,9 @@ data class WalletEntity(
val isLedger: Boolean
get() = type == Wallet.Type.Ledger

val isW5: Boolean
get() = version == WalletVersion.V5BETA || version == WalletVersion.V5R1

val isExternal: Boolean
get() = signer || isLedger

Expand All @@ -94,7 +95,7 @@ data class WalletEntity(
type = parcel.readEnum(Wallet.Type::class.java)!!,
version = parcel.readEnum(WalletVersion::class.java)!!,
label = parcel.readParcelableCompat()!!,
ledger = parcel.readParcelableCompat()!!
ledger = parcel.readParcelableCompat()
)

fun isMyAddress(address: String): Boolean {
Expand Down
19 changes: 1 addition & 18 deletions apps/wallet/data/backup/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,30 +1,13 @@
plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
id("com.tonapps.wallet.data")
id("kotlin-parcelize")
}

android {
namespace = Build.namespacePrefix("wallet.data.backup")
compileSdk = Build.compileSdkVersion

defaultConfig {
minSdk = Build.minSdkVersion
consumerProguardFiles("consumer-rules.pro")
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}

dependencies {
implementation(Dependence.KotlinX.coroutines)
implementation(Dependence.Koin.core)
implementation(project(Dependence.Lib.sqlite))
implementation(project(Dependence.Lib.extensions))
implementation(project(Dependence.Wallet.Data.rn))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.tonapps.wallet.data.backup

import android.content.Context
import android.util.Log
import com.tonapps.extensions.isMainVersion
import com.tonapps.wallet.data.backup.entities.BackupEntity
import com.tonapps.wallet.data.backup.source.LocalDataSource
import com.tonapps.wallet.data.rn.RNLegacy
Expand All @@ -12,9 +10,6 @@ import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.filterNotNull
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.flow.shareIn
import kotlinx.coroutines.launch
import org.json.JSONObject
Expand Down Expand Up @@ -76,7 +71,7 @@ class BackupRepository(

fun addBackup(
walletId: String,
source: BackupEntity.Source,
source: BackupEntity.Source = BackupEntity.Source.LOCAL,
date: Long = System.currentTimeMillis()
): BackupEntity {
val entity = localDataSource.addBackup(walletId, source, date)
Expand Down
19 changes: 1 addition & 18 deletions apps/wallet/data/battery/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,30 +1,13 @@
plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
id("com.tonapps.wallet.data")
id("kotlin-parcelize")
}

android {
namespace = Build.namespacePrefix("wallet.data.battery")
compileSdk = Build.compileSdkVersion

defaultConfig {
minSdk = Build.minSdkVersion
consumerProguardFiles("consumer-rules.pro")
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}

dependencies {
implementation(Dependence.KotlinX.coroutines)
implementation(Dependence.Koin.core)
implementation(Dependence.Squareup.moshi)
implementation(Dependence.Squareup.moshiAdapters)
implementation(Dependence.Squareup.okhttp)
Expand Down
Empty file.
21 changes: 0 additions & 21 deletions apps/wallet/data/battery/proguard-rules.pro

This file was deleted.

19 changes: 1 addition & 18 deletions apps/wallet/data/browser/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,30 +1,13 @@
plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
id("com.tonapps.wallet.data")
id("kotlin-parcelize")
}

android {
namespace = Build.namespacePrefix("wallet.data.browser")
compileSdk = Build.compileSdkVersion

defaultConfig {
minSdk = Build.minSdkVersion
consumerProguardFiles("consumer-rules.pro")
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}

dependencies {
implementation(Dependence.KotlinX.coroutines)
implementation(Dependence.Koin.core)
implementation(Dependence.Squareup.okhttp)

implementation(project(Dependence.Wallet.api))
Expand Down
Loading

0 comments on commit d391a4b

Please sign in to comment.