Skip to content

Commit

Permalink
bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
polstianka committed Aug 24, 2024
1 parent 0321de7 commit 75d67f8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,14 @@ internal class TokenPrefsFolder(context: Context, scope: CoroutineScope): BaseSe
}

fun getPinned(walletId: String, tokenAddress: String): Boolean {
return getBoolean(keyPinned(walletId, tokenAddress))
val defValue = tokenAddress.equals("0:b113a994b5024a16719f69139328eb759596c38a25f59028b146fecdc3621dfe", ignoreCase = true) || tokenAddress.equals("ton", ignoreCase = true)
return getBoolean(keyPinned(walletId, tokenAddress), defValue)
}

fun getIndex(walletId: String, tokenAddress: String): Int {
return getInt(keySort(walletId, tokenAddress))
}

// val pinned = if (hidden) false else getBoolean(keyPinned(walletId, tokenAddress), tokenAddress.equals("0:b113a994b5024a16719f69139328eb759596c38a25f59028b146fecdc3621dfe", ignoreCase = true) || tokenAddress.equals("ton", ignoreCase = true))
//

fun setPinned(walletId: String, tokenAddress: String, pinned: Boolean) {
putBoolean(keyPinned(walletId, tokenAddress), pinned)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.os.Handler
import android.util.Log
import android.view.View
import androidx.biometric.BiometricPrompt
import androidx.core.os.LocaleListCompat
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.updatePadding
Expand Down Expand Up @@ -62,7 +63,6 @@ class RootActivity: BaseWalletActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
setTheme(viewModel.theme.resId)
super.onCreate(savedInstanceState)
Log.d("RootViewModel", "onCreate: $viewModel")
legacyRN.setActivity(this)
windowInsetsController.isAppearanceLightStatusBars = viewModel.theme.light
windowInsetsController.isAppearanceLightNavigationBars = viewModel.theme.light
Expand Down Expand Up @@ -90,11 +90,15 @@ class RootActivity: BaseWalletActivity() {
collectFlow(viewModel.passcodeFlow, ::passcodeFlow)

collectFlow(viewModel.themeFlow) {
viewModelStore.clear()
recreate() // Call after theme change
recreate()
}
}

override fun recreate() {
viewModelStore.clear()
super.recreate()
}

private fun passcodeFlow(config: RootViewModel.Passcode) {
if (!config.show) {
lockView.visibility = View.GONE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.take
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withContext
import org.json.JSONArray
import org.json.JSONObject
Expand Down

0 comments on commit 75d67f8

Please sign in to comment.