Skip to content

Commit

Permalink
Migrate to Compose 1.7.0 stable and other compose relevant dependenci…
Browse files Browse the repository at this point in the history
…es (#1177)
  • Loading branch information
skydoves authored Sep 10, 2024
1 parent b0c0ad8 commit fa44c8d
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.getByType
import org.jetbrains.kotlin.compose.compiler.gradle.ComposeCompilerGradlePluginExtension
import org.jetbrains.kotlin.compose.compiler.gradle.ComposeFeatureFlag

/**
* Configure Compose-specific options
Expand All @@ -31,7 +32,7 @@ internal fun Project.configureAndroidCompose(
}

extensions.configure<ComposeCompilerGradlePluginExtension> {
enableStrongSkippingMode = true
featureFlags.addAll(ComposeFeatureFlag.StrongSkipping, ComposeFeatureFlag.IntrinsicRemember)
reportsDestination = layout.buildDirectory.dir("compose_compiler")
stabilityConfigurationFile = rootProject.layout.projectDirectory.file("compose_compiler_config.conf")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import androidx.compose.material.icons.filled.CallEnd
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.tooling.preview.Preview
Expand All @@ -48,7 +47,6 @@ import io.getstream.video.android.mock.StreamPreviewDataUtils
import io.getstream.video.android.mock.previewCall
import io.getstream.video.android.tooling.extensions.toPx

@OptIn(ExperimentalComposeUiApi::class)
@Composable
fun LandscapeControls(call: Call, onDismiss: () -> Unit) {
val isCameraEnabled by call.camera.isEnabled.collectAsStateWithLifecycle()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,10 @@
* limitations under the License.
*/

@file:OptIn(ExperimentalLayoutApi::class)

package io.getstream.video.android.ui.call

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.width
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.AutoAwesome
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package io.getstream.video.android.ui.call

import android.content.ClipboardManager
import android.content.Context
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
Expand Down Expand Up @@ -100,7 +99,6 @@ fun ParticipantsList(call: Call) {
ParticipantsListContent(call, clipboardManager, participants)
}

@OptIn(ExperimentalFoundationApi::class)
@Composable
fun ParticipantsListContent(
call: Call,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
Expand All @@ -48,7 +47,7 @@ import androidx.compose.material.icons.filled.Email
import androidx.compose.material.icons.filled.Settings
import androidx.compose.material.icons.outlined.Adb
import androidx.compose.material.icons.outlined.GroupAdd
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.material.ripple
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
Expand Down Expand Up @@ -408,7 +407,7 @@ private fun BuiltInUsersLoginDialog(
.fillMaxWidth()
.clickable(
interactionSource = remember { MutableInteractionSource() },
indication = rememberRipple(bounded = true),
indication = ripple(bounded = true),
onClick = {
login(true, LoginEvent.SignIn(user))
onDismissRequest()
Expand Down Expand Up @@ -439,7 +438,6 @@ private fun BuiltInUsersLoginDialog(
)
}

@OptIn(ExperimentalLayoutApi::class)
@Composable
fun SelectableDialog(
items: List<StreamEnvironment>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.tooling.preview.Preview
Expand All @@ -63,7 +62,7 @@ import io.getstream.video.android.util.filters.SampleAudioFilter
import kotlinx.coroutines.launch
import java.nio.ByteBuffer

@OptIn(ExperimentalComposeUiApi::class, ExperimentalPermissionsApi::class)
@OptIn(ExperimentalPermissionsApi::class)
@Composable
internal fun SettingsMenu(
call: Call,
Expand Down
26 changes: 13 additions & 13 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ androidGradlePlugin = "8.4.2"
cameraCamera2 = "1.3.0"
spotless = "6.21.0"
nexusPlugin = "1.3.0"
kotlin = "2.0.0"
ksp = "2.0.0-1.0.22"
kotlinSerialization = "1.6.3"
kotlin = "2.0.20"
ksp = "2.0.20-1.0.25"
kotlinSerialization = "1.7.1"
kotlinSerializationConverter = "1.0.0"
kotlinxCoroutines = "1.8.0"
kotlinxCoroutines = "1.8.1"

kotlinDokka = "1.9.20"
jvmTarget = "11"
Expand All @@ -16,21 +16,21 @@ androidxMaterial = "1.11.0"
androidxAppCompat = "1.6.1"
androidxCore = "1.12.0"
androidxAnnotation = "1.7.1"
androidxLifecycle = "2.7.0"
androidxLifecycle = "2.8.5"
androidxStartup = "1.1.1"
androidxActivity = "1.9.0"
androidxActivity = "1.9.2"
androidxDataStore = "1.0.0"
googleService = "4.3.14"

androidxComposeBom = "2024.06.00"
androidxComposeBom = "2024.09.00"
androidxComposeTracing = "1.0.0-beta01"
androidxHiltNavigation = "1.2.0"
androidxComposeNavigation = "2.7.7"
androidxComposeNavigation = "2.8.0"
composeStableMarker = "1.0.5"

coil = "2.6.0"
landscapist = "2.3.5"
accompanist = "0.32.0"
landscapist = "2.3.6"
accompanist = "0.34.0"
telephoto = "0.3.0"
audioswitch = "1.1.8"
libyuv = "0.30.0"
Expand All @@ -44,7 +44,7 @@ tink = "1.9.0"
turbine = "0.13.0"

streamWebRTC = "1.1.2"
streamResult = "1.1.0"
streamResult = "1.2.0"
streamChat = "6.0.13"
streamLog = "1.1.4"
streamPush = "1.1.7"
Expand Down Expand Up @@ -72,10 +72,10 @@ playAppUpdate = "2.1.0"

hilt = "2.51.1"
leakCanary = "2.13"
binaryCompatabilityValidator = "0.14.0"
binaryCompatabilityValidator = "0.16.3"
playPublisher = "3.8.4"

googleMlKitSelfieSegmentation = "16.0.0-beta4"
googleMlKitSelfieSegmentation = "16.0.0-beta6"

[libraries]
androidx-camera-camera2 = { module = "androidx.camera:camera-camera2", version.ref = "cameraCamera2" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,12 @@ public final class io/getstream/video/android/compose/theme/StreamDimens$Compani
public final fun defaultDimens (Landroidx/compose/runtime/Composer;I)Lio/getstream/video/android/compose/theme/StreamDimens;
}

public final class io/getstream/video/android/compose/theme/StreamRippleConfiguration {
public static final field $stable I
public static final field INSTANCE Lio/getstream/video/android/compose/theme/StreamRippleConfiguration;
public final fun default (Landroidx/compose/runtime/Composer;I)Landroidx/compose/material/RippleConfiguration;
}

public final class io/getstream/video/android/compose/theme/StreamShapes {
public static final field $stable I
public static final field Companion Lio/getstream/video/android/compose/theme/StreamShapes$Companion;
Expand Down Expand Up @@ -295,7 +301,7 @@ public abstract interface class io/getstream/video/android/compose/theme/StreamT
public fun getColors (Landroidx/compose/runtime/Composer;I)Lio/getstream/video/android/compose/theme/StreamColors;
public fun getDimens (Landroidx/compose/runtime/Composer;I)Lio/getstream/video/android/compose/theme/StreamDimens;
public fun getReactionMapper (Landroidx/compose/runtime/Composer;I)Lio/getstream/video/android/core/mapper/ReactionMapper;
public fun getRippleTheme (Landroidx/compose/runtime/Composer;I)Landroidx/compose/material/ripple/RippleTheme;
public fun getRippleConfiguration (Landroidx/compose/runtime/Composer;I)Landroidx/compose/material/RippleConfiguration;
public fun getShapes (Landroidx/compose/runtime/Composer;I)Lio/getstream/video/android/compose/theme/StreamShapes;
public fun getStyles (Landroidx/compose/runtime/Composer;I)Lio/getstream/video/android/compose/ui/components/base/styling/CompositeStyleProvider;
public fun getTypography (Landroidx/compose/runtime/Composer;I)Lio/getstream/video/android/compose/theme/StreamTypography;
Expand Down Expand Up @@ -350,7 +356,7 @@ public final class io/getstream/video/android/compose/theme/VideoTheme : io/gets
}

public final class io/getstream/video/android/compose/theme/VideoThemeKt {
public static final fun VideoTheme (ZLio/getstream/video/android/compose/theme/StreamColors;Lio/getstream/video/android/compose/theme/StreamDimens;Lio/getstream/video/android/compose/theme/StreamTypography;Lio/getstream/video/android/compose/theme/StreamShapes;Landroidx/compose/material/ripple/RippleTheme;Lio/getstream/video/android/core/mapper/ReactionMapper;ZLio/getstream/video/android/compose/ui/components/base/styling/CompositeStyleProvider;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V
public static final fun VideoTheme (ZLio/getstream/video/android/compose/theme/StreamColors;Lio/getstream/video/android/compose/theme/StreamDimens;Lio/getstream/video/android/compose/theme/StreamTypography;Lio/getstream/video/android/compose/theme/StreamShapes;Lio/getstream/video/android/compose/theme/StreamRippleConfiguration;Lio/getstream/video/android/core/mapper/ReactionMapper;ZLio/getstream/video/android/compose/ui/components/base/styling/CompositeStyleProvider;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V
}

public final class io/getstream/video/android/compose/ui/ComposableSingletons$StreamCallActivityComposeDelegateKt {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,31 @@
* limitations under the License.
*/

@file:OptIn(ExperimentalMaterialApi::class)

package io.getstream.video.android.compose.theme

import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.LocalContentColor
import androidx.compose.material.LocalRippleConfiguration
import androidx.compose.material.MaterialTheme
import androidx.compose.material.ripple.RippleAlpha
import androidx.compose.material.ripple.RippleTheme
import androidx.compose.material.RippleConfiguration
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.ui.graphics.Color
import androidx.compose.runtime.ReadOnlyComposable

/**
* A modified version of the default [RippleTheme] from [MaterialTheme] which
* A modified version of the default [RippleConfiguration] from [MaterialTheme] which
* works in case the [MaterialTheme] is not initialized.
*/
@Immutable
internal object StreamRippleTheme : RippleTheme {
@Composable
override fun defaultColor(): Color {
return RippleTheme.defaultRippleColor(
contentColor = LocalContentColor.current,
lightTheme = !isSystemInDarkTheme(),
)
}
public object StreamRippleConfiguration {

@Composable
override fun rippleAlpha(): RippleAlpha {
return RippleTheme.defaultRippleAlpha(
contentColor = LocalContentColor.current,
lightTheme = !isSystemInDarkTheme(),
)
@ReadOnlyComposable
public fun default(): RippleConfiguration {
val rippleConfiguration = LocalRippleConfiguration.current
if (rippleConfiguration != null) return rippleConfiguration

val contentColor = LocalContentColor.current
return RippleConfiguration(color = contentColor)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ package io.getstream.video.android.compose.theme

import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Box
import androidx.compose.material.ripple.LocalRippleTheme
import androidx.compose.material.ripple.RippleTheme
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.LocalRippleConfiguration
import androidx.compose.material.RippleConfiguration
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.ReadOnlyComposable
Expand Down Expand Up @@ -72,18 +73,19 @@ private val LocalStyles = compositionLocalOf<CompositeStyleProvider> {
* @param dimens The set of dimens we provide, wrapped in [StreamDimens].
* @param typography The set of typography styles we provide, wrapped in [StreamTypography].
* @param shapes The set of shapes we provide, wrapped in [StreamShapes].
* @param rippleTheme Defines the appearance for ripples.
* @param rippleConfiguration Defines the appearance for ripples.
* @param reactionMapper Defines a mapper of the emoji code from the reaction events.
* @param content The content shown within the theme wrapper.
*/
@Composable
@OptIn(ExperimentalMaterialApi::class)
public fun VideoTheme(
isInDarkMode: Boolean = isSystemInDarkTheme(),
colors: StreamColors = StreamColors.defaultColors(),
dimens: StreamDimens = StreamDimens.defaultDimens(),
typography: StreamTypography = StreamTypography.defaultTypography(colors, dimens),
shapes: StreamShapes = StreamShapes.defaultShapes(dimens),
rippleTheme: RippleTheme = StreamRippleTheme,
rippleConfiguration: StreamRippleConfiguration = StreamRippleConfiguration,
reactionMapper: ReactionMapper = ReactionMapper.defaultReactionMapper(),
allowUIAutomationTest: Boolean = true,
styles: CompositeStyleProvider = CompositeStyleProvider(),
Expand All @@ -94,7 +96,7 @@ public fun VideoTheme(
LocalDimens provides dimens,
LocalTypography provides typography,
LocalShapes provides shapes,
LocalRippleTheme provides rippleTheme,
LocalRippleConfiguration provides rippleConfiguration.default(),
LocalReactionMapper provides reactionMapper,
LocalStyles provides styles,
) {
Expand All @@ -108,6 +110,7 @@ public fun VideoTheme(
}
}

@OptIn(ExperimentalMaterialApi::class)
public interface StreamTheme {
/**
* Retrieves the current [StreamColors] at the call site's position in the hierarchy.
Expand Down Expand Up @@ -138,11 +141,11 @@ public interface StreamTheme {
get() = LocalShapes.current

/**
* Retrieves the current [RippleTheme] at the call site's position in the hierarchy.
* Retrieves the current [RippleConfiguration] at the call site's position in the hierarchy.
*/
public val rippleTheme: RippleTheme
public val rippleConfiguration: RippleConfiguration?
@Composable @ReadOnlyComposable
get() = LocalRippleTheme.current
get() = StreamRippleConfiguration.default()

/**
* Retrieves the current [ReactionMapper] at the call site's position in the hierarchy.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.material.ripple
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
Expand Down Expand Up @@ -107,7 +107,7 @@ internal fun Avatar(
val clickableModifier: Modifier = if (onClick != null) {
modifier.clickable(
onClick = onClick,
indication = rememberRipple(bounded = false),
indication = ripple(bounded = false),
interactionSource = remember { MutableInteractionSource() },
)
} else {
Expand Down

0 comments on commit fa44c8d

Please sign in to comment.