Skip to content

Commit 6b9b600

Browse files
authored
Merge pull request #487 from code-payments/feat/add-disclaimer-to-access-key-image
feat: add disclaimer to access key image
2 parents 5a5c9c8 + 0565921 commit 6b9b600

2 files changed

Lines changed: 25 additions & 5 deletions

File tree

app/src/main/java/com/getcode/view/login/BaseAccessKeyViewModel.kt

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import com.getcode.manager.TopBarManager
1818
import com.getcode.network.repository.TransactionRepository
1919
import com.getcode.network.repository.TransactionRepository.DeniedReason
2020
import com.getcode.network.repository.decodeBase64
21+
import com.getcode.theme.Alert
2122
import com.getcode.theme.R as themeR
2223
import com.getcode.theme.Brand
2324
import com.getcode.theme.Transparent
@@ -85,7 +86,7 @@ abstract class BaseAccessKeyViewModel(
8586
val accessKeyBitmapDisplay =
8687
createBitmapForExport(drawBackground = false, words, entropyB64)
8788
val accessKeyCroppedBitmap =
88-
Bitmap.createBitmap(accessKeyBitmapDisplay, 0, 300, 1200, 1450)
89+
Bitmap.createBitmap(accessKeyBitmapDisplay, 0, 500, 1200, 1450)
8990

9091
uiFlow.value = uiFlow.value.copy(
9192
accessKeyBitmap = accessKeyBitmap,
@@ -108,10 +109,11 @@ abstract class BaseAccessKeyViewModel(
108109
private val logoHeight = 88
109110
private val qrCodeSize = 480
110111

111-
private val bgTopOffset = 350
112-
private val logoTopOffset = 570
113-
private val qrTopOffset = 780
114-
private val keyTextTopOffset = 1400
112+
private val bgTopOffset = 550
113+
private val logoTopOffset = 770
114+
private val qrTopOffset = 980
115+
private val keyTextTopOffset = 1600
116+
private val topTextTopOffset = 200
115117
private val bottomTextTopOffset = 2000
116118

117119

@@ -165,6 +167,22 @@ abstract class BaseAccessKeyViewModel(
165167
drawPaint(paintBackground)
166168
}
167169

170+
val topTextChunks = getString(R.string.title_accessKeySnapshotDescription)
171+
.split(" ", "\n")
172+
.chunked(7)
173+
.map { it.joinToString(" ") }
174+
175+
topTextChunks.forEachIndexed { index, text ->
176+
drawText(
177+
canvas = this,
178+
y = topTextTopOffset + (60 * (index + 1)),
179+
sizePx = 40,
180+
color = Alert.toAGColor(),
181+
text = text
182+
)
183+
}
184+
185+
168186
drawBitmap(
169187
accessKeyBg,
170188
(((targetWidth - accessBgActualWidth) / 2)).toFloat(),

app/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,6 @@
4141
<string name="action_biometricsClickToAuthenticate">Click to authenticate</string>
4242
<string name="error_title_missingBiometrics">Biometrics Removed</string>
4343
<string name="error_description_missingBiometrics">Biometrics are no longer available on your device.</string>
44+
45+
<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>
4446
</resources>

0 commit comments

Comments
 (0)