Skip to content

Commit eba8c8b

Browse files
committed
Merge remote-tracking branch 'origin/master' into feature/geetest
2 parents 44fb84a + ebb3524 commit eba8c8b

File tree

8 files changed

+61
-84
lines changed

8 files changed

+61
-84
lines changed

app/src/main/java/one/mixin/android/net/SequentialDns.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ class SequentialDns(vararg dns: Dns) : Dns {
1818
} else {
1919
Timber.w("Didn't find any addresses for %s using %s. Continuing.", hostname, dns.javaClass.simpleName)
2020
}
21+
} catch (e: RuntimeException) {
22+
Timber.e(e, "Failed to resolve runtime %s using %s. Continuing.", hostname, dns.javaClass.simpleName)
2123
} catch (e: UnknownHostException) {
2224
Timber.w(e, "Failed to resolve unknown host %s using %s. Continuing.", hostname, dns.toString())
2325
} catch (e: IllegalStateException) {

app/src/main/java/one/mixin/android/ui/home/web3/swap/SwapActivity.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import one.mixin.android.ui.home.web3.swap.SwapFragment.Companion.ARGS_INPUT
1414
import one.mixin.android.ui.home.web3.swap.SwapFragment.Companion.ARGS_IN_MIXIN
1515
import one.mixin.android.ui.home.web3.swap.SwapFragment.Companion.ARGS_OUTPUT
1616
import one.mixin.android.ui.home.web3.swap.SwapFragment.Companion.ARGS_REFERRAL
17-
import one.mixin.android.ui.home.web3.swap.SwapFragment.Companion.ARGS_TOKEN_ITEMS
1817
import one.mixin.android.util.viewBinding
1918
import one.mixin.android.vo.safe.TokenItem
2019

@@ -28,7 +27,6 @@ class SwapActivity : BaseActivity(){
2827
amount: String? = null,
2928
referral: String? = null,
3029
inMixin: Boolean = true,
31-
tokens: List<TokenItem>? = null,
3230
walletId: String? = null,
3331
) {
3432
context.startActivity(
@@ -38,7 +36,6 @@ class SwapActivity : BaseActivity(){
3836
amount?.let { putExtra(ARGS_AMOUNT, it) }
3937
referral?.let { putExtra(ARGS_REFERRAL, it) }
4038
putExtra(ARGS_IN_MIXIN, inMixin)
41-
tokens?.let { putParcelableArrayListExtra(ARGS_TOKEN_ITEMS, ArrayList(it)) }
4239
walletId?.let { putExtra(SwapFragment.ARGS_WALLET_ID, it) }
4340
flags = Intent.FLAG_ACTIVITY_SINGLE_TOP
4441
},
@@ -51,9 +48,7 @@ class SwapActivity : BaseActivity(){
5148
override fun onCreate(savedInstanceState: Bundle?) {
5249
super.onCreate(savedInstanceState)
5350
setContentView(binding.root)
54-
val passedTokens = IntentCompat.getParcelableArrayListExtra(intent, ARGS_TOKEN_ITEMS, TokenItem::class.java)
5551
val swapFragment = SwapFragment.newInstance<TokenItem>(
56-
passedTokens,
5752
intent.getStringExtra(ARGS_INPUT),
5853
intent.getStringExtra(ARGS_OUTPUT),
5954
intent.getStringExtra(ARGS_AMOUNT),

app/src/main/java/one/mixin/android/ui/home/web3/swap/SwapFragment.kt

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ class SwapFragment : BaseFragment() {
9191
companion object {
9292
const val TAG = "SwapFragment"
9393
const val ARGS_WEB3_TOKENS = "args_web3_tokens"
94-
const val ARGS_TOKEN_ITEMS = "args_token_items"
9594
const val ARGS_INPUT = "args_input"
9695
const val ARGS_OUTPUT = "args_output"
9796
const val ARGS_AMOUNT = "args_amount"
@@ -107,7 +106,6 @@ class SwapFragment : BaseFragment() {
107106
const val maxLeftAmount = 0.01
108107

109108
inline fun <reified T : Swappable> newInstance(
110-
tokens: List<T>? = null,
111109
input: String? = null,
112110
output: String? = null,
113111
amount: String? = null,
@@ -116,23 +114,6 @@ class SwapFragment : BaseFragment() {
116114
walletId: String? = null,
117115
): SwapFragment =
118116
SwapFragment().withArgs {
119-
when (T::class) {
120-
Web3TokenItem::class -> {
121-
putParcelableArrayList(ARGS_WEB3_TOKENS, arrayListOf<T>().apply {
122-
if (tokens != null) {
123-
addAll(tokens)
124-
}
125-
})
126-
}
127-
128-
TokenItem::class -> {
129-
putParcelableArrayList(ARGS_TOKEN_ITEMS, arrayListOf<T>().apply {
130-
if (tokens != null) {
131-
addAll(tokens)
132-
}
133-
})
134-
}
135-
}
136117
input?.let { putString(ARGS_INPUT, it) }
137118
output?.let { putString(ARGS_OUTPUT, it) }
138119
amount?.let { putString(ARGS_AMOUNT, it) }
@@ -684,7 +665,6 @@ class SwapFragment : BaseFragment() {
684665
}
685666

686667
private suspend fun initFromTo() {
687-
tokenItems = requireArguments().getParcelableArrayListCompat(ARGS_TOKEN_ITEMS, TokenItem::class.java)
688668
var swappable = web3tokens ?: tokenItems
689669
if (!inMixin() && web3tokens.isNullOrEmpty()) {
690670
if (walletId == null) {

app/src/main/java/one/mixin/android/ui/wallet/MarketDetailsFragment.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import one.mixin.android.ui.home.market.Market
3838
import one.mixin.android.ui.home.web3.market.ChooseTokensBottomSheetDialogFragment
3939
import one.mixin.android.ui.home.web3.swap.SwapFragment.Companion.ARGS_INPUT
4040
import one.mixin.android.ui.home.web3.swap.SwapFragment.Companion.ARGS_OUTPUT
41-
import one.mixin.android.ui.home.web3.swap.SwapFragment.Companion.ARGS_TOKEN_ITEMS
4241
import one.mixin.android.ui.wallet.alert.AlertFragment.Companion.ARGS_COIN
4342
import one.mixin.android.ui.wallet.alert.AlertFragment.Companion.ARGS_GO_ALERT
4443
import one.mixin.android.util.viewBinding
@@ -132,7 +131,6 @@ class MarketDetailsFragment : BaseFragment(R.layout.fragment_details_market) {
132131
Bundle().apply {
133132
putString(ARGS_INPUT, input)
134133
putString(ARGS_OUTPUT, nowTokens.first().assetId)
135-
putParcelableArrayList(ARGS_TOKEN_ITEMS, arrayListOf<TokenItem>().apply { addAll(assets.filter { (it.balance.toBigDecimalOrNull()?: BigDecimal.ZERO) > BigDecimal.ZERO }) })
136134
})
137135
} else {
138136
ChooseTokensBottomSheetDialogFragment.newInstance(ArrayList<TokenItem>().apply { addAll(nowTokens) }).apply {
@@ -147,7 +145,6 @@ class MarketDetailsFragment : BaseFragment(R.layout.fragment_details_market) {
147145
Bundle().apply {
148146
putString(ARGS_INPUT, token.assetId)
149147
putString(ARGS_OUTPUT, output)
150-
putParcelableArrayList(ARGS_TOKEN_ITEMS, arrayListOf<TokenItem>().apply { addAll(assets.filter { (it.balance.toBigDecimalOrNull()?: BigDecimal.ZERO) > BigDecimal.ZERO }) })
151148
})
152149
}
153150
}.show(parentFragmentManager, ChooseTokensBottomSheetDialogFragment.TAG)

app/src/main/java/one/mixin/android/ui/wallet/TransactionsFragment.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class TransactionsFragment : BaseFragment(R.layout.fragment_transactions), OnSna
127127
binding.apply {
128128
sendReceiveView.swap.setOnClickListener {
129129
lifecycleScope.launch {
130-
val assets = walletViewModel.allAssetItems()
130+
131131
val output = if (asset.assetId == USDT_ASSET_ETH_ID) {
132132
XIN_ASSET_ID
133133
} else {
@@ -137,9 +137,6 @@ class TransactionsFragment : BaseFragment(R.layout.fragment_transactions), OnSna
137137
SwapActivity.show(
138138
requireActivity(),
139139
inMixin = true,
140-
tokens = assets.filter {
141-
(it.balance.toBigDecimalOrNull() ?: BigDecimal.ZERO) > BigDecimal.ZERO
142-
},
143140
input = asset.assetId,
144141
output = output
145142
)

app/src/main/java/one/mixin/android/ui/web/FloatingManager.kt

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -39,30 +39,34 @@ private var screenshot: Bitmap? = null
3939
fun getScreenshot() = screenshot
4040

4141
fun refreshScreenshot(context: Context, cover: Int? = null) {
42-
MixinApplication.get().currentActivity?.let { activity ->
43-
val rootView: View = activity.window.decorView.findViewById(android.R.id.content)
44-
if (!rootView.isLaidOut) return@let
45-
46-
val screenBitmap = rootView.drawToBitmap()
47-
val resultBitmap =
48-
screenBitmap.scale(screenBitmap.width / 3, screenBitmap.height / 3, false)
49-
50-
val cv = Canvas(resultBitmap)
51-
cv.drawBitmap(resultBitmap, 0f, 0f, Paint())
52-
cv.drawRect(
53-
0f,
54-
0f,
55-
screenBitmap.width.toFloat(),
56-
screenBitmap.height.toFloat(),
57-
Paint().apply {
58-
color = cover ?: if (context.isNightMode()) {
59-
"#CC1C1C1C".toColorInt()
60-
} else {
61-
"#E6F6F7FA".toColorInt()
62-
}
63-
},
64-
)
65-
screenshot = resultBitmap
42+
runCatching {
43+
MixinApplication.get().currentActivity?.let { activity ->
44+
val rootView: View = activity.window.decorView.findViewById(android.R.id.content)
45+
if (!rootView.isLaidOut) return@let
46+
47+
val screenBitmap = rootView.drawToBitmap()
48+
val resultBitmap =
49+
screenBitmap.scale(screenBitmap.width / 3, screenBitmap.height / 3, false)
50+
51+
val cv = Canvas(resultBitmap)
52+
cv.drawBitmap(resultBitmap, 0f, 0f, Paint())
53+
cv.drawRect(
54+
0f,
55+
0f,
56+
screenBitmap.width.toFloat(),
57+
screenBitmap.height.toFloat(),
58+
Paint().apply {
59+
color = cover ?: if (context.isNightMode()) {
60+
"#CC1C1C1C".toColorInt()
61+
} else {
62+
"#E6F6F7FA".toColorInt()
63+
}
64+
},
65+
)
66+
screenshot = resultBitmap
67+
}
68+
}.onFailure {
69+
Timber.e(it)
6670
}
6771
initRenderScript(context)
6872
}

app/src/main/java/one/mixin/android/util/RomUtil.kt

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -62,34 +62,36 @@ object RomUtil {
6262
}
6363

6464
fun check(rom: String): Boolean {
65-
if (sName != null) {
66-
return sName == rom
67-
}
68-
if (!TextUtils.isEmpty(getProp(KEY_VERSION_MIUI).also { sVersion = it })) {
69-
sName = ROM_MIUI
70-
} else if (!TextUtils.isEmpty(getProp(KEY_VERSION_EMUI).also { sVersion = it })) {
71-
sName = ROM_EMUI
72-
} else if (!TextUtils.isEmpty(getProp(KEY_VERSION_OPPO).also { sVersion = it })) {
73-
sName = ROM_OPPO
74-
} else if (!TextUtils.isEmpty(getProp(KEY_VERSION_VIVO).also { sVersion = it })) {
75-
sName = ROM_VIVO
76-
} else if (!TextUtils.isEmpty(
77-
getProp(KEY_VERSION_SMARTISAN).also {
78-
sVersion = it
79-
},
80-
)
81-
) {
82-
sName = ROM_SMARTISAN
83-
} else {
84-
sVersion = Build.DISPLAY
85-
if (sVersion?.uppercase(Locale.getDefault())?.contains(ROM_FLYME) == true) {
86-
sName = ROM_FLYME
65+
return runCatching {
66+
if (sName != null) {
67+
return sName == rom
68+
}
69+
if (!TextUtils.isEmpty(getProp(KEY_VERSION_MIUI).also { sVersion = it })) {
70+
sName = ROM_MIUI
71+
} else if (!TextUtils.isEmpty(getProp(KEY_VERSION_EMUI).also { sVersion = it })) {
72+
sName = ROM_EMUI
73+
} else if (!TextUtils.isEmpty(getProp(KEY_VERSION_OPPO).also { sVersion = it })) {
74+
sName = ROM_OPPO
75+
} else if (!TextUtils.isEmpty(getProp(KEY_VERSION_VIVO).also { sVersion = it })) {
76+
sName = ROM_VIVO
77+
} else if (!TextUtils.isEmpty(
78+
getProp(KEY_VERSION_SMARTISAN).also {
79+
sVersion = it
80+
},
81+
)
82+
) {
83+
sName = ROM_SMARTISAN
8784
} else {
88-
sVersion = Build.UNKNOWN
89-
sName = Build.MANUFACTURER.uppercase(Locale.getDefault())
85+
sVersion = Build.DISPLAY
86+
if (sVersion?.uppercase(Locale.getDefault())?.contains(ROM_FLYME) == true) {
87+
sName = ROM_FLYME
88+
} else {
89+
sVersion = Build.UNKNOWN
90+
sName = Build.MANUFACTURER.uppercase(Locale.getDefault())
91+
}
9092
}
91-
}
92-
return sName == rom
93+
return sName == rom
94+
}.getOrDefault(false)
9395
}
9496

9597
private fun getProp(name: String): String? {

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ buildscript {
44
ext.bitcoinVersion ='0.17'
55
ext.fragmentVersion = '1.8.9'
66
ext.activity_version = '1.11.0'
7-
ext.lifecycleVersion = '2.9.3'
7+
ext.lifecycleVersion = '2.9.4'
88
ext.appcompatVersion = '1.7.1'
99
ext.pagingVersion = '3.3.6'
1010
ext.coilVersion = '3.3.0'
@@ -124,7 +124,7 @@ buildscript {
124124
ext.installreferrerVersion ='2.2'
125125
ext.billingVersion ='8.0.0'
126126

127-
ext.lottieComposeVersion = '6.6.7'
127+
ext.lottieComposeVersion = '6.6.9'
128128
ext.composeBomVersion = '2025.09.00'
129129
ext.activityComposeVersion = '1.11.0'
130130
ext.web3jCoreVersion = '4.11.0'

0 commit comments

Comments
 (0)