Merge branch 'development_aamir' into 'master'
Chat Incoming Call / Out Going Call See merge request Cloud_Solution/mohemm-flutter-app!188merge-requests/188/merge
commit
bc993ce33d
Binary file not shown.
Binary file not shown.
@ -0,0 +1,203 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter_callkit_incoming/entities/entities.dart';
|
||||||
|
import 'package:flutter_callkit_incoming/flutter_callkit_incoming.dart';
|
||||||
|
import 'package:mohem_flutter_app/app_state/app_state.dart';
|
||||||
|
import 'package:mohem_flutter_app/classes/navigationService.dart';
|
||||||
|
import 'package:mohem_flutter_app/classes/notifications.dart';
|
||||||
|
import 'package:mohem_flutter_app/classes/utils.dart';
|
||||||
|
import 'package:mohem_flutter_app/config/routes.dart';
|
||||||
|
import 'package:mohem_flutter_app/main.dart';
|
||||||
|
import 'package:mohem_flutter_app/models/chat/call.dart';
|
||||||
|
import 'package:mohem_flutter_app/models/chat/get_single_user_chat_list_model.dart';
|
||||||
|
import 'package:mohem_flutter_app/models/chat/get_user_login_token_model.dart' as ALM;
|
||||||
|
import 'package:mohem_flutter_app/models/chat/get_user_login_token_model.dart';
|
||||||
|
import 'package:mohem_flutter_app/provider/chat_call_provider.dart';
|
||||||
|
import 'package:mohem_flutter_app/provider/chat_provider_model.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class ChatVoipCall {
|
||||||
|
static final ChatVoipCall _instance = ChatVoipCall._internal();
|
||||||
|
|
||||||
|
ChatVoipCall._internal();
|
||||||
|
|
||||||
|
factory ChatVoipCall() => _instance;
|
||||||
|
|
||||||
|
late ChatProviderModel prov;
|
||||||
|
late ChatCallProvider cProv;
|
||||||
|
dynamic inCallData;
|
||||||
|
bool isUserOnline = false;
|
||||||
|
dynamic callData;
|
||||||
|
|
||||||
|
Future<void> showCallkitIncoming({required String uuid, RemoteMessage? data, CallDataModel? incomingCallData, bool background = false}) async {
|
||||||
|
await ChatVoipCall().listenerEvent();
|
||||||
|
await FlutterCallkitIncoming.endAllCalls();
|
||||||
|
ALM.Response autoLoginData;
|
||||||
|
SingleUserChatModel callerData;
|
||||||
|
if (data!.data["user_token_response"] == null || data.data["user_token_response"].isEmpty) {
|
||||||
|
// Online & App Logged In
|
||||||
|
ALM.Response sharedDetails = ALM.Response.fromJson(jsonDecode(await Utils.getStringFromPrefs("userLoginChatDetails")));
|
||||||
|
|
||||||
|
autoLoginData = ALM.Response.fromJson(AppState().getchatUserDetails == null ? sharedDetails.toJson() : AppState().getchatUserDetails!.response!.toJson());
|
||||||
|
dynamic items = jsonDecode(data!.data["user_chat_history_response"]);
|
||||||
|
callerData = SingleUserChatModel(
|
||||||
|
targetUserId: items["CurrentUserId"],
|
||||||
|
targetUserEmail: items["CurrentUserEmail"],
|
||||||
|
targetUserName: items["CurrentUserName"].split("@").first,
|
||||||
|
currentUserId: autoLoginData.id,
|
||||||
|
currentUserEmail: autoLoginData.email,
|
||||||
|
currentUserName: autoLoginData.userName,
|
||||||
|
chatEventId: 3);
|
||||||
|
isUserOnline = true;
|
||||||
|
} else {
|
||||||
|
// Offline or App in Background or App is At Verify Screen
|
||||||
|
autoLoginData = ALM.Response.fromJson(jsonDecode(data.data["user_token_response"]));
|
||||||
|
callerData = SingleUserChatModel.fromJson(json.decode(data!.data["user_chat_history_response"]));
|
||||||
|
}
|
||||||
|
CallKitParams params = CallKitParams(
|
||||||
|
id: uuid,
|
||||||
|
nameCaller: callerData.targetUserName,
|
||||||
|
appName: 'Mohemm',
|
||||||
|
handle: '',
|
||||||
|
type: 0,
|
||||||
|
duration: 25000,
|
||||||
|
textAccept: 'Accept',
|
||||||
|
textDecline: 'Decline',
|
||||||
|
textMissedCall: 'Missed call',
|
||||||
|
textCallback: 'Call back',
|
||||||
|
extra: {
|
||||||
|
"loginDetails": autoLoginData.toJson(),
|
||||||
|
"callerDetails": callerData.toJson(),
|
||||||
|
'isIncomingCall': true,
|
||||||
|
},
|
||||||
|
android: const AndroidParams(
|
||||||
|
isCustomNotification: true,
|
||||||
|
isShowLogo: false,
|
||||||
|
isShowCallback: false,
|
||||||
|
isShowMissedCallNotification: true,
|
||||||
|
ringtonePath: 'system_ringtone_default',
|
||||||
|
backgroundColor: '#0955fa',
|
||||||
|
backgroundUrl: 'assets/test.png',
|
||||||
|
actionColor: '#4CAF50',
|
||||||
|
),
|
||||||
|
ios: IOSParams(
|
||||||
|
iconName: 'Mohemm',
|
||||||
|
handleType: '',
|
||||||
|
supportsVideo: true,
|
||||||
|
maximumCallGroups: 2,
|
||||||
|
maximumCallsPerCallGroup: 1,
|
||||||
|
audioSessionMode: 'default',
|
||||||
|
audioSessionActive: true,
|
||||||
|
audioSessionPreferredSampleRate: 38000.0,
|
||||||
|
audioSessionPreferredIOBufferDuration: 0.005,
|
||||||
|
supportsDTMF: true,
|
||||||
|
supportsHolding: true,
|
||||||
|
supportsGrouping: false,
|
||||||
|
supportsUngrouping: false,
|
||||||
|
ringtonePath: 'system_ringtone_default',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if (callerData.chatEventId == 3) {
|
||||||
|
await Utils.saveStringFromPrefs("isIncomingCall", "true");
|
||||||
|
await FlutterCallkitIncoming.showCallkitIncoming(params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Future getCurrentCall() async {
|
||||||
|
var calls = await FlutterCallkitIncoming.activeCalls();
|
||||||
|
if (calls is List) {
|
||||||
|
if (calls.isNotEmpty) {
|
||||||
|
return calls[0];
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkAndNavigationCallingPage() async {
|
||||||
|
var currentCall = await getCurrentCall();
|
||||||
|
if (currentCall != null) {
|
||||||
|
Future.delayed(const Duration(seconds: 2)).whenComplete(() {
|
||||||
|
Navigator.pushNamed(AppRoutes.navigatorKey.currentContext!, AppRoutes.chatStartCall);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> isCall() async {
|
||||||
|
var calls = await FlutterCallkitIncoming.activeCalls();
|
||||||
|
if (calls is List) {
|
||||||
|
if (calls.isNotEmpty) {
|
||||||
|
NavigationService.navigateTo(AppRoutes.chatStartCall);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Function(CallEvent) callback
|
||||||
|
Future<void> listenerEvent() async {
|
||||||
|
try {
|
||||||
|
FlutterCallkitIncoming.onEvent.listen((CallEvent? event) async {
|
||||||
|
switch (event!.event) {
|
||||||
|
case Event.ACTION_CALL_INCOMING:
|
||||||
|
break;
|
||||||
|
case Event.ACTION_CALL_START:
|
||||||
|
break;
|
||||||
|
case Event.ACTION_CALL_ACCEPT:
|
||||||
|
if (isUserOnline) {
|
||||||
|
checkAndNavigationCallingPage();
|
||||||
|
} else {
|
||||||
|
isCall();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Event.ACTION_CALL_DECLINE:
|
||||||
|
// cProv.isIncomingCall = true;
|
||||||
|
Utils.saveStringFromPrefs("isIncomingCall", "false");
|
||||||
|
Utils.saveStringFromPrefs("inComingCallData", "null");
|
||||||
|
|
||||||
|
// cProv.endCall(isUserOnline: true);
|
||||||
|
FlutterCallkitIncoming.endAllCalls();
|
||||||
|
break;
|
||||||
|
case Event.ACTION_CALL_ENDED:
|
||||||
|
Utils.saveStringFromPrefs("isIncomingCall", "false");
|
||||||
|
Utils.saveStringFromPrefs("inComingCallData", "null");
|
||||||
|
FlutterCallkitIncoming.endAllCalls();
|
||||||
|
break;
|
||||||
|
case Event.ACTION_CALL_TIMEOUT:
|
||||||
|
Utils.saveStringFromPrefs("isIncomingCall", "false");
|
||||||
|
Utils.saveStringFromPrefs("inComingCallData", "null");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} on Exception {}
|
||||||
|
}
|
||||||
|
|
||||||
|
void nothing() {
|
||||||
|
// if (!background) {
|
||||||
|
// await initProviders();
|
||||||
|
// if (data!.data["callType"] == "video") {
|
||||||
|
// cProv.isVideoCall = true;
|
||||||
|
// } else {
|
||||||
|
// cProv.isAudioCall = true;
|
||||||
|
// cProv.isVideoCall = false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // if(!background){}
|
||||||
|
// await initProviders();
|
||||||
|
|
||||||
|
// callData = jsonEncode([
|
||||||
|
// {
|
||||||
|
// "loginDetails": autoLoginData.toJson(),
|
||||||
|
// "callerDetails": callerData.toJson(),
|
||||||
|
// }
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// connection(data: callData, isUserOnline: isUserOnline).whenComplete(() => {});
|
||||||
|
// if (isUserOnline) {
|
||||||
|
// cProv.init();
|
||||||
|
// }
|
||||||
|
// if (!isUserOnline) {
|
||||||
|
// initProviders();
|
||||||
|
// }
|
||||||
|
// Navigator.pushNamed(AppRoutes.navigatorKey.currentContext!, AppRoutes.chatStartCall);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get_it/get_it.dart';
|
||||||
|
import 'package:mohem_flutter_app/app_state/app_state.dart';
|
||||||
|
import 'package:mohem_flutter_app/config/routes.dart';
|
||||||
|
|
||||||
|
final locator = GetIt.instance;
|
||||||
|
|
||||||
|
class NavigationService {
|
||||||
|
final GlobalKey<NavigatorState> navigatorKey = AppRoutes.navigatorKey;
|
||||||
|
|
||||||
|
static Future<dynamic> navigateTo(String routeName) {
|
||||||
|
var key = locator<NavigationService>().navigatorKey;
|
||||||
|
return key.currentState!.pushNamed(routeName);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<dynamic> navigateToPage(Widget page) {
|
||||||
|
var key = locator<NavigationService>().navigatorKey;
|
||||||
|
var pageRoute = MaterialPageRoute(builder: (context) => page);
|
||||||
|
return Navigator.push(key.currentContext!, pageRoute);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setupLocator() {
|
||||||
|
locator.registerLazySingleton( ()=> NavigationService());
|
||||||
|
}
|
||||||
@ -0,0 +1,329 @@
|
|||||||
|
// To parse this JSON data, do
|
||||||
|
//
|
||||||
|
// final incomingCallModel = incomingCallModelFromJson(jsonString);
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
class IncomingCallModel {
|
||||||
|
String? actionColor;
|
||||||
|
String? appName;
|
||||||
|
Args? args;
|
||||||
|
String? avatar;
|
||||||
|
String? backgroundColor;
|
||||||
|
String? backgroundUrl;
|
||||||
|
int? duration;
|
||||||
|
Extra? extra;
|
||||||
|
String? from;
|
||||||
|
String? handle;
|
||||||
|
Args? headers;
|
||||||
|
String? id;
|
||||||
|
bool? isAccepted;
|
||||||
|
bool? isCustomNotification;
|
||||||
|
bool? isCustomSmallExNotification;
|
||||||
|
bool? isShowCallback;
|
||||||
|
bool? isShowLogo;
|
||||||
|
bool? isShowMissedCallNotification;
|
||||||
|
String? nameCaller;
|
||||||
|
String? ringtonePath;
|
||||||
|
String? textAccept;
|
||||||
|
String? textCallback;
|
||||||
|
String? textDecline;
|
||||||
|
String? textMissedCall;
|
||||||
|
int? type;
|
||||||
|
String? uuid;
|
||||||
|
|
||||||
|
IncomingCallModel({
|
||||||
|
this.actionColor,
|
||||||
|
this.appName,
|
||||||
|
this.args,
|
||||||
|
this.avatar,
|
||||||
|
this.backgroundColor,
|
||||||
|
this.backgroundUrl,
|
||||||
|
this.duration,
|
||||||
|
this.extra,
|
||||||
|
this.from,
|
||||||
|
this.handle,
|
||||||
|
this.headers,
|
||||||
|
this.id,
|
||||||
|
this.isAccepted,
|
||||||
|
this.isCustomNotification,
|
||||||
|
this.isCustomSmallExNotification,
|
||||||
|
this.isShowCallback,
|
||||||
|
this.isShowLogo,
|
||||||
|
this.isShowMissedCallNotification,
|
||||||
|
this.nameCaller,
|
||||||
|
this.ringtonePath,
|
||||||
|
this.textAccept,
|
||||||
|
this.textCallback,
|
||||||
|
this.textDecline,
|
||||||
|
this.textMissedCall,
|
||||||
|
this.type,
|
||||||
|
this.uuid,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory IncomingCallModel.fromRawJson(String str) => IncomingCallModel.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String toRawJson() => json.encode(toJson());
|
||||||
|
|
||||||
|
factory IncomingCallModel.fromJson(Map<String, dynamic> json) => IncomingCallModel(
|
||||||
|
actionColor: json["actionColor"],
|
||||||
|
appName: json["appName"],
|
||||||
|
args: json["args"] == null ? null : Args.fromJson(json["args"]),
|
||||||
|
avatar: json["avatar"],
|
||||||
|
backgroundColor: json["backgroundColor"],
|
||||||
|
backgroundUrl: json["backgroundUrl"],
|
||||||
|
duration: json["duration"] == null ? null : json["duration"].toInt(),
|
||||||
|
extra: json["extra"] == null ? null : Extra.fromJson(json["extra"]),
|
||||||
|
from: json["from"],
|
||||||
|
handle: json["handle"],
|
||||||
|
headers: json["headers"] == null ? null : Args.fromJson(json["headers"]),
|
||||||
|
id: json["id"],
|
||||||
|
isAccepted: json["isAccepted"],
|
||||||
|
isCustomNotification: json["isCustomNotification"],
|
||||||
|
isCustomSmallExNotification: json["isCustomSmallExNotification"],
|
||||||
|
isShowCallback: json["isShowCallback"],
|
||||||
|
isShowLogo: json["isShowLogo"],
|
||||||
|
isShowMissedCallNotification: json["isShowMissedCallNotification"],
|
||||||
|
nameCaller: json["nameCaller"],
|
||||||
|
ringtonePath: json["ringtonePath"],
|
||||||
|
textAccept: json["textAccept"],
|
||||||
|
textCallback: json["textCallback"],
|
||||||
|
textDecline: json["textDecline"],
|
||||||
|
textMissedCall: json["textMissedCall"],
|
||||||
|
type: json["type"] == null ? null : json["type"].toInt(),
|
||||||
|
uuid: json["uuid"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"actionColor": actionColor,
|
||||||
|
"appName": appName,
|
||||||
|
"args": args?.toJson(),
|
||||||
|
"avatar": avatar,
|
||||||
|
"backgroundColor": backgroundColor,
|
||||||
|
"backgroundUrl": backgroundUrl,
|
||||||
|
"duration": duration,
|
||||||
|
"extra": extra?.toJson(),
|
||||||
|
"from": from,
|
||||||
|
"handle": handle,
|
||||||
|
"headers": headers?.toJson(),
|
||||||
|
"id": id,
|
||||||
|
"isAccepted": isAccepted,
|
||||||
|
"isCustomNotification": isCustomNotification,
|
||||||
|
"isCustomSmallExNotification": isCustomSmallExNotification,
|
||||||
|
"isShowCallback": isShowCallback,
|
||||||
|
"isShowLogo": isShowLogo,
|
||||||
|
"isShowMissedCallNotification": isShowMissedCallNotification,
|
||||||
|
"nameCaller": nameCaller,
|
||||||
|
"ringtonePath": ringtonePath,
|
||||||
|
"textAccept": textAccept,
|
||||||
|
"textCallback": textCallback,
|
||||||
|
"textDecline": textDecline,
|
||||||
|
"textMissedCall": textMissedCall,
|
||||||
|
"type": type,
|
||||||
|
"uuid": uuid,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
class Args {
|
||||||
|
Args();
|
||||||
|
|
||||||
|
factory Args.fromRawJson(String str) => Args.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String toRawJson() => json.encode(toJson());
|
||||||
|
|
||||||
|
factory Args.fromJson(Map<String, dynamic> json) => Args();
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {};
|
||||||
|
}
|
||||||
|
|
||||||
|
class Extra {
|
||||||
|
LoginDetails? loginDetails;
|
||||||
|
bool? isIncomingCall;
|
||||||
|
CallerDetails? callerDetails;
|
||||||
|
|
||||||
|
Extra({
|
||||||
|
this.loginDetails,
|
||||||
|
this.isIncomingCall,
|
||||||
|
this.callerDetails,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory Extra.fromRawJson(String str) => Extra.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String toRawJson() => json.encode(toJson());
|
||||||
|
|
||||||
|
factory Extra.fromJson(Map<String, dynamic> json) => Extra(
|
||||||
|
loginDetails: json["loginDetails"] == null ? null : LoginDetails.fromJson(json["loginDetails"]),
|
||||||
|
isIncomingCall: json["isIncomingCall"],
|
||||||
|
callerDetails: json["callerDetails"] == null ? null : CallerDetails.fromJson(json["callerDetails"]),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"loginDetails": loginDetails?.toJson(),
|
||||||
|
"isIncomingCall": isIncomingCall,
|
||||||
|
"callerDetails": callerDetails?.toJson(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
class CallerDetails {
|
||||||
|
int? userChatHistoryId;
|
||||||
|
String? contant;
|
||||||
|
FileTypeResponse? fileTypeResponse;
|
||||||
|
String? currentUserName;
|
||||||
|
String? targetUserEmail;
|
||||||
|
String? conversationId;
|
||||||
|
String? encryptedTargetUserId;
|
||||||
|
int? targetUserId;
|
||||||
|
bool? isSeen;
|
||||||
|
int? userChatHistoryLineId;
|
||||||
|
bool? isDelivered;
|
||||||
|
String? targetUserName;
|
||||||
|
int? currentUserId;
|
||||||
|
DateTime? createdDate;
|
||||||
|
String? currentUserEmail;
|
||||||
|
String? contantNo;
|
||||||
|
int? chatEventId;
|
||||||
|
String? encryptedTargetUserName;
|
||||||
|
int? chatSource;
|
||||||
|
|
||||||
|
CallerDetails({
|
||||||
|
this.userChatHistoryId,
|
||||||
|
this.contant,
|
||||||
|
this.fileTypeResponse,
|
||||||
|
this.currentUserName,
|
||||||
|
this.targetUserEmail,
|
||||||
|
this.conversationId,
|
||||||
|
this.encryptedTargetUserId,
|
||||||
|
this.targetUserId,
|
||||||
|
this.isSeen,
|
||||||
|
this.userChatHistoryLineId,
|
||||||
|
this.isDelivered,
|
||||||
|
this.targetUserName,
|
||||||
|
this.currentUserId,
|
||||||
|
this.createdDate,
|
||||||
|
this.currentUserEmail,
|
||||||
|
this.contantNo,
|
||||||
|
this.chatEventId,
|
||||||
|
this.encryptedTargetUserName,
|
||||||
|
this.chatSource,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory CallerDetails.fromRawJson(String str) => CallerDetails.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String toRawJson() => json.encode(toJson());
|
||||||
|
|
||||||
|
factory CallerDetails.fromJson(Map<String, dynamic> json) => CallerDetails(
|
||||||
|
userChatHistoryId: json["userChatHistoryId"] == null ? null : json["userChatHistoryId"].toInt(),
|
||||||
|
contant: json["contant"],
|
||||||
|
fileTypeResponse: json["fileTypeResponse"] == null ? null : FileTypeResponse.fromJson(json["fileTypeResponse"]),
|
||||||
|
currentUserName: json["currentUserName"],
|
||||||
|
targetUserEmail: json["targetUserEmail"],
|
||||||
|
conversationId: json["conversationId"],
|
||||||
|
encryptedTargetUserId: json["encryptedTargetUserId"],
|
||||||
|
targetUserId: json["targetUserId"] == null ? null : json["targetUserId"].toInt(),
|
||||||
|
isSeen: json["isSeen"],
|
||||||
|
userChatHistoryLineId: json["userChatHistoryLineId"] == null ? null : json["userChatHistoryLineId"].toInt(),
|
||||||
|
isDelivered: json["isDelivered"],
|
||||||
|
targetUserName: json["targetUserName"],
|
||||||
|
currentUserId: json["currentUserId"] == null ? null : json["currentUserId"].toInt(),
|
||||||
|
createdDate: json["createdDate"] == null ? null : DateTime.parse(json["createdDate"]),
|
||||||
|
currentUserEmail: json["currentUserEmail"],
|
||||||
|
contantNo: json["contantNo"],
|
||||||
|
chatEventId: json["chatEventId"] == null ? null : json["chatEventId"].toInt(),
|
||||||
|
encryptedTargetUserName: json["encryptedTargetUserName"],
|
||||||
|
chatSource: json["chatSource"] == null ? null : json["chatSource"].toInt(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"userChatHistoryId": userChatHistoryId,
|
||||||
|
"contant": contant,
|
||||||
|
"fileTypeResponse": fileTypeResponse?.toJson(),
|
||||||
|
"currentUserName": currentUserName,
|
||||||
|
"targetUserEmail": targetUserEmail,
|
||||||
|
"conversationId": conversationId,
|
||||||
|
"encryptedTargetUserId": encryptedTargetUserId,
|
||||||
|
"targetUserId": targetUserId,
|
||||||
|
"isSeen": isSeen,
|
||||||
|
"userChatHistoryLineId": userChatHistoryLineId,
|
||||||
|
"isDelivered": isDelivered,
|
||||||
|
"targetUserName": targetUserName,
|
||||||
|
"currentUserId": currentUserId,
|
||||||
|
"createdDate": createdDate?.toIso8601String(),
|
||||||
|
"currentUserEmail": currentUserEmail,
|
||||||
|
"contantNo": contantNo,
|
||||||
|
"chatEventId": chatEventId,
|
||||||
|
"encryptedTargetUserName": encryptedTargetUserName,
|
||||||
|
"chatSource": chatSource,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
class FileTypeResponse {
|
||||||
|
int? fileTypeId;
|
||||||
|
|
||||||
|
FileTypeResponse({
|
||||||
|
this.fileTypeId,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory FileTypeResponse.fromRawJson(String str) => FileTypeResponse.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String toRawJson() => json.encode(toJson());
|
||||||
|
|
||||||
|
factory FileTypeResponse.fromJson(Map<String, dynamic> json) => FileTypeResponse(
|
||||||
|
fileTypeId: json["fileTypeId"].toInt(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"fileTypeId": fileTypeId,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
class LoginDetails {
|
||||||
|
bool? isActiveCode;
|
||||||
|
int? id;
|
||||||
|
String? encryptedUserName;
|
||||||
|
String? userName;
|
||||||
|
String? title;
|
||||||
|
String? encryptedUserId;
|
||||||
|
String? email;
|
||||||
|
bool? isDomainUser;
|
||||||
|
String? token;
|
||||||
|
|
||||||
|
LoginDetails({
|
||||||
|
this.isActiveCode,
|
||||||
|
this.id,
|
||||||
|
this.encryptedUserName,
|
||||||
|
this.userName,
|
||||||
|
this.title,
|
||||||
|
this.encryptedUserId,
|
||||||
|
this.email,
|
||||||
|
this.isDomainUser,
|
||||||
|
this.token,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory LoginDetails.fromRawJson(String str) => LoginDetails.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String toRawJson() => json.encode(toJson());
|
||||||
|
|
||||||
|
factory LoginDetails.fromJson(Map<String, dynamic> json) => LoginDetails(
|
||||||
|
isActiveCode: json["isActiveCode"],
|
||||||
|
id: json["id"] == null ? null : json["id"].toInt(),
|
||||||
|
encryptedUserName: json["encryptedUserName"],
|
||||||
|
userName: json["userName"],
|
||||||
|
title: json["title"],
|
||||||
|
encryptedUserId: json["encryptedUserId"],
|
||||||
|
email: json["email"],
|
||||||
|
isDomainUser: json["isDomainUser"],
|
||||||
|
token: json["token"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"isActiveCode": isActiveCode,
|
||||||
|
"id": id,
|
||||||
|
"encryptedUserName": encryptedUserName,
|
||||||
|
"userName": userName,
|
||||||
|
"title": title,
|
||||||
|
"encryptedUserId": encryptedUserId,
|
||||||
|
"email": email,
|
||||||
|
"isDomainUser": isDomainUser,
|
||||||
|
"token": token,
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
// To parse this JSON data, do
|
||||||
|
//
|
||||||
|
// final remoteIceCandidatePayLoad = remoteIceCandidatePayLoadFromJson(jsonString);
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
class RemoteIceCandidatePayLoad {
|
||||||
|
RemoteIceCandidatePayLoad({
|
||||||
|
this.target,
|
||||||
|
this.candidate,
|
||||||
|
});
|
||||||
|
|
||||||
|
int? target;
|
||||||
|
Candidate? candidate;
|
||||||
|
|
||||||
|
factory RemoteIceCandidatePayLoad.fromRawJson(String str) => RemoteIceCandidatePayLoad.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String toRawJson() => json.encode(toJson());
|
||||||
|
|
||||||
|
factory RemoteIceCandidatePayLoad.fromJson(Map<String, dynamic> json) => RemoteIceCandidatePayLoad(
|
||||||
|
target: json["target"],
|
||||||
|
candidate: json["candidate"] == null ? null : Candidate.fromJson(json["candidate"]),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"target": target,
|
||||||
|
"candidate": candidate?.toJson(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
class Candidate {
|
||||||
|
Candidate({
|
||||||
|
this.candidate,
|
||||||
|
this.sdpMid,
|
||||||
|
this.sdpMLineIndex,
|
||||||
|
this.usernameFragment,
|
||||||
|
});
|
||||||
|
|
||||||
|
String? candidate;
|
||||||
|
String? sdpMid;
|
||||||
|
int? sdpMLineIndex;
|
||||||
|
String? usernameFragment;
|
||||||
|
|
||||||
|
factory Candidate.fromRawJson(String str) => Candidate.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String toRawJson() => json.encode(toJson());
|
||||||
|
|
||||||
|
factory Candidate.fromJson(Map<String, dynamic> json) => Candidate(
|
||||||
|
candidate: json["candidate"],
|
||||||
|
sdpMid: json["sdpMid"],
|
||||||
|
sdpMLineIndex: json["sdpMLineIndex"],
|
||||||
|
usernameFragment: json["usernameFragment"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"candidate": candidate,
|
||||||
|
"sdpMid": sdpMid,
|
||||||
|
"sdpMLineIndex": sdpMLineIndex,
|
||||||
|
"usernameFragment": usernameFragment,
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -0,0 +1,171 @@
|
|||||||
|
// import 'dart:async';
|
||||||
|
// import 'dart:io';
|
||||||
|
// import 'package:flutter/material.dart';
|
||||||
|
//
|
||||||
|
// class DraggableCam extends StatefulWidget {
|
||||||
|
// //final Size availableScreenSize;
|
||||||
|
// final Widget child;
|
||||||
|
// final double scaleFactor;
|
||||||
|
// // final Stream<bool> onButtonBarVisible;
|
||||||
|
// // final Stream<double> onButtonBarHeight;
|
||||||
|
//
|
||||||
|
// const DraggableCam({
|
||||||
|
// Key? key,
|
||||||
|
// //@required this.availableScreenSize,
|
||||||
|
// required this.child,
|
||||||
|
// // @required this.onButtonBarVisible,
|
||||||
|
// // @required this.onButtonBarHeight,
|
||||||
|
//
|
||||||
|
// /// The portion of the screen the DraggableWidget should use.
|
||||||
|
// this.scaleFactor = .25,
|
||||||
|
// }) : assert(scaleFactor != null && scaleFactor > 0 && scaleFactor <= .4),
|
||||||
|
// // assert(availableScreenSize != null),
|
||||||
|
// // assert(onButtonBarVisible != null),
|
||||||
|
// // assert(onButtonBarHeight != null),
|
||||||
|
// super(key: key);
|
||||||
|
//
|
||||||
|
// @override
|
||||||
|
// _DraggablePublisherState createState() => _DraggablePublisherState();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// class _DraggablePublisherState extends State<DraggableCam> {
|
||||||
|
// bool _isButtonBarVisible = true;
|
||||||
|
// double _buttonBarHeight = 0;
|
||||||
|
// late double _width;
|
||||||
|
// late double _height;
|
||||||
|
// late double _top;
|
||||||
|
// late double _left;
|
||||||
|
// late double _viewPaddingTop;
|
||||||
|
// late double _viewPaddingBottom;
|
||||||
|
// final double _padding = 8.0;
|
||||||
|
// final Duration _duration300ms = const Duration(milliseconds: 300);
|
||||||
|
// final Duration _duration0ms = const Duration(milliseconds: 0);
|
||||||
|
// late Duration _duration;
|
||||||
|
// late StreamSubscription _streamSubscription;
|
||||||
|
// late StreamSubscription _streamHeightSubscription;
|
||||||
|
//
|
||||||
|
// @override
|
||||||
|
// void initState() {
|
||||||
|
// super.initState();
|
||||||
|
// _duration = _duration300ms;
|
||||||
|
// _width = widget.availableScreenSize.width * widget.scaleFactor;
|
||||||
|
// _height = _width * (widget.availableScreenSize.height / widget.availableScreenSize.width);
|
||||||
|
// _top = widget.availableScreenSize.height - (_buttonBarHeight + _padding) - _height;
|
||||||
|
// _left = widget.availableScreenSize.width - _padding - _width;
|
||||||
|
//
|
||||||
|
// _streamSubscription = widget.onButtonBarVisible.listen(_buttonBarVisible);
|
||||||
|
// _streamHeightSubscription = widget.onButtonBarHeight.listen(_getButtonBarHeight);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @override
|
||||||
|
// void didChangeDependencies() {
|
||||||
|
// var mediaQuery = MediaQuery.of(context);
|
||||||
|
// _viewPaddingTop = mediaQuery.viewPadding.top;
|
||||||
|
// _viewPaddingBottom = mediaQuery.viewPadding.bottom;
|
||||||
|
// super.didChangeDependencies();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @override
|
||||||
|
// void dispose() {
|
||||||
|
// _streamSubscription.cancel();
|
||||||
|
// _streamHeightSubscription.cancel();
|
||||||
|
// super.dispose();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// void _getButtonBarHeight(double height) {
|
||||||
|
// setState(() {
|
||||||
|
// _buttonBarHeight = height;
|
||||||
|
// _positionWidget();
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// void _buttonBarVisible(bool visible) {
|
||||||
|
// if (!mounted) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// setState(() {
|
||||||
|
// _isButtonBarVisible = visible;
|
||||||
|
// if (_duration == _duration300ms) {
|
||||||
|
// // only position the widget when we are not currently dragging it around
|
||||||
|
// _positionWidget();
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @override
|
||||||
|
// Widget build(BuildContext context) {
|
||||||
|
// return AnimatedPositioned(
|
||||||
|
// top: _top,
|
||||||
|
// left: _left,
|
||||||
|
// width: _width,
|
||||||
|
// height: _height,
|
||||||
|
// duration: _duration,
|
||||||
|
// child: Listener(
|
||||||
|
// onPointerDown: (_) => _duration = _duration0ms,
|
||||||
|
// onPointerMove: (PointerMoveEvent event) {
|
||||||
|
// setState(() {
|
||||||
|
// _left = (_left + event.delta.dx).roundToDouble();
|
||||||
|
// _top = (_top + event.delta.dy).roundToDouble();
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// onPointerUp: (_) => _positionWidget(),
|
||||||
|
// onPointerCancel: (_) => _positionWidget(),
|
||||||
|
// child: ClippedVideo(
|
||||||
|
// height: _height,
|
||||||
|
// width: _width,
|
||||||
|
// child: widget.child,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// double _getCurrentStatusBarHeight() {
|
||||||
|
// if (_isButtonBarVisible) {
|
||||||
|
// return _viewPaddingTop;
|
||||||
|
// }
|
||||||
|
// final _defaultViewPaddingTop = Platform.isIOS ? 20.0 : Platform.isAndroid ? 24.0 : 0.0;
|
||||||
|
// if (_viewPaddingTop > _defaultViewPaddingTop) {
|
||||||
|
// // There must be a hardware notch in the display.
|
||||||
|
// return _viewPaddingTop;
|
||||||
|
// }
|
||||||
|
// return 0.0;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// double _getCurrentButtonBarHeight() {
|
||||||
|
// if (_isButtonBarVisible) {
|
||||||
|
// return _buttonBarHeight + _viewPaddingBottom;
|
||||||
|
// }
|
||||||
|
// return _viewPaddingBottom;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// void _positionWidget() {
|
||||||
|
// // Determine the center of the object being dragged so we can decide
|
||||||
|
// // in which corner the object should be placed.
|
||||||
|
// var dx = (_width / 2) + _left;
|
||||||
|
// dx = dx < 0 ? 0 : dx >= widget.availableScreenSize.width ? widget.availableScreenSize.width - 1 : dx;
|
||||||
|
// var dy = (_height / 2) + _top;
|
||||||
|
// dy = dy < 0 ? 0 : dy >= widget.availableScreenSize.height ? widget.availableScreenSize.height - 1 : dy;
|
||||||
|
// final draggableCenter = Offset(dx, dy);
|
||||||
|
//
|
||||||
|
// setState(() {
|
||||||
|
// _duration = _duration300ms;
|
||||||
|
// if (Rect.fromLTRB(0, 0, widget.availableScreenSize.width / 2, widget.availableScreenSize.height / 2).contains(draggableCenter)) {
|
||||||
|
// // Top-left
|
||||||
|
// _top = _getCurrentStatusBarHeight() + _padding;
|
||||||
|
// _left = _padding;
|
||||||
|
// } else if (Rect.fromLTRB(widget.availableScreenSize.width / 2, 0, widget.availableScreenSize.width, widget.availableScreenSize.height / 2).contains(draggableCenter)) {
|
||||||
|
// // Top-right
|
||||||
|
// _top = _getCurrentStatusBarHeight() + _padding;
|
||||||
|
// _left = widget.availableScreenSize.width - _padding - _width;
|
||||||
|
// } else if (Rect.fromLTRB(0, widget.availableScreenSize.height / 2, widget.availableScreenSize.width / 2, widget.availableScreenSize.height).contains(draggableCenter)) {
|
||||||
|
// // Bottom-left
|
||||||
|
// _top = widget.availableScreenSize.height - (_getCurrentButtonBarHeight() + _padding) - _height;
|
||||||
|
// _left = _padding;
|
||||||
|
// } else if (Rect.fromLTRB(widget.availableScreenSize.width / 2, widget.availableScreenSize.height / 2, widget.availableScreenSize.width, widget.availableScreenSize.height).contains(draggableCenter)) {
|
||||||
|
// // Bottom-right
|
||||||
|
// _top = widget.availableScreenSize.height - (_getCurrentButtonBarHeight() + _padding) - _height;
|
||||||
|
// _left = widget.availableScreenSize.width - _padding - _width;
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }
|
||||||
Loading…
Reference in New Issue