Possible iOS sharing fix
This commit is contained in:
@@ -141,11 +141,15 @@ public class IOSLauncher extends IOSApplication.Delegate{
|
|||||||
public void shareFile(Fi file){
|
public void shareFile(Fi file){
|
||||||
try{
|
try{
|
||||||
Log.info("Attempting to share file " + file);
|
Log.info("Attempting to share file " + file);
|
||||||
Fi to = Core.files.absolute(getDocumentsDirectory()).child(file.name());
|
List<Object> list = new ArrayList<>();
|
||||||
file.copyTo(to);
|
|
||||||
|
|
||||||
NSURL url = new NSURL(to.file());
|
list.add(file.name());
|
||||||
UIActivityViewController p = new UIActivityViewController(Collections.singletonList(url), null);
|
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();
|
UIViewController rootVc = UIApplication.getSharedApplication().getKeyWindow().getRootViewController();
|
||||||
if(UIDevice.getCurrentDevice().getUserInterfaceIdiom() == UIUserInterfaceIdiom.Pad){
|
if(UIDevice.getCurrentDevice().getUserInterfaceIdiom() == UIUserInterfaceIdiom.Pad){
|
||||||
// Set up the pop-over for iPad
|
// Set up the pop-over for iPad
|
||||||
@@ -156,7 +160,7 @@ public class IOSLauncher extends IOSApplication.Delegate{
|
|||||||
pop.setSourceRect(targetRect);
|
pop.setSourceRect(targetRect);
|
||||||
pop.setPermittedArrowDirections(UIPopoverArrowDirection.None);
|
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){
|
}catch(Throwable t){
|
||||||
ui.showException(t);
|
ui.showException(t);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user