Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a216de29 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[SB] Make OngoingActivityChipModel.Shown a sealed class.

We've been thinking of this model as a sealed class but I realized I
forgot to label it as such. This makes the update and also updates any
`when` clauses that now need to be exhaustive.

Bug: 392895330
Flag: EXEMPT refactor
Test: compiles
Test: atest OngoingActivityChipsViewModelTest
Change-Id: I7589f4c4017519b723cda1a569fdb1853e7b2d22
parent 6c1a7411
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -418,6 +418,7 @@ object OngoingActivityChipBinder {
            }
            is OngoingActivityChipModel.Shown.Timer,
            is OngoingActivityChipModel.Shown.Text,
            is OngoingActivityChipModel.Shown.ShortTimeDelta,
            is OngoingActivityChipModel.Shown.IconOnly -> {
                chipView.accessibilityLiveRegion = View.ACCESSIBILITY_LIVE_REGION_NONE
            }
+4 −0
Original line number Diff line number Diff line
@@ -95,6 +95,10 @@ fun ChipContent(viewModel: OngoingActivityChipModel.Shown, modifier: Modifier =
        is OngoingActivityChipModel.Shown.ShortTimeDelta -> {
            // TODO(b/372657935): Implement ShortTimeDelta content in compose.
        }

        is OngoingActivityChipModel.Shown.IconOnly -> {
            throw IllegalStateException("ChipContent should only be used if the chip shows text")
        }
    }
}

+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ sealed class OngoingActivityChipModel {
    }

    /** This chip should be shown with the given information. */
    abstract class Shown(
    sealed class Shown(
        /** The icon to show on the chip. If null, no icon will be shown. */
        open val icon: ChipIcon?,
        /** What colors to use for the chip. */