mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 16:05:18 +00:00

* feat: add connect server support * feat: add ability discover and connect to same network Spotube(s) and sync queue * feat(connect): add player controls, shuffle, loop, progress bar and queue support * feat: make control page adaptive * feat: add volume control support * cd: upgrade macos runner version * chore: upgrade inappwebview version to 6 * feat: customized devices button * feat: add user icon next to devices button * feat: add play in remote device support * feat: show alert when new client connects * fix: ignore the device itself from broadcast list * fix: volume control not working * feat: add ability to select current device's output speaker
35 lines
1002 B
Dart
35 lines
1002 B
Dart
import 'package:device_info_plus/device_info_plus.dart';
|
|
|
|
class DeviceInfoService {
|
|
final DeviceInfoPlugin deviceInfo;
|
|
DeviceInfoService._() : deviceInfo = DeviceInfoPlugin();
|
|
|
|
static final instance = DeviceInfoService._();
|
|
|
|
Future<String> deviceId() async {
|
|
final info = await deviceInfo.deviceInfo;
|
|
|
|
return switch (info) {
|
|
AndroidDeviceInfo() => info.id,
|
|
IosDeviceInfo() => info.identifierForVendor ?? info.model,
|
|
MacOsDeviceInfo() => info.systemGUID ?? info.model,
|
|
WindowsDeviceInfo() => info.deviceId,
|
|
LinuxDeviceInfo() => info.machineId ?? info.id,
|
|
_ => 'Unknown',
|
|
};
|
|
}
|
|
|
|
Future<String> computerName() async {
|
|
final info = await deviceInfo.deviceInfo;
|
|
|
|
return switch (info) {
|
|
AndroidDeviceInfo() => info.model,
|
|
IosDeviceInfo() => info.localizedModel,
|
|
MacOsDeviceInfo() => info.computerName,
|
|
WindowsDeviceInfo() => info.computerName,
|
|
LinuxDeviceInfo() => info.name,
|
|
_ => 'Unknown',
|
|
};
|
|
}
|
|
}
|