5/19/1
This commit is contained in:
@@ -138,7 +138,7 @@ class CRUD {
|
||||
}) async {
|
||||
var headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'Ocp-Apim-Subscription-Key': '21010e54b50f41a4904708c526e102df'
|
||||
'Ocp-Apim-Subscription-Key': AK.ocpApimSubscriptionKey
|
||||
};
|
||||
|
||||
String imagePathFull =
|
||||
|
||||
@@ -1,104 +1,25 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
|
||||
class DeviceInfoPlus {
|
||||
static List<Map<String, dynamic>> deviceDataList = [];
|
||||
import '../../constant/box_name.dart';
|
||||
|
||||
static Future<List<Map<String, dynamic>>> getDeviceInfo() async {
|
||||
final DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
|
||||
class DeviceController {
|
||||
String deviceSerialNumber = '';
|
||||
final box = GetStorage();
|
||||
|
||||
try {
|
||||
if (Platform.isAndroid) {
|
||||
AndroidDeviceInfo androidInfo = await deviceInfoPlugin.androidInfo;
|
||||
Map<String, dynamic> deviceData = {
|
||||
'platform': 'Android',
|
||||
'brand': androidInfo.brand,
|
||||
'model': androidInfo.model,
|
||||
'androidId': androidInfo.device,
|
||||
'versionRelease': androidInfo.version.release,
|
||||
'sdkVersion': androidInfo.version.sdkInt,
|
||||
'manufacturer': androidInfo.manufacturer,
|
||||
'isPhysicalDevice': androidInfo.isPhysicalDevice,
|
||||
'serialNumber': androidInfo.serialNumber,
|
||||
'fingerprint': androidInfo.fingerprint,
|
||||
'type': androidInfo.type,
|
||||
'data': androidInfo.data,
|
||||
'version': androidInfo.version,
|
||||
'tags': androidInfo.tags,
|
||||
'display': androidInfo.display,
|
||||
};
|
||||
deviceDataList.add(deviceData);
|
||||
} else if (Platform.isIOS) {
|
||||
IosDeviceInfo iosInfo = await deviceInfoPlugin.iosInfo;
|
||||
Map<String, dynamic> deviceData = {
|
||||
'brand': 'Apple',
|
||||
'model': iosInfo.model,
|
||||
'systemName': iosInfo.systemName,
|
||||
'systemVersion': iosInfo.systemVersion,
|
||||
'utsname': iosInfo.utsname,
|
||||
'isPhysicalDevice': iosInfo.isPhysicalDevice,
|
||||
'identifierForVendor': iosInfo.identifierForVendor,
|
||||
'name': iosInfo.name,
|
||||
'localizedModel': iosInfo.localizedModel,
|
||||
};
|
||||
deviceDataList.add(deviceData);
|
||||
} else if (Platform.isMacOS) {
|
||||
MacOsDeviceInfo macInfo = await deviceInfoPlugin.macOsInfo;
|
||||
Map<String, dynamic> deviceData = {
|
||||
'platform': 'macOS',
|
||||
'model': macInfo.model,
|
||||
'version': macInfo.systemGUID,
|
||||
};
|
||||
deviceDataList.add(deviceData);
|
||||
} else if (Platform.isWindows) {
|
||||
WindowsDeviceInfo windowsInfo = await deviceInfoPlugin.windowsInfo;
|
||||
Map<String, dynamic> deviceData = {
|
||||
'platform': 'Windows',
|
||||
'manufacturer': windowsInfo.computerName,
|
||||
'version': windowsInfo.majorVersion,
|
||||
'deviceId': windowsInfo.deviceId,
|
||||
'userName': windowsInfo.userName,
|
||||
'productName': windowsInfo.productName,
|
||||
'installDate': windowsInfo.installDate,
|
||||
'productId': windowsInfo.productId,
|
||||
'numberOfCores': windowsInfo.numberOfCores,
|
||||
'systemMemoryInMegabytes': windowsInfo.systemMemoryInMegabytes,
|
||||
};
|
||||
deviceDataList.add(deviceData);
|
||||
} else if (Platform.isLinux) {
|
||||
LinuxDeviceInfo linuxInfo = await deviceInfoPlugin.linuxInfo;
|
||||
Map<String, dynamic> deviceData = {
|
||||
'platform': 'Linux',
|
||||
'manufacturer': linuxInfo.name,
|
||||
'version': linuxInfo.version,
|
||||
};
|
||||
deviceDataList.add(deviceData);
|
||||
}
|
||||
} catch (e) {
|
||||
print('Failed to get device info: $e');
|
||||
}
|
||||
|
||||
return deviceDataList;
|
||||
}
|
||||
|
||||
// Method to print all device data
|
||||
static void printDeviceInfo() {
|
||||
for (Map<String, dynamic> deviceData in deviceDataList) {
|
||||
print('Platform: ${deviceData['platform']}');
|
||||
print('Brand: ${deviceData['brand']}');
|
||||
print('Model: ${deviceData['model']}');
|
||||
print(
|
||||
'Version: ${deviceData['version'] ?? deviceData['versionRelease'] ?? 'N/A'}');
|
||||
print('Manufacturer: ${deviceData['manufacturer'] ?? 'N/A'}');
|
||||
print('Is Physical Device: ${deviceData['isPhysicalDevice']}');
|
||||
print('Serial Number: ${deviceData['serialNumber'] ?? 'N/A'}');
|
||||
print('Fingerprint: ${deviceData['fingerprint'] ?? 'N/A'}');
|
||||
print('Type: ${deviceData['type'] ?? 'N/A'}');
|
||||
print('Data: ${deviceData['data'] ?? 'N/A'}');
|
||||
print('Tags: ${deviceData['tags'] ?? 'N/A'}');
|
||||
print('Display: ${deviceData['display'] ?? 'N/A'}');
|
||||
print('--------------------');
|
||||
void getDeviceSerialNumber() async {
|
||||
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
|
||||
if (Platform.isAndroid) {
|
||||
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
|
||||
deviceSerialNumber = androidInfo.serialNumber;
|
||||
box.write(BoxName.deviceInfo, deviceSerialNumber.toString());
|
||||
} else if (Platform.isIOS) {
|
||||
IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
|
||||
deviceSerialNumber = iosInfo.identifierForVendor!;
|
||||
box.write(BoxName.deviceInfo, deviceSerialNumber.toString());
|
||||
}
|
||||
print(deviceSerialNumber);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/constant/links.dart';
|
||||
import 'package:SEFER/constant/style.dart';
|
||||
import 'package:SEFER/controller/functions/crud.dart';
|
||||
import 'package:SEFER/controller/functions/device_info.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
import 'package:SEFER/views/home/Captin/home_captain/home_captin.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -197,7 +198,10 @@ class AI extends GetxController {
|
||||
await addRegistrationCarEgypt();
|
||||
|
||||
if (isCarSaved && isDriverSaved) {
|
||||
Get.to(() => HomeCaptain());
|
||||
DeviceController().getDeviceSerialNumber();
|
||||
box.write(BoxName.phoneVerified, '1');
|
||||
Get.offAll(() => const MyApp());
|
||||
// Get.offAll(() => HomeCaptain());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -520,8 +524,7 @@ class AI extends GetxController {
|
||||
final response = await http.post(
|
||||
Uri.parse('https://api.anthropic.com/v1/messages'),
|
||||
headers: {
|
||||
'x-api-key':
|
||||
'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',
|
||||
'x-api-key': AK.anthropicAIkeySeferNew,
|
||||
'anthropic-version': '2023-06-01',
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import 'dart:async';
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/constant/colors.dart';
|
||||
import 'package:SEFER/controller/auth/captin/login_captin_controller.dart';
|
||||
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
||||
import 'package:background_location/background_location.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
@@ -13,7 +12,7 @@ class LocationBackgroundController extends GetxController {
|
||||
@override
|
||||
Future<void> onInit() async {
|
||||
super.onInit();
|
||||
// await requestLocationPermission();
|
||||
await requestLocationPermission();
|
||||
await configureBackgroundLocation();
|
||||
}
|
||||
|
||||
@@ -23,10 +22,33 @@ class LocationBackgroundController extends GetxController {
|
||||
|
||||
if (status == PermissionStatus.denied ||
|
||||
status == PermissionStatus.restricted) {
|
||||
// Request permission
|
||||
status = await Permission.locationAlways.request();
|
||||
print('Requested status: $status');
|
||||
// Show dialog to inform the driver about background GPS location usage
|
||||
await Get.dialog(
|
||||
AlertDialog(
|
||||
title: Text('Location Permission'.tr),
|
||||
content: Text(
|
||||
'We use GPS location in the background to enable you to receive orders.'
|
||||
.tr),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
Get.back(); // Close the dialog
|
||||
// Request permission
|
||||
status = await Permission.locationAlways.request();
|
||||
print('Requested status: $status');
|
||||
_handlePermissionStatus(status);
|
||||
},
|
||||
child: Text('OK'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
} else {
|
||||
_handlePermissionStatus(status);
|
||||
}
|
||||
}
|
||||
|
||||
void _handlePermissionStatus(PermissionStatus status) async {
|
||||
status = await Permission.locationAlways.status;
|
||||
if (!status.isGranted) {
|
||||
// Open app settings if permission is permanently denied
|
||||
|
||||
@@ -15,7 +15,7 @@ class SmsEgyptController extends GetxController {
|
||||
Future<dynamic> sendSmsEgypt(String phone, otp) async {
|
||||
var body = jsonEncode({
|
||||
"username": AppInformation.appName,
|
||||
"password": AK.smsPassword,
|
||||
"password": 'E)Pu=an/@Z', // AK.smsPasswordEgypt,
|
||||
"message": "${AppInformation.appName} app code is $otp\ncopy it to app",
|
||||
"language": box.read(BoxName.lang) == 'en' ? "e" : 'r',
|
||||
"sender": "Kazumi", // todo add sefer sender name
|
||||
@@ -31,6 +31,7 @@ class SmsEgyptController extends GetxController {
|
||||
print(res.reasonPhrase);
|
||||
print(res.request);
|
||||
print(res.body);
|
||||
print(body);
|
||||
if (res.statusCode == 200) {
|
||||
Get.defaultDialog(
|
||||
title: 'You will recieve code in sms message'.tr,
|
||||
@@ -48,7 +49,7 @@ class SmsEgyptController extends GetxController {
|
||||
Uri.parse(AppLink.checkCredit),
|
||||
body: {
|
||||
"username": AppInformation.appName,
|
||||
"password": AK.smsPassword,
|
||||
"password": AK.smsPasswordEgypt,
|
||||
},
|
||||
headers: headers,
|
||||
);
|
||||
@@ -60,7 +61,7 @@ class SmsEgyptController extends GetxController {
|
||||
Uri.parse(AppLink.checkCredit),
|
||||
body: {
|
||||
"username": AppInformation.appName,
|
||||
"password": AK.smsPassword,
|
||||
"password": AK.smsPasswordEgypt,
|
||||
"message": "This is an example SMS message.",
|
||||
"language": box.read(BoxName.lang) == 'en' ? "e" : 'r',
|
||||
"sender": "Kazumi", // todo add sefer sender name
|
||||
@@ -78,7 +79,7 @@ class SmsEgyptController extends GetxController {
|
||||
Uri.parse(AppLink.checkCredit),
|
||||
body: {
|
||||
"username": AppInformation.appName,
|
||||
"password": AK.smsPassword,
|
||||
"password": AK.smsPasswordEgypt,
|
||||
"smsid": smsid //"00b77dfc-5b8f-474d-9def-9f0158b70f98"
|
||||
},
|
||||
headers: headers,
|
||||
|
||||
@@ -19,7 +19,13 @@ class ImageController extends GetxController {
|
||||
final picker = ImagePicker();
|
||||
var image;
|
||||
choosImage(String link, String imageType) async {
|
||||
final pickedImage = await picker.pickImage(source: ImageSource.gallery);
|
||||
final pickedImage = await picker.pickImage(
|
||||
source: ImageSource.camera,
|
||||
preferredCameraDevice: CameraDevice.rear,
|
||||
// maxHeight: Get.height * .3,
|
||||
// maxWidth: Get.width * .9,
|
||||
// imageQuality: 100,
|
||||
);
|
||||
image = File(pickedImage!.path);
|
||||
|
||||
croppedFile = await ImageCropper().cropImage(
|
||||
|
||||
Reference in New Issue
Block a user