Skip to content

Commit

Permalink
fix send logs
Browse files Browse the repository at this point in the history
  • Loading branch information
luvletter2333 committed Mar 28, 2023
1 parent 6a5b90e commit e72c174
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,11 @@ public static String getVersion() {
}

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() {
Expand Down
25 changes: 2 additions & 23 deletions TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -9109,28 +9109,7 @@ public static void sendLogs(Activity activity, boolean last) {

}
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();
Expand Down Expand Up @@ -9624,7 +9603,7 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
} 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) {
Expand Down

0 comments on commit e72c174

Please sign in to comment.