Skip to content

Commit

Permalink
Merge branch 'master' into version/0.42
Browse files Browse the repository at this point in the history
# Conflicts:
#	app/build.gradle
  • Loading branch information
rafaelekol committed Dec 20, 2024
2 parents 25d4edc + d435509 commit 3e0d576
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 31 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ android {
compileSdk compile_sdk_version
minSdkVersion min_sdk_version
targetSdkVersion compile_sdk_version
versionCode 123
versionCode 126
versionName "0.42.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

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
@@ -1,5 +1,6 @@
package io.horizontalsystems.bankwallet.modules.main

import android.content.Intent
import android.os.Bundle
import androidx.activity.OnBackPressedCallback
import androidx.activity.compose.BackHandler
Expand Down Expand Up @@ -88,7 +89,8 @@ class MainFragment : BaseComposeFragment() {
)
} ?: run {
// Back stack entry doesn't exist, restart activity
requireActivity().recreate()
val intent = Intent(context, MainActivity::class.java)
requireActivity().startActivity(intent)
}
}

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

0 comments on commit 3e0d576

Please sign in to comment.