Skip to content

Rewrite ImportDialog with Kotlin + Compose - #36

Open
sdsantos wants to merge 3 commits into
GrapheneOS:mainfrom
sdsantos:import-dialog
Open

Rewrite ImportDialog with Kotlin + Compose#36
sdsantos wants to merge 3 commits into
GrapheneOS:mainfrom
sdsantos:import-dialog

Conversation

@sdsantos

@sdsantos sdsantos commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Related with #35

Before After
Screenshot_20260722_142642 Screenshot_20260723_123735

@sdsantos
sdsantos requested a review from RankoR July 23, 2026 15:57
@sdsantos
sdsantos force-pushed the import-dialog branch 3 times, most recently from 8a62db2 to ee09739 Compare July 23, 2026 17:32
@thestinger
thestinger force-pushed the main branch 3 times, most recently from cbaca32 to c9ac9d9 Compare August 5, 2026 18:47
@sdsantos
sdsantos force-pushed the import-dialog branch 2 times, most recently from d91f590 to 8483f81 Compare September 1, 2026 11:44
@OptIn(ExperimentalMaterial3Api::class)
ModalBottomSheet(
onDismissRequest = { onAction(Action.Dismiss) },
sheetState = rememberStandardBottomSheetState(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be rememberModalBottomSheetState(skipPartiallyExpanded = true), otherwise "back" gesture can partially collapse the sheet instead of closing it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually done that in the next PRs and forgot to backport it here. Now it's actually: confirmValueChange = { it != SheetValue.PartiallyExpanded },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be rememberModalBottomSheetState(skipPartiallyExpanded = true). If window exceeds half the screen, it will be undismissable by "back" otherwise.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I missed that rememberStandardBottomSheetState was different from rememberModalBottomSheetState 🤦

is Effect.OpenSimImport -> {
activity.startActivity(
UIIntents.getSimImportIntent(activity, effect.subscriptionId),
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably need to add finish here

bidiFormatter.unicodeWrap(
PhoneNumberUtilsCompat.createTtsSpannable(phone),
TextDirectionHeuristicsCompat.LTR,
)?.toString()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toString removes TTS spans. Would be better to render it as AnnotatedString with VerbatimTtsAnnotation.

Text(
text = stringResource(
R.string.import_from_sim_summary_fmt,
option.name ?: (index + 1),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Old code had a special case for one sim card, it used R.string.import_from_sim there. Without it, result may look weird, for example, SIM SIM 1, SIM Verizon, etc

@sdsantos
sdsantos requested review from RankoR and m4pl September 8, 2026 09:45
}

private fun annotatedPhone(simCard: SimCard): AnnotatedString {
val phone = simCard.getFormattedPhone() ?: simCard.phone

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simCard.phone - potential NPE below if simCard.phone is null.


return when {
option.contactsCount != null && !option.phone.isNullOrBlank() -> {
expandStringTemplate(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TTS annotation will be still destroyed. expandStringTemplate -> TextUtils.expandTemplate -> SpannableStringBuilder.replace, it copies spans only from Spanned inputs, and AnnotatedString is not Spanned.

@sdsantos
sdsantos requested a review from RankoR September 9, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants