From 02870af3d2221bab439b251fb3d8ae04a89290dd Mon Sep 17 00:00:00 2001 From: Aamir-iMac Date: Sun, 21 May 2023 16:58:16 +0300 Subject: [PATCH] Changes On iOS --- lib/classes/chat_call_kit.dart | 56 +-- lib/main.dart | 17 +- ...mingCall.dart => incoming_call_model.dart} | 468 +++++++----------- lib/ui/chat/call/start_call_screen.dart | 22 +- lib/ui/login/login_screen.dart | 2 +- lib/ui/login/verify_last_login_screen.dart | 7 +- 6 files changed, 242 insertions(+), 330 deletions(-) rename lib/models/chat/{incomingCall.dart => incoming_call_model.dart} (59%) diff --git a/lib/classes/chat_call_kit.dart b/lib/classes/chat_call_kit.dart index 66eef6a..dee676e 100644 --- a/lib/classes/chat_call_kit.dart +++ b/lib/classes/chat_call_kit.dart @@ -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:provider/provider.dart'; -class ChatVoipCall { +class ChatVoipCall extends WidgetsBindingObserver { static final ChatVoipCall _instance = ChatVoipCall._internal(); ChatVoipCall._internal(); @@ -34,8 +34,9 @@ class ChatVoipCall { ALM.Response autoLoginData; SingleUserChatModel callerData; if (data!.data["user_token_response"] == null || data.data["user_token_response"].isEmpty) { + logger.d(AppState().getchatUserDetails!.response!.toJson()); // 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"]); callerData = SingleUserChatModel( targetUserId: items["CurrentUserId"], @@ -65,7 +66,7 @@ class ChatVoipCall { extra: { "loginDetails": autoLoginData.toJson(), "callerDetails": callerData.toJson(), - 'isIncomingCall' : true, + 'isIncomingCall': true, }, android: const AndroidParams( isCustomNotification: true, @@ -148,7 +149,14 @@ class ChatVoipCall { }); } } - + Future isCall() async { + var calls = await FlutterCallkitIncoming.activeCalls(); + if (calls is List) { + if (calls.isNotEmpty) { + Navigator.pushNamed(AppRoutes.navigatorKey.currentContext!, AppRoutes.chatStartCall); + } + } + } //Function(CallEvent) callback Future listenerEvent() async { try { @@ -159,8 +167,16 @@ class ChatVoipCall { case Event.ACTION_CALL_START: break; case Event.ACTION_CALL_ACCEPT: - print("------------------------------------------Call Accespted By User ----------------------------------------------"); - checkAndNavigationCallingPage(); + print("------------------------------------------Call Accepted By User ----------------------------------------------"); + if (isUserOnline) { + checkAndNavigationCallingPage(); + } else { + Utils.showToast("BackgroundState Else Started", longDuration: true); + isCall(); + + } + + // checkAndNavigationCallingPage(); // Navigator.pushNamed(AppRoutes.navigatorKey.currentContext!, AppRoutes.chatStartCall); // checkAndNavigationCallingPage(); @@ -261,26 +277,10 @@ class ChatVoipCall { // } // Navigator.pushNamed(AppRoutes.navigatorKey.currentContext!, AppRoutes.chatStartCall); } - // void didChangeAppLifecycleState(AppLifecycleState state) { - // super.didChangeAppLifecycleState(state); - // switch (state) { - // case AppLifecycleState.paused: - // logger.i('paused'); - // 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); - // } + +// +// @override +// void dispose() { +// WidgetsBinding.instance.removeObserver(this); +// } } diff --git a/lib/main.dart b/lib/main.dart index 1856da1..08c5fad 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -28,6 +28,8 @@ Logger logger = Logger( // output: null, // U ); +enum AppRunningStates { resume, background, closed } + class MyHttpOverrides extends HttpOverrides { @override HttpClient createHttpClient(SecurityContext? context) { @@ -86,9 +88,22 @@ Future main() async { // flutter pub run easy_localization:generate --source-dir ./assets/langs -f keys -o locale_keys.g.dart // command to generate languages data from json -class MyApp extends StatelessWidget { +class MyApp extends StatefulWidget { const MyApp({Key? key}) : super(key: key); + @override + State createState() => _MyAppState(); +} + +class _MyAppState extends State with WidgetsBindingObserver { + @override + void initState() { + WidgetsBinding.instance.addObserver(this); + super.initState(); + } + + + @override Widget build(BuildContext context) { return Sizer( diff --git a/lib/models/chat/incomingCall.dart b/lib/models/chat/incoming_call_model.dart similarity index 59% rename from lib/models/chat/incomingCall.dart rename to lib/models/chat/incoming_call_model.dart index c3aa11c..784f9c0 100644 --- a/lib/models/chat/incomingCall.dart +++ b/lib/models/chat/incoming_call_model.dart @@ -1,425 +1,331 @@ // To parse this JSON data, do // -// final incomingCallDataPayload = incomingCallDataPayloadFromJson(jsonString); +// final incomingCallModel = incomingCallModelFromJson(jsonString); import 'dart:convert'; -class IncomingCallDataPayload { - IncomingCallDataPayload({ - this.id, - this.nameCaller, +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.handle, - this.type, + 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.textCallback, - this.extra, - this.headers, - this.android, - this.ios, + this.type, + this.uuid, }); - String? id; - 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)); + factory IncomingCallModel.fromRawJson(String str) => IncomingCallModel.fromJson(json.decode(str)); String toRawJson() => json.encode(toJson()); - factory IncomingCallDataPayload.fromJson(Map json) => IncomingCallDataPayload( - id: json["id"], - nameCaller: json["nameCaller"], + factory IncomingCallModel.fromJson(Map 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"].toInt(), + extra: json["extra"] == null ? null : Extra.fromJson(json["extra"]), + from: json["from"], handle: json["handle"], - type: json["type"], - duration: json["duration"], + 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"], - textCallback: json["textCallback"], - extra: json["extra"] == null ? null : Extra.fromJson(json["extra"]), - headers: json["headers"], - android: json["android"] == null ? null : Android.fromJson(json["android"]), - ios: json["ios"] == null ? null : Ios.fromJson(json["ios"]), + type: json["type"].toInt(), + uuid: json["uuid"], ); Map toJson() => { - "id": id, - "nameCaller": nameCaller, + "actionColor": actionColor, "appName": appName, + "args": args?.toJson(), "avatar": avatar, - "handle": handle, - "type": type, + "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, - "textCallback": textCallback, - "extra": extra?.toJson(), - "headers": headers, - "android": android?.toJson(), - "ios": ios?.toJson(), + "type": type, + "uuid": uuid, }; } -class Android { - Android({ - 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; +class Args { + Args(); - 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()); - factory Android.fromJson(Map json) => Android( - 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"], + factory Args.fromJson(Map json) => Args( ); Map toJson() => { - "isCustomNotification": isCustomNotification, - "isShowLogo": isShowLogo, - "isShowCallback": isShowCallback, - "isShowMissedCallNotification": isShowMissedCallNotification, - "ringtonePath": ringtonePath, - "backgroundColor": backgroundColor, - "backgroundUrl": backgroundUrl, - "actionColor": actionColor, - "incomingCallNotificationChannelName": incomingCallNotificationChannelName, - "missedCallNotificationChannelName": missedCallNotificationChannelName, }; } class Extra { + LoginDetails? loginDetails; + bool? isIncomingCall; + CallerDetails? callerDetails; + Extra({ this.loginDetails, + this.isIncomingCall, this.callerDetails, }); - LoginDetails? loginDetails; - CallerDetails? callerDetails; - factory Extra.fromRawJson(String str) => Extra.fromJson(json.decode(str)); String toRawJson() => json.encode(toJson()); factory Extra.fromJson(Map json) => Extra( loginDetails: json["loginDetails"] == null ? null : LoginDetails.fromJson(json["loginDetails"]), + isIncomingCall: json["isIncomingCall"], callerDetails: json["callerDetails"] == null ? null : CallerDetails.fromJson(json["callerDetails"]), ); Map 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.userChatHistoryLineId, this.contant, - this.contantNo, - this.currentUserId, + this.fileTypeResponse, this.currentUserName, - this.targetUserId, - this.targetUserName, - this.encryptedTargetUserId, - this.encryptedTargetUserName, - this.currentUserEmail, this.targetUserEmail, - this.chatEventId, - this.fileTypeId, + 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, - 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)); String toRawJson() => json.encode(toJson()); factory CallerDetails.fromJson(Map json) => CallerDetails( - userChatHistoryId: json["userChatHistoryId"], - userChatHistoryLineId: json["userChatHistoryLineId"], + userChatHistoryId: json["userChatHistoryId"].toInt(), contant: json["contant"], - contantNo: json["contantNo"], - currentUserId: json["currentUserId"], + fileTypeResponse: json["fileTypeResponse"] == null ? null : FileTypeResponse.fromJson(json["fileTypeResponse"]), currentUserName: json["currentUserName"], - targetUserId: json["targetUserId"], - targetUserName: json["targetUserName"], - encryptedTargetUserId: json["encryptedTargetUserId"], - encryptedTargetUserName: json["encryptedTargetUserName"], - currentUserEmail: json["currentUserEmail"], targetUserEmail: json["targetUserEmail"], - chatEventId: json["chatEventId"], - fileTypeId: json["fileTypeId"], + conversationId: json["conversationId"], + encryptedTargetUserId: json["encryptedTargetUserId"], + targetUserId: json["targetUserId"].toInt(), isSeen: json["isSeen"], + userChatHistoryLineId: json["userChatHistoryLineId"].toInt(), isDelivered: json["isDelivered"], + targetUserName: json["targetUserName"], + currentUserId: json["currentUserId"].toInt(), createdDate: json["createdDate"] == null ? null : DateTime.parse(json["createdDate"]), - chatSource: json["chatSource"], - conversationId: json["conversationId"], - fileTypeResponse: json["fileTypeResponse"] == null ? null : FileTypeResponse.fromJson(json["fileTypeResponse"]), - userChatReplyResponse: json["userChatReplyResponse"], + currentUserEmail: json["currentUserEmail"], + contantNo: json["contantNo"], + chatEventId: json["chatEventId"].toInt(), + encryptedTargetUserName: json["encryptedTargetUserName"], + chatSource: json["chatSource"].toInt(), ); Map toJson() => { "userChatHistoryId": userChatHistoryId, - "userChatHistoryLineId": userChatHistoryLineId, "contant": contant, - "contantNo": contantNo, - "currentUserId": currentUserId, + "fileTypeResponse": fileTypeResponse?.toJson(), "currentUserName": currentUserName, - "targetUserId": targetUserId, - "targetUserName": targetUserName, - "encryptedTargetUserId": encryptedTargetUserId, - "encryptedTargetUserName": encryptedTargetUserName, - "currentUserEmail": currentUserEmail, "targetUserEmail": targetUserEmail, - "chatEventId": chatEventId, - "fileTypeId": fileTypeId, + "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, - "conversationId": conversationId, - "fileTypeResponse": fileTypeResponse?.toJson(), - "userChatReplyResponse": userChatReplyResponse, }; } class FileTypeResponse { + int? fileTypeId; + FileTypeResponse({ 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)); String toRawJson() => json.encode(toJson()); factory FileTypeResponse.fromJson(Map json) => FileTypeResponse( - fileTypeId: json["fileTypeId"], - fileTypeName: json["fileTypeName"], - fileTypeDescription: json["fileTypeDescription"], - fileKind: json["fileKind"], - fileName: json["fileName"], + fileTypeId:json["fileTypeId"].toInt(), ); Map toJson() => { "fileTypeId": fileTypeId, - "fileTypeName": fileTypeName, - "fileTypeDescription": fileTypeDescription, - "fileKind": fileKind, - "fileName": fileName, }; } 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.email, - this.phone, this.title, - this.token, - this.isDomainUser, - this.isActiveCode, 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)); String toRawJson() => json.encode(toJson()); factory LoginDetails.fromJson(Map json) => LoginDetails( - id: json["id"], + isActiveCode: json["isActiveCode"], + id: json["id"].toInt(), + encryptedUserName: json["encryptedUserName"], userName: json["userName"], - email: json["email"], - phone: json["phone"], title: json["title"], - token: json["token"], - isDomainUser: json["isDomainUser"], - isActiveCode: json["isActiveCode"], encryptedUserId: json["encryptedUserId"], - encryptedUserName: json["encryptedUserName"], + email: json["email"], + isDomainUser: json["isDomainUser"], + token: json["token"], ); Map toJson() => { + "isActiveCode": isActiveCode, "id": id, + "encryptedUserName": encryptedUserName, "userName": userName, - "email": email, - "phone": phone, "title": title, - "token": token, - "isDomainUser": isDomainUser, - "isActiveCode": isActiveCode, "encryptedUserId": encryptedUserId, - "encryptedUserName": encryptedUserName, - }; -} - -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 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 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, + "email": email, + "isDomainUser": isDomainUser, + "token": token, }; } diff --git a/lib/ui/chat/call/start_call_screen.dart b/lib/ui/chat/call/start_call_screen.dart index 2c9156e..823bd92 100644 --- a/lib/ui/chat/call/start_call_screen.dart +++ b/lib/ui/chat/call/start_call_screen.dart @@ -1,12 +1,10 @@ - import 'dart:convert'; import 'dart:core'; import 'package:draggable_widget/draggable_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter_callkit_incoming/flutter_callkit_incoming.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/get_user_login_token_model.dart' as ALM; +import 'package:mohem_flutter_app/models/chat/incoming_call_model.dart'; class StartCallPage extends StatefulWidget { @override @@ -28,23 +26,13 @@ class _StartCallPageState extends State { } void startCall() async { - ALM.Response? sessionData; + IncomingCallModel? sessionData; var calls = await FlutterCallkitIncoming.activeCalls(); - if (calls is List) { - if (calls.isNotEmpty) { - //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"]); - } + if (calls.isNotEmpty) { + sessionData = IncomingCallModel.fromRawJson(jsonEncode(calls[0])); } - logger.i(sessionData); -print("========================"); - + logger.d(sessionData!.extra!.isIncomingCall); } @override diff --git a/lib/ui/login/login_screen.dart b/lib/ui/login/login_screen.dart index e88cd2d..2d9e25c 100644 --- a/lib/ui/login/login_screen.dart +++ b/lib/ui/login/login_screen.dart @@ -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/widget_extensions.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/get_mobile_login_info_list_model.dart'; import 'package:mohem_flutter_app/models/member_information_list_model.dart'; diff --git a/lib/ui/login/verify_last_login_screen.dart b/lib/ui/login/verify_last_login_screen.dart index c48d1f3..3263abf 100644 --- a/lib/ui/login/verify_last_login_screen.dart +++ b/lib/ui/login/verify_last_login_screen.dart @@ -3,6 +3,7 @@ import 'dart:io'; import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_callkit_incoming/flutter_callkit_incoming.dart'; import 'package:flutter_svg/svg.dart'; import 'package:local_auth/auth_strings.dart'; import 'package:local_auth/local_auth.dart'; @@ -51,10 +52,13 @@ class _VerifyLastLoginScreenState extends State { @override void initState() { _getAvailableBiometrics(); + print("------------------- Verfiy Screeeeeen -----------------------"); // setDefault(); super.initState(); } + + @override Widget build(BuildContext context) { mobileLoginInfoListModel ??= ModalRoute.of(context)!.settings.arguments as GetMobileLoginInfoListModel; @@ -289,7 +293,7 @@ class _VerifyLastLoginScreenState extends State { width: 38, 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 { // // isLoading = isTrue; // }); // } - }