Skip to content

Commit ec506b4

Browse files
authored
Merge pull request #1653 from DimensionDev/bugfix/sensitive_blur
fix sensitive blur
2 parents 62d6e43 + ad56d64 commit ec506b4

File tree

5 files changed

+37
-12
lines changed

5 files changed

+37
-12
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package dev.dimension.flare.common
2+
3+
import android.os.Build
4+
5+
internal actual object SystemUtils {
6+
actual val isBlurSupported: Boolean
7+
get() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S
8+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package dev.dimension.flare.common
2+
3+
internal actual object SystemUtils {
4+
actual val isBlurSupported: Boolean
5+
get() = true
6+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package dev.dimension.flare.common
2+
3+
internal expect object SystemUtils {
4+
val isBlurSupported: Boolean
5+
}

compose-ui/src/commonMain/kotlin/dev/dimension/flare/ui/component/status/StatusMediaComponent.kt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import compose.icons.fontawesomeicons.Solid
3333
import compose.icons.fontawesomeicons.solid.CirclePlay
3434
import compose.icons.fontawesomeicons.solid.EyeSlash
3535
import dev.dimension.flare.common.AppDeepLink
36+
import dev.dimension.flare.common.SystemUtils
3637
import dev.dimension.flare.compose.ui.Res
3738
import dev.dimension.flare.compose.ui.status_sensitive_media
3839
import dev.dimension.flare.ui.component.AdaptiveGrid
@@ -160,16 +161,16 @@ internal fun StatusMediaComponent(
160161
Modifier
161162
.clip(PlatformTheme.shapes.medium)
162163
.let {
163-
if (hideSensitive) {
164-
it.blur(32.dp)
165-
} else {
166-
it
167-
}
168-
// if (hideSensitive && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
164+
// if (hideSensitive) {
169165
// it.blur(32.dp)
170166
// } else {
171167
// it
172168
// }
169+
if (hideSensitive && SystemUtils.isBlurSupported) {
170+
it.blur(32.dp)
171+
} else {
172+
it
173+
}
173174
},
174175
expandedSize = appearanceSettings.expandMediaSize,
175176
)
@@ -179,12 +180,11 @@ internal fun StatusMediaComponent(
179180
Modifier
180181
.matchParentSize()
181182
.let {
182-
it
183-
// if (hideSensitive && Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
184-
// it.background(PlatformTheme.colorScheme.surfaceContainer)
185-
// } else {
186-
// it
187-
// }
183+
if (hideSensitive && !SystemUtils.isBlurSupported) {
184+
it.background(PlatformTheme.colorScheme.outline)
185+
} else {
186+
it
187+
}
188188
}.let {
189189
if (hideSensitive) {
190190
it.clickable {
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package dev.dimension.flare.common
2+
3+
internal actual object SystemUtils {
4+
actual val isBlurSupported: Boolean
5+
get() = true
6+
}

0 commit comments

Comments
 (0)