diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..60e9fdd --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "MATSOL/External/GIDAAlertView"] + path = MATSOL/External/GIDAAlertView + url = git://github.com/GIDAIbero/GIDAAlertView.git +[submodule "MATSOL/External/GIDACalculateString"] + path = MATSOL/External/GIDACalculateString + url = git://github.com/GIDAIbero/GIDACalculateString.git diff --git a/MATSOL/External/GIDAAlertView b/MATSOL/External/GIDAAlertView new file mode 160000 index 0000000..04cdd80 --- /dev/null +++ b/MATSOL/External/GIDAAlertView @@ -0,0 +1 @@ +Subproject commit 04cdd800e2cae77a313bbb2f5f9c0a7be030b59a diff --git a/MATSOL/External/GIDACalculateString b/MATSOL/External/GIDACalculateString new file mode 160000 index 0000000..e3bdd07 --- /dev/null +++ b/MATSOL/External/GIDACalculateString @@ -0,0 +1 @@ +Subproject commit e3bdd073bea0418ba222ea048dd5e9ee03d544cd diff --git a/MATSOL/GIDAUtilities/GIDAAlertView.h b/MATSOL/GIDAUtilities/GIDAAlertView.h deleted file mode 100644 index 055b650..0000000 --- a/MATSOL/GIDAUtilities/GIDAAlertView.h +++ /dev/null @@ -1,120 +0,0 @@ -// -// GIDASearchAlert.h 2011/10/28 to 2013/02/27 -// GIDAAlertView.h since 2013/02/27 -// TestAlert -// -// Created by Alejandro Paredes on 10/28/11. -// -// Following methods are inspired in Yoshiki Vázquez Baeza work on previous versions -// of GIDAAlertView. -// - (id)initWithMessage:(NSString *)someMessage andAlertImage:(UIImage *)someImage; -// - (id) initWithSpinnerAndMessage:(NSString *)message; -// - (void)presentAlertFor:(float)seconds; -// - (void)presentAlertWithSpinnerAndHideAfterSelector:(SEL)selector from:(id)sender; -// - -#import -#import - -typedef enum { - GIDAAlertViewMessageImage, - GIDAAlertViewSpinner, - GIDAAlertViewPrompt, - GIDAAlertViewNoPrompt, - GIDAAlertViewProgressTime, - GIDAAlertViewProgressURL, - GIDAAlertViewCheck, - GIDAAlertViewXMark -}GIDAAlertViewType; - -@class GIDAAlertView; -/** - * Methods that the GIDAAlertView delegate must implement. - */ -@protocol GIDAAlertViewDelegate -@optional -/** Tells the delegate that an alert has been clicked. - -@param alertView The alert view that sends the notification */ --(void)alertOnClicked:(GIDAAlertView *)alertView; -/** Tells the delegate that an alert has been dismised. - - @param alertView The alert view that sends the notification */ --(void)alertOnDismiss:(GIDAAlertView *)alertView; -/** Tells the delegate that an alert has been clicked, dismissed and finished background activities. - - @param alertView The alert view that sends the notification */ --(void)alertFinished:(GIDAAlertView *)alertView; -@end - -/** - * Description of GIDAAlertView - */ -@interface GIDAAlertView : UIAlertView -/** @name Attributes */ -@property (nonatomic, strong) NSString *identifier; -@property (readonly) GIDAAlertViewType type; -@property (readonly) BOOL accepted; -@property (nonatomic, strong) id gavdelegate; - -/** @name Initialization */ - -/** Initialization of a GIDAAlertView with an check mark and a message. - - An NSString presented along with a check mark - @param message String with the message to present - @return A GIDAAlertView object or `nil` if it could not be created. */ -- (id)initWithCheckMarkAndMessage:(NSString *)message; - -/** Initialization of a GIDAAlertView with an exclamation mark and a message. - - An NSString presented along with a exclamation mark - @param message String with the message to present - @return A GIDAAlertView object or `nil` if it could not be created. */ -- (id)initWithExclamationMarkAndMessage:(NSString *)message; - -/** Initialization of a GIDAAlertView with an image and prompt - - Creates an alert that presents an image and a prompt. This can be used for confirming that the user is a real user. This can be used for CAPTCHA requests - - @param image An image to present in the alertview - @param message The message to present in the alert - @param cancelTitle String for the cancel button - @param acceptTitle String for the accept button - @return A GIDAAlertView object or `nil` if it could not be created. */ -- (id)initWithImage:(UIImage *)image andMessage:(NSString *)message cancelButtonTitle:(NSString *)cancelTitle acceptButtonTitle:(NSString *)acceptTitle; - -/** Initialization of a GIDAAlertView with a message and an image. - - An NSString and a UIImage to be presented in the alert -@param someMessage String with the message -@param someImage Image to show in alert -@return A GIDAAlertView object or `nil` if it could not be created.*/ -- (id)initWithMessage:(NSString *)someMessage andAlertImage:(UIImage *)someImage; - -/** Initialization of a GIDAAlertView with a message and a graphic spinner. - - An NSString presented along with a UIActivityIndicatorView in the alert -@param message String with the message to present -@return A GIDAAlertView object or `nil` if it could not be created. */ -- (id) initWithSpinnerWith:(NSString *)message; -- (id)initWithPrompt:(NSString *)prompt cancelButtonTitle:(NSString *)cancelTitle acceptButtonTitle:(NSString *)acceptTitle; - -- (id)initWithTitle:(NSString *)title cancelButtonTitle:(NSString *)cancelTitle acceptButtonTitle:(NSString *)acceptTitle andMessage:(NSString *)message; -- (id)initWithProgressBarWith:(NSString *)message andTime:(NSInteger)seconds; -- (id)initWithProgressBarWith:(NSString *)message andURL:(NSURL *)url; -- (id)initWithProgressCircleWith:(NSString *)message andURL:(NSURL *)url; -- (id)initWithXMarkWith:(NSString *)message; - -/** @name Other Methods */ -- (void)setColor:(UIColor *)color; -- (NSString *) enteredText; -- (void)presentProgressBar; -- (void)presentAlertFor:(float)seconds; -- (void)presentAlertWithSpinnerAndHideAfterSelector:(SEL)selector from:(id)sender withObject:(id)object; -- (void)progresBarStartDownload; - -- (NSDictionary *)getDownloadedData; -- (void)setProgressBarColor:(UIColor *)color; -- (void)setKeyboard:(UIKeyboardType)keyboard; -@end diff --git a/MATSOL/GIDAUtilities/GIDAAlertView.m b/MATSOL/GIDAUtilities/GIDAAlertView.m deleted file mode 100644 index f99a7a1..0000000 --- a/MATSOL/GIDAUtilities/GIDAAlertView.m +++ /dev/null @@ -1,967 +0,0 @@ -// -// GIDASearchAlert.m 2011/10/28 to 2013/02/27 -// GIDAAlertView.m since 2013/02/27 -// TestAlert -// -// Created by Alejandro Paredes on 10/28/11. -// -// Following methods are inspired in Yoshiki Vázquez Baeza work on previous versions -// of GIDAAlertView. -// - (id)initWithMessage:(NSString *)someMessage andAlertImage:(UIImage *)someImage; -// - (id) initWithSpinnerAndMessage:(NSString *)message; -// - (void)presentAlertFor:(float)seconds; -// - (void)presentAlertWithSpinnerAndHideAfterSelector:(SEL)selector from:(id)sender; -// - -#import "GIDAAlertView.h" - -@interface LoadingCircle : UIView { - //Angle for arc, in radians. - CGFloat angle; -} - -//Color for arc -@property (nonatomic, strong) UIColor *arcColor; -@property (nonatomic, strong) UILabel *percentageLabel; -@end - -@implementation LoadingCircle --(id)initWithFrame:(CGRect)frame { - self = [super initWithFrame:frame]; - if (self) { - [self setBackgroundColor:[UIColor clearColor]]; - - //Start at -90 as 0.0 is to the right. - angle = -90.0f*M_PI/180.0f; - - CGRect labelFrame = frame; - labelFrame.origin.x = 0; - labelFrame.origin.y = 0; - //Label to show the current percentage. Size of the frame to have the text centered. - _percentageLabel = [[UILabel alloc] initWithFrame:labelFrame]; - [_percentageLabel setTextAlignment:NSTextAlignmentCenter]; - [_percentageLabel setBackgroundColor:[UIColor clearColor]]; - [_percentageLabel setTextColor:[UIColor whiteColor]]; - - if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) { - [_percentageLabel setFont:[UIFont boldSystemFontOfSize:20]]; - } else { - [_percentageLabel setFont:[UIFont fontWithName:@"TimesNewRomanPS-BoldMT" size:20]]; - } - [self addSubview:_percentageLabel]; - _arcColor = [UIColor whiteColor]; - } - return self; -} --(void)setProgressLabelColor:(UIColor *)progressLabelColor { - [_percentageLabel setTextColor:progressLabelColor]; -} --(void)setProgressColor:(UIColor *)color { - _arcColor = color; -} -//Update percentage values. --(void)updateProgress:(CGFloat)percentage { - - //Update the percentage label appropriately - if (percentage >= 1.0f) { - [_percentageLabel setText:@"100%"]; - } else { - [_percentageLabel setText:[NSString stringWithFormat:@"%.1f%c",percentage*100,'%']]; - } - - //Calculate angle from percentage. - angle = (percentage * 360)-90; - angle = angle*M_PI/180.0f; - - //Call drawRect to draw again. - [self setNeedsDisplay]; -} -//Draw back circle and percentage arc. --(void)drawRect:(CGRect)rect { - CGSize size = rect.size; - CGFloat radius = size.width/2.0f; - CGContextRef context = UIGraphicsGetCurrentContext(); - - CGContextSetLineWidth(context, 12.0); - - //Set the back circle, done by an elipse of the size of the UIView frame. - CGContextSetStrokeColorWithColor(context, [UIColor lightGrayColor].CGColor); - CGRect elipse = CGRectMake(6, 6, size.width-12, size.height-12); - CGContextAddEllipseInRect(context, elipse); - CGContextStrokePath(context); - - //Set the arc of the progress so far. Starting from center top, to the percentage angle in a clockwise way. - CGContextSetStrokeColorWithColor(context, _arcColor.CGColor); - CGContextAddArc(context, radius, radius, radius-6, -90.0f*M_PI/180.0f, angle, 0); - CGContextStrokePath(context); -} -@end - -@interface ProgressBar : UIView -@property (nonatomic, strong) UIColor *progressColor; -@property CGFloat progress; -@property (nonatomic, strong) UILabel *progressLabel; -@end -@implementation ProgressBar - --(id)initWithFrame:(CGRect)frame { - self = [super initWithFrame:frame]; - if (self) { - _progress = 0.0; - [self setBackgroundColor:[UIColor clearColor]]; - - CGRect labelFrame = frame; - labelFrame.origin.x = 0; - labelFrame.origin.y = 0; - _progressLabel = [[UILabel alloc] initWithFrame:labelFrame]; - [_progressLabel setTextAlignment:NSTextAlignmentCenter]; - _progressLabel.baselineAdjustment = UIBaselineAdjustmentAlignCenters; - [_progressLabel setTextColor:[UIColor whiteColor]]; - [_progressLabel setBackgroundColor:[UIColor clearColor]]; - if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) { - [_progressLabel setFont:[UIFont boldSystemFontOfSize:20]]; - } else { - [_progressLabel setFont:[UIFont fontWithName:@"TimesNewRomanPS-BoldMT" size:20]]; - } - [self addSubview:_progressLabel]; - } - return self; -} --(void)setProgressLabelColor:(UIColor *)progressLabelColor { - [_progressLabel setTextColor:progressLabelColor]; -} --(void)setProgressColor:(UIColor *)color { - _progressColor = color; -} - - -//Update the percentage value and label appropriately. Call for drawRect again. --(void)updateProgress:(CGFloat)percentage { - _progress = percentage; - - if (percentage >= 1.0f) { - [_progressLabel setText:@"100%"]; - } else { - [_progressLabel setText:[NSString stringWithFormat:@"%.1f%c",fabsf(percentage*100),'%']]; - } - - [self setNeedsDisplay]; -} - -//Create rectangle with rounded corner for the appropiate width related to the progress. --(void)drawRect:(CGRect)rect { - rect.size.width = rect.size.width*_progress; - if (!_progressColor) { - _progressColor = [UIColor blueColor]; - } - CGFloat radius = 8; - if (rect.size.width < 21) { - radius = rect.size.width/3; - } - - CGContextRef context = UIGraphicsGetCurrentContext(); - CGContextSetFillColorWithColor(context, _progressColor.CGColor); - CGContextSetAlpha(context, 0.8); - - CGContextMoveToPoint(context, rect.origin.x, rect.origin.y + radius); - CGContextAddLineToPoint(context, rect.origin.x, rect.origin.y + rect.size.height - radius); - CGContextAddArc(context, rect.origin.x + radius, rect.origin.y + rect.size.height - radius, - radius, M_PI, M_PI / 2, 1); //STS fixed - CGContextAddLineToPoint(context, rect.origin.x + rect.size.width - radius, - rect.origin.y + rect.size.height); - CGContextAddArc(context, rect.origin.x + rect.size.width - radius, - rect.origin.y + rect.size.height - radius, radius, M_PI / 2, 0.0f, 1); - CGContextAddLineToPoint(context, rect.origin.x + rect.size.width, rect.origin.y + radius); - CGContextAddArc(context, rect.origin.x + rect.size.width - radius, rect.origin.y + radius, - radius, 0.0f, -M_PI / 2, 1); - CGContextAddLineToPoint(context, rect.origin.x + radius, rect.origin.y); - CGContextAddArc(context, rect.origin.x + radius, rect.origin.y + radius, radius, - -M_PI / 2, M_PI, 1); - - CGContextFillPath(context); -} - -@end - -@interface GIDAAlertView() { - BOOL withSpinnerOrImage; - float progress; - double timeSeconds; - float _receivedDataBytes; - float _totalFileSize; - GIDAAlertViewType alertType; - BOOL acceptedAlert; - BOOL failedDownload; -} - -@property (nonatomic, strong) NSString *entered; -@property (nonatomic, strong) UITextField *textField; -@property (nonatomic, strong) UILabel *messageLabel; -@property (nonatomic, strong) UILabel *messageExtraLabel; -@property (nonatomic, strong) UIColor *alertColor; -@property (nonatomic, strong) NSTimer *timer; -@property (nonatomic, strong) NSMutableData *responseData; -@property (nonatomic, strong) NSURL *userURL; -@property (nonatomic, strong) NSString *mimeType; -@property (nonatomic, strong) NSString *textEncoding; -@property (nonatomic, strong) id progressBar; -@property (nonatomic, strong) NSURLConnection *connection; -@property (nonatomic, strong) NSString *downloadError; -@property (nonatomic, strong) UILabel *cancelLabel; -@property (nonatomic, strong) UIView *backgroundView; -@property (nonatomic, strong) UIImageView *imageView; -@property (nonatomic, strong) UILabel *labelMark; -@end - -@implementation GIDAAlertView - --(GIDAAlertViewType)type { - return alertType; -} - --(id)initWithMessage:(NSString *)message andAlertImage:(UIImage *)image { - self = [super initWithTitle:@"\n\n\n\n\n" message:nil delegate:nil cancelButtonTitle:nil otherButtonTitles:nil]; - if (self) { - withSpinnerOrImage = YES; - _responseData = nil; - alertType = GIDAAlertViewMessageImage; - - if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) { - [super setTitle:@""]; - - _backgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 160, 130)]; - [_backgroundView setBackgroundColor:[UIColor clearColor]]; - - UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; - [imageView setFrame:CGRectMake(40, 5, 80, 80)]; - - UILabel *messageLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 85, 160, 50)]; - [messageLabel setTextAlignment:NSTextAlignmentCenter]; - [messageLabel setText:message]; - [messageLabel setBackgroundColor:[UIColor clearColor]]; - [messageLabel setTextColor:[UIColor colorWithRed:(28.0/255) green:(130.0/255) blue:(251.0/255) alpha:1]]; - [messageLabel setFont:[UIFont boldSystemFontOfSize:20]]; - [messageLabel setAdjustsFontSizeToFitWidth:YES]; - [messageLabel removeFromSuperview]; - - [_backgroundView addSubview:imageView]; - [_backgroundView addSubview:messageLabel]; - - [self setValue:_backgroundView forKey:@"accessoryView"]; - } else { - _backgroundView = nil; - _backgroundView = [[UIView alloc] initWithFrame:CGRectMake(40, -10, 200, 200)]; - [_backgroundView setBackgroundColor:[UIColor blackColor]]; - [_backgroundView setAlpha:0.8]; - _backgroundView.layer.cornerRadius = 15; - [self addSubview:_backgroundView]; - - UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; - [imageView setFrame:CGRectMake(100, 25, 80, 80)]; - [self addSubview:imageView]; - - UILabel *messageLabel = [[UILabel alloc] initWithFrame:CGRectMake(62, 125, 160, 50)]; - [messageLabel setTextAlignment:NSTextAlignmentCenter]; - [messageLabel setText:message]; - [messageLabel setBackgroundColor:[UIColor clearColor]]; - [messageLabel setTextColor:[UIColor whiteColor]]; - [messageLabel setFont:[UIFont fontWithName:@"TimesNewRomanPS-BoldMT" size:20]]; - [messageLabel setAdjustsFontSizeToFitWidth:YES]; - [self addSubview:messageLabel]; - - [self bringSubviewToFront:_backgroundView]; - [self bringSubviewToFront:imageView]; - [self bringSubviewToFront:messageLabel]; - } - } - return self; -} - --(id)initWithProgressBarWith:(NSString *)message andTime:(NSInteger)seconds { - self = [super initWithTitle:@"\n\n\n\n\n" message:nil delegate:self cancelButtonTitle:nil otherButtonTitles:nil]; - if (self) { - progress = -0.1; - timeSeconds = seconds/10; - withSpinnerOrImage = YES; - if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) { - self = [super initWithTitle:@"" message:nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil]; - _progressBar = [[ProgressBar alloc] initWithFrame:CGRectMake(50, 5, 100, 100)]; - [_progressBar setProgressLabelColor:[UIColor colorWithRed:(28.0/255) green:(130.0/255) blue:(251.0/255) alpha:1]]; - _backgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 160)]; - [_backgroundView setBackgroundColor:[UIColor clearColor]]; - _messageExtraLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 110, 160, 50)]; - [_messageExtraLabel setTextAlignment:NSTextAlignmentCenter]; - [_messageExtraLabel setText:message]; - [_messageExtraLabel setBackgroundColor:[UIColor clearColor]]; - [_messageExtraLabel setTextColor:[UIColor colorWithRed:(28.0/255) green:(130.0/255) blue:(251.0/255) alpha:1]]; - [_messageExtraLabel setFont:[UIFont boldSystemFontOfSize:20]]; - [_messageExtraLabel setAdjustsFontSizeToFitWidth:YES]; - [_messageExtraLabel removeFromSuperview]; - - [_backgroundView addSubview:_progressBar]; - [_backgroundView addSubview:_messageExtraLabel]; - - - [self setValue:_backgroundView forKey:@"accessoryView"]; - } else { - _backgroundView = [[UIView alloc] initWithFrame:CGRectMake(40, -10, 200, 200)]; - [_backgroundView setBackgroundColor:[UIColor blackColor]]; - [_backgroundView setAlpha:0.8]; - _backgroundView.layer.cornerRadius = 15; - [self addSubview:_backgroundView]; - _progressBar = [[ProgressBar alloc] initWithFrame:CGRectMake(90, 25, 100, 100)]; - [self addSubview:_progressBar]; - - _messageLabel = [[UILabel alloc] initWithFrame:CGRectMake(62, 125, 160, 50)]; - [_messageLabel setTextAlignment:NSTextAlignmentCenter]; - [_messageLabel setText:message]; - [_messageLabel setBackgroundColor:[UIColor clearColor]]; - [_messageLabel setTextColor:[UIColor whiteColor]]; - [_messageLabel setFont:[UIFont fontWithName:@"TimesNewRomanPS-BoldMT" size:20]]; - [_messageLabel setAdjustsFontSizeToFitWidth:YES]; - [self addSubview:_messageLabel]; - - _cancelLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 32, 32)]; - [_cancelLabel setBackgroundColor:[UIColor blackColor]]; - [_cancelLabel setTextAlignment:NSTextAlignmentCenter]; - [_cancelLabel setTextColor:[UIColor whiteColor]]; - [_cancelLabel setText:@"\u2718"]; - [_cancelLabel setFont:[UIFont fontWithName:@"TimesNewRomanPS-BoldMT" size:20]]; - _cancelLabel.layer.cornerRadius = 15; - _cancelLabel.layer.borderColor = [[UIColor whiteColor] CGColor]; - _cancelLabel.layer.borderWidth = 1.5; - - - UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(215, -15, 30, 30)]; - [button addSubview:_cancelLabel]; - - [button addTarget:self action:@selector(cancelDownload:) forControlEvents:UIControlEventTouchUpInside]; - [self addSubview:button]; //[iv release]; - } - _responseData = nil; - alertType = GIDAAlertViewProgressTime; - } - return self; -} --(void)moveProgress { - if (progress <= 1.0) { - progress += 0.1; - [_progressBar updateProgress:progress]; - } else { - [_timer invalidate]; - _timer = nil; - [self dismissWithClickedButtonIndex:0 animated:NO]; - } -} --(void)presentProgressBar { - [self show]; - _timer = [NSTimer timerWithTimeInterval:timeSeconds target:self selector:@selector(moveProgress) userInfo:nil repeats:YES]; - [[NSRunLoop mainRunLoop] addTimer:_timer forMode:NSDefaultRunLoopMode]; -} - --(id) initWithSpinnerWith:(NSString *)message { - self = [super initWithTitle:@"\n\n\n\n\n" message:nil delegate:nil cancelButtonTitle:nil otherButtonTitles:nil]; - if (self) { - withSpinnerOrImage = YES; - if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) { - [super setTitle:@""]; - UIActivityIndicatorView *theSpinner=[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; - [theSpinner setFrame:CGRectMake(50, 5, 100, 100)]; - - [theSpinner startAnimating]; - - _backgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 160)]; - [_backgroundView setBackgroundColor:[UIColor clearColor]]; - _messageExtraLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 110, 160, 50)]; - [_messageExtraLabel setTextAlignment:NSTextAlignmentCenter]; - [_messageExtraLabel setText:message]; - [_messageExtraLabel setBackgroundColor:[UIColor clearColor]]; - [_messageExtraLabel setTextColor:[UIColor colorWithRed:(28.0/255) green:(130.0/255) blue:(251.0/255) alpha:1]]; - [_messageExtraLabel setFont:[UIFont boldSystemFontOfSize:20]]; - [_messageExtraLabel setAdjustsFontSizeToFitWidth:YES]; - - [_backgroundView addSubview:theSpinner]; - [_backgroundView addSubview:_messageExtraLabel]; - - [self setValue:_backgroundView forKey:@"accessoryView"]; - } else { - _backgroundView = [[UIView alloc] initWithFrame:CGRectMake(40, -10, 200, 200)]; - [_backgroundView setBackgroundColor:[UIColor blackColor]]; - [_backgroundView setAlpha:0.8]; - _backgroundView.layer.cornerRadius = 15; - [self addSubview:_backgroundView]; - UIActivityIndicatorView *theSpinner=[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; - [theSpinner setFrame:CGRectMake(90, 25, 100, 100)]; - - [theSpinner startAnimating]; - [self addSubview:theSpinner]; - _messageLabel = [[UILabel alloc] initWithFrame:CGRectMake(62, 125, 160, 50)]; - [_messageLabel setTextAlignment:NSTextAlignmentCenter]; - [_messageLabel setText:message]; - [_messageLabel setBackgroundColor:[UIColor clearColor]]; - [_messageLabel setTextColor:[UIColor whiteColor]]; - [_messageLabel setFont:[UIFont fontWithName:@"TimesNewRomanPS-BoldMT" size:20]]; - [_messageLabel setAdjustsFontSizeToFitWidth:YES]; - [self addSubview:_messageLabel]; - } - _responseData = nil; - alertType = GIDAAlertViewSpinner; - } - return self; -} -- (id)initWithPrompt:(NSString *)prompt cancelButtonTitle:(NSString *)cancelTitle acceptButtonTitle:(NSString *)acceptTitle { - _responseData = nil; - alertType = GIDAAlertViewPrompt; - if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) { - if (self = [super initWithTitle:prompt message:nil delegate:self cancelButtonTitle:cancelTitle otherButtonTitles:acceptTitle, nil]) { - [self setAlertViewStyle:UIAlertViewStylePlainTextInput]; - } - } else { - while ([prompt sizeWithFont:[UIFont systemFontOfSize:18.0] constrainedToSize:CGSizeMake(240, 1000)].width > 240.0) { - prompt = [NSString stringWithFormat:@"%@...", [prompt substringToIndex:[prompt length] - 4]]; - } - NSString *heightString = @"\n"; - NSInteger bm; - if ([[[UIDevice currentDevice] systemVersion] floatValue] < 6.0) { - bm = UILineBreakModeWordWrap; - } else { - bm = NSLineBreakByWordWrapping; - } - CGFloat height = [prompt sizeWithFont:[UIFont systemFontOfSize:18.0] constrainedToSize:CGSizeMake(240, 1000) lineBreakMode:bm].height; - for (int i = 0; i < height; i+=22) { - heightString = [heightString stringByAppendingString:@"\n"]; - } - - NSString *total = [prompt stringByAppendingString:heightString]; - height = [total sizeWithFont:[UIFont systemFontOfSize:18.0] constrainedToSize:CGSizeMake(240, 1000) lineBreakMode:bm].height; - if (self = [super initWithTitle:prompt message:heightString delegate:nil cancelButtonTitle:cancelTitle otherButtonTitles:acceptTitle, nil]) { - - _backgroundView = [[UIView alloc] initWithFrame:super.frame]; - [_backgroundView setBackgroundColor:[UIColor blackColor]]; - [_backgroundView setAlpha:0.8]; - _backgroundView.layer.cornerRadius = 15; - [self addSubview:_backgroundView]; - withSpinnerOrImage = NO; - _textField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, height+10, 260.0, 31.0)]; - [_textField setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter]; - [_textField setAutocorrectionType:UITextAutocorrectionTypeNo]; - [_textField setBorderStyle:UITextBorderStyleRoundedRect]; - [_textField setTextAlignment:NSTextAlignmentCenter]; - [_textField setKeyboardAppearance:UIKeyboardAppearanceAlert]; - [self addSubview:_textField]; - - _alertColor = [UIColor blackColor]; - } - } - return self; -} - --(void)drawRect:(CGRect)rect { - // if (alertType == GIDAAlertViewPrompt || alertType == GIDAAlertViewNoPrompt) { - [_backgroundView setFrame:rect]; - [self sendSubviewToBack:_backgroundView]; - _backgroundView.layer.borderColor = [[UIColor whiteColor] CGColor]; - _backgroundView.layer.borderWidth = 1.5; - // } -} -- (id)initWithImage:(UIImage *)image andMessage:(NSString *)message cancelButtonTitle:(NSString *)cancelTitle acceptButtonTitle:(NSString *)acceptTitle { - withSpinnerOrImage = NO; - _responseData = nil; - alertType = GIDAAlertViewPrompt; - - if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) { - if (self = [super initWithTitle:message message:nil delegate:nil cancelButtonTitle:cancelTitle otherButtonTitles:acceptTitle, nil]) { - - _backgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 160, 130)]; - [_backgroundView setBackgroundColor:[UIColor clearColor]]; - - UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; - [imageView setFrame:CGRectMake(40, 5, 80, 80)]; - - UILabel *messageLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 85, 160, 50)]; - [messageLabel setTextAlignment:NSTextAlignmentCenter]; - [messageLabel setText:message]; - [messageLabel setBackgroundColor:[UIColor clearColor]]; - [messageLabel setTextColor:[UIColor colorWithRed:(28.0/255) green:(130.0/255) blue:(251.0/255) alpha:1]]; - [messageLabel setFont:[UIFont boldSystemFontOfSize:20]]; - [messageLabel setAdjustsFontSizeToFitWidth:YES]; - [messageLabel removeFromSuperview]; - - [_backgroundView addSubview:imageView]; - [_backgroundView addSubview:messageLabel]; - - [self setValue:_backgroundView forKey:@"accessoryView"]; - } - } else { - while ([message sizeWithFont:[UIFont systemFontOfSize:18.0]].width > 240.0) { - message = [NSString stringWithFormat:@"%@...", [message substringToIndex:[message length] - 4]]; - } - NSString *height = @"\n"; - for (int i = 0; i < image.size.height; i+=14) { - height = [height stringByAppendingString:@"\n"]; - } - if (self = [super initWithTitle:message message:height delegate:nil cancelButtonTitle:cancelTitle otherButtonTitles:acceptTitle, nil]) { - _backgroundView = [[UIView alloc] initWithFrame:CGRectMake(40, -10, 200, 200)]; - [_backgroundView setBackgroundColor:[UIColor blackColor]]; - [_backgroundView setAlpha:0.8]; - _backgroundView.layer.cornerRadius = 15; - [self addSubview:_backgroundView]; - UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; - CGSize imageSize = image.size; - CGRect imageViewFrame = CGRectMake((280-imageSize.width)/2, 20.0f, imageSize.width, imageSize.height); - [imageView setFrame:imageViewFrame]; - UITextField *theTextField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, imageSize.height+40.0, 260.0, 31.0)]; - [theTextField setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter]; - [theTextField setAutocorrectionType:UITextAutocorrectionTypeNo]; - [theTextField setBorderStyle:UITextBorderStyleRoundedRect]; - [theTextField setTextAlignment:NSTextAlignmentCenter]; - [theTextField setKeyboardAppearance:UIKeyboardAppearanceAlert]; - [self addSubview:imageView]; - [self addSubview:theTextField]; - self.textField = theTextField; - - _alertColor = [UIColor blackColor]; - - } - } - return self; -} - --(id)initWithTitle:(NSString *)title message:(NSString *)message delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ... { - self = [super initWithTitle:title message:message delegate:delegate cancelButtonTitle:cancelButtonTitle otherButtonTitles:nil]; - if (self) { - alertType = GIDAAlertViewNoPrompt; - - if ([[[UIDevice currentDevice] systemVersion] floatValue] < 7.0) { - _backgroundView = [[UIView alloc] initWithFrame:CGRectMake(40, -10, 200, 200)]; - [_backgroundView setBackgroundColor:[UIColor blackColor]]; - [_backgroundView setAlpha:0.8]; - _backgroundView.layer.cornerRadius = 15; - [self addSubview:_backgroundView]; - } else { - _messageLabel = [[UILabel alloc] initWithFrame:CGRectMake(62, 125, 160, 50)]; - [_messageLabel setTextAlignment:NSTextAlignmentCenter]; - [_messageLabel setText:message]; - [_messageLabel setBackgroundColor:[UIColor clearColor]]; - [_messageLabel setTextColor:[UIColor whiteColor]]; - [_messageLabel setFont:[UIFont fontWithName:@"TimesNewRomanPS-BoldMT" size:20]]; - [_messageLabel setAdjustsFontSizeToFitWidth:YES]; - [self addSubview:_messageLabel]; - } - } - return self; -} - --(id)initWithTitle:(NSString *)title cancelButtonTitle:(NSString *)cancelTitle acceptButtonTitle:(NSString *)acceptTitle andMessage:(NSString *)message { - while ([title sizeWithFont:[UIFont systemFontOfSize:18.0]].width > 240.0) { - title = [NSString stringWithFormat:@"%@...", [title substringToIndex:[title length] - 4]]; - } - - if (self = [super initWithTitle:title message:@"\n" delegate:self cancelButtonTitle:cancelTitle otherButtonTitles:acceptTitle, nil]) { - withSpinnerOrImage = NO; - _backgroundView = [[UIView alloc] initWithFrame:CGRectMake(40, -10, 200, 200)]; - [_backgroundView setBackgroundColor:[UIColor blackColor]]; - [_backgroundView setAlpha:0.8]; - _backgroundView.layer.cornerRadius = 15; - [self addSubview:_backgroundView]; - _messageLabel = [[UILabel alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 31.0)]; - [_messageLabel setBackgroundColor:[UIColor clearColor]]; - [_messageLabel setTextColor:[UIColor whiteColor]]; - [_messageLabel setTextAlignment:NSTextAlignmentCenter]; - [_messageLabel setText:message]; - [self addSubview:_messageLabel]; - _alertColor = [UIColor blackColor]; - - _responseData = nil; - alertType = GIDAAlertViewNoPrompt; - } - return self; -} - --(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { - _totalFileSize = response.expectedContentLength; - _responseData = [[NSMutableData alloc] init]; - _mimeType = [response MIMEType]; - _textEncoding = [response textEncodingName]; -} - --(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { - _receivedDataBytes += [data length]; - progress = _receivedDataBytes / (float)_totalFileSize; - [_responseData appendData:data]; - - if (progress < 1 && progress >= 0) { - [_progressBar updateProgress:progress]; - } else { - [_progressBar updateProgress:1]; - } -} - --(void)connectionDidFinishLoading:(NSURLConnection *)connection { - [_progressBar updateProgress:1]; - double delayInSeconds = 0.7; - dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); - dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ - [self dismissWithClickedButtonIndex:0 animated:NO]; - }); -} - --(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { - NSLog(@"%@",[error description]); - - double delayInSeconds = 0.5; - dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); - dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ - _responseData = nil; - failedDownload = YES; - _downloadError = @"Connection failed!"; - [self dismissWithClickedButtonIndex:0 animated:NO]; - }); -} - --(void)cancelDownload:(id)sender { - [_connection cancel]; - failedDownload = YES; - _downloadError = @"Connection cancelled"; - - [self dismissWithClickedButtonIndex:0 animated:YES]; -} - -- (id)initWithProgressBarWith:(NSString *)message andURL:(NSURL *)url { - _receivedDataBytes = 0; - _totalFileSize = 0; - progress = -0.1; - withSpinnerOrImage = YES; - failedDownload = NO; - _responseData = nil; - _userURL = url; - alertType = GIDAAlertViewProgressURL; - - if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) { - //Cancel button, not available now due to iOS 7 can not handle modifications to alertView - // if(self = [super initWithTitle:@"" message:nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil]){ - if (self = [super initWithTitle:nil message:nil delegate:self cancelButtonTitle:nil otherButtonTitles: nil]) { - _progressBar = [[ProgressBar alloc] initWithFrame:CGRectMake(50, 5, 100, 100)]; - [_progressBar setProgressLabelColor:[UIColor grayColor]]; - [_progressBar setProgressColor:[UIColor colorWithRed:(28.0/255) green:(130.0/255) blue:(251.0/255) alpha:1]]; - _backgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 160)]; - [_backgroundView setBackgroundColor:[UIColor clearColor]]; - _messageExtraLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 110, 160, 50)]; - [_messageExtraLabel setTextAlignment:NSTextAlignmentCenter]; - [_messageExtraLabel setText:message]; - [_messageExtraLabel setBackgroundColor:[UIColor clearColor]]; - [_messageExtraLabel setTextColor:[UIColor colorWithRed:(28.0/255) green:(130.0/255) blue:(251.0/255) alpha:1]]; - [_messageExtraLabel setFont:[UIFont boldSystemFontOfSize:20]]; - [_messageExtraLabel setAdjustsFontSizeToFitWidth:YES]; - [_messageExtraLabel removeFromSuperview]; - [_backgroundView addSubview:_progressBar]; - [_backgroundView addSubview:_messageExtraLabel]; - - [self setValue:_backgroundView forKey:@"accessoryView"]; - } - } else { - self = [super initWithTitle:@"\n\n\n\n\n" message:nil delegate:nil cancelButtonTitle:nil otherButtonTitles:nil]; - if (self) { - _backgroundView = [[UIView alloc] initWithFrame:CGRectMake(40, -10, 200, 200)]; - [_backgroundView setBackgroundColor:[UIColor blackColor]]; - [_backgroundView setAlpha:0.8]; - _backgroundView.layer.cornerRadius = 15; - [self addSubview:_backgroundView]; - - _progressBar = [[ProgressBar alloc] initWithFrame:CGRectMake(90, 25, 100, 100)]; - [self addSubview:_progressBar]; - - _messageLabel = [[UILabel alloc] initWithFrame:CGRectMake(40, 136, 200, 44)]; - [_messageLabel setTextAlignment:NSTextAlignmentCenter]; - [_messageLabel setText:message]; - [_messageLabel setBackgroundColor:[UIColor clearColor]]; - [_messageLabel setTextColor:[UIColor whiteColor]]; - [_messageLabel setFont:[UIFont fontWithName:@"TimesNewRomanPS-BoldMT" size:20]]; - [_messageLabel setAdjustsFontSizeToFitWidth:YES]; - [self addSubview:_messageLabel]; - } - } - return self; -} -- (id)initWithProgressCircleWith:(NSString *)message andURL:(NSURL *)url { - _receivedDataBytes = 0; - _totalFileSize = 0; - progress = -0.1; - withSpinnerOrImage = YES; - failedDownload = NO; - _responseData = nil; - _userURL = url; - alertType = GIDAAlertViewProgressURL; - - if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) { - if(self = [super initWithTitle:@"" message:nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil]){ - _progressBar = [[LoadingCircle alloc] initWithFrame:CGRectMake(50, 5, 100, 100)]; - [_progressBar setProgressLabelColor:[UIColor colorWithRed:(28.0/255) green:(130.0/255) blue:(251.0/255) alpha:1]]; - [_progressBar setProgressColor:[UIColor colorWithRed:(28.0/255) green:(130.0/255) blue:(251.0/255) alpha:1]]; - _backgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 160)]; - [_backgroundView setBackgroundColor:[UIColor clearColor]]; - _messageExtraLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 110, 160, 50)]; - [_messageExtraLabel setTextAlignment:NSTextAlignmentCenter]; - [_messageExtraLabel setText:message]; - [_messageExtraLabel setBackgroundColor:[UIColor clearColor]]; - [_messageExtraLabel setTextColor:[UIColor colorWithRed:(28.0/255) green:(130.0/255) blue:(251.0/255) alpha:1]]; - [_messageExtraLabel setFont:[UIFont boldSystemFontOfSize:20]]; - [_messageExtraLabel setAdjustsFontSizeToFitWidth:YES]; - [_messageExtraLabel removeFromSuperview]; - [_backgroundView addSubview:_progressBar]; - [_backgroundView addSubview:_messageExtraLabel]; - - [self setValue:_backgroundView forKey:@"accessoryView"]; - } - } else { - - self = [super initWithTitle:@"\n\n\n\n\n" message:nil delegate:nil cancelButtonTitle:nil otherButtonTitles:nil]; - if (self) { - _backgroundView = [[UIView alloc] initWithFrame:CGRectMake(40, -10, 200, 200)]; - [_backgroundView setBackgroundColor:[UIColor blackColor]]; - [_backgroundView setAlpha:0.8]; - _backgroundView.layer.cornerRadius = 15; - [self addSubview:_backgroundView]; - - _progressBar = [[LoadingCircle alloc] initWithFrame:CGRectMake(90, 20, 100, 100)]; - [self addSubview:_progressBar]; - - _messageLabel = [[UILabel alloc] initWithFrame:CGRectMake(62, 125, 160, 50)]; - [_messageLabel setTextAlignment:NSTextAlignmentCenter]; - [_messageLabel setText:message]; - [_messageLabel setBackgroundColor:[UIColor clearColor]]; - [_messageLabel setTextColor:[UIColor whiteColor]]; - [_messageLabel setFont:[UIFont fontWithName:@"TimesNewRomanPS-BoldMT" size:20]]; - [_messageLabel setAdjustsFontSizeToFitWidth:YES]; - [self addSubview:_messageLabel]; - } - } - return self; -} - - -- (void)setColor:(UIColor *)color { - if ([[[UIDevice currentDevice] systemVersion] floatValue] < 7.0) { - _alertColor = color; - if (_backgroundView) { - [_backgroundView setBackgroundColor:color]; - } - if (_cancelLabel) { - [_cancelLabel setBackgroundColor:color]; - } - } else { - switch (alertType) { - case GIDAAlertViewCheck: - [_messageExtraLabel setTextColor:color]; - [_labelMark setTextColor:color]; - break; - case GIDAAlertViewProgressURL: - [_messageExtraLabel setTextColor:color]; - [_progressBar setProgressColor:color]; - if ([_progressBar isKindOfClass:[LoadingCircle class]]) { - [_progressBar setProgressLabelColor:color]; - } - break; - default: - [_messageExtraLabel setTextColor:color]; - break; - } - } -} - -- (void)show { - [_textField becomeFirstResponder]; - [super show]; -} - -- (NSString *)enteredText { - return _entered; -} -- (NSString *)message { - return [[self messageLabel] text]; -} - - -- (void) layoutSubviews { - for (UIView *sub in [self subviews]) - { - if ([sub isKindOfClass:[UIImageView class]] && sub.tag == 0) { - [sub removeFromSuperview]; - break; - } - } -} - --(void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated { - [super dismissWithClickedButtonIndex:buttonIndex animated:animated]; -} --(void)setDelegate:(id)delegate { - [super setDelegate:self]; - _gavdelegate = delegate; -} --(void)presentAlertWithSpinnerAndHideAfterSelector:(SEL)selector from:(id)sender withObject:(id)object { - [self show]; - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Warc-performSelector-leaks" - [sender performSelector:selector withObject:object]; -#pragma clang diagnostic pop - dispatch_async(dispatch_get_main_queue(), ^ - { - [self dismissWithClickedButtonIndex:0 animated:YES]; - }); - }); -} --(id)initWithCharacter:(NSString *)character andMessage:(NSString *)message{ - withSpinnerOrImage = YES; - _responseData = nil; - alertType = GIDAAlertViewCheck; - - if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) { - if (self = [super initWithTitle:nil message:nil delegate:nil cancelButtonTitle:nil otherButtonTitles:nil]) { - - _backgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 160, 130)]; - [_backgroundView setBackgroundColor:[UIColor clearColor]]; - - _labelMark = [[UILabel alloc] initWithFrame:CGRectMake(0, 5, 160, 80)]; - [_labelMark setTextAlignment:NSTextAlignmentCenter]; - [_labelMark setTextColor:[UIColor whiteColor]]; - [_labelMark setBackgroundColor:[UIColor clearColor]]; - [_labelMark setText:character]; - [_labelMark setFont:[UIFont fontWithName:@"ZapfDingbatsITC" size:100]]; - - _messageExtraLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 90, 160, 50)]; - [_messageExtraLabel setTextAlignment:NSTextAlignmentCenter]; - [_messageExtraLabel setText:message]; - [_messageExtraLabel setBackgroundColor:[UIColor clearColor]]; - [_messageExtraLabel setTextColor:[UIColor colorWithRed:(28.0/255) green:(130.0/255) blue:(251.0/255) alpha:1]]; - [_messageExtraLabel setFont:[UIFont boldSystemFontOfSize:20]]; - [_messageExtraLabel setAdjustsFontSizeToFitWidth:YES]; - [_messageExtraLabel removeFromSuperview]; - - [_backgroundView addSubview:_labelMark]; - [_backgroundView addSubview:_messageExtraLabel]; - [self setValue:_backgroundView forKey:@"accessoryView"]; - } - } else { - self = [super initWithTitle:@"\n\n\n\n\n" message:nil delegate:nil cancelButtonTitle:nil otherButtonTitles:nil]; - if (self) { - _backgroundView = [[UIView alloc] initWithFrame:CGRectMake(40, -10, 200, 200)]; - [_backgroundView setBackgroundColor:[UIColor blackColor]]; - [_backgroundView setAlpha:0.8]; - _backgroundView.layer.cornerRadius = 15; - [self addSubview:_backgroundView]; - - UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(40, 15, 200, 120)]; - [label setTextAlignment:NSTextAlignmentCenter]; - [label setTextColor:[UIColor whiteColor]]; - [label setBackgroundColor:[UIColor clearColor]]; - [label setText:character]; - [label setFont:[UIFont fontWithName:@"ZapfDingbatsITC" size:100]]; - [self addSubview:label]; - - _messageLabel = [[UILabel alloc] initWithFrame:CGRectMake(62, 125, 160, 50)]; - [_messageLabel setTextAlignment:NSTextAlignmentCenter]; - [_messageLabel setText:message]; - [_messageLabel setBackgroundColor:[UIColor clearColor]]; - [_messageLabel setTextColor:[UIColor whiteColor]]; - [_messageLabel setFont:[UIFont fontWithName:@"TimesNewRomanPS-BoldMT" size:20]]; - [_messageLabel setAdjustsFontSizeToFitWidth:YES]; - [self addSubview:_messageLabel]; - } - } - return self; -} --(id)initWithCheckMarkAndMessage:(NSString *)message { - self = [self initWithCharacter:@"✓" andMessage:message]; - return self; -} - --(id)initWithExclamationMarkAndMessage:(NSString *)message { - self = [self initWithCharacter:@"❢" andMessage:message]; - return self; -} - --(id)initWithXMarkWith:(NSString *)message { - self = [self initWithCharacter:@"\u2718" andMessage:message]; - return self; -} --(void)presentAlertFor:(float)seconds { - [self show]; - dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(seconds * NSEC_PER_SEC)); - dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ - [self dismissWithClickedButtonIndex:0 animated:YES]; - }); -} - --(NSDictionary *)getDownloadedData { - NSDictionary *dictionary; - if (failedDownload) { - dictionary = [NSDictionary dictionaryWithObject:_downloadError forKey:@"error"]; - } else { - dictionary = [NSDictionary dictionaryWithObjectsAndKeys: - _responseData, @"data", - _userURL, @"url", - _mimeType, @"mime", - _textEncoding, @"encoding", - nil]; - } - return dictionary; -} --(void)progresBarStartDownload { - [self show]; - NSURLRequest *request = [NSURLRequest requestWithURL:_userURL cachePolicy:NSURLCacheStorageNotAllowed timeoutInterval:20.0]; - _connection = [NSURLConnection connectionWithRequest:request delegate:self]; - [_connection start]; - -} - --(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { - - if (buttonIndex == 1) { - acceptedAlert = YES; - if (alertType == GIDAAlertViewPrompt) { - if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) { - _entered = [[alertView textFieldAtIndex:0] text]; - } else { - _entered = [[(GIDAAlertView *)alertView textField] text]; - } - } - } else { - acceptedAlert = NO; - if (alertType == GIDAAlertViewProgressURL) { - [self cancelDownload:nil]; - } - } - if ([_gavdelegate respondsToSelector:@selector(alertOnClicked:)]) - [_gavdelegate alertOnClicked:(GIDAAlertView *)alertView]; - if (alertType == GIDAAlertViewPrompt) { - [_textField resignFirstResponder]; - } -} --(BOOL)accepted { - return acceptedAlert; -} --(void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex { - if (buttonIndex == 1) { - acceptedAlert = YES; - } else { - acceptedAlert = NO; - } - if([_gavdelegate respondsToSelector:@selector(alertOnDismiss:)]) - [_gavdelegate alertOnDismiss:(GIDAAlertView *)alertView]; - if ([_gavdelegate respondsToSelector:@selector(alertFinished:)]) - [_gavdelegate alertFinished:(GIDAAlertView *)alertView]; -} --(void)setProgressBarColor:(UIColor *)color { - [_progressBar setProgressColor:color]; -} - --(void)setKeyboard:(UIKeyboardType)keyboard { - if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) { - [[self textFieldAtIndex:0] setKeyboardType:keyboard]; - } else { - [_textField setKeyboardType:keyboard]; - } -} -@end diff --git a/MATSOL/GIDAUtilities/GIDACalculateString.h b/MATSOL/GIDAUtilities/GIDACalculateString.h deleted file mode 100644 index d98916c..0000000 --- a/MATSOL/GIDAUtilities/GIDACalculateString.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// GIDACalculateString.h -// Demo -// -// Created by Alejandro Paredes Alva on 2/11/13. -// Copyright (c) 2013 Alejandro Paredes Alva. All rights reserved. -// - -#import - -@interface GIDACalculateString : NSObject - -+(BOOL)usingThis:(NSString *)string addThis:(NSString *)newString; -+(BOOL)usingThis:(NSString *)string addThis:(NSString *)newString here:(NSRange)range; - -+(NSString *)stringFrom:(NSString *)string withThis:(NSString *)newString; -+(NSString *)stringFrom:(NSString *)string withThis:(NSString *)newString here:(NSRange)range; - -+(NSNumber *)solveString:(NSString *)string; - -@end diff --git a/MATSOL/GIDAUtilities/GIDACalculateString.m b/MATSOL/GIDAUtilities/GIDACalculateString.m deleted file mode 100644 index 0cb90d5..0000000 --- a/MATSOL/GIDAUtilities/GIDACalculateString.m +++ /dev/null @@ -1,518 +0,0 @@ -// -// GIDACalculateString.m -// Demo -// -// Created by Alejandro Paredes Alva on 2/11/13. -// Copyright (c) 2013 Alejandro Paredes Alva. All rights reserved. -// - -#import "GIDACalculateString.h" - -enum { - GIDAOperatorNone = 0, - GIDAOperatorOpenParentheses = 1, - GIDAOperatorCloseParentheses = 2, - GIDAOperatorFraction = 3, - GIDAOperatorTimes = 4, - GIDAOperatorPlus = 5, - GIDAOperatorMinus = 6 -}; -typedef NSUInteger GIDAOperator; - -@interface GIDACalculateString () - -+(BOOL)checkFor:(char)character inThis:(NSString *)string fromThis:(int)position whereThisAre:(NSCharacterSet *)notAllowed andThisHelps:(NSCharacterSet *)toStop; -+(BOOL)checkThis:(NSString *)string atThis:(int)position ifLeftDoesNotHave:(NSCharacterSet *)leftCheck norRightHas:(NSCharacterSet *)rightCheck allowFirst:(BOOL)first; -+(int)openParenthesesFor:(NSString *)string toLocation:(int)position; -+(NSString *)fixString:(NSString *)string; -+(NSNumber *)solveString:(NSString *)string andOperator:(GIDAOperator)operator; -+(NSArray *)splitString:(NSString *)string byOperator:(GIDAOperator)operator; -+(NSArray *)splitFirstParentheses:(NSString *)string; - -@end - -@implementation GIDACalculateString - - -//String appending newString to String. -+(NSString *)stringFrom:(NSString *)string withThis:(NSString *)newString { - return [string stringByAppendingString:newString]; -} - -//String by cutting at the range location and putting the newString in between. -+(NSString *)stringFrom:(NSString *)string withThis:(NSString *)newString here:(NSRange)range { - NSString *fullString = nil; - if ([self usingThis:string addThis:newString here:range]) { - NSString *preString = [string substringToIndex:range.location]; - NSString *postString = [string substringFromIndex:range.location]; - fullString = [[preString stringByAppendingString:newString] stringByAppendingString:postString]; - } else { - fullString = string; - } - return fullString; -} - -//Check if the character at position and its left is not included in a list of characters. Each side has special characters not allowed. -+(BOOL)checkThis:(NSString *)string atThis:(int)position ifLeftDoesNotHave:(NSCharacterSet *)leftCheck norRightHas:(NSCharacterSet *)rightCheck allowFirst:(BOOL)first{ - BOOL success = YES; - - //Do a check to the left character. - if (position!= 0) { - if ([leftCheck characterIsMember:[string characterAtIndex:position-1]]) - success = NO; - } else { - //If the position is 0 and it is not allowed to be the first character, then say it can't be placed there. - if (!first) { - success = NO; - } - } - - //Do a check to the right of there the character will be. (its the position) - if (position < [string length]) { - if ([rightCheck characterIsMember:[string characterAtIndex:position]]) { - success = NO; - } - } - - return success; -} - -//Go from position to left and right to check if there is a character not allowed. Can use extra characters to stop search. -+(BOOL)checkFor:(char)character inThis:(NSString *)string fromThis:(int)position whereThisAre:(NSCharacterSet *)notAllowed andThisHelps:(NSCharacterSet *)toStop { - BOOL success = YES; - - //Check from the begining until: the position, found a character that helps the stop or found a not allowed character. - for (int i = position; i >= 0; i--) { - if ([notAllowed characterIsMember:[string characterAtIndex:i]]) { - success = NO; - i = -1; - } else { - if ([toStop characterIsMember:[string characterAtIndex:i]]) { - i = -1; - } - } - } - - //Check to the right until: the end, found a character that helps the stop or found a not allowed character. - for (int i = position; i < [string length]; i++) { - if ([notAllowed characterIsMember:[string characterAtIndex:i]]) { - success = NO; - i = [string length]; - } else { - if ([toStop characterIsMember:[string characterAtIndex:i]]) { - i = [string length]; - } - } - } - - return success; -} - -//Check if the string contains parentheses. Split the string with '('. -//If more than 1 object at array that means there is at least 1 parenthesis. -+(BOOL)hasParentheses:(NSString *)string { - NSArray *array = [string componentsSeparatedByString:@"("]; - if ([array count] > 1) { - return YES; - } - return NO; -} - -//How many parentheses are left open from begining of string to position. -+(int)openParenthesesFor:(NSString *)string toLocation:(int)position { - int open = 0; - int close = 0; - - for (int i = 0; i < position; i++) { - switch ([string characterAtIndex:i]) { - case '(': - open++; - break; - case ')': - close++; - break; - } - } - - return open - close; -} - -//call the same function but with the position at the end. Use this if it is always at the end. -//If not use the same but with aroundThis:range. -+(BOOL)usingThis:(NSString *)string addThis:(NSString *)newString { - return [self usingThis:string addThis:newString here:(NSMakeRange(0, [string length]))]; -} - -//Check if the newString is a valid string or character to add to the string in the range position. -+(BOOL)usingThis:(NSString *)string addThis:(NSString *)newString here:(NSRange)range { - BOOL success = YES; - - //if newString is empty then it means it wants to delete. - //As default all deletions are allowed. - if ([newString length] == 0) { - return YES; - } - - //Selecting several characters to delete and insert new character at position. - //Cut string, remove the middle part and put together the sides. - if (range.length > 0) { - NSString *preString = [string substringToIndex:range.location]; - NSString *postString = [string substringFromIndex:range.location+range.length]; - string = [preString stringByAppendingString:postString]; - } - - //If the newString has more than one character. - //Go through each character checking if it is allowed in the string. - //If the character is allowed it is appended to the string to continue checking the next character. - if ([newString length] > 1) { - range.length = 0; - for (int i = 0; i < [newString length]; i++) { - if ([self usingThis:string addThis:[NSString stringWithFormat:@"%c",[newString characterAtIndex:i]] here:range]) { - string = [string stringByAppendingFormat:@"%c",[newString characterAtIndex:i]]; - range.location ++; - } else { - success = NO; - i = [newString length]; - } - } - } else { - //newString is of 1 character. - - //If its the first character to input, check if it is an allowed character. - //Allowed characters as first character of input are '.', '-', '(' and numbers from 0 to 9. - if ([string length] == 0 || range.location == 0) { - if ([newString characterAtIndex:0] == '.' || [newString characterAtIndex:0] == '-' || [newString characterAtIndex:0] == '(' || ([newString characterAtIndex:0] >= '0' && [newString characterAtIndex:0] <= '9')) { - success = YES; - } else { - success = NO; - } - } else { - NSCharacterSet *notAllowed; - NSCharacterSet *toStop; - NSCharacterSet *left; - NSCharacterSet *right; - - //Depending on the character to add differend operations are handled. - switch ([newString characterAtIndex:0]) { - case '.': - //The user is not allowed to put only ONE '.' in a series of numbers in between operators. - notAllowed = [NSCharacterSet characterSetWithCharactersInString:@"."]; - toStop = [NSCharacterSet characterSetWithCharactersInString:@"()/+-*"]; - success = [self checkFor:'.' inThis:string fromThis:range.location-1 whereThisAre:notAllowed andThisHelps:toStop]; - break; - case '+': - //The user is not allowed to put a '+' sign when on the left there is a '(', '+', '-', '*', or '/'. - //To the right of a '+' sign there can not be a ')', '+', '-', '*', or '/'. - left = [NSCharacterSet characterSetWithCharactersInString:@"(+-*/"]; - right = [NSCharacterSet characterSetWithCharactersInString:@"+-*/)"]; - success = [self checkThis:string atThis:range.location ifLeftDoesNotHave:left norRightHas:right allowFirst:NO]; - break; - case '-': - //The user is not allowed to put a '+' sign when on the left there is a '-'. - //To the right of a '-' sign there can not be a ')', '+', '-', '*', or '/'. - left = [NSCharacterSet characterSetWithCharactersInString:@"-"]; - right = [NSCharacterSet characterSetWithCharactersInString:@"+-*/)"]; - success = [self checkThis:string atThis:range.location ifLeftDoesNotHave:left norRightHas:right allowFirst:YES]; - break; - case '*': - //The user is not allowed to put a '*' sign when on the left there is a '(', '+', '-', '*', or '/'. - //To the right of a '*' sign there can not be a ')', '+', '-', '*', or '/'. - left = [NSCharacterSet characterSetWithCharactersInString:@"(+-*/"]; - right = [NSCharacterSet characterSetWithCharactersInString:@"+-*/)"]; - success = [self checkThis:string atThis:range.location ifLeftDoesNotHave:left norRightHas:right allowFirst:NO]; - break; - case '/': - //The user is not allowed to put a '/' sign when on the left there is a '(', '+', '-', '*', or '/'. - //To the right of a '/' sign there can not be a ')', '+', '-', '*', or '/'. - left = [NSCharacterSet characterSetWithCharactersInString:@"(+-*/"]; - right = [NSCharacterSet characterSetWithCharactersInString:@"+*/)"]; - success = [self checkThis:string atThis:range.location ifLeftDoesNotHave:left norRightHas:right allowFirst:NO]; - break; - case '(': - //To put a '(', there can not be a ')', '+', '-', '*', or '/' to the right. - //There is no limitation to the left. '(' can go after any character - left = [NSCharacterSet characterSetWithCharactersInString:@""]; - right = [NSCharacterSet characterSetWithCharactersInString:@"+*/)"]; - success = [self checkThis:string atThis:range.location ifLeftDoesNotHave:left norRightHas:right allowFirst:NO]; - break; - case ')': - //To put a ')', there can not be a ')', '+', '-', '*', or '/' to the left. - //There is no limitation to the right. ')' can go before any character. - //Except if there is no open parentheses from the begining of the string to its position. - left = [NSCharacterSet characterSetWithCharactersInString:@"(+-*/"]; - right = [NSCharacterSet characterSetWithCharactersInString:@""]; - success = [self checkThis:string atThis:range.location ifLeftDoesNotHave:left norRightHas:right allowFirst:NO]; - if (success) { - if ([self openParenthesesFor:string toLocation:range.location] <= 0) { - success = NO; - } - } - break; - default: - //Numbers can go anywhere. - success = YES; - break; - } - } - } - return success; -} - -//Fix the string in case the string presents operation simplifications. -//First replace with keywords so that no error is done when replacing. -//Replace keywords with correct syntax. -+(NSString *)fixString:(NSString *)string { - NSMutableString *mutable = [NSMutableString stringWithString:string]; - - //---THIS COULD BE OPTIMIZED?? ---// - [mutable replaceOccurrencesOfString:@")(" withString:@"CO" options:NSLiteralSearch range:NSMakeRange(0, [string length])]; - [mutable replaceOccurrencesOfString:@"--" withString:@"MM" options:NSLiteralSearch range:NSMakeRange(0, [string length])]; - [mutable replaceOccurrencesOfString:@"-(" withString:@"BM" options:NSLiteralSearch range:NSMakeRange(0, [string length])]; - [mutable replaceOccurrencesOfString:@")-" withString:@"CM" options:NSLiteralSearch range:NSMakeRange(0, [string length])]; - [mutable replaceOccurrencesOfString:@"(-" withString:@"OM" options:NSLiteralSearch range:NSMakeRange(0, [string length])]; - [mutable replaceOccurrencesOfString:@"*-" withString:@"TM" options:NSLiteralSearch range:NSMakeRange(0, [string length])]; - [mutable replaceOccurrencesOfString:@"/-" withString:@"FM" options:NSLiteralSearch range:NSMakeRange(0, [string length])]; - [mutable replaceOccurrencesOfString:@"+-" withString:@"PM" options:NSLiteralSearch range:NSMakeRange(0, [string length])]; - [mutable replaceOccurrencesOfString:@"-" withString:@"+-" options:NSLiteralSearch range:NSMakeRange(0, [string length])]; - [mutable replaceOccurrencesOfString:@"MM" withString:@"+" options:NSLiteralSearch range:NSMakeRange(0, [string length])]; - [mutable replaceOccurrencesOfString:@"PM" withString:@"+-" options:NSLiteralSearch range:NSMakeRange(0, [string length])]; - [mutable replaceOccurrencesOfString:@"FM" withString:@"/-" options:NSLiteralSearch range:NSMakeRange(0, [string length])]; - [mutable replaceOccurrencesOfString:@"TM" withString:@"*-" options:NSLiteralSearch range:NSMakeRange(0, [string length])]; - [mutable replaceOccurrencesOfString:@"OM" withString:@"(-" options:NSLiteralSearch range:NSMakeRange(0, [string length])]; - [mutable replaceOccurrencesOfString:@"CM" withString:@")+-" options:NSLiteralSearch range:NSMakeRange(0, [string length])]; - [mutable replaceOccurrencesOfString:@"BM" withString:@"-1*(" options:NSLiteralSearch range:NSMakeRange(0, [string length])]; - [mutable replaceOccurrencesOfString:@"CO" withString:@")*(" options:NSLiteralSearch range:NSMakeRange(0, [string length])]; - - return mutable; -} - -//Split in string in 3 parts. -//Before the first parentheses -//The parentheses, between open and close. -//After the parentheses. -//If all string is the parentheses then it is put in the middle and empty trings on the sides. -+(NSArray *)splitFirstParentheses:(NSString *)string { - int i = 0; - NSArray *parentheses = nil; - - //Look for the first '(' - for (i = 0; i < [string length]; i++) { - if ([string characterAtIndex:i] == '(') { - break; - } - } - NSString *pre = [string substringToIndex:i]; - - //Did it find a '(' - if (i == [string length]) { - //Did not find a '(', put string in the middle. - parentheses = [NSArray arrayWithObjects:@"",pre, @"", nil]; - } else { - //Did find a '('. - //If the there is a number before '(', then append to pre a '*'. (As it is a simplification) - if (i != 0) { - if ([string characterAtIndex:i-1] >= '0' && [string characterAtIndex:i-1] <= '9') { - pre = [pre stringByAppendingString:@"*"]; - } - } - //par is string where the parentheses is. (without the parentheses) - NSString *par = [string substringFromIndex:i+1]; - - //Look for the close parentheses. Use open in case there are subparentheses inside. - int open = 0; - for (i = 0; i < [par length]; i++) { - if ([par characterAtIndex:i] == '('){ - open ++; - } else { - - if ([par characterAtIndex:i] == ')') { - if (open == 0) { - break; - } else { - open --; - } - } - } - } - - NSString *post = @""; - //If the last character of par is ) then remove it and have post be "". - //If it is not. Cut the string and put the ending part in post. - if (i < [par length] - 1){ - post = [par substringFromIndex:i+1]; - if ([post characterAtIndex:0] >= '0' && [post characterAtIndex:0] <= '9') { - post = [@"*" stringByAppendingString:post]; - } - } - par = [par substringToIndex:i]; - - parentheses = [NSArray arrayWithObjects:pre, par, post, nil]; - } - return parentheses; -} - -//Split a string based on its GIDAOperator. -//Only exception is parentheses and minus. -//Minus does not require spliting as it is considered a negative adition. -//For parentheses call splitFirstPArentheses. -+(NSArray *)splitString:(NSString *)string byOperator:(GIDAOperator)operator { - NSArray *split = nil; - switch (operator) { - case GIDAOperatorOpenParentheses: - split = [self splitFirstParentheses:string]; - break; - case GIDAOperatorPlus: - split = [string componentsSeparatedByString:@"+"]; - break; - case GIDAOperatorTimes: - split = [string componentsSeparatedByString:@"*"]; - break; - case GIDAOperatorFraction: - split = [string componentsSeparatedByString:@"/"]; - break; - default: - break; - } - return split; -} - -//Solve string based on operator. -+(NSNumber *)solveString:(NSString *)string andOperator:(GIDAOperator)operator { - float total = 0; - NSNumber *number = nil; - NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; - [formatter setNumberStyle:NSNumberFormatterDecimalStyle]; - NSNumber *temp = nil; - - //Split the string based on the GIDAOperator. - NSArray *split = [self splitString:string byOperator:operator]; - - //Go through the split string. - for (int i = 0; i < [split count]; i++) { - switch (operator) { - case GIDAOperatorPlus: - //Plus operation. - if (i == 0 && [[split objectAtIndex:i] isEqualToString:@""]){ - } else { - //Try to format to a number. - temp = [formatter numberFromString:[split objectAtIndex:i]]; - if (temp) { - //If it was a number add it to the total, and update number. - total += [temp floatValue]; - number = [NSNumber numberWithFloat:total]; - } else { - //If not a number maybe it has '*' or '/'. So try with '*' - number = [self solveString:[split objectAtIndex:i] andOperator:GIDAOperatorTimes]; - if (!number) { - //Not a number then abort - i = [split count]; - } else { - //Add the value returned to total, and update number. - total += [number floatValue]; - number = [NSNumber numberWithFloat:total]; - } - } - } - break; - case GIDAOperatorTimes: - //Times operator. (Make total 1.0, to be able to do the mutliplications. - if (i == 0) { - total = 1.0; - } - - //Try to format the split string. - temp = [formatter numberFromString:[split objectAtIndex:i]]; - if (temp) { - //It is a number, then multiply it to total, and update number - total *= [temp floatValue]; - number = [NSNumber numberWithFloat:total]; - } else { - //Not a number but it could still be an operation, try with '/'. - number = [self solveString:[split objectAtIndex:i] andOperator:GIDAOperatorFraction]; - if (!number) { - //Still not a number, abort!! - i = [split count]; - } else { - //It was a fraction so we can mutiply the value returned and update number. - total *= [number floatValue]; - number = [NSNumber numberWithFloat:total]; - } - } - break; - case GIDAOperatorFraction: - //Fraction operation. - //Check if the split is a number. - temp = [formatter numberFromString:[split objectAtIndex:i]]; - if (temp) { - //It is a number. - //If it is the begining of the split then use the number as total, and update number. - if (i == 0) { - total = [temp floatValue]; - number = [NSNumber numberWithFloat:total]; - } else { - //It is not the first value of the array, and the division number is different than zero. - //(Division by 0 are considered not valid) - if ([temp floatValue] != 0.0) { - //Divide the total, and update number. - total /= [temp floatValue]; - number = [NSNumber numberWithFloat:total]; - } else { - //Terminate iteration and number is nil, to represent a nonvalid result. - i = [split count]; - number = nil; - } - } - } else { - //Not a number so lets stop and say number is nil. - i = [split count]; - number = nil; - } - break; - default: - //Anyother operator just stop. - i = [split count]; - number = nil; - break; - } - } - - //Return the number. It could be an NSNumber or nil. - return number; -} - - -//Solve the NSString. -//With a string, solve its content if it is an operation if it is not a valid operation returns nil. -+(NSNumber *)solveString:(NSString *)string { - NSNumber *result = nil; - - //Check if it is a valid expression based on parenthesis. - //If it was the same open as close parentheses it is considered valid. - if ([self openParenthesesFor:string toLocation:[string length]] == 0) { - //Fix the string. String might need some help to process eg. )( should be )*( - string = [self fixString:string]; - - //Check if the string has parentheses - if ([self hasParentheses:string]) { - //Try to obtain a special array with the middle object is the string to process - //When done, concatenate all other objects and try to solve recursively. - NSMutableArray *parentheses = [NSMutableArray arrayWithArray:[self splitString:string byOperator:GIDAOperatorOpenParentheses]]; - if (parentheses) { - NSNumber *par = [self solveString:[parentheses objectAtIndex:1]]; - if (par) { - [parentheses setObject:[par stringValue] atIndexedSubscript:1]; - string = [parentheses componentsJoinedByString:@""]; - result = [self solveString:string]; - } - } - } else { - //Start solving based on +, then, * then /. - result = [self solveString:string andOperator:GIDAOperatorPlus]; - } - } - - return result; -} - - -@end diff --git a/MATSOL/MATSOL.xcodeproj/project.pbxproj b/MATSOL/MATSOL.xcodeproj/project.pbxproj index a65736a..56a764d 100644 --- a/MATSOL/MATSOL.xcodeproj/project.pbxproj +++ b/MATSOL/MATSOL.xcodeproj/project.pbxproj @@ -207,8 +207,8 @@ 50020DFF11D576DA00C61974 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 50020E1F11D576DA00C61974 /* MATSOL-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "MATSOL-Info.plist"; sourceTree = ""; }; 5068F7321230978300BAFDBF /* MATSOL.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MATSOL.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 507BBC2C171B1AB9001B9079 /* GIDAAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GIDAAlertView.h; path = GIDAUtilities/GIDAAlertView.h; sourceTree = ""; }; - 507BBC2D171B1AB9001B9079 /* GIDAAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GIDAAlertView.m; path = GIDAUtilities/GIDAAlertView.m; sourceTree = ""; }; + 507BBC2C171B1AB9001B9079 /* GIDAAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GIDAAlertView.h; path = External/GIDAAlertView/GIDAAlertView.h; sourceTree = ""; }; + 507BBC2D171B1AB9001B9079 /* GIDAAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GIDAAlertView.m; path = External/GIDAAlertView/GIDAAlertView.m; sourceTree = ""; }; 507BBC2E171B1AB9001B9079 /* GIDAMatrixCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GIDAMatrixCell.h; path = GIDAUtilities/GIDAMatrixCell.h; sourceTree = ""; }; 507BBC2F171B1AB9001B9079 /* GIDAMatrixCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GIDAMatrixCell.m; path = GIDAUtilities/GIDAMatrixCell.m; sourceTree = ""; }; 507BBC30171B1AB9001B9079 /* GIDAMatrixViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GIDAMatrixViewController.h; path = GIDAUtilities/GIDAMatrixViewController.h; sourceTree = ""; }; @@ -373,8 +373,8 @@ 9CB5F13E128C9351003117AD /* Conversor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Conversor.m; path = Utilities/Conversor.m; sourceTree = ""; }; BEA18BFD151A7C7300B48EB7 /* Parenthesis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Parenthesis.h; path = Classes/Parenthesis.h; sourceTree = ""; }; BEA18BFE151A7C7300B48EB7 /* Parenthesis.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Parenthesis.m; path = Classes/Parenthesis.m; sourceTree = ""; }; - BEC8D1BC16CE968D00D7C442 /* GIDACalculateString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GIDACalculateString.h; path = GIDAUtilities/GIDACalculateString.h; sourceTree = ""; }; - BEC8D1BD16CE968D00D7C442 /* GIDACalculateString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GIDACalculateString.m; path = GIDAUtilities/GIDACalculateString.m; sourceTree = ""; }; + BEC8D1BC16CE968D00D7C442 /* GIDACalculateString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GIDACalculateString.h; path = External/GIDACalculateString/GIDACalculateString.h; sourceTree = ""; }; + BEC8D1BD16CE968D00D7C442 /* GIDACalculateString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GIDACalculateString.m; path = External/GIDACalculateString/GIDACalculateString.m; sourceTree = SOURCE_ROOT; }; BEDD23C51518A3EF004265C2 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */