change to map-saas api key and env - 2026-04-12
This commit is contained in:
@@ -12,7 +12,8 @@ class ContactUsController extends GetxController {
|
||||
final TimeOfDay workStartTime = const TimeOfDay(hour: 10, minute: 0);
|
||||
final TimeOfDay workEndTime = const TimeOfDay(hour: 16, minute: 0);
|
||||
|
||||
bool _isWithinWorkTime(TimeOfDay now) {
|
||||
bool get isWorkTime {
|
||||
final now = TimeOfDay.now();
|
||||
return (now.hour > workStartTime.hour ||
|
||||
(now.hour == workStartTime.hour &&
|
||||
now.minute >= workStartTime.minute)) &&
|
||||
@@ -20,6 +21,11 @@ class ContactUsController extends GetxController {
|
||||
(now.hour == workEndTime.hour && now.minute <= workEndTime.minute));
|
||||
}
|
||||
|
||||
/// Helper to format working hours for UI
|
||||
String get workHoursString =>
|
||||
'${workStartTime.hour.toString().padLeft(2, '0')}:${workStartTime.minute.toString().padLeft(2, '0')} - '
|
||||
'${workEndTime.hour.toString().padLeft(2, '0')}:${workEndTime.minute.toString().padLeft(2, '0')}';
|
||||
|
||||
/// PHONE LIST (USED FOR CALLS + WHATSAPP)
|
||||
final List<String> phoneNumbers = [
|
||||
'+963952475734',
|
||||
@@ -33,10 +39,24 @@ class ContactUsController extends GetxController {
|
||||
return phoneNumbers[random.nextInt(phoneNumbers.length)];
|
||||
}
|
||||
|
||||
/// SHOW DIALOG
|
||||
/// DIRECT ACTIONS
|
||||
void makeCall() {
|
||||
if (isWorkTime) {
|
||||
makePhoneCall(getRandomPhone());
|
||||
}
|
||||
}
|
||||
|
||||
void sendWhatsApp() {
|
||||
launchCommunication('whatsapp', getRandomPhone(), 'Hello'.tr);
|
||||
}
|
||||
|
||||
void sendEmail() {
|
||||
launchCommunication('email', 'support@intaleqapp.com', 'Hello'.tr);
|
||||
}
|
||||
|
||||
/// SHOW DIALOG (Optional legacy support)
|
||||
void showContactDialog(BuildContext context) {
|
||||
TimeOfDay now = TimeOfDay.now();
|
||||
bool withinHours = _isWithinWorkTime(now);
|
||||
bool withinHours = isWorkTime;
|
||||
|
||||
showCupertinoModalPopup(
|
||||
context: context,
|
||||
@@ -44,7 +64,6 @@ class ContactUsController extends GetxController {
|
||||
title: Text('Contact Us'.tr),
|
||||
message: Text('Choose a contact option'.tr),
|
||||
actions: <Widget>[
|
||||
/// 📞 CALL (RANDOM) — ONLY DURING WORK HOURS
|
||||
if (withinHours)
|
||||
CupertinoActionSheetAction(
|
||||
child: Row(
|
||||
@@ -55,12 +74,10 @@ class ContactUsController extends GetxController {
|
||||
],
|
||||
),
|
||||
onPressed: () {
|
||||
final phone = getRandomPhone();
|
||||
makePhoneCall(phone);
|
||||
Navigator.pop(context);
|
||||
makeCall();
|
||||
},
|
||||
),
|
||||
|
||||
/// ⛔ OUTSIDE WORK HOURS — SHOW INFO
|
||||
if (!withinHours)
|
||||
CupertinoActionSheetAction(
|
||||
child: Text(
|
||||
@@ -70,8 +87,6 @@ class ContactUsController extends GetxController {
|
||||
),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
|
||||
/// 💬 WHATSAPP (RANDOM)
|
||||
CupertinoActionSheetAction(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
@@ -84,20 +99,18 @@ class ContactUsController extends GetxController {
|
||||
],
|
||||
),
|
||||
onPressed: () {
|
||||
final phone = getRandomPhone();
|
||||
launchCommunication('whatsapp', phone, 'Hello'.tr);
|
||||
Navigator.pop(context);
|
||||
sendWhatsApp();
|
||||
},
|
||||
),
|
||||
|
||||
/// 📧 EMAIL
|
||||
CupertinoActionSheetAction(
|
||||
child: Text('Send Email'.tr),
|
||||
onPressed: () => launchCommunication(
|
||||
'email', 'support@intaleqapp.com', 'Hello'.tr),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
sendEmail();
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
/// ❌ CANCEL BUTTON
|
||||
cancelButton: CupertinoActionSheetAction(
|
||||
child: Text('Cancel'.tr),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
|
||||
Reference in New Issue
Block a user