download static method
- List<
RxSession> ? sessions, - SessionId? sessionId,
- String? userAgent,
- MyUser? myUser,
- DeviceToken? token,
- bool? pushNotifications,
- NotificationSettings? notificationSettings,
Creates and downloads the report as a .txt file.
Implementation
static Future<void> download({
List<RxSession>? sessions,
SessionId? sessionId,
String? userAgent,
MyUser? myUser,
DeviceToken? token,
bool? pushNotifications,
NotificationSettings? notificationSettings,
}) async {
try {
final encoder = Utf8Encoder();
final DateTime utc = DateTime.now().toUtc();
final String app = PlatformUtils.isWeb
? Config.origin
: Config.userAgentProduct;
final file = await PlatformUtils.createAndDownload(
'${app.toLowerCase()}_bug_report_${utc.year.toString().padLeft(4, '0')}.${utc.month.toString().padLeft(2, '0')}.${utc.day.toString().padLeft(2, '0')}_${utc.hour.toString().padLeft(2, '0')}.${utc.minute.toString().padLeft(2, '0')}.${utc.second.toString().padLeft(2, '0')}.log',
encoder.convert(
LogController.report(
sessions: sessions,
sessionId: sessionId,
userAgent: userAgent,
myUser: myUser,
token: token,
pushNotifications: pushNotifications,
notificationSettings: notificationSettings,
),
),
);
if (file != null && PlatformUtils.isMobile) {
await SharePlus.instance.share(ShareParams(files: [XFile(file.path)]));
}
} catch (e) {
MessagePopup.error(e);
}
}