1 // Copyright 2016-present 650 Industries. All rights reserved. 2 3 #import <UIKit/UIKit.h> 4 #import <Foundation/Foundation.h> 5 #import <ExpoModulesCore/EXSingletonModule.h> 6 #import <EXSplashScreen/EXSplashScreenViewController.h> 7 #import <EXSplashScreen/EXSplashScreenViewProvider.h> 8 9 NS_ASSUME_NONNULL_BEGIN 10 11 typedef NS_OPTIONS(NSUInteger, EXSplashScreenOptions) { 12 EXSplashScreenDefault = 0, 13 14 // Show splash screen even it was already shown before. 15 // e.g. show splash screen again when reloading apps, 16 EXSplashScreenForceShow = 1 << 0, 17 }; 18 19 /** 20 * Entry point for handling SplashScreen associated mechanism. 21 * This class has state based on the following relation { ViewController -> ApplicationSplashScreenState }. 22 * Each method call has to be made using ViewController that holds Application's view hierachy. 23 */ 24 @protocol EXSplashScreenService <NSObject> 25 26 /** 27 * Overloaded method. See main method below. 28 */ 29 - (void)showSplashScreenFor:(UIViewController *)viewController 30 options:(EXSplashScreenOptions)options; 31 32 /** 33 * Entry point for SplashScreen unimodule. 34 * Registers SplashScreen for given viewController and presents it in that viewController. 35 */ 36 - (void)showSplashScreenFor:(UIViewController *)viewController 37 options:(EXSplashScreenOptions)options 38 splashScreenViewProvider:(id<EXSplashScreenViewProvider>)splashScreenViewProvider 39 successCallback:(void (^)(void))successCallback 40 failureCallback:(void (^)(NSString *message))failureCallback; 41 42 /** 43 * Entry point for SplashScreen unimodule. 44 * Registers SplashScreen for given viewController and EXSplashController and presents it in that viewController. 45 */ 46 -(void)showSplashScreenFor:(UIViewController *)viewController 47 options:(EXSplashScreenOptions)options 48 splashScreenController:(EXSplashScreenViewController *)splashScreenController 49 successCallback:(void (^)(void))successCallback 50 failureCallback:(void (^)(NSString *message))failureCallback; 51 52 /** 53 * Hides SplashScreen for given viewController. 54 */ 55 - (void)hideSplashScreenFor:(UIViewController *)viewController 56 options:(EXSplashScreenOptions)options 57 successCallback:(void (^)(BOOL hasEffect))successCallback 58 failureCallback:(void (^)(NSString *message))failureCallback; 59 60 /** 61 * Prevents SplashScreen from default autohiding. 62 */ 63 - (void)preventSplashScreenAutoHideFor:(UIViewController *)viewController 64 options:(EXSplashScreenOptions)options 65 successCallback:(void (^)(BOOL hasEffect))successCallback 66 failureCallback:(void (^)(NSString *message))failureCallback; 67 68 /** 69 * Signaling method that has to be called upon Content is rendered in view hierarchy. 70 * Autohide functionality depends on this call. 71 */ 72 - (void)onAppContentDidAppear:(UIViewController *)viewController; 73 74 /** 75 * Signaling method that is responsible for reshowing SplashScreen upon full content reload. 76 */ 77 - (void)onAppContentWillReload:(UIViewController *)viewController; 78 79 @end 80 81 @interface EXSplashScreenService : EXSingletonModule <EXSplashScreenService, UIApplicationDelegate> 82 @end 83 84 NS_ASSUME_NONNULL_END 85