Skip to content

Commit 1b81418

Browse files
committed
UIApplicationShortcutItems 优化
1 parent 8815b0e commit 1b81418

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed

Coding_iOS.xcworkspace/xcshareddata/Coding_iOS.xcscmblueprint

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
},
1111
"DVTSourceControlWorkspaceBlueprintIdentifierKey" : "433ECD69-91E4-4E60-9763-B27EA86C3648",
1212
"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
13-
"0BE8B4916C79C0D6BC415A5C19AC33B37D62A706" : "Coding\/Coding_iOS\/Resources\/webview\/",
13+
"0BE8B4916C79C0D6BC415A5C19AC33B37D62A706" : "Coding-iOS\/Coding_iOS\/Resources\/webview\/",
1414
"B810104048DF61B07FF1F2922D434EA5073F4362" : "Coding_iOS",
15-
"9F3660E5AC46AAE96CC141F90EBB3A671D67F2C2" : "Coding\/"
15+
"9F3660E5AC46AAE96CC141F90EBB3A671D67F2C2" : "Coding-iOS\/"
1616
},
1717
"DVTSourceControlWorkspaceBlueprintNameKey" : "Coding_iOS",
1818
"DVTSourceControlWorkspaceBlueprintVersion" : 204,

Coding_iOS/AppDelegate.m

+21-14
Original file line numberDiff line numberDiff line change
@@ -437,20 +437,27 @@ - (void)application:(UIApplication *)application performActionForShortcutItem:(U
437437
UINavigationController *nav = [[BaseNavigationController alloc] initWithRootViewController:vc];
438438
[presentingVC presentViewController:nav animated:YES completion:nil];
439439
}
440-
}else if ([shortcutItem.type isEqualToString:@"shortcut_task"]) {
441-
ProjectToChooseListViewController *chooseVC = [[ProjectToChooseListViewController alloc] init];
442-
[BaseViewController goToVC:chooseVC];
443-
}else if ([shortcutItem.type isEqualToString:@"shortcut_tweet"]){
444-
TweetSendViewController *vc = [[TweetSendViewController alloc] init];
445-
vc.sendNextTweet = ^(Tweet *nextTweet){
446-
[nextTweet saveSendData];//发送前保存草稿
447-
[[Coding_NetAPIManager sharedManager] request_Tweet_DoTweet_WithObj:nextTweet andBlock:^(id data, NSError *error) {
448-
if (data) {
449-
[Tweet deleteSendData];//发送成功后删除草稿
450-
}
451-
}];
452-
};
453-
[BaseViewController presentVC:vc];
440+
}else{
441+
if ([kKeyWindow.rootViewController isKindOfClass:[RootTabViewController class]]) {
442+
RootTabViewController *vc = (RootTabViewController *)kKeyWindow.rootViewController;
443+
vc.selectedIndex = ([shortcutItem.type isEqualToString:@"shortcut_task"]? 1:
444+
2);
445+
}
446+
if ([shortcutItem.type isEqualToString:@"shortcut_task"]) {
447+
ProjectToChooseListViewController *chooseVC = [[ProjectToChooseListViewController alloc] init];
448+
[BaseViewController goToVC:chooseVC];
449+
}else if ([shortcutItem.type isEqualToString:@"shortcut_tweet"]){
450+
TweetSendViewController *vc = [[TweetSendViewController alloc] init];
451+
vc.sendNextTweet = ^(Tweet *nextTweet){
452+
[nextTweet saveSendData];//发送前保存草稿
453+
[[Coding_NetAPIManager sharedManager] request_Tweet_DoTweet_WithObj:nextTweet andBlock:^(id data, NSError *error) {
454+
if (data) {
455+
[Tweet deleteSendData];//发送成功后删除草稿
456+
}
457+
}];
458+
};
459+
[BaseViewController presentVC:vc];
460+
}
454461
}
455462
completionHandler(YES);
456463
}

0 commit comments

Comments
 (0)