Skip to content

Commit

Permalink
style update
Browse files Browse the repository at this point in the history
  • Loading branch information
aogilvie committed Mar 10, 2014
1 parent 7d39379 commit e93763a
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 59 deletions.
42 changes: 21 additions & 21 deletions ios/project/Plugins/WizViewManagerPlugin/WizViewManagerPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@
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;


/**
INTERNALS
**/
- (void)sendMessage:(NSString *)viewName withMessage:(NSString*)message;
- (void)sendMessage:(NSString *)viewName withMessage:(NSString *)message;
- (void)updateViewList;
- (BOOL)validateFileExtension:(NSString *)candidate;

Expand All @@ -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
50 changes: 25 additions & 25 deletions ios/project/Plugins/WizViewManagerPlugin/WizViewManagerPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -552,20 +552,20 @@ - (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]) {
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:[self throwError:1 description:@"View not found"]];
[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"];
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -786,15 +786,15 @@ - (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);

if ([wizViewList objectForKey:viewName]) {

// SetLayout UIWebView
UIWebView* targetWebView = [wizViewList objectForKey:viewName];
UIWebView *targetWebView = [wizViewList objectForKey:viewName];

CGRect newRect = [self frameWithOptions:options];
if (targetWebView.isHidden) {
Expand Down Expand Up @@ -823,15 +823,15 @@ - (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 {
WizLog(@"Message failed! View not found!");
}
}

- (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;

Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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 ];

Expand Down Expand Up @@ -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];

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ios/project/Plugins/WizViewManagerPlugin/WizWebView.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading

0 comments on commit e93763a

Please sign in to comment.