@@ -35,11 +35,9 @@ import androidx.hilt.navigation.compose.hiltViewModel
35
35
import androidx.lifecycle.compose.collectAsStateWithLifecycle
36
36
import com.x8bit.bitwarden.R
37
37
import com.x8bit.bitwarden.ui.auth.feature.checkemail.handlers.rememberCheckEmailHandler
38
- import com.x8bit.bitwarden.ui.platform.base.util.ClickableTextHighlight
39
38
import com.x8bit.bitwarden.ui.platform.base.util.EventsEffect
40
- import com.x8bit.bitwarden.ui.platform.base.util.createAnnotatedString
41
- import com.x8bit.bitwarden.ui.platform.base.util.createClickableAnnotatedString
42
39
import com.x8bit.bitwarden.ui.platform.base.util.standardHorizontalMargin
40
+ import com.x8bit.bitwarden.ui.platform.base.util.toAnnotatedString
43
41
import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar
44
42
import com.x8bit.bitwarden.ui.platform.components.button.BitwardenFilledButton
45
43
import com.x8bit.bitwarden.ui.platform.components.button.BitwardenTextButton
@@ -152,18 +150,13 @@ private fun CheckEmailContent(
152
150
)
153
151
Spacer (modifier = Modifier .height(8 .dp))
154
152
155
- val descriptionAnnotatedString = createAnnotatedString(
156
- mainString = stringResource(
157
- id = R .string.we_sent_an_email_to,
158
- email,
159
- ),
160
- highlights = listOf (email),
161
- highlightStyle = SpanStyle (
153
+ val descriptionAnnotatedString = R .string.we_sent_an_email_to.toAnnotatedString(
154
+ args = arrayOf(email),
155
+ emphasisHighlightStyle = SpanStyle (
162
156
color = BitwardenTheme .colorScheme.text.primary,
163
157
fontSize = BitwardenTheme .typography.bodyMedium.fontSize,
164
158
fontWeight = FontWeight .Bold ,
165
159
),
166
- tag = " EMAIL" ,
167
160
)
168
161
Text (
169
162
text = descriptionAnnotatedString,
@@ -241,18 +234,14 @@ private fun CheckEmailLegacyContent(
241
234
Spacer (modifier = Modifier .height(16 .dp))
242
235
243
236
@Suppress(" MaxLineLength" )
244
- val descriptionAnnotatedString = createAnnotatedString(
245
- mainString = stringResource(
246
- id = R .string.follow_the_instructions_in_the_email_sent_to_x_to_continue_creating_your_account,
237
+ val descriptionAnnotatedString =
238
+ R .string.follow_the_instructions_in_the_email_sent_to_x_to_continue_creating_your_account.toAnnotatedString(
247
239
email,
248
- ),
249
- highlights = listOf (email),
250
- highlightStyle = SpanStyle (
240
+ emphasisHighlightStyle = SpanStyle (
251
241
color = BitwardenTheme .colorScheme.text.primary,
252
242
fontSize = BitwardenTheme .typography.bodyMedium.fontSize,
253
243
fontWeight = FontWeight .Bold ,
254
244
),
255
- tag = " EMAIL" ,
256
245
)
257
246
Text (
258
247
text = descriptionAnnotatedString,
@@ -276,34 +265,17 @@ private fun CheckEmailLegacyContent(
276
265
modifier = Modifier .fillMaxSize(),
277
266
horizontalAlignment = Alignment .CenterHorizontally ,
278
267
) {
279
- val goBackAnnotatedString = createClickableAnnotatedString(
280
- mainString = stringResource(
281
- id = R .string.no_email_go_back_to_edit_your_email_address,
282
- ),
283
- highlights = listOf (
284
- ClickableTextHighlight (
285
- textToHighlight = stringResource(id = R .string.go_back),
286
- onTextClick = onChangeEmailClick,
287
- ),
288
- ),
289
- )
290
268
Text (
291
- text = goBackAnnotatedString,
269
+ text = R .string.no_email_go_back_to_edit_your_email_address.toAnnotatedString {
270
+ onChangeEmailClick()
271
+ },
292
272
)
293
273
Spacer (modifier = Modifier .height(32 .dp))
294
- val logInAnnotatedString = createClickableAnnotatedString(
295
- mainString = stringResource(
296
- id = R .string.or_log_in_you_may_already_have_an_account,
297
- ),
298
- highlights = listOf (
299
- ClickableTextHighlight (
300
- textToHighlight = stringResource(id = R .string.log_in_verb),
301
- onTextClick = onLoginClick,
302
- ),
303
- ),
304
- )
305
274
Text (
306
- text = logInAnnotatedString,
275
+ text = R .string.or_log_in_you_may_already_have_an_account
276
+ .toAnnotatedString {
277
+ onLoginClick()
278
+ },
307
279
)
308
280
}
309
281
}
0 commit comments