diff --git a/core/src/io/anuke/mindustry/core/Platform.java b/core/src/io/anuke/mindustry/core/Platform.java
index 8ded30670e..5f88611cd3 100644
--- a/core/src/io/anuke/mindustry/core/Platform.java
+++ b/core/src/io/anuke/mindustry/core/Platform.java
@@ -1,6 +1,6 @@
package io.anuke.mindustry.core;
-import com.badlogic.gdx.graphics.Pixmap;
+import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.utils.Base64Coder;
import io.anuke.mindustry.core.ThreadHandler.ThreadProvider;
import io.anuke.ucore.core.Settings;
@@ -61,8 +61,8 @@ public abstract class Platform {
}
return Base64Coder.decode(uuid);
}
- /**Only used for iOS or android: open the share menu for a map pixmap.*/
- public void shareImage(Pixmap pixmap){}
+ /**Only used for iOS or android: open the share menu for a map or save.*/
+ public void shareFile(FileHandle file){}
/**Use the default thread provider from the kryonet module for this.*/
public ThreadProvider getThreadProvider(){
return new ThreadProvider() {
diff --git a/core/src/io/anuke/mindustry/mapeditor/MapEditorDialog.java b/core/src/io/anuke/mindustry/mapeditor/MapEditorDialog.java
index e55e0bc7e6..ed02ad4cbf 100644
--- a/core/src/io/anuke/mindustry/mapeditor/MapEditorDialog.java
+++ b/core/src/io/anuke/mindustry/mapeditor/MapEditorDialog.java
@@ -1,5 +1,6 @@
package io.anuke.mindustry.mapeditor;
+import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Pixmap;
@@ -235,8 +236,14 @@ public class MapEditorDialog extends Dialog{
//iOS doesn't really support saving raw files. Sharing is used instead.
if(!ios){
saveFile.show();
- }else {
- Platform.instance.shareImage(editor.pixmap());
+ }else{
+ try{
+ FileHandle file = Gdx.files.local(("map-" + ((editor.getMap().name == null) ? "unknown" : editor.getMap().name) + ".png"));
+ Pixmaps.write(editor.pixmap(), file);
+ Platform.instance.shareFile(file);
+ }catch (Exception e){
+ ui.showError(Bundles.format("text.editor.errorimagesave", Strings.parseException(e, false)));
+ }
}
}).text("$text.editor.saveimage");
diff --git a/core/src/io/anuke/mindustry/ui/dialogs/ChangelogDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/ChangelogDialog.java
index eebb618aca..6da2480aa3 100644
--- a/core/src/io/anuke/mindustry/ui/dialogs/ChangelogDialog.java
+++ b/core/src/io/anuke/mindustry/ui/dialogs/ChangelogDialog.java
@@ -25,7 +25,6 @@ public class ChangelogDialog extends FloatingDialog{
content().add("$text.changelog.loading");
if(!ios) {
-
Changelogs.getChangelog(result -> {
versions = result;
Gdx.app.postRunnable(this::setup);
diff --git a/core/src/io/anuke/mindustry/ui/dialogs/LoadDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/LoadDialog.java
index a7e7b653cc..93319d54fc 100644
--- a/core/src/io/anuke/mindustry/ui/dialogs/LoadDialog.java
+++ b/core/src/io/anuke/mindustry/ui/dialogs/LoadDialog.java
@@ -1,7 +1,10 @@
package io.anuke.mindustry.ui.dialogs;
+import com.badlogic.gdx.Gdx;
+import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.core.GameState.State;
+import io.anuke.mindustry.core.Platform;
import io.anuke.mindustry.io.SaveIO;
import io.anuke.mindustry.io.Saves.SaveSlot;
import io.anuke.ucore.core.Core;
@@ -83,14 +86,24 @@ public class LoadDialog extends FloatingDialog{
if(!gwt) {
t.addImageButton("icon-save", "empty", 14 * 3, () -> {
- new FileChooser("$text.save.export", false, file -> {
- try {
- slot.exportFile(file);
- setup();
- } catch (IOException e) {
- ui.showError(Bundles.format("text.save.export.fail", Strings.parseException(e, false)));
- }
- }).show();
+ if(!ios) {
+ new FileChooser("$text.save.export", false, file -> {
+ try {
+ slot.exportFile(file);
+ setup();
+ } catch (IOException e) {
+ ui.showError(Bundles.format("text.save.export.fail", Strings.parseException(e, false)));
+ }
+ }).show();
+ }else{
+ try {
+ FileHandle file = Gdx.files.local("save-" + slot.getName() + ".mins");
+ slot.exportFile(file);
+ Platform.instance.shareFile(file);
+ }catch (Exception e){
+ ui.showError(Bundles.format("text.save.export.fail", Strings.parseException(e, false)));
+ }
+ }
}).size(14 * 3).right();
}
@@ -134,7 +147,7 @@ public class LoadDialog extends FloatingDialog{
slots.row();
- if(gwt) return;
+ if(gwt || ios) return;
slots.addImageTextButton("$text.save.import", "icon-add", "clear", 14*3, () -> {
new FileChooser("$text.save.import", f -> f.extension().equals("mins"), true, file -> {
diff --git a/ios/Info.plist.xml b/ios/Info.plist.xml
index dda5b181f8..7a3b643a2f 100644
--- a/ios/Info.plist.xml
+++ b/ios/Info.plist.xml
@@ -67,6 +67,27 @@
+
+ UTExportedTypeDeclarations
+
+
+ UTTypeConformsTo
+
+ public.data
+
+ UTTypeDescription
+ Mindustry Save File
+ UTTypeIdentifier
+ io.anuke.mindustry.savefile
+ UTTypeTagSpecification
+
+ public.filename-extension
+ mins
+ public.mime-type
+ mindustry/mins
+
+
+