diff --git a/lib/config/config.dart b/lib/config/config.dart index c09f2cd2..60336685 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -727,6 +727,9 @@ var SEND_DENTAL_APPOINTMENT_INVOICE_EMAIL = var GET_TAMARA_PLAN = 'https://mdlaboratories.com/tamara/Home/GetInstallments'; +var GET_ONESIGNAL_VOIP_TOKEN = + 'https://onesignal.com/api/v1/players'; + class AppGlobal { static var context; diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 8ae7e20b..9e5c4f27 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -3,6 +3,7 @@ const APP_LANGUAGE = 'language'; const USER_PROFILE = 'user-profile'; const PUSH_TOKEN = 'push-token'; const APNS_TOKEN = 'apns-token'; +const ONESIGNAL_APNS_TOKEN = 'onesignal-apns-token'; const REGISTER_DATA_FOR_REGISTER = 'register-data-for-register'; const LOGIN_TOKEN_ID = 'register-data-for-register'; const REGISTER_DATA_FOR_LOGIIN = 'register-data-for-login'; diff --git a/lib/models/LiveCare/ApplePayInsertRequest.dart b/lib/models/LiveCare/ApplePayInsertRequest.dart index ab1bd2cc..fa001124 100644 --- a/lib/models/LiveCare/ApplePayInsertRequest.dart +++ b/lib/models/LiveCare/ApplePayInsertRequest.dart @@ -6,6 +6,7 @@ class ApplePayInsertRequest { int customerID; String customerName; String deviceToken; + String voipToken; int doctorID; String projectID; String serviceID; @@ -43,6 +44,7 @@ class ApplePayInsertRequest { this.customerID, this.customerName, this.deviceToken, + this.voipToken, this.doctorID, this.projectID, this.serviceID, @@ -80,6 +82,7 @@ class ApplePayInsertRequest { customerID = json['CustomerID']; customerName = json['CustomerName']; deviceToken = json['DeviceToken']; + voipToken = json['VoipToken']; doctorID = json['DoctorID']; projectID = json['ProjectID']; serviceID = json['Service_ID']; @@ -119,6 +122,7 @@ class ApplePayInsertRequest { data['CustomerID'] = this.customerID; data['CustomerName'] = this.customerName; data['DeviceToken'] = this.deviceToken; + data['VoipToken'] = this.voipToken; data['DoctorID'] = this.doctorID; data['ProjectID'] = this.projectID; data['Service_ID'] = this.serviceID; diff --git a/lib/pages/DrawerPages/notifications/notification_details_page.dart b/lib/pages/DrawerPages/notifications/notification_details_page.dart index 1365d77a..ad4815d9 100644 --- a/lib/pages/DrawerPages/notifications/notification_details_page.dart +++ b/lib/pages/DrawerPages/notifications/notification_details_page.dart @@ -24,7 +24,7 @@ class _NotificationsDetailsPageState extends State { initialVideoId: getVideoURL(), flags: YoutubePlayerFlags( autoPlay: true, - mute: true, + mute: false, ), ); super.initState(); @@ -48,10 +48,12 @@ class _NotificationsDetailsPageState extends State { } String getVideoURL() { - String videoId; - videoId = YoutubePlayer.convertUrlToId(widget.notification.videoURL); - print(videoId); // BBAyRBTfsOU - return videoId; + if (widget.notification.videoURL != null && widget.notification.notificationType == "2") { + String videoId; + videoId = YoutubePlayer.convertUrlToId(widget.notification.videoURL); + print(videoId); // BBAyRBTfsOU + return videoId; + } } @override diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index f6450f36..64685b1b 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -17,10 +17,10 @@ import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/pages/landing/home_page_2.dart'; import 'package:diplomaticquarterapp/pages/livecare/incoming_call.dart'; import 'package:diplomaticquarterapp/pages/medical/medical_profile_page_new.dart'; -import 'package:diplomaticquarterapp/pages/videocall-webrtc-rnd/webrtc/start_video_call.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart' as family; +import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; @@ -40,7 +40,6 @@ import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_app_icon_badge/flutter_app_icon_badge.dart'; -import 'package:flutter_ios_voip_kit/call_state_type.dart'; import 'package:flutter_ios_voip_kit/flutter_ios_voip_kit.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -449,8 +448,6 @@ class _LandingPageState extends State with WidgetsBindingObserver { } } - - dummyCall() async { final json = { "callerID": "s1", @@ -459,7 +456,6 @@ class _LandingPageState extends State with WidgetsBindingObserver { "notfID": "123", "notification_foreground": "true", "count": "1", - "message": "Doctor is calling ", "AppointmentNo": "123", "title": "Rayyan Hospital", @@ -473,7 +469,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { "appointmenttime": "09:00", "type": "video", "session_id": - "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImN0eSI6InR3aWxpby1mcGE7dj0xIn0.eyJqdGkiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0LTE1OTg3NzQ1MDYiLCJpc3MiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0Iiwic3ViIjoiQUNhYWQ1YTNmOGM2NGZhNjczNTY3NTYxNTc0N2YyNmMyYiIsImV4cCI6MTU5ODc3ODEwNiwiZ3JhbnRzIjp7ImlkZW50aXR5IjoiSGFyb29uMSIsInZpZGVvIjp7InJvb20iOiJTbWFsbERhaWx5U3RhbmR1cCJ9fX0.7XUS5uMQQJfkrBZu9EjQ6STL6R7iXkso6BtO1HmrQKk", + "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImN0eSI6InR3aWxpby1mcGE7dj0xIn0.eyJqdGkiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0LTE1OTg3NzQ1MDYiLCJpc3MiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0Iiwic3ViIjoiQUNhYWQ1YTNmOGM2NGZhNjczNTY3NTYxNTc0N2YyNmMyYiIsImV4cCI6MTU5ODc3ODEwNiwiZ3JhbnRzIjp7ImlkZW50aXR5IjoiSGFyb29uMSIsInZpZGVvIjp7InJvb20iOiJTbWFsbERhaWx5U3RhbmR1cCJ9fX0.7XUS5uMQQJfkrBZu9EjQ6STL6R7iXkso6BtO1HmrQKk", "identity": "Haroon1", "name": "SmallDailyStandup", "videoUrl": "video", @@ -703,6 +699,17 @@ class _LandingPageState extends State with WidgetsBindingObserver { } else { projectViewModel.analytics.setUser(null); } + String voipToken = await sharedPref.getString(APNS_TOKEN); + getOneSignalVOIPToken(voipToken); + } + + getOneSignalVOIPToken(String voipToken) { + LiveCareService service = new LiveCareService(); + service.getOneSignalVOIPToken(voipToken, context).then((res) { + AppSharedPreferences().setString(ONESIGNAL_APNS_TOKEN, res['id']); + }).catchError((err) { + print(err); + }); } void showUserConsent() { diff --git a/lib/services/livecare_services/livecare_provider.dart b/lib/services/livecare_services/livecare_provider.dart index b30960b4..f9851ff7 100644 --- a/lib/services/livecare_services/livecare_provider.dart +++ b/lib/services/livecare_services/livecare_provider.dart @@ -201,7 +201,7 @@ class LiveCareService extends BaseService { Map request; String deviceToken; - String voipToken = await sharedPref.getString(APNS_TOKEN); + String voipToken = await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN); getDeviceToken().then((value) { print(value); deviceToken = value; @@ -314,4 +314,19 @@ class LiveCareService extends BaseService { return Future.value(localRes); } + Future getOneSignalVOIPToken(String voipToken, BuildContext context) async { + Map request; + + // request = {"app_id": "eb8e49e5-dec7-4ed2-8d6a-4df8cb301406", "identifier": voipToken, "device_type": 0, "test_type": 0}; + request = { "app_id": "eb8e49e5-dec7-4ed2-8d6a-4df8cb301406", "identifier": voipToken, "device_type": 0 }; + + dynamic localRes; + + await baseAppClient.post(GET_ONESIGNAL_VOIP_TOKEN, isExternal: true, isAllowAny: true, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } } diff --git a/lib/splashPage.dart b/lib/splashPage.dart index 040a4c1a..b5dc28bb 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -44,8 +44,8 @@ class _SplashScreenState extends State { AppSharedPreferences().getAll().then((value){ - debugPrint("ALL SHARED PREFERENCES!!!!!"); - debugPrint(jsonEncode(value)); + // debugPrint("ALL SHARED PREFERENCES!!!!!"); + // debugPrint(jsonEncode(value)); }); } diff --git a/lib/uitl/push-notification-handler.dart b/lib/uitl/push-notification-handler.dart index a1ff5ea3..a8b06051 100644 --- a/lib/uitl/push-notification-handler.dart +++ b/lib/uitl/push-notification-handler.dart @@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/pages/DrawerPages/notifications/notificatio import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/livecare/incoming_call.dart'; import 'package:diplomaticquarterapp/pages/webRTC/OpenTok/OpenTok.dart'; +import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; import 'package:diplomaticquarterapp/uitl/app-permissions.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index 57985daf..6e89bb01 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -26,11 +26,7 @@ var _InAppBrowserOptions = InAppBrowserClassOptions( applePayAPIEnabled: true, )), crossPlatform: InAppBrowserOptions(hideUrlBar: true, toolbarTopBackgroundColor: Colors.black), - ios: IOSInAppBrowserOptions( - hideToolbarBottom: true, - toolbarBottomBackgroundColor: Colors.white, - presentationStyle: IOSUIModalPresentationStyle.OVER_FULL_SCREEN - )); + ios: IOSInAppBrowserOptions(hideToolbarBottom: true, toolbarBottomBackgroundColor: Colors.white, presentationStyle: IOSUIModalPresentationStyle.OVER_FULL_SCREEN)); class MyInAppBrowser extends InAppBrowser { _PAYMENT_TYPE paymentType; @@ -168,6 +164,7 @@ class MyInAppBrowser extends InAppBrowser { applePayInsertRequest.customerID = authenticatedUser.patientID; applePayInsertRequest.customerName = authenticatedUser.firstName; applePayInsertRequest.deviceToken = await AppSharedPreferences().getString(PUSH_TOKEN); + applePayInsertRequest.voipToken = await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN); applePayInsertRequest.doctorID = (doctorID != null && doctorID != "") ? doctorID : 0; applePayInsertRequest.projectID = projId; applePayInsertRequest.serviceID = servID; @@ -254,8 +251,8 @@ class MyInAppBrowser extends InAppBrowser { form = form.replaceFirst('PATIENT_OUT_SA', authUser.outSA == 0 ? false.toString() : true.toString()); form = form.replaceFirst('PATIENT_TYPE_ID', patientData == null ? patientType.toString() : "1"); - // form = form.replaceFirst('DEVICE_TOKEN', await sharedPref.getString(PUSH_TOKEN) + "," + await sharedPref.getString(APNS_TOKEN)); - form = form.replaceFirst('DEVICE_TOKEN', await sharedPref.getString(PUSH_TOKEN)); + form = form.replaceFirst('DEVICE_TOKEN', await AppSharedPreferences().getString(PUSH_TOKEN) + "," + await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN)); + // form = form.replaceFirst('DEVICE_TOKEN', await sharedPref.getString(PUSH_TOKEN)); form = form.replaceFirst('LATITUDE_VALUE', this.lat.toString()); form = form.replaceFirst('LONGITUDE_VALUE', this.long.toString()); diff --git a/pubspec.yaml b/pubspec.yaml index 72c5fbb5..6bc27e53 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.4.98+404098 +version: 4.4.99+404099 environment: sdk: ">=2.7.0 <3.0.0"