@@ -118,7 +118,7 @@ class _StreamDogFoodingAppContentState
118
118
}
119
119
120
120
void _tryConsumingIncomingCallFromTerminatedState () {
121
- if (CurrentPlatform .isIos ) return ;
121
+ if (! CurrentPlatform .isAndroid ) return ;
122
122
123
123
if (_router.routerDelegate.navigatorKey.currentContext == null ) {
124
124
// App is not running yet. Postpone consuming after app is in the foreground
@@ -143,32 +143,36 @@ class _StreamDogFoodingAppContentState
143
143
void _observeCallKitEvents () {
144
144
final streamVideo = locator.get <StreamVideo >();
145
145
146
- _compositeSubscription.add (
147
- streamVideo.observeCoreCallKitEvents (
148
- onCallAccepted: (callToJoin) {
149
- // Navigate to the call screen.
150
- final extra = (
151
- call: callToJoin,
152
- connectOptions: null ,
153
- );
154
-
155
- _router.push (CallRoute ($extra: extra).location, extra: extra);
156
- },
157
- ),
158
- );
146
+ // On mobile we depend on call kit notifications.
147
+ // On desktop and web they are (currently) not available, so we depend on a
148
+ // websocket which can receive a call when the app is open.
149
+ if (CurrentPlatform .isMobile) {
150
+ _compositeSubscription.add (
151
+ streamVideo.observeCoreCallKitEvents (
152
+ onCallAccepted: (callToJoin) {
153
+ // Navigate to the call screen.
154
+ final extra = (
155
+ call: callToJoin,
156
+ connectOptions: null ,
157
+ );
159
158
160
- // UNCOMMENT THIS TO SHOW IN-APP INCOMING SCREEN
161
- // _compositeSubscription.add(streamVideo.state.incomingCall.listen((call) {
162
- // if (call == null) return;
159
+ _router.push (CallRoute ($extra: extra).location, extra: extra);
160
+ },
161
+ ),
162
+ );
163
+ } else {
164
+ _compositeSubscription.add (streamVideo.state.incomingCall.listen ((call) {
165
+ if (call == null ) return ;
163
166
164
- // // Navigate to the call screen.
165
- // final extra = (
166
- // call: call,
167
- // connectOptions: null,
168
- // );
167
+ // Navigate to the call screen.
168
+ final extra = (
169
+ call: call,
170
+ connectOptions: null ,
171
+ );
169
172
170
- // _router.push(CallRoute($extra: extra).location, extra: extra);
171
- // }));
173
+ _router.push (CallRoute ($extra: extra).location, extra: extra);
174
+ }));
175
+ }
172
176
}
173
177
174
178
_observeFcmMessages () {
0 commit comments