Files
phonegap-plugins/iPhone/networkActivityIndicator/networkActivityIndicator.m
Shazron Abdullah 7fe23343f6 Updated some stuff
Signed-off-by: Tue Topholm <tt@sugee.dk>
2011-08-04 23:38:39 +02:00

49 lines
1.0 KiB
Objective-C

//
// networkActivityIndicator.m
//
//
// Created by Tue Topholm on 16/03/11.
// Copyright 2011 Sugee. All rights reserved.
//
#import "networkActivityIndicator.h"
@implementation networkActivityIndicator
- (void)setIndicator:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options
{
NSUInteger argc = [arguments count];
if(argc == 3)
{
NSString *jsString = nil;
UIApplication* app = [UIApplication sharedApplication];
NSString *boolValue = [arguments objectAtIndex:0];
NSString *successCallback = [arguments objectAtIndex:1];
NSString *failCallback = [arguments objectAtIndex:2];
@try
{
if ([boolValue isEqualToString:@"false"])
app.networkActivityIndicatorVisible = NO;
else
app.networkActivityIndicatorVisible = YES;
jsString = [NSString stringWithFormat:@"%@();",successCallback];
}
@catch (NSException * e)
{
jsString = [NSString stringWithFormat:@"%@(\"%@\");",failCallback,[e reason]];
}
@finally
{
[self writeJavascript: jsString];
}
}
}
@end