diff --git a/lib/features/settings/subfeatures/customer_support/customer_support_presenter.dart b/lib/features/settings/subfeatures/customer_support/customer_support_presenter.dart index 417eed18..43a810b2 100644 --- a/lib/features/settings/subfeatures/customer_support/customer_support_presenter.dart +++ b/lib/features/settings/subfeatures/customer_support/customer_support_presenter.dart @@ -1,5 +1,6 @@ import 'dart:io'; - +import 'package:flutter/cupertino.dart'; +import 'package:share_plus/share_plus.dart'; import 'package:appinio_social_share/appinio_social_share.dart'; import 'package:datadashwallet/core/core.dart'; import 'package:f_logs/f_logs.dart'; @@ -25,14 +26,23 @@ class CustomerSupportPresenter extends CompletePresenter { loading = true; try { final file = await FLog.exportLogs(); - final newFile = await changeFileName(file, 'axs-wallet.log'); - - await _socialShare.shareToSystem( - translate('export_logs')!, - '', - filePath: newFile.path, + final newFile = await changeFileName( + file, + 'axs-wallet.txt', ); + final Size size = MediaQuery.of(context!).size; + + await Share.shareXFiles([ + XFile( + newFile.path, + mimeType: 'text/plain', + ) + ], + subject: translate('export_logs'), + sharePositionOrigin: + Rect.fromLTWH(0, 0, size.width, size.height / 2)); + addMessage(translate('exported_logs_successfully')); } catch (e, s) { addError(e, s); @@ -41,11 +51,11 @@ class CustomerSupportPresenter extends CompletePresenter { } } - Future changeFileName(File file, String newFileName) { + Future changeFileName(File file, String newFileName) async { var path = file.path; var lastSeparator = path.lastIndexOf(Platform.pathSeparator); var newPath = path.substring(0, lastSeparator + 1) + newFileName; - return file.rename(newPath); + return (await file.rename(newPath)); } Future loadPage() async {