Repository URL to install this package:
/********* de-core-plugin.m Cordova Plugin Implementation *******/
#import <Cordova/CDV.h>
#import <DEUtility/DEUtils.h>
#import "DESplashScreenPlugin.h"
#import "DESplashScreenManager.h"
#import <DEUtility/DEAppPreferencesUtils.h>
#import "DESplashScreenDefines.h"
@implementation DESplashScreenPlugin
- (void)pluginInitialize
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pageDidLoad) name:CDVPageDidLoadNotification object:nil];
}
- (void)pageDidLoad
{
BOOL autoHide = [[DEAppPreferencesUtils sharedInstance] booleanPreferenceForKey:DESPLASH_CFG_PARAM_AUTHIDE withDefaultValue:YES];
if (autoHide){
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
[[DESplashScreenManager sharedInstance]hideSplash];
});
}
}
- (void)coolMethod:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = nil;
NSString* echo = [command.arguments objectAtIndex:0];
if (echo != nil && [echo length] > 0) {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:echo];
} else {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
}
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)hideSplash:(CDVInvokedUrlCommand*)command
{
[[DESplashScreenManager sharedInstance]hideSplash];
}
- (void)showSplash:(CDVInvokedUrlCommand*)command
{
[[DESplashScreenManager sharedInstance]showSplash];
}
- (void)destroySplash:(CDVInvokedUrlCommand*)command
{
[[DESplashScreenManager sharedInstance]destroySplash];
}
- (void)isVisible:(CDVInvokedUrlCommand*)command
{
BOOL isSplashVisible = [[DESplashScreenManager sharedInstance]isSplashVisible];
CDVPluginResult* pluginResult = nil;
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:isSplashVisible];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
@end