diff --git a/android/app/build.gradle b/android/app/build.gradle index ce5e9e3..9fa2db1 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -55,8 +55,8 @@ android { // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. minSdkVersion 23 targetSdkVersion 33 - versionCode 49 - versionName '1.5.49' + versionCode 52 + versionName '1.5.52' // manifestPlaceholders = [mapsApiKey: 'android/app/src/main/AndroidManifest.xml'] } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index b9bbae8..5732480 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,67 +1,53 @@ - - - - - - - - - + + + - - - - - - - + - - - - + - - - - - - + - - - + - - - - + - - \ No newline at end of file diff --git a/lib/controller/auth/captin/register_captin_controller.dart b/lib/controller/auth/captin/register_captin_controller.dart index 7cd8a2e..ebda9ec 100644 --- a/lib/controller/auth/captin/register_captin_controller.dart +++ b/lib/controller/auth/captin/register_captin_controller.dart @@ -91,16 +91,30 @@ class RegisterCaptainController extends GetxController { .post(link: AppLink.checkPhoneNumberISVerfiedDriver, payload: { 'phone_number': '+2${phoneController.text}', }); - var d = jsonDecode(responseCheker); - if (d['message'][0]['is_verified'].toString() == '1') { - Get.snackbar('Phone number is verified before'.tr, '', - backgroundColor: AppColor.greenColor); - box.write(BoxName.isVerified, '1'); - box.write(BoxName.phone, '+2${phoneController.text}'); - await Get.put(LoginDriverController()).loginUsingCredentials( - box.read(BoxName.driverID).toString(), - box.read(BoxName.emailDriver).toString(), - ); + if (responseCheker != 'failure') { + var d = jsonDecode(responseCheker); + if (d['message'][0]['is_verified'].toString() == '1') { + Get.snackbar('Phone number is verified before'.tr, '', + backgroundColor: AppColor.greenColor); + box.write(BoxName.isVerified, '1'); + box.write(BoxName.phone, '+2${phoneController.text}'); + await Get.put(LoginDriverController()).loginUsingCredentials( + box.read(BoxName.driverID).toString(), + box.read(BoxName.emailDriver).toString(), + ); + } else { + await CRUD().post(link: AppLink.sendVerifyOtpMessage, payload: { + 'phone_number': '+2${phoneController.text}', + 'token_code': randomNumber.toString(), + }); + + await smsEgyptController.sendSmsEgypt( + phoneController.text.toString(), randomNumber.toString()); + isSent = true; + + isLoading = false; + update(); + } } else { await CRUD().post(link: AppLink.sendVerifyOtpMessage, payload: { 'phone_number': '+2${phoneController.text}', diff --git a/lib/controller/firebase/firbase_messge.dart b/lib/controller/firebase/firbase_messge.dart index 5dd709c..34e80ee 100644 --- a/lib/controller/firebase/firbase_messge.dart +++ b/lib/controller/firebase/firbase_messge.dart @@ -161,11 +161,11 @@ class FirebaseMessagesController extends GetxController { ); // } // Assuming GetMaterialApp is initialized and context is valid for navigation - Get.to(() => CallPage( - // channelName: driverList[1].toString(), - // token: driverList[0].toString(), - // remoteID: driverList[2].toString(), - )); + // Get.to(() => CallPage( + // // channelName: driverList[1].toString(), + // // token: driverList[0].toString(), + // // remoteID: driverList[2].toString(), + // )); } catch (e) {} } else if (message.notification!.title! == 'Call End'.tr) { try { @@ -179,7 +179,7 @@ class FirebaseMessagesController extends GetxController { ); } // Assuming GetMaterialApp is initialized and context is valid for navigation - Get.off(const CallPage()); + // Get.off(const CallPage()); } catch (e) {} } else if (message.notification!.title! == 'Order Applied'.tr) { Get.snackbar( diff --git a/lib/controller/functions/call_controller.dart b/lib/controller/functions/call_controller.dart index 13d8d12..e310f0e 100644 --- a/lib/controller/functions/call_controller.dart +++ b/lib/controller/functions/call_controller.dart @@ -1,129 +1,129 @@ -import 'package:SEFER/constant/api_key.dart'; -import 'package:SEFER/controller/functions/crud.dart'; -import 'package:agora_rtc_engine/agora_rtc_engine.dart'; -import 'package:get/get.dart'; -import 'package:permission_handler/permission_handler.dart'; +// import 'package:SEFER/constant/api_key.dart'; +// import 'package:SEFER/controller/functions/crud.dart'; +// // import 'package:agora_rtc_engine/agora_rtc_engine.dart'; +// import 'package:get/get.dart'; +// import 'package:permission_handler/permission_handler.dart'; -import '../../constant/box_name.dart'; -import '../firebase/firbase_messge.dart'; -import '../home/captin/map_driver_controller.dart'; -import '../../main.dart'; +// import '../../constant/box_name.dart'; +// import '../firebase/firbase_messge.dart'; +// import '../home/captin/map_driver_controller.dart'; +// import '../../main.dart'; -class CallController extends GetxController { - String channelName = ''; // Get.find().rideId; - String token = ''; - // int uid = int.parse(box.read(BoxName.phoneDriver)); // uid of the local user - int uid = 0; - int? remoteUid; // uid of the remote user - bool _isJoined = false; // Indicates if the local user has joined the channel - String status = ''; - late RtcEngine agoraEngine; // Agora engine instance +// class CallController extends GetxController { +// String channelName = ''; // Get.find().rideId; +// String token = ''; +// // int uid = int.parse(box.read(BoxName.phoneDriver)); // uid of the local user +// int uid = 0; +// int? remoteUid; // uid of the remote user +// bool _isJoined = false; // Indicates if the local user has joined the channel +// String status = ''; +// // late RtcEngine agoraEngine; // Agora engine instance - @override - void onInit() { - super.onInit(); +// @override +// void onInit() { +// super.onInit(); - channelName = Get.find().rideId; // 'sefer300'; // - remoteUid = int.parse(Get.find().passengerPhone); - uid = int.parse(box.read(BoxName.phoneDriver)); +// channelName = Get.find().rideId; // 'sefer300'; // +// remoteUid = int.parse(Get.find().passengerPhone); +// uid = int.parse(box.read(BoxName.phoneDriver)); - initAgoraFull(); - } +// initAgoraFull(); +// } - initAgoraFull() async { - await fetchToken(); - // Set up an instance of Agora engine - setupVoiceSDKEngine(); - // join(); - FirebaseMessagesController().sendNotificationToPassengerTokenCALL( - 'Call Income', - '${'You have call from driver'.tr} ${box.read(BoxName.nameDriver)}', - Get.find().tokenPassenger, - [ - token, - channelName, - uid.toString(), - remoteUid.toString(), - ], - ); - join(); - } +// initAgoraFull() async { +// await fetchToken(); +// // Set up an instance of Agora engine +// setupVoiceSDKEngine(); +// // join(); +// FirebaseMessagesController().sendNotificationToPassengerTokenCALL( +// 'Call Income', +// '${'You have call from driver'.tr} ${box.read(BoxName.nameDriver)}', +// Get.find().tokenPassenger, +// [ +// token, +// channelName, +// uid.toString(), +// remoteUid.toString(), +// ], +// ); +// join(); +// } - @override - void onClose() { - agoraEngine.leaveChannel(); - super.onClose(); - } +// @override +// void onClose() { +// // agoraEngine.leaveChannel(); +// super.onClose(); +// } - Future setupVoiceSDKEngine() async { - // retrieve or request microphone permission - await [Permission.microphone].request(); +// // Future setupVoiceSDKEngine() async { +// // // retrieve or request microphone permission +// // await [Permission.microphone].request(); - //create an instance of the Agora engine - agoraEngine = createAgoraRtcEngine(); - await agoraEngine.initialize(RtcEngineContext(appId: AK.agoraAppId)); - // Register the event handler - agoraEngine.registerEventHandler( - RtcEngineEventHandler( - onJoinChannelSuccess: (RtcConnection connection, int elapsed) { - // Get.snackbar( - // "Local user uid:${connection.localUid} joined the channel", ''); - status = 'joined'.tr; - _isJoined = true; - update(); - }, - onUserJoined: (RtcConnection connection, int remoteUid, int elapsed) { - // Get.snackbar("Remote user uid:$remoteUid joined the channel", ''); - status = '${Get.find().passengerName} ' - 'joined' - .tr; - remoteUid = remoteUid; - update(); - }, - onUserOffline: (RtcConnection connection, int? remoteUid, - UserOfflineReasonType reason) { - // Get.snackbar("Remote user uid:$remoteUid left the channel", ''); - status = 'Call Left'.tr; - remoteUid = null; - update(); - }, - ), - ); - } +// // //create an instance of the Agora engine +// // agoraEngine = createAgoraRtcEngine(); +// // await agoraEngine.initialize(RtcEngineContext(appId: AK.agoraAppId)); +// // // Register the event handler +// // agoraEngine.registerEventHandler( +// // RtcEngineEventHandler( +// // onJoinChannelSuccess: (RtcConnection connection, int elapsed) { +// // // Get.snackbar( +// // // "Local user uid:${connection.localUid} joined the channel", ''); +// // status = 'joined'.tr; +// // _isJoined = true; +// // update(); +// // }, +// // onUserJoined: (RtcConnection connection, int remoteUid, int elapsed) { +// // // Get.snackbar("Remote user uid:$remoteUid joined the channel", ''); +// // status = '${Get.find().passengerName} ' +// // 'joined' +// // .tr; +// // remoteUid = remoteUid; +// // update(); +// // }, +// // onUserOffline: (RtcConnection connection, int? remoteUid, +// // UserOfflineReasonType reason) { +// // // Get.snackbar("Remote user uid:$remoteUid left the channel", ''); +// // status = 'Call Left'.tr; +// // remoteUid = null; +// // update(); +// // }, +// // ), +// // ); +// // } - void join() async { - // Set channel options including the client role and channel profile - ChannelMediaOptions options = const ChannelMediaOptions( - clientRoleType: ClientRoleType.clientRoleBroadcaster, - channelProfile: ChannelProfileType.channelProfileCommunication, - ); +// // void join() async { +// // // Set channel options including the client role and channel profile +// // ChannelMediaOptions options = const ChannelMediaOptions( +// // clientRoleType: ClientRoleType.clientRoleBroadcaster, +// // channelProfile: ChannelProfileType.channelProfileCommunication, +// // ); - await agoraEngine.joinChannel( - token: token, - channelId: channelName, - options: options, - uid: uid, - ); - } +// // await agoraEngine.joinChannel( +// // token: token, +// // channelId: channelName, +// // options: options, +// // uid: uid, +// // ); +// // } - void leave() { - _isJoined = false; - remoteUid = null; - update(); - agoraEngine.leaveChannel(); - } +// // void leave() { +// // _isJoined = false; +// // remoteUid = null; +// // update(); +// // agoraEngine.leaveChannel(); +// // } -// Clean up the resources when you leave - @override - void dispose() async { - await agoraEngine.leaveChannel(); - super.dispose(); - } +// // // Clean up the resources when you leave +// // @override +// // void dispose() async { +// // await agoraEngine.leaveChannel(); +// // super.dispose(); +// // } - fetchToken() async { - var res = await CRUD() - .getAgoraToken(channelName: channelName, uid: uid.toString()); - token = res; - update(); - } -} +// fetchToken() async { +// var res = await CRUD() +// .getAgoraToken(channelName: channelName, uid: uid.toString()); +// token = res; +// update(); +// } +// } diff --git a/lib/controller/functions/gemeni.dart b/lib/controller/functions/gemeni.dart index c959c58..66f7322 100644 --- a/lib/controller/functions/gemeni.dart +++ b/lib/controller/functions/gemeni.dart @@ -388,7 +388,7 @@ class AI extends GetxController { 'displacement': responseIdCardDriverEgyptBack['engine'].toString(), 'fuel': responseIdCardDriverEgyptBack['fuel'].toString(), 'registration_date': - '${responseIdCardDriverEgyptBack['inspection_date']}-01-01', + '${responseIdCardDriverEgyptBack['inspection_date']}', }); isLoading = false; update(); diff --git a/lib/controller/functions/upload_image.dart b/lib/controller/functions/upload_image.dart index 115eb1c..776c62a 100644 --- a/lib/controller/functions/upload_image.dart +++ b/lib/controller/functions/upload_image.dart @@ -113,4 +113,100 @@ class ImageController extends GetxController { 'Failed to upload image: ${res.statusCode} - ${res.body}'); } } + + choosImagePicture(String link, String imageType) async { + final pickedImage = await picker.pickImage( + source: ImageSource.gallery, + // preferredCameraDevice: CameraDevice.rear, + // maxHeight: Get.height * .3, + // maxWidth: Get.width * .9, + // imageQuality: 100, + ); + image = File(pickedImage!.path); + + croppedFile = await ImageCropper().cropImage( + sourcePath: image!.path, + aspectRatioPresets: [ + CropAspectRatioPreset.square, + CropAspectRatioPreset.ratio3x2, + CropAspectRatioPreset.original, + CropAspectRatioPreset.ratio4x3, + CropAspectRatioPreset.ratio16x9 + ], + uiSettings: [ + AndroidUiSettings( + toolbarTitle: 'Cropper'.tr, + toolbarColor: AppColor.blueColor, + toolbarWidgetColor: AppColor.yellowColor, + initAspectRatio: CropAspectRatioPreset.original, + lockAspectRatio: false), + IOSUiSettings( + title: 'Cropper'.tr, + ), + ], + ); + myImage = File(pickedImage.path); + isloading = true; + update(); +// Save the cropped image + File savedCroppedImage = File(croppedFile!.path); + print('link =$link'); + try { + await uploadImage( + savedCroppedImage, + { + 'driverID': + box.read(BoxName.driverID) ?? box.read(BoxName.passengerID), + 'imageType': imageType + }, + link, + ); + } catch (e) { + Get.snackbar('Image Upload Failed'.tr, e.toString(), + backgroundColor: AppColor.redColor); + } finally { + isloading = false; + update(); + } + } + + uploadImagePicture(File file, Map data, String link) async { + var request = http.MultipartRequest( + 'POST', + Uri.parse(link), //'https://ride.mobile-app.store/uploadImage1.php' + ); + + var length = await file.length(); + var stream = http.ByteStream(file.openRead()); + var multipartFile = http.MultipartFile( + 'image', + stream, + length, + filename: basename(file.path), + ); + request.headers.addAll({ + 'Authorization': + 'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials.toString()))}', + }); + // Set the file name to the driverID + request.files.add( + http.MultipartFile( + 'image', + stream, + length, + filename: '${box.read(BoxName.driverID)}.jpg', + ), + ); + data.forEach((key, value) { + request.fields[key] = value; + }); + var myrequest = await request.send(); + var res = await http.Response.fromStream(myrequest); + if (res.statusCode == 200) { + return jsonDecode(res.body); + } else { + throw Exception( + 'Failed to upload image: ${res.statusCode} - ${res.body}'); + } + } } diff --git a/lib/controller/home/payment/captain_wallet_controller.dart b/lib/controller/home/payment/captain_wallet_controller.dart index 88a3223..7a5148d 100644 --- a/lib/controller/home/payment/captain_wallet_controller.dart +++ b/lib/controller/home/payment/captain_wallet_controller.dart @@ -264,10 +264,29 @@ class CaptainWalletController extends GetxController { update(); } + getKazanPercent() async { + var res = await CRUD().get( + link: AppLink.getKazanPercent, + payload: {'country': box.read(BoxName.countryCode).toString()}, + ); + if (res != 'failure') { + var json = jsonDecode(res); + kazan = double.parse(json['message'][0]['kazan']); + // naturePrice = double.parse(json['message'][0]['naturePrice']); + // heavyPrice = double.parse(json['message'][0]['heavyPrice']); + // latePrice = double.parse(json['message'][0]['latePrice']); + // comfortPrice = double.parse(json['message'][0]['comfortPrice']); + // speedPrice = double.parse(json['message'][0]['speedPrice']); + // deliveryPrice = double.parse(json['message'][0]['deliveryPrice']); + // mashwariPrice = double.parse(json['message'][0]['freePrice']); + // fuelPrice = double.parse(json['message'][0]['fuelPrice']); + } + update(); + } + @override void onInit() async { - await Get.find().getKazanPercent(); - kazan = Get.find().kazan; + getKazanPercent(); await refreshCaptainWallet(); super.onInit(); diff --git a/lib/controller/local/translations.dart b/lib/controller/local/translations.dart index 74d3d6f..8d21cc5 100644 --- a/lib/controller/local/translations.dart +++ b/lib/controller/local/translations.dart @@ -4,6 +4,8 @@ class MyTranslation extends Translations { @override Map> get keys => { "ar": { + "you can show video how to setup": + "يمكنك عرض فيديو حول كيفية الإعداد", "don't start trip if not": "لا تبدأ الرحلة إذا لم", "you are not moved yet !": "أنت لم تتحرك بعد!", "Update Available": "تحديث متوفر", @@ -265,7 +267,7 @@ class MyTranslation extends Translations { "Year": "السنة", "Chassis": "الشاسيه", "Color": "اللون", - "Displacement": "الإحلال", + "Displacement": "سعه المحرك", "Fuel": "الوقود", "Tax Expiry Date": "تاريخ انهاء الصلاحية", "Inspection Date": "تاريخ الفحص", diff --git a/lib/views/auth/captin/cards/egypt_card_a_i.dart b/lib/views/auth/captin/cards/egypt_card_a_i.dart index c0a1ce3..4f783ee 100644 --- a/lib/views/auth/captin/cards/egypt_card_a_i.dart +++ b/lib/views/auth/captin/cards/egypt_card_a_i.dart @@ -3,7 +3,8 @@ import 'package:SEFER/controller/functions/tts.dart'; import 'package:SEFER/views/widgets/elevated_btn.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; - +import 'package:url_launcher/url_launcher.dart'; +import 'package:webview_flutter/webview_flutter.dart'; import '../../../../constant/colors.dart'; import '../../../../constant/links.dart'; import '../../../../constant/style.dart'; @@ -71,10 +72,26 @@ class EgyptCardAI extends StatelessWidget { // controller.responseCriminalRecordEgypt // .isNotEmpty ) - ? Get.height * .7 + ? Get.height * .5 : Get.height * .85, child: ListView( children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + decoration: AppStyle.boxDecoration + .copyWith(boxShadow: [ + const BoxShadow( + color: AppColor.blueColor, + blurRadius: 2, + offset: Offset(1, 2)), + const BoxShadow( + color: AppColor.blueColor, + blurRadius: 2, + offset: Offset(-1, -1)) + ]), + child: VideoButton()), + ), egyptDriverLicense(), egyptCarLicenceFront(), egyptCarLicenceBack(), @@ -853,7 +870,7 @@ Important notes: 3. Ensure all numeric values (year, displacement, cylinders) are in Latin numerals. 4. If any information is missing, leave the corresponding field as an empty string. 5. Do not include any explanatory text in the JSON fields, only the extracted values. - +displacement in the line contain (سم٣ ) Please fill in the JSON object with the extracted information, following these guidelines. """, AppLink.uploadEgypt, 'car_back'); }, @@ -1094,3 +1111,24 @@ Please fill in the JSON object with the extracted information, following these g ); } } + +class VideoButton extends StatelessWidget { + final String videoUrl = + "https://www.youtube.com/watch?v=dQw4w9WgXcQ"; // Replace with your video URL + + @override + Widget build(BuildContext context) { + return TextButton( + onPressed: () async { + if (await canLaunchUrl(Uri.parse(videoUrl))) { + await launchUrl(Uri.parse(videoUrl)); + } else { + throw 'Could not launch $videoUrl'; + } + }, + child: Text( + "you can show video how to setup".tr, + ), + ); + } +} diff --git a/lib/views/home/Captin/home_captain/drawer_captain.dart b/lib/views/home/Captin/home_captain/drawer_captain.dart index 54aa73d..907b84f 100644 --- a/lib/views/home/Captin/home_captain/drawer_captain.dart +++ b/lib/views/home/Captin/home_captain/drawer_captain.dart @@ -192,7 +192,8 @@ class UserAccountHeader extends StatelessWidget { top: 0, child: IconButton( onPressed: () { - imageController.choosImage(AppLink.uploadImage1, 'portrait'); + imageController.choosImagePicture( + AppLink.uploadImage1, 'portrait'); }, icon: const Icon(Icons.edit), ), diff --git a/lib/views/home/Captin/home_captain/driver_call_page.dart b/lib/views/home/Captin/home_captain/driver_call_page.dart index 0334aff..be60a92 100644 --- a/lib/views/home/Captin/home_captain/driver_call_page.dart +++ b/lib/views/home/Captin/home_captain/driver_call_page.dart @@ -1,189 +1,189 @@ -import 'dart:async'; -import 'package:SEFER/constant/box_name.dart'; -import 'package:SEFER/main.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:permission_handler/permission_handler.dart'; +// import 'dart:async'; +// import 'package:SEFER/constant/box_name.dart'; +// import 'package:SEFER/main.dart'; +// import 'package:SEFER/views/widgets/my_scafold.dart'; +// import 'package:flutter/material.dart'; +// import 'package:get/get.dart'; +// import 'package:permission_handler/permission_handler.dart'; -import 'package:agora_rtc_engine/agora_rtc_engine.dart'; +// import 'package:agora_rtc_engine/agora_rtc_engine.dart'; -import '../../../../constant/api_key.dart'; -import '../../../../controller/functions/crud.dart'; +// import '../../../../constant/api_key.dart'; +// import '../../../../controller/functions/crud.dart'; -String appId = AK.agoraAppId; +// String appId = AK.agoraAppId; -class DriverCallPage extends StatefulWidget { - const DriverCallPage({super.key}); +// class DriverCallPage extends StatefulWidget { +// const DriverCallPage({super.key}); - @override - State createState() => _DriverCallPageState(); -} +// @override +// State createState() => _DriverCallPageState(); +// } -class _DriverCallPageState extends State { - String channelName = ''; - String token = ''; - // "00612994c6e707543e68d5638894d04f989IAAlydoFEC3ZeZkeUwl0dSswZTX8n+xyZR8PBWdwXFV6t6MLiA8AAAAAEACCHD/gn3TUZQEAAQAAAAAA"; +// class _DriverCallPageState extends State { +// String channelName = ''; +// String token = ''; +// // "00612994c6e707543e68d5638894d04f989IAAlydoFEC3ZeZkeUwl0dSswZTX8n+xyZR8PBWdwXFV6t6MLiA8AAAAAEACCHD/gn3TUZQEAAQAAAAAA"; - // int uid = int.parse(box.read(BoxName.phoneDriver)); // uid of the local user - int uid = 0; - int? _remoteUid; // uid of the remote user - bool _isJoined = false; // Indicates if the local user has joined the channel - late RtcEngine agoraEngine; // Agora engine instance +// // int uid = int.parse(box.read(BoxName.phoneDriver)); // uid of the local user +// int uid = 0; +// int? _remoteUid; // uid of the remote user +// bool _isJoined = false; // Indicates if the local user has joined the channel +// late RtcEngine agoraEngine; // Agora engine instance - final GlobalKey scaffoldMessengerKey = - GlobalKey(); // Global key to access the scaffold +// final GlobalKey scaffoldMessengerKey = +// GlobalKey(); // Global key to access the scaffold - showMessage(String message) { - scaffoldMessengerKey.currentState?.showSnackBar(SnackBar( - content: Text(message), - )); - } +// showMessage(String message) { +// scaffoldMessengerKey.currentState?.showSnackBar(SnackBar( +// content: Text(message), +// )); +// } - initAgora() async { - await fetchToken(); - await setupVoiceSDKEngine(); - } +// initAgora() async { +// await fetchToken(); +// await setupVoiceSDKEngine(); +// } - fetchToken() async { - var res = await CRUD() - .getAgoraToken(channelName: channelName, uid: uid.toString()); - setState(() { - token = res; - }); - } +// fetchToken() async { +// var res = await CRUD() +// .getAgoraToken(channelName: channelName, uid: uid.toString()); +// setState(() { +// token = res; +// }); +// } - @override - void initState() { - super.initState(); - _remoteUid = box.read(BoxName.phone) != null - ? int.parse(box.read(BoxName.phone)) - : int.parse(box.read(BoxName.phoneDriver)); - uid = box.read(BoxName.phoneDriver) != null - ? int.parse(box.read(BoxName.phoneDriver)) - : int.parse(box.read(BoxName.phone)); - // Set up an instance of Agora engine - initAgora(); - } +// @override +// void initState() { +// super.initState(); +// _remoteUid = box.read(BoxName.phone) != null +// ? int.parse(box.read(BoxName.phone)) +// : int.parse(box.read(BoxName.phoneDriver)); +// uid = box.read(BoxName.phoneDriver) != null +// ? int.parse(box.read(BoxName.phoneDriver)) +// : int.parse(box.read(BoxName.phone)); +// // Set up an instance of Agora engine +// initAgora(); +// } - Future setupVoiceSDKEngine() async { - // retrieve or request microphone permission - await [Permission.microphone].request(); +// Future setupVoiceSDKEngine() async { +// // retrieve or request microphone permission +// await [Permission.microphone].request(); - //create an instance of the Agora engine - agoraEngine = createAgoraRtcEngine(); - await agoraEngine.initialize(RtcEngineContext(appId: AK.agoraAppId)); - // Register the event handler - agoraEngine.registerEventHandler( - RtcEngineEventHandler( - onJoinChannelSuccess: (RtcConnection connection, int elapsed) { - showMessage( - "Local user uid:${connection.localUid} joined the channel"); - setState(() { - _isJoined = true; - }); - }, - onUserJoined: (RtcConnection connection, int remoteUid, int elapsed) { - showMessage("Remote user uid:$remoteUid joined the channel"); - setState(() { - _remoteUid = remoteUid; - }); - }, - onUserOffline: (RtcConnection connection, int remoteUid, - UserOfflineReasonType reason) { - showMessage("Remote user uid:$remoteUid left the channel"); - setState(() { - _remoteUid = null; - }); - }, - ), - ); - } +// //create an instance of the Agora engine +// agoraEngine = createAgoraRtcEngine(); +// await agoraEngine.initialize(RtcEngineContext(appId: AK.agoraAppId)); +// // Register the event handler +// agoraEngine.registerEventHandler( +// RtcEngineEventHandler( +// onJoinChannelSuccess: (RtcConnection connection, int elapsed) { +// showMessage( +// "Local user uid:${connection.localUid} joined the channel"); +// setState(() { +// _isJoined = true; +// }); +// }, +// onUserJoined: (RtcConnection connection, int remoteUid, int elapsed) { +// showMessage("Remote user uid:$remoteUid joined the channel"); +// setState(() { +// _remoteUid = remoteUid; +// }); +// }, +// onUserOffline: (RtcConnection connection, int remoteUid, +// UserOfflineReasonType reason) { +// showMessage("Remote user uid:$remoteUid left the channel"); +// setState(() { +// _remoteUid = null; +// }); +// }, +// ), +// ); +// } - void join() async { - // Set channel options including the client role and channel profile - ChannelMediaOptions options = const ChannelMediaOptions( - clientRoleType: ClientRoleType.clientRoleBroadcaster, - channelProfile: ChannelProfileType.channelProfileCommunication, - ); +// void join() async { +// // Set channel options including the client role and channel profile +// ChannelMediaOptions options = const ChannelMediaOptions( +// clientRoleType: ClientRoleType.clientRoleBroadcaster, +// channelProfile: ChannelProfileType.channelProfileCommunication, +// ); - await agoraEngine.joinChannel( - token: token, - channelId: channelName, - options: options, - uid: uid, - ); - } - //https://console.agora.io/invite?sign=5e9e22d06f22caeeada9954c9e908572%253A5ba8aed978a35eab5a5113742502ded2a41478b2a81cb19c71a30776e125b58a +// await agoraEngine.joinChannel( +// token: token, +// channelId: channelName, +// options: options, +// uid: uid, +// ); +// } +// //https://console.agora.io/invite?sign=5e9e22d06f22caeeada9954c9e908572%253A5ba8aed978a35eab5a5113742502ded2a41478b2a81cb19c71a30776e125b58a - void leave() { - setState(() { - _isJoined = false; - _remoteUid = null; - }); - agoraEngine.leaveChannel(); - } +// void leave() { +// setState(() { +// _isJoined = false; +// _remoteUid = null; +// }); +// agoraEngine.leaveChannel(); +// } -// Clean up the resources when you leave - @override - void dispose() async { - await agoraEngine.leaveChannel(); - super.dispose(); - } +// // Clean up the resources when you leave +// @override +// void dispose() async { +// await agoraEngine.leaveChannel(); +// super.dispose(); +// } -// Build UI - @override - Widget build(BuildContext context) { - return MaterialApp( - scaffoldMessengerKey: scaffoldMessengerKey, - home: MyScafolld( - // appBar: AppBar( - // title: const Text('Get started with Voice Calling'), - // ), - title: 'Voice Calling'.tr, - isleading: true, - body: [ - ListView( - padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), - children: [ - // Status text - Container(height: 40, child: Center(child: _status())), - // Button Row - Row( - children: [ - Expanded( - child: ElevatedButton( - child: const Text("Join"), - onPressed: () => {join()}, - ), - ), - const SizedBox(width: 10), - Expanded( - child: ElevatedButton( - child: const Text("Leave"), - onPressed: () => {leave()}, - ), - ), - ], - ), - ], - ), - ]), - ); - } +// // Build UI +// @override +// Widget build(BuildContext context) { +// return MaterialApp( +// scaffoldMessengerKey: scaffoldMessengerKey, +// home: MyScafolld( +// // appBar: AppBar( +// // title: const Text('Get started with Voice Calling'), +// // ), +// title: 'Voice Calling'.tr, +// isleading: true, +// body: [ +// ListView( +// padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), +// children: [ +// // Status text +// Container(height: 40, child: Center(child: _status())), +// // Button Row +// Row( +// children: [ +// Expanded( +// child: ElevatedButton( +// child: const Text("Join"), +// onPressed: () => {join()}, +// ), +// ), +// const SizedBox(width: 10), +// Expanded( +// child: ElevatedButton( +// child: const Text("Leave"), +// onPressed: () => {leave()}, +// ), +// ), +// ], +// ), +// ], +// ), +// ]), +// ); +// } - Widget _status() { - String statusText; +// Widget _status() { +// String statusText; - if (!_isJoined) - statusText = 'Join a channel'; - else if (_remoteUid == null) - statusText = 'Waiting for a remote user to join...'; - else - statusText = 'Connected to remote user, uid:$_remoteUid'; +// if (!_isJoined) +// statusText = 'Join a channel'; +// else if (_remoteUid == null) +// statusText = 'Waiting for a remote user to join...'; +// else +// statusText = 'Connected to remote user, uid:$_remoteUid'; - return Text( - statusText, - ); - } -} +// return Text( +// statusText, +// ); +// } +// } diff --git a/lib/views/home/Captin/home_captain/widget/call_page.dart b/lib/views/home/Captin/home_captain/widget/call_page.dart index 906db0d..91da0f3 100644 --- a/lib/views/home/Captin/home_captain/widget/call_page.dart +++ b/lib/views/home/Captin/home_captain/widget/call_page.dart @@ -1,84 +1,84 @@ -import 'package:SEFER/constant/colors.dart'; -import 'package:SEFER/constant/style.dart'; -import 'package:SEFER/controller/firebase/firbase_messge.dart'; -import 'package:SEFER/controller/home/captin/map_driver_controller.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/controller/home/captin/home_captain_controller.dart'; +// import 'package:SEFER/constant/colors.dart'; +// import 'package:SEFER/constant/style.dart'; +// import 'package:SEFER/controller/firebase/firbase_messge.dart'; +// import 'package:SEFER/controller/home/captin/map_driver_controller.dart'; +// import 'package:SEFER/views/widgets/my_scafold.dart'; +// import 'package:flutter/material.dart'; +// import 'package:get/get.dart'; +// import 'package:SEFER/controller/home/captin/home_captain_controller.dart'; -import '../../../../../controller/functions/call_controller.dart'; +// import '../../../../../controller/functions/call_controller.dart'; -class CallPage extends StatelessWidget { - const CallPage({super.key}); +// class CallPage extends StatelessWidget { +// const CallPage({super.key}); - @override - Widget build(BuildContext context) { - return MyScafolld( - title: 'Call Page'.tr, isleading: true, body: [callPage()]); - } -} +// @override +// Widget build(BuildContext context) { +// return MyScafolld( +// title: 'Call Page'.tr, isleading: true, body: [callPage()]); +// } +// } -GetBuilder callPage() { - CallController callController = Get.put(CallController()); - Get.put(MapDriverController()); - // callController.join(); - return GetBuilder( - builder: (controller) => Positioned( - top: Get.height * .2, - child: Container( - height: 100, width: Get.width, - decoration: AppStyle.boxDecoration, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - GestureDetector( - onTap: () async { - callController.join(); - }, - child: Container( - width: 50, - height: 50, - decoration: const BoxDecoration( - shape: BoxShape.circle, color: AppColor.greenColor), - child: const Icon( - Icons.phone, - size: 35, - color: AppColor.secondaryColor, - )), - ), - Column( - children: [ - Text(callController.status), - Text(Get.find().passengerName.toString()), - ], - ), - GestureDetector( - onTap: () async { - FirebaseMessagesController().sendNotificationToPassengerToken( - 'Call End'.tr, - 'Call End', - Get.find().tokenPassenger, - [], - 'iphone_ringtone.wav'); - callController.leave(); - Get.back(); - }, - child: Container( - width: 50, - height: 50, - decoration: const BoxDecoration( - shape: BoxShape.circle, color: AppColor.redColor), - child: const Icon( - Icons.phone_disabled_sharp, - size: 35, - color: AppColor.secondaryColor, - )), - ) - ], - ), - // ignore: prefer_const_constructors - ), - ), - ); -} +// GetBuilder callPage() { +// CallController callController = Get.put(CallController()); +// Get.put(MapDriverController()); +// // callController.join(); +// return GetBuilder( +// builder: (controller) => Positioned( +// top: Get.height * .2, +// child: Container( +// height: 100, width: Get.width, +// decoration: AppStyle.boxDecoration, +// child: Row( +// mainAxisAlignment: MainAxisAlignment.spaceEvenly, +// children: [ +// GestureDetector( +// onTap: () async { +// callController.join(); +// }, +// child: Container( +// width: 50, +// height: 50, +// decoration: const BoxDecoration( +// shape: BoxShape.circle, color: AppColor.greenColor), +// child: const Icon( +// Icons.phone, +// size: 35, +// color: AppColor.secondaryColor, +// )), +// ), +// Column( +// children: [ +// Text(callController.status), +// Text(Get.find().passengerName.toString()), +// ], +// ), +// GestureDetector( +// onTap: () async { +// FirebaseMessagesController().sendNotificationToPassengerToken( +// 'Call End'.tr, +// 'Call End', +// Get.find().tokenPassenger, +// [], +// 'iphone_ringtone.wav'); +// callController.leave(); +// Get.back(); +// }, +// child: Container( +// width: 50, +// height: 50, +// decoration: const BoxDecoration( +// shape: BoxShape.circle, color: AppColor.redColor), +// child: const Icon( +// Icons.phone_disabled_sharp, +// size: 35, +// color: AppColor.secondaryColor, +// )), +// ) +// ], +// ), +// // ignore: prefer_const_constructors +// ), +// ), +// ); +// } diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index ad6a21e..51d85d2 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,7 +5,6 @@ import FlutterMacOS import Foundation -import agora_rtc_engine import audio_session import device_info_plus import file_selector_macos @@ -17,7 +16,6 @@ import flutter_secure_storage_macos import flutter_tts import geolocator_apple import google_sign_in_ios -import iris_method_channel import just_audio import location import package_info_plus @@ -30,7 +28,6 @@ import video_player_avfoundation import wakelock_plus func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { - AgoraRtcNgPlugin.register(with: registry.registrar(forPlugin: "AgoraRtcNgPlugin")) AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin")) DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) @@ -42,7 +39,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { FlutterTtsPlugin.register(with: registry.registrar(forPlugin: "FlutterTtsPlugin")) GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin")) FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin")) - IrisMethodChannelPlugin.register(with: registry.registrar(forPlugin: "IrisMethodChannelPlugin")) JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin")) LocationPlugin.register(with: registry.registrar(forPlugin: "LocationPlugin")) FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) diff --git a/pubspec.lock b/pubspec.lock index 2bcbd59..bedee8a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -17,14 +17,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.34" - agora_rtc_engine: - dependency: "direct main" - description: - name: agora_rtc_engine - sha256: ec84db08cd6727e3e480abe9089df4a9522aa4315f688ac2abf25a82f26c4055 - url: "https://pub.dev" - source: hosted - version: "6.3.0" analyzer: dependency: transitive description: @@ -1160,14 +1152,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.4" - iris_method_channel: - dependency: transitive - description: - name: iris_method_channel - sha256: "78caede20be4a1dd258262fb13704aab2f16fd05ef414bed06e7b1e3b95b3413" - url: "https://pub.dev" - source: hosted - version: "2.0.1" js: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 8210a90..88e9f5a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -48,7 +48,7 @@ dependencies: # cached_network_image: ^3.3.0 #to be remove calendar_builder: ^0.0.6 fl_chart: ^0.66.0 - agora_rtc_engine: ^6.2.6 + # agora_rtc_engine: ^6.2.6 flutter_tts: ^3.8.5 permission_handler: ^11.3.0 # google_generative_ai: ^0.0.1-dev @@ -74,22 +74,22 @@ dev_dependencies: build_runner: flutter_launcher_icons: - android: "launcher_icon" - ios: true - image_path: "assets/images/logo.png" - min_sdk_android: 21 - web: - generate: true - image_path: "assets/images/logo.png" - background_color: "#hexcode" - theme_color: "#hexcode" - windows: - generate: true - image_path: "assets/images/logo.png" - icon_size: 48 - macos: - generate: true - image_path: "assets/images/logo.png" + android: "launcher_icon" + ios: true + image_path: "assets/images/logo.png" + min_sdk_android: 21 + web: + generate: true + image_path: "assets/images/logo.png" + background_color: "#hexcode" + theme_color: "#hexcode" + windows: + generate: true + image_path: "assets/images/logo.png" + icon_size: 48 + macos: + generate: true + image_path: "assets/images/logo.png" flutter: uses-material-design: true diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 77a5f42..afbf346 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,22 +6,18 @@ #include "generated_plugin_registrant.h" -#include #include #include #include #include #include #include -#include #include #include #include #include void RegisterPlugins(flutter::PluginRegistry* registry) { - AgoraRtcEnginePluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("AgoraRtcEnginePlugin")); FileSelectorWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("FileSelectorWindows")); FirebaseAuthPluginCApiRegisterWithRegistrar( @@ -34,8 +30,6 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("FlutterTtsPlugin")); GeolocatorWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("GeolocatorWindows")); - IrisMethodChannelPluginCApiRegisterWithRegistrar( - registry->GetRegistrarForPlugin("IrisMethodChannelPluginCApi")); LocalAuthPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("LocalAuthPlugin")); PermissionHandlerWindowsPluginRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 71a0a7a..7957800 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,14 +3,12 @@ # list(APPEND FLUTTER_PLUGIN_LIST - agora_rtc_engine file_selector_windows firebase_auth firebase_core flutter_secure_storage_windows flutter_tts geolocator_windows - iris_method_channel local_auth_windows permission_handler_windows record_windows