5/29/1
This commit is contained in:
@@ -1,104 +1,104 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
|
||||
class DeviceInfoPlus {
|
||||
static List<Map<String, dynamic>> deviceDataList = [];
|
||||
|
||||
static Future<List<Map<String, dynamic>>> getDeviceInfo() async {
|
||||
final DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
|
||||
|
||||
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('--------------------');
|
||||
}
|
||||
}
|
||||
}
|
||||
// import 'dart:io';
|
||||
//
|
||||
// import 'package:device_info_plus/device_info_plus.dart';
|
||||
//
|
||||
// class DeviceInfoPlus {
|
||||
// static List<Map<String, dynamic>> deviceDataList = [];
|
||||
//
|
||||
// static Future<List<Map<String, dynamic>>> getDeviceInfo() async {
|
||||
// final DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
|
||||
//
|
||||
// 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('--------------------');
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -907,7 +907,8 @@ class MapPassengerController extends GetxController {
|
||||
rideConfirm = true;
|
||||
shouldFetch = true;
|
||||
isBottomSheetShown = false;
|
||||
timeToPassengerFromDriverAfterApplied = 60;
|
||||
timeToPassengerFromDriverAfterApplied =
|
||||
durationToPassenger; //60 todo durationToPassenger;/
|
||||
isDriversTokensSend = false;
|
||||
|
||||
update();
|
||||
@@ -1337,7 +1338,7 @@ class MapPassengerController extends GetxController {
|
||||
for (var i = 0; i < loopCount; i++) {
|
||||
// Wait for 50 seconds.
|
||||
await Future.delayed(const Duration(seconds: 4));
|
||||
if (isRideFinished == true) {
|
||||
if (rideTimerBegin == true) {
|
||||
await getDriverCarsLocationToPassengerAfterApplied();
|
||||
}
|
||||
reloadMarkerDriverCarsLocationToPassengerAfterApplied();
|
||||
@@ -1353,7 +1354,7 @@ class MapPassengerController extends GetxController {
|
||||
// Wait for 50 seconds.
|
||||
print('loop is $i from $loopCount');
|
||||
await Future.delayed(const Duration(seconds: 4));
|
||||
if (isRideFinished == true) {
|
||||
if (rideTimerBegin == true) {
|
||||
await getDriverCarsLocationToPassengerAfterApplied();
|
||||
}
|
||||
reloadMarkerDriverCarsLocationToPassengerAfterApplied();
|
||||
@@ -1916,7 +1917,7 @@ class MapPassengerController extends GetxController {
|
||||
i < dataCarsLocationByPassenger['message'].length;
|
||||
i++) {
|
||||
var carLocation = dataCarsLocationByPassenger['message'][i];
|
||||
durationToPassenger = 100; //////
|
||||
|
||||
// Calculate the distance between the passenger's location and the current driver's location
|
||||
final distance = Geolocator.distanceBetween(
|
||||
passengerLocation.latitude,
|
||||
@@ -1924,7 +1925,8 @@ class MapPassengerController extends GetxController {
|
||||
double.parse(carLocation['latitude']),
|
||||
double.parse(carLocation['longitude']),
|
||||
);
|
||||
|
||||
durationToPassenger = (distance * 35 * (1000 / 3600))
|
||||
.round(); //////35 is avg of speed in city
|
||||
// Update the UI with the distance and duration
|
||||
update();
|
||||
|
||||
@@ -2599,8 +2601,12 @@ class MapPassengerController extends GetxController {
|
||||
payload: {'passenger_id': box.read(BoxName.passengerID)});
|
||||
if (res != 'failure') {
|
||||
print(jsonDecode(res)['message']['rating']);
|
||||
passengerRate =
|
||||
double.parse(jsonDecode(res)['message']['rating'].toString());
|
||||
if (jsonDecode(res)['message']['rating'] == null) {
|
||||
passengerRate = 5;
|
||||
} else {
|
||||
passengerRate =
|
||||
double.parse(jsonDecode(res)['message']['rating'].toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user