[#1008] SecureScreen customization
* [#1008] Customizing SecureScreen mechanism Tested with an unexpected value in checkProperties too.
This commit is contained in:
parent
16bf1afa90
commit
5010c624a8
|
@ -207,6 +207,7 @@ val googlePlayServiceKeyFilePath = project.property("ZCASH_GOOGLE_PLAY_SERVICE_K
|
||||||
androidComponents {
|
androidComponents {
|
||||||
onVariants { variant ->
|
onVariants { variant ->
|
||||||
for (output in variant.outputs) {
|
for (output in variant.outputs) {
|
||||||
|
// Configure strict mode in runtime
|
||||||
variant.buildConfigFields.put(
|
variant.buildConfigFields.put(
|
||||||
"IS_STRICT_MODE_CRASH_ENABLED",
|
"IS_STRICT_MODE_CRASH_ENABLED",
|
||||||
BuildConfigField(
|
BuildConfigField(
|
||||||
|
|
|
@ -101,6 +101,7 @@ tasks {
|
||||||
"ZCASH_RELEASE_APP_NAME" to "Zashi",
|
"ZCASH_RELEASE_APP_NAME" to "Zashi",
|
||||||
"ZCASH_RELEASE_PACKAGE_NAME" to "co.electriccoin.zcash",
|
"ZCASH_RELEASE_PACKAGE_NAME" to "co.electriccoin.zcash",
|
||||||
"ZCASH_SUPPORT_EMAIL_ADDRESS" to "support@electriccoin.co",
|
"ZCASH_SUPPORT_EMAIL_ADDRESS" to "support@electriccoin.co",
|
||||||
|
"IS_SECURE_SCREEN_PROTECTION_ACTIVE" to "true",
|
||||||
|
|
||||||
"ZCASH_DEBUG_KEYSTORE_PATH" to "",
|
"ZCASH_DEBUG_KEYSTORE_PATH" to "",
|
||||||
"ZCASH_RELEASE_KEYSTORE_PATH" to "",
|
"ZCASH_RELEASE_KEYSTORE_PATH" to "",
|
||||||
|
|
|
@ -61,6 +61,10 @@ ZCASH_RELEASE_PACKAGE_NAME=co.electriccoin.zcash
|
||||||
ZCASH_DEBUG_APP_NAME_SUFFIX=" (D)"
|
ZCASH_DEBUG_APP_NAME_SUFFIX=" (D)"
|
||||||
ZCASH_SUPPORT_EMAIL_ADDRESS=support@electriccoin.co
|
ZCASH_SUPPORT_EMAIL_ADDRESS=support@electriccoin.co
|
||||||
|
|
||||||
|
# Recommended protection of screens with sensitive data.
|
||||||
|
# It is enabled by default to protect the developers from revealing their wallet secrets by mistake.
|
||||||
|
IS_SECURE_SCREEN_PROTECTION_ACTIVE=true
|
||||||
|
|
||||||
# Set keystore details to enable build signing. Typically these
|
# Set keystore details to enable build signing. Typically these
|
||||||
# are overridden via ~/.gradle/gradle.properties to allow secure injection.
|
# are overridden via ~/.gradle/gradle.properties to allow secure injection.
|
||||||
# Debug keystore is useful if using Google Maps or Firebase, which require API keys to be linked
|
# Debug keystore is useful if using Google Maps or Firebase, which require API keys to be linked
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import com.android.build.api.variant.BuildConfigField
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("com.android.library")
|
id("com.android.library")
|
||||||
kotlin("android")
|
kotlin("android")
|
||||||
|
@ -51,6 +53,20 @@ android {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
androidComponents {
|
||||||
|
onVariants { variant ->
|
||||||
|
// Configure SecureScreen for protecting screens with sensitive data in runtime
|
||||||
|
variant.buildConfigFields.put(
|
||||||
|
"IS_SECURE_SCREEN_ENABLED",
|
||||||
|
BuildConfigField(
|
||||||
|
type = "boolean",
|
||||||
|
value = project.property("IS_SECURE_SCREEN_PROTECTION_ACTIVE").toString(),
|
||||||
|
comment = null
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(libs.accompanist.permissions)
|
implementation(libs.accompanist.permissions)
|
||||||
implementation(libs.androidx.activity)
|
implementation(libs.androidx.activity)
|
||||||
|
|
|
@ -16,7 +16,6 @@ class VersionInfoTest {
|
||||||
|
|
||||||
// We expect some VersionInfo object parameters to be empty during the testing
|
// We expect some VersionInfo object parameters to be empty during the testing
|
||||||
// isDebuggable is not tested as it's not static during UI testing in CI or locally
|
// isDebuggable is not tested as it's not static during UI testing in CI or locally
|
||||||
|
|
||||||
assertEquals("null", versionInfo.versionName)
|
assertEquals("null", versionInfo.versionName)
|
||||||
assertEquals(0, versionInfo.versionCode)
|
assertEquals(0, versionInfo.versionCode)
|
||||||
assertNotEquals(versionInfo.gitSha, "")
|
assertNotEquals(versionInfo.gitSha, "")
|
||||||
|
|
|
@ -43,6 +43,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import cash.z.ecc.android.sdk.model.PersistableWallet
|
import cash.z.ecc.android.sdk.model.PersistableWallet
|
||||||
import cash.z.ecc.sdk.fixture.PersistableWalletFixture
|
import cash.z.ecc.sdk.fixture.PersistableWalletFixture
|
||||||
import co.electriccoin.zcash.spackle.model.Index
|
import co.electriccoin.zcash.spackle.model.Index
|
||||||
|
import co.electriccoin.zcash.ui.BuildConfig
|
||||||
import co.electriccoin.zcash.ui.R
|
import co.electriccoin.zcash.ui.R
|
||||||
import co.electriccoin.zcash.ui.common.SecureScreen
|
import co.electriccoin.zcash.ui.common.SecureScreen
|
||||||
import co.electriccoin.zcash.ui.design.MINIMAL_WEIGHT
|
import co.electriccoin.zcash.ui.design.MINIMAL_WEIGHT
|
||||||
|
@ -202,7 +203,9 @@ private fun EducationRecoveryPhrase() {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun SeedPhrase(persistableWallet: PersistableWallet) {
|
private fun SeedPhrase(persistableWallet: PersistableWallet) {
|
||||||
SecureScreen()
|
if (BuildConfig.IS_SECURE_SCREEN_ENABLED) {
|
||||||
|
SecureScreen()
|
||||||
|
}
|
||||||
Column(
|
Column(
|
||||||
Modifier
|
Modifier
|
||||||
.verticalScroll(rememberScrollState())
|
.verticalScroll(rememberScrollState())
|
||||||
|
@ -225,14 +228,16 @@ private data class TestChoice(val originalIndex: Index, val word: String)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@Suppress("LongMethod")
|
||||||
private fun TestInProgress(
|
private fun TestInProgress(
|
||||||
splitSeedPhrase: ImmutableList<String>,
|
splitSeedPhrase: ImmutableList<String>,
|
||||||
selectedTestChoices: TestChoices,
|
selectedTestChoices: TestChoices,
|
||||||
onChoicesChanged: ((choicesCount: Int) -> Unit)?,
|
onChoicesChanged: ((choicesCount: Int) -> Unit)?,
|
||||||
backupState: BackupState
|
backupState: BackupState
|
||||||
) {
|
) {
|
||||||
SecureScreen()
|
if (BuildConfig.IS_SECURE_SCREEN_ENABLED) {
|
||||||
|
SecureScreen()
|
||||||
|
}
|
||||||
val testChoices = splitSeedPhrase
|
val testChoices = splitSeedPhrase
|
||||||
.mapIndexed { index, word -> TestChoice(Index(index), word) }
|
.mapIndexed { index, word -> TestChoice(Index(index), word) }
|
||||||
.filter { testIndices.contains(it.originalIndex) }
|
.filter { testIndices.contains(it.originalIndex) }
|
||||||
|
|
|
@ -32,6 +32,7 @@ import androidx.compose.ui.tooling.preview.Devices
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import cash.z.ecc.android.sdk.model.PersistableWallet
|
import cash.z.ecc.android.sdk.model.PersistableWallet
|
||||||
import cash.z.ecc.sdk.fixture.PersistableWalletFixture
|
import cash.z.ecc.sdk.fixture.PersistableWalletFixture
|
||||||
|
import co.electriccoin.zcash.ui.BuildConfig
|
||||||
import co.electriccoin.zcash.ui.R
|
import co.electriccoin.zcash.ui.R
|
||||||
import co.electriccoin.zcash.ui.common.SecureScreen
|
import co.electriccoin.zcash.ui.common.SecureScreen
|
||||||
import co.electriccoin.zcash.ui.design.component.Body
|
import co.electriccoin.zcash.ui.design.component.Body
|
||||||
|
@ -111,7 +112,9 @@ private fun ShortNewWalletMainContent(
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun SeedPhrase(persistableWallet: PersistableWallet) {
|
private fun SeedPhrase(persistableWallet: PersistableWallet) {
|
||||||
SecureScreen()
|
if (BuildConfig.IS_SECURE_SCREEN_ENABLED) {
|
||||||
|
SecureScreen()
|
||||||
|
}
|
||||||
Column {
|
Column {
|
||||||
Body(stringResource(R.string.new_wallet_short_body))
|
Body(stringResource(R.string.new_wallet_short_body))
|
||||||
ChipGrid(persistableWallet.seedPhrase.split.toPersistentList())
|
ChipGrid(persistableWallet.seedPhrase.split.toPersistentList())
|
||||||
|
|
|
@ -63,6 +63,7 @@ import cash.z.ecc.android.sdk.model.BlockHeight
|
||||||
import cash.z.ecc.android.sdk.model.ZcashNetwork
|
import cash.z.ecc.android.sdk.model.ZcashNetwork
|
||||||
import cash.z.ecc.sdk.model.SeedPhraseValidation
|
import cash.z.ecc.sdk.model.SeedPhraseValidation
|
||||||
import co.electriccoin.zcash.spackle.model.Index
|
import co.electriccoin.zcash.spackle.model.Index
|
||||||
|
import co.electriccoin.zcash.ui.BuildConfig
|
||||||
import co.electriccoin.zcash.ui.R
|
import co.electriccoin.zcash.ui.R
|
||||||
import co.electriccoin.zcash.ui.common.SecureScreen
|
import co.electriccoin.zcash.ui.common.SecureScreen
|
||||||
import co.electriccoin.zcash.ui.design.MINIMAL_WEIGHT
|
import co.electriccoin.zcash.ui.design.MINIMAL_WEIGHT
|
||||||
|
@ -201,7 +202,9 @@ fun RestoreWallet(
|
||||||
|
|
||||||
when (currentStage) {
|
when (currentStage) {
|
||||||
RestoreStage.Seed -> {
|
RestoreStage.Seed -> {
|
||||||
SecureScreen()
|
if (BuildConfig.IS_SECURE_SCREEN_ENABLED) {
|
||||||
|
SecureScreen()
|
||||||
|
}
|
||||||
|
|
||||||
RestoreSeedMainContent(
|
RestoreSeedMainContent(
|
||||||
userWordList = userWordList,
|
userWordList = userWordList,
|
||||||
|
|
|
@ -22,6 +22,7 @@ import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import cash.z.ecc.android.sdk.model.PersistableWallet
|
import cash.z.ecc.android.sdk.model.PersistableWallet
|
||||||
import cash.z.ecc.sdk.fixture.PersistableWalletFixture
|
import cash.z.ecc.sdk.fixture.PersistableWalletFixture
|
||||||
|
import co.electriccoin.zcash.ui.BuildConfig
|
||||||
import co.electriccoin.zcash.ui.R
|
import co.electriccoin.zcash.ui.R
|
||||||
import co.electriccoin.zcash.ui.common.SecureScreen
|
import co.electriccoin.zcash.ui.common.SecureScreen
|
||||||
import co.electriccoin.zcash.ui.design.component.Body
|
import co.electriccoin.zcash.ui.design.component.Body
|
||||||
|
@ -55,7 +56,9 @@ fun Seed(
|
||||||
onBack: () -> Unit,
|
onBack: () -> Unit,
|
||||||
onCopyToClipboard: () -> Unit
|
onCopyToClipboard: () -> Unit
|
||||||
) {
|
) {
|
||||||
SecureScreen()
|
if (BuildConfig.IS_SECURE_SCREEN_ENABLED) {
|
||||||
|
SecureScreen()
|
||||||
|
}
|
||||||
Scaffold(topBar = {
|
Scaffold(topBar = {
|
||||||
SeedTopAppBar(onBack = onBack)
|
SeedTopAppBar(onBack = onBack)
|
||||||
}) { paddingValues ->
|
}) { paddingValues ->
|
||||||
|
|
Loading…
Reference in New Issue