From 6bdb7a330523a3024e4ca4ef8e3676cc215dd9a9 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 10 Jan 2023 17:26:34 +0300 Subject: [PATCH] Updates & fixes --- android/app/src/main/AndroidManifest.xml | 1 + lib/config/localized_values.dart | 4 +- lib/pages/feedback/send_feedback_page.dart | 8 ++-- lib/pages/livecare/incoming_call.dart | 35 ++++++------------ .../livecare/live_care_payment_page.dart | 37 +++++++++++++++++-- lib/uitl/app-permissions.dart | 8 ++-- lib/uitl/push-notification-handler.dart | 30 ++++++++++----- pubspec.yaml | 4 +- 8 files changed, 80 insertions(+), 47 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index ef4a8f83..de6f8030 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -6,6 +6,7 @@ In most cases you can leave this as-is, but you if you want to provide additional functionality it is fine to subclass or reimplement FlutterApplication and put your custom class here. --> + diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 958b451d..73f4c1fe 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -863,7 +863,7 @@ const Map localizedValues = { "question": {"en": "Question", "ar": "سؤال"}, "message-type": {"en": "Message Type", "ar": "نوع الرسالة"}, "feedback-type": {"en": "Feedback Type", "ar": "نوع الرسالة"}, - "compliment": {"en": "compliment", "ar": "شكوى"}, + "compliment": {"en": "Appreciation", "ar": "تقدير"}, "suggestion": {"en": "Suggestion", "ar": "إقتراح"}, "your-feedback": {"en": "Your feedback was sent", "ar": "لقد تم ارسال اقتراحك شكرا لك"}, "select-part": {"en": "Please select the part that complain about", "ar": "يرجى تحديد الجزء الذي تشكو منه"}, @@ -1843,7 +1843,7 @@ const Map localizedValues = { "privacyPolicy": {"en": "Privacy Policy", "ar": "سياسة الخصوصية"}, "termsConditions": {"en": "Terms & Conditions", "ar": "الأحكام والشروط"}, "prescriptionDeliveryError": {"en": "This clinic does not support refill & delivery.", "ar": "هذه العيادة لا تدعم إعادة التعبئة والتسليم."}, - "liveCarePermissions": {"en": "LiveCare requires Camera, Microphone & Location permissions, Please allow these to proceed.", "ar": "يتطلب لايف كير أذونات الكاميرا والميكروفون والموقع، يرجى السماح لها بالمتابعة."}, + "liveCarePermissions": {"en": "LiveCare requires Camera, Microphone & Location permissions to enable virtual consultation between patient & doctor, Please allow these to proceed.", "ar": "يتطلب لايف كير أذونات الكاميرا والميكروفون والموقع، يرجى السماح لها بالمتابعة."}, "lakumUnhold": { "en": "The account has already been activated", "ar": "لقد تم تفعيل الحساب من قبل" }, "lakumDiscontinue": { "en": "The account is closed", "ar": "الحساب مغلق" }, "lakumSuccess": { "en": "The account has been activated successfully", "ar": "تم تفعيل الحساب بنجاح" }, diff --git a/lib/pages/feedback/send_feedback_page.dart b/lib/pages/feedback/send_feedback_page.dart index 4bd1ae81..2badddd5 100644 --- a/lib/pages/feedback/send_feedback_page.dart +++ b/lib/pages/feedback/send_feedback_page.dart @@ -340,8 +340,8 @@ class _SendFeedbackPageState extends State { }); } }, - color: Color(0xffD02127), - textColor: (titleController.text.toString().isEmpty || messageController.text.toString().isEmpty) ? Color(0xff000000) : Colors.white, + color: (titleController.text.toString().isEmpty || messageController.text.toString().isEmpty) ? Color(0xffEAEAEA) : Color(0xffD02127), + textColor: Colors.white, disabledColor: Color(0xffEAEAEA), ), ), @@ -405,8 +405,8 @@ class _SendFeedbackPageState extends State { color: Color(0xff575757), letterSpacing: -0.56, ), - suffixIconConstraints: BoxConstraints(minWidth: 50), - suffixIcon: suffixTap == null ? null : IconButton(icon: Icon(Icons.mic, color: Color(0xff2E303A)), onPressed: suffixTap), + // suffixIconConstraints: BoxConstraints(minWidth: 50), + // suffixIcon: suffixTap == null ? null : IconButton(icon: Icon(Icons.mic, color: Color(0xff2E303A)), onPressed: suffixTap), contentPadding: EdgeInsets.zero, border: InputBorder.none, focusedBorder: InputBorder.none, diff --git a/lib/pages/livecare/incoming_call.dart b/lib/pages/livecare/incoming_call.dart index 69ae98f6..da8c507e 100644 --- a/lib/pages/livecare/incoming_call.dart +++ b/lib/pages/livecare/incoming_call.dart @@ -49,7 +49,7 @@ class _IncomingCallState extends State with SingleTickerProviderSt void dispose() { _animationController.dispose(); player.stop(); - _controller.dispose(); + // _controller.dispose(); disposeAudioResources(); super.dispose(); } @@ -62,17 +62,17 @@ class _IncomingCallState extends State with SingleTickerProviderSt body: FutureBuilder( future: _initializeControllerFuture, builder: (context, snapshot) { - if (snapshot.connectionState == ConnectionState.done) { + // if (snapshot.connectionState == ConnectionState.done) { return Stack( alignment: FractionalOffset.center, children: [ - new Positioned.fill( - child: new AspectRatio(aspectRatio: _controller.value.aspectRatio, child: new CameraPreview(_controller)), - ), + // new Positioned.fill( + // child: new AspectRatio(aspectRatio: _controller.value.aspectRatio, child: new CameraPreview(_controller)), + // ), new Positioned.fill( child: new ClipRect( - child: new BackdropFilter( - filter: new ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0), + // child: new BackdropFilter( + // filter: new ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0), child: new Container( decoration: new BoxDecoration(color: Colors.grey[800].withOpacity(0.8)), child: Column( @@ -191,29 +191,18 @@ class _IncomingCallState extends State with SingleTickerProviderSt ), ), ), - ), + // ), ], ); - } else { - return const Center(child: CircularProgressIndicator()); - } + // } else { + // return const Center(child: CircularProgressIndicator()); + // } }, ), ); } void _runAnimation() async { - final cameras = await availableCameras(); - final firstCamera = cameras[1]; - - _controller = CameraController( - // Get a specific camera from the list of available cameras. - firstCamera, - // Define the resolution to use. - ResolutionPreset.medium, - ); - _initializeControllerFuture = _controller.initialize(); - setState(() { isCameraReady = true; }); @@ -229,7 +218,7 @@ class _IncomingCallState extends State with SingleTickerProviderSt try { // backToHome(); // final roomModel = RoomModel(name: widget.incomingCallData.name, token: widget.incomingCallData.sessionId, identity: widget.incomingCallData.identity); - await _controller.dispose(); + // await _controller.dispose(); changeCallStatusAPI(4); await Navigator.of(context).pushReplacement( MaterialPageRoute( diff --git a/lib/pages/livecare/live_care_payment_page.dart b/lib/pages/livecare/live_care_payment_page.dart index 375249b3..3b0dab9b 100644 --- a/lib/pages/livecare/live_care_payment_page.dart +++ b/lib/pages/livecare/live_care_payment_page.dart @@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/covid_consent_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -290,7 +291,7 @@ class _LiveCarePatmentPageState extends State { AppToast.showErrorToast(message: TranslationBase.of(context).pleaseAcceptTerms); } else { askVideoCallPermission().then((value) async { - if (value) { + if (value == true) { locationUtils = new LocationUtils(isShowConfirmDialog: false, context: context); locationUtils.getCurrentLocation(callBack: (value) { print(value); @@ -322,10 +323,29 @@ class _LiveCarePatmentPageState extends State { } Future askVideoCallPermission() async { - if (!(await Permission.camera.request().isGranted) || !(await Permission.microphone.request().isGranted) || !(await Permission.location.request().isGranted)) { - return false; + if (Platform.isIOS) { + if (!(await Permission.camera.request().isGranted) || !(await Permission.microphone.request().isGranted) || !(await Permission.location.request().isGranted)) { + return false; + } + } else { + await showDialog( + context: context, + builder: (cxt) => CovidConsentDialog( + okTitle: TranslationBase.of(context).acceptLbl, + title: TranslationBase.of(context).covidConsentHeader, + message: TranslationBase.of(context).liveCarePermissions, + onTap: () async { + if (!(await Permission.camera.request().isGranted) || !(await Permission.microphone.request().isGranted) || !(await Permission.location.request().isGranted)) { + return false; + } + }, + )); } return true; + // if (!(await Permission.camera.request().isGranted) || !(await Permission.microphone.request().isGranted) || !(await Permission.location.request().isGranted)) { + // return false; + // } + // return true; } openPermissionsDialog() { @@ -342,6 +362,17 @@ class _LiveCarePatmentPageState extends State { dialog.showAlertDialog(context); } + openPermissionsConsentDialog() { + showDialog( + context: context, + builder: (cxt) => CovidConsentDialog( + okTitle: TranslationBase.of(context).acceptLbl, + title: TranslationBase.of(context).covidConsentHeader, + message: TranslationBase.of(context).covidConsent, + onTap: () async {}, + )); + } + Future drawOverAppsMessageDialog(BuildContext context) async { ConfirmDialog dialog = new ConfirmDialog( context: context, diff --git a/lib/uitl/app-permissions.dart b/lib/uitl/app-permissions.dart index bdd72e54..62fd484a 100644 --- a/lib/uitl/app-permissions.dart +++ b/lib/uitl/app-permissions.dart @@ -14,10 +14,10 @@ class AppPermission{ if (!(await Permission.camera.request().isGranted) || !(await Permission.microphone.request().isGranted)) { return false; } - if (Platform.isAndroid && !(await PlatformBridge.shared().isDrawOverAppsPermissionAllowed())) { - await _drawOverAppsMessageDialog(context); - return false; - } + // if (Platform.isAndroid && !(await PlatformBridge.shared().isDrawOverAppsPermissionAllowed())) { + // await _drawOverAppsMessageDialog(context); + // return false; + // } return true; } diff --git a/lib/uitl/push-notification-handler.dart b/lib/uitl/push-notification-handler.dart index 49fa571d..4cc85342 100644 --- a/lib/uitl/push-notification-handler.dart +++ b/lib/uitl/push-notification-handler.dart @@ -22,6 +22,7 @@ import 'package:flutter_ios_voip_kit/call_state_type.dart'; import 'package:flutter_ios_voip_kit/flutter_ios_voip_kit.dart'; import 'package:huawei_hmsavailability/huawei_hmsavailability.dart'; import 'package:huawei_push/huawei_push.dart' as h_push; +import 'package:permission_handler/permission_handler.dart'; import 'app_shared_preferences.dart'; import 'navigation_service.dart'; @@ -236,6 +237,11 @@ class PushNotificationHandler { if (Platform.isIOS) { final permission = await FirebaseMessaging.instance.requestPermission(); if (permission.authorizationStatus == AuthorizationStatus.denied) return; + } else { + // await Permission.notification.request().then((value) { + // }).catchError((err) { + // print(err); + // }); } // 'Android HMS' (Handle Huawei Push_Kit Streams) @@ -245,15 +251,21 @@ class PushNotificationHandler { // } else { // 'Android GMS or iOS' (Handle Firebase Messaging Streams - FirebaseMessaging.instance.getInitialMessage().then((RemoteMessage message) async { - print("Firebase getInitialMessage with message : ${message.data.toString()}"); - subscribeFCMTopic(); - if (Platform.isIOS) - await Future.delayed(Duration(milliseconds: 3000)).then((value) { - if (message != null) newMessage(message); - }); - else if (message != null) newMessage(message); - }); + try { + FirebaseMessaging.instance.getInitialMessage().then((RemoteMessage message) async { + if(message != null) { + // print("Firebase getInitialMessage with message : ${message.data.toString()}"); + subscribeFCMTopic(); + if (Platform.isIOS) + await Future.delayed(Duration(milliseconds: 3000)).then((value) { + if (message != null) newMessage(message); + }); + else if (message != null) newMessage(message); + } + }); + } catch(ex) { + + } FirebaseMessaging.onMessage.listen((RemoteMessage message) async { print("Firebase onMessage!!!"); diff --git a/pubspec.yaml b/pubspec.yaml index 0f8af947..15accfac 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.5.008+4050008 +version: 4.5.013+4050013 environment: sdk: ">=2.7.0 <3.0.0" @@ -40,7 +40,7 @@ dependencies: camera: ^0.10.1 # Permissions - permission_handler: ^8.3.0 + permission_handler: ^10.2.0 # Flutter Html View flutter_html: ^2.2.1