From e72c1741bfda12984dba9406c4fc7614e137570a Mon Sep 17 00:00:00 2001 From: luvletter2333 Date: Tue, 28 Mar 2023 08:51:10 +0800 Subject: [PATCH] fix send logs --- .../messenger/voip/VoIPController.java | 4 +-- .../java/org/telegram/ui/ProfileActivity.java | 25 ++----------------- 2 files changed, 4 insertions(+), 25 deletions(-) diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPController.java b/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPController.java index 61914cfee..ffdd629b9 100755 --- a/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPController.java @@ -193,11 +193,11 @@ public class VoIPController { } private String getLogFilePath(String name) { - return new File(EnvUtil.getTelegramPath(),"logs/" + name + ".log").getPath(); + return new File(ApplicationLoader.applicationContext.getCacheDir(),"logs/" + name + ".log").getPath(); } private String getLogFilePath(long callID){ - return new File(EnvUtil.getTelegramPath(),"logs/" + callID + ".log").getPath(); + return new File(ApplicationLoader.applicationContext.getCacheDir(),"logs/" + callID + ".log").getPath(); } public String getDebugLog() { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java index 94faa54c4..8bcc3735d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java @@ -9109,28 +9109,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. } if (finished[0]) { - Uri uri; - if (Build.VERSION.SDK_INT >= 24) { - uri = FileProvider.getUriForFile(activity, ApplicationLoader.getApplicationId() + ".provider", zipFile); - } else { - uri = Uri.fromFile(zipFile); - } - - Intent i = new Intent(Intent.ACTION_SEND); - if (Build.VERSION.SDK_INT >= 24) { - i.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - } - i.setType("message/rfc822"); - i.putExtra(Intent.EXTRA_EMAIL, ""); - i.putExtra(Intent.EXTRA_SUBJECT, "Logs from " + LocaleController.getInstance().formatterStats.format(System.currentTimeMillis())); - i.putExtra(Intent.EXTRA_STREAM, uri); - if (activity != null) { - try { - activity.startActivityForResult(Intent.createChooser(i, "Select email application."), 500); - } catch (Exception e) { - FileLog.e(e); - } - } + ShareUtil.shareFile(activity, zipFile); } else { if (activity != null) { Toast.makeText(activity, LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred), Toast.LENGTH_SHORT).show(); @@ -9624,7 +9603,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. } else if (position == sendLogsRow) { textCell.setTextAndIcon(LocaleController.getString("DebugSendLogs", R.string.DebugSendLogs), R.drawable.baseline_bug_report_24, true); } else if (position == sendLastLogsRow) { - textCell.setText(LocaleController.getString("DebugSendLastLogs", R.string.DebugSendLastLogs), true); + textCell.setTextAndIcon(LocaleController.getString("DebugSendLastLogs", R.string.DebugSendLastLogs), R.drawable.baseline_bug_report_24 ,true); } else if (position == clearLogsRow) { textCell.setTextAndIcon(LocaleController.getString("DebugClearLogs", R.string.DebugClearLogs), R.drawable.baseline_delete_sweep_24, switchBackendRow != -1); } else if (position == switchBackendRow) {