From e93763ae7089a4ad2f22f78c1a6477a06a2d1b85 Mon Sep 17 00:00:00 2001 From: aogilvie Date: Mon, 10 Mar 2014 18:30:44 +0900 Subject: [PATCH] style update --- .../WizViewManagerPlugin.h | 42 ++++++++-------- .../WizViewManagerPlugin.m | 50 +++++++++---------- .../Plugins/WizViewManagerPlugin/WizWebView.h | 2 +- .../Plugins/WizViewManagerPlugin/WizWebView.m | 24 ++++----- 4 files changed, 59 insertions(+), 59 deletions(-) diff --git a/ios/project/Plugins/WizViewManagerPlugin/WizViewManagerPlugin.h b/ios/project/Plugins/WizViewManagerPlugin/WizViewManagerPlugin.h index 72acd08..9f0e6df 100755 --- a/ios/project/Plugins/WizViewManagerPlugin/WizViewManagerPlugin.h +++ b/ios/project/Plugins/WizViewManagerPlugin/WizViewManagerPlugin.h @@ -30,12 +30,12 @@ PHONEGAP HOOKS **/ -- (void)createView:(CDVInvokedUrlCommand*)command; -- (void)hideView:(CDVInvokedUrlCommand*)command; -- (void)showView:(CDVInvokedUrlCommand*)command; -- (void)load:(CDVInvokedUrlCommand*)command;; -- (void)removeView:(CDVInvokedUrlCommand*)command; -- (void)setLayout:(CDVInvokedUrlCommand*)command; +- (void)createView:(CDVInvokedUrlCommand *)command; +- (void)hideView:(CDVInvokedUrlCommand *)command; +- (void)showView:(CDVInvokedUrlCommand *)command; +- (void)load:(CDVInvokedUrlCommand *)command; +- (void)removeView:(CDVInvokedUrlCommand *)command; +- (void)setLayout:(CDVInvokedUrlCommand *)command; /** @@ -43,7 +43,7 @@ INTERNALS **/ -- (void)sendMessage:(NSString *)viewName withMessage:(NSString*)message; +- (void)sendMessage:(NSString *)viewName withMessage:(NSString *)message; - (void)updateViewList; - (BOOL)validateFileExtension:(NSString *)candidate; @@ -52,20 +52,20 @@ ANIMATION METHODS **/ -- (void) hideWithNoAnimation:(UIView*)view; -- (void) showWithNoAnimation:(UIView*)view; +- (void)hideWithNoAnimation:(UIView *)view; +- (void)showWithNoAnimation:(UIView *)view; -- (void) showWithZoomInAnimation:(UIView*)view duration:(float)secs option:(UIViewAnimationOptions)option showViewCallbackId:(NSString*)callbackId viewName:(NSString*)viewName; -- (void) hideWithZoomOutAnimation:(UIView*)view duration:(float)secs option:(UIViewAnimationOptions)option viewName:(NSString*)viewName; -- (void) showWithFadeAnimation:(UIView*)view duration:(float)secs option:(UIViewAnimationOptions)option showViewCallbackId:(NSString*)callbackId viewName:(NSString*)viewName; -- (void) hideWithFadeAnimation:(UIView*)view duration:(float)secs option:(UIViewAnimationOptions)option viewName:(NSString*)viewName; -- (void) showWithSlideInFromLeftAnimation:(UIView*)view duration:(float)secs option:(UIViewAnimationOptions)option showViewCallbackId:(NSString*)callbackId viewName:(NSString*)viewName; -- (void) hideWithSlideOutToLeftAnimation:(UIView*)view duration:(float)secs option:(UIViewAnimationOptions)option viewName:(NSString*)viewName; -- (void) showWithSlideInFromRightAnimation:(UIView*)view duration:(float)secs option:(UIViewAnimationOptions)option showViewCallbackId:(NSString*)callbackId viewName:(NSString*)viewName; -- (void) hideWithSlideOutToRightAnimation:(UIView*)view duration:(float)secs option:(UIViewAnimationOptions)option viewName:(NSString*)viewName; -- (void) showWithSlideInFromTopAnimation:(UIView*)view duration:(float)secs option:(UIViewAnimationOptions)option showViewCallbackId:(NSString*)callbackId viewName:(NSString*)viewName; -- (void) hideWithSlideOutToTopAnimation:(UIView*)view duration:(float)secs option:(UIViewAnimationOptions)option viewName:(NSString*)viewName; -- (void) showWithSlideInFromBottomAnimation:(UIView*)view duration:(float)secs option:(UIViewAnimationOptions)option showViewCallbackId:(NSString*)callbackId viewName:(NSString*)viewName; -- (void) hideWithSlideOutToBottomAnimation:(UIView*)view duration:(float)secs option:(UIViewAnimationOptions)option viewName:(NSString*)viewName; +- (void)showWithZoomInAnimation:(UIView *)view duration:(float)secs option:(UIViewAnimationOptions)option showViewCallbackId:(NSString *)callbackId viewName:(NSString *)viewName; +- (void)hideWithZoomOutAnimation:(UIView *)view duration:(float)secs option:(UIViewAnimationOptions)option viewName:(NSString *)viewName; +- (void)showWithFadeAnimation:(UIView *)view duration:(float)secs option:(UIViewAnimationOptions)option showViewCallbackId:(NSString *)callbackId viewName:(NSString *)viewName; +- (void)hideWithFadeAnimation:(UIView *)view duration:(float)secs option:(UIViewAnimationOptions)option viewName:(NSString *)viewName; +- (void)showWithSlideInFromLeftAnimation:(UIView *)view duration:(float)secs option:(UIViewAnimationOptions)option showViewCallbackId:(NSString *)callbackId viewName:(NSString *)viewName; +- (void)hideWithSlideOutToLeftAnimation:(UIView *)view duration:(float)secs option:(UIViewAnimationOptions)option viewName:(NSString *)viewName; +- (void)showWithSlideInFromRightAnimation:(UIView *)view duration:(float)secs option:(UIViewAnimationOptions)option showViewCallbackId:(NSString *)callbackId viewName:(NSString *)viewName; +- (void)hideWithSlideOutToRightAnimation:(UIView *)view duration:(float)secs option:(UIViewAnimationOptions)option viewName:(NSString *)viewName; +- (void)showWithSlideInFromTopAnimation:(UIView *)view duration:(float)secs option:(UIViewAnimationOptions)option showViewCallbackId:(NSString *)callbackId viewName:(NSString *)viewName; +- (void)hideWithSlideOutToTopAnimation:(UIView *)view duration:(float)secs option:(UIViewAnimationOptions)option viewName:(NSString *)viewName; +- (void)showWithSlideInFromBottomAnimation:(UIView *)view duration:(float)secs option:(UIViewAnimationOptions)option showViewCallbackId:(NSString *)callbackId viewName:(NSString *)viewName; +- (void)hideWithSlideOutToBottomAnimation:(UIView *)view duration:(float)secs option:(UIViewAnimationOptions)option viewName:(NSString *)viewName; @end \ No newline at end of file diff --git a/ios/project/Plugins/WizViewManagerPlugin/WizViewManagerPlugin.m b/ios/project/Plugins/WizViewManagerPlugin/WizViewManagerPlugin.m index 5114de4..5d2b29f 100644 --- a/ios/project/Plugins/WizViewManagerPlugin/WizViewManagerPlugin.m +++ b/ios/project/Plugins/WizViewManagerPlugin/WizViewManagerPlugin.m @@ -130,7 +130,7 @@ - (void)updateViewList { - (void)createView:(CDVInvokedUrlCommand *)command { // Assign arguments - NSString *viewName = [command.arguments objectAtIndex:0]; + NSString *viewName = [command.arguments objectAtIndex:0]; NSDictionary *options = nil; if ([[command.arguments objectAtIndex:1] class] == [NSNull class]) { // options are null @@ -151,7 +151,7 @@ - (void)createView:(CDVInvokedUrlCommand *)command { // In event of no source, set a default NSString *src = @""; - if ([options objectForKey:@"src"] && ![[options objectForKey:@"src"] isKindOfClass:[NSNull class]] ) { + if ([options objectForKey:@"src"] && ![[options objectForKey:@"src"] isKindOfClass:[NSNull class]]) { src = [options objectForKey:@"src"]; if ([self validateUrl:src]) { @@ -265,7 +265,7 @@ - (void)hideView:(CDVInvokedUrlCommand *)command { [self hideWebView:command]; } else { // View not found - CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary: + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary: [self throwError:1 description:@"View not found"]]; [self writeJavascript: [pluginResult toErrorCallbackString:command.callbackId]]; return; @@ -325,9 +325,9 @@ - (void)hideWebView:(CDVInvokedUrlCommand *)command { if (animationDict) { - NSString *type = [animationDict objectForKey:@"type"]; - int animateTimeinMilliSecs = [[animationDict objectForKey:@"duration"] intValue]; - CGFloat animateTime = (CGFloat)animateTimeinMilliSecs / 1000; + NSString *type = [animationDict objectForKey:@"type"]; + int animateTimeinMilliSecs = [[animationDict objectForKey:@"duration"] intValue]; + CGFloat animateTime = (CGFloat)animateTimeinMilliSecs / 1000; if (!animateTime) { // Default animateTime = 0.3f; @@ -409,7 +409,7 @@ - (void)showView:(CDVInvokedUrlCommand *)command { [self showWebView:command]; } else { // View not found - CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary: + CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary: [self throwError:1 description:@"View not found"]]; [self writeJavascript: [pluginResult toErrorCallbackString:command.callbackId]]; return; @@ -441,7 +441,7 @@ - (void)showWebView:(CDVInvokedUrlCommand *)command { if ([isAnimating objectForKey:viewName]) { // view is animating - stop current animation can release previous callback - //[isAnimating removeObjectForKey:viewName]; + // [isAnimating removeObjectForKey:viewName]; WizLog(@"[WizViewManager] ******* showView hideViewCallbackId %@", self.hideViewCallbackId); WizLog(@"[WizViewManager] ******* showView showViewCallbackId %@", self.showViewCallbackId); @@ -469,9 +469,9 @@ - (void)showWebView:(CDVInvokedUrlCommand *)command { if (animationDict) { WizLog(@"[WizViewManager] ******* with options : %@ ", options); - NSString *type = [animationDict objectForKey:@"type"]; - int animateTimeinMilliSecs = [[animationDict objectForKey:@"duration"] intValue]; - CGFloat animateTime = (CGFloat)animateTimeinMilliSecs / 1000; + NSString *type = [animationDict objectForKey:@"type"]; + int animateTimeinMilliSecs = [[animationDict objectForKey:@"duration"] intValue]; + CGFloat animateTime = (CGFloat)animateTimeinMilliSecs / 1000; if (!animateTime) { // Default animateTime = 0.3f; @@ -552,12 +552,12 @@ - (void)showWebView:(CDVInvokedUrlCommand *)command { - (void)load:(CDVInvokedUrlCommand *)command { // Assign arguments - NSString *viewName = [command.arguments objectAtIndex:0]; + NSString *viewName = [command.arguments objectAtIndex:0]; NSDictionary *options = [command.arguments objectAtIndex:1]; WizLog(@"[WizViewManager] ******* Load into view : %@ - viewlist -> %@ options %@", viewName, wizViewList, options); - if (options && ![options isKindOfClass:[NSNull class]] ) { + if (options && ![options isKindOfClass:[NSNull class]]) { // Search for view if (![wizViewList objectForKey:viewName]) { @@ -565,7 +565,7 @@ - (void)load:(CDVInvokedUrlCommand *)command { [self writeJavascript: [pluginResult toErrorCallbackString:command.callbackId]]; } - if ([options objectForKey:@"src"] && ![[options objectForKey:@"src"] isKindOfClass:[NSNull class]] ) { + if ([options objectForKey:@"src"] && ![[options objectForKey:@"src"] isKindOfClass:[NSNull class]]) { WizLog(@"[WizViewManager] ******* loading source to view : %@ ", viewName); NSString *src = [options objectForKey:@"src"]; @@ -623,7 +623,7 @@ - (void)load:(CDVInvokedUrlCommand *)command { NSURL *url; // Is relative path? Try to load from cache NSArray *pathList = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); - NSString *cachePath = [pathList objectAtIndex:0]; + NSString *cachePath = [pathList objectAtIndex:0]; url = [[NSURL alloc] initFileURLWithPath:src isDirectory:cachePath]; NSString *cacheSrc = [NSString stringWithFormat:@"%@/%@", cachePath, src]; WizLog(@"check: %@", cacheSrc); @@ -677,7 +677,7 @@ - (void)load:(CDVInvokedUrlCommand *)command { - (void)removeView:(CDVInvokedUrlCommand *)command { // Assign arguments - NSString *viewName = [command.arguments objectAtIndex:0]; + NSString *viewName = [command.arguments objectAtIndex:0]; WizLog(@"[WizViewManager] ******* removeView name : %@ ", viewName); // Search for view @@ -786,7 +786,7 @@ - (CGRect)frameWithOptions:(NSDictionary *)options { - (void)setLayout:(CDVInvokedUrlCommand *)command { // Assign arguments - NSString *viewName = [command.arguments objectAtIndex:0]; + NSString *viewName = [command.arguments objectAtIndex:0]; NSDictionary *options = [command.arguments objectAtIndex:1]; // NSLog(@"[WizViewManagerPlugin] ******* resizeView name: %@ withOptions: %@", viewName, options); @@ -794,7 +794,7 @@ - (void)setLayout:(CDVInvokedUrlCommand *)command { if ([wizViewList objectForKey:viewName]) { // SetLayout UIWebView - UIWebView* targetWebView = [wizViewList objectForKey:viewName]; + UIWebView *targetWebView = [wizViewList objectForKey:viewName]; CGRect newRect = [self frameWithOptions:options]; if (targetWebView.isHidden) { @@ -823,7 +823,7 @@ - (void)sendMessage:(NSString *)viewName withMessage:(NSString *)message { NSString *postDataEscaped = [message stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"]; // Message UIWebView - UIWebView* targetWebView = [wizViewList objectForKey:viewName]; + UIWebView *targetWebView = [wizViewList objectForKey:viewName]; [targetWebView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"wizMessageReceiver(window.decodeURIComponent('%@'));", postDataEscaped]]; } else { @@ -831,7 +831,7 @@ - (void)sendMessage:(NSString *)viewName withMessage:(NSString *)message { } } -- (int)getWeakLinker:(NSString*)myString ofType:(NSString*)type { +- (int)getWeakLinker:(NSString *)myString ofType:(NSString *)type { // Do tests to get correct int (we read in as string pointer but infact we are unaware of the var type) int i; @@ -862,14 +862,14 @@ - (int)getWeakLinker:(NSString*)myString ofType:(NSString*)type { float k = j*0.01; // use float here or int is rounded to a 0 int i = k*screenHeight; } else { - //invalid type - not supported + // Invalid type - not supported i = 0; } } else { // test - float - BOOL floatTest= [self floatTest:myString]; + BOOL floatTest = [self floatTest:myString]; if (floatTest) { // We have a float, check our float range and convert to int float floatValue = [myString floatValue]; @@ -1405,7 +1405,7 @@ - (void)webView:(UIWebView *)theWebView didFailLoadWithError:(NSError *)error { return [self.webviewDelegate webView:theWebView didFailLoadWithError:error]; } --(BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { +- (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { BOOL superValue = [ self.webviewDelegate webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType ]; @@ -1441,7 +1441,7 @@ -(BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest NSString *postDataEscaped = [data stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"]; - UIWebView* targetWebView = [viewList objectForKey:targetView]; + UIWebView *targetWebView = [viewList objectForKey:targetView]; NSString *js = [NSString stringWithFormat:@"wizViewMessenger.__triggerMessageEvent( window.decodeURIComponent('%@'), window.decodeURIComponent('%@'), window.decodeURIComponent('%@'), '%@' );", originView, targetView, postDataEscaped, type]; [targetWebView stringByEvaluatingJavaScriptFromString:js]; @@ -1463,7 +1463,7 @@ -(BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest } --(void)timedRestart:(UIWebView *)theWebView { +- (void)timedRestart:(UIWebView *)theWebView { // Gives time for our JS method to execute splash // Remove all views diff --git a/ios/project/Plugins/WizViewManagerPlugin/WizWebView.h b/ios/project/Plugins/WizViewManagerPlugin/WizWebView.h index 3c3ba3f..2b72ab2 100755 --- a/ios/project/Plugins/WizViewManagerPlugin/WizWebView.h +++ b/ios/project/Plugins/WizViewManagerPlugin/WizWebView.h @@ -15,6 +15,6 @@ @property (nonatomic, retain) UIWebView *wizView; @property (nonatomic, retain) NSString *viewName; -- (UIWebView *)createNewInstanceViewFromManager:(CDVPlugin*)myViewManager newBounds:(CGRect)webViewBounds viewName:(NSString *)name sourceToLoad:(NSString*)src withOptions:(NSDictionary *)options; +- (UIWebView *)createNewInstanceViewFromManager:(CDVPlugin *)myViewManager newBounds:(CGRect)webViewBounds viewName:(NSString *)name sourceToLoad:(NSString *)src withOptions:(NSDictionary *)options; @end diff --git a/ios/project/Plugins/WizViewManagerPlugin/WizWebView.m b/ios/project/Plugins/WizViewManagerPlugin/WizWebView.m index 3549395..471a358 100755 --- a/ios/project/Plugins/WizViewManagerPlugin/WizWebView.m +++ b/ios/project/Plugins/WizViewManagerPlugin/WizWebView.m @@ -13,7 +13,7 @@ @implementation WizWebView @synthesize wizView, viewName; -static CDVPlugin* viewManager; +static CDVPlugin *viewManager; - (void)dealloc { wizView.delegate = nil; @@ -49,7 +49,7 @@ - (UIWebView *)createNewInstanceViewFromManager:(CDVPlugin *)myViewManager newBo wizView.scalesPageToFit = [[options objectForKey:@"scalesPageToFit"] boolValue]; } else { NSNumber *scaleToFit = [cordovaConfig objectForKey:@"EnableViewportScale"]; - if ( scaleToFit ) { + if (scaleToFit) { wizView.scalesPageToFit = [scaleToFit boolValue]; } else { wizView.scalesPageToFit = NO; @@ -86,8 +86,8 @@ - (UIWebView *)createNewInstanceViewFromManager:(CDVPlugin *)myViewManager newBo } else { // Not a URL, a local resource, check file extension - WizViewManagerPlugin *_WizViewManagerPlugin = [WizViewManagerPlugin instance]; - if (![_WizViewManagerPlugin validateFileExtension:src]) { + WizViewManagerPlugin *wizViewManagerPlugin = [WizViewManagerPlugin instance]; + if (![wizViewManagerPlugin validateFileExtension:src]) { NSLog(@"Invalid extension type!"); return NULL; } @@ -95,7 +95,7 @@ - (UIWebView *)createNewInstanceViewFromManager:(CDVPlugin *)myViewManager newBo NSURL *url; // Is relative path? Try to load from cache NSArray *pathList = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); - NSString *cachePath = [pathList objectAtIndex:0]; + NSString *cachePath = [pathList objectAtIndex:0]; url = [[NSURL alloc] initFileURLWithPath:src isDirectory:cachePath]; NSString *cacheSrc = [NSString stringWithFormat:@"%@/%@", cachePath, src]; WizLog(@"check: %@", cacheSrc); @@ -114,7 +114,7 @@ - (UIWebView *)createNewInstanceViewFromManager:(CDVPlugin *)myViewManager newBo [wizView loadRequest:[NSURLRequest requestWithURL:url]]; } else { NSLog(@"Load Error: invalid source"); - if (![_WizViewManagerPlugin validateFileExtension:src]) { + if (![wizViewManagerPlugin validateFileExtension:src]) { NSLog(@"Load Error: No or NULL source"); return NULL; } @@ -136,7 +136,7 @@ - (UIWebView *)createNewInstanceViewFromManager:(CDVPlugin *)myViewManager newBo return wizView; } -- (BOOL) validateUrl: (NSString *) candidate { +- (BOOL)validateUrl:(NSString *)candidate { NSString *lowerCased = [candidate lowercaseString]; return [lowerCased hasPrefix:@"http://"] || [lowerCased hasPrefix:@"https://"]; } @@ -181,7 +181,7 @@ - (void)webViewDidFinishLoad:(UIWebView *)theWebView { WizLog(@"[WizViewManager] ******* viewName: %@ viewLoadedCallbackId : %@ ", callbackDict, viewName); if ([callbackDict objectForKey:[NSString stringWithFormat:@"%@_viewLoadedCallback", viewName]]) { - NSString* callbackId = [callbackDict objectForKey:[NSString stringWithFormat:@"%@_viewLoadedCallback", viewName]]; + NSString *callbackId = [callbackDict objectForKey:[NSString stringWithFormat:@"%@_viewLoadedCallback", viewName]]; CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; [viewManager writeJavascript:[pluginResult toSuccessCallbackString:callbackId]]; // Remove callback @@ -189,7 +189,7 @@ - (void)webViewDidFinishLoad:(UIWebView *)theWebView { } if ([callbackDict objectForKey:[NSString stringWithFormat:@"%@_updateCallback", viewName]]) { - NSString* callbackId = [callbackDict objectForKey:[NSString stringWithFormat:@"%@_updateCallback", viewName]]; + NSString *callbackId = [callbackDict objectForKey:[NSString stringWithFormat:@"%@_updateCallback", viewName]]; CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; [viewManager writeJavascript:[pluginResult toSuccessCallbackString:callbackId]]; // Remove callback @@ -199,8 +199,8 @@ - (void)webViewDidFinishLoad:(UIWebView *)theWebView { [callbackDict release]; // Update view list array for each view - WizViewManagerPlugin *_WizViewManagerPlugin = [WizViewManagerPlugin instance]; - [_WizViewManagerPlugin updateViewList]; + WizViewManagerPlugin *wizViewManagerPlugin = [WizViewManagerPlugin instance]; + [wizViewManagerPlugin updateViewList]; // Feed in the view name to the view's window.name property @@ -310,7 +310,7 @@ - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSMutableURLReq if ([viewList objectForKey:targetView]) { NSString *postDataEscaped = [data stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"]; - UIWebView* targetWebView = [viewList objectForKey:targetView]; + UIWebView *targetWebView = [viewList objectForKey:targetView]; NSString *js = [NSString stringWithFormat:@"wizViewMessenger.__triggerMessageEvent( window.decodeURIComponent('%@'), window.decodeURIComponent('%@'), window.decodeURIComponent('%@'), '%@' );", originView, targetView, postDataEscaped, type]; [targetWebView stringByEvaluatingJavaScriptFromString:js];