Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions app/src/main/java/com/getcode/view/login/BaseAccessKeyViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import com.getcode.manager.TopBarManager
import com.getcode.network.repository.TransactionRepository
import com.getcode.network.repository.TransactionRepository.DeniedReason
import com.getcode.network.repository.decodeBase64
import com.getcode.theme.Alert
import com.getcode.theme.R as themeR
import com.getcode.theme.Brand
import com.getcode.theme.Transparent
Expand Down Expand Up @@ -85,7 +86,7 @@ abstract class BaseAccessKeyViewModel(
val accessKeyBitmapDisplay =
createBitmapForExport(drawBackground = false, words, entropyB64)
val accessKeyCroppedBitmap =
Bitmap.createBitmap(accessKeyBitmapDisplay, 0, 300, 1200, 1450)
Bitmap.createBitmap(accessKeyBitmapDisplay, 0, 500, 1200, 1450)

uiFlow.value = uiFlow.value.copy(
accessKeyBitmap = accessKeyBitmap,
Expand All @@ -108,10 +109,11 @@ abstract class BaseAccessKeyViewModel(
private val logoHeight = 88
private val qrCodeSize = 480

private val bgTopOffset = 350
private val logoTopOffset = 570
private val qrTopOffset = 780
private val keyTextTopOffset = 1400
private val bgTopOffset = 550
private val logoTopOffset = 770
private val qrTopOffset = 980
private val keyTextTopOffset = 1600
private val topTextTopOffset = 200
private val bottomTextTopOffset = 2000


Expand Down Expand Up @@ -165,6 +167,22 @@ abstract class BaseAccessKeyViewModel(
drawPaint(paintBackground)
}

val topTextChunks = getString(R.string.title_accessKeySnapshotDescription)
.split(" ", "\n")
.chunked(7)
.map { it.joinToString(" ") }

topTextChunks.forEachIndexed { index, text ->
drawText(
canvas = this,
y = topTextTopOffset + (60 * (index + 1)),
sizePx = 40,
color = Alert.toAGColor(),
text = text
)
}


drawBitmap(
accessKeyBg,
(((targetWidth - accessBgActualWidth) / 2)).toFloat(),
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@
<string name="action_biometricsClickToAuthenticate">Click to authenticate</string>
<string name="error_title_missingBiometrics">Biometrics Removed</string>
<string name="error_description_missingBiometrics">Biometrics are no longer available on your device.</string>

<string name="title_accessKeySnapshotDescription">Warning! This image gives access to all the funds you have in Code. Do not share this image with anyone else.\nKeep it secure and safe.</string>
</resources>