diff --git a/build.gradle b/build.gradle
index 7bc56367ea..028189f58f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -38,7 +38,7 @@ allprojects{
}
getArcHash = {
- return new Properties().with{ p -> p.load(new File((File)projectDir, 'gradle.properties').newReader()); return p }["archash"]
+ return new Properties().with{ p -> p.load(file('gradle.properties').newReader()); return p }["archash"]
}
arcModule = { String name ->
@@ -200,7 +200,7 @@ project(":core"){
}
dependencies{
- if(System.properties["user.name"] == "anuke"){
+ if(System.properties["user.name"] == "anuke2"){
task cleanGen{
doFirst{
delete{
diff --git a/core/src/io/anuke/mindustry/editor/MapEditorDialog.java b/core/src/io/anuke/mindustry/editor/MapEditorDialog.java
index 773ce88749..461de87844 100644
--- a/core/src/io/anuke/mindustry/editor/MapEditorDialog.java
+++ b/core/src/io/anuke/mindustry/editor/MapEditorDialog.java
@@ -85,37 +85,35 @@ public class MapEditorDialog extends Dialog implements Disposable{
t.row();
- if(!ios){
- t.addImageTextButton("$editor.import", Icon.loadMapSmall, () ->
- createDialog("$editor.import",
- "$editor.importmap", "$editor.importmap.description", Icon.loadMap, (Runnable)loadDialog::show,
- "$editor.importfile", "$editor.importfile.description", Icon.file, (Runnable)() ->
- platform.showFileChooser(true, mapExtension, file -> ui.loadAnd(() -> {
- maps.tryCatchMapError(() -> {
- if(MapIO.isImage(file)){
- ui.showInfo("$editor.errorimage");
- }else{
- editor.beginEdit(MapIO.createMap(file, true));
- }
- });
- })),
-
- "$editor.importimage", "$editor.importimage.description", Icon.fileImage, (Runnable)() ->
- platform.showFileChooser(true, "png", file ->
- ui.loadAnd(() -> {
- try{
- Pixmap pixmap = new Pixmap(file);
- editor.beginEdit(pixmap);
- pixmap.dispose();
- }catch(Exception e){
- ui.showException("$editor.errorload", e);
- Log.err(e);
+ t.addImageTextButton("$editor.import", Icon.loadMapSmall, () ->
+ createDialog("$editor.import",
+ "$editor.importmap", "$editor.importmap.description", Icon.loadMap, (Runnable)loadDialog::show,
+ "$editor.importfile", "$editor.importfile.description", Icon.file, (Runnable)() ->
+ platform.showFileChooser(true, mapExtension, file -> ui.loadAnd(() -> {
+ maps.tryCatchMapError(() -> {
+ if(MapIO.isImage(file)){
+ ui.showInfo("$editor.errorimage");
+ }else{
+ editor.beginEdit(MapIO.createMap(file, true));
}
- })))
- );
- }
+ });
+ })),
- Cell cell = t.addImageTextButton("$editor.export", Icon.saveMapSmall, () -> {
+ "$editor.importimage", "$editor.importimage.description", Icon.fileImage, (Runnable)() ->
+ platform.showFileChooser(true, "png", file ->
+ ui.loadAnd(() -> {
+ try{
+ Pixmap pixmap = new Pixmap(file);
+ editor.beginEdit(pixmap);
+ pixmap.dispose();
+ }catch(Exception e){
+ ui.showException("$editor.errorload", e);
+ Log.err(e);
+ }
+ })))
+ );
+
+ t.addImageTextButton("$editor.export", Icon.saveMapSmall, () -> {
if(!ios){
platform.showFileChooser(false, mapExtension, file -> {
ui.loadAnd(() -> {
@@ -143,10 +141,6 @@ public class MapEditorDialog extends Dialog implements Disposable{
});
}
});
-
- if(ios){
- cell.size(swidth * 2f + 10, 60f).colspan(2);
- }
});
menu.cont.row();
diff --git a/core/src/io/anuke/mindustry/ui/dialogs/SettingsMenuDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/SettingsMenuDialog.java
index 28226b215d..a430eb1b21 100644
--- a/core/src/io/anuke/mindustry/ui/dialogs/SettingsMenuDialog.java
+++ b/core/src/io/anuke/mindustry/ui/dialogs/SettingsMenuDialog.java
@@ -126,24 +126,21 @@ public class SettingsMenuDialog extends SettingsDialog{
t.row();
- //iOS doesn't have a file chooser.
- //if(!ios){
- t.addButton("$data.import", style, () -> ui.showConfirm("$confirm", "$data.import.confirm", () -> platform.showFileChooser(true, "zip", file -> {
- try{
- data.importData(file);
- Core.app.exit();
- }catch(IllegalArgumentException e){
+ t.addButton("$data.import", style, () -> ui.showConfirm("$confirm", "$data.import.confirm", () -> platform.showFileChooser(true, "zip", file -> {
+ try{
+ data.importData(file);
+ Core.app.exit();
+ }catch(IllegalArgumentException e){
+ ui.showErrorMessage("$data.invalid");
+ }catch(Exception e){
+ e.printStackTrace();
+ if(e.getMessage() == null || !e.getMessage().contains("too short")){
+ ui.showException(e);
+ }else{
ui.showErrorMessage("$data.invalid");
- }catch(Exception e){
- e.printStackTrace();
- if(e.getMessage() == null || !e.getMessage().contains("too short")){
- ui.showException(e);
- }else{
- ui.showErrorMessage("$data.invalid");
- }
}
- })));
- //}
+ }
+ })));
});
ScrollPane pane = new ScrollPane(prefs);
diff --git a/ios/Info.plist.xml b/ios/Info.plist.xml
index 7c7ba53d60..0ab706af32 100644
--- a/ios/Info.plist.xml
+++ b/ios/Info.plist.xml
@@ -74,22 +74,22 @@
-
-
- CFBundleTypeIconFiles
-
- icon-72.png
-
- CFBundleTypeName
- Zip Data File
- LSHandlerRank
- Alternate
- LSItemContentTypes
-
- public.archive
-
-
-
+
+ CFBundleTypeIconFiles
+
+ icon-72.png
+
+ CFBundleTypeName
+ Zip Game Data
+ CFBundleTypeRole
+ Editor
+ LSHandlerRank
+ Owner
+ LSItemContentTypes
+
+ public.archive
+
+
UTExportedTypeDeclarations
diff --git a/ios/src/io/anuke/mindustry/IOSLauncher.java b/ios/src/io/anuke/mindustry/IOSLauncher.java
index 17bb408c13..6867ff01f7 100644
--- a/ios/src/io/anuke/mindustry/IOSLauncher.java
+++ b/ios/src/io/anuke/mindustry/IOSLauncher.java
@@ -13,6 +13,7 @@ import io.anuke.mindustry.io.*;
import io.anuke.mindustry.ui.*;
import org.robovm.apple.foundation.*;
import org.robovm.apple.uikit.*;
+import org.robovm.apple.uikit.UIBarButtonItem.*;
import org.robovm.objc.block.*;
import java.io.*;
@@ -39,10 +40,15 @@ public class IOSLauncher extends IOSApplication.Delegate{
@Override
public void showFileChooser(boolean open, String extension, Consumer cons){
- UIDocumentBrowserViewController cont = new UIDocumentBrowserViewController(NSArray.fromStrings("public.archive"));
+ UIDocumentBrowserViewController cont = new UIDocumentBrowserViewController((NSArray)null);
- cont.setAllowsDocumentCreation(false);
- cont.setDelegate(new UIDocumentBrowserViewControllerDelegate(){
+ NSArray arr = new NSArray<>(new UIBarButtonItem(Core.bundle.get("cancel"), UIBarButtonItemStyle.Plain,
+ uiBarButtonItem -> cont.dismissViewController(true, () -> {})));
+
+ cont.setAllowsDocumentCreation(!open);
+ cont.setAdditionalLeadingNavigationBarButtonItems(arr);
+
+ class ChooserDelegate extends NSObject implements UIDocumentBrowserViewControllerDelegate{
@Override
public void didPickDocumentURLs(UIDocumentBrowserViewController controller, NSArray documentURLs){
@@ -50,7 +56,10 @@ public class IOSLauncher extends IOSApplication.Delegate{
@Override
public void didPickDocumentsAtURLs(UIDocumentBrowserViewController controller, NSArray documentURLs){
+ if(documentURLs.size() < 1) return;
+ cont.dismissViewController(true, () -> {});
+ cons.accept(Core.files.absolute(documentURLs.get(0).getPath()));
}
@Override
@@ -77,7 +86,9 @@ public class IOSLauncher extends IOSApplication.Delegate{
public void willPresentActivityViewController(UIDocumentBrowserViewController controller, UIActivityViewController activityViewController){
}
- });
+ }
+
+ cont.setDelegate(new ChooserDelegate());
UIApplication.getSharedApplication().getKeyWindow().getRootViewController().presentViewController(cont, true, () -> {
});