Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash fixes from PlayStore logs #7814

Merged
merged 6 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ android {
compileSdk compile_sdk_version
minSdkVersion min_sdk_version
targetSdkVersion compile_sdk_version
versionCode 124
versionName "0.41.1"
versionCode 125
versionName "0.41.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

ksp {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ class NftAdapterManager(
coroutineScope.launch {
walletManager.activeWalletsUpdatedObservable.asFlow()
.collect {
initAdapters(it)
//disable NFT adapters for now
//initAdapters(it)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import kotlinx.coroutines.cancel
import kotlinx.coroutines.launch
import kotlinx.coroutines.reactive.asFlow
import java.math.BigDecimal
import java.net.UnknownHostException

class BalanceAdapterRepository(
private val adapterManager: IAdapterManager,
Expand Down Expand Up @@ -115,7 +114,7 @@ class BalanceAdapterRepository(
return BalanceWarning.TronInactiveAccountWarning
}
}
} catch (e: UnknownHostException) {
} catch (e: Exception) {
e.printStackTrace()
}
return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ class ManageAccountFragment : BaseComposeFragment() {

@Composable
override fun GetContent(navController: NavController) {
val input = navController.requireInput<Input>()
val input = try {
navController.requireInput<Input>()
} catch (e: NullPointerException) {
navController.popBackStack()
return
}
ManageAccountScreen(
navController,
input.accountId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,13 @@ class BackupConfirmKeyFragment : BaseComposeFragment() {

@Composable
override fun GetContent(navController: NavController) {
RecoveryPhraseVerifyScreen(
navController,
navController.requireInput(),
)
val input = try {
navController.requireInput<Account>()
} catch (e: NullPointerException) {
navController.popBackStack()
return
}
RecoveryPhraseVerifyScreen(navController, input)
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,13 @@ class ManageAccountsFragment : BaseComposeFragment() {

@Composable
override fun GetContent(navController: NavController) {
ManageAccountsScreen(
navController,
navController.requireInput()
)
val input = try {
navController.requireInput<ManageAccountsModule.Mode>()
} catch (e: NullPointerException) {
navController.popBackStack()
return
}
ManageAccountsScreen(navController, input)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,15 @@ class ReceiveAddressViewModel(
usedAddresses = adapter.usedAddresses(false)
usedChangeAddresses = adapter.usedAddresses(true)
uri = getUri()
accountActive = adapter.isAddressActive(adapter.receiveAddress)
mainNet = adapter.isMainNet
viewState = ViewState.Success

accountActive = try {
adapter.isAddressActive(adapter.receiveAddress)
} catch (e: Exception) {
viewState = ViewState.Error(e)
false
}
} else {
viewState = ViewState.Error(NullPointerException())
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package io.horizontalsystems.bankwallet.ui.helpers

import android.content.Context
import android.content.Intent
import android.net.Uri
import android.util.Log
import androidx.browser.customtabs.CustomTabColorSchemeParams
import androidx.browser.customtabs.CustomTabsIntent
import io.horizontalsystems.bankwallet.R
Expand All @@ -12,26 +14,37 @@ object LinkHelper {
fun openLinkInAppBrowser(context: Context, link: String) {
val urlString = getValidUrl(link) ?: return

val builder = CustomTabsIntent.Builder()
try {
val builder = CustomTabsIntent.Builder()

val color = context.getColor(R.color.tyler)
val color = context.getColor(R.color.tyler)

val params = CustomTabColorSchemeParams.Builder()
.setNavigationBarColor(color)
.setToolbarColor(color)
.build()
val params = CustomTabColorSchemeParams.Builder()
.setNavigationBarColor(color)
.setToolbarColor(color)
.build()

builder.setColorSchemeParams(CustomTabsIntent.COLOR_SCHEME_DARK, params)
builder.setColorSchemeParams(CustomTabsIntent.COLOR_SCHEME_LIGHT, params)
builder.setStartAnimations(context, R.anim.slide_from_right, R.anim.slide_to_left)
builder.setExitAnimations(
context,
android.R.anim.slide_in_left,
android.R.anim.slide_out_right
)
builder.setColorSchemeParams(CustomTabsIntent.COLOR_SCHEME_DARK, params)
builder.setColorSchemeParams(CustomTabsIntent.COLOR_SCHEME_LIGHT, params)
builder.setStartAnimations(context, R.anim.slide_from_right, R.anim.slide_to_left)
builder.setExitAnimations(
context,
android.R.anim.slide_in_left,
android.R.anim.slide_out_right
)

val intent = builder.build()
intent.launchUrl(context, Uri.parse(urlString))
val intent = builder.build()
intent.launchUrl(context, Uri.parse(urlString))
} catch (e: SecurityException) {
// Fallback to standard intent if Custom Tabs fails
try {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(urlString))
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
context.startActivity(intent)
} catch (e: Exception) {
Log.e("LinkHelper", "Failed to open URL: $urlString", e)
}
}
}

private fun getValidUrl(urlString: String): String? {
Expand Down
Loading