mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-26 16:46:51 +08:00
Log device info
This way it's easier to debug user's issues
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:device_info/device_info.dart';
|
||||
import 'package:firebase_analytics/firebase_analytics.dart';
|
||||
|
||||
import 'package:gitjournal/app.dart';
|
||||
@ -220,3 +221,53 @@ class AnalyticsRouteObserver extends RouteObserver<PageRoute<dynamic>> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This should be provided by device_info
|
||||
Map<String, dynamic> readAndroidBuildData(AndroidDeviceInfo build) {
|
||||
return <String, dynamic>{
|
||||
'version.securityPatch': build.version.securityPatch,
|
||||
'version.sdkInt': build.version.sdkInt,
|
||||
'version.release': build.version.release,
|
||||
'version.previewSdkInt': build.version.previewSdkInt,
|
||||
'version.incremental': build.version.incremental,
|
||||
'version.codename': build.version.codename,
|
||||
'version.baseOS': build.version.baseOS,
|
||||
'board': build.board,
|
||||
'bootloader': build.bootloader,
|
||||
'brand': build.brand,
|
||||
'device': build.device,
|
||||
'display': build.display,
|
||||
'fingerprint': build.fingerprint,
|
||||
'hardware': build.hardware,
|
||||
'host': build.host,
|
||||
'id': build.id,
|
||||
'manufacturer': build.manufacturer,
|
||||
'model': build.model,
|
||||
'product': build.product,
|
||||
'supported32BitAbis': build.supported32BitAbis,
|
||||
'supported64BitAbis': build.supported64BitAbis,
|
||||
'supportedAbis': build.supportedAbis,
|
||||
'tags': build.tags,
|
||||
'type': build.type,
|
||||
'isPhysicalDevice': build.isPhysicalDevice,
|
||||
'androidId': build.androidId,
|
||||
'systemFeatures': build.systemFeatures,
|
||||
};
|
||||
}
|
||||
|
||||
Map<String, dynamic> readIosDeviceInfo(IosDeviceInfo data) {
|
||||
return <String, dynamic>{
|
||||
'name': data.name,
|
||||
'systemName': data.systemName,
|
||||
'systemVersion': data.systemVersion,
|
||||
'model': data.model,
|
||||
'localizedModel': data.localizedModel,
|
||||
'identifierForVendor': data.identifierForVendor,
|
||||
'isPhysicalDevice': data.isPhysicalDevice,
|
||||
'utsname.sysname:': data.utsname.sysname,
|
||||
'utsname.nodename:': data.utsname.nodename,
|
||||
'utsname.release:': data.utsname.release,
|
||||
'utsname.version:': data.utsname.version,
|
||||
'utsname.machine:': data.utsname.machine,
|
||||
};
|
||||
}
|
||||
|
@ -96,9 +96,13 @@ class JournalApp extends StatefulWidget {
|
||||
if (Platform.isAndroid) {
|
||||
var info = await deviceInfo.androidInfo;
|
||||
isPhysicalDevice = info.isPhysicalDevice;
|
||||
|
||||
Log.i("Running on Android", props: readAndroidBuildData(info));
|
||||
} else if (Platform.isIOS) {
|
||||
var info = await deviceInfo.iosInfo;
|
||||
isPhysicalDevice = info.isPhysicalDevice;
|
||||
|
||||
Log.i("Running on ios", props: readIosDeviceInfo(info));
|
||||
}
|
||||
} catch (e) {
|
||||
Log.d(e);
|
||||
|
@ -57,6 +57,9 @@ class Log {
|
||||
stacktrace = Trace.from(stacktrace).terse;
|
||||
|
||||
if (foundation.kDebugMode) {
|
||||
if (props != null && props.isNotEmpty) {
|
||||
msg += " $props";
|
||||
}
|
||||
Fimber.log("I", msg,
|
||||
ex: ex, stacktrace: stacktrace, tag: LogTree.getTag(stackIndex: 2));
|
||||
}
|
||||
|
Reference in New Issue
Block a user