Skip to content

Commit

Permalink
Merge branch 'refs/heads/develop' into socket_improvements
Browse files Browse the repository at this point in the history
# Conflicts:
#	stream-video-android-core/api/stream-video-android-core.api
#	stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/internal/network/NetworkStateProvider.kt
#	stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/utils/AndroidUtils.kt
  • Loading branch information
aleksandar-apostolov committed Sep 10, 2024
2 parents 8a2b619 + 9b4ffee commit 0ac3e31
Show file tree
Hide file tree
Showing 24 changed files with 641 additions and 258 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ object Configuration {
const val minSdk = 24
const val majorVersion = 1
const val minorVersion = 0
const val patchVersion = 12
const val patchVersion = 13
const val versionName = "$majorVersion.$minorVersion.$patchVersion"
const val versionCode = 36
const val versionCode = 37
const val snapshotVersionName = "$majorVersion.$minorVersion.${patchVersion + 1}-SNAPSHOT"
const val artifactGroup = "io.getstream"
const val streamVideoCallGooglePlayVersion = "1.1.5"
const val streamVideoCallGooglePlayVersion = "1.1.6"
const val streamWebRtcVersionName = "1.1.1"
}
23 changes: 11 additions & 12 deletions docusaurus/docs/Android/04-ui-components/06-ui-previews.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ Now, you can implement your preview composable like the example below:
@Preview
@Composable
private fun CallContentPreview() {
StreamMockUtils.initializeStreamVideo(LocalContext.current)
StreamPreviewDataUtils.initializeStreamVideo(LocalContext.current)
VideoTheme {
CallContent(
modifier = Modifier.background(color = VideoTheme.colors.appBackground),
call = mockCall,
call = previewCall,
)
}
}
Expand All @@ -49,29 +48,29 @@ After adding the above example to your project, you'll see the following preview

You should follow the steps below to make your previews work well:

1. Initialize a mock `StreamVideo` with the following method: `StreamMockUtils.initializeStreamVideo`.
1. Initialize a mock `StreamVideo` with the following method: `StreamPreviewDataUtils.initializeStreamVideo`.
2. Wrap your composable with the `VideoTheme`.
3. Use the provided mock instances for Stream Video UI components.

This library provides the following mocks:

- **mockCall**: Mock a `Call` that contains few of mock users.
- **mockParticipant**: Mock a `ParticipantState` instance.
- **mockParticipantList**: Mock a list of `ParticipantState` instances.
- **mockUsers**: Mock a list of `User` instances.
- **mockVideoMediaTrack**: Mock a new `MediaTrack` instance.
- **previewCall**: Mock a `Call` that contains few of mock users.
- **previewParticipant**: Mock a `ParticipantState` instance.
- **previewParticipantsList**: Mock a list of `ParticipantState` instances.
- **previewUsers**: Mock a list of `User` instances.
- **previewVideoMediaTrack**: Mock a new `MediaTrack` instance.

For example, you can build a preview Composable for `ParticipantVideo` as in the example below:

```kotlin
@Preview
@Composable
private fun ParticipantVideoPreview() {
StreamMockUtils.initializeStreamVideo(LocalContext.current)
StreamPreviewDataUtils.initializeStreamVideo(LocalContext.current)
VideoTheme {
ParticipantVideoRenderer(
call = mockCall,
participant = mockParticipant,
call = previewCall,
participant = previewParticipant,
)
}
}
Expand Down
10 changes: 5 additions & 5 deletions docusaurus/docs/Android/04-ui-components/07-ui-testing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ScreenTests {
composable: @Composable () -> Unit
) {
paparazzi.snapshot(name = name) {
StreamMockUtils.initializeStreamVideo(LocalContext.current)
StreamPreviewDataUtils.initializeStreamVideo(LocalContext.current)
CompositionLocalProvider(
LocalInspectionMode provides true,
LocalAvatarPreviewPlaceholder provides
Expand All @@ -49,7 +49,7 @@ class ScreenTests {
@Test
fun `snapshot CallContent component`() {
snapshot(name = "CallContent") {
CallContent(call = mockCall)
CallContent(call = previewCall)
}
}

Expand All @@ -58,7 +58,7 @@ class ScreenTests {
snapshot(name = "CallLobby") {
CallLobby(
modifier = Modifier.fillMaxWidth(),
call = mockCall
call = previewCall
)
}
}
Expand All @@ -70,7 +70,7 @@ Let's break the code down line by line.
First, you should initialize Stream Video SDK with the `initializeStreamVideo()` method. You can learn more about our mock library on [UI Previews](07-ui-previews.mdx).

```kotlin
StreamMockUtils.initializeStreamVideo(LocalContext.current)
StreamPreviewDataUtils.initializeStreamVideo(LocalContext.current)
```

Next, you should enable `LocalInspectionMode` with the `CompositionLocalProvider` and allow Stream UI components to be rendered for the test environment.
Expand All @@ -90,7 +90,7 @@ Finally, snapshot Stream Video components or your own Composable functions that
@Test
fun `snapshot CallContent component`() {
snapshot(name = "CallContent") {
CallContent(call = mockCall)
CallContent(call = previewCall)
}
}
```
Expand Down
Loading

0 comments on commit 0ac3e31

Please sign in to comment.