FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

在项目动态中要可以查看推送代码详情 · CodeY2J/Coding-iOS@f6f490f · GitHub

Commit f6f490f

Browse files
committed
在项目动态中要可以查看推送代码详情
1 parent 8d02774 commit f6f490f

8 files changed

Lines changed: 313 additions & 184 deletions

File tree

‎Coding_iOS.xcodeproj/project.pbxproj‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
4E53EB5A1AFB090E0034FE1C /* nav_page_unselected@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E53EB581AFB090E0034FE1C /* nav_page_unselected@2x.png */; };
125125
4E59E1D31A5E6B34004DAEEC /* TaskDescriptionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E59E1D21A5E6B34004DAEEC /* TaskDescriptionViewController.m */; };
126126
4E5A66951B268D160007A0AD /* UIView+PressMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E5A66941B268D160007A0AD /* UIView+PressMenu.m */; };
127-
4E5A66971B269AA20007A0AD /* diff.html in Resources */ = {isa = PBXBuildFile; fileRef = 4E5A66961B269AA20007A0AD /* diff.html */; };
127+
4E5A66991B26EB210007A0AD /* diff.html in Resources */ = {isa = PBXBuildFile; fileRef = 4E5A66981B26EB210007A0AD /* diff.html */; };
128128
4E5C06E81AC2B34800F427C5 /* tipIcon_BranchMember@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E5C06E71AC2B34800F427C5 /* tipIcon_BranchMember@2x.png */; };
129129
4E5C06EB1AC4009100F427C5 /* CannotLoginViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E5C06EA1AC4009100F427C5 /* CannotLoginViewController.m */; };
130130
4E5C06EE1AC4405300F427C5 /* PasswordViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E5C06ED1AC4405300F427C5 /* PasswordViewController.m */; };
@@ -879,7 +879,7 @@
879879
4E59E1D21A5E6B34004DAEEC /* TaskDescriptionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TaskDescriptionViewController.m; sourceTree = "<group>"; };
880880
4E5A66931B268D160007A0AD /* UIView+PressMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+PressMenu.h"; sourceTree = "<group>"; };
881881
4E5A66941B268D160007A0AD /* UIView+PressMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+PressMenu.m"; sourceTree = "<group>"; };
882-
4E5A66961B269AA20007A0AD /* diff.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = diff.html; sourceTree = "<group>"; };
882+
4E5A66981B26EB210007A0AD /* diff.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = diff.html; sourceTree = "<group>"; };
883883
4E5C06E71AC2B34800F427C5 /* tipIcon_BranchMember@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "tipIcon_BranchMember@2x.png"; sourceTree = "<group>"; };
884884
4E5C06E91AC4009100F427C5 /* CannotLoginViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CannotLoginViewController.h; sourceTree = "<group>"; };
885885
4E5C06EA1AC4009100F427C5 /* CannotLoginViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CannotLoginViewController.m; sourceTree = "<group>"; };
@@ -3094,7 +3094,7 @@
30943094
children = (
30953095
4EE083DD1ADB739300CA342E /* modules */,
30963096
4EE083DB1ADB736800CA342E /* service_terms.html */,
3097-
4E5A66961B269AA20007A0AD /* diff.html */,
3097+
4E5A66981B26EB210007A0AD /* diff.html */,
30983098
8E1C3DF519E7F4CA00EF3032 /* address.json */,
30993099
);
31003100
path = Resources;
@@ -3831,7 +3831,7 @@
38313831
B9A00D7F1ACA3A05008BA008 /* ProjectSetting.storyboard in Resources */,
38323832
8EA6D19219E240C40076D59C /* timeline_icon_unread@2x.png in Resources */,
38333833
4E217F141A70EDC700F6DF88 /* SVWebViewControllerActivitySafari-iPad@2x.png in Resources */,
3834-
4E5A66971B269AA20007A0AD /* diff.html in Resources */,
3834+
4E5A66991B26EB210007A0AD /* diff.html in Resources */,
38353835
4EF91F641B00B62B0021C951 /* icon_not_locationed@2x.png in Resources */,
38363836
8EA6D19119E240C40076D59C /* timeline_icon_read@2x.png in Resources */,
38373837
8E97CEB21A0C7E26006F9AD7 /* coding_emoji_27@2x.png in Resources */,

‎Coding_iOS/Controllers/MRPRDetailViewController.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
@interface MRPRDetailViewController : BaseViewController
1414
@property (strong, nonatomic) MRPR *curMRPR;
1515
@property (strong, nonatomic) Project *curProject;
16-
16+
+ (MRPRDetailViewController *)vcWithPath:(NSString *)path;
1717
@end

‎Coding_iOS/Controllers/MRPRDetailViewController.m‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,25 @@ @interface MRPRDetailViewController ()<UITableViewDataSource, UITableViewDelegat
4242
@end
4343

4444
@implementation MRPRDetailViewController
45+
46+
+ (MRPRDetailViewController *)vcWithPath:(NSString *)path{
47+
48+
NSArray *pathComponents = [path componentsSeparatedByString:@"/"];
49+
if (pathComponents.count != 8) {
50+
return nil;
51+
}
52+
MRPRDetailViewController *vc = [MRPRDetailViewController new];
53+
54+
vc.curMRPR = [MRPR new];
55+
vc.curMRPR.path = path;
56+
vc.curMRPR.iid = [NSNumber numberWithInteger:[(NSString *)pathComponents.lastObject integerValue]];
57+
58+
vc.curProject = [Project new];
59+
vc.curProject.owner_user_name = vc.curMRPR.des_owner_name;
60+
vc.curProject.name = vc.curMRPR.des_project_name;
61+
62+
return vc;
63+
}
4564
- (void)viewDidLoad{
4665
[super viewDidLoad];
4766
self.title = [NSString stringWithFormat:@"#%@", _curMRPR.iid.stringValue];
@@ -378,7 +397,7 @@ - (void)goToAddCommentVCToUser:(NSString *)userName{
378397
vc.curProject = _curProject;
379398
vc.requestPath = [NSString stringWithFormat:@"api/user/%@/project/%@/git/line_notes", _curMRPR.des_owner_name, _curMRPR.des_project_name];
380399
vc.requestParams = [@{
381-
@"noteable_type" : @"MergeRequestBean",
400+
@"noteable_type" : [self.curMRPRInfo.mrpr isMR]? @"MergeRequestBean" : @"PullRequestBean",
382401
@"noteable_id" : _curMRPRInfo.mrpr.id,
383402
} mutableCopy];
384403
vc.contentStr = userName.length > 0? [NSString stringWithFormat:@"@%@ ", userName]: nil;

‎Coding_iOS/Controllers/ProjectCommitsViewController.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,5 @@
1313
@interface ProjectCommitsViewController : BaseViewController
1414
@property (strong, nonatomic) Project *curProject;
1515
@property (strong, nonatomic) Commits *curCommits;
16-
@property (strong, nonatomic) NSString *ref, *path;
1716

1817
@end

‎Coding_iOS/Controllers/ProjectMemberActivityListViewController.m‎

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
#import "FileListViewController.h"
1414
#import "FileViewController.h"
1515

16+
#import "ProjectCommitsViewController.h"
17+
#import "MRPRDetailViewController.h"
18+
#import "NProjectViewController.h"
19+
1620
@interface ProjectMemberActivityListViewController ()
1721

1822
@end
@@ -145,13 +149,59 @@ - (void)goToVCWithItem:(HtmlMediaItem *)clickedItem activity:(ProjectActivity *)
145149
vc.curUser = [User userWithGlobalKey:user.global_key];
146150
[self.navigationController pushViewController:vc animated:YES];
147151
}
152+
153+
154+
}else if ([target_type isEqualToString:@"Depot"]) {
155+
if ([proAct.action_msg isEqualToString:@"删除了"]) {
156+
[self showHudTipStr:@"删除了,不能看了~"];
157+
}else if ([proAct.action isEqualToString:@"fork"]) {
158+
NSArray *nameComponents = [proAct.depot.name componentsSeparatedByString:@"/"];
159+
if (nameComponents.count == 2) {
160+
NProjectViewController *vc = [NProjectViewController new];
161+
vc.myProject = [Project new];
162+
vc.myProject.owner_user_name = nameComponents[0];
163+
vc.myProject.name = nameComponents[1];
164+
[self.navigationController pushViewController:vc animated:YES];
165+
}else{
166+
[self showHudTipStr:@"没找到 Fork 到哪里去了~"];
167+
}
168+
}else{
169+
NSString *ref = proAct.ref? proAct.ref : @"master";
170+
ProjectCommitsViewController *vc = [ProjectCommitsViewController new];
171+
vc.curProject = project;
172+
vc.curCommits = [Commits commitsWithRef:ref Path:@""];
173+
[self.navigationController pushViewController:vc animated:YES];
174+
}
175+
}else if ([target_type isEqualToString:@"PullRequestBean"] ||
176+
[target_type isEqualToString:@"MergeRequestBean"] ||
177+
[target_type isEqualToString:@"CommitLineNote"]){
178+
NSString *request_path;
179+
if ([target_type isEqualToString:@"PullRequestBean"]){
180+
request_path = proAct.pull_request_path;
181+
}else if ([target_type isEqualToString:@"MergeRequestBean"]){
182+
request_path = proAct.merge_request_path;
183+
}else if ([target_type isEqualToString:@"CommitLineNote"]){
184+
request_path = proAct.line_note.noteable_url;
185+
}
186+
MRPRDetailViewController *vc = [MRPRDetailViewController vcWithPath:request_path];
187+
if (vc) {
188+
[self.navigationController pushViewController:vc animated:YES];
189+
}else{
190+
[self showHudTipStr:@"RequestBean 没找到~"];
191+
}
148192
}else{
149-
[self showHudTipStr:@"还不能查看详细信息呢~"];
150-
DebugLog(@"暂时不解析啊:%@--%@", proAct.user.name, proAct.action_msg);
193+
if ([target_type isEqualToString:@"Project"]){//这是什么鬼。。遗留的 type 吧
194+
[self showHudTipStr:@"还不能查看详细信息呢~"];
195+
// }else if ([target_type isEqualToString:@"MergeRequestComment"]){//过期类型,已用CommitLineNote替代
196+
// }else if ([target_type isEqualToString:@"PullRequestComment"]){//过期类型,已用CommitLineNote替代
197+
// }else if ([target_type isEqualToString:@"ProjectStar"]){//不用解析
198+
// }else if ([target_type isEqualToString:@"ProjectWatcher"]){//不用解析
199+
}else if ([target_type isEqualToString:@"QcTask"]){//还不能解析
200+
[self showHudTipStr:@"还不能查看详细信息呢~"];
201+
}
151202
}
152203
}else{//cell上面第一个Label
153204
[self goToUserInfo:[User userWithGlobalKey:[clickedItem.href substringFromIndex:3]]];
154205
}
155206
}
156-
157207
@end

‎Coding_iOS/Controllers/ProjectViewController.m‎

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
#import "FileViewController.h"
3131
#import "ProjectCommitsViewController.h"
3232

33+
#import "ProjectCommitsViewController.h"
34+
#import "MRPRDetailViewController.h"
35+
#import "NProjectViewController.h"
36+
3337
@interface ProjectViewController ()
3438

3539
@property (nonatomic, strong) NSMutableDictionary *projectContentDict;
@@ -400,9 +404,56 @@ - (void)goToVCWithItem:(HtmlMediaItem *)clickedItem activity:(ProjectActivity *)
400404
vc.curUser = [User userWithGlobalKey:user.global_key];
401405
[self.navigationController pushViewController:vc animated:YES];
402406
}
407+
408+
409+
}else if ([target_type isEqualToString:@"Depot"]) {
410+
if ([proAct.action_msg isEqualToString:@"删除了"]) {
411+
[self showHudTipStr:@"删除了,不能看了~"];
412+
}else if ([proAct.action isEqualToString:@"fork"]) {
413+
NSArray *nameComponents = [proAct.depot.name componentsSeparatedByString:@"/"];
414+
if (nameComponents.count == 2) {
415+
NProjectViewController *vc = [NProjectViewController new];
416+
vc.myProject = [Project new];
417+
vc.myProject.owner_user_name = nameComponents[0];
418+
vc.myProject.name = nameComponents[1];
419+
[self.navigationController pushViewController:vc animated:YES];
420+
}else{
421+
[self showHudTipStr:@"没找到 Fork 到哪里去了~"];
422+
}
423+
}else{
424+
NSString *ref = proAct.ref? proAct.ref : @"master";
425+
ProjectCommitsViewController *vc = [ProjectCommitsViewController new];
426+
vc.curProject = project;
427+
vc.curCommits = [Commits commitsWithRef:ref Path:@""];
428+
[self.navigationController pushViewController:vc animated:YES];
429+
}
430+
}else if ([target_type isEqualToString:@"PullRequestBean"] ||
431+
[target_type isEqualToString:@"MergeRequestBean"] ||
432+
[target_type isEqualToString:@"CommitLineNote"]){
433+
NSString *request_path;
434+
if ([target_type isEqualToString:@"PullRequestBean"]){
435+
request_path = proAct.pull_request_path;
436+
}else if ([target_type isEqualToString:@"MergeRequestBean"]){
437+
request_path = proAct.merge_request_path;
438+
}else if ([target_type isEqualToString:@"CommitLineNote"]){
439+
request_path = proAct.line_note.noteable_url;
440+
}
441+
MRPRDetailViewController *vc = [MRPRDetailViewController vcWithPath:request_path];
442+
if (vc) {
443+
[self.navigationController pushViewController:vc animated:YES];
444+
}else{
445+
[self showHudTipStr:@"RequestBean 没找到~"];
446+
}
403447
}else{
404-
[self showHudTipStr:@"还不能查看详细信息呢~"];
405-
DebugLog(@"暂时不解析啊:%@--%@", proAct.user.name, proAct.action_msg);
448+
if ([target_type isEqualToString:@"Project"]){//这是什么鬼。。遗留的 type 吧
449+
[self showHudTipStr:@"还不能查看详细信息呢~"];
450+
// }else if ([target_type isEqualToString:@"MergeRequestComment"]){//过期类型,已用CommitLineNote替代
451+
// }else if ([target_type isEqualToString:@"PullRequestComment"]){//过期类型,已用CommitLineNote替代
452+
// }else if ([target_type isEqualToString:@"ProjectStar"]){//不用解析
453+
// }else if ([target_type isEqualToString:@"ProjectWatcher"]){//不用解析
454+
}else if ([target_type isEqualToString:@"QcTask"]){//还不能解析
455+
[self showHudTipStr:@"还不能查看详细信息呢~"];
456+
}
406457
}
407458
}else{//cell上面第一个Label
408459
[self goToUserInfo:[User userWithGlobalKey:[clickedItem.href substringFromIndex:3]]];

‎Coding_iOS/Models/ProjectActivity.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
@interface ProjectActivity : NSObject
2020
@property (readwrite, nonatomic, strong) NSNumber *id;
21-
@property (readwrite, nonatomic, strong) NSString *target_type, *action, *action_msg, *type, *ref, *ref_type, *ref_path, *pull_request_title, *merge_request_title, *comment_content;
21+
@property (readwrite, nonatomic, strong) NSString *target_type, *action, *action_msg, *type, *ref, *ref_type, *ref_path, *pull_request_title, *merge_request_title, *comment_content, *merge_request_path, *pull_request_path;
2222
@property (readwrite, nonatomic, strong) User *user, *target_user;
2323
@property (readwrite, nonatomic, strong) NSDate *created_at;
2424
@property (readwrite, nonatomic, strong) Task *origin_task, *task;

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL