This commit is contained in:
Hamza-Ayed
2024-11-17 22:13:31 +02:00
parent e8c72d79a9
commit 5aeb3cf685
45 changed files with 856 additions and 284 deletions

View File

@@ -14,6 +14,7 @@ import 'package:share/share.dart';
import '../../../main.dart';
import '../../../print.dart';
import '../../../views/widgets/error_snakbar.dart';
import '../../functions/launch.dart';
import '../../notification/notification_captain_controller.dart';
@@ -103,10 +104,11 @@ Download the SEFER app now and enjoy your ride!
// TODO: Implement the actual server upload logic here
// Simulating a server request
await Future.delayed(Duration(seconds: 2));
Get.snackbar('Success'.tr,
mySnackbarSuccess(
'${selectedContacts.length} contacts saved to server'.tr);
} catch (e) {
Get.snackbar('Error'.tr,
mySnackeBarError(
'An error occurred while saving contacts to server: $e'.tr);
}
}
@@ -134,16 +136,13 @@ Download the SEFER app now and enjoy your ride!
update();
if (contacts.isEmpty) {
Get.snackbar('No contacts available'.tr,
'Please add contacts to your phone.'.tr);
mySnackeBarError('Please add contacts to your phone.'.tr);
}
} else {
Get.snackbar('Permission denied'.tr,
'Contact permission is required to pick contacts'.tr);
mySnackeBarError('Contact permission is required to pick contacts'.tr);
}
} catch (e) {
Get.snackbar(
'Error'.tr, 'An error occurred while picking contacts: $e'.tr);
mySnackeBarError('An error occurred while picking contacts: $e'.tr);
}
}
@@ -267,7 +266,7 @@ Download the SEFER app now and enjoy your ride!
void sendInvite() async {
if (invitePhoneController.text.isEmpty) {
Get.snackbar('Error', 'Please enter an phone address'.tr);
mySnackeBarError('Please enter an phone address'.tr);
return;
}
@@ -281,8 +280,7 @@ Download the SEFER app now and enjoy your ride!
if (response != 'failure') {
var d = jsonDecode(response);
Get.snackbar('Success', 'Invite sent successfully'.tr);
mySnackbarSuccess('Invite sent successfully'.tr);
String message = '${'*SEFER DRIVER CODE*'.tr}\n\n'
'${"Use this code in registration".tr}\n'
'${"To get a gift for both".tr}\n\n'
@@ -297,18 +295,14 @@ Download the SEFER app now and enjoy your ride!
invitePhoneController.clear();
} else {
Get.snackbar('Error'.tr, "Invite code already used".tr,
backgroundColor: AppColor.redColor,
duration: const Duration(seconds: 4));
mySnackeBarError("Invite code already used".tr);
}
// } catch (e) {
// Get.snackbar('Error', 'An error occurred'.tr);
// }
}
void sendInviteToPassenger() async {
if (invitePhoneController.text.isEmpty) {
Get.snackbar('Error', 'Please enter an phone address'.tr);
mySnackeBarError('Please enter an phone address'.tr);
return;
}
@@ -323,7 +317,8 @@ Download the SEFER app now and enjoy your ride!
if (response != 'failure') {
var d = jsonDecode(response);
Get.snackbar('Success', 'Invite sent successfully'.tr);
mySnackbarSuccess('Invite sent successfully'.tr);
String message = '${'*SEFER APP CODE*'.tr}\n\n'
'${"Use this code in registration".tr}\n'
@@ -339,13 +334,10 @@ Download the SEFER app now and enjoy your ride!
invitePhoneController.clear();
} else {
Get.snackbar('Error'.tr, "Invite code already used".tr,
backgroundColor: AppColor.redColor,
duration: const Duration(seconds: 4));
mySnackeBarError(
"Invite code already used".tr,
);
}
// } catch (e) {
// Get.snackbar('Error', 'An error occurred'.tr);
// }
}
}