mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-22 20:48:33 +07:00
Possible iOS sharing fix
This commit is contained in:
parent
1a22eae21a
commit
2bd892d880
@ -141,11 +141,15 @@ public class IOSLauncher extends IOSApplication.Delegate{
|
||||
public void shareFile(Fi file){
|
||||
try{
|
||||
Log.info("Attempting to share file " + file);
|
||||
Fi to = Core.files.absolute(getDocumentsDirectory()).child(file.name());
|
||||
file.copyTo(to);
|
||||
List<Object> list = new ArrayList<>();
|
||||
|
||||
NSURL url = new NSURL(to.file());
|
||||
UIActivityViewController p = new UIActivityViewController(Collections.singletonList(url), null);
|
||||
list.add(file.name());
|
||||
list.add(NSData.read(file.file()));
|
||||
|
||||
//better choice?
|
||||
//list.add(new NSURL(file.file()));
|
||||
|
||||
UIActivityViewController p = new UIActivityViewController(list, null);
|
||||
UIViewController rootVc = UIApplication.getSharedApplication().getKeyWindow().getRootViewController();
|
||||
if(UIDevice.getCurrentDevice().getUserInterfaceIdiom() == UIUserInterfaceIdiom.Pad){
|
||||
// Set up the pop-over for iPad
|
||||
@ -156,7 +160,7 @@ public class IOSLauncher extends IOSApplication.Delegate{
|
||||
pop.setSourceRect(targetRect);
|
||||
pop.setPermittedArrowDirections(UIPopoverArrowDirection.None);
|
||||
}
|
||||
rootVc.presentViewController(p, true, () -> Log.info("Success! Presented @", to));
|
||||
rootVc.presentViewController(p, true, () -> Log.info("Success! Presented @", file));
|
||||
}catch(Throwable t){
|
||||
ui.showException(t);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user