Changes On iOS

merge-requests/188/head
Aamir Muhammad 2 years ago
parent 2e05bea49d
commit 02870af3d2

@ -15,7 +15,7 @@ import 'package:mohem_flutter_app/provider/chat_call_provider.dart';
import 'package:mohem_flutter_app/provider/chat_provider_model.dart'; import 'package:mohem_flutter_app/provider/chat_provider_model.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class ChatVoipCall { class ChatVoipCall extends WidgetsBindingObserver {
static final ChatVoipCall _instance = ChatVoipCall._internal(); static final ChatVoipCall _instance = ChatVoipCall._internal();
ChatVoipCall._internal(); ChatVoipCall._internal();
@ -34,8 +34,9 @@ class ChatVoipCall {
ALM.Response autoLoginData; ALM.Response autoLoginData;
SingleUserChatModel callerData; SingleUserChatModel callerData;
if (data!.data["user_token_response"] == null || data.data["user_token_response"].isEmpty) { if (data!.data["user_token_response"] == null || data.data["user_token_response"].isEmpty) {
logger.d(AppState().getchatUserDetails!.response!.toJson());
// Online & App Logged In // Online & App Logged In
autoLoginData = ALM.Response.fromJson(AppState().getchatUserDetails!.response!.toJson()); autoLoginData = ALM.Response.fromJson(AppState().getchatUserDetails!.response!.toJson());
dynamic items = jsonDecode(data!.data["user_chat_history_response"]); dynamic items = jsonDecode(data!.data["user_chat_history_response"]);
callerData = SingleUserChatModel( callerData = SingleUserChatModel(
targetUserId: items["CurrentUserId"], targetUserId: items["CurrentUserId"],
@ -65,7 +66,7 @@ class ChatVoipCall {
extra: { extra: {
"loginDetails": autoLoginData.toJson(), "loginDetails": autoLoginData.toJson(),
"callerDetails": callerData.toJson(), "callerDetails": callerData.toJson(),
'isIncomingCall' : true, 'isIncomingCall': true,
}, },
android: const AndroidParams( android: const AndroidParams(
isCustomNotification: true, isCustomNotification: true,
@ -148,7 +149,14 @@ class ChatVoipCall {
}); });
} }
} }
Future<void> isCall() async {
var calls = await FlutterCallkitIncoming.activeCalls();
if (calls is List) {
if (calls.isNotEmpty) {
Navigator.pushNamed(AppRoutes.navigatorKey.currentContext!, AppRoutes.chatStartCall);
}
}
}
//Function(CallEvent) callback //Function(CallEvent) callback
Future<void> listenerEvent() async { Future<void> listenerEvent() async {
try { try {
@ -159,8 +167,16 @@ class ChatVoipCall {
case Event.ACTION_CALL_START: case Event.ACTION_CALL_START:
break; break;
case Event.ACTION_CALL_ACCEPT: case Event.ACTION_CALL_ACCEPT:
print("------------------------------------------Call Accespted By User ----------------------------------------------"); print("------------------------------------------Call Accepted By User ----------------------------------------------");
checkAndNavigationCallingPage(); if (isUserOnline) {
checkAndNavigationCallingPage();
} else {
Utils.showToast("BackgroundState Else Started", longDuration: true);
isCall();
}
// checkAndNavigationCallingPage();
// Navigator.pushNamed(AppRoutes.navigatorKey.currentContext!, AppRoutes.chatStartCall); // Navigator.pushNamed(AppRoutes.navigatorKey.currentContext!, AppRoutes.chatStartCall);
// checkAndNavigationCallingPage(); // checkAndNavigationCallingPage();
@ -261,26 +277,10 @@ class ChatVoipCall {
// } // }
// Navigator.pushNamed(AppRoutes.navigatorKey.currentContext!, AppRoutes.chatStartCall); // Navigator.pushNamed(AppRoutes.navigatorKey.currentContext!, AppRoutes.chatStartCall);
} }
// void didChangeAppLifecycleState(AppLifecycleState state) {
// super.didChangeAppLifecycleState(state); //
// switch (state) { // @override
// case AppLifecycleState.paused: // void dispose() {
// logger.i('paused'); // WidgetsBinding.instance.removeObserver(this);
// break; // }
// case AppLifecycleState.inactive:
// logger.i('inactive');
// break;
// case AppLifecycleState.resumed:
// logger.i('resumed');
// break;
// case AppLifecycleState.detached:
// logger.i('detached');
// break;
// }
// }
//
// @override
// void dispose() {
// WidgetsBinding.instance.removeObserver(this);
// }
} }

@ -28,6 +28,8 @@ Logger logger = Logger(
// output: null, // U // output: null, // U
); );
enum AppRunningStates { resume, background, closed }
class MyHttpOverrides extends HttpOverrides { class MyHttpOverrides extends HttpOverrides {
@override @override
HttpClient createHttpClient(SecurityContext? context) { HttpClient createHttpClient(SecurityContext? context) {
@ -86,9 +88,22 @@ Future<void> main() async {
// flutter pub run easy_localization:generate --source-dir ./assets/langs -f keys -o locale_keys.g.dart // flutter pub run easy_localization:generate --source-dir ./assets/langs -f keys -o locale_keys.g.dart
// command to generate languages data from json // command to generate languages data from json
class MyApp extends StatelessWidget { class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key); const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
@override
void initState() {
WidgetsBinding.instance.addObserver(this);
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Sizer( return Sizer(

@ -1,425 +1,331 @@
// To parse this JSON data, do // To parse this JSON data, do
// //
// final incomingCallDataPayload = incomingCallDataPayloadFromJson(jsonString); // final incomingCallModel = incomingCallModelFromJson(jsonString);
import 'dart:convert'; import 'dart:convert';
class IncomingCallDataPayload { class IncomingCallModel {
IncomingCallDataPayload({ String? actionColor;
this.id, String? appName;
this.nameCaller, 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.appName,
this.args,
this.avatar, this.avatar,
this.handle, this.backgroundColor,
this.type, this.backgroundUrl,
this.duration, 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.textAccept,
this.textCallback,
this.textDecline, this.textDecline,
this.textMissedCall, this.textMissedCall,
this.textCallback, this.type,
this.extra, this.uuid,
this.headers,
this.android,
this.ios,
}); });
String? id; factory IncomingCallModel.fromRawJson(String str) => IncomingCallModel.fromJson(json.decode(str));
String? nameCaller;
String? appName;
dynamic avatar;
String? handle;
dynamic? type;
dynamic? duration;
String? textAccept;
String? textDecline;
String? textMissedCall;
String? textCallback;
Extra? extra;
dynamic headers;
Android? android;
Ios? ios;
factory IncomingCallDataPayload.fromRawJson(String str) => IncomingCallDataPayload.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson()); String toRawJson() => json.encode(toJson());
factory IncomingCallDataPayload.fromJson(Map<String, dynamic> json) => IncomingCallDataPayload( factory IncomingCallModel.fromJson(Map<String, dynamic> json) => IncomingCallModel(
id: json["id"], actionColor: json["actionColor"],
nameCaller: json["nameCaller"],
appName: json["appName"], appName: json["appName"],
args: json["args"] == null ? null : Args.fromJson(json["args"]),
avatar: json["avatar"], avatar: json["avatar"],
backgroundColor: json["backgroundColor"],
backgroundUrl: json["backgroundUrl"],
duration: json["duration"].toInt(),
extra: json["extra"] == null ? null : Extra.fromJson(json["extra"]),
from: json["from"],
handle: json["handle"], handle: json["handle"],
type: json["type"], headers: json["headers"] == null ? null : Args.fromJson(json["headers"]),
duration: json["duration"], 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"], textAccept: json["textAccept"],
textCallback: json["textCallback"],
textDecline: json["textDecline"], textDecline: json["textDecline"],
textMissedCall: json["textMissedCall"], textMissedCall: json["textMissedCall"],
textCallback: json["textCallback"], type: json["type"].toInt(),
extra: json["extra"] == null ? null : Extra.fromJson(json["extra"]), uuid: json["uuid"],
headers: json["headers"],
android: json["android"] == null ? null : Android.fromJson(json["android"]),
ios: json["ios"] == null ? null : Ios.fromJson(json["ios"]),
); );
Map<String, dynamic> toJson() => { Map<String, dynamic> toJson() => {
"id": id, "actionColor": actionColor,
"nameCaller": nameCaller,
"appName": appName, "appName": appName,
"args": args?.toJson(),
"avatar": avatar, "avatar": avatar,
"handle": handle, "backgroundColor": backgroundColor,
"type": type, "backgroundUrl": backgroundUrl,
"duration": duration, "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, "textAccept": textAccept,
"textCallback": textCallback,
"textDecline": textDecline, "textDecline": textDecline,
"textMissedCall": textMissedCall, "textMissedCall": textMissedCall,
"textCallback": textCallback, "type": type,
"extra": extra?.toJson(), "uuid": uuid,
"headers": headers,
"android": android?.toJson(),
"ios": ios?.toJson(),
}; };
} }
class Android { class Args {
Android({ Args();
this.isCustomNotification,
this.isShowLogo,
this.isShowCallback,
this.isShowMissedCallNotification,
this.ringtonePath,
this.backgroundColor,
this.backgroundUrl,
this.actionColor,
this.incomingCallNotificationChannelName,
this.missedCallNotificationChannelName,
});
bool? isCustomNotification;
bool? isShowLogo;
bool? isShowCallback;
bool? isShowMissedCallNotification;
String? ringtonePath;
String? backgroundColor;
String? backgroundUrl;
String? actionColor;
dynamic incomingCallNotificationChannelName;
dynamic missedCallNotificationChannelName;
factory Android.fromRawJson(String str) => Android.fromJson(json.decode(str)); factory Args.fromRawJson(String str) => Args.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson()); String toRawJson() => json.encode(toJson());
factory Android.fromJson(Map<String, dynamic> json) => Android( factory Args.fromJson(Map<String, dynamic> json) => Args(
isCustomNotification: json["isCustomNotification"],
isShowLogo: json["isShowLogo"],
isShowCallback: json["isShowCallback"],
isShowMissedCallNotification: json["isShowMissedCallNotification"],
ringtonePath: json["ringtonePath"],
backgroundColor: json["backgroundColor"],
backgroundUrl: json["backgroundUrl"],
actionColor: json["actionColor"],
incomingCallNotificationChannelName: json["incomingCallNotificationChannelName"],
missedCallNotificationChannelName: json["missedCallNotificationChannelName"],
); );
Map<String, dynamic> toJson() => { Map<String, dynamic> toJson() => {
"isCustomNotification": isCustomNotification,
"isShowLogo": isShowLogo,
"isShowCallback": isShowCallback,
"isShowMissedCallNotification": isShowMissedCallNotification,
"ringtonePath": ringtonePath,
"backgroundColor": backgroundColor,
"backgroundUrl": backgroundUrl,
"actionColor": actionColor,
"incomingCallNotificationChannelName": incomingCallNotificationChannelName,
"missedCallNotificationChannelName": missedCallNotificationChannelName,
}; };
} }
class Extra { class Extra {
LoginDetails? loginDetails;
bool? isIncomingCall;
CallerDetails? callerDetails;
Extra({ Extra({
this.loginDetails, this.loginDetails,
this.isIncomingCall,
this.callerDetails, this.callerDetails,
}); });
LoginDetails? loginDetails;
CallerDetails? callerDetails;
factory Extra.fromRawJson(String str) => Extra.fromJson(json.decode(str)); factory Extra.fromRawJson(String str) => Extra.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson()); String toRawJson() => json.encode(toJson());
factory Extra.fromJson(Map<String, dynamic> json) => Extra( factory Extra.fromJson(Map<String, dynamic> json) => Extra(
loginDetails: json["loginDetails"] == null ? null : LoginDetails.fromJson(json["loginDetails"]), loginDetails: json["loginDetails"] == null ? null : LoginDetails.fromJson(json["loginDetails"]),
isIncomingCall: json["isIncomingCall"],
callerDetails: json["callerDetails"] == null ? null : CallerDetails.fromJson(json["callerDetails"]), callerDetails: json["callerDetails"] == null ? null : CallerDetails.fromJson(json["callerDetails"]),
); );
Map<String, dynamic> toJson() => { Map<String, dynamic> toJson() => {
"loginDetails": loginDetails?.toJson(), "loginDetails": loginDetails?.toJson(),
"isIncomingCall": isIncomingCall,
"callerDetails": callerDetails?.toJson(), "callerDetails": callerDetails?.toJson(),
}; };
} }
class CallerDetails { 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({ CallerDetails({
this.userChatHistoryId, this.userChatHistoryId,
this.userChatHistoryLineId,
this.contant, this.contant,
this.contantNo, this.fileTypeResponse,
this.currentUserId,
this.currentUserName, this.currentUserName,
this.targetUserId,
this.targetUserName,
this.encryptedTargetUserId,
this.encryptedTargetUserName,
this.currentUserEmail,
this.targetUserEmail, this.targetUserEmail,
this.chatEventId, this.conversationId,
this.fileTypeId, this.encryptedTargetUserId,
this.targetUserId,
this.isSeen, this.isSeen,
this.userChatHistoryLineId,
this.isDelivered, this.isDelivered,
this.targetUserName,
this.currentUserId,
this.createdDate, this.createdDate,
this.currentUserEmail,
this.contantNo,
this.chatEventId,
this.encryptedTargetUserName,
this.chatSource, this.chatSource,
this.conversationId,
this.fileTypeResponse,
this.userChatReplyResponse,
}); });
int? userChatHistoryId;
int? userChatHistoryLineId;
String? contant;
String? contantNo;
int? currentUserId;
String? currentUserName;
int? targetUserId;
String? targetUserName;
String? encryptedTargetUserId;
String? encryptedTargetUserName;
String? currentUserEmail;
String? targetUserEmail;
int? chatEventId;
dynamic fileTypeId;
bool? isSeen;
bool? isDelivered;
DateTime? createdDate;
int? chatSource;
String? conversationId;
FileTypeResponse? fileTypeResponse;
dynamic userChatReplyResponse;
factory CallerDetails.fromRawJson(String str) => CallerDetails.fromJson(json.decode(str)); factory CallerDetails.fromRawJson(String str) => CallerDetails.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson()); String toRawJson() => json.encode(toJson());
factory CallerDetails.fromJson(Map<String, dynamic> json) => CallerDetails( factory CallerDetails.fromJson(Map<String, dynamic> json) => CallerDetails(
userChatHistoryId: json["userChatHistoryId"], userChatHistoryId: json["userChatHistoryId"].toInt(),
userChatHistoryLineId: json["userChatHistoryLineId"],
contant: json["contant"], contant: json["contant"],
contantNo: json["contantNo"], fileTypeResponse: json["fileTypeResponse"] == null ? null : FileTypeResponse.fromJson(json["fileTypeResponse"]),
currentUserId: json["currentUserId"],
currentUserName: json["currentUserName"], currentUserName: json["currentUserName"],
targetUserId: json["targetUserId"],
targetUserName: json["targetUserName"],
encryptedTargetUserId: json["encryptedTargetUserId"],
encryptedTargetUserName: json["encryptedTargetUserName"],
currentUserEmail: json["currentUserEmail"],
targetUserEmail: json["targetUserEmail"], targetUserEmail: json["targetUserEmail"],
chatEventId: json["chatEventId"], conversationId: json["conversationId"],
fileTypeId: json["fileTypeId"], encryptedTargetUserId: json["encryptedTargetUserId"],
targetUserId: json["targetUserId"].toInt(),
isSeen: json["isSeen"], isSeen: json["isSeen"],
userChatHistoryLineId: json["userChatHistoryLineId"].toInt(),
isDelivered: json["isDelivered"], isDelivered: json["isDelivered"],
targetUserName: json["targetUserName"],
currentUserId: json["currentUserId"].toInt(),
createdDate: json["createdDate"] == null ? null : DateTime.parse(json["createdDate"]), createdDate: json["createdDate"] == null ? null : DateTime.parse(json["createdDate"]),
chatSource: json["chatSource"], currentUserEmail: json["currentUserEmail"],
conversationId: json["conversationId"], contantNo: json["contantNo"],
fileTypeResponse: json["fileTypeResponse"] == null ? null : FileTypeResponse.fromJson(json["fileTypeResponse"]), chatEventId: json["chatEventId"].toInt(),
userChatReplyResponse: json["userChatReplyResponse"], encryptedTargetUserName: json["encryptedTargetUserName"],
chatSource: json["chatSource"].toInt(),
); );
Map<String, dynamic> toJson() => { Map<String, dynamic> toJson() => {
"userChatHistoryId": userChatHistoryId, "userChatHistoryId": userChatHistoryId,
"userChatHistoryLineId": userChatHistoryLineId,
"contant": contant, "contant": contant,
"contantNo": contantNo, "fileTypeResponse": fileTypeResponse?.toJson(),
"currentUserId": currentUserId,
"currentUserName": currentUserName, "currentUserName": currentUserName,
"targetUserId": targetUserId,
"targetUserName": targetUserName,
"encryptedTargetUserId": encryptedTargetUserId,
"encryptedTargetUserName": encryptedTargetUserName,
"currentUserEmail": currentUserEmail,
"targetUserEmail": targetUserEmail, "targetUserEmail": targetUserEmail,
"chatEventId": chatEventId, "conversationId": conversationId,
"fileTypeId": fileTypeId, "encryptedTargetUserId": encryptedTargetUserId,
"targetUserId": targetUserId,
"isSeen": isSeen, "isSeen": isSeen,
"userChatHistoryLineId": userChatHistoryLineId,
"isDelivered": isDelivered, "isDelivered": isDelivered,
"targetUserName": targetUserName,
"currentUserId": currentUserId,
"createdDate": createdDate?.toIso8601String(), "createdDate": createdDate?.toIso8601String(),
"currentUserEmail": currentUserEmail,
"contantNo": contantNo,
"chatEventId": chatEventId,
"encryptedTargetUserName": encryptedTargetUserName,
"chatSource": chatSource, "chatSource": chatSource,
"conversationId": conversationId,
"fileTypeResponse": fileTypeResponse?.toJson(),
"userChatReplyResponse": userChatReplyResponse,
}; };
} }
class FileTypeResponse { class FileTypeResponse {
int? fileTypeId;
FileTypeResponse({ FileTypeResponse({
this.fileTypeId, this.fileTypeId,
this.fileTypeName,
this.fileTypeDescription,
this.fileKind,
this.fileName,
}); });
int? fileTypeId;
dynamic fileTypeName;
dynamic fileTypeDescription;
dynamic fileKind;
dynamic fileName;
factory FileTypeResponse.fromRawJson(String str) => FileTypeResponse.fromJson(json.decode(str)); factory FileTypeResponse.fromRawJson(String str) => FileTypeResponse.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson()); String toRawJson() => json.encode(toJson());
factory FileTypeResponse.fromJson(Map<String, dynamic> json) => FileTypeResponse( factory FileTypeResponse.fromJson(Map<String, dynamic> json) => FileTypeResponse(
fileTypeId: json["fileTypeId"], fileTypeId:json["fileTypeId"].toInt(),
fileTypeName: json["fileTypeName"],
fileTypeDescription: json["fileTypeDescription"],
fileKind: json["fileKind"],
fileName: json["fileName"],
); );
Map<String, dynamic> toJson() => { Map<String, dynamic> toJson() => {
"fileTypeId": fileTypeId, "fileTypeId": fileTypeId,
"fileTypeName": fileTypeName,
"fileTypeDescription": fileTypeDescription,
"fileKind": fileKind,
"fileName": fileName,
}; };
} }
class LoginDetails { class LoginDetails {
bool? isActiveCode;
int? id;
String? encryptedUserName;
String? userName;
String? title;
String? encryptedUserId;
String? email;
bool? isDomainUser;
String? token;
LoginDetails({ LoginDetails({
this.isActiveCode,
this.id, this.id,
this.encryptedUserName,
this.userName, this.userName,
this.email,
this.phone,
this.title, this.title,
this.token,
this.isDomainUser,
this.isActiveCode,
this.encryptedUserId, this.encryptedUserId,
this.encryptedUserName, this.email,
this.isDomainUser,
this.token,
}); });
int? id;
String? userName;
String? email;
dynamic phone;
String? title;
String? token;
bool? isDomainUser;
bool? isActiveCode;
String? encryptedUserId;
String? encryptedUserName;
factory LoginDetails.fromRawJson(String str) => LoginDetails.fromJson(json.decode(str)); factory LoginDetails.fromRawJson(String str) => LoginDetails.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson()); String toRawJson() => json.encode(toJson());
factory LoginDetails.fromJson(Map<String, dynamic> json) => LoginDetails( factory LoginDetails.fromJson(Map<String, dynamic> json) => LoginDetails(
id: json["id"], isActiveCode: json["isActiveCode"],
id: json["id"].toInt(),
encryptedUserName: json["encryptedUserName"],
userName: json["userName"], userName: json["userName"],
email: json["email"],
phone: json["phone"],
title: json["title"], title: json["title"],
token: json["token"],
isDomainUser: json["isDomainUser"],
isActiveCode: json["isActiveCode"],
encryptedUserId: json["encryptedUserId"], encryptedUserId: json["encryptedUserId"],
encryptedUserName: json["encryptedUserName"], email: json["email"],
isDomainUser: json["isDomainUser"],
token: json["token"],
); );
Map<String, dynamic> toJson() => { Map<String, dynamic> toJson() => {
"isActiveCode": isActiveCode,
"id": id, "id": id,
"encryptedUserName": encryptedUserName,
"userName": userName, "userName": userName,
"email": email,
"phone": phone,
"title": title, "title": title,
"token": token,
"isDomainUser": isDomainUser,
"isActiveCode": isActiveCode,
"encryptedUserId": encryptedUserId, "encryptedUserId": encryptedUserId,
"encryptedUserName": encryptedUserName, "email": email,
}; "isDomainUser": isDomainUser,
} "token": token,
class Ios {
Ios({
this.iconName,
this.handleType,
this.supportsVideo,
this.maximumCallGroups,
this.maximumCallsPerCallGroup,
this.audioSessionMode,
this.audioSessionActive,
this.audioSessionPreferredSampleRate,
this.audioSessionPreferredIoBufferDuration,
this.supportsDtmf,
this.supportsHolding,
this.supportsGrouping,
this.supportsUngrouping,
this.ringtonePath,
});
String? iconName;
String? handleType;
bool? supportsVideo;
int? maximumCallGroups;
int? maximumCallsPerCallGroup;
String? audioSessionMode;
bool? audioSessionActive;
double? audioSessionPreferredSampleRate;
double? audioSessionPreferredIoBufferDuration;
bool? supportsDtmf;
bool? supportsHolding;
bool? supportsGrouping;
bool? supportsUngrouping;
String? ringtonePath;
factory Ios.fromRawJson(String str) => Ios.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory Ios.fromJson(Map<String, dynamic> json) => Ios(
iconName: json["iconName"],
handleType: json["handleType"],
supportsVideo: json["supportsVideo"],
maximumCallGroups: json["maximumCallGroups"],
maximumCallsPerCallGroup: json["maximumCallsPerCallGroup"],
audioSessionMode: json["audioSessionMode"],
audioSessionActive: json["audioSessionActive"],
audioSessionPreferredSampleRate: json["audioSessionPreferredSampleRate"],
audioSessionPreferredIoBufferDuration: json["audioSessionPreferredIOBufferDuration"]?.toDouble(),
supportsDtmf: json["supportsDTMF"],
supportsHolding: json["supportsHolding"],
supportsGrouping: json["supportsGrouping"],
supportsUngrouping: json["supportsUngrouping"],
ringtonePath: json["ringtonePath"],
);
Map<String, dynamic> toJson() => {
"iconName": iconName,
"handleType": handleType,
"supportsVideo": supportsVideo,
"maximumCallGroups": maximumCallGroups,
"maximumCallsPerCallGroup": maximumCallsPerCallGroup,
"audioSessionMode": audioSessionMode,
"audioSessionActive": audioSessionActive,
"audioSessionPreferredSampleRate": audioSessionPreferredSampleRate,
"audioSessionPreferredIOBufferDuration": audioSessionPreferredIoBufferDuration,
"supportsDTMF": supportsDtmf,
"supportsHolding": supportsHolding,
"supportsGrouping": supportsGrouping,
"supportsUngrouping": supportsUngrouping,
"ringtonePath": ringtonePath,
}; };
} }

@ -1,12 +1,10 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:core'; import 'dart:core';
import 'package:draggable_widget/draggable_widget.dart'; import 'package:draggable_widget/draggable_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_callkit_incoming/flutter_callkit_incoming.dart'; import 'package:flutter_callkit_incoming/flutter_callkit_incoming.dart';
import 'package:mohem_flutter_app/main.dart'; import 'package:mohem_flutter_app/main.dart';
import 'package:mohem_flutter_app/models/chat/get_user_login_token_model.dart'; import 'package:mohem_flutter_app/models/chat/incoming_call_model.dart';
import 'package:mohem_flutter_app/models/chat/get_user_login_token_model.dart' as ALM;
class StartCallPage extends StatefulWidget { class StartCallPage extends StatefulWidget {
@override @override
@ -28,23 +26,13 @@ class _StartCallPageState extends State<StartCallPage> {
} }
void startCall() async { void startCall() async {
ALM.Response? sessionData; IncomingCallModel? sessionData;
var calls = await FlutterCallkitIncoming.activeCalls(); var calls = await FlutterCallkitIncoming.activeCalls();
if (calls is List) { if (calls.isNotEmpty) {
if (calls.isNotEmpty) { sessionData = IncomingCallModel.fromRawJson(jsonEncode(calls[0]));
//print('DATA------------: $calls');
var items = jsonEncode(calls);
logger.w(items);
// sessionData = ALM.Response.fromJson(items);
// logger.w(items[0]["extra"]["loginDetails"]);
// logger.d(calls[0]["extra"]["callerDetails"]);
// logger.w(calls[0]["extra"]["isIncomingCall"]);
}
} }
logger.i(sessionData);
print("========================");
logger.d(sessionData!.extra!.isIncomingCall);
} }
@override @override

@ -21,7 +21,7 @@ import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/models/chat/incomingCall.dart'; import 'package:mohem_flutter_app/models/chat/incoming_call_model.dart';
import 'package:mohem_flutter_app/models/check_mobile_app_version_model.dart'; import 'package:mohem_flutter_app/models/check_mobile_app_version_model.dart';
import 'package:mohem_flutter_app/models/get_mobile_login_info_list_model.dart'; import 'package:mohem_flutter_app/models/get_mobile_login_info_list_model.dart';
import 'package:mohem_flutter_app/models/member_information_list_model.dart'; import 'package:mohem_flutter_app/models/member_information_list_model.dart';

@ -3,6 +3,7 @@ import 'dart:io';
import 'package:easy_localization/src/public_ext.dart'; import 'package:easy_localization/src/public_ext.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_callkit_incoming/flutter_callkit_incoming.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:local_auth/auth_strings.dart'; import 'package:local_auth/auth_strings.dart';
import 'package:local_auth/local_auth.dart'; import 'package:local_auth/local_auth.dart';
@ -51,10 +52,13 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
@override @override
void initState() { void initState() {
_getAvailableBiometrics(); _getAvailableBiometrics();
print("------------------- Verfiy Screeeeeen -----------------------");
// setDefault(); // setDefault();
super.initState(); super.initState();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
mobileLoginInfoListModel ??= ModalRoute.of(context)!.settings.arguments as GetMobileLoginInfoListModel; mobileLoginInfoListModel ??= ModalRoute.of(context)!.settings.arguments as GetMobileLoginInfoListModel;
@ -289,7 +293,7 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
width: 38, width: 38,
color: isDisable ? MyColors.darkTextColor.withOpacity(0.7) : null, color: isDisable ? MyColors.darkTextColor.withOpacity(0.7) : null,
), ),
_title.toText16(height: 20/16) _title.toText16(height: 20 / 16)
], ],
), ),
), ),
@ -404,5 +408,4 @@ class _VerifyLastLoginScreenState extends State<VerifyLastLoginScreen> {
// // isLoading = isTrue; // // isLoading = isTrue;
// }); // });
// } // }
} }

Loading…
Cancel
Save