|
@@ -51,11 +51,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
UIAlertAction *OK = [UIAlertAction actionWithTitle:@"YES" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
|
|
UIAlertAction *OK = [UIAlertAction actionWithTitle:@"YES" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
|
|
|
- NSMutableArray* arr_tasks =[NSMutableArray new];
|
|
|
|
|
|
|
+
|
|
|
|
|
+ NSMutableArray* arr_tasks =[NSMutableArray new];
|
|
|
for(NSMutableDictionary* task in appdelegate.uploadManager.arr_queue)
|
|
for(NSMutableDictionary* task in appdelegate.uploadManager.arr_queue)
|
|
|
{
|
|
{
|
|
|
if([task[@"status"] intValue]==TaskStatusFinish||[task[@"status"] intValue]==TaskStatusError)
|
|
if([task[@"status"] intValue]==TaskStatusFinish||[task[@"status"] intValue]==TaskStatusError)
|
|
|
- [arr_tasks addObject:task];
|
|
|
|
|
|
|
+ [arr_tasks addObject:task];
|
|
|
}
|
|
}
|
|
|
[appdelegate.uploadManager removeTasks:arr_tasks];
|
|
[appdelegate.uploadManager removeTasks:arr_tasks];
|
|
|
|
|
|
|
@@ -86,9 +87,9 @@
|
|
|
// NSArray* arr2 = [change objectForKey:NSKeyValueChangeNewKey];
|
|
// NSArray* arr2 = [change objectForKey:NSKeyValueChangeNewKey];
|
|
|
// if(arr1.count!=arr2.count)
|
|
// if(arr1.count!=arr2.count)
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
-
|
|
|
|
|
|
|
+ blockDebugLog(@"arr_queue changed reload tableview");
|
|
|
[self.tableView reloadData];
|
|
[self.tableView reloadData];
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -114,12 +115,13 @@
|
|
|
{
|
|
{
|
|
|
AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
|
|
AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ DebugLog(@"cellForRowAtIndexPath %ld",indexPath.row);
|
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
{
|
|
|
NSString *CellIdentifier = @"UploadCell";
|
|
NSString *CellIdentifier = @"UploadCell";
|
|
|
UploadCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
|
|
UploadCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
|
|
|
|
|
+
|
|
|
NSDictionary * item_json = Appdelegate.uploadManager.arr_queue[indexPath.row];
|
|
NSDictionary * item_json = Appdelegate.uploadManager.arr_queue[indexPath.row];
|
|
|
|
|
|
|
|
if (cell.operation) {
|
|
if (cell.operation) {
|
|
@@ -155,9 +157,20 @@
|
|
|
cell.state= status;
|
|
cell.state= status;
|
|
|
cell.errorMsg = item_json[@"msg"];
|
|
cell.errorMsg = item_json[@"msg"];
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
RAUploadOperation* op = item_json[@"operation"];
|
|
RAUploadOperation* op = item_json[@"operation"];
|
|
|
|
|
+
|
|
|
|
|
+ __block RAUploadOperation* block_op = op;
|
|
|
|
|
+ __block UploadCell* block_cell = cell;
|
|
|
|
|
+ __block NSIndexPath* block_index = indexPath;
|
|
|
|
|
+ long idx = indexPath.row;
|
|
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
op.updateUI=^(){
|
|
op.updateUI=^(){
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ blockDebugLog(@"updateUI @ row%ld %p \n operation %p",idx,block_cell,block_op);
|
|
|
|
|
+
|
|
|
NSString* status =nil;
|
|
NSString* status =nil;
|
|
|
switch ([item_json[@"status"] intValue]) {
|
|
switch ([item_json[@"status"] intValue]) {
|
|
|
case TaskStatusStart:
|
|
case TaskStatusStart:
|