|
|
|
|
@ -1,9 +1,9 @@
|
|
|
|
|
import 'dart:convert';
|
|
|
|
|
import 'dart:math';
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
|
import 'package:firebase_messaging/firebase_messaging.dart';
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
import 'package:flutter_callkit_incoming/entities/entities.dart';
|
|
|
|
|
import 'package:flutter_callkit_incoming/flutter_callkit_incoming.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/api/chat/chat_api_client.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/app_state/app_state.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/classes/consts.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/classes/utils.dart';
|
|
|
|
|
@ -124,29 +124,7 @@ class ChatVoipCall {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
Utils.showToast("Offline END Call", longDuration: true);
|
|
|
|
|
HttpConnectionOptions httpOp = HttpConnectionOptions(skipNegotiation: false, logMessageContent: true);
|
|
|
|
|
HubConnection _bghc = HubConnectionBuilder()
|
|
|
|
|
.withUrl(ApiConsts.chatHubConnectionUrl + "?UserId=${data.extra!.loginDetails!.id}&source=Desktop&access_token=${data.extra?.loginDetails!.token}", options: httpOp)
|
|
|
|
|
.withAutomaticReconnect(retryDelays: <int>[2000, 5000, 10000, 20000]).build();
|
|
|
|
|
await _bghc.start();
|
|
|
|
|
await _bghc.invoke(
|
|
|
|
|
"HangUpAsync",
|
|
|
|
|
args: [
|
|
|
|
|
data.extra!.callerDetails!.currentUserId!,
|
|
|
|
|
data.extra!.callerDetails!.targetUserId!,
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
_bghc.invoke("UpdateUserStatusAsync", args: [
|
|
|
|
|
int.parse(data.extra!.callerDetails!.currentUserId.toString()),
|
|
|
|
|
2,
|
|
|
|
|
]);
|
|
|
|
|
FlutterCallkitIncoming.endAllCalls();
|
|
|
|
|
if (!isUserOnline) {
|
|
|
|
|
_bghc.stop();
|
|
|
|
|
} else {
|
|
|
|
|
chatHubConnection = _bghc;
|
|
|
|
|
}
|
|
|
|
|
await ChatApiClient().callDecline(cUserID: data.extra!.callerDetails!.targetUserId!, tUserID: data.extra!.callerDetails!.currentUserId!, targetUsertoken: data.extra!.loginDetails!.token!);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|