This commit is contained in:
Hamza-Ayed
2024-09-19 06:55:42 +03:00
parent 85ece97855
commit b09e0da403
22 changed files with 352 additions and 186 deletions

View File

@@ -54,8 +54,8 @@ android {
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdk = 23 minSdk = 23
targetSdk = flutter.targetSdkVersion targetSdk = flutter.targetSdkVersion
versionCode = 85 versionCode = 88
versionName = '1.5.85' versionName = '1.5.88`'
multiDexEnabled =true multiDexEnabled =true
} }

View File

@@ -20,14 +20,12 @@
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" /> <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" /> <uses-permission android:name="android.permission.WRITE_CONTACTS" />
<!-- <uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" /> -->
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" /> <uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application <application

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

View File

@@ -63,18 +63,18 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: leak_tracker name: leak_tracker
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "10.0.4" version: "10.0.5"
leak_tracker_flutter_testing: leak_tracker_flutter_testing:
dependency: transitive dependency: transitive
description: description:
name: leak_tracker_flutter_testing name: leak_tracker_flutter_testing
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.3" version: "3.0.5"
leak_tracker_testing: leak_tracker_testing:
dependency: transitive dependency: transitive
description: description:
@@ -95,18 +95,18 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: material_color_utilities name: material_color_utilities
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.8.0" version: "0.11.1"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.12.0" version: "1.15.0"
path: path:
dependency: transitive dependency: transitive
description: description:
@@ -164,10 +164,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.7.0" version: "0.7.2"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
@@ -180,10 +180,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: vm_service name: vm_service
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "14.2.1" version: "14.2.5"
sdks: sdks:
dart: ">=3.3.0 <4.0.0" dart: ">=3.3.0 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54" flutter: ">=3.18.0-18.0.pre.54"

View File

@@ -4,7 +4,7 @@ import FirebaseCore
import GoogleMaps import GoogleMaps
// import Constants // import Constants
@UIApplicationMain @main
@objc class AppDelegate: FlutterAppDelegate { @objc class AppDelegate: FlutterAppDelegate {
override func application( override func application(

View File

@@ -9,6 +9,7 @@ class BoxName {
static const String myList = "myList"; static const String myList = "myList";
static const String bodyOrder = "bodyOrder"; static const String bodyOrder = "bodyOrder";
static const String gender = "gender"; static const String gender = "gender";
static const String phoneWallet = "phoneWallet";
static const String IsSavedPhones = "IsSavedPhones"; static const String IsSavedPhones = "IsSavedPhones";
static const String carType = "carType"; static const String carType = "carType";
static const String isFirstTime = "isFirstTime"; static const String isFirstTime = "isFirstTime";

View File

@@ -8,7 +8,8 @@ class AppLink {
static final String seferPaymentServer = '${Env.seferPaymentServer}/ride'; static final String seferPaymentServer = '${Env.seferPaymentServer}/ride';
static final String seferAlexandriaServer = Env.seferAlexandriaServer; static final String seferAlexandriaServer = Env.seferAlexandriaServer;
static final String seferCairoServer = Env.seferCairoServer; 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 = static final String endPoint =
box.read(BoxName.serverChosen) ?? Env.seferCairoServer; box.read(BoxName.serverChosen) ?? Env.seferCairoServer;

View File

@@ -96,7 +96,8 @@ class RegisterCaptainController extends GetxController {
sendOtpMessage() async { sendOtpMessage() async {
SmsEgyptController smsEgyptController = Get.put(SmsEgyptController()); SmsEgyptController smsEgyptController = Get.put(SmsEgyptController());
isLoading = true;
update();
int randomNumber = Random().nextInt(100000) + 1; int randomNumber = Random().nextInt(100000) + 1;
isLoading = true; isLoading = true;
update(); update();
@@ -156,6 +157,8 @@ class RegisterCaptainController extends GetxController {
} }
} }
} }
isLoading = false;
update();
} }
verifySMSCode() async { verifySMSCode() async {

View File

@@ -134,10 +134,10 @@ class FirebaseMessagesController extends GetxController {
'body': message.notification!.body 'body': message.notification!.body
}); });
} else if (message.notification!.title == 'Cancel Trip') { } else if (message.notification!.title == 'Cancel Trip') {
// if (Platform.isAndroid) { if (Platform.isAndroid) {
// NotificationController().showNotification( NotificationController().showNotification(
// 'Cancel Trip'.tr, 'Passenger Cancel Trip'.tr, 'cancel', ''); 'Cancel Trip'.tr, 'Passenger Cancel Trip'.tr, 'cancel', '');
// } }
cancelTripDialog(); cancelTripDialog();
} else if (message.notification!.title == 'VIP Order') { } else if (message.notification!.title == 'VIP Order') {
var myListString = message.data['DriverList']; var myListString = message.data['DriverList'];
@@ -166,7 +166,7 @@ class FirebaseMessagesController extends GetxController {
} else if (message.notification!.title! == 'message From passenger') { } else if (message.notification!.title! == 'message From passenger') {
if (Platform.isAndroid) { if (Platform.isAndroid) {
NotificationController() NotificationController()
.showNotification('message From passenger', ''.tr, 'tone2', ''); .showNotification('message From passenger'.tr, ''.tr, 'tone2', '');
} }
passengerDialog(message.notification!.body!); 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. // Get the token you want to subtract.
String token = box.read(BoxName.tokenFCM); String token = box.read(BoxName.tokenFCM);
tokens = box.read(BoxName.tokens); tokens = box.read(BoxName.tokens);
@@ -483,26 +483,41 @@ class FirebaseMessagesController extends GetxController {
// Send the notification // Send the notification
final response = await http final response = await http
.post( .post(
Uri.parse( Uri.parse(
'https://fcm.googleapis.com/v1/projects/ride-b1bd8/messages:send'), 'https://fcm.googleapis.com/v1/projects/ride-b1bd8/messages:send'),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Authorization': 'Bearer $accessToken', 'Authorization': 'Bearer $accessToken',
}, },
body: jsonEncode({ body: jsonEncode({
'notification': <String, dynamic>{ 'message': {
'token': token,
'notification': {
'title': title, 'title': title,
'body': body, 'body': body,
'sound': 'ding.wav'
}, },
'priority': 'high', // 'data': {
'data': <String, dynamic>{ // 'DriverList': jsonEncode(data),
'click_action': 'FLUTTER_NOTIFICATION_CLICK', // },
'id': '1', 'android': {
'status': 'done' '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(() {}) .whenComplete(() {})
.catchError((e) {}); .catchError((e) {});
} }
@@ -568,16 +583,32 @@ class FirebaseMessagesController extends GetxController {
'Authorization': 'Bearer $accessToken', 'Authorization': 'Bearer $accessToken',
}, },
body: jsonEncode({ body: jsonEncode({
'notification': <String, dynamic>{ 'message': {
'title': title, 'token': token,
'body': body, 'notification': {
'sound': tone '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( void sendNotificationToPassengerTokenCALL(
String title, body, token, List<String> map) async { String title, body, token, List<String> map, String tone) async {
try { try {
String serviceAccountKeyJson = '''{ String serviceAccountKeyJson = '''{
"type": "service_account", "type": "service_account",
@@ -635,14 +666,18 @@ class FirebaseMessagesController extends GetxController {
'passengerList': jsonEncode(map), 'passengerList': jsonEncode(map),
}, },
'android': { 'android': {
'priority': 'high', // Set priority to high
'notification': { 'notification': {
'sound': 'iphone_ringtone.wav', 'sound': tone,
}, },
}, },
'apns': { 'apns': {
'headers': {
'apns-priority': '10', // Set APNs priority to 10
},
'payload': { 'payload': {
'aps': { 'aps': {
'sound': 'iphone_ringtone.wav', 'sound': tone,
}, },
}, },
}, },
@@ -707,11 +742,15 @@ class FirebaseMessagesController extends GetxController {
'DriverList': jsonEncode([]), 'DriverList': jsonEncode([]),
}, },
'android': { 'android': {
'priority': 'high', // Set priority to high
'notification': { 'notification': {
'sound': tone, 'sound': tone,
}, },
}, },
'apns': { 'apns': {
'headers': {
'apns-priority': '10', // Set APNs priority to 10
},
'payload': { 'payload': {
'aps': { 'aps': {
'sound': tone, 'sound': tone,
@@ -779,11 +818,15 @@ class FirebaseMessagesController extends GetxController {
'DriverList': jsonEncode(data), 'DriverList': jsonEncode(data),
}, },
'android': { 'android': {
'priority': 'high', // Set priority to high
'notification': { 'notification': {
'sound': tone, 'sound': tone,
}, },
}, },
'apns': { 'apns': {
'headers': {
'apns-priority': '10', // Set APNs priority to 10
},
'payload': { 'payload': {
'aps': { 'aps': {
'sound': tone, 'sound': tone,
@@ -809,7 +852,7 @@ class FirebaseMessagesController extends GetxController {
} }
void sendNotificationToDriverMapPolyline(String title, String body, void sendNotificationToDriverMapPolyline(String title, String body,
String token, List<String> data, String polylineJson) async { String token, List<String> data, String polylineJson, String tone) async {
try { try {
String serviceAccountKeyJson = '''{ String serviceAccountKeyJson = '''{
"type": "service_account", "type": "service_account",
@@ -841,18 +884,32 @@ class FirebaseMessagesController extends GetxController {
'Authorization': 'Bearer $accessToken', 'Authorization': 'Bearer $accessToken',
}, },
body: jsonEncode({ body: jsonEncode({
'notification': <String, dynamic>{ 'message': {
'title': title, 'token': token,
'body': body, 'notification': {
// 'sound': 'tone2.wav', 'title': title,
'sound': 'order.wav' '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,
}), }),
); );

View File

@@ -14,11 +14,10 @@ import '../home/captin/home_captain_controller.dart';
class NotificationController extends GetxController { class NotificationController extends GetxController {
final FlutterLocalNotificationsPlugin _flutterLocalNotificationsPlugin = final FlutterLocalNotificationsPlugin _flutterLocalNotificationsPlugin =
FlutterLocalNotificationsPlugin(); FlutterLocalNotificationsPlugin();
// Initializes the local notifications plugin // Initializes the local notifications plugin
Future<void> initNotifications() async { Future<void> initNotifications() async {
const AndroidInitializationSettings android = const AndroidInitializationSettings android =
AndroidInitializationSettings('app_icon'); AndroidInitializationSettings('@mipmap/launcher_icon');
const InitializationSettings initializationSettings = const InitializationSettings initializationSettings =
InitializationSettings(android: android); 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 // 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<void> 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<void> 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,
// );
// }
// }

View File

@@ -5,6 +5,10 @@ import 'package:flutter_overlay_window/flutter_overlay_window.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import '../../constant/box_name.dart';
import '../../main.dart';
import '../auth/captin/login_captin_controller.dart';
Future<void> getPermissionOverlay() async { Future<void> getPermissionOverlay() async {
if (Platform.isAndroid) { if (Platform.isAndroid) {
final bool status = await FlutterOverlayWindow.isPermissionGranted(); final bool status = await FlutterOverlayWindow.isPermissionGranted();
@@ -23,17 +27,22 @@ Future<void> getPermissionOverlay() async {
} }
Future<void> getPermissionLocation() async { Future<void> getPermissionLocation() async {
final PermissionStatus status = await Permission.location.request(); final PermissionStatus status = await Permission.location.status;
if (status.isDenied) { if (!status.isGranted) {
MyDialog().getDialog( // Log.print('status.isGranted: ${status.isGranted}');
'Enable Location Permission'.tr, // {en:ar} box.write(BoxName.locationPermission, 'true');
'Allowing location access will help us display orders near you. Please enable it now.' await Permission.location.request();
.tr, // {en:ar} Get.find<LoginDriverController>().update();
() async { // MyDialog().getDialog(
Get.back(); // 'Enable Location Permission'.tr, // {en:ar}
await FlutterOverlayWindow.requestPermission(); // '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();
// },
// );
} }
} }

View File

@@ -521,6 +521,7 @@ class MapDriverController extends GetxController {
Get.back(); Get.back();
if (distanceToDestination < 150) { if (distanceToDestination < 150) {
// todo add scam from start point and dont move // todo add scam from start point and dont move
// finishRideFromDriver1();
} }
MyDialog().getDialog('you are not moved yet !'.tr, '', () { MyDialog().getDialog('you are not moved yet !'.tr, '', () {
Get.back(); Get.back();

View File

@@ -32,6 +32,7 @@ class PaymentController extends GetxController {
// double.parse(Get.find<MapDriverController>().totalPricePassenger); // double.parse(Get.find<MapDriverController>().totalPricePassenger);
int? selectedAmount = 0; int? selectedAmount = 0;
List<dynamic> totalPassengerWalletDetails = []; List<dynamic> totalPassengerWalletDetails = [];
final walletphoneController = TextEditingController();
String passengerTotalWalletAmount = ''; String passengerTotalWalletAmount = '';
String ip = '1'; String ip = '1';
DateTime now = DateTime.now(); DateTime now = DateTime.now();

View File

@@ -144,7 +144,7 @@ class PaymobPaymentWallet {
}) async { }) async {
final Map<String, dynamic> data = { final Map<String, dynamic> data = {
"source": { "source": {
"identifier": box.read(BoxName.phoneDriver).toString(), "identifier": box.read(BoxName.phoneWallet).toString(),
"subtype": "WALLET", "subtype": "WALLET",
}, },
"payment_token": paymentToken, "payment_token": paymentToken,

View File

@@ -108,15 +108,18 @@ void main() async {
await WakelockPlus.enable(); await WakelockPlus.enable();
// Request location permission // Request location permission
PermissionStatus status = await Permission.location.request(); // PermissionStatus status = await Permission.location.request();
if (status.isDenied) { // if (status.isDenied) {
WidgetsBinding.instance.addPostFrameCallback((_) { // WidgetsBinding.instance.addPostFrameCallback((_) {
getPermissionLocation(); // getPermissionLocation();
}); // });
return; // return;
// }
PermissionStatus status1 = await Permission.location.status;
if (status1.isGranted) {
await LocationController().startLocationUpdates();
} }
await LocationController().startLocationUpdates();
await GetStorage.init(); await GetStorage.init();
Stripe.publishableKey = AK.publishableKeyStripe; Stripe.publishableKey = AK.publishableKeyStripe;

View File

@@ -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/elevated_btn.dart';
import 'package:SEFER/views/widgets/my_scafold.dart'; import 'package:SEFER/views/widgets/my_scafold.dart';
import 'package:SEFER/views/widgets/my_textField.dart'; import 'package:SEFER/views/widgets/my_textField.dart';
import 'package:SEFER/views/widgets/mycircular.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@@ -88,14 +89,16 @@ class SmsSignupEgypt extends StatelessWidget {
) )
: const SizedBox()), : const SizedBox()),
// Submit button // Submit button
MyElevatedButton( registerCaptainController.isLoading
onPressed: () async { ? const MyCircularProgressIndicator()
!registerCaptainController.isSent : MyElevatedButton(
? await registerCaptainController.sendOtpMessage() onPressed: () async {
: await registerCaptainController.verifySMSCode(); !registerCaptainController.isSent
}, ? await registerCaptainController.sendOtpMessage()
title: 'Submit'.tr, : await registerCaptainController.verifySMSCode();
), },
title: 'Submit'.tr,
),
], ],
); );
}), }),

View File

@@ -5,6 +5,7 @@ import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.dart';
import '../../../constant/box_name.dart'; import '../../../constant/box_name.dart';
import '../../../constant/colors.dart'; import '../../../constant/colors.dart';
@@ -13,6 +14,7 @@ import '../../../constant/style.dart';
import '../../../controller/auth/apple_sigin.dart'; import '../../../controller/auth/apple_sigin.dart';
import '../../../controller/auth/captin/login_captin_controller.dart'; import '../../../controller/auth/captin/login_captin_controller.dart';
import '../../../controller/auth/google_sign.dart'; import '../../../controller/auth/google_sign.dart';
import '../../../controller/functions/overlay_permisssion.dart';
import '../../../main.dart'; import '../../../main.dart';
import '../../widgets/elevated_btn.dart'; import '../../widgets/elevated_btn.dart';
import '../../widgets/my_scafold.dart'; import '../../widgets/my_scafold.dart';
@@ -410,6 +412,14 @@ class LoginCaptin extends StatelessWidget {
title: "Allow Location Access".tr, title: "Allow Location Access".tr,
onPressed: () async { onPressed: () async {
// await Get.put(LocationBackgroundController()); ////// // await Get.put(LocationBackgroundController()); //////
PermissionStatus status =
await Permission.location.status;
if (!status.isGranted) {
// WidgetsBinding.instance.addPostFrameCallback((_) {
getPermissionLocation();
// });
return;
}
box.write(BoxName.locationPermission, 'true'); box.write(BoxName.locationPermission, 'true');
controller.update(); controller.update();
}, },

View File

@@ -1,6 +1,7 @@
import 'package:SEFER/constant/box_name.dart'; import 'package:SEFER/constant/box_name.dart';
import 'package:SEFER/main.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/egypt_card_a_i.dart';
import 'package:SEFER/views/auth/captin/cards/sms_signup.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_font_icons/flutter_font_icons.dart'; import 'package:flutter_font_icons/flutter_font_icons.dart';
import 'package:bubble_head/bubble.dart'; import 'package:bubble_head/bubble.dart';
@@ -177,7 +178,7 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
// onPressed: () async { // onPressed: () async {
// // Get.to(() => EgyptCardAI()); // // Get.to(() => EgyptCardAI());
// // print(box.read(BoxName.myList)); // // print(box.read(BoxName.myList));
//
// List<String> d = [ // List<String> d = [
// "30.003028,31.2419628", // "30.003028,31.2419628",
// "30.0955661,31.2665336", // "30.0955661,31.2665336",
@@ -214,54 +215,36 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
// "8", // "8",
// "5.00" // "5.00"
// ]; // ];
// // FirebaseMessagesController().sendNotificationToDriverMAP(
// try { // 'Order'.tr,
// print('Before showing overlay: ${box.read('some_key')}'); // 'from: ',
// // // jsonDecode(value)['message'].toString(),
// // Ensure any existing overlay is closed before showing a new one // // 'd3JaCCFAQeu8QTxRnlC1sB:APA91bFuRjbVK32obIFYXFTI4iwsZEPrrgwvPouob2bXivID-W4aXz51J_OIJ2nHpNU2ocOvGLD1Ip65rLViAFx5qHVE-c8FabBwBi5fSQ-lDTQfe36xxKsc9DU-sTyj_FoYrrMnLNVi',
// // 'dN7B10MgQKOR13R5wnBqTN:APA91bHAlcfrOhxXdMYB8akJeeJzQ4lxfx7UhOpP0dcjGtRdKXSD9x6jiEoz6ULnQK5Hc030_VRUAV6Q8qGj-RmlbLAm4wppc4gv_Ri4oEbHHwONP5c41-341YkVqsFYTCRaHz7VpUoj',
// bool isOverlayActive = // d,
// await FlutterOverlayWindow.isActive(); // 'order.wav');
// if (isOverlayActive) { // try {} catch (e) {
// 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) {
// print('Error showing overlay: $e'); // print('Error showing overlay: $e');
// } // }
// final Bubble _bubble = Bubble(showCloseButton: true); // // final Bubble _bubble = Bubble(showCloseButton: true);
// try { // // try {
// await _bubble.startBubbleHead(sendAppToBackground: false); // // await _bubble.startBubbleHead(sendAppToBackground: false);
// } on PlatformException { // // } on PlatformException {
// print('Failed to call startBubbleHead'); // // print('Failed to call startBubbleHead');
// } // // }
// Bubble().startBubbleHead(sendAppToBackground: true); // // Bubble().startBubbleHead(sendAppToBackground: true);
// } // // }
// Future<void> stopBubbleHead() async { // // Future<void> stopBubbleHead() async {
// try { // // try {
// await _bubble.stopBubbleHead(); // // await _bubble.stopBubbleHead();
// } on PlatformException { // // } on PlatformException {
// print('Failed to call stopBubbleHead'); // // print('Failed to call stopBubbleHead');
// } // // }
// } // // }
// // //
// // // send data to ovelay // // // // send data to ovelay
// }, // },
// icon: const Icon( // icon: const Icon(
// FontAwesome5.grin_tears, // FontAwesome5.grin_tears,
@@ -271,35 +254,36 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
// ); // );
// }), // }),
// ), // ),
AnimatedContainer( // // AnimatedContainer(
duration: const Duration(microseconds: 200), // duration: const Duration(microseconds: 200),
width: controller.widthMapTypeAndTraffic, // width: controller.widthMapTypeAndTraffic,
decoration: BoxDecoration( // decoration: BoxDecoration(
color: AppColor.secondaryColor, // color: AppColor.secondaryColor,
border: Border.all(color: AppColor.blueColor), // border: Border.all(color: AppColor.blueColor),
borderRadius: BorderRadius.circular(15)), // borderRadius: BorderRadius.circular(15)),
child: Builder(builder: (context) { // child: Builder(builder: (context) {
return IconButton( // return IconButton(
onPressed: () async { // onPressed: () async {
// FirebaseMessagesController().sendNotificationToAnyWithoutData( // // FirebaseMessagesController().sendNotificationToAnyWithoutData(
// 'Order'.tr, // // 'Order'.tr,
// 'from: ', // // 'from: ',
// // jsonDecode(value)['message'].toString(), // // // jsonDecode(value)['message'].toString(),
// 'dEugS-JOT4Ka5riF4s5TEN:APA91bEDL_W7BuEQGbyL-RMaKiMWDlURXhFuaybe5WurTUV8K5eIooSGe22yY22_U2hEZcfPr46ig1v--l00dbOGiivazxvmTyhUyQQW6lJsuIN-wordGtBxtREyeYtEKvxIa1J4ApEu', // // 'dEugS-JOT4Ka5riF4s5TEN:APA91bEDL_W7BuEQGbyL-RMaKiMWDlURXhFuaybe5WurTUV8K5eIooSGe22yY22_U2hEZcfPr46ig1v--l00dbOGiivazxvmTyhUyQQW6lJsuIN-wordGtBxtREyeYtEKvxIa1J4ApEu',
// 'order.wav' // // 'order.wav'
// // polylineCoordinates.toString() // // // polylineCoordinates.toString()
// ); // // );
print(AppLink.addDriverPaymentPoints); // Get.to(SmsSignupEgypt());
}, // // print(AppLink.addDriverPaymentPoints);
icon: const Icon( // },
FontAwesome5.closed_captioning, // icon: const Icon(
size: 29, // FontAwesome5.closed_captioning,
color: AppColor.blueColor, // size: 29,
), // color: AppColor.blueColor,
); // ),
}), // );
), // }),
// ),
], ],
)), )),
); );

View File

@@ -8,6 +8,7 @@ import 'package:SEFER/controller/payment/payment_controller.dart';
import '../../../constant/box_name.dart'; import '../../../constant/box_name.dart';
import '../../../main.dart'; import '../../../main.dart';
import '../../widgets/elevated_btn.dart'; import '../../widgets/elevated_btn.dart';
import '../../widgets/my_textField.dart';
class PointsCaptain extends StatelessWidget { class PointsCaptain extends StatelessWidget {
PaymentController paymentController = Get.put(PaymentController()); PaymentController paymentController = Get.put(PaymentController());
@@ -65,21 +66,48 @@ class PointsCaptain extends StatelessWidget {
title: 'Pay with Wallet'.tr, title: 'Pay with Wallet'.tr,
onPressed: () async { onPressed: () async {
Get.back(); Get.back();
await paymentController.payWithPayMobWallet( Get.defaultDialog(
context, barrierDismissible: false,
pricePoint.toStringAsFixed(2), title: 'Insert Wallet phone number'.tr,
box.read(BoxName.countryCode) == 'Egypt' content: Form(
? 'EGP' key: paymentController.formKey,
: 'JOD', () async { child: MyTextForm(
await captainWalletController.addDriverPaymentPoints( controller:
'visa-in', pricePoint); paymentController.walletphoneController,
await captainWalletController.addDriverWallet( label: 'Insert Wallet phone number'.tr,
'visa-in', countPoint); hint: 'Insert Wallet phone number'.tr,
await captainWalletController.addSeferWallet( type: TextInputType.phone)),
'visa-in', pricePoint.toString()); confirm: MyElevatedButton(
await captainWalletController title: 'OK'.tr,
.getCaptainWalletFromBuyPoints(); 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();
}));
}, },
), ),
], ],

View File

@@ -37,19 +37,22 @@ class NotificationCaptain extends StatelessWidget {
onTap: () { onTap: () {
Get.defaultDialog( Get.defaultDialog(
title: res['title'], title: res['title'],
titleStyle: AppStyle.title, titleStyle: AppStyle.title.copyWith(
fontWeight: FontWeight.bold),
content: SizedBox( content: SizedBox(
width: Get.width * .8, width: Get.width * .8,
height: Get.height * .4, height: Get.height * .4,
child: Text( child: Text(
res['body'], res['body'],
style: AppStyle.title, style: AppStyle.subtitle,
), ),
), ),
confirm: MyElevatedButton( confirm: MyElevatedButton(
title: 'Ok', title: 'Ok',
onPressed: () { onPressed: () {
//todo sql readen //todo sql readen
notificationCaptainController
.updateNotification(res['id']);
})); }));
}, },
leading: leading:

View File

@@ -92,9 +92,10 @@ dependencies:
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flutter_lints: ^4.0.0 flutter_lints: ^4.0.0
envied_generator: ^0.5.2 envied_generator: ^0.5.2
build_runner: build_runner: ^2.4.6
flutter_launcher_icons: flutter_launcher_icons:
android: "launcher_icon" android: "launcher_icon"