فهرست منبع

Apex Mobile

修改 cargo tracking 上行参数,和Detail 保持统一。
修复 查询出的 document 发送 email,收件人,主题,内容错误的问题。
修复文档保存后,email 参数无法打开的bug。
重写本地文档分享,使其支持发送自定义邮件。
Ray Zhang 8 سال پیش
والد
کامیت
6b1182de96

BIN
Apex Mobile/Apex Mobile.xcodeproj/project.xcworkspace/xcuserdata/Ray.xcuserdatad/UserInterfaceState.xcuserstate


+ 275 - 3
Apex Mobile/Apex Mobile.xcodeproj/xcuserdata/Ray.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -10,7 +10,7 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "Apex Mobile/LPShareActivity.m"
-            timestampString = "541990789.8043621"
+            timestampString = "542082579.569302"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "156"
@@ -26,12 +26,284 @@
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "Apex Mobile/LPShareActivity.m"
-            timestampString = "541990789.804967"
+            timestampString = "542082579.569374"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "90"
             endingLineNumber = "90"
-            landmarkName = "-mailComposeController:didFinishWithResult:error:"
+            landmarkName = "-activityViewController"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Apex Mobile/HomeViewController.m"
+            timestampString = "542095531.807923"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "267"
+            endingLineNumber = "267"
+            landmarkName = "-tableView:didSelectRowAtIndexPath:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Apex Mobile/DetailPageViewController.m"
+            timestampString = "542083153.669015"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "225"
+            endingLineNumber = "225"
+            landmarkName = "-loadpage"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Apex Mobile/ShipSearchController.m"
+            timestampString = "542084356.609332"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "169"
+            endingLineNumber = "169"
+            landmarkName = "-tableView:didSelectRowAtIndexPath:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Apex Mobile/OrderHistoryViewController.m"
+            timestampString = "542095531.808054"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "259"
+            endingLineNumber = "259"
+            landmarkName = "-tableView:didSelectRowAtIndexPath:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Apex Mobile/ShipSearchController.m"
+            timestampString = "542084367.026739"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "208"
+            endingLineNumber = "208"
+            landmarkName = "-searchBarSearchButtonClicked:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Apex Mobile/MessageDetailViewController.m"
+            timestampString = "542084378.241797"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "217"
+            endingLineNumber = "217"
+            landmarkName = "-tableView:didSelectRowAtIndexPath:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Apex Mobile/AMResultViewController.m"
+            timestampString = "542095531.808156"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "656"
+            endingLineNumber = "656"
+            landmarkName = "-share_activity"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Apex Mobile/DetailTabBarController.m"
+            timestampString = "542087427.327617"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "356"
+            endingLineNumber = "356"
+            landmarkName = "-shareDetail"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Apex Mobile/LocalDocumentsViewController.m"
+            timestampString = "542095531.808615"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "253"
+            endingLineNumber = "253"
+            landmarkName = "-tableView:didSelectRowAtIndexPath:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Apex Mobile/LocalDocumentsViewController.m"
+            timestampString = "542095531.8089499"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "196"
+            endingLineNumber = "196"
+            landmarkName = "-share_activity"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Apex Mobile/AMResultViewController.m"
+            timestampString = "542095531.809225"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "552"
+            endingLineNumber = "552"
+            landmarkName = "-saveDocument"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Apex Mobile/LocalDocumentsViewController.m"
+            timestampString = "542095531.80951"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "440"
+            endingLineNumber = "440"
+            landmarkName = "-emailPathForFile:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Apex Mobile/AMResultViewController.m"
+            timestampString = "542095531.809756"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "586"
+            endingLineNumber = "586"
+            landmarkName = "-saveDocument"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Apex Mobile/LocalDocumentsViewController.m"
+            timestampString = "542095531.810021"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "214"
+            endingLineNumber = "214"
+            landmarkName = "-share_activity"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Apex Mobile/ShipSearchController.m"
+            timestampString = "542095988.194937"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "34"
+            endingLineNumber = "34"
+            landmarkName = "-viewDidLoad"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Apex Mobile/ShipSearchController.m"
+            timestampString = "542096290.145471"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "230"
+            endingLineNumber = "230"
+            landmarkName = "-searchBarSearchButtonClicked:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Apex Mobile/ShipSearchController.m"
+            timestampString = "542096304.490129"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "204"
+            endingLineNumber = "204"
+            landmarkName = "-searchBarSearchButtonClicked:"
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>

+ 27 - 14
Apex Mobile/Apex Mobile/AMResultViewController.m

@@ -14,6 +14,7 @@
 #import <QuickLook/QuickLook.h>
 #import "EmailItemProvider.h"
 #import "LPShareActivity.h"
+#import "RAConvertor.h"
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored"-Wdeprecated-declarations"
 
@@ -548,17 +549,22 @@
 
 - (void)saveDocument {
     
-    NSMutableDictionary *emailInfo = [NSMutableDictionary dictionaryWithCapacity:3];
-    if (self.email) {
-        [emailInfo setValue:self.email forKey:@"reciptions"];
+    NSMutableDictionary *emailInfo = [NSMutableDictionary new];
+    if (self.email.length==0) {
+        self.email=@"";
+
     }
-    if (self.email_subject) {
-        [emailInfo setValue:self.email_subject forKey:@"subject"];
+    if (self.email_subject.length==0) {
+        self.email_subject=@"";
+
     }
-    if (self.email_content) {
-        [emailInfo setValue:self.email_content forKey:@"content"];
+    if (self.email_content.length==0) {
+        self.email_content=@"";
+
     }
-    
+         [emailInfo setValue:self.email forKey:@"reciptions"];
+            [emailInfo setValue:self.email_subject forKey:@"subject"];
+            [emailInfo setValue:self.email_content forKey:@"content"];
     NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
     NSString *path = [paths objectAtIndex:0];
     NSString *filePath = [path stringByAppendingPathComponent:[self.documentPath lastPathComponent]];
@@ -570,7 +576,14 @@
         [[NSFileManager defaultManager] removeItemAtPath:filePath error:nil];
     }
     [[NSFileManager defaultManager] moveItemAtPath:self.documentPath toPath:filePath error:&err];
-    [emailInfo writeToFile:emailPath atomically:NO];
+    
+    NSData* saved_email_data = [RAConvertor dict2data:emailInfo];
+    
+    [saved_email_data writeToFile:emailPath atomically:NO];
+    
+    
+    
+
     
     UIAlertController *alertVC;
     UIAlertAction *action = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
@@ -588,7 +601,7 @@
 
 - (void)shareDocument {
     
-    return [self test_activity];
+    return [self share_activity];
     // 默认为保存,取保存路径
     NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
     NSString *path = [paths objectAtIndex:0];
@@ -623,7 +636,7 @@
                                                animated:YES];
 }
 
--(void) test_activity
+-(void) share_activity
 {
     // 设置分享内容
     //    NSString *text = @"分享内容";
@@ -641,9 +654,9 @@
     NSArray *activityItems = @[url];
     
     LPShareActivity *share = [[LPShareActivity alloc] init];
-    share.to = @[@"676767@qq.com"];
-    share.subject = @"test subject";
-    share.body = @"body";
+    share.to = [self.email componentsSeparatedByString:@","];//@[@"676767@qq.com"];
+    share.subject = self.email_subject;//@"test subject";
+    share.body = self.email_content;// @"body";
     share.filePath = filePath;
     share.handle = ^(UIViewController *vc) {
         [self presentViewController:vc animated:YES completion:^{

+ 2 - 1
Apex Mobile/Apex Mobile/HomeViewController.m

@@ -249,7 +249,7 @@
     
     NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
 
-    [params setObject:@"dumb" forKey:@"id"];
+//    [params setObject:@"dumb" forKey:@"id"];
     NSString* h_field;
     //if(self.radioContainer.selected==true)
     //{
@@ -270,6 +270,7 @@
     [params setObject:cargo_criterion forKey:@"cargo_criterion"];
     if (serial_no != nil) {
         [params setObject:serial_no forKey:@"serial_no"];
+        [params setObject:serial_no forKey:@"id"];
     }
 
 

+ 97 - 33
Apex Mobile/Apex Mobile/LocalDocumentsViewController.m

@@ -8,13 +8,15 @@
 
 #import "LocalDocumentsViewController.h"
 #import "MyQLPreviewController.h"
-
+#import "LPShareActivity.h"
 @interface LocalDocumentsViewController () <QLPreviewControllerDelegate,QLPreviewControllerDataSource,UIDocumentInteractionControllerDelegate>
-
+//@property (nonatomic,copy) NSString *documentPath;
 @property (nonatomic,strong) MyQLPreviewController *quickLook;
 @property (nonatomic,copy) NSString *selectedDocumentPath;
-@property (nonatomic,strong) UIDocumentInteractionController *documentController;
-
+//@property (nonatomic,strong) UIDocumentInteractionController *documentController;
+//@property (nonatomic,copy) NSString *email;
+//@property (nonatomic,copy) NSString *email_subject;
+//@property (nonatomic,copy) NSString *email_content;
 
 @end
 
@@ -182,7 +184,69 @@
     
     
 }
-
+-(void) share_activity
+{
+    // 设置分享内容
+    //    NSString *text = @"分享内容";
+//    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+//    NSString *path = [paths objectAtIndex:0];
+//    NSString *filePath = [path stringByAppendingPathComponent:[self.documentPath lastPathComponent]];
+//
+    
+        NSString *filePath = self.selectedDocumentPath;
+        NSString *emailPath = [self emailPathForFile:filePath];
+    
+    NSData *data = [[NSData alloc] initWithContentsOfFile:emailPath];
+    NSError *err = nil;
+    NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&err];
+    
+//self.e
+    
+    // 没有保存的情况
+//    if ([[NSFileManager defaultManager] fileExistsAtPath:self.documentPath]) {
+//        filePath = self.documentPath;
+//    }
+    
+    NSURL *url = [NSURL fileURLWithPath:filePath];
+    
+    NSArray *activityItems = @[url];
+    
+    LPShareActivity *share = [[LPShareActivity alloc] init];
+    share.to = [json[@"reciptions"] componentsSeparatedByString:@","];//@[@"676767@qq.com"];
+    share.subject = json[@"subject"];//@"test subject";
+    share.body = json[@"content"];// @"body";
+    share.filePath = filePath;
+    share.handle = ^(UIViewController *vc) {
+        [self presentViewController:vc animated:YES completion:^{
+            //                [share activityDidFinish:YES];
+            // ...
+        }];
+    };
+    
+    // 服务类型控制器
+    UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:@[share]];
+    //    _activityViewController = activityViewController;
+    //    activityViewController.excludedActivityTypes = @[UIActivityTypeMail];
+    activityViewController.modalInPopover = true;
+    [self presentViewController:activityViewController animated:YES completion:nil];
+    
+    // 选中分享类型
+    [activityViewController setCompletionWithItemsHandler:^(NSString * __nullable activityType, BOOL completed, NSArray * __nullable returnedItems, NSError * __nullable activityError){
+        
+        // 显示选中的分享类型
+        NSLog(@"act type %@",activityType);
+        
+        if (completed) {
+            NSLog(@"ok");
+        }else {
+            NSLog(@"not ok");
+        }
+        
+    }];
+    
+    
+ 
+}
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 {
     
@@ -339,42 +403,42 @@
 #pragma mark - Share
 
 - (void)shareClick:(id)sender {
-    [self shareDocument];
+    [self share_activity];
 }
 
-- (void)shareDocument {
-    
-    NSString *filePath = self.selectedDocumentPath;
-    NSString *emailPath = [self emailPathForFile:filePath];
-    
-    NSURL *fileURL = [NSURL fileURLWithPath:filePath];
-    
-    if (self.documentController == nil) {
-        UIDocumentInteractionController *documentController = [UIDocumentInteractionController interactionControllerWithURL:fileURL];
-        documentController.delegate = self;
-        documentController.UTI = @"com.adobe.pdf";
-        self.documentController = documentController;
-    } else {
-        self.documentController.URL = fileURL;
-    }
-    self.documentController.annotation = @{@"_toRecipients" : @[@"676034647@qq.com"]};
-    self.documentController.name = @"Test";
-    
-    //    [self.documentController presentOpenInMenuFromRect:self.navigationController.topViewController.view.bounds
-    //                                                inView:self.navigationController.topViewController.view
-    //                                              animated:YES];
-    
-    [self.documentController presentOptionsMenuFromRect:self.navigationController.topViewController.view.bounds
-                                                 inView:self.navigationController.topViewController.view
-                                               animated:YES];
-}
+//- (void)shareDocument {
+//
+//    NSString *filePath = self.selectedDocumentPath;
+//    NSString *emailPath = [self emailPathForFile:filePath];
+//
+//    NSURL *fileURL = [NSURL fileURLWithPath:filePath];
+//
+//    if (self.documentController == nil) {
+//        UIDocumentInteractionController *documentController = [UIDocumentInteractionController interactionControllerWithURL:fileURL];
+//        documentController.delegate = self;
+//        documentController.UTI = @"com.adobe.pdf";
+//        self.documentController = documentController;
+//    } else {
+//        self.documentController.URL = fileURL;
+//    }
+//    self.documentController.annotation = @{@"_toRecipients" : @[@"676034647@qq.com"]};
+//    self.documentController.name = @"Test";
+//
+//    //    [self.documentController presentOpenInMenuFromRect:self.navigationController.topViewController.view.bounds
+//    //                                                inView:self.navigationController.topViewController.view
+//    //                                              animated:YES];
+//
+//    [self.documentController presentOptionsMenuFromRect:self.navigationController.topViewController.view.bounds
+//                                                 inView:self.navigationController.topViewController.view
+//                                               animated:YES];
+//}
 
 - (NSString *)emailPathForFile:(NSString *)file {
     if (file == nil) {
         return nil;
     }
     NSString *fileName = [file lastPathComponent];
-    NSString *emailPath = [[file stringByDeletingLastPathComponent] stringByAppendingPathComponent:[NSString stringWithFormat:@".%@",fileName]];
+    NSString *emailPath = [[file stringByDeletingLastPathComponent] stringByAppendingPathComponent:[NSString stringWithFormat:@".%@",[fileName stringByDeletingPathExtension]]];
     return emailPath;
 }
 

+ 2 - 1
Apex Mobile/Apex Mobile/OrderHistoryViewController.m

@@ -255,7 +255,7 @@ static const int history_delta = 7;
     
     NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
 
-    [params setObject:@"dumb" forKey:@"id"];
+//    [params setObject:@"dumb" forKey:@"id"];
     NSString* h_field;
     //if(self.radioContainer.selected==true)
     //{
@@ -277,6 +277,7 @@ static const int history_delta = 7;
     NSString *serial_no = item[@"serial_no"];
     if (serial_no != nil) {
         [params setObject:serial_no forKey:@"serial_no"];
+        [params setObject:serial_no forKey:@"id"];
     }
 
     [ApexMobileDB savehistory:h_field value:cargo_criterion];