|
|
@@ -57,15 +57,19 @@
|
|
|
if([keyPath isEqualToString:@"queue_status"])
|
|
|
{
|
|
|
NSString* msg=@"";
|
|
|
-
|
|
|
+ BOOL useToast = NO;
|
|
|
switch ([[change objectForKey:NSKeyValueChangeNewKey] intValue]) {
|
|
|
- case QueueStatusFinish:
|
|
|
+ case QueueStatusFinish: {
|
|
|
msg=@"Upload is complete.";
|
|
|
[[UIApplication sharedApplication] setIdleTimerDisabled:NO];
|
|
|
+ useToast = NO;
|
|
|
+ }
|
|
|
break;
|
|
|
- case QueueStatusAdd:
|
|
|
+ case QueueStatusAdd: {
|
|
|
msg=@"New tasks added.";
|
|
|
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
|
|
|
+ useToast = YES;
|
|
|
+ }
|
|
|
break;
|
|
|
|
|
|
case QueueStatusFinishWithError:
|
|
|
@@ -78,15 +82,29 @@
|
|
|
msg=@"Some of the tasks have not been successfully uploaded.\n Check upload list for detail.";
|
|
|
|
|
|
[[UIApplication sharedApplication] setIdleTimerDisabled:NO];
|
|
|
- break;
|
|
|
+ useToast = NO;
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
|
- if(msg.length>0)
|
|
|
- [self.view makeToast:msg duration:3.0 position:CSToastPositionCenter];
|
|
|
+ if(msg.length>0) {
|
|
|
+ if (useToast) {
|
|
|
+ [weakself.view makeToast:msg duration:3.0 position:CSToastPositionCenter];
|
|
|
+ } else {
|
|
|
+ UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"" message:msg preferredStyle:UIAlertControllerStyleAlert];
|
|
|
+ UIAlertAction *action = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+
|
|
|
+ }];
|
|
|
+ [alert addAction:action];
|
|
|
+ [weakself presentViewController:alert animated:YES completion:nil];
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
}
|
|
|
@@ -202,8 +220,9 @@
|
|
|
|
|
|
// Take
|
|
|
UIButton *takeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
- takeBtn.frame = CGRectMake((w - 60) * 0.5, (150 - 40) * 0.5, 60, 40);
|
|
|
- [takeBtn setTitle:@"take" forState:UIControlStateNormal];
|
|
|
+ takeBtn.frame = CGRectMake((w - 60) * 0.5, (150 - 60) * 0.5, 60, 60);
|
|
|
+// [takeBtn setTitle:@"take" forState:UIControlStateNormal];
|
|
|
+ [takeBtn setImage:[UIImage imageNamed:@"take_photo"] forState:UIControlStateNormal];
|
|
|
[takeBtn addTarget:self action:@selector(takePhotoClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
[overlay addSubview:takeBtn];
|
|
|
|