File tree 2 files changed +8
-2
lines changed
kotlin/com/artemchep/keyguard/ui/markdown
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ import androidx.compose.ui.Modifier
9
9
import androidx.compose.ui.platform.LocalUriHandler
10
10
import com.artemchep.keyguard.common.model.ToastMessage
11
11
import com.artemchep.keyguard.common.usecase.ShowMessage
12
+ import com.artemchep.keyguard.feature.localization.textResource
13
+ import com.artemchep.keyguard.platform.LocalLeContext
14
+ import com.artemchep.keyguard.res.Res
12
15
import com.halilibo.richtext.commonmark.Markdown
13
16
import com.halilibo.richtext.markdown.BasicMarkdown
14
17
import com.halilibo.richtext.markdown.node.AstNode
@@ -52,16 +55,18 @@ fun MarkdownText(
52
55
@Composable
53
56
private fun rememberGracefulLinkClickHandler (): LinkClickHandler {
54
57
val showMessage by rememberInstance<ShowMessage >()
58
+
59
+ val updatedContext by rememberUpdatedState(LocalLeContext )
55
60
val updatedUriHandler by rememberUpdatedState(LocalUriHandler .current)
56
61
return remember {
57
62
LinkClickHandler { uri ->
58
63
try {
59
64
updatedUriHandler.openUri(uri)
60
65
} catch (e: Exception ) {
61
- val title = e.message
62
- ? : " Could not open a URI"
66
+ val title = textResource(Res .strings.error_failed_open_uri, updatedContext)
63
67
val msg = ToastMessage (
64
68
title = title,
69
+ text = e.message,
65
70
type = ToastMessage .Type .ERROR ,
66
71
)
67
72
showMessage.copy(msg)
Original file line number Diff line number Diff line change 455
455
<string name =" error_failed_generate_otp_code" >Failed to generate OTP code</string >
456
456
<string name =" error_failed_create_passkey" >Failed to create a passkey</string >
457
457
<string name =" error_failed_use_passkey" >Failed to authorize a request</string >
458
+ <string name =" error_failed_open_uri" >Failed to open a URI</string >
458
459
<string name =" error_failed_format_placeholder" >Failed to format the placeholder</string >
459
460
460
461
<!-- Title of the 'Show as Barcode' dialog -->
You can’t perform that action at this time.
0 commit comments