diff --git a/ios/src/cz/nic/tablexia/IOSLauncher.java b/ios/src/cz/nic/tablexia/IOSLauncher.java index 4e1380417f4f5d2821f52ff19a4e14cade958d28..70fd0dd40d729cd74469e3db5020986fa5fa3eba 100644 --- a/ios/src/cz/nic/tablexia/IOSLauncher.java +++ b/ios/src/cz/nic/tablexia/IOSLauncher.java @@ -1,25 +1,23 @@ package cz.nic.tablexia; +import com.badlogic.gdx.Files; +import com.badlogic.gdx.Gdx; import com.badlogic.gdx.backends.iosrobovm.IOSApplication; import com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration; import org.robovm.apple.foundation.NSAutoreleasePool; import org.robovm.apple.foundation.NSBundle; import org.robovm.apple.foundation.NSDictionary; -import org.robovm.apple.foundation.NSErrorException; -import org.robovm.apple.foundation.NSNumber; import org.robovm.apple.foundation.NSString; -import org.robovm.apple.foundation.NSURL; -import org.robovm.apple.foundation.NSURLFileSystemProperty; import org.robovm.apple.glkit.GLKViewDrawableMultisample; import org.robovm.apple.systemconfiguration.SCNetworkReachability; import org.robovm.apple.systemconfiguration.SCNetworkReachabilityFlags; import org.robovm.apple.uikit.UIApplication; +import org.robovm.apple.uikit.UIApplicationLaunchOptions; import java.net.InetSocketAddress; import java.util.Locale; -import cz.nic.tablexia.loader.TablexiaAbstractFileManager; import cz.nic.tablexia.screen.loader.IConnectionManager; public class IOSLauncher extends IOSApplication.Delegate { @@ -32,6 +30,8 @@ public class IOSLauncher extends IOSApplication.Delegate { private static final String CONNECTION_CHECK_HOST = TablexiaBuildConfig.TABLEXIA_SERVER_HOST != null ? TablexiaBuildConfig.TABLEXIA_SERVER_HOST : FALLBACK_CONNECTION_CHECK_HOST; private static final Integer CONNECTION_CHECK_PORT = TablexiaBuildConfig.TABLEXIA_SERVER_PORT != null ? TablexiaBuildConfig.TABLEXIA_SERVER_PORT : FALLBACK_CONNECTION_CHECK_PORT; + private TablexiaIOSFiles tablexiaIOSFiles; + @Override protected IOSApplication createApplication() { IOSApplicationConfiguration config = new IOSApplicationConfiguration(); @@ -40,21 +40,29 @@ public class IOSLauncher extends IOSApplication.Delegate { NSDictionary infoDictionary = NSBundle.getMainBundle().getInfoDictionary(); String buildType = infoDictionary.get(new NSString("cz.nic.tablexia.BuildType")).toString(); + tablexiaIOSFiles = new TablexiaIOSFiles(); IOSApplication iosApplication = new IOSApplication(new Tablexia(buildType, Locale.getDefault(), SQL_CONNECTION_TYPE, new IOSConnectionManager(), - false), config); + false), config) { - try { - (new NSURL(TablexiaAbstractFileManager.AssetsStorageType.EXTERNAL.getStoragePath())).setResourceValue(NSURLFileSystemProperty.IsExcludedFromBackup, NSNumber.valueOf(1)); - } catch (NSErrorException e) { - e.printStackTrace(); - } + @Override + public Files getFiles() { + return tablexiaIOSFiles; + } + }; return iosApplication; } + @Override + public boolean didFinishLaunching(UIApplication application, UIApplicationLaunchOptions launchOptions) { + boolean result = super.didFinishLaunching(application, launchOptions); + Gdx.files = tablexiaIOSFiles; + return result; + } + public static void main(String[] argv) { NSAutoreleasePool pool = new NSAutoreleasePool(); UIApplication.main(argv, null, IOSLauncher.class);