25-5-30/1
This commit is contained in:
@@ -196,10 +196,8 @@ class LoginController extends GetxController {
|
||||
|
||||
var res =
|
||||
await CRUD().get(link: AppLink.loginFromGooglePassenger, payload: {
|
||||
'email': email.toString().contains('@')
|
||||
? EncryptionHelper.instance.encryptData(email)
|
||||
: email,
|
||||
'id': passengerID,
|
||||
'email': email.toString(),
|
||||
'id': passengerID.toString(),
|
||||
"platform": Platform.isAndroid ? 'android' : 'ios',
|
||||
"appName": AppInformation.appName,
|
||||
});
|
||||
@@ -229,59 +227,112 @@ class LoginController extends GetxController {
|
||||
box.write(BoxName.firstTimeLoadKey, 'false');
|
||||
d['inviteCode'] != null
|
||||
? box.write(
|
||||
BoxName.inviteCode,
|
||||
EncryptionHelper.instance
|
||||
.decryptData(d['inviteCode'].toString()) ??
|
||||
'none')
|
||||
BoxName.inviteCode, (d['inviteCode'].toString()) ?? 'none')
|
||||
: null;
|
||||
|
||||
var token = await CRUD().get(link: AppLink.getTokens, payload: {
|
||||
'passengerID': box.read(BoxName.passengerID).toString()
|
||||
});
|
||||
var fingerPrint = DeviceHelper.getDeviceFingerprint().toString();
|
||||
var fingerPrint = await DeviceHelper.getDeviceFingerprint();
|
||||
Log.print('fingerPrint 0: ${fingerPrint}');
|
||||
await storage.write(key: BoxName.fingerPrint, value: fingerPrint);
|
||||
if (token != 'failure') {
|
||||
if ((jsonDecode(token)['data'][0]['token'].toString()) !=
|
||||
box.read(BoxName.tokenFCM)) {
|
||||
MyDialog().getDialog('change device'.tr, 'token change'.tr,
|
||||
() async {
|
||||
List<Future> updatetoken = [
|
||||
CRUD().post(
|
||||
link: "${AppLink.server}/ride/firebase/add.php",
|
||||
payload: {
|
||||
'token': box.read(BoxName.tokenFCM),
|
||||
'passengerID': box.read(BoxName.passengerID).toString(),
|
||||
'fingerPrint': (fingerPrint).toString()
|
||||
}),
|
||||
CRUD().post(
|
||||
link:
|
||||
"${AppLink.tripzAlexandriaServer}/ride/firebase/add.php",
|
||||
payload: {
|
||||
'token': box.read(BoxName.tokenFCM),
|
||||
'passengerID': box.read(BoxName.passengerID).toString(),
|
||||
'fingerPrint': (fingerPrint).toString()
|
||||
}),
|
||||
CRUD().post(
|
||||
link: "${AppLink.tripzGizaServer}/ride/firebase/add.php",
|
||||
payload: {
|
||||
'token': box.read(BoxName.tokenFCM),
|
||||
'passengerID': box.read(BoxName.passengerID).toString(),
|
||||
'fingerPrint': (fingerPrint).toString()
|
||||
}),
|
||||
];
|
||||
// cameras = await availableCameras();
|
||||
await Future.wait(updatetoken);
|
||||
Get.put(FirebaseMessagesController())
|
||||
.sendNotificationToDriverMAP(
|
||||
'token change'.tr,
|
||||
'change device'.tr,
|
||||
EncryptionHelper.instance.decryptData(
|
||||
jsonDecode(token)['data'][0]['token'].toString()),
|
||||
[],
|
||||
'cancel.wav',
|
||||
);
|
||||
});
|
||||
|
||||
if (token != 'failure') {
|
||||
if ((jsonDecode(token)['message']['token'].toString()) !=
|
||||
box.read(BoxName.tokenFCM)) {
|
||||
// MyDialog().getDialog('change device'.tr, 'token change'.tr,
|
||||
// () async {
|
||||
// List<Future> updatetoken = [
|
||||
// CRUD().post(
|
||||
// link: "${AppLink.server}/ride/firebase/add.php",
|
||||
// payload: {
|
||||
// 'token': box.read(BoxName.tokenFCM),
|
||||
// 'passengerID': box.read(BoxName.passengerID).toString(),
|
||||
// 'fingerPrint': (fingerPrint).toString()
|
||||
// }),
|
||||
// CRUD().post(
|
||||
// link:
|
||||
// "${AppLink.tripzAlexandriaServer}/ride/firebase/add.php",
|
||||
// payload: {
|
||||
// 'token': box.read(BoxName.tokenFCM),
|
||||
// 'passengerID': box.read(BoxName.passengerID).toString(),
|
||||
// 'fingerPrint': (fingerPrint).toString()
|
||||
// }),
|
||||
// CRUD().post(
|
||||
// link: "${AppLink.tripzGizaServer}/ride/firebase/add.php",
|
||||
// payload: {
|
||||
// 'token': box.read(BoxName.tokenFCM),
|
||||
// 'passengerID': box.read(BoxName.passengerID).toString(),
|
||||
// 'fingerPrint': (fingerPrint).toString()
|
||||
// }),
|
||||
// ];
|
||||
// // cameras = await availableCameras();
|
||||
// await Future.wait(updatetoken);
|
||||
// Get.put(FirebaseMessagesController())
|
||||
// .sendNotificationToDriverMAP(
|
||||
// 'token change'.tr,
|
||||
// 'change device'.tr,
|
||||
// (jsonDecode(token)['data'][0]['token'].toString()),
|
||||
// [],
|
||||
// 'cancel.wav',
|
||||
// );
|
||||
// });
|
||||
await Get.defaultDialog(
|
||||
title: 'Device Change Detected'.tr,
|
||||
middleText:
|
||||
'You can only use one device at a time. This device will now be set as your active device.'
|
||||
.tr,
|
||||
textConfirm: 'OK'.tr,
|
||||
confirmTextColor: Colors.white,
|
||||
onConfirm: () async {
|
||||
Get.back(); // Close dialog
|
||||
|
||||
/// تحديث التوكين في السيرفرات
|
||||
List<Future> updatetoken = [
|
||||
CRUD().post(
|
||||
link: "${AppLink.server}/ride/firebase/add.php",
|
||||
payload: {
|
||||
'token': box.read(BoxName.tokenFCM),
|
||||
'passengerID':
|
||||
box.read(BoxName.passengerID).toString(),
|
||||
'fingerPrint': fingerPrint
|
||||
}),
|
||||
CRUD().post(
|
||||
link:
|
||||
"${AppLink.tripzAlexandriaServer}/ride/firebase/add.php",
|
||||
payload: {
|
||||
'token': box.read(BoxName.tokenFCM),
|
||||
'passengerID':
|
||||
box.read(BoxName.passengerID).toString(),
|
||||
'fingerPrint': fingerPrint
|
||||
}),
|
||||
CRUD().post(
|
||||
link:
|
||||
"${AppLink.tripzGizaServer}/ride/firebase/add.php",
|
||||
payload: {
|
||||
'token': box.read(BoxName.tokenFCM),
|
||||
'passengerID':
|
||||
box.read(BoxName.passengerID).toString(),
|
||||
'fingerPrint': fingerPrint
|
||||
}),
|
||||
];
|
||||
|
||||
await Future.wait(updatetoken);
|
||||
|
||||
/// إشعار للسائق بأنه تم تغيير الجهاز
|
||||
await Get.put(FirebaseMessagesController())
|
||||
.sendNotificationToDriverMAP(
|
||||
'token change'.tr,
|
||||
'change device'.tr,
|
||||
jsonDecode(token)['message']['token'].toString(),
|
||||
[],
|
||||
'cancel.wav',
|
||||
);
|
||||
|
||||
/// التوجه للصفحة الرئيسية
|
||||
Get.offAll(() => const MapPagePassenger());
|
||||
},
|
||||
);
|
||||
Future.delayed(const Duration(seconds: 1));
|
||||
|
||||
Get.defaultDialog(
|
||||
@@ -305,8 +356,7 @@ class LoginController extends GetxController {
|
||||
box.read(BoxName.isInstall).toString() != '1') {
|
||||
await CRUD()
|
||||
.post(link: AppLink.updatePassengersInvitation, payload: {
|
||||
"inviteCode": EncryptionHelper.instance
|
||||
.encryptData(box.read(BoxName.inviteCode).toString()),
|
||||
"inviteCode": (box.read(BoxName.inviteCode).toString()),
|
||||
"passengerID": box.read(BoxName.passengerID).toString(),
|
||||
});
|
||||
Get.defaultDialog(
|
||||
@@ -318,7 +368,7 @@ class LoginController extends GetxController {
|
||||
try {
|
||||
CRUD().post(link: AppLink.addPassengersPromo, payload: {
|
||||
"promoCode":
|
||||
'S-${EncryptionHelper.instance.decryptData(box.read(BoxName.name)).toString().split(' ')[0]}',
|
||||
'S-${(box.read(BoxName.name)).toString().split(' ')[0]}',
|
||||
"amount": '25',
|
||||
"passengerID": box.read(BoxName.passengerID).toString(),
|
||||
"description": 'promo first'
|
||||
@@ -354,11 +404,12 @@ class LoginController extends GetxController {
|
||||
void login() async {
|
||||
isloading = true;
|
||||
update();
|
||||
var res =
|
||||
await CRUD().get(link: AppLink.loginFromGooglePassenger, payload: {
|
||||
'email': EncryptionHelper.instance.encryptData(emailController.text),
|
||||
'id': passwordController.text
|
||||
});
|
||||
var res = await CRUD().get(
|
||||
link: AppLink.loginFromGooglePassenger,
|
||||
payload: {
|
||||
'email': (emailController.text),
|
||||
'id': passwordController.text
|
||||
});
|
||||
|
||||
isloading = false;
|
||||
update();
|
||||
|
||||
Reference in New Issue
Block a user