@@ -28,6 +28,7 @@ import androidx.compose.foundation.layout.ColumnScope
2828import androidx.compose.foundation.layout.Spacer
2929import androidx.compose.foundation.layout.fillMaxSize
3030import androidx.compose.foundation.layout.size
31+ import androidx.compose.foundation.layout.systemBarsPadding
3132import androidx.compose.material.Text
3233import androidx.compose.runtime.Composable
3334import androidx.compose.runtime.getValue
@@ -97,124 +98,130 @@ public open class StreamCallActivityComposeDelegate : StreamCallActivityComposeU
9798 override fun setContent (activity : StreamCallActivity , call : Call ) {
9899 logger.d { " [setContent(activity, call)] invoked from compose delegate." }
99100 activity.setContent {
100- logger.d { " [setContent] with RootContent" }
101- activity.RootContent (call = call)
101+ VideoTheme {
102+ Box (
103+ modifier = Modifier
104+ .background(VideoTheme .colors.baseSheetPrimary)
105+ .systemBarsPadding(),
106+ ) {
107+ logger.d { " [setContent] with RootContent" }
108+ activity.RootContent (call = call)
109+ }
110+ }
102111 }
103112 }
104113
105114 @StreamCallActivityDelicateApi
106115 @Composable
107116 override fun StreamCallActivity.RootContent (call : Call ) {
108- VideoTheme {
109- var callAction: CallAction by remember {
110- mutableStateOf(CustomAction (tag = " initial" ))
111- }
117+ var callAction: CallAction by remember {
118+ mutableStateOf(CustomAction (tag = " initial" ))
119+ }
112120
113- when (callAction) {
114- is LeaveCall , is DeclineCall , is CancelCall -> {
115- CallDisconnectedContent (call)
116- }
121+ when (callAction) {
122+ is LeaveCall , is DeclineCall , is CancelCall -> {
123+ CallDisconnectedContent (call)
124+ }
117125
118- else -> {
119- LaunchPermissionRequest (listOf (Manifest .permission.RECORD_AUDIO )) {
120- AllPermissionsGranted {
121- // All permissions granted
122- RingingCallContent (
123- isVideoType = isVideoCall(call),
124- call = call,
125- modifier = Modifier .background(
126- color = VideoTheme .colors.baseSheetPrimary,
127- ),
128- onBackPressed = {
129- onBackPressed(call)
130- },
131- onOutgoingContent = {
132- modifier: Modifier ,
133- call: Call ,
134- isVideoType: Boolean ,
135- isShowingHeader: Boolean ,
136- headerContent: @Composable (ColumnScope .() -> Unit )? ,
137- detailsContent: @Composable (
138- ColumnScope .(
139- participants: List <MemberState >,
140- topPadding: Dp ,
141- ) -> Unit
142- )? ,
143- controlsContent: @Composable (BoxScope .() -> Unit )? ,
144- onBackPressed: () -> Unit ,
145- onCallAction: (CallAction ) -> Unit ,
146- ->
147- OutgoingCallContent (
148- call = call,
149- isVideoType = isVideoType,
150- modifier = modifier,
151- isShowingHeader = isShowingHeader,
152- headerContent = headerContent,
153- detailsContent = detailsContent,
154- controlsContent = controlsContent,
155- onBackPressed = onBackPressed,
156- onCallAction = onCallAction,
157- )
158- },
159- onIncomingContent = {
160- modifier: Modifier ,
161- call: Call ,
162- isVideoType: Boolean , isShowingHeader: Boolean ,
163- headerContent: @Composable (ColumnScope .() -> Unit )? ,
164- detailsContent: @Composable (
165- ColumnScope .(
166- participants: List <MemberState >,
167- topPadding: Dp ,
168- ) -> Unit
169- )? ,
170- controlsContent: @Composable (BoxScope .() -> Unit )? ,
171- onBackPressed: () -> Unit ,
172- onCallAction: (CallAction ) -> Unit ,
173- ->
174- IncomingCallContent (
175- call = call,
176- isVideoType = isVideoType,
177- modifier = modifier,
178- isShowingHeader = isShowingHeader,
179- headerContent = headerContent,
180- detailsContent = detailsContent,
181- controlsContent = controlsContent,
182- onBackPressed = onBackPressed,
183- onCallAction = onCallAction,
184- )
185- },
186- onAcceptedContent = {
187- ConnectionAvailable (call = call) { theCall ->
188- if (isVideoCall(theCall)) {
189- VideoCallContent (call = theCall)
190- } else {
191- AudioCallContent (call = theCall)
192- }
126+ else -> {
127+ LaunchPermissionRequest (listOf (Manifest .permission.RECORD_AUDIO )) {
128+ AllPermissionsGranted {
129+ // All permissions granted
130+ RingingCallContent (
131+ isVideoType = isVideoCall(call),
132+ call = call,
133+ modifier = Modifier .background(
134+ color = VideoTheme .colors.baseSheetPrimary,
135+ ),
136+ onBackPressed = {
137+ onBackPressed(call)
138+ },
139+ onOutgoingContent = {
140+ modifier: Modifier ,
141+ call: Call ,
142+ isVideoType: Boolean ,
143+ isShowingHeader: Boolean ,
144+ headerContent: @Composable (ColumnScope .() -> Unit )? ,
145+ detailsContent: @Composable (
146+ ColumnScope .(
147+ participants: List <MemberState >,
148+ topPadding: Dp ,
149+ ) -> Unit
150+ )? ,
151+ controlsContent: @Composable (BoxScope .() -> Unit )? ,
152+ onBackPressed: () -> Unit ,
153+ onCallAction: (CallAction ) -> Unit ,
154+ ->
155+ OutgoingCallContent (
156+ call = call,
157+ isVideoType = isVideoType,
158+ modifier = modifier,
159+ isShowingHeader = isShowingHeader,
160+ headerContent = headerContent,
161+ detailsContent = detailsContent,
162+ controlsContent = controlsContent,
163+ onBackPressed = onBackPressed,
164+ onCallAction = onCallAction,
165+ )
166+ },
167+ onIncomingContent = {
168+ modifier: Modifier ,
169+ call: Call ,
170+ isVideoType: Boolean , isShowingHeader: Boolean ,
171+ headerContent: @Composable (ColumnScope .() -> Unit )? ,
172+ detailsContent: @Composable (
173+ ColumnScope .(
174+ participants: List <MemberState >,
175+ topPadding: Dp ,
176+ ) -> Unit
177+ )? ,
178+ controlsContent: @Composable (BoxScope .() -> Unit )? ,
179+ onBackPressed: () -> Unit ,
180+ onCallAction: (CallAction ) -> Unit ,
181+ ->
182+ IncomingCallContent (
183+ call = call,
184+ isVideoType = isVideoType,
185+ modifier = modifier,
186+ isShowingHeader = isShowingHeader,
187+ headerContent = headerContent,
188+ detailsContent = detailsContent,
189+ controlsContent = controlsContent,
190+ onBackPressed = onBackPressed,
191+ onCallAction = onCallAction,
192+ )
193+ },
194+ onAcceptedContent = {
195+ ConnectionAvailable (call = call) { theCall ->
196+ if (isVideoCall(theCall)) {
197+ VideoCallContent (call = theCall)
198+ } else {
199+ AudioCallContent (call = theCall)
193200 }
194- },
195- onNoAnswerContent = {
196- NoAnswerContent (call)
197- },
198- onRejectedContent = {
199- RejectedContent (call)
200- },
201- onCallAction = {
202- onCallAction(call, it)
203- callAction = it
204- },
205- onIdle = {
206- LoadingContent (call)
207- },
208- )
209- }
201+ }
202+ },
203+ onNoAnswerContent = {
204+ NoAnswerContent (call)
205+ },
206+ onRejectedContent = {
207+ RejectedContent (call)
208+ },
209+ onCallAction = {
210+ onCallAction(call, it)
211+ callAction = it
212+ },
213+ onIdle = {
214+ LoadingContent (call)
215+ },
216+ )
217+ }
210218
211- SomeGranted { granted, notGranted, showRationale ->
212- InternalPermissionContent (showRationale, call, granted, notGranted)
213- }
219+ SomeGranted { granted, notGranted, showRationale ->
220+ InternalPermissionContent (showRationale, call, granted, notGranted)
221+ }
214222
215- NoneGranted {
216- InternalPermissionContent (it, call, emptyList(), emptyList())
217- }
223+ NoneGranted {
224+ InternalPermissionContent (it, call, emptyList(), emptyList())
218225 }
219226 }
220227 }
0 commit comments