@@ -144,6 +144,8 @@ class ConnectycubeFlutterCallKit {
144
144
String ? icon,
145
145
String ? notificationIcon,
146
146
String ? color}) {
147
+ if (! Platform .isAndroid && ! Platform .isIOS) return Future .value ();
148
+
147
149
return _methodChannel.invokeMethod ('updateConfig' , {
148
150
'ringtone' : ringtone,
149
151
'icon' : icon,
@@ -155,20 +157,26 @@ class ConnectycubeFlutterCallKit {
155
157
/// Returns VoIP token for iOS plaform.
156
158
/// Returns FCM token for Android platform
157
159
static Future <String ?> getToken () {
160
+ if (! Platform .isAndroid && ! Platform .isIOS) return Future .value (null );
161
+
158
162
return _methodChannel.invokeMethod ('getVoipToken' , {}).then ((result) {
159
163
return result? .toString ();
160
164
});
161
165
}
162
166
163
167
/// Show incoming call notification
164
168
static Future <void > showCallNotification (CallEvent callEvent) async {
169
+ if (! Platform .isAndroid && ! Platform .isIOS) return Future .value ();
170
+
165
171
return _methodChannel.invokeMethod (
166
172
"showCallNotification" , callEvent.toMap ());
167
173
}
168
174
169
175
/// Report that the current active call has been accepted by your application
170
176
///
171
177
static Future <void > reportCallAccepted ({required String ? sessionId}) async {
178
+ if (! Platform .isAndroid && ! Platform .isIOS) return Future .value ();
179
+
172
180
return _methodChannel
173
181
.invokeMethod ("reportCallAccepted" , {'session_id' : sessionId});
174
182
}
@@ -177,17 +185,22 @@ class ConnectycubeFlutterCallKit {
177
185
static Future <void > reportCallEnded ({
178
186
required String ? sessionId,
179
187
}) async {
188
+ if (! Platform .isAndroid && ! Platform .isIOS) return Future .value ();
189
+
180
190
return _methodChannel.invokeMethod ("reportCallEnded" , {
181
191
'session_id' : sessionId,
182
192
});
183
193
}
184
194
185
195
/// Get the current call state
186
196
///
187
- /// Other platforms than Android and iOS will receive [CallState.unknown ]
197
+ /// Other platforms than Android and iOS will receive [CallState.UNKNOWN ]
188
198
static Future <String > getCallState ({
189
199
required String ? sessionId,
190
200
}) async {
201
+ if (! Platform .isAndroid && ! Platform .isIOS)
202
+ return Future .value (CallState .UNKNOWN );
203
+
191
204
return _methodChannel.invokeMethod ("getCallState" , {
192
205
'session_id' : sessionId,
193
206
}).then ((state) {
@@ -200,6 +213,8 @@ class ConnectycubeFlutterCallKit {
200
213
required String ? sessionId,
201
214
required String ? callState,
202
215
}) async {
216
+ if (! Platform .isAndroid && ! Platform .isIOS) return Future .value ();
217
+
203
218
return _methodChannel.invokeMethod ("setCallState" , {
204
219
'session_id' : sessionId,
205
220
'call_state' : callState,
@@ -210,6 +225,8 @@ class ConnectycubeFlutterCallKit {
210
225
static Future <Map <String , dynamic >?> getCallData ({
211
226
required String ? sessionId,
212
227
}) async {
228
+ if (! Platform .isAndroid && ! Platform .isIOS) return Future .value (null );
229
+
213
230
return _methodChannel.invokeMethod ("getCallData" , {
214
231
'session_id' : sessionId,
215
232
}).then ((data) {
@@ -224,6 +241,8 @@ class ConnectycubeFlutterCallKit {
224
241
static Future <void > clearCallData ({
225
242
required String ? sessionId,
226
243
}) async {
244
+ if (! Platform .isAndroid && ! Platform .isIOS) return Future .value ();
245
+
227
246
return _methodChannel.invokeMethod ("clearCallData" , {
228
247
'session_id' : sessionId,
229
248
});
@@ -232,6 +251,8 @@ class ConnectycubeFlutterCallKit {
232
251
/// Returns the id of the last displayed call.
233
252
/// It is useful on starting app step for navigation to the call screen if the call was accepted
234
253
static Future <String ?> getLastCallId () async {
254
+ if (! Platform .isAndroid && ! Platform .isIOS) return Future .value (null );
255
+
235
256
return _methodChannel.invokeMethod ("getLastCallId" );
236
257
}
237
258
0 commit comments