- Fixed _addModifiersRecursively to track OrderLineItemID through recursion - Changed from hardcoded parentOrderLineItemId: 0 to actual parent IDs - Added logic to find root item's OrderLineItemID before starting recursion - Added logic to find each modifier's OrderLineItemID for its children - Fixed API_BASE_URL to AALISTS_API_BASE_URL for environment consistency - Added comprehensive debug logging for troubleshooting This fix ensures nested modifiers (e.g., Customize Spread > Extra) are properly saved to the database with correct parent-child relationships. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
47 lines
1.6 KiB
Dart
47 lines
1.6 KiB
Dart
import 'package:flutter/foundation.dart';
|
|
import 'package:permission_handler/permission_handler.dart';
|
|
|
|
class BeaconPermissions {
|
|
static Future<bool> requestPermissions() async {
|
|
try {
|
|
// Request location permission (required for Bluetooth scanning)
|
|
final locationStatus = await Permission.locationWhenInUse.request();
|
|
|
|
// Request Bluetooth permissions (Android 12+)
|
|
final bluetoothScan = await Permission.bluetoothScan.request();
|
|
final bluetoothConnect = await Permission.bluetoothConnect.request();
|
|
|
|
final allGranted = locationStatus.isGranted &&
|
|
bluetoothScan.isGranted &&
|
|
bluetoothConnect.isGranted;
|
|
|
|
if (allGranted) {
|
|
debugPrint('[BeaconPermissions] ✅ All permissions granted');
|
|
} else {
|
|
debugPrint('[BeaconPermissions] ❌ Permissions denied: '
|
|
'location=$locationStatus, '
|
|
'bluetoothScan=$bluetoothScan, '
|
|
'bluetoothConnect=$bluetoothConnect');
|
|
}
|
|
|
|
return allGranted;
|
|
} catch (e) {
|
|
debugPrint('[BeaconPermissions] Error requesting permissions: $e');
|
|
return false;
|
|
}
|
|
}
|
|
|
|
static Future<bool> checkPermissions() async {
|
|
final locationStatus = await Permission.locationWhenInUse.status;
|
|
final bluetoothScan = await Permission.bluetoothScan.status;
|
|
final bluetoothConnect = await Permission.bluetoothConnect.status;
|
|
|
|
return locationStatus.isGranted &&
|
|
bluetoothScan.isGranted &&
|
|
bluetoothConnect.isGranted;
|
|
}
|
|
|
|
static Future<void> openSettings() async {
|
|
await openAppSettings();
|
|
}
|
|
}
|