Skip to content

Commit 489b142

Browse files
committed
chore: self review 2
1 parent 7c0f595 commit 489b142

5 files changed

Lines changed: 11 additions & 11 deletions

File tree

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ internal fun Context.notificationBuilder(
4949
}
5050
val flags = FLAG_IMMUTABLE or FLAG_ONE_SHOT
5151

52-
@Suppress("ForbiddenComment") // TODO: review if needed:
5352
val pendingIntent = PendingIntent.getActivity(this, 0, intent, flags)
5453

5554
return NotificationCompat.Builder(this, channelId)

app/src/main/java/to/bitkit/ui/shared/util/ShareSheet.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fun shareQrCode(context: Context, bitmap: Bitmap, text: String) {
4545
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
4646
}
4747

48-
val chooser = Intent.createChooser(intent, "Share Qr code via")
48+
val chooser = Intent.createChooser(intent, context.getString(R.string.other__share_qr))
4949
context.startActivity(chooser)
5050
} catch (e: IOException) {
5151
Logger.error("Failed to share QR code", e, context = "ShareSheet")

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ class LogsViewModel @Inject constructor(
2525
private val application: Application,
2626
private val logsRepo: LogsRepo,
2727
) : AndroidViewModel(application) {
28+
companion object {
29+
private const val TAG = "LogsViewModel"
30+
}
31+
2832
private val _logs = MutableStateFlow<List<LogFile>>(emptyList())
2933
val logs: StateFlow<List<LogFile>> = _logs.asStateFlow()
3034

@@ -46,12 +50,11 @@ class LogsViewModel @Inject constructor(
4650
}
4751
.onFailure { e ->
4852
_selectedLogContent.update { listOf("Log file not found") }
49-
Logger.error("Failed to load log content", e)
53+
Logger.error("Failed to load log content", e, context = TAG)
5054
}
5155
}
5256
}
5357

54-
@Suppress("TooGenericExceptionCaught")
5558
fun prepareLogForSharing(logFile: LogFile, onReady: (Uri) -> Unit) {
5659
viewModelScope.launch {
5760
runCatching {
@@ -73,7 +76,7 @@ class LogsViewModel @Inject constructor(
7376
}
7477
}
7578
}.onFailure {
76-
Logger.error("Error preparing file for sharing", it)
79+
Logger.error("Error preparing file for sharing", it, context = TAG)
7780
}
7881
}
7982
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@
480480
<string name="other__scan_err_decoding">Decoding Error</string>
481481
<string name="other__scan_err_interpret_title">Unable To Interpret Provided Data</string>
482482
<string name="other__scan_err_not_payable_msg">This QR code does not appear to contain payment data.</string>
483+
<string name="other__share_qr">Share QR Code Via</string>
483484
<string name="other__shop__discover__esims__description">Go borderless</string>
484485
<string name="other__shop__discover__esims__title">ESims</string>
485486
<string name="other__shop__discover__gift_cards__description">Shop with Bitcoin</string>

app/src/test/java/to/bitkit/utils/CryptoTest.kt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import to.bitkit.fcm.EncryptedNotification
1111
import kotlin.test.assertContentEquals
1212
import kotlin.test.assertEquals
1313

14-
@Suppress("SpacingBetweenDeclarationsWithAnnotations", "Wrapping")
1514
class CryptoTest {
1615
private lateinit var sut: Crypto
1716

@@ -86,14 +85,12 @@ class CryptoTest {
8685
val derivationName = "bitkit-notifications"
8786

8887
@Suppress("MaxLineLength")
89-
val ciphertext = ("l2fInfyw64gO12odo8iipISloQJ45Rc4WjFmpe95brdaAMDq+T/L9ZChcmMCXnR0J6BXd8sSI" +
90-
"Je/0bmby8uSZZJuVCzwF76XHfY5oq0Y1/hKzyZTn8nG3dqfiLHnAPy1tZFQfm5ALgjwWnViYJLXoGFpXs7kLMA=")
91-
.fromBase64()
88+
val ciphertext = ("l2fInfyw64gO12odo8iipISloQJ45Rc4WjFmpe95brdaAMDq+T/L9ZChcmMCXnR0J6BXd8sSIJe/0bmby8uSZZJuVCzwF76XHfY5oq0Y1/hKzyZTn8nG3dqfiLHnAPy1tZFQfm5ALgjwWnViYJLXoGFpXs7kLMA=").fromBase64()
9289
val iv = "2b8ed77fd2198e3ed88cfaa794a246e8"
9390
val tag = "caddd13746d6a6aed16176734964d3a3"
91+
9492
@Suppress("MaxLineLength")
95-
val decryptedPayload = """{"source":"blocktank","type":"incomingHtlc","payload":""" +
96-
"""{"secretMessage":"hello"},"createdAt":"2024-09-18T13:33:52.555Z"}"""
93+
val decryptedPayload = """{"source":"blocktank","type":"incomingHtlc","payload":{"secretMessage":"hello"},"createdAt":"2024-09-18T13:33:52.555Z"}"""
9794

9895
// Without derivationName
9996
val sharedSecret = sut.generateSharedSecret(clientPrivateKey.fromHex(), serverPublicKey)

0 commit comments

Comments
 (0)