Fixed iOS sharing
This commit is contained in:
@@ -199,25 +199,20 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
t.row();
|
t.row();
|
||||||
|
|
||||||
t.button("@crash.export", Icon.upload, style, () -> {
|
t.button("@crash.export", Icon.upload, style, () -> {
|
||||||
if(settings.getDataDirectory().child("crashes").list().length == 0){
|
if(settings.getDataDirectory().child("crashes").list().length == 0 && !settings.getDataDirectory().child("last_log.txt").exists()){
|
||||||
ui.showInfo("@crash.none");
|
ui.showInfo("@crash.none");
|
||||||
|
}else{
|
||||||
|
if(ios){
|
||||||
|
Fi logs = tmpDirectory.child("logs.txt");
|
||||||
|
logs.writeString(getLogs());
|
||||||
|
platform.shareFile(logs);
|
||||||
}else{
|
}else{
|
||||||
platform.showFileChooser(false, "txt", file -> {
|
platform.showFileChooser(false, "txt", file -> {
|
||||||
Fi log = settings.getDataDirectory().child("last_log.txt");
|
file.writeString(getLogs());
|
||||||
|
|
||||||
StringBuilder out = new StringBuilder();
|
|
||||||
for(Fi fi : settings.getDataDirectory().child("crashes").list()){
|
|
||||||
out.append(fi.name()).append("\n\n").append(fi.readString()).append("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(log.exists()){
|
|
||||||
out.append("\nlast log:\n").append(log.readString());
|
|
||||||
}
|
|
||||||
|
|
||||||
file.writeString(out.toString());
|
|
||||||
app.post(() -> ui.showInfo("@crash.exported"));
|
app.post(() -> ui.showInfo("@crash.exported"));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}).marginLeft(4);
|
}).marginLeft(4);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -250,6 +245,21 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
addSettings();
|
addSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getLogs(){
|
||||||
|
Fi log = settings.getDataDirectory().child("last_log.txt");
|
||||||
|
|
||||||
|
StringBuilder out = new StringBuilder();
|
||||||
|
for(Fi fi : settings.getDataDirectory().child("crashes").list()){
|
||||||
|
out.append(fi.name()).append("\n\n").append(fi.readString()).append("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(log.exists()){
|
||||||
|
out.append("\nlast log:\n").append(log.readString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return out.toString();
|
||||||
|
}
|
||||||
|
|
||||||
void rebuildMenu(){
|
void rebuildMenu(){
|
||||||
menu.clearChildren();
|
menu.clearChildren();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user