This commit is contained in:
Hamza-Ayed
2023-11-20 01:29:27 +03:00
parent 63a6420531
commit 64cdc55845
13 changed files with 261 additions and 89 deletions

View File

@@ -64,11 +64,13 @@ class FirebaseMessagesController extends GetxController {
}
Future getTokens() async {
String? basicAuthCredentials =
await storage.read(key: BoxName.basicAuthCredentials);
var res = await http.post(
Uri.parse(AppLink.getTokens),
headers: {
'Authorization':
'Basic ${base64Encode(utf8.encode(AppCredintials.basicAuthCredentials))}',
'Basic ${base64Encode(utf8.encode(basicAuthCredentials.toString()))}',
},
body: {},
);
@@ -94,7 +96,7 @@ class FirebaseMessagesController extends GetxController {
} else {
box.write(BoxName.tokenFCM, token);
}
print(token);
// print(token);
});
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
@@ -120,7 +122,7 @@ class FirebaseMessagesController extends GetxController {
driverID = myList[2].toString();
Get.snackbar(
'Captin Applied the Ride for You'.tr,
'Captain Applied the Ride for You'.tr,
'message',
colorText: AppColor.greenColor,
duration: const Duration(seconds: 11),
@@ -131,7 +133,7 @@ class FirebaseMessagesController extends GetxController {
style: const TextStyle(color: AppColor.redColor),
),
messageText: Text(
'Captin Applied the Ride for You'.tr,
'Captain Applied the Ride for You'.tr,
style: AppStyle.title,
),
icon: const Icon(Icons.approval),
@@ -221,17 +223,17 @@ class FirebaseMessagesController extends GetxController {
onPressed: () {
String mapUrl =
'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/';
print(mapUrl);
// print(mapUrl);
launchUrl1(mapUrl);
},
icon: const Icon(Icons.map),
label: Text('Rouats of Trip'.tr)),
label: Text('Routs of Trip'.tr)),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Tatal From Passenger is '.tr +
'Total From Passenger is '.tr +
double.parse(myList[2]).toStringAsFixed(2),
style: AppStyle.title,
),
@@ -239,7 +241,7 @@ class FirebaseMessagesController extends GetxController {
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Tatal For You is '.tr +
'Total For You is '.tr +
double.parse(myList[3]).toStringAsFixed(2),
style: AppStyle.title,
),
@@ -315,7 +317,7 @@ class FirebaseMessagesController extends GetxController {
var myList = jsonDecode(passengerList) as List<dynamic>;
driverID = myList[2].toString();
Get.snackbar(
'Captin Applied the Ride for You'.tr,
'Captain Applied the Ride for You'.tr,
'message',
colorText: AppColor.greenColor,
duration: const Duration(seconds: 11),
@@ -326,7 +328,7 @@ class FirebaseMessagesController extends GetxController {
style: const TextStyle(color: AppColor.redColor),
),
messageText: Text(
'Captin Applied the Ride for You'.tr,
'Captain Applied the Ride for You'.tr,
style: AppStyle.title,
),
icon: const Icon(Icons.approval),
@@ -404,7 +406,7 @@ class FirebaseMessagesController extends GetxController {
.post(Uri.parse('https://fcm.googleapis.com/fcm/send'),
headers: <String, String>{
'Content-Type': 'application/json',
'Authorization': 'key=${AppCredintials.serverAPI}'
'Authorization': 'key=${storage.read(key: BoxName.serverAPI)}'
},
body: jsonEncode({
'notification': <String, dynamic>{
@@ -432,7 +434,7 @@ class FirebaseMessagesController extends GetxController {
// .post(Uri.parse('https://fcm.googleapis.com/fcm/send'),
// headers: <String, String>{
// 'Content-Type': 'application/json',
// 'Authorization': 'key=${AppCredintials.serverAPI}'
// 'Authorization': 'key=${storage.read(key: BoxName.serverAPI}'
// },
// body: jsonEncode({
// 'notification': <String, dynamic>{
@@ -462,7 +464,7 @@ class FirebaseMessagesController extends GetxController {
Uri.parse('https://fcm.googleapis.com/fcm/send'),
headers: <String, String>{
'Content-Type': 'application/json',
'Authorization': 'key=${AppCredintials.serverAPI}'
'Authorization': 'key=${storage.read(key: BoxName.serverAPI)}'
},
body: jsonEncode({
'notification': <String, dynamic>{
@@ -499,7 +501,7 @@ class FirebaseMessagesController extends GetxController {
Uri.parse('https://fcm.googleapis.com/fcm/send'),
headers: <String, String>{
'Content-Type': 'application/json',
'Authorization': 'key=${AppCredintials.serverAPI}'
'Authorization': 'key=${storage.read(key: BoxName.serverAPI)}'
},
body: jsonEncode({
'notification': <String, dynamic>{
@@ -538,7 +540,7 @@ class FirebaseMessagesController extends GetxController {
Uri.parse('https://fcm.googleapis.com/fcm/send'),
headers: <String, String>{
'Content-Type': 'application/json',
'Authorization': 'key=${AppCredintials.serverAPI}'
'Authorization': 'key=${storage.read(key: BoxName.serverAPI)}'
},
body: jsonEncode({
'notification': <String, dynamic>{