From 1fd7c36e87bda01901d0e8f28b5681c042789466 Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Sun, 11 Oct 2020 08:40:35 -0700 Subject: [PATCH] fixes --- ios/Info.plist.xml | 2 +- ios/src/java/advent/core/GameCenter.java | 6 ++ ios/src/java/advent/core/IOSLauncher.java | 76 +++++++++++++---------- 3 files changed, 49 insertions(+), 35 deletions(-) diff --git a/ios/Info.plist.xml b/ios/Info.plist.xml index 76ef3c52..0512cc0d 100644 --- a/ios/Info.plist.xml +++ b/ios/Info.plist.xml @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 141 + 146 CFBundleIconName AppIcon MinimumOSVersion diff --git a/ios/src/java/advent/core/GameCenter.java b/ios/src/java/advent/core/GameCenter.java index 8e98b17d..64fe33cc 100644 --- a/ios/src/java/advent/core/GameCenter.java +++ b/ios/src/java/advent/core/GameCenter.java @@ -44,9 +44,11 @@ public class GameCenter { /** Do the login logic. If the user has never loged, a dialog will be shown. */ public void login (final UIWindow window) { + try { GKLocalPlayer.getLocalPlayer().setAuthenticateHandler(new VoidBlock2() { @Override public void invoke (UIViewController viewController, NSError error) { + System.out.println("AUTH: invoked"); // If the device does not have an authenticated player, show the login dialog if (viewController != null) { System.out.println("Not logged in"); @@ -65,6 +67,10 @@ public class GameCenter { } } }); + } catch (Exception e) { + System.out.println(e.toString()); + throw e; + } } public void show(final UIViewController d) { diff --git a/ios/src/java/advent/core/IOSLauncher.java b/ios/src/java/advent/core/IOSLauncher.java index e44fb6b8..09c310a0 100644 --- a/ios/src/java/advent/core/IOSLauncher.java +++ b/ios/src/java/advent/core/IOSLauncher.java @@ -18,10 +18,17 @@ public class IOSLauncher extends IOSApplication.Delegate { TransactionObserver transactionObserver; @Override public boolean didFinishLaunching (UIApplication application, UIApplicationLaunchOptions launchOptions) { + System.out.println("Did finish loading"); + try { transactionObserver = new TransactionObserver(); SKPaymentQueue.getDefaultQueue().addTransactionObserver(transactionObserver); + boolean result = super.didFinishLaunching(application, launchOptions); new GameCenter().login(application.getKeyWindow()); - return super.didFinishLaunching(application, launchOptions); + return result; + } catch (Exception e) { + System.out.println(e.toString()); + throw e; + } } @Override @@ -31,41 +38,42 @@ public class IOSLauncher extends IOSApplication.Delegate { } protected IOSApplication createApplication() { - IOSApplicationConfiguration config = new IOSApplicationConfiguration(); - // config.colorFormat = GLKViewDrawableColorFormat.SRGBA8888; - // config.depthFormat = GLKViewDrawableDepthFormat._24; - config.orientationPortrait = false; - config.orientationLandscape = true; - config.preferredFramesPerSecond = 30; - config.useAccelerometer=false; - config.useCompass=false; - System.out.println("application created."); - HashSet products = new HashSet(); - products.add("fullgame"); - SKProductsRequest request = new SKProductsRequest(products); - request.setDelegate(new ProductDelegate()); - request.start(); + IOSApplicationConfiguration config = new IOSApplicationConfiguration(); + // config.colorFormat = GLKViewDrawableColorFormat.SRGBA8888; + // config.depthFormat = GLKViewDrawableDepthFormat._24; + config.orientationPortrait = true; + config.orientationLandscape = true; + config.preferredFramesPerSecond = 30; + config.useAccelerometer=false; + config.useCompass=false; + System.out.println("application created."); + try { + HashSet products = new HashSet(); + products.add("fullgame"); + SKProductsRequest request = new SKProductsRequest(products); + request.setDelegate(new ProductDelegate()); + request.start(); - RT.var("clojure.core", "require").invoke(Symbol.intern("advent.core")); - RT.var("clojure.core", "require").invoke(Symbol.intern("advent.ios")); - System.out.println("clojure loaded"); - try { - NSDictionary infoDictionary = NSBundle.getMainBundle().getInfoDictionary(); - String version = infoDictionary.get(new NSString("CFBundleShortVersionString")).toString(); - RT.var("advent.version", "version-override").bindRoot(version); - Game game = (Game) RT.var("advent.core", "advent").deref(); - System.out.println("game loaded"); - return new IOSApplication(game, config); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } + RT.var("clojure.core", "require").invoke(Symbol.intern("advent.core")); + RT.var("clojure.core", "require").invoke(Symbol.intern("advent.ios")); + System.out.println("clojure loaded"); + NSDictionary infoDictionary = NSBundle.getMainBundle().getInfoDictionary(); + String version = infoDictionary.get(new NSString("CFBundleShortVersionString")).toString(); + RT.var("advent.version", "version-override").bindRoot(version); + Game game = (Game) RT.var("advent.core", "advent").deref(); + System.out.println("game loaded"); + return new IOSApplication(game, config); + } catch (Exception e) { + System.out.println(e.toString()); + e.printStackTrace(); + throw e; + } + } - public static void main(String[] argv) { - NSAutoreleasePool pool = new NSAutoreleasePool(); - UIApplication.main(argv, null, IOSLauncher.class); - pool.close(); + public static void main(String[] argv) { + NSAutoreleasePool pool = new NSAutoreleasePool(); + UIApplication.main(argv, null, IOSLauncher.class); + pool.close(); } @Override