From cd4b9d8c74f705632c44bbb1b6a6f5003af347f9 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 22 Aug 2023 17:55:58 +0300 Subject: [PATCH] updates --- android/app/build.gradle | 2 + lib/classes/notifications.dart | 37 ++++++++++--------- .../chat/call/chat_incoming_call_screen.dart | 4 +- lib/ui/login/login_screen.dart | 10 ++++- .../offers_and_discounts_details.dart | 2 +- 5 files changed, 32 insertions(+), 23 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index e66b465..e4f623e 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -86,5 +86,7 @@ flutter { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'com.squareup.okhttp3:okhttp:4.9.1' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0' + } diff --git a/lib/classes/notifications.dart b/lib/classes/notifications.dart index 80f0d79..527c3aa 100644 --- a/lib/classes/notifications.dart +++ b/lib/classes/notifications.dart @@ -73,7 +73,7 @@ class AppNotifications { if (initialMessage != null) _handleMessage(initialMessage); FirebaseMessaging.onMessage.listen((RemoteMessage message) { - if (message.notification != null) _handleMessage(message); + _handleMessage(message); }); FirebaseMessaging.onMessageOpenedApp.listen(_handleOpenApp); @@ -134,23 +134,26 @@ class AppNotifications { Utils.saveStringFromPrefs("isAppOpendByChat", "false"); GetNotificationsResponseModel notification = GetNotificationsResponseModel(); - notification.createdOn = DateUtil.getMonthDayYearDateFormatted(DateTime.now()); - notification.messageTypeData = message.data['picture']; - notification.message = message.data['message']; - notification.notificationType = message.data["NotificationType"].toString(); - if (message.data["NotificationType"] == "2") { - notification.videoURL = message.data["VideoUrl"]; - } + if (message.notification != null) { + notification.createdOn = DateUtil.getMonthDayYearDateFormatted(DateTime.now()); + notification.messageTypeData = message.data['picture']; + notification.message = message.data['message']; + notification.notificationType = message.data["NotificationType"].toString(); + if (message.data["NotificationType"] == "2") { + notification.videoURL = message.data["VideoUrl"]; + } - Future.delayed(Duration(seconds: 5), () { - Navigator.of(context).push( - MaterialPageRoute( - builder: (BuildContext context) => NotificationsDetailsPage( - notification: notification, + Future.delayed(Duration(seconds: 5), () { + Navigator.of(context).push( + MaterialPageRoute( + builder: (BuildContext context) => NotificationsDetailsPage( + notification: notification, + ), ), - ), - ); - }); + ); + }); + } + if (message.data.isNotEmpty && message.data["messageType"] == 'chat') { Utils.saveStringFromPrefs("isAppOpendByChat", "true"); Utils.saveStringFromPrefs("notificationData", message.data["user_chat_history_response"].toString()); @@ -187,8 +190,6 @@ class AppNotifications { }); } } - - } const AndroidNotificationChannel channel = AndroidNotificationChannel( diff --git a/lib/ui/chat/call/chat_incoming_call_screen.dart b/lib/ui/chat/call/chat_incoming_call_screen.dart index 81645c3..8056292 100644 --- a/lib/ui/chat/call/chat_incoming_call_screen.dart +++ b/lib/ui/chat/call/chat_incoming_call_screen.dart @@ -154,7 +154,7 @@ class _StartCallPageState extends State { RTCVideoView( provider.remoteRenderer!, objectFit: RTCVideoViewObjectFit.RTCVideoViewObjectFitContain, - filterQuality: FilterQuality.high, + // filterQuality: FilterQuality.high, key: const Key('remote'), ), if (provider.isVideoCall) @@ -174,7 +174,7 @@ class _StartCallPageState extends State { child: RTCVideoView( provider.localVideoRenderer!, mirror: true, - filterQuality: FilterQuality.high, + // filterQuality: FilterQuality.high, objectFit: RTCVideoViewObjectFit.RTCVideoViewObjectFitCover, ), ), diff --git a/lib/ui/login/login_screen.dart b/lib/ui/login/login_screen.dart index 59fc3fe..2217fd5 100644 --- a/lib/ui/login/login_screen.dart +++ b/lib/ui/login/login_screen.dart @@ -98,8 +98,10 @@ class _LoginScreenState extends State with WidgetsBindingObserver { void setupVoIPCallBacks() { if (Platform.isIOS) { voIPKit.getVoIPToken().then((String? value) async { + print('🎈 example: getVoIPToken: $value'); if (value != null) { AppState().setiosVoipPlayerID = await ChatApiClient().oneSignalVoip(value!); + print('🎈 example: OneSignal ID: ${AppState().iosVoipPlayerID}'); } }); } @@ -150,8 +152,11 @@ class _LoginScreenState extends State with WidgetsBindingObserver { isIncomingCall = true; if (AppState().getisUserOnline) { _iosCallPayload = IosCallPayload( - uuid: uuid, incomingCallerId: callDetails.split("-")[0], incomingCallReciverId: callDetails.split("-")[1], incomingCallerName: _iosCallPayload!.incomingCallerName, incomingCallType: callDetails.split("-").last); - + uuid: uuid, + incomingCallerId: callDetails.split("-")[0], + incomingCallReciverId: callDetails.split("-")[1], + incomingCallerName: _iosCallPayload!.incomingCallerName, + incomingCallType: callDetails.split("-").last); } else { _iosCallPayload = IosCallPayload( uuid: uuid, incomingCallerId: callDetails.split("-")[0], incomingCallReciverId: callDetails.split("-")[1], incomingCallerName: null, incomingCallType: callDetails.split("-").last); @@ -398,6 +403,7 @@ class _LoginScreenState extends State with WidgetsBindingObserver { Utils.showLoading(context); Future.delayed(Duration(seconds: Platform.isIOS ? 3 : 2)).whenComplete(() { if (!isIncomingCall) { + Utils.hideLoading(context); if (isAppOpenBySystem!) checkFirebaseToken(); } }); diff --git a/lib/ui/screens/offers_and_discounts/offers_and_discounts_details.dart b/lib/ui/screens/offers_and_discounts/offers_and_discounts_details.dart index 30a9fa2..b4cb242 100644 --- a/lib/ui/screens/offers_and_discounts/offers_and_discounts_details.dart +++ b/lib/ui/screens/offers_and_discounts/offers_and_discounts_details.dart @@ -76,7 +76,7 @@ class _OffersAndDiscountsDetailsState extends State { : getOffersList[0].titleEn!.toText22(isBold: true, color: const Color(0xff2B353E)).center, Html( data: AppState().isArabic(context) ? getOffersList[0].descriptionAr! : getOffersList[0].descriptionEn ?? "", - onLinkTap: (String? url, Map attributes, _) { + onLinkTap: (String? url, RenderContext context, Map attributes, _) { launchUrl(Uri.parse(url!)); }, ),