[#511] Ktlint 0.46.1

This commit is contained in:
Carter Jernigan 2022-06-22 05:48:19 -04:00 committed by GitHub
parent 503d516c8f
commit 45aff80e76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
56 changed files with 122 additions and 68 deletions

View File

@ -1,3 +1,5 @@
@file:Suppress("ktlint:filename")
package co.electriccoin.zcash.crash package co.electriccoin.zcash.crash
import co.electriccoin.zcash.spackle.io.writeAtomically import co.electriccoin.zcash.spackle.io.writeAtomically

View File

@ -1,3 +1,5 @@
@file:Suppress("ktlint:filename")
package co.electriccoin.zcash.crash package co.electriccoin.zcash.crash
import kotlinx.datetime.Instant import kotlinx.datetime.Instant

View File

@ -89,7 +89,7 @@ FLANK_VERSION=21.09.0
FULLADLE_VERSION=0.17.4 FULLADLE_VERSION=0.17.4
GRADLE_VERSIONS_PLUGIN_VERSION=0.42.0 GRADLE_VERSIONS_PLUGIN_VERSION=0.42.0
JGIT_VERSION=6.1.0.202203080745-r JGIT_VERSION=6.1.0.202203080745-r
KTLINT_VERSION=0.45.2 KTLINT_VERSION=0.46.1
PLAY_PUBLISHER_PLUGIN_VERSION=3.7.0 PLAY_PUBLISHER_PLUGIN_VERSION=3.7.0
ACCOMPANIST_PERMISSIONS_VERSION=0.23.1 ACCOMPANIST_PERMISSIONS_VERSION=0.23.1

View File

@ -1,3 +1,5 @@
@file:Suppress("ktlint:filename")
package cash.z.ecc.sdk.test package cash.z.ecc.sdk.test
fun <T> Iterator<T>.count(): Int { fun <T> Iterator<T>.count(): Int {

View File

@ -1,3 +1,5 @@
@file:Suppress("ktlint:filename")
package cash.z.ecc.sdk package cash.z.ecc.sdk
import cash.z.ecc.android.sdk.Synchronizer import cash.z.ecc.android.sdk.Synchronizer

View File

@ -1,3 +1,5 @@
@file:Suppress("ktlint:filename")
package cash.z.ecc.sdk.ext package cash.z.ecc.sdk.ext
import java.nio.charset.Charset import java.nio.charset.Charset

View File

@ -7,6 +7,7 @@ object WalletBirthdayFixture {
const val HEIGHT = 1500000 const val HEIGHT = 1500000
const val HASH = "00047a34c61409682f44640af9352023ad92f69b827d0f2b288f152ebea50f46" const val HASH = "00047a34c61409682f44640af9352023ad92f69b827d0f2b288f152ebea50f46"
const val EPOCH_SECONDS = 1627076501L const val EPOCH_SECONDS = 1627076501L
@Suppress("MaxLineLength") @Suppress("MaxLineLength")
const val TREE = "01172b95f271c6af8f68388f08c8ef970db8ec8d8d61204ecb7b2bb2c38262b92d0010016284585a6c85dadfef27ff33f1403926b4bb391de92e8be797e4280cc4ca2971000001a1ff388639379c0120782b3929bd8871af797be4b651f694aa961bad65a9c12400000001d806c98bda9653d5ae22757eed750871e16e0fb657f52c3d771a4411668e84330001260f6e9fac0922f98d58afbcc3f391ac19d5d944081466929a33b99df19c0e6a0000013d2fd009bf8a22d68f720eac19c411c99014ed9c5f85d5942e15d1fc039e28680001f08f39275112dd8905b854170b7f247cf2df18454d4fa94e6e4f9320cca05f24011f8322ef806eb2430dc4a7a41c1b344bea5be946efc7b4349c1c9edb14ff9d39" const val TREE = "01172b95f271c6af8f68388f08c8ef970db8ec8d8d61204ecb7b2bb2c38262b92d0010016284585a6c85dadfef27ff33f1403926b4bb391de92e8be797e4280cc4ca2971000001a1ff388639379c0120782b3929bd8871af797be4b651f694aa961bad65a9c12400000001d806c98bda9653d5ae22757eed750871e16e0fb657f52c3d771a4411668e84330001260f6e9fac0922f98d58afbcc3f391ac19d5d944081466929a33b99df19c0e6a0000013d2fd009bf8a22d68f720eac19c411c99014ed9c5f85d5942e15d1fc039e28680001f08f39275112dd8905b854170b7f247cf2df18454d4fa94e6e4f9320cca05f24011f8322ef806eb2430dc4a7a41c1b344bea5be946efc7b4349c1c9edb14ff9d39"

View File

@ -7,6 +7,7 @@ import cash.z.ecc.sdk.model.ZecRequestMessage
object ZecRequestFixture { object ZecRequestFixture {
const val ADDRESS: String = WalletAddressFixture.UNIFIED_ADDRESS_STRING const val ADDRESS: String = WalletAddressFixture.UNIFIED_ADDRESS_STRING
@Suppress("MagicNumber") @Suppress("MagicNumber")
val AMOUNT = Zatoshi(123) val AMOUNT = Zatoshi(123)
val MESSAGE = ZecRequestMessage("Thanks for lunch") val MESSAGE = ZecRequestMessage("Thanks for lunch")

View File

@ -11,6 +11,7 @@ object Zip321UriParseFixture {
"for%20your%20purchase" "for%20your%20purchase"
const val ADDRESS: String = WalletAddressFixture.UNIFIED_ADDRESS_STRING const val ADDRESS: String = WalletAddressFixture.UNIFIED_ADDRESS_STRING
@Suppress("MagicNumber") @Suppress("MagicNumber")
val AMOUNT = Zatoshi(123) val AMOUNT = Zatoshi(123)
val MESSAGE = ZecRequestMessage("Thank you for your purchase") val MESSAGE = ZecRequestMessage("Thank you for your purchase")
@ -19,6 +20,6 @@ object Zip321UriParseFixture {
// Should return ZecRequest.fromUri(toParse) ideally, but it'd end up with an infinite loop for now. // Should return ZecRequest.fromUri(toParse) ideally, but it'd end up with an infinite loop for now.
@Suppress("UNUSED_PARAMETER") @Suppress("UNUSED_PARAMETER")
suspend fun new( suspend fun new(
toParse: String = URI, toParse: String = URI
) = ZecRequest(WalletAddress.Unified.new(ADDRESS), AMOUNT, MESSAGE) ) = ZecRequest(WalletAddress.Unified.new(ADDRESS), AMOUNT, MESSAGE)
} }

View File

@ -1,3 +1,5 @@
@file:Suppress("ktlint:filename")
package cash.z.ecc.sdk.type package cash.z.ecc.sdk.type
import android.content.Context import android.content.Context

View File

@ -18,7 +18,6 @@ object ZecSendExt {
memoString: String, memoString: String,
monetarySeparators: MonetarySeparators monetarySeparators: MonetarySeparators
): ZecSendValidation { ): ZecSendValidation {
// This runBlocking shouldn't have a performance impact, since everything needs to be loaded at this point. // This runBlocking shouldn't have a performance impact, since everything needs to be loaded at this point.
// However it would be better to eliminate it entirely. // However it would be better to eliminate it entirely.
val destination = runBlocking { WalletAddress.Unified.new(destinationString) } val destination = runBlocking { WalletAddress.Unified.new(destinationString) }

View File

@ -20,7 +20,8 @@ class AbstractProcessNameContentProviderTest {
} }
val actualProcessName = AbstractProcessNameContentProvider.getProcessNameLegacy( val actualProcessName = AbstractProcessNameContentProvider.getProcessNameLegacy(
ctx, ProviderInfo() ctx,
ProviderInfo()
) )
assertEquals(expectedApplicationProcessName, actualProcessName) assertEquals(expectedApplicationProcessName, actualProcessName)

View File

@ -1,3 +1,5 @@
@file:Suppress("ktlint:filename")
package co.electriccoin.zcash.spackle package co.electriccoin.zcash.spackle
import android.content.Context import android.content.Context

View File

@ -14,6 +14,7 @@ class ZcashUiTestRunner : AndroidJUnitRunner() {
val powerManager = ApplicationProvider.getApplicationContext<Context>() val powerManager = ApplicationProvider.getApplicationContext<Context>()
.getSystemService(Context.POWER_SERVICE) as PowerManager .getSystemService(Context.POWER_SERVICE) as PowerManager
// There is no alternative to this deprecated API. The suggestion of a view to keep the screen // There is no alternative to this deprecated API. The suggestion of a view to keep the screen
// on won't work well for our tests. // on won't work well for our tests.
@Suppress("DEPRECATION") @Suppress("DEPRECATION")

View File

@ -34,7 +34,7 @@ fun PrimaryButton(
onClick: () -> Unit, onClick: () -> Unit,
text: String, text: String,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
enabled: Boolean = true, enabled: Boolean = true
) { ) {
Button( Button(
onClick = onClick, onClick = onClick,

View File

@ -27,13 +27,13 @@ fun ComposablePreview() {
fun Chip( fun Chip(
index: Index, index: Index,
text: String, text: String,
modifier: Modifier = Modifier, modifier: Modifier = Modifier
) { ) {
Surface( Surface(
modifier = modifier.then(Modifier.padding(4.dp)), modifier = modifier.then(Modifier.padding(4.dp)),
shape = RoundedCornerShape(8.dp), shape = RoundedCornerShape(8.dp),
color = MaterialTheme.colorScheme.secondary, color = MaterialTheme.colorScheme.secondary,
shadowElevation = 8.dp, shadowElevation = 8.dp
) { ) {
Row( Row(
modifier = Modifier modifier = Modifier
@ -42,7 +42,7 @@ fun Chip(
Text( Text(
text = (index.value + 1).toString(), text = (index.value + 1).toString(),
style = ZcashTheme.typography.chipIndex, style = ZcashTheme.typography.chipIndex,
color = ZcashTheme.colors.chipIndex, color = ZcashTheme.colors.chipIndex
) )
Spacer(modifier = Modifier.padding(horizontal = 2.dp, vertical = 0.dp)) Spacer(modifier = Modifier.padding(horizontal = 2.dp, vertical = 0.dp))
Text( Text(

View File

@ -1,3 +1,5 @@
@file:Suppress("ktlint:filename")
package co.electriccoin.zcash.ui.design.component package co.electriccoin.zcash.ui.design.component
import androidx.compose.material3.LinearProgressIndicator import androidx.compose.material3.LinearProgressIndicator
@ -11,8 +13,10 @@ import co.electriccoin.zcash.ui.design.theme.ZcashTheme
fun PinkProgress(progress: Progress, modifier: Modifier = Modifier) { fun PinkProgress(progress: Progress, modifier: Modifier = Modifier) {
// Needs custom implementation to apply gradient // Needs custom implementation to apply gradient
LinearProgressIndicator( LinearProgressIndicator(
progress = progress.percent(), modifier, progress = progress.percent(),
ZcashTheme.colors.progressStart, ZcashTheme.colors.progressBackground modifier,
ZcashTheme.colors.progressStart,
ZcashTheme.colors.progressBackground
) )
} }

View File

@ -117,7 +117,7 @@ internal val DarkColorPalette = darkColorScheme(
surface = Dark.backgroundStart, surface = Dark.backgroundStart,
onSurface = Dark.textBodyOnBackground, onSurface = Dark.textBodyOnBackground,
background = Dark.backgroundStart, background = Dark.backgroundStart,
onBackground = Dark.textBodyOnBackground, onBackground = Dark.textBodyOnBackground
) )
internal val LightColorPalette = lightColorScheme( internal val LightColorPalette = lightColorScheme(
@ -128,7 +128,7 @@ internal val LightColorPalette = lightColorScheme(
surface = Light.backgroundStart, surface = Light.backgroundStart,
onSurface = Light.textBodyOnBackground, onSurface = Light.textBodyOnBackground,
background = Light.backgroundStart, background = Light.backgroundStart,
onBackground = Light.textBodyOnBackground, onBackground = Light.textBodyOnBackground
) )
internal val DarkExtendedColorPalette = ExtendedColors( internal val DarkExtendedColorPalette = ExtendedColors(

View File

@ -39,7 +39,7 @@ internal val Typography = Typography(
headlineLarge = TextStyle( headlineLarge = TextStyle(
fontFamily = RubikFontFamily, fontFamily = RubikFontFamily,
fontWeight = FontWeight.SemiBold, fontWeight = FontWeight.SemiBold,
fontSize = 30.sp, fontSize = 30.sp
), ),
bodyLarge = TextStyle( bodyLarge = TextStyle(
fontFamily = RubikFontFamily, fontFamily = RubikFontFamily,
@ -55,13 +55,13 @@ internal val Typography = Typography(
fontFamily = RubikFontFamily, fontFamily = RubikFontFamily,
fontWeight = FontWeight.Normal, fontWeight = FontWeight.Normal,
fontSize = 16.sp fontSize = 16.sp
), )
) )
@Immutable @Immutable
data class ExtendedTypography( data class ExtendedTypography(
val chipIndex: TextStyle, val chipIndex: TextStyle,
val listItem: TextStyle, val listItem: TextStyle
) )
val LocalExtendedTypography = staticCompositionLocalOf { val LocalExtendedTypography = staticCompositionLocalOf {

View File

@ -1,4 +1,4 @@
package co.electriccoin.zcash.ui.screen.wallet_address.view package co.electriccoin.zcash.ui.screen.address.view
import androidx.compose.ui.test.junit4.ComposeContentTestRule import androidx.compose.ui.test.junit4.ComposeContentTestRule
import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.junit4.createComposeRule

View File

@ -206,6 +206,7 @@ class RequestViewTest : UiTestPrerequisites() {
private val onBackCount = AtomicInteger(0) private val onBackCount = AtomicInteger(0)
private val onCreateCount = AtomicInteger(0) private val onCreateCount = AtomicInteger(0)
@Volatile @Volatile
private var onCreateZecRequest: ZecRequest? = null private var onCreateZecRequest: ZecRequest? = null

View File

@ -227,7 +227,7 @@ class RestoreViewTest : UiTestPrerequisites() {
paste = { "" }, paste = { "" },
onFinished = { onFinished = {
onFinishedCount.incrementAndGet() onFinishedCount.incrementAndGet()
}, }
) )
} }
} }

View File

@ -31,7 +31,7 @@ class UpdateViewIntegrationTest {
priority = AppUpdateChecker.Priority.HIGH, priority = AppUpdateChecker.Priority.HIGH,
force = true, force = true,
appUpdateInfo = null, appUpdateInfo = null,
state = UpdateState.Prepared, state = UpdateState.Prepared
) )
) )

View File

@ -58,7 +58,6 @@ class AppUpdateCheckerImpTest {
@MediumTest @MediumTest
@OptIn(ExperimentalCoroutinesApi::class) @OptIn(ExperimentalCoroutinesApi::class)
fun start_update_availability_test() = runTest { fun start_update_availability_test() = runTest {
getAppUpdateInfoFlow().onFirst { updateInfo -> getAppUpdateInfoFlow().onFirst { updateInfo ->
// In case we get result with FAILED state, e.g. app is still not released in the Google // In case we get result with FAILED state, e.g. app is still not released in the Google
// Play store, there is no way to continue with the test. // Play store, there is no way to continue with the test.

View File

@ -33,7 +33,7 @@ class UpdateViewTest : UiTestPrerequisites() {
priority = AppUpdateChecker.Priority.HIGH, priority = AppUpdateChecker.Priority.HIGH,
force = true, force = true,
appUpdateInfo = null, appUpdateInfo = null,
state = UpdateState.Prepared, state = UpdateState.Prepared
) )
newTestSetup(updateInfo) newTestSetup(updateInfo)
@ -58,7 +58,7 @@ class UpdateViewTest : UiTestPrerequisites() {
priority = AppUpdateChecker.Priority.LOW, priority = AppUpdateChecker.Priority.LOW,
force = false, force = false,
appUpdateInfo = null, appUpdateInfo = null,
state = UpdateState.Prepared, state = UpdateState.Prepared
) )
val testSetup = newTestSetup(updateInfo) val testSetup = newTestSetup(updateInfo)
@ -76,7 +76,7 @@ class UpdateViewTest : UiTestPrerequisites() {
priority = AppUpdateChecker.Priority.MEDIUM, priority = AppUpdateChecker.Priority.MEDIUM,
force = false, force = false,
appUpdateInfo = null, appUpdateInfo = null,
state = UpdateState.Prepared, state = UpdateState.Prepared
) )
newTestSetup(updateInfo) newTestSetup(updateInfo)
@ -99,7 +99,7 @@ class UpdateViewTest : UiTestPrerequisites() {
priority = AppUpdateChecker.Priority.HIGH, priority = AppUpdateChecker.Priority.HIGH,
force = true, force = true,
appUpdateInfo = null, appUpdateInfo = null,
state = UpdateState.Prepared, state = UpdateState.Prepared
) )
val testSetup = newTestSetup(updateInfo) val testSetup = newTestSetup(updateInfo)

View File

@ -125,7 +125,8 @@ class WalletCoordinator(context: Context) {
} }
} }
.stateIn( .stateIn(
walletScope, SharingStarted.WhileSubscribed(), walletScope,
SharingStarted.WhileSubscribed(),
null null
) )

View File

@ -29,6 +29,7 @@ import co.electriccoin.zcash.ui.design.component.GradientSurface
import co.electriccoin.zcash.ui.design.component.Override import co.electriccoin.zcash.ui.design.component.Override
import co.electriccoin.zcash.ui.design.theme.ZcashTheme import co.electriccoin.zcash.ui.design.theme.ZcashTheme
import co.electriccoin.zcash.ui.screen.about.WrapAbout import co.electriccoin.zcash.ui.screen.about.WrapAbout
import co.electriccoin.zcash.ui.screen.address.view.WalletAddresses
import co.electriccoin.zcash.ui.screen.backup.WrapBackup import co.electriccoin.zcash.ui.screen.backup.WrapBackup
import co.electriccoin.zcash.ui.screen.backup.copyToClipboard import co.electriccoin.zcash.ui.screen.backup.copyToClipboard
import co.electriccoin.zcash.ui.screen.home.WrapHome import co.electriccoin.zcash.ui.screen.home.WrapHome
@ -47,7 +48,6 @@ import co.electriccoin.zcash.ui.screen.support.WrapSupport
import co.electriccoin.zcash.ui.screen.update.AppUpdateCheckerImp import co.electriccoin.zcash.ui.screen.update.AppUpdateCheckerImp
import co.electriccoin.zcash.ui.screen.update.WrapUpdate import co.electriccoin.zcash.ui.screen.update.WrapUpdate
import co.electriccoin.zcash.ui.screen.update.model.UpdateState import co.electriccoin.zcash.ui.screen.update.model.UpdateState
import co.electriccoin.zcash.ui.screen.wallet_address.view.WalletAddresses
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
@ -265,7 +265,7 @@ class MainActivity : ComponentActivity() {
@Composable @Composable
private fun WrapWalletAddresses( private fun WrapWalletAddresses(
goBack: () -> Unit, goBack: () -> Unit
) { ) {
val walletAddresses = walletViewModel.addresses.collectAsState().value val walletAddresses = walletViewModel.addresses.collectAsState().value
if (null == walletAddresses) { if (null == walletAddresses) {
@ -321,7 +321,7 @@ class MainActivity : ComponentActivity() {
startActivity(chooserIntent) startActivity(chooserIntent)
goBack() goBack()
}, }
) )
} }
} }
@ -343,7 +343,7 @@ class MainActivity : ComponentActivity() {
synchronizer.send(spendingKey, it) synchronizer.send(spendingKey, it)
goBack() goBack()
}, }
) )
} }
} }

View File

@ -1,3 +1,5 @@
@file:Suppress("ktlint:filename")
package co.electriccoin.zcash.ui.common package co.electriccoin.zcash.ui.common
fun <T> List<T>.first(count: Int) = subList(0, minOf(size, count)) fun <T> List<T>.first(count: Int) = subList(0, minOf(size, count))

View File

@ -8,7 +8,7 @@ object TestChoicesFixture {
val INITIAL_CHOICES = val INITIAL_CHOICES =
mapOf( mapOf(
Pair(Index(0), "baz"), Pair(Index(0), "baz"),
Pair(Index(1), "foo"), Pair(Index(1), "foo")
) )
fun new(initial: Map<Index, String?> = INITIAL_CHOICES) = TestChoices(initial) fun new(initial: Map<Index, String?> = INITIAL_CHOICES) = TestChoices(initial)

View File

@ -1,3 +1,5 @@
@file:Suppress("ktlint:filename")
package co.electriccoin.zcash.ui.screen.about package co.electriccoin.zcash.ui.screen.about
import androidx.activity.ComponentActivity import androidx.activity.ComponentActivity

View File

@ -44,7 +44,7 @@ fun AboutPreview() {
@Composable @Composable
fun About( fun About(
versionInfo: VersionInfo, versionInfo: VersionInfo,
goBack: () -> Unit, goBack: () -> Unit
) { ) {
Scaffold(topBar = { Scaffold(topBar = {
AboutTopAppBar(onBack = goBack) AboutTopAppBar(onBack = goBack)

View File

@ -1,6 +1,6 @@
@file:Suppress("TooManyFunctions", "PackageNaming") @file:Suppress("TooManyFunctions")
package co.electriccoin.zcash.ui.screen.wallet_address.view package co.electriccoin.zcash.ui.screen.address.view
import androidx.compose.foundation.Image import androidx.compose.foundation.Image
import androidx.compose.foundation.border import androidx.compose.foundation.border

View File

@ -36,7 +36,8 @@ internal fun WrapBackup(
val backupViewModel by activity.viewModels<BackupViewModel>() val backupViewModel by activity.viewModels<BackupViewModel>()
WrapBackup( WrapBackup(
persistableWallet, backupViewModel.backupState, persistableWallet,
backupViewModel.backupState,
onCopyToClipboard = { copyToClipboard(activity.applicationContext, persistableWallet) }, onCopyToClipboard = { copyToClipboard(activity.applicationContext, persistableWallet) },
onBackupComplete = onBackupComplete onBackupComplete = onBackupComplete
) )

View File

@ -22,8 +22,9 @@ private fun TestChoices.toSaverMap() = buildMap {
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
private fun fromSaverMap(map: Map<String, Any?>): Map<Index, String?> { private fun fromSaverMap(map: Map<String, Any?>): Map<Index, String?> {
return if (map.isEmpty()) return if (map.isEmpty()) {
emptyMap() emptyMap()
else } else {
(map[KEY_TEST_CHOICES] as Map<Int, String?>).mapKeys { Index(it.key) } (map[KEY_TEST_CHOICES] as Map<Int, String?>).mapKeys { Index(it.key) }
}
} }

View File

@ -67,7 +67,7 @@ fun BackupWallet(
choices: TestChoices, choices: TestChoices,
onCopyToClipboard: () -> Unit, onCopyToClipboard: () -> Unit,
onComplete: () -> Unit, onComplete: () -> Unit,
onChoicesChanged: ((choicesCount: Int) -> Unit)?, onChoicesChanged: ((choicesCount: Int) -> Unit)?
) { ) {
Column { Column {
when (backupState.current.collectAsState().value) { when (backupState.current.collectAsState().value) {
@ -185,7 +185,7 @@ private fun TestInProgress(
splitSeedPhrase: List<String>, splitSeedPhrase: List<String>,
selectedTestChoices: TestChoices, selectedTestChoices: TestChoices,
onBack: () -> Unit, onBack: () -> Unit,
onChoicesChanged: ((choicesCount: Int) -> Unit)?, onChoicesChanged: ((choicesCount: Int) -> Unit)?
) { ) {
val testChoices = splitSeedPhrase val testChoices = splitSeedPhrase
.mapIndexed { index, word -> TestChoice(Index(index), word) } .mapIndexed { index, word -> TestChoice(Index(index), word) }
@ -224,8 +224,9 @@ private fun TestInProgress(
this[currentIndex] = testChoices[it.value].word this[currentIndex] = testChoices[it.value].word
} }
) )
if (onChoicesChanged != null) if (onChoicesChanged != null) {
onChoicesChanged(selectedTestChoices.current.value.size) onChoicesChanged(selectedTestChoices.current.value.size)
}
} }
} else { } else {
Chip( Chip(

View File

@ -1,3 +1,5 @@
@file:Suppress("ktlint:filename")
package co.electriccoin.zcash.ui.screen.backup.view package co.electriccoin.zcash.ui.screen.backup.view
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
@ -55,13 +57,13 @@ fun ChipDropDown(
color = MaterialTheme.colorScheme.secondary, color = MaterialTheme.colorScheme.secondary,
contentColor = MaterialTheme.colorScheme.secondary, contentColor = MaterialTheme.colorScheme.secondary,
tonalElevation = 8.dp, tonalElevation = 8.dp,
shadowElevation = 8.dp, shadowElevation = 8.dp
) { ) {
Row(modifier = Modifier.padding(8.dp)) { Row(modifier = Modifier.padding(8.dp)) {
Text( Text(
text = (chipIndex.value + 1).toString(), text = (chipIndex.value + 1).toString(),
style = ZcashTheme.typography.chipIndex, style = ZcashTheme.typography.chipIndex,
color = ZcashTheme.colors.chipIndex, color = ZcashTheme.colors.chipIndex
) )
Spacer(modifier = Modifier.padding(horizontal = 2.dp, vertical = 0.dp)) Spacer(modifier = Modifier.padding(horizontal = 2.dp, vertical = 0.dp))
Text( Text(

View File

@ -1,3 +1,5 @@
@file:Suppress("ktlint:filename")
package co.electriccoin.zcash.ui.screen.home package co.electriccoin.zcash.ui.screen.home
import androidx.activity.ComponentActivity import androidx.activity.ComponentActivity

View File

@ -127,7 +127,8 @@ class WalletViewModel(application: Application) : AndroidViewModel(application)
} }
} }
.stateIn( .stateIn(
viewModelScope, SharingStarted.WhileSubscribed(ANDROID_STATE_FLOW_TIMEOUT), viewModelScope,
SharingStarted.WhileSubscribed(ANDROID_STATE_FLOW_TIMEOUT),
emptyList() emptyList()
) )
@ -136,7 +137,8 @@ class WalletViewModel(application: Application) : AndroidViewModel(application)
.filterIsInstance<SecretState.Ready>() .filterIsInstance<SecretState.Ready>()
.map { WalletAddresses.new(it.persistableWallet) } .map { WalletAddresses.new(it.persistableWallet) }
.stateIn( .stateIn(
viewModelScope, SharingStarted.WhileSubscribed(ANDROID_STATE_FLOW_TIMEOUT), viewModelScope,
SharingStarted.WhileSubscribed(ANDROID_STATE_FLOW_TIMEOUT),
null null
) )
@ -269,7 +271,7 @@ private fun Synchronizer.toTransactions() =
clearedTransactions.distinctUntilChanged(), clearedTransactions.distinctUntilChanged(),
pendingTransactions.distinctUntilChanged(), pendingTransactions.distinctUntilChanged(),
sentTransactions.distinctUntilChanged(), sentTransactions.distinctUntilChanged(),
receivedTransactions.distinctUntilChanged(), receivedTransactions.distinctUntilChanged()
) { cleared, pending, sent, received -> ) { cleared, pending, sent, received ->
// TODO [#157]: Sort the transactions to show the most recent // TODO [#157]: Sort the transactions to show the most recent
buildList<Transaction> { buildList<Transaction> {

View File

@ -1,3 +1,5 @@
@file:Suppress("ktlint:filename")
package co.electriccoin.zcash.ui.screen.onboarding package co.electriccoin.zcash.ui.screen.onboarding
import android.content.ClipboardManager import android.content.ClipboardManager

View File

@ -83,7 +83,7 @@ fun Onboarding(
isDebugMenuEnabled: Boolean, isDebugMenuEnabled: Boolean,
onImportWallet: () -> Unit, onImportWallet: () -> Unit,
onCreateWallet: () -> Unit, onCreateWallet: () -> Unit,
onFixtureWallet: () -> Unit, onFixtureWallet: () -> Unit
) { ) {
Scaffold( Scaffold(
topBar = { topBar = {
@ -270,7 +270,8 @@ private fun Wallet(onCreateWallet: () -> Unit, onImportWallet: () -> Unit) {
Body(stringResource(R.string.onboarding_4_body)) Body(stringResource(R.string.onboarding_4_body))
PrimaryButton(onCreateWallet, stringResource(R.string.onboarding_4_create_new_wallet), Modifier.fillMaxWidth()) PrimaryButton(onCreateWallet, stringResource(R.string.onboarding_4_create_new_wallet), Modifier.fillMaxWidth())
TertiaryButton( TertiaryButton(
onImportWallet, stringResource(R.string.onboarding_4_import_existing_wallet), onImportWallet,
stringResource(R.string.onboarding_4_import_existing_wallet),
Modifier.fillMaxWidth() Modifier.fillMaxWidth()
) )
} }

View File

@ -1,3 +1,5 @@
@file:Suppress("ktlint:filename")
package co.electriccoin.zcash.ui.screen.profile package co.electriccoin.zcash.ui.screen.profile
import androidx.activity.ComponentActivity import androidx.activity.ComponentActivity

View File

@ -92,7 +92,7 @@ private fun ProfileTopAppBar(onBack: () -> Unit) {
) { ) {
Icon( Icon(
imageVector = Icons.Filled.ArrowBack, imageVector = Icons.Filled.ArrowBack,
contentDescription = stringResource(R.string.profile_back_content_description), contentDescription = stringResource(R.string.profile_back_content_description)
) )
} }
} }

View File

@ -63,7 +63,7 @@ fun PreviewRequest() {
fun Request( fun Request(
myAddress: WalletAddress.Unified, myAddress: WalletAddress.Unified,
goBack: () -> Unit, goBack: () -> Unit,
onCreateAndSend: (ZecRequest) -> Unit, onCreateAndSend: (ZecRequest) -> Unit
) { ) {
Scaffold(topBar = { Scaffold(topBar = {
RequestTopAppBar(onBack = goBack) RequestTopAppBar(onBack = goBack)

View File

@ -254,7 +254,8 @@ private fun ChipGridWithText(
Modifier Modifier
.focusRequester(focusRequester) .focusRequester(focusRequester)
.weight((CHIP_GRID_ROW_SIZE - chunk.size) * singleItemWeight), .weight((CHIP_GRID_ROW_SIZE - chunk.size) * singleItemWeight),
text, setText text,
setText
) )
} }
} }
@ -273,7 +274,8 @@ private fun NextWordTextField(modifier: Modifier = Modifier, text: String, setTe
* Treat the user input as a password, but disable the transformation to obscure input. * Treat the user input as a password, but disable the transformation to obscure input.
*/ */
TextField( TextField(
value = text, onValueChange = setText, value = text,
onValueChange = setText,
modifier = modifier modifier = modifier
.fillMaxWidth() .fillMaxWidth()
.height(IntrinsicSize.Max) .height(IntrinsicSize.Max)
@ -281,7 +283,9 @@ private fun NextWordTextField(modifier: Modifier = Modifier, text: String, setTe
visualTransformation = VisualTransformation.None, visualTransformation = VisualTransformation.None,
keyboardOptions = KeyboardOptions( keyboardOptions = KeyboardOptions(
KeyboardCapitalization.None, KeyboardCapitalization.None,
autoCorrect = false, imeAction = ImeAction.Done, keyboardType = KeyboardType.Password autoCorrect = false,
imeAction = ImeAction.Done,
keyboardType = KeyboardType.Password
), ),
keyboardActions = KeyboardActions(onAny = {}) keyboardActions = KeyboardActions(onAny = {})
) )

View File

@ -1,3 +1,5 @@
@file:Suppress("ktlint:filename")
package co.electriccoin.zcash.ui.screen.scan package co.electriccoin.zcash.ui.screen.scan
import androidx.activity.ComponentActivity import androidx.activity.ComponentActivity

View File

@ -13,13 +13,13 @@ import java.nio.ByteBuffer
// TODO [#437]: https://github.com/zcash/secant-android-wallet/issues/437 // TODO [#437]: https://github.com/zcash/secant-android-wallet/issues/437
class QrCodeAnalyzer( class QrCodeAnalyzer(
private val onQrCodeScanned: (String) -> Unit, private val onQrCodeScanned: (String) -> Unit
) : ImageAnalysis.Analyzer { ) : ImageAnalysis.Analyzer {
private val supportedImageFormats = listOf( private val supportedImageFormats = listOf(
ImageFormat.YUV_420_888, ImageFormat.YUV_420_888,
ImageFormat.YUV_422_888, ImageFormat.YUV_422_888,
ImageFormat.YUV_444_888, ImageFormat.YUV_444_888
) )
override fun analyze(image: ImageProxy) { override fun analyze(image: ImageProxy) {

View File

@ -98,11 +98,11 @@ fun Scan(
onBack: () -> Unit, onBack: () -> Unit,
onScanned: (String) -> Unit, onScanned: (String) -> Unit,
onOpenSettings: () -> Unit, onOpenSettings: () -> Unit,
onScanStateChanged: (ScanState) -> Unit, onScanStateChanged: (ScanState) -> Unit
) { ) {
Scaffold( Scaffold(
topBar = { ScanTopAppBar(onBack = onBack) }, topBar = { ScanTopAppBar(onBack = onBack) },
snackbarHost = { SnackbarHost(snackbarHostState) }, snackbarHost = { SnackbarHost(snackbarHostState) }
) { paddingValues -> ) { paddingValues ->
ScanMainContent( ScanMainContent(
paddingValues, paddingValues,
@ -210,8 +210,9 @@ private fun ScanMainContent(
} else if (scanState == ScanState.Failed) { } else if (scanState == ScanState.Failed) {
// keep current state // keep current state
} else if (permissionState.hasPermission) { } else if (permissionState.hasPermission) {
if (scanState != ScanState.Scanning) if (scanState != ScanState.Scanning) {
setScanState(ScanState.Scanning) setScanState(ScanState.Scanning)
}
} }
// we calculate the best frame size for the current device screen // we calculate the best frame size for the current device screen
@ -271,7 +272,7 @@ private fun ScanMainContent(
onScanStateChanged(ScanState.Failed) onScanStateChanged(ScanState.Failed)
val snackbarResult = snackbarHostState.showSnackbar( val snackbarResult = snackbarHostState.showSnackbar(
message = context.getString(R.string.scan_setup_failed), message = context.getString(R.string.scan_setup_failed),
actionLabel = context.getString(R.string.scan_setup_back), actionLabel = context.getString(R.string.scan_setup_back)
) )
if (snackbarResult == SnackbarResult.ActionPerformed) { if (snackbarResult == SnackbarResult.ActionPerformed) {
onBack() onBack()

View File

@ -68,7 +68,7 @@ fun PreviewSend() {
fun Send( fun Send(
mySpendableBalance: Zatoshi, mySpendableBalance: Zatoshi,
goBack: () -> Unit, goBack: () -> Unit,
onCreateAndSend: (ZecSend) -> Unit, onCreateAndSend: (ZecSend) -> Unit
) { ) {
// For now, we're avoiding sub-navigation to keep the navigation logic simple. But this might // For now, we're avoiding sub-navigation to keep the navigation logic simple. But this might
// change once deep-linking support is added. It depends on whether deep linking should do one of: // change once deep-linking support is added. It depends on whether deep linking should do one of:

View File

@ -1,3 +1,5 @@
@file:Suppress("ktlint:filename")
package co.electriccoin.zcash.ui.screen.settings package co.electriccoin.zcash.ui.screen.settings
import androidx.activity.ComponentActivity import androidx.activity.ComponentActivity
@ -39,7 +41,8 @@ private fun WrapSettings(
onBackupWallet = goWalletBackup, onBackupWallet = goWalletBackup,
onRescanWallet = { onRescanWallet = {
walletViewModel.rescanBlockchain() walletViewModel.rescanBlockchain()
}, onWipeWallet = { },
onWipeWallet = {
walletViewModel.wipeEntireWallet() walletViewModel.wipeEntireWallet()
val onboardingViewModel by activity.viewModels<OnboardingViewModel>() val onboardingViewModel by activity.viewModels<OnboardingViewModel>()

View File

@ -42,7 +42,7 @@ fun Settings(
onBack: () -> Unit, onBack: () -> Unit,
onBackupWallet: () -> Unit, onBackupWallet: () -> Unit,
onWipeWallet: () -> Unit, onWipeWallet: () -> Unit,
onRescanWallet: () -> Unit, onRescanWallet: () -> Unit
) { ) {
Scaffold(topBar = { Scaffold(topBar = {
SettingsTopAppBar(onBack = onBack) SettingsTopAppBar(onBack = onBack)

View File

@ -1,3 +1,5 @@
@file:Suppress("ktlint:filename")
package co.electriccoin.zcash.ui.screen.support package co.electriccoin.zcash.ui.screen.support
import android.content.Intent import android.content.Intent

View File

@ -36,7 +36,7 @@ class TimeInfo(
currentTime = currentTime, currentTime = currentTime,
rebootTime = currentTime - elapsedRealtime, rebootTime = currentTime - elapsedRealtime,
installTime = Instant.fromEpochMilliseconds(packageInfo.firstInstallTime), installTime = Instant.fromEpochMilliseconds(packageInfo.firstInstallTime),
updateTime = Instant.fromEpochMilliseconds(packageInfo.lastUpdateTime), updateTime = Instant.fromEpochMilliseconds(packageInfo.lastUpdateTime)
) )
} }
} }

View File

@ -48,7 +48,7 @@ fun PreviewSupport() {
fun Support( fun Support(
snackbarHostState: SnackbarHostState, snackbarHostState: SnackbarHostState,
onBack: () -> Unit, onBack: () -> Unit,
onSend: (String) -> Unit, onSend: (String) -> Unit
) { ) {
val (message, setMessage) = rememberSaveable { mutableStateOf("") } val (message, setMessage) = rememberSaveable { mutableStateOf("") }
val (isShowingDialog, setShowDialog) = rememberSaveable { mutableStateOf(false) } val (isShowingDialog, setShowDialog) = rememberSaveable { mutableStateOf(false) }
@ -56,7 +56,8 @@ fun Support(
Scaffold( Scaffold(
topBar = { topBar = {
SupportTopAppBar(onBack = onBack) SupportTopAppBar(onBack = onBack)
}, snackbarHost = { SnackbarHost(snackbarHostState) }, },
snackbarHost = { SnackbarHost(snackbarHostState) },
floatingActionButton = { floatingActionButton = {
FloatingActionButton(onClick = { setShowDialog(true) }) { FloatingActionButton(onClick = { setShowDialog(true) }) {
Icon( Icon(
@ -131,20 +132,20 @@ private fun SupportConfirmationDialog(
}, },
confirmButton = { confirmButton = {
Button( Button(
onClick = onConfirm, onClick = onConfirm
) { ) {
Text(stringResource(id = R.string.support_confirmation_dialog_ok)) Text(stringResource(id = R.string.support_confirmation_dialog_ok))
} }
}, },
dismissButton = { dismissButton = {
Button( Button(
onClick = onDismiss, onClick = onDismiss
) { ) {
Text(stringResource(id = R.string.support_confirmation_dialog_cancel)) Text(stringResource(id = R.string.support_confirmation_dialog_cancel))
} }
}, },
text = { text = {
Text(stringResource(id = R.string.support_confirmation_explanation, stringResource(id = R.string.app_name))) Text(stringResource(id = R.string.support_confirmation_explanation, stringResource(id = R.string.app_name)))
}, }
) )
} }

View File

@ -88,7 +88,7 @@ internal fun WrapUpdate(
fun openPlayStoreAppPage( fun openPlayStoreAppPage(
context: Context, context: Context,
snackbarHostState: SnackbarHostState, snackbarHostState: SnackbarHostState,
scope: CoroutineScope, scope: CoroutineScope
) { ) {
val storeIntent = PlayStoreUtil.newActivityIntent(context) val storeIntent = PlayStoreUtil.newActivityIntent(context)
runCatching { runCatching {

View File

@ -45,7 +45,7 @@ interface AppUpdateChecker {
} }
fun newCheckForUpdateAvailabilityFlow( fun newCheckForUpdateAvailabilityFlow(
context: Context, context: Context
): Flow<UpdateInfo> ): Flow<UpdateInfo>
fun newStartUpdateFlow( fun newStartUpdateFlow(

View File

@ -125,7 +125,7 @@ private fun UpdateTopAppBar(updateInfo: UpdateInfo) {
} }
) )
) )
}, }
) )
} }