Jelajahi Sumber

RA Image

修复上传任务移除后,界面没有刷新的问题。
上传新增客户端平台参数,用于区分iOS和android
Ray Zhang 9 tahun lalu
induk
melakukan
9ec9ea4450

TEMPAT SAMPAH
Ants Contract/AntsContract.xcworkspace/xcuserdata/Ray.xcuserdatad/UserInterfaceState.xcuserstate


+ 2 - 2
Ants Contract/Granite Expo eSign/Granite Expo eSign/Info.plist

@@ -34,9 +34,9 @@
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
-	<string>1.31</string>
+	<string>1.32</string>
 	<key>CFBundleVersion</key>
-	<string>32383</string>
+	<string>32419</string>
 	<key>ITSAppUsesNonExemptEncryption</key>
 	<false/>
 	<key>LSRequiresIPhoneOS</key>

TEMPAT SAMPAH
RA Image/RA Image.xcodeproj/project.xcworkspace/xcuserdata/ray.xcuserdatad/UserInterfaceState.xcuserstate


+ 1 - 0
RA Image/RA Image/PopModeViewController.m

@@ -94,6 +94,7 @@
                                  @"mode":self.name,
                                  @"barcode":self.barcode,
                                  @"_operate":@"upload",
+                                 @"platform":@"ios",
                                  @"md5":md5
                                  };
         task[@"params"]=params;

+ 6 - 5
RA Image/RA Image/Upload.storyboard

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
     <device id="retina5_5" orientation="landscape">
         <adaptation id="fullscreen"/>
     </device>
@@ -33,7 +33,7 @@
                                                 <rect key="frame" x="0.0" y="28" width="736" height="80"/>
                                                 <autoresizingMask key="autoresizingMask"/>
                                                 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="p1C-Cy-yXq" id="tdd-mO-6vJ">
-                                                    <rect key="frame" x="0.0" y="0.0" width="736" height="79"/>
+                                                    <rect key="frame" x="0.0" y="0.0" width="736" height="80"/>
                                                     <autoresizingMask key="autoresizingMask"/>
                                                     <subviews>
                                                         <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="QS8884456999666666" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0VW-ZZ-YcB">
@@ -46,13 +46,13 @@
                                                             <nil key="highlightedColor"/>
                                                         </label>
                                                         <progressView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="750" progress="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="NYs-S2-H37">
-                                                            <rect key="frame" x="10" y="37" width="716" height="5"/>
+                                                            <rect key="frame" x="10" y="37.333333333333336" width="716" height="5"/>
                                                             <constraints>
                                                                 <constraint firstAttribute="height" constant="5" id="QYr-rE-zSp"/>
                                                             </constraints>
                                                         </progressView>
                                                         <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="99.9%" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8Qr-iv-UsW">
-                                                            <rect key="frame" x="676" y="52" width="50" height="21"/>
+                                                            <rect key="frame" x="676" y="52.333333333333329" width="50" height="20.999999999999986"/>
                                                             <constraints>
                                                                 <constraint firstAttribute="height" constant="21" id="8Tc-O3-69h"/>
                                                                 <constraint firstAttribute="width" constant="50" id="ljZ-ci-ehG"/>
@@ -62,7 +62,7 @@
                                                             <nil key="highlightedColor"/>
                                                         </label>
                                                         <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Waiting" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DED-nv-Rm5">
-                                                            <rect key="frame" x="10" y="52" width="656" height="21"/>
+                                                            <rect key="frame" x="10" y="52.333333333333329" width="656" height="20.999999999999986"/>
                                                             <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                                             <nil key="textColor"/>
                                                             <nil key="highlightedColor"/>
@@ -115,6 +115,7 @@
                         </constraints>
                     </view>
                     <connections>
+                        <outlet property="tableView" destination="u4f-TD-M09" id="TSE-8F-Kde"/>
                         <outlet property="uploadTable" destination="u4f-TD-M09" id="nnG-Am-DZu"/>
                     </connections>
                 </viewController>

+ 1 - 0
RA Image/RA Image/UploadViewController.h

@@ -9,5 +9,6 @@
 #import "BasicViewController.h"
 
 @interface UploadViewController : BasicViewController
+@property (weak, nonatomic) IBOutlet UITableView *tableView;
 
 @end

+ 35 - 2
RA Image/RA Image/UploadViewController.m

@@ -9,7 +9,7 @@
 #import "UploadViewController.h"
 #import "UploadCell.h"
 
-@interface UploadViewController ()<UITableViewDelegate,UITableViewDataSource,RAUploadManagerDelegate>
+@interface UploadViewController ()<UITableViewDelegate,UITableViewDataSource>
 
 @property (strong, nonatomic) IBOutlet UITableView *uploadTable;
 
@@ -23,9 +23,42 @@
     [self.view insertSubview:[UIView new] atIndex:0];
     
     AppDelegate* appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
-    appdelegate.uploadManager.delegate = self;
+    
+    
+    [appdelegate.uploadManager addObserver:self
+                                forKeyPath:@"arr_queue"
+                                   options:(NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld)
+                                   context:@"arr_queue changed"];
+    
+//    appdelegate.uploadManager.delegate = self;
+}
+-(void) dealloc
+{
+    AppDelegate* appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
+    [appdelegate.uploadManager removeObserver:self forKeyPath:@"arr_queue"];
 }
 
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
+{
+    
+    if([keyPath isEqualToString:@"arr_queue"])
+    {
+        //        NSArray* arr1 = [change objectForKey:NSKeyValueChangeOldKey];
+        //        NSArray* arr2 = [change objectForKey:NSKeyValueChangeNewKey];
+        //        if(arr1.count!=arr2.count)
+        
+        
+        dispatch_async(dispatch_get_main_queue(), ^{
+            
+            [self.tableView reloadData];
+        });
+        
+    }
+    //    if(context)
+    //    NSLog(@"old: %@", [change objectForKey:NSKeyValueChangeOldKey]);
+    //    NSLog(@"old: %@", [change objectForKey:NSKeyValueChangeNewKey]);
+    //    NSLog(@"context: %@", context);
+}
 - (void)didReceiveMemoryWarning {
     [super didReceiveMemoryWarning];
     // Dispose of any resources that can be recreated.

+ 8 - 8
common/upload/RAUploadManager.h

@@ -9,13 +9,13 @@
 #import <Foundation/Foundation.h>
 #import "RAUploadOperation.h"
 
-@class RAUploadManager;
-@protocol RAUploadManagerDelegate <NSObject>
-
-@required
-- (void)uploadManager:(RAUploadManager *)manager didRemoveTasks:(NSArray *)tasks;
-
-@end
+//@class RAUploadManager;
+////@protocol RAUploadManagerDelegate <NSObject>
+//
+////@required
+////- (void)uploadManager:(RAUploadManager *)manager didRemoveTasks:(NSArray *)tasks;
+//
+//@end
 
 @interface RAUploadManager : NSObject
 @property (assign) int maxThread;
@@ -33,6 +33,6 @@
 
 @property (strong,nonatomic) NSOperationQueue* operation_queue;
 
-@property (nonatomic,weak) id <RAUploadManagerDelegate> delegate;
+//@property (nonatomic,weak) id <RAUploadManagerDelegate> delegate;
 
 @end

+ 6 - 6
common/upload/RAUploadManager.m

@@ -89,9 +89,9 @@
         [fmanager removeItemAtPath:task[@"file_path"] error:&error];
     }
     [[self mutableArrayValueForKey:@"arr_queue"] removeObjectsInArray:tasks];
-    if (self.delegate && [self.delegate respondsToSelector:@selector(uploadManager:didRemoveTasks:)]) {
-        [self.delegate uploadManager:self didRemoveTasks:tasks];
-    }
+//    if (self.delegate && [self.delegate respondsToSelector:@selector(uploadManager:didRemoveTasks:)]) {
+//        [self.delegate uploadManager:self didRemoveTasks:tasks];
+//    }
 }
 
 -(void) removeTask:(NSMutableDictionary*) task
@@ -103,9 +103,9 @@
     [fmanager removeItemAtPath:task[@"file_path"] error:&error];
     
     [[self mutableArrayValueForKey:@"arr_queue"] removeObject:task];
-    if (self.delegate && [self.delegate respondsToSelector:@selector(uploadManager:didRemoveTasks:)]) {
-        [self.delegate uploadManager:self didRemoveTasks:@[task]];
-    }
+//    if (self.delegate && [self.delegate respondsToSelector:@selector(uploadManager:didRemoveTasks:)]) {
+//        [self.delegate uploadManager:self didRemoveTasks:@[task]];
+//    }