mirror of
				https://github.com/immich-app/immich.git
				synced 2025-11-03 19:29:32 -05:00 
			
		
		
		
	Show correct device type when registering new device
This commit is contained in:
		
							parent
							
								
									c624580596
								
							
						
					
					
						commit
						e13d4a6b9c
					
				@ -1,27 +1,18 @@
 | 
				
			|||||||
import 'package:device_info_plus/device_info_plus.dart';
 | 
					import 'package:device_info_plus/device_info_plus.dart';
 | 
				
			||||||
import 'package:flutter_udid/flutter_udid.dart';
 | 
					import 'package:flutter_udid/flutter_udid.dart';
 | 
				
			||||||
import 'package:flutter/material.dart';
 | 
					import 'dart:io' show Platform;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class DeviceInfoService {
 | 
					class DeviceInfoService {
 | 
				
			||||||
  Future<Map<String, dynamic>> getDeviceInfo() async {
 | 
					  Future<Map<String, dynamic>> getDeviceInfo() async {
 | 
				
			||||||
    // Get device info
 | 
					    // Get device info
 | 
				
			||||||
    DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
 | 
					    DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
 | 
				
			||||||
    String? deviceId = "";
 | 
					    String deviceId = await FlutterUdid.consistentUdid;
 | 
				
			||||||
    String deviceType = "";
 | 
					    String deviceType = "";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    try {
 | 
					    if (Platform.isAndroid) {
 | 
				
			||||||
      deviceId = await FlutterUdid.consistentUdid;
 | 
					 | 
				
			||||||
      deviceType = "ANDROID";
 | 
					      deviceType = "ANDROID";
 | 
				
			||||||
    } catch (e) {
 | 
					    } else if (Platform.isIOS) {
 | 
				
			||||||
      debugPrint("Not an android device");
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    try {
 | 
					 | 
				
			||||||
      deviceId = await FlutterUdid.consistentUdid;
 | 
					 | 
				
			||||||
      deviceType = "IOS";
 | 
					      deviceType = "IOS";
 | 
				
			||||||
      debugPrint("Device ID: $deviceId");
 | 
					 | 
				
			||||||
    } catch (e) {
 | 
					 | 
				
			||||||
      debugPrint("Not an ios device");
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return {"deviceId": deviceId, "deviceType": deviceType};
 | 
					    return {"deviceId": deviceId, "deviceType": deviceType};
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user