mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-07-24 01:18:56 +00:00

* feat: support collab selection * feat: collab cusro/selection * chore: add metadata field * feat: support displaying user name above cursor * fix: emit error * feat: support displaying collaborators * feat: sync collaborator * fix: collab doc issues * chore: update deps * feat: refactor device id * chore: enable share button * chore: update collab a816214 * fix: clippy lint * chore: use extension type instead class function * feat: add clear recent views button in debug mode * chore: support clear recent views * feat: support saving the last opened workspace * chore: update collab
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.deviceId;
|
|
} else if (Platform.isLinux) {
|
|
final LinuxDeviceInfo linuxInfo = await deviceInfo.linuxInfo;
|
|
deviceId = linuxInfo.machineId;
|
|
}
|
|
} on PlatformException {
|
|
Log.error('Failed to get platform version');
|
|
}
|
|
return deviceId ?? '';
|
|
}
|