change to map-saas api key and env - 2026-04-12

This commit is contained in:
Hamza-Ayed
2026-04-12 02:25:44 +03:00
parent 454276d1e0
commit 0aa1f15f25
16 changed files with 14974 additions and 13857 deletions

View File

@@ -7,6 +7,7 @@ import 'package:Intaleq/controller/functions/crud.dart';
import 'package:flutter/material.dart';
import 'package:flutter_contacts/flutter_contacts.dart';
import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:share_plus/share_plus.dart';
import '../../../main.dart';
@@ -107,7 +108,37 @@ ${'Download the Intaleq app now and enjoy your ride!'.tr}
/// tried to access the first phone number of a contact that had none.
Future<void> pickContacts() async {
try {
if (await FlutterContacts.requestPermission(readonly: true)) {
// 1. Check current permission status using permission_handler for better control
PermissionStatus status = await Permission.contacts.status;
// 2. If status is permanently denied, direct user to settings
if (status.isPermanentlyDenied) {
Get.defaultDialog(
title: 'Permission Required'.tr,
middleText:
'Contact permission is permanently denied. Please enable it in settings to continue.'
.tr,
textConfirm: 'Settings'.tr,
textCancel: 'Cancel'.tr,
confirmTextColor: Colors.white,
onConfirm: () {
openAppSettings();
Get.back();
},
);
return;
}
// 3. Request permission if not already granted
if (!status.isGranted) {
status = await Permission.contacts.request();
}
// 4. Proceed if granted
if (status.isGranted) {
// Also call flutter_contacts requestPermission to ensure it's synced (internal state)
await FlutterContacts.requestPermission(readonly: true);
final List<Contact> allContacts =
await FlutterContacts.getContacts(withProperties: true);
final int totalContactsOnDevice = allContacts.length;