Skip to content

Commit 3fb1124

Browse files
committed
chore: fix lint
1 parent 43afcd8 commit 3fb1124

File tree

7 files changed

+34
-36
lines changed

7 files changed

+34
-36
lines changed

app/src/main/java/to/bitkit/ui/utils/WeViewExtensions.kt renamed to app/src/main/java/to/bitkit/ext/WebView.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package to.bitkit.ui.utils
1+
package to.bitkit.ext
22

33
import android.annotation.SuppressLint
44
import android.webkit.WebSettings

app/src/main/java/to/bitkit/ui/MainActivity.kt

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ private fun OnboardingNav(
185185
startupNavController.navigate(StartupRoutes.Slides())
186186
},
187187
onSkipClick = {
188-
startupNavController.navigate(StartupRoutes.Slides(4))
188+
startupNavController.navigate(StartupRoutes.Slides(StartupRoutes.LAST_SLIDE_INDEX))
189189
},
190190
)
191191
}
@@ -197,12 +197,12 @@ private fun OnboardingNav(
197197
onAdvancedSetupClick = { startupNavController.navigate(StartupRoutes.Advanced) },
198198
onCreateClick = {
199199
scope.launch {
200-
try {
200+
runCatching {
201201
appViewModel.resetIsAuthenticatedState()
202202
walletViewModel.setInitNodeLifecycleState()
203203
walletViewModel.createWallet(bip39Passphrase = null)
204-
} catch (e: Throwable) {
205-
appViewModel.toast(e)
204+
}.onFailure {
205+
appViewModel.toast(it)
206206
}
207207
}
208208
},
@@ -228,13 +228,13 @@ private fun OnboardingNav(
228228
onBackClick = { startupNavController.popBackStack() },
229229
onRestoreClick = { mnemonic, passphrase ->
230230
scope.launch {
231-
try {
231+
runCatching {
232232
appViewModel.resetIsAuthenticatedState()
233233
walletViewModel.setInitNodeLifecycleState()
234234
walletViewModel.setRestoringWalletState()
235235
walletViewModel.restoreWallet(mnemonic, passphrase)
236-
} catch (e: Throwable) {
237-
appViewModel.toast(e)
236+
}.onFailure {
237+
appViewModel.toast(it)
238238
}
239239
}
240240
}
@@ -245,12 +245,12 @@ private fun OnboardingNav(
245245
onBackClick = { startupNavController.popBackStack() },
246246
onCreateClick = { passphrase ->
247247
scope.launch {
248-
try {
248+
runCatching {
249249
appViewModel.resetIsAuthenticatedState()
250250
walletViewModel.setInitNodeLifecycleState()
251251
walletViewModel.createWallet(bip39Passphrase = passphrase)
252-
} catch (e: Throwable) {
253-
appViewModel.toast(e)
252+
}.onFailure {
253+
appViewModel.toast(it)
254254
}
255255
}
256256
},
@@ -260,6 +260,8 @@ private fun OnboardingNav(
260260
}
261261

262262
private object StartupRoutes {
263+
const val LAST_SLIDE_INDEX = 4
264+
263265
@Serializable
264266
data object Terms
265267

app/src/main/java/to/bitkit/ui/components/SuggestionCard.kt

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -81,28 +81,27 @@ fun SuggestionCard(
8181
if (isDismissible || disableGlow) {
8282
Modifier.gradientBackground(gradientColor)
8383
} else {
84-
val (shadowColor, borderColor, gradientSelectedColor) = when (gradientColor) {
85-
Colors.Purple24 -> Triple(
86-
Color(130, 65, 175),
87-
Color(185, 92, 232),
88-
Color(65, 32, 80)
89-
)
84+
val (borderColor, centerColor) =
85+
@Suppress("MagicNumber")
86+
when (gradientColor) {
87+
Colors.Purple24 -> Pair(
88+
Color(185, 92, 232),
89+
Color(65, 32, 80)
90+
)
9091

91-
Colors.Red24 -> Triple(
92-
Color(200, 48, 0),
93-
Color(255, 68, 0),
94-
Color(100, 24, 0)
95-
)
92+
Colors.Red24 -> Pair(
93+
Color(255, 68, 0),
94+
Color(100, 24, 0)
95+
)
9696

97-
else -> Triple(
98-
gradientColor,
99-
gradientColor,
100-
gradientColor.copy(alpha = MIN_ALPHA_GRADIENT)
101-
)
102-
}
97+
else -> Pair(
98+
gradientColor,
99+
gradientColor.copy(alpha = MIN_ALPHA_GRADIENT)
100+
)
101+
}
103102

104103
Modifier
105-
.gradientRadialBackground(gradientSelectedColor, glowAlpha)
104+
.gradientRadialBackground(centerColor, glowAlpha)
106105
.border(width = 1.dp, color = borderColor, shape = ShapeDefaults.Large)
107106
}
108107
)

app/src/main/java/to/bitkit/ui/screens/shop/shopDiscover/ShopDiscoverScreen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import androidx.compose.ui.unit.dp
3939
import androidx.compose.ui.viewinterop.AndroidView
4040
import to.bitkit.R
4141
import to.bitkit.env.Env
42+
import to.bitkit.ext.configureForBasicWebContent
4243
import to.bitkit.models.BitrefillCategory
4344
import to.bitkit.ui.components.BodyM
4445
import to.bitkit.ui.components.CaptionB
@@ -53,7 +54,6 @@ import to.bitkit.ui.shared.util.gradientBackground
5354
import to.bitkit.ui.theme.AppThemeSurface
5455
import to.bitkit.ui.theme.Colors
5556
import to.bitkit.ui.theme.Shapes
56-
import to.bitkit.ui.utils.configureForBasicWebContent
5757

5858
private const val SHOP_CARD_SIZE = 164
5959

app/src/main/java/to/bitkit/ui/screens/shop/shopWebView/ShopWebViewScreen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ import androidx.compose.ui.tooling.preview.Preview
1919
import androidx.compose.ui.viewinterop.AndroidView
2020
import to.bitkit.R
2121
import to.bitkit.env.Env
22+
import to.bitkit.ext.configureForBasicWebContent
2223
import to.bitkit.ui.scaffold.AppTopBar
2324
import to.bitkit.ui.scaffold.CloseNavIcon
2425
import to.bitkit.ui.scaffold.ScreenColumn
2526
import to.bitkit.ui.theme.AppThemeSurface
26-
import to.bitkit.ui.utils.configureForBasicWebContent
2727

2828
@SuppressLint("SetJavaScriptEnabled", "JavascriptInterface")
2929
@Composable

app/src/main/java/to/bitkit/ui/utils/Nav.kt renamed to app/src/main/java/to/bitkit/ui/utils/Transitions.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,11 @@ import androidx.navigation.NavBackStackEntry
1818
import androidx.navigation.NavDeepLink
1919
import androidx.navigation.NavGraph
2020
import androidx.navigation.NavGraphBuilder
21-
import androidx.navigation.NavOptionsBuilder
2221
import androidx.navigation.NavType
2322
import androidx.navigation.compose.composable
2423
import androidx.navigation.compose.navigation
2524
import kotlin.reflect.KType
2625

27-
fun NavOptionsBuilder.clearBackStack() = popUpTo(id = 0)
28-
2926
object Transitions {
3027
val slideInHorizontally = slideInHorizontally(animationSpec = tween(), initialOffsetX = { it })
3128
val slideOutHorizontally = slideOutHorizontally(animationSpec = tween(), targetOffsetX = { it })
@@ -38,6 +35,7 @@ object Transitions {
3835
/**
3936
* Adds the [Composable] to the [NavGraphBuilder] with the default screen transitions.
4037
*/
38+
@Suppress("LongParameterList")
4139
inline fun <reified T : Any> NavGraphBuilder.composableWithDefaultTransitions(
4240
typeMap: Map<KType, NavType<*>> = emptyMap(),
4341
deepLinks: List<NavDeepLink> = emptyList(),
@@ -66,10 +64,10 @@ inline fun <reified T : Any> NavGraphBuilder.composableWithDefaultTransitions(
6664
)
6765
}
6866

69-
7067
/**
7168
* Construct a nested [NavGraph] with the default screen transitions.
7269
*/
70+
@Suppress("LongParameterList")
7371
inline fun <reified T : Any> NavGraphBuilder.navigationWithDefaultTransitions(
7472
startDestination: Any,
7573
typeMap: Map<KType, @JvmSuppressWildcards NavType<*>> = emptyMap(),

app/src/main/java/to/bitkit/viewmodels/TransferViewModel.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,6 @@ class TransferViewModel @Inject constructor(
537537

538538
companion object {
539539
private const val TAG = "TransferViewModel"
540-
private const val RETRY_LIMIT = 5
541540
private const val QUARTER = 0.25
542541
}
543542
}

0 commit comments

Comments
 (0)