|
29 | 29 | #import "CommitFilesViewController.h"
|
30 | 30 | #import "FileViewController.h"
|
31 | 31 | #import "CSTopicDetailVC.h"
|
| 32 | +#import "CodeViewController.h" |
32 | 33 |
|
33 | 34 | #import "UnReadManager.h"
|
34 | 35 |
|
@@ -155,6 +156,7 @@ + (UIViewController *)analyseVCFromLinkStr:(NSString *)linkStr analyseMethod:(An
|
155 | 156 | NSString *gitMRPRCommitRegexStr = @"/u/([^/]+)/p/([^/]+)/git/(merge|pull|commit)/([^/#]+)";
|
156 | 157 | NSString *conversionRegexStr = @"/user/messages/history/([^/]+)$";
|
157 | 158 | NSString *pp_topicRegexStr = @"/pp/topic/([0-9]+)$";
|
| 159 | + NSString *codeRegexStr = @"/u/([^/]+)/p/([^/]+)/git/blob/([^/]+)[/]?([^?]*)"; |
158 | 160 | NSString *projectRegexStr = @"/u/([^/]+)/p/([^/]+)";
|
159 | 161 | NSArray *matchedCaptures = nil;
|
160 | 162 |
|
@@ -310,6 +312,18 @@ + (UIViewController *)analyseVCFromLinkStr:(NSString *)linkStr analyseMethod:(An
|
310 | 312 | CSTopicDetailVC *vc = [CSTopicDetailVC new];
|
311 | 313 | vc.topicID = pp_topic_id.integerValue;
|
312 | 314 | analyseVC = vc;
|
| 315 | + }else if ((matchedCaptures = [linkStr captureComponentsMatchedByRegex:codeRegexStr]).count > 0){ |
| 316 | + NSString *user_global_key = matchedCaptures[1]; |
| 317 | + NSString *project_name = matchedCaptures[2]; |
| 318 | + NSString *ref = matchedCaptures[3]; |
| 319 | + NSString *path = matchedCaptures.count >= 5? matchedCaptures[4]: @""; |
| 320 | + |
| 321 | + Project *curPro = [[Project alloc] init]; |
| 322 | + curPro.owner_user_name = user_global_key; |
| 323 | + curPro.name = project_name; |
| 324 | + CodeFile *codeFile = [CodeFile codeFileWithRef:ref andPath:path]; |
| 325 | + CodeViewController *vc = [CodeViewController codeVCWithProject:curPro andCodeFile:codeFile]; |
| 326 | + analyseVC = vc; |
313 | 327 | }else if ((matchedCaptures = [linkStr captureComponentsMatchedByRegex:projectRegexStr]).count > 0){
|
314 | 328 | //项目
|
315 | 329 | NSString *user_global_key = matchedCaptures[1];
|
|
0 commit comments