diff --git a/BT Vendor/BT Vendor.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate b/BT Vendor/BT Vendor.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate index 588c9be..c63a0a2 100644 --- a/BT Vendor/BT Vendor.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate +++ b/BT Vendor/BT Vendor.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate diff --git a/BT Vendor/MenuTableViewController.m b/BT Vendor/MenuTableViewController.m index 2877219..aa0fcec 100644 --- a/BT Vendor/MenuTableViewController.m +++ b/BT Vendor/MenuTableViewController.m @@ -364,13 +364,13 @@ - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { NSLog(@"[MenuTableViewController.m]: Received response from report server: %@",[NSString stringWithUTF8String:[data bytes]]); - [self.view makeToast:NSLocalizedString(@"Report sent successfully", nil) duration:3 position:[NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2)] title:NSLocalizedString(@"Success!", nil) image:[UIImage imageNamed:@"icon_checkmark"]]; + [self.navigationController.view makeToast:NSLocalizedString(@"Report sent successfully", nil) duration:3 position:[NSValue valueWithCGPoint:self.view.center] title:NSLocalizedString(@"Success!", nil) image:[UIImage imageNamed:@"icon_checkmark"]]; } - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { NSLog(@"[MenuTableViewController.m]: Error connecting to server: %@ %@",[error localizedDescription],[[error userInfo] objectForKey:NSURLErrorFailingURLStringErrorKey]); - [self.view makeToast:NSLocalizedString(@"Connection to server failed", nil) duration:3 position:[NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2)] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]]; + [self.navigationController.view makeToast:NSLocalizedString(@"Connection to server failed", nil) duration:3 position:[NSValue valueWithCGPoint:self.view.center] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]]; } //PROTOCOL ERROR CALLBACK - (void) reportProtocolError: (CommunicationProtocol*)protocol didFinishEnteringItem:(NSString*) error @@ -381,7 +381,7 @@ } else { - [self.view makeToast:error duration:3 position:[NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2)] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]]; + [self.navigationController.view makeToast:error duration:3 position:[NSValue valueWithCGPoint:self.view.center] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]]; } } @@ -430,12 +430,12 @@ NSLog(@"[MenuTableViewController.m]: Received A5 answer"); if([response isEqualToString:@"P51"]) { - [self.view makeToast:NSLocalizedString(@"Time and Date changed successfully", nil) duration:3 position:[NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2)] title:nil image:[UIImage imageNamed:@"icon_checkmark"]]; + [self.navigationController.view makeToast:NSLocalizedString(@"Time and Date changed successfully", nil) duration:3 position:[NSValue valueWithCGPoint:self.view.center] title:nil image:[UIImage imageNamed:@"icon_checkmark"]]; } else if([response isEqualToString:@"P52"]) { NSLog(@"[MenuTableViewController.m]: Device returned error for command A5"); - [self.view makeToast:NSLocalizedString(@"Time and Date change returned error", nil) duration:3 position:[NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2)] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]]; + [self.navigationController.view makeToast:NSLocalizedString(@"Time and Date change returned error", nil) duration:3 position:[NSValue valueWithCGPoint:self.view.center] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]]; } } else if(self.sentCommand == A6 && [[response substringToIndex:2]isEqualToString:@"P6"]) @@ -443,12 +443,12 @@ NSLog(@"[MenuTableViewController.m]: Received A6 answer"); if([response isEqualToString:@"P61"]) { - [self.view makeToast:NSLocalizedString(@"Product price changed successfully", nil) duration:3 position:[NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2)] title:nil image:[UIImage imageNamed:@"icon_checkmark"]]; + [self.navigationController.view makeToast:NSLocalizedString(@"Product price changed successfully", nil) duration:3 position:[NSValue valueWithCGPoint:self.view.center] title:nil image:[UIImage imageNamed:@"icon_checkmark"]]; } else if([response isEqualToString:@"P62"]) { NSLog(@"[MenuTableViewController.m]: Device returned error for command A6"); - [self.view makeToast:NSLocalizedString(@"Product price change returned error", nil) duration:3 position:[NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2)] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]]; + [self.navigationController.view makeToast:NSLocalizedString(@"Product price change returned error", nil) duration:3 position:[NSValue valueWithCGPoint:self.view.center] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]]; } } else if(self.sentCommand == A7 && [[response substringToIndex:2]isEqualToString:@"P7"]) @@ -456,12 +456,12 @@ NSLog(@"[MenuTableViewController.m]: Received A7 answer"); if([response isEqualToString:@"P71"]) { - [self.view makeToast:NSLocalizedString(@"Product name changed successfully", nil) duration:3 position:[NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2)] title:nil image:[UIImage imageNamed:@"icon_checkmark"]]; + [self.navigationController.view makeToast:NSLocalizedString(@"Product name changed successfully", nil) duration:3 position:[NSValue valueWithCGPoint:self.view.center] title:nil image:[UIImage imageNamed:@"icon_checkmark"]]; } else if([response isEqualToString:@"P72"]) { NSLog(@"[MenuTableViewController.m]: Device returned error for command A7"); - [self.view makeToast:NSLocalizedString(@"Product name change returned error", nil) duration:3 position:[NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2)] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]]; + [self.navigationController.view makeToast:NSLocalizedString(@"Product name change returned error", nil) duration:3 position:[NSValue valueWithCGPoint:self.view.center] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]]; } } else if(self.sentCommand == BATCH_COMMANDS) @@ -502,7 +502,7 @@ else { [self setSentCommand:NONE]; - [self.view makeToast:NSLocalizedString(@"Device answer timeout occurred", nil) duration:3 position:[NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2)] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]]; + [self.navigationController.view makeToast:NSLocalizedString(@"Device answer timeout occurred", nil) duration:3 position:[NSValue valueWithCGPoint:self.view.center] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]]; } self.controlsDisabled = FALSE; } @@ -536,7 +536,7 @@ if(data == nil) { NSLog(@"[MenuTableViewController.m]: Error obtaining data from URL"); - [self.view makeToast:NSLocalizedString(@"Error obtaining data from URL", nil) duration:3 position:[NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2)] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]]; + [self.navigationController.view makeToast:NSLocalizedString(@"Error obtaining data from URL", nil) duration:3 position:[NSValue valueWithCGPoint:self.view.center] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]]; return; } NSLog(@"[MenuTableViewController.m]: Read file contents from handled URL: %@",contents); @@ -545,7 +545,7 @@ if(!JSONData) { NSLog(@"[MenuTableViewController.m]: %@",error); - [self.view makeToast:[error localizedDescription] duration:3 position:[NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2)] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]]; + [self.navigationController.view makeToast:[error localizedDescription] duration:3 position:[NSValue valueWithCGPoint:self.view.center] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]]; return; } NSString *version = [JSONData objectForKey:@"version"];