diff --git a/android/app/build.gradle b/android/app/build.gradle index 9f9edef..c2b3ad4 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -54,8 +54,8 @@ android { // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. minSdk = 23 targetSdk = flutter.targetSdkVersion - versionCode = 85 - versionName = '1.5.85' + versionCode = 88 + versionName = '1.5.88`' multiDexEnabled =true } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 52fbb87..60bcc4c 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -20,14 +20,12 @@ - - + - =3.3.0 <4.0.0" flutter: ">=3.18.0-18.0.pre.54" diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index 265f9be..3966f9f 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -4,7 +4,7 @@ import FirebaseCore import GoogleMaps // import Constants -@UIApplicationMain +@main @objc class AppDelegate: FlutterAppDelegate { override func application( diff --git a/lib/constant/box_name.dart b/lib/constant/box_name.dart index e604d39..9dbb404 100644 --- a/lib/constant/box_name.dart +++ b/lib/constant/box_name.dart @@ -9,6 +9,7 @@ class BoxName { static const String myList = "myList"; static const String bodyOrder = "bodyOrder"; static const String gender = "gender"; + static const String phoneWallet = "phoneWallet"; static const String IsSavedPhones = "IsSavedPhones"; static const String carType = "carType"; static const String isFirstTime = "isFirstTime"; diff --git a/lib/constant/links.dart b/lib/constant/links.dart index cec2d81..e2d73a5 100644 --- a/lib/constant/links.dart +++ b/lib/constant/links.dart @@ -8,7 +8,8 @@ class AppLink { static final String seferPaymentServer = '${Env.seferPaymentServer}/ride'; static final String seferAlexandriaServer = Env.seferAlexandriaServer; static final String seferCairoServer = Env.seferCairoServer; - static final String seferGizaServer = Env.seferGizaServer; + static const String seferGizaServer = 'https://gizasefer.online/sefer'; + // static final String seferGizaServer = Env.seferGizaServer; static final String endPoint = box.read(BoxName.serverChosen) ?? Env.seferCairoServer; diff --git a/lib/controller/auth/captin/register_captin_controller.dart b/lib/controller/auth/captin/register_captin_controller.dart index 2e443f6..95ea1eb 100644 --- a/lib/controller/auth/captin/register_captin_controller.dart +++ b/lib/controller/auth/captin/register_captin_controller.dart @@ -96,7 +96,8 @@ class RegisterCaptainController extends GetxController { sendOtpMessage() async { SmsEgyptController smsEgyptController = Get.put(SmsEgyptController()); - + isLoading = true; + update(); int randomNumber = Random().nextInt(100000) + 1; isLoading = true; update(); @@ -156,6 +157,8 @@ class RegisterCaptainController extends GetxController { } } } + isLoading = false; + update(); } verifySMSCode() async { diff --git a/lib/controller/firebase/firbase_messge.dart b/lib/controller/firebase/firbase_messge.dart index 0fcec45..658eebb 100644 --- a/lib/controller/firebase/firbase_messge.dart +++ b/lib/controller/firebase/firbase_messge.dart @@ -134,10 +134,10 @@ class FirebaseMessagesController extends GetxController { 'body': message.notification!.body }); } else if (message.notification!.title == 'Cancel Trip') { - // if (Platform.isAndroid) { - // NotificationController().showNotification( - // 'Cancel Trip'.tr, 'Passenger Cancel Trip'.tr, 'cancel', ''); - // } + if (Platform.isAndroid) { + NotificationController().showNotification( + 'Cancel Trip'.tr, 'Passenger Cancel Trip'.tr, 'cancel', ''); + } cancelTripDialog(); } else if (message.notification!.title == 'VIP Order') { var myListString = message.data['DriverList']; @@ -166,7 +166,7 @@ class FirebaseMessagesController extends GetxController { } else if (message.notification!.title! == 'message From passenger') { if (Platform.isAndroid) { NotificationController() - .showNotification('message From passenger', ''.tr, 'tone2', ''); + .showNotification('message From passenger'.tr, ''.tr, 'tone2', ''); } passengerDialog(message.notification!.body!); @@ -448,7 +448,7 @@ class FirebaseMessagesController extends GetxController { // )); // } - void sendNotificationAll(String title, body) async { + void sendNotificationAll(String title, body, tone) async { // Get the token you want to subtract. String token = box.read(BoxName.tokenFCM); tokens = box.read(BoxName.tokens); @@ -483,26 +483,41 @@ class FirebaseMessagesController extends GetxController { // Send the notification final response = await http .post( - Uri.parse( - 'https://fcm.googleapis.com/v1/projects/ride-b1bd8/messages:send'), - headers: { - 'Content-Type': 'application/json', - 'Authorization': 'Bearer $accessToken', - }, - body: jsonEncode({ - 'notification': { + Uri.parse( + 'https://fcm.googleapis.com/v1/projects/ride-b1bd8/messages:send'), + headers: { + 'Content-Type': 'application/json', + 'Authorization': 'Bearer $accessToken', + }, + body: jsonEncode({ + 'message': { + 'token': token, + 'notification': { 'title': title, 'body': body, - 'sound': 'ding.wav' }, - 'priority': 'high', - 'data': { - 'click_action': 'FLUTTER_NOTIFICATION_CLICK', - 'id': '1', - 'status': 'done' + // 'data': { + // 'DriverList': jsonEncode(data), + // }, + 'android': { + 'priority': 'high', // Set priority to high + 'notification': { + 'sound': tone, + }, }, - 'to': tokens[i], - })) + 'apns': { + 'headers': { + 'apns-priority': '10', // Set APNs priority to 10 + }, + 'payload': { + 'aps': { + 'sound': tone, + }, + }, + }, + }, + }), + ) .whenComplete(() {}) .catchError((e) {}); } @@ -568,16 +583,32 @@ class FirebaseMessagesController extends GetxController { 'Authorization': 'Bearer $accessToken', }, body: jsonEncode({ - 'notification': { - 'title': title, - 'body': body, - 'sound': tone + 'message': { + 'token': token, + 'notification': { + 'title': title, + 'body': body, + }, + 'data': { + 'passengerList': map, + }, + 'android': { + 'priority': 'high', // Set priority to high + 'notification': { + 'sound': tone, + }, + }, + 'apns': { + 'headers': { + 'apns-priority': '10', // Set APNs priority to 10 + }, + 'payload': { + 'aps': { + 'sound': tone, + }, + }, + }, }, - 'data': { - 'passengerList': map, - }, - 'priority': 'high', - 'to': token, }), ); @@ -593,7 +624,7 @@ class FirebaseMessagesController extends GetxController { } void sendNotificationToPassengerTokenCALL( - String title, body, token, List map) async { + String title, body, token, List map, String tone) async { try { String serviceAccountKeyJson = '''{ "type": "service_account", @@ -635,14 +666,18 @@ class FirebaseMessagesController extends GetxController { 'passengerList': jsonEncode(map), }, 'android': { + 'priority': 'high', // Set priority to high 'notification': { - 'sound': 'iphone_ringtone.wav', + 'sound': tone, }, }, 'apns': { + 'headers': { + 'apns-priority': '10', // Set APNs priority to 10 + }, 'payload': { 'aps': { - 'sound': 'iphone_ringtone.wav', + 'sound': tone, }, }, }, @@ -707,11 +742,15 @@ class FirebaseMessagesController extends GetxController { 'DriverList': jsonEncode([]), }, 'android': { + 'priority': 'high', // Set priority to high 'notification': { 'sound': tone, }, }, 'apns': { + 'headers': { + 'apns-priority': '10', // Set APNs priority to 10 + }, 'payload': { 'aps': { 'sound': tone, @@ -779,11 +818,15 @@ class FirebaseMessagesController extends GetxController { 'DriverList': jsonEncode(data), }, 'android': { + 'priority': 'high', // Set priority to high 'notification': { 'sound': tone, }, }, 'apns': { + 'headers': { + 'apns-priority': '10', // Set APNs priority to 10 + }, 'payload': { 'aps': { 'sound': tone, @@ -809,7 +852,7 @@ class FirebaseMessagesController extends GetxController { } void sendNotificationToDriverMapPolyline(String title, String body, - String token, List data, String polylineJson) async { + String token, List data, String polylineJson, String tone) async { try { String serviceAccountKeyJson = '''{ "type": "service_account", @@ -841,18 +884,32 @@ class FirebaseMessagesController extends GetxController { 'Authorization': 'Bearer $accessToken', }, body: jsonEncode({ - 'notification': { - 'title': title, - 'body': body, - // 'sound': 'tone2.wav', - 'sound': 'order.wav' + 'message': { + 'token': token, + 'notification': { + 'title': title, + 'body': body, + }, + 'data': { + 'DriverList': jsonEncode(data), + }, + 'android': { + 'priority': 'high', // Set priority to high + 'notification': { + 'sound': tone, + }, + }, + 'apns': { + 'headers': { + 'apns-priority': '10', // Set APNs priority to 10 + }, + 'payload': { + 'aps': { + 'sound': tone, + }, + }, + }, }, - 'data': { - 'DriverList': data, - 'PolylineJson': polylineJson, - }, - 'priority': 'high', - 'to': token, }), ); diff --git a/lib/controller/firebase/local_notification.dart b/lib/controller/firebase/local_notification.dart index 4efe567..1995e43 100644 --- a/lib/controller/firebase/local_notification.dart +++ b/lib/controller/firebase/local_notification.dart @@ -14,11 +14,10 @@ import '../home/captin/home_captain_controller.dart'; class NotificationController extends GetxController { final FlutterLocalNotificationsPlugin _flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); - // Initializes the local notifications plugin Future initNotifications() async { const AndroidInitializationSettings android = - AndroidInitializationSettings('app_icon'); + AndroidInitializationSettings('@mipmap/launcher_icon'); const InitializationSettings initializationSettings = InitializationSettings(android: android); @@ -175,3 +174,67 @@ class NotificationController extends GetxController { // display a dialog with the notification details, tap ok to go to another page } } +// import 'package:flutter_local_notifications/flutter_local_notifications.dart'; +// import 'package:get/get.dart'; +// import 'package:timezone/data/latest.dart' as tz; +// import 'package:timezone/timezone.dart' as tz; + +// class NotificationController extends GetxController { +// final FlutterLocalNotificationsPlugin _flutterLocalNotificationsPlugin = +// FlutterLocalNotificationsPlugin(); + +// @override +// void onInit() { +// super.onInit(); +// initNotifications(); +// tz.initializeTimeZones(); +// } + +// // Initializes the local notifications plugin +// Future initNotifications() async { +// const AndroidInitializationSettings android = +// AndroidInitializationSettings('@mipmap/launcher_icon'); +// const InitializationSettings initializationSettings = +// InitializationSettings(android: android); +// await _flutterLocalNotificationsPlugin.initialize(initializationSettings); +// } + +// // Displays a notification with the given title and message +// void showNotification( +// String title, String message, String tone, String payLoad) async { +// AndroidNotificationDetails android = AndroidNotificationDetails( +// 'your channel id', 'your channel name', +// importance: Importance.max, +// priority: Priority.high, +// showWhen: false, +// sound: RawResourceAndroidNotificationSound(tone)); + +// NotificationDetails details = NotificationDetails(android: android); +// await _flutterLocalNotificationsPlugin.show(0, title, message, details); +// } + +// // Schedules a notification for a specific time +// Future scheduleNotification( +// String title, String body, DateTime scheduledTime) async { +// await _flutterLocalNotificationsPlugin.zonedSchedule( +// 0, +// title, +// body, +// tz.TZDateTime.from(scheduledTime, tz.local), +// const NotificationDetails( +// android: AndroidNotificationDetails( +// 'your_channel_id', +// 'your_channel_name', +// channelDescription: 'your_channel_description', +// importance: Importance.max, +// priority: Priority.high, +// showWhen: false, +// ), +// ), +// androidAllowWhileIdle: true, +// uiLocalNotificationDateInterpretation: +// UILocalNotificationDateInterpretation.absoluteTime, +// matchDateTimeComponents: DateTimeComponents.time, +// ); +// } +// } diff --git a/lib/controller/functions/overlay_permisssion.dart b/lib/controller/functions/overlay_permisssion.dart index 86d70c2..032d89d 100644 --- a/lib/controller/functions/overlay_permisssion.dart +++ b/lib/controller/functions/overlay_permisssion.dart @@ -5,6 +5,10 @@ import 'package:flutter_overlay_window/flutter_overlay_window.dart'; import 'package:get/get.dart'; import 'package:permission_handler/permission_handler.dart'; +import '../../constant/box_name.dart'; +import '../../main.dart'; +import '../auth/captin/login_captin_controller.dart'; + Future getPermissionOverlay() async { if (Platform.isAndroid) { final bool status = await FlutterOverlayWindow.isPermissionGranted(); @@ -23,17 +27,22 @@ Future getPermissionOverlay() async { } Future getPermissionLocation() async { - final PermissionStatus status = await Permission.location.request(); - if (status.isDenied) { - MyDialog().getDialog( - 'Enable Location Permission'.tr, // {en:ar} - 'Allowing location access will help us display orders near you. Please enable it now.' - .tr, // {en:ar} - () async { - Get.back(); - await FlutterOverlayWindow.requestPermission(); - }, - ); + final PermissionStatus status = await Permission.location.status; + if (!status.isGranted) { + // Log.print('status.isGranted: ${status.isGranted}'); + box.write(BoxName.locationPermission, 'true'); + await Permission.location.request(); + Get.find().update(); + // MyDialog().getDialog( + // 'Enable Location Permission'.tr, // {en:ar} + // 'Allowing location access will help us display orders near you. Please enable it now.' + // .tr, // {en:ar} + // () async { + // Get.back(); + // box.write(BoxName.locationPermission, 'true'); + // await Permission.location.request(); + // }, + // ); } } diff --git a/lib/controller/home/captin/map_driver_controller.dart b/lib/controller/home/captin/map_driver_controller.dart index 94ab59a..1c2d624 100644 --- a/lib/controller/home/captin/map_driver_controller.dart +++ b/lib/controller/home/captin/map_driver_controller.dart @@ -521,6 +521,7 @@ class MapDriverController extends GetxController { Get.back(); if (distanceToDestination < 150) { // todo add scam from start point and dont move + // finishRideFromDriver1(); } MyDialog().getDialog('you are not moved yet !'.tr, '', () { Get.back(); diff --git a/lib/controller/payment/payment_controller.dart b/lib/controller/payment/payment_controller.dart index 5e66cbe..9f95cec 100644 --- a/lib/controller/payment/payment_controller.dart +++ b/lib/controller/payment/payment_controller.dart @@ -32,6 +32,7 @@ class PaymentController extends GetxController { // double.parse(Get.find().totalPricePassenger); int? selectedAmount = 0; List totalPassengerWalletDetails = []; + final walletphoneController = TextEditingController(); String passengerTotalWalletAmount = ''; String ip = '1'; DateTime now = DateTime.now(); diff --git a/lib/controller/payment/paymob/paymob_wallet.dart b/lib/controller/payment/paymob/paymob_wallet.dart index a18646c..5c9b86c 100644 --- a/lib/controller/payment/paymob/paymob_wallet.dart +++ b/lib/controller/payment/paymob/paymob_wallet.dart @@ -144,7 +144,7 @@ class PaymobPaymentWallet { }) async { final Map data = { "source": { - "identifier": box.read(BoxName.phoneDriver).toString(), + "identifier": box.read(BoxName.phoneWallet).toString(), "subtype": "WALLET", }, "payment_token": paymentToken, diff --git a/lib/main.dart b/lib/main.dart index ebdf5d0..f52411e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -108,15 +108,18 @@ void main() async { await WakelockPlus.enable(); // Request location permission - PermissionStatus status = await Permission.location.request(); - if (status.isDenied) { - WidgetsBinding.instance.addPostFrameCallback((_) { - getPermissionLocation(); - }); - return; + // PermissionStatus status = await Permission.location.request(); + // if (status.isDenied) { + // WidgetsBinding.instance.addPostFrameCallback((_) { + // getPermissionLocation(); + // }); + // return; + // } + PermissionStatus status1 = await Permission.location.status; + if (status1.isGranted) { + await LocationController().startLocationUpdates(); } - await LocationController().startLocationUpdates(); await GetStorage.init(); Stripe.publishableKey = AK.publishableKeyStripe; diff --git a/lib/views/auth/captin/cards/sms_signup.dart b/lib/views/auth/captin/cards/sms_signup.dart index 986841b..0fe84f2 100644 --- a/lib/views/auth/captin/cards/sms_signup.dart +++ b/lib/views/auth/captin/cards/sms_signup.dart @@ -3,6 +3,7 @@ import 'package:SEFER/controller/auth/captin/register_captin_controller.dart'; import 'package:SEFER/views/widgets/elevated_btn.dart'; import 'package:SEFER/views/widgets/my_scafold.dart'; import 'package:SEFER/views/widgets/my_textField.dart'; +import 'package:SEFER/views/widgets/mycircular.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -88,14 +89,16 @@ class SmsSignupEgypt extends StatelessWidget { ) : const SizedBox()), // Submit button - MyElevatedButton( - onPressed: () async { - !registerCaptainController.isSent - ? await registerCaptainController.sendOtpMessage() - : await registerCaptainController.verifySMSCode(); - }, - title: 'Submit'.tr, - ), + registerCaptainController.isLoading + ? const MyCircularProgressIndicator() + : MyElevatedButton( + onPressed: () async { + !registerCaptainController.isSent + ? await registerCaptainController.sendOtpMessage() + : await registerCaptainController.verifySMSCode(); + }, + title: 'Submit'.tr, + ), ], ); }), diff --git a/lib/views/auth/captin/login_captin.dart b/lib/views/auth/captin/login_captin.dart index d05d7fd..d57fe1f 100644 --- a/lib/views/auth/captin/login_captin.dart +++ b/lib/views/auth/captin/login_captin.dart @@ -5,6 +5,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; import 'package:get/get.dart'; +import 'package:permission_handler/permission_handler.dart'; import '../../../constant/box_name.dart'; import '../../../constant/colors.dart'; @@ -13,6 +14,7 @@ import '../../../constant/style.dart'; import '../../../controller/auth/apple_sigin.dart'; import '../../../controller/auth/captin/login_captin_controller.dart'; import '../../../controller/auth/google_sign.dart'; +import '../../../controller/functions/overlay_permisssion.dart'; import '../../../main.dart'; import '../../widgets/elevated_btn.dart'; import '../../widgets/my_scafold.dart'; @@ -410,6 +412,14 @@ class LoginCaptin extends StatelessWidget { title: "Allow Location Access".tr, onPressed: () async { // await Get.put(LocationBackgroundController()); ////// + PermissionStatus status = + await Permission.location.status; + if (!status.isGranted) { + // WidgetsBinding.instance.addPostFrameCallback((_) { + getPermissionLocation(); + // }); + return; + } box.write(BoxName.locationPermission, 'true'); controller.update(); }, diff --git a/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart b/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart index 54c4a68..8821893 100644 --- a/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart +++ b/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart @@ -1,6 +1,7 @@ import 'package:SEFER/constant/box_name.dart'; import 'package:SEFER/main.dart'; import 'package:SEFER/views/auth/captin/cards/egypt_card_a_i.dart'; +import 'package:SEFER/views/auth/captin/cards/sms_signup.dart'; import 'package:flutter/material.dart'; import 'package:flutter_font_icons/flutter_font_icons.dart'; import 'package:bubble_head/bubble.dart'; @@ -177,7 +178,7 @@ GetBuilder leftMainMenuCaptainIcons() { // onPressed: () async { // // Get.to(() => EgyptCardAI()); // // print(box.read(BoxName.myList)); - // + // List d = [ // "30.003028,31.2419628", // "30.0955661,31.2665336", @@ -214,54 +215,36 @@ GetBuilder leftMainMenuCaptainIcons() { // "8", // "5.00" // ]; - // - // try { - // print('Before showing overlay: ${box.read('some_key')}'); - // - // // Ensure any existing overlay is closed before showing a new one - // - // bool isOverlayActive = - // await FlutterOverlayWindow.isActive(); - // if (isOverlayActive) { - // await FlutterOverlayWindow.closeOverlay(); - // } - // await FlutterOverlayWindow.showOverlay( - // enableDrag: true, - // overlayTitle: d[0], - // overlayContent: d[1], - // flag: OverlayFlag.focusPointer, - // visibility: NotificationVisibility.visibilityPublic, - // positionGravity: PositionGravity.auto, - // height: 700, - // width: WindowSize.matchParent, - // startPosition: const OverlayPosition(0, -170), - // ); - // - // await FlutterOverlayWindow.shareData(d); - // - // print('After showing overlay: ${box.read('some_key')}'); - // } catch (e) { + // FirebaseMessagesController().sendNotificationToDriverMAP( + // 'Order'.tr, + // 'from: ', + // // jsonDecode(value)['message'].toString(), + // // 'd3JaCCFAQeu8QTxRnlC1sB:APA91bFuRjbVK32obIFYXFTI4iwsZEPrrgwvPouob2bXivID-W4aXz51J_OIJ2nHpNU2ocOvGLD1Ip65rLViAFx5qHVE-c8FabBwBi5fSQ-lDTQfe36xxKsc9DU-sTyj_FoYrrMnLNVi', + // 'dN7B10MgQKOR13R5wnBqTN:APA91bHAlcfrOhxXdMYB8akJeeJzQ4lxfx7UhOpP0dcjGtRdKXSD9x6jiEoz6ULnQK5Hc030_VRUAV6Q8qGj-RmlbLAm4wppc4gv_Ri4oEbHHwONP5c41-341YkVqsFYTCRaHz7VpUoj', + // d, + // 'order.wav'); + // try {} catch (e) { // print('Error showing overlay: $e'); // } - // final Bubble _bubble = Bubble(showCloseButton: true); - // try { - // await _bubble.startBubbleHead(sendAppToBackground: false); - // } on PlatformException { - // print('Failed to call startBubbleHead'); - // } + // // final Bubble _bubble = Bubble(showCloseButton: true); + // // try { + // // await _bubble.startBubbleHead(sendAppToBackground: false); + // // } on PlatformException { + // // print('Failed to call startBubbleHead'); + // // } - // Bubble().startBubbleHead(sendAppToBackground: true); - // } + // // Bubble().startBubbleHead(sendAppToBackground: true); + // // } - // Future stopBubbleHead() async { - // try { - // await _bubble.stopBubbleHead(); - // } on PlatformException { - // print('Failed to call stopBubbleHead'); - // } - // } - // - // // // send data to ovelay + // // Future stopBubbleHead() async { + // // try { + // // await _bubble.stopBubbleHead(); + // // } on PlatformException { + // // print('Failed to call stopBubbleHead'); + // // } + // // } + // // + // // // // send data to ovelay // }, // icon: const Icon( // FontAwesome5.grin_tears, @@ -271,35 +254,36 @@ GetBuilder leftMainMenuCaptainIcons() { // ); // }), // ), - AnimatedContainer( - duration: const Duration(microseconds: 200), - width: controller.widthMapTypeAndTraffic, - decoration: BoxDecoration( - color: AppColor.secondaryColor, - border: Border.all(color: AppColor.blueColor), - borderRadius: BorderRadius.circular(15)), - child: Builder(builder: (context) { - return IconButton( - onPressed: () async { - // FirebaseMessagesController().sendNotificationToAnyWithoutData( - // 'Order'.tr, - // 'from: ', - // // jsonDecode(value)['message'].toString(), - // 'dEugS-JOT4Ka5riF4s5TEN:APA91bEDL_W7BuEQGbyL-RMaKiMWDlURXhFuaybe5WurTUV8K5eIooSGe22yY22_U2hEZcfPr46ig1v--l00dbOGiivazxvmTyhUyQQW6lJsuIN-wordGtBxtREyeYtEKvxIa1J4ApEu', - // 'order.wav' + // // AnimatedContainer( + // duration: const Duration(microseconds: 200), + // width: controller.widthMapTypeAndTraffic, + // decoration: BoxDecoration( + // color: AppColor.secondaryColor, + // border: Border.all(color: AppColor.blueColor), + // borderRadius: BorderRadius.circular(15)), + // child: Builder(builder: (context) { + // return IconButton( + // onPressed: () async { + // // FirebaseMessagesController().sendNotificationToAnyWithoutData( + // // 'Order'.tr, + // // 'from: ', + // // // jsonDecode(value)['message'].toString(), + // // 'dEugS-JOT4Ka5riF4s5TEN:APA91bEDL_W7BuEQGbyL-RMaKiMWDlURXhFuaybe5WurTUV8K5eIooSGe22yY22_U2hEZcfPr46ig1v--l00dbOGiivazxvmTyhUyQQW6lJsuIN-wordGtBxtREyeYtEKvxIa1J4ApEu', + // // 'order.wav' - // // polylineCoordinates.toString() - // ); - print(AppLink.addDriverPaymentPoints); - }, - icon: const Icon( - FontAwesome5.closed_captioning, - size: 29, - color: AppColor.blueColor, - ), - ); - }), - ), + // // // polylineCoordinates.toString() + // // ); + // Get.to(SmsSignupEgypt()); + // // print(AppLink.addDriverPaymentPoints); + // }, + // icon: const Icon( + // FontAwesome5.closed_captioning, + // size: 29, + // color: AppColor.blueColor, + // ), + // ); + // }), + // ), ], )), ); diff --git a/lib/views/home/my_wallet/points_captain.dart b/lib/views/home/my_wallet/points_captain.dart index 5ed8b70..93872bd 100644 --- a/lib/views/home/my_wallet/points_captain.dart +++ b/lib/views/home/my_wallet/points_captain.dart @@ -8,6 +8,7 @@ import 'package:SEFER/controller/payment/payment_controller.dart'; import '../../../constant/box_name.dart'; import '../../../main.dart'; import '../../widgets/elevated_btn.dart'; +import '../../widgets/my_textField.dart'; class PointsCaptain extends StatelessWidget { PaymentController paymentController = Get.put(PaymentController()); @@ -65,21 +66,48 @@ class PointsCaptain extends StatelessWidget { title: 'Pay with Wallet'.tr, onPressed: () async { Get.back(); - await paymentController.payWithPayMobWallet( - context, - pricePoint.toStringAsFixed(2), - box.read(BoxName.countryCode) == 'Egypt' - ? 'EGP' - : 'JOD', () async { - await captainWalletController.addDriverPaymentPoints( - 'visa-in', pricePoint); - await captainWalletController.addDriverWallet( - 'visa-in', countPoint); - await captainWalletController.addSeferWallet( - 'visa-in', pricePoint.toString()); - await captainWalletController - .getCaptainWalletFromBuyPoints(); - }); + Get.defaultDialog( + barrierDismissible: false, + title: 'Insert Wallet phone number'.tr, + content: Form( + key: paymentController.formKey, + child: MyTextForm( + controller: + paymentController.walletphoneController, + label: 'Insert Wallet phone number'.tr, + hint: 'Insert Wallet phone number'.tr, + type: TextInputType.phone)), + confirm: MyElevatedButton( + title: 'OK'.tr, + onPressed: () async { + Get.back(); + if (paymentController.formKey.currentState! + .validate()) { + box.write( + BoxName.phoneWallet, + paymentController + .walletphoneController.text); + await paymentController.payWithPayMobWallet( + context, + pricePoint.toStringAsFixed(2), + box.read(BoxName.countryCode) == 'Egypt' + ? 'EGP' + : 'JOD', () async { + await captainWalletController + .addDriverPaymentPoints( + 'visa-in', pricePoint); + await captainWalletController + .addDriverWallet( + 'visa-in', countPoint); + await captainWalletController + .addSeferWallet( + 'visa-in', pricePoint.toString()); + await captainWalletController + .getCaptainWalletFromBuyPoints(); + }); + } + Get.back(); + })); }, ), ], diff --git a/lib/views/notification/notification_captain.dart b/lib/views/notification/notification_captain.dart index cd4c6b9..b2aa8e4 100644 --- a/lib/views/notification/notification_captain.dart +++ b/lib/views/notification/notification_captain.dart @@ -37,19 +37,22 @@ class NotificationCaptain extends StatelessWidget { onTap: () { Get.defaultDialog( title: res['title'], - titleStyle: AppStyle.title, + titleStyle: AppStyle.title.copyWith( + fontWeight: FontWeight.bold), content: SizedBox( width: Get.width * .8, height: Get.height * .4, child: Text( res['body'], - style: AppStyle.title, + style: AppStyle.subtitle, ), ), confirm: MyElevatedButton( title: 'Ok', onPressed: () { //todo sql readen + notificationCaptainController + .updateNotification(res['id']); })); }, leading: diff --git a/pubspec.yaml b/pubspec.yaml index 94d1545..1568574 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -92,9 +92,10 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter + flutter_lints: ^4.0.0 envied_generator: ^0.5.2 - build_runner: + build_runner: ^2.4.6 flutter_launcher_icons: android: "launcher_icon"