[mob][photos] Log device brand and model

This commit is contained in:
ashilkn
2024-12-16 16:11:57 +05:30
parent ce3e8bf315
commit c4880fd07e
2 changed files with 25 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ import 'package:path_provider/path_provider.dart';
import 'package:photos/core/error-reporting/tunneled_transport.dart';
import "package:photos/core/errors.dart";
import 'package:photos/models/typedefs.dart';
import "package:photos/utils/device_info.dart";
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:shared_preferences/shared_preferences.dart';
@@ -198,6 +199,12 @@ class SuperLogging {
$.info("sentry uploader started");
}
unawaited(
getDeviceName().then((name) {
$.info("Device name: $name");
}),
);
if (appConfig.body == null) return;
if (enable && sentryIsEnabled) {

View File

@@ -50,3 +50,21 @@ Future<bool> isAndroidSDKVersionLowerThan(int inputSDK) async {
return false;
}
}
Future<String?> getDeviceName() async {
try {
if (Platform.isIOS) {
final IosDeviceInfo iosInfo = await deviceInfoPlugin.iosInfo;
return iosInfo.utsname.machine;
} else if (Platform.isAndroid) {
final AndroidDeviceInfo androidInfo = await deviceInfoPlugin.androidInfo;
return "${androidInfo.brand} ${androidInfo.model}";
} else {
return "Not iOS or Android";
}
} catch (e) {
Logger("device_info").severe("deviceSpec check failed", e);
return null;
}
}