|
|
@@ -8,6 +8,7 @@
|
|
|
|
|
|
#import "DetailTabBarController.h"
|
|
|
#import "AMResultViewController.h"
|
|
|
+#import "LPShareActivity.h"
|
|
|
|
|
|
@interface DetailTabBarController () <UITabBarControllerDelegate>
|
|
|
|
|
|
@@ -302,13 +303,15 @@
|
|
|
[menuBtn addTarget:self action:@selector(menuClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithCustomView:menuBtn];
|
|
|
|
|
|
- DetailPageViewController *pageVC = (DetailPageViewController *)self.selectedViewController;
|
|
|
+// DetailPageViewController *pageVC = (DetailPageViewController *)self.selectedViewController;
|
|
|
+//
|
|
|
+// if([pageVC.function_name isEqualToString:@"Cargo Tracking"] || [pageVC.title isEqualToString:@"Tracing"]) {
|
|
|
+// self.navigationItem.rightBarButtonItems = @[closeButton,fixBtn,menuButton];
|
|
|
+// } else {
|
|
|
+// self.navigationItem.rightBarButtonItems = @[closeButton,fixBtn,saveButton];
|
|
|
+// }
|
|
|
|
|
|
- if([pageVC.function_name isEqualToString:@"Cargo Tracking"] || [pageVC.title isEqualToString:@"Tracing"]) {
|
|
|
- self.navigationItem.rightBarButtonItems = @[closeButton,fixBtn,menuButton];
|
|
|
- } else {
|
|
|
- self.navigationItem.rightBarButtonItems = @[closeButton,fixBtn,saveButton];
|
|
|
- }
|
|
|
+ self.navigationItem.rightBarButtonItems = @[closeButton,fixBtn,menuButton];
|
|
|
}
|
|
|
|
|
|
- (void)searchDocument {
|
|
|
@@ -336,24 +339,78 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+- (void)shareDetail {
|
|
|
+
|
|
|
+ DetailPageViewController *pageVC = (DetailPageViewController *)self.selectedViewController;
|
|
|
+
|
|
|
+ NSString *to = [pageVC.content.originContent objectForKey:@"email"];
|
|
|
+ NSString *subject = [pageVC.content.originContent objectForKey:@"email_subject"];
|
|
|
+ NSString *content = [pageVC.content.originContent objectForKey:@"email_content"];
|
|
|
+
|
|
|
+// content = @"Test Body";
|
|
|
+ NSArray *activityItems = nil;
|
|
|
+ if (content) {
|
|
|
+ activityItems = @[content];
|
|
|
+ }
|
|
|
+
|
|
|
+ LPShareActivity *share = [[LPShareActivity alloc] init];
|
|
|
+ share.to = [to componentsSeparatedByString:@","];
|
|
|
+ share.subject = subject;
|
|
|
+ share.body = content;
|
|
|
+
|
|
|
+
|
|
|
+ // 服务类型控制器
|
|
|
+ UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:@[share]];
|
|
|
+ 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)menuClick:(id)sender {
|
|
|
|
|
|
- UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleAlert];
|
|
|
+ UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
|
|
|
|
|
|
__weak typeof(self) weakSelf = self;
|
|
|
- UIAlertAction *saveAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"save", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+ UIAlertAction *saveAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"save_detail", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
[weakSelf saveDetail:nil];
|
|
|
}];
|
|
|
|
|
|
- UIAlertAction *searchAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"search", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+ UIAlertAction *searchAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"search_document", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
[weakSelf searchDocument];
|
|
|
}];
|
|
|
- UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"cancel", nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+
|
|
|
+ UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"cancel", nil) style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
|
|
|
|
|
|
}];
|
|
|
|
|
|
+ UIAlertAction *shareAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"share_detail", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+ [self shareDetail];
|
|
|
+ }];
|
|
|
+
|
|
|
[alertVC addAction:saveAction];
|
|
|
- [alertVC addAction:searchAction];
|
|
|
+ [alertVC addAction:shareAction];
|
|
|
+
|
|
|
+ DetailPageViewController *pageVC = (DetailPageViewController *)self.selectedViewController;
|
|
|
+
|
|
|
+ if([pageVC.function_name isEqualToString:@"Cargo Tracking"] || [pageVC.title isEqualToString:@"Tracing"]) {
|
|
|
+ [alertVC addAction:searchAction];
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
[alertVC addAction:cancelAction];
|
|
|
|
|
|
[self presentViewController:alertVC animated:YES completion:nil];
|