Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

vipera-npm-registry / de-splashscreen-plugin   js

Repository URL to install this package:

Version: 0.0.4 

/ src / ios / DEDefaultSplashScreenProvider.m

//
//  DEDefaultSplashScreenProvider.m
//  HelloCordova
//
//  Created by Marco Bonati on 23/02/2017.
//
//

#import <Foundation/Foundation.h>
#import "DEDefaultSplashScreenProvider.h"
#import <Cordova/CDVViewController.h>
#import "DEDefaultSplashScreen.h"
#import <DEUtility/DEAppPreferencesUtils.h>
#import "DESplashScreenDefines.h"
#import <DEUtility/DELogger.h>

@interface DEDefaultSplashScreenProvider()
{
    CDVViewController* _mainViewController;
}
@end

@implementation DEDefaultSplashScreenProvider
    
- (id)init:(CDVViewController*)mainViewController
{
    self = [super init];
    _mainViewController = mainViewController;
    return self;
}

- (UIView*)createSplashScreenView
{
    DDLogDebug(@"createSplashScreenView called");
    
    BOOL useStoryboard = [[DEAppPreferencesUtils sharedInstance] booleanPreferenceForKey:DESPLASH_CFG_PARAM_USE_STORYBOARD withDefaultValue:YES];
    NSString* storyboardName = [[DEAppPreferencesUtils sharedInstance] stringPreferenceForKey:DESPLASH_CFG_PARAM_STORYBOARD_NAME withDefaultValue:@"default"];
    
    DDLogDebug(@"createSplashScreenView useStoryboard=%d storyboardName=%@",useStoryboard,storyboardName);

    UIView *view = nil;
    if (useStoryboard)
    {
        NSString* launchStoryboardName = storyboardName;
        if ([storyboardName caseInsensitiveCompare:@"default"]==NSOrderedSame){
            launchStoryboardName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UILaunchStoryboardName"];
        }
        UIStoryboard *sb = [UIStoryboard storyboardWithName:launchStoryboardName bundle:nil];
        UIViewController *vq = [sb instantiateInitialViewController];
        view = vq.view;
        CGRect screenBounds = [[UIScreen mainScreen] bounds];
        //view.bounds = screenBounds;
        view.frame = screenBounds;
        view.autoresizingMask = UIViewAutoresizingNone;// UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    } else {
        CGRect screenBounds = [[UIScreen mainScreen] bounds];
        //NSLog(@"screenBounds %@", NSStringFromCGRect(screenBounds));
        view = [[DEDefaultSplashScreen alloc]initWithFrame:screenBounds];
        //view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    }
    
    DDLogDebug(@"createSplashScreenView created view=%@",view);

    return view;
}


@end