1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-17 12:22:31 +02:00
immich/mobile/lib/shared/services/device_info.service.dart

24 lines
666 B
Dart
Raw Normal View History

import 'package:flutter_udid/flutter_udid.dart';
import 'dart:io' show Platform;
2022-02-03 18:06:44 +02:00
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:openapi/api.dart';
final deviceInfoServiceProvider = Provider((_) => DeviceInfoService());
2022-02-03 18:06:44 +02:00
class DeviceInfoService {
Future<Map<String, dynamic>> getDeviceInfo() async {
// Get device info
var deviceId = await FlutterUdid.consistentUdid;
var deviceType = DeviceTypeEnum.ANDROID;
2022-02-03 18:06:44 +02:00
if (Platform.isAndroid) {
deviceType = DeviceTypeEnum.ANDROID;
} else if (Platform.isIOS) {
deviceType = DeviceTypeEnum.IOS;
2022-02-03 18:06:44 +02:00
}
return {"deviceId": deviceId, "deviceType": deviceType};
}
}