Skip to content

Commit e9da3bb

Browse files
committed
chore(deps): migrate Haze to 2.0.0-beta01
Supersedes Dependabot's 2.0.0-alpha03 -> 2.0.0-alpha04 bump (#1234). alpha04 is a hard break for every call site here, and beta01 breaks them again by removing the alpha-era source shims, so migrating straight to beta01 absorbs the churn once instead of twice. beta01 also fixes a cross-window recomposition livelock that affects a HazeState shared between a host composable and a Dialog. API changes applied: - Modifier.hazeEffect { blurEffect { style = ... } } -> Modifier.hazeBlur( HazeInput.Sources(state), style) - HazeBlurStyle(...) constructor -> HazeBlurStyle { } builder; colorEffect becomes colorEffects(List<HazeColorEffect>) - BlurredContent's per-call blur radius override now composes onto the material via HazeBlurStyle.then { blurRadius(...) } The HazeBlurStyle builder is not a @composable scope, so CodeTheme reads are hoisted above it at each call site. HazeState, rememberHazeState, hazeSource and HazeMaterials are unchanged. Verified with :apps:flipcash:app:assembleDebug. The glass surfaces (v2 nav pill, currency title pill, creator upsell card, chat input/send bar, app-bar icon buttons) still need a visual pass.
1 parent 3891c53 commit e9da3bb

8 files changed

Lines changed: 65 additions & 63 deletions

File tree

‎apps/flipcash/core-ui/src/main/kotlin/com/flipcash/app/core/ui/NavigationBar.kt‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ import androidx.compose.ui.unit.dp
6767
import androidx.compose.ui.util.fastForEach
6868
import androidx.compose.ui.zIndex
6969
import com.flipcash.app.core.navigation.NavBarButton
70+
import dev.chrisbanes.haze.HazeInput
7071
import dev.chrisbanes.haze.HazeState
7172
import dev.chrisbanes.haze.blur.HazeBlurStyle
7273
import dev.chrisbanes.haze.blur.HazeColorEffect
73-
import dev.chrisbanes.haze.blur.blurEffect
74-
import dev.chrisbanes.haze.hazeEffect
74+
import dev.chrisbanes.haze.blur.hazeBlur
7575
import com.flipcash.app.core.navigation.NavBarConfig
7676
import com.flipcash.app.theme.FlipcashThemeWrapper
7777
import com.flipcash.core.R
@@ -271,22 +271,24 @@ private fun NavigationBarV2(
271271
// content the pill just reads as the background (a subtle glass, not a black blob); over the
272272
// vibrant cards the high alpha mutes their colour toward that same neutral dark. A faint bright
273273
// rim gives the glass edge. Haze can only blur Compose-layer pixels, so on the scanner tab (a
274-
// camera SurfaceView) fall back to the opaque pill. `clip` must precede `hazeEffect` to bound the
274+
// camera SurfaceView) fall back to the opaque pill. `clip` must precede `hazeBlur` to bound the
275275
// blur to the pill shape, not its bounding box.
276276
// Tint toward a grey lifted off the (near-black) background so the pill reads as a light frosted
277277
// glass sitting ABOVE the dark content, not the background tone itself.
278-
val glassTint = lerp(CodeTheme.colors.background, Color.White, 0.18f)
279-
val liquidGlass = HazeBlurStyle(
280-
blurRadius = 32.dp,
281-
backgroundColor = CodeTheme.colors.background,
282-
colorEffect = HazeColorEffect.tint(glassTint.copy(alpha = 0.72f)),
283-
)
278+
val backdrop = CodeTheme.colors.background
279+
val glassTint = lerp(backdrop, Color.White, 0.18f)
280+
// The HazeBlurStyle builder is not a @Composable scope, so theme reads are hoisted above it.
281+
val liquidGlass = HazeBlurStyle {
282+
blurRadius(32.dp)
283+
backgroundColor(backdrop)
284+
colorEffects(listOf(HazeColorEffect.tint(glassTint.copy(alpha = 0.72f))))
285+
}
284286
// Same clip + rim on every tab; only the fill differs. Haze frosts the content beneath — including
285287
// the scanner's live camera, since its PreviewView runs in COMPATIBLE mode (a TextureView drawn in
286288
// the Compose layer, not a SurfaceView hole). Fall back to a near-opaque fill of the same
287289
// lifted-grey tint only when no HazeState is supplied.
288290
val pillFill = if (hazeState != null) {
289-
Modifier.hazeEffect(hazeState) { blurEffect { style = liquidGlass } }
291+
Modifier.hazeBlur(HazeInput.Sources(hazeState), liquidGlass)
290292
} else {
291293
Modifier.background(glassTint.copy(alpha = 0.9f), CircleShape)
292294
}

‎apps/flipcash/features/messenger/src/main/kotlin/com/flipcash/app/messenger/internal/screens/components/ChatBottomBar.kt‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ import com.getcode.ui.components.chat.TypingIndicator
4444
import com.getcode.ui.core.drawWithGradient
4545
import com.getcode.ui.core.measured
4646
import com.getcode.ui.utils.rememberKeyboardController
47+
import dev.chrisbanes.haze.HazeInput
4748
import dev.chrisbanes.haze.HazeState
48-
import dev.chrisbanes.haze.blur.blurEffect
49+
import dev.chrisbanes.haze.blur.hazeBlur
4950
import dev.chrisbanes.haze.blur.materials.HazeMaterials
50-
import dev.chrisbanes.haze.hazeEffect
5151

5252
@Composable
5353
internal fun UserControlBottomBar(
@@ -96,9 +96,7 @@ internal fun UserControlBottomBar(
9696
if (show) {
9797
TypingIndicator(
9898
modifier = Modifier
99-
.hazeEffect(hazeState) {
100-
blurEffect { style = material }
101-
},
99+
.hazeBlur(HazeInput.Sources(hazeState), material),
102100
)
103101
}
104102
}
@@ -177,11 +175,7 @@ internal fun UserControlBottomBar(
177175
CodeTheme.colors.divider,
178176
CodeTheme.shapes.medium,
179177
)
180-
.hazeEffect(hazeState) {
181-
blurEffect {
182-
style = material
183-
}
184-
},
178+
.hazeBlur(HazeInput.Sources(hazeState), material),
185179
focusRequester = focusRequester,
186180
hint = "Message",
187181
state = state.chatInputState,

‎apps/flipcash/features/messenger/src/main/kotlin/com/flipcash/app/messenger/internal/screens/components/SendCashButton.kt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ import com.flipcash.services.models.chat.ChatType
4040
import com.flipcash.features.messenger.R
4141
import com.getcode.theme.CodeTheme
4242
import com.getcode.ui.core.addIf
43+
import dev.chrisbanes.haze.HazeInput
4344
import dev.chrisbanes.haze.HazeState
4445
import dev.chrisbanes.haze.blur.HazeBlurStyle
45-
import dev.chrisbanes.haze.blur.blurEffect
46-
import dev.chrisbanes.haze.hazeEffect
46+
import dev.chrisbanes.haze.blur.hazeBlur
4747

4848
@Composable
4949
internal fun RowScope.SendCashButton(
@@ -122,7 +122,7 @@ internal fun RowScope.SendCashButton(
122122
.clip(shape)
123123
// Haze sits under the fill — hidden while the background is opaque white, revealed
124124
// naturally as the background eases to transparent when typing begins.
125-
.hazeEffect(hazeState) { blurEffect { style = hazeMaterial } }
125+
.hazeBlur(HazeInput.Sources(hazeState), hazeMaterial)
126126
.background(backgroundColor, shape)
127127
.border(CodeTheme.dimens.border, borderColor, shape)
128128
.clickable(onClick = onClick)

‎apps/flipcash/features/tokens/src/main/kotlin/com/flipcash/app/tokens/internal/components/info/CurrencyInfoContentV2.kt‎

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ import com.getcode.theme.extraSmall
7070
import com.getcode.ui.components.text.ExpandableText
7171
import com.getcode.ui.core.addIf
7272
import com.getcode.ui.theme.CodeCircularProgressIndicator
73+
import dev.chrisbanes.haze.HazeInput
7374
import dev.chrisbanes.haze.HazeState
74-
import dev.chrisbanes.haze.hazeEffect
75-
import dev.chrisbanes.haze.hazeSource
7675
import dev.chrisbanes.haze.blur.HazeBlurStyle
7776
import dev.chrisbanes.haze.blur.HazeColorEffect
78-
import dev.chrisbanes.haze.blur.blurEffect
77+
import dev.chrisbanes.haze.blur.hazeBlur
78+
import dev.chrisbanes.haze.hazeSource
7979
import com.getcode.util.format
8080

8181
/**
@@ -503,18 +503,21 @@ internal fun CurrencyInfoTitlePill(
503503
hazeState: HazeState? = null,
504504
) {
505505
val shape = CircleShape
506-
val glassTint = lerp(CodeTheme.colors.background, Color.White, 0.18f)
506+
val backdrop = CodeTheme.colors.background
507+
val glassBlurRadius = CodeTheme.dimens.grid.x4
508+
val glassTint = lerp(backdrop, Color.White, 0.18f)
507509
// Real liquid glass over the scrolling content when a HazeState is supplied; falls back to a
508-
// translucent capsule otherwise. `clip` precedes `hazeEffect` so the blur is bounded to the pill.
510+
// translucent capsule otherwise. `clip` precedes `hazeBlur` so the blur is bounded to the pill.
509511
val fill = if (hazeState != null) {
510-
val liquidGlass = HazeBlurStyle(
511-
blurRadius = CodeTheme.dimens.grid.x4,
512-
backgroundColor = CodeTheme.colors.background,
513-
colorEffect = HazeColorEffect.tint(glassTint.copy(alpha = 0.72f)),
514-
)
512+
// The HazeBlurStyle builder is not a @Composable scope, so theme reads are hoisted above it.
513+
val liquidGlass = HazeBlurStyle {
514+
blurRadius(glassBlurRadius)
515+
backgroundColor(backdrop)
516+
colorEffects(listOf(HazeColorEffect.tint(glassTint.copy(alpha = 0.72f))))
517+
}
515518
Modifier
516519
.clip(shape)
517-
.hazeEffect(hazeState) { blurEffect { style = liquidGlass } }
520+
.hazeBlur(HazeInput.Sources(hazeState), liquidGlass)
518521
.border(CodeTheme.dimens.border, Color.White.copy(alpha = 0.08f), shape)
519522
} else {
520523
Modifier

‎apps/flipcash/shared/tokens/src/main/kotlin/com/flipcash/app/tokens/ui/CurrencyCreatorUpsellCard.kt‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ import com.flipcash.app.theme.FlipcashThemeWrapper
3131
import com.flipcash.app.theme.MultiDevicePreview
3232
import com.flipcash.shared.tokens.R
3333
import com.getcode.theme.CodeTheme
34+
import dev.chrisbanes.haze.HazeInput
3435
import dev.chrisbanes.haze.HazeState
3536
import dev.chrisbanes.haze.blur.HazeBlurStyle
3637
import dev.chrisbanes.haze.blur.HazeColorEffect
37-
import dev.chrisbanes.haze.blur.blurEffect
38-
import dev.chrisbanes.haze.hazeEffect
38+
import dev.chrisbanes.haze.blur.hazeBlur
3939

4040
@Composable
4141
fun CurrencyCreatorUpsellCard(
@@ -48,18 +48,20 @@ fun CurrencyCreatorUpsellCard(
4848
// When a HazeState is supplied the card frosts whatever list content scrolls beneath it (iOS
4949
// "liquid glass"), matching the v2 navigation pill: a wide blur plus a strong tint toward the
5050
// BACKGROUND colour at high alpha, finished with a faint bright rim. `clip` must precede
51-
// `hazeEffect` so the blur is bounded to the rounded card, not its bounding box. Falls back to the
51+
// `hazeBlur` so the blur is bounded to the rounded card, not its bounding box. Falls back to the
5252
// opaque surface when no HazeState is supplied (e.g. when the card is itself part of the list).
53-
val glassTint = lerp(CodeTheme.colors.background, Color.White, 0.18f)
54-
val liquidGlass = HazeBlurStyle(
55-
blurRadius = 32.dp,
56-
backgroundColor = CodeTheme.colors.background,
57-
colorEffect = HazeColorEffect.tint(glassTint.copy(alpha = 0.72f)),
58-
)
53+
val backdrop = CodeTheme.colors.background
54+
val glassTint = lerp(backdrop, Color.White, 0.18f)
55+
// The HazeBlurStyle builder is not a @Composable scope, so theme reads are hoisted above it.
56+
val liquidGlass = HazeBlurStyle {
57+
blurRadius(32.dp)
58+
backgroundColor(backdrop)
59+
colorEffects(listOf(HazeColorEffect.tint(glassTint.copy(alpha = 0.72f))))
60+
}
5961
val glassBackground = if (hazeState != null) {
6062
Modifier
6163
.clip(shape)
62-
.hazeEffect(hazeState) { blurEffect { style = liquidGlass } }
64+
.hazeBlur(HazeInput.Sources(hazeState), liquidGlass)
6365
.border(CodeTheme.dimens.border, Color.White.copy(alpha = 0.08f), shape)
6466
} else {
6567
Modifier

‎gradle/libs.versions.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ bugsnag = "6.26.1"
9494
bugsnag-gradle-plugin = "1.2.0"
9595
rinku = "1.6.0"
9696
compose-unstyled = "2.9.0"
97-
haze = "2.0.0-alpha03"
97+
haze = "2.0.0-beta01"
9898
phantom-connect-kmp = "2.0.2-1.0.1"
9999
vico = "3.2.3"
100100

‎ui/components/src/main/kotlin/com/getcode/ui/components/BlurredContent.kt‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import androidx.compose.ui.Modifier
1010
import androidx.compose.ui.graphics.Color
1111
import androidx.compose.ui.unit.dp
1212
import com.getcode.theme.CodeTheme
13-
import dev.chrisbanes.haze.blur.blurEffect
13+
import dev.chrisbanes.haze.HazeInput
14+
import dev.chrisbanes.haze.blur.hazeBlur
1415
import dev.chrisbanes.haze.blur.materials.HazeMaterials
15-
import dev.chrisbanes.haze.hazeEffect
1616
import dev.chrisbanes.haze.hazeSource
1717
import dev.chrisbanes.haze.rememberHazeState
1818

@@ -40,12 +40,10 @@ fun BlurredContent(
4040
Box(
4141
Modifier
4242
.matchParentSize()
43-
.hazeEffect(hazeState) {
44-
blurEffect {
45-
this.blurRadius = blurRadius
46-
style = material
47-
}
48-
}
43+
.hazeBlur(
44+
input = HazeInput.Sources(hazeState),
45+
style = material.then { blurRadius(blurRadius) },
46+
)
4947
)
5048
}
5149
}

‎ui/components/src/main/kotlin/com/getcode/ui/components/CircularIconButton.kt‎

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ import androidx.compose.ui.unit.dp
1717
import com.getcode.ui.components.AppBarDefaults.IconSize
1818
import androidx.compose.foundation.clickable
1919
import com.getcode.theme.CodeTheme
20+
import dev.chrisbanes.haze.HazeInput
2021
import dev.chrisbanes.haze.HazeState
2122
import dev.chrisbanes.haze.blur.HazeBlurStyle
2223
import dev.chrisbanes.haze.blur.HazeColorEffect
23-
import dev.chrisbanes.haze.blur.blurEffect
24-
import dev.chrisbanes.haze.hazeEffect
24+
import dev.chrisbanes.haze.blur.hazeBlur
2525

2626
private val ButtonSize: Dp
2727
@Composable get() = CodeTheme.dimens.staticGrid.x8
@@ -39,18 +39,21 @@ fun CircularIconButton(
3939
content: @Composable (Dp) -> Unit,
4040
) {
4141
// When a HazeState is supplied the button frosts whatever content scrolls beneath the app bar
42-
// (iOS "liquid glass"), matching the v2 nav pill; `clip` precedes `hazeEffect` so the blur is
42+
// (iOS "liquid glass"), matching the v2 nav pill; `clip` precedes `hazeBlur` so the blur is
4343
// bounded to the circle. Falls back to the flat translucent fill when no HazeState is supplied.
4444
val fill = if (hazeState != null) {
45-
val glassTint = lerp(CodeTheme.colors.background, Color.White, 0.18f)
46-
val liquidGlass = HazeBlurStyle(
47-
blurRadius = CodeTheme.dimens.grid.x4,
48-
backgroundColor = CodeTheme.colors.background,
49-
colorEffect = HazeColorEffect.tint(glassTint.copy(alpha = 0.72f)),
50-
)
45+
val backdrop = CodeTheme.colors.background
46+
val glassBlurRadius = CodeTheme.dimens.grid.x4
47+
val glassTint = lerp(backdrop, Color.White, 0.18f)
48+
// The HazeBlurStyle builder is not a @Composable scope, so theme reads are hoisted above it.
49+
val liquidGlass = HazeBlurStyle {
50+
blurRadius(glassBlurRadius)
51+
backgroundColor(backdrop)
52+
colorEffects(listOf(HazeColorEffect.tint(glassTint.copy(alpha = 0.72f))))
53+
}
5154
Modifier
5255
.clip(CircleShape)
53-
.hazeEffect(hazeState) { blurEffect { style = liquidGlass } }
56+
.hazeBlur(HazeInput.Sources(hazeState), liquidGlass)
5457
.border(CodeTheme.dimens.border, Color.White.copy(alpha = 0.08f), CircleShape)
5558
} else {
5659
Modifier

0 commit comments

Comments
 (0)