|
27 | 27 | #import "ProjectCommitsViewController.h" |
28 | 28 | #import "MRPRDetailViewController.h" |
29 | 29 | #import "CommitFilesViewController.h" |
| 30 | +#import "FileViewController.h" |
30 | 31 |
|
31 | 32 | #import "UnReadManager.h" |
32 | 33 |
|
@@ -154,6 +155,7 @@ + (UIViewController *)analyseVCFromLinkStr:(NSString *)linkStr analyseMethod:(An |
154 | 155 | NSString *ppRegexStr = @"/u/([^/]+)/pp/([0-9]+)$"; |
155 | 156 | NSString *topicRegexStr = @"/u/([^/]+)/p/([^/]+)/topic/(\\d+)"; |
156 | 157 | NSString *taskRegexStr = @"/u/([^/]+)/p/([^/]+)/task/(\\d+)"; |
| 158 | + NSString *fileRegexStr = @"/u/([^/]+)/p/([^/]+)/attachment/([^/]+)/preview/(\\d+)"; |
157 | 159 | NSString *gitMRPRCommitRegexStr = @"/u/([^/]+)/p/([^/]+)/git/(merge|pull|commit)/([^/#]+)"; |
158 | 160 | NSString *conversionRegexStr = @"/user/messages/history/([^/]+)$"; |
159 | 161 | NSString *projectRegexStr = @"/u/([^/]+)/p/([^/]+)"; |
@@ -249,7 +251,24 @@ + (UIViewController *)analyseVCFromLinkStr:(NSString *)linkStr analyseMethod:(An |
249 | 251 | }; |
250 | 252 | analyseVC = vc; |
251 | 253 | } |
252 | | - |
| 254 | + }else if ((matchedCaptures = [linkStr captureComponentsMatchedByRegex:fileRegexStr]).count > 0){ |
| 255 | + NSString *user_global_key = matchedCaptures[1]; |
| 256 | + NSString *project_name = matchedCaptures[2]; |
| 257 | + NSString *fileId = matchedCaptures[4]; |
| 258 | + if ([presentingVC isKindOfClass:[FileViewController class]]) { |
| 259 | + FileViewController *vc = (FileViewController *)presentingVC; |
| 260 | + if (vc.curFile.file_id.integerValue == fileId.integerValue) { |
| 261 | + [vc requestFileData]; |
| 262 | + analyseVCIsNew = NO; |
| 263 | + analyseVC = vc; |
| 264 | + } |
| 265 | + } |
| 266 | + if (!analyseVC) { |
| 267 | + FileViewController *vc = [FileViewController new]; |
| 268 | + ProjectFile *curFile = [[ProjectFile alloc] initWithFileId:@(fileId.integerValue) inProject:project_name ofUser:user_global_key]; |
| 269 | + vc.curFile = curFile; |
| 270 | + analyseVC = vc; |
| 271 | + } |
253 | 272 | }else if ((matchedCaptures = [linkStr captureComponentsMatchedByRegex:conversionRegexStr]).count > 0) { |
254 | 273 | //私信 |
255 | 274 | NSString *user_global_key = matchedCaptures[1]; |
|
0 commit comments