mirror of
				https://github.com/AppFlowy-IO/AppFlowy.git
				synced 2025-10-31 01:54:37 +00:00 
			
		
		
		
	 77637ff461
			
		
	
	
		77637ff461
		
			
		
	
	
	
	
		
			
			* test: add supabase auth tests * chore: format before test * chore: fix warnings * ci: rust test * chore: disable clicking get started button when logining through the google OAuth
		
			
				
	
	
		
			38 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
| import 'dart:io';
 | |
| 
 | |
| import 'package:appflowy/startup/startup.dart';
 | |
| import 'package:appflowy_backend/log.dart';
 | |
| import 'package:device_info_plus/device_info_plus.dart';
 | |
| import 'package:flutter/services.dart';
 | |
| 
 | |
| final DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
 | |
| 
 | |
| Future<String> getDeviceId() async {
 | |
|   if (integrationMode().isTest) {
 | |
|     return "test_device_id";
 | |
|   }
 | |
| 
 | |
|   String deviceId = "";
 | |
|   try {
 | |
|     if (Platform.isAndroid) {
 | |
|       final AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
 | |
|       deviceId = androidInfo.device;
 | |
|     } else if (Platform.isIOS) {
 | |
|       final IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
 | |
|       deviceId = iosInfo.identifierForVendor ?? "";
 | |
|     } else if (Platform.isMacOS) {
 | |
|       final MacOsDeviceInfo macInfo = await deviceInfo.macOsInfo;
 | |
|       deviceId = macInfo.systemGUID ?? "";
 | |
|     } else if (Platform.isWindows) {
 | |
|       final WindowsDeviceInfo windowsInfo = await deviceInfo.windowsInfo;
 | |
|       deviceId = windowsInfo.computerName;
 | |
|     } else if (Platform.isLinux) {
 | |
|       final LinuxDeviceInfo linuxInfo = await deviceInfo.linuxInfo;
 | |
|       deviceId = linuxInfo.machineId ?? "";
 | |
|     }
 | |
|   } on PlatformException {
 | |
|     Log.error('Failed to get platform version');
 | |
|   }
 | |
|   return deviceId;
 | |
| }
 |