Skip to content

Commit 52d0af9

Browse files
committed
search test~
1 parent 63ea38a commit 52d0af9

9 files changed

Lines changed: 180 additions & 16 deletions

File tree

Coding_iOS.xcodeproj/project.pbxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,7 @@
888888
B9A00D821ACA3A17008BA008 /* ProjectSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B9A00D811ACA3A17008BA008 /* ProjectSettingViewController.m */; };
889889
B9A00D851ACA3A55008BA008 /* ProjectAdvancedSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B9A00D841ACA3A55008BA008 /* ProjectAdvancedSettingViewController.m */; };
890890
D000E04A1BFC45CF00A33C2B /* CategorySearchBar.m in Sources */ = {isa = PBXBuildFile; fileRef = D000E0491BFC45CF00A33C2B /* CategorySearchBar.m */; };
891+
D02BE0AF1C0434DB008374C0 /* PRMRSearchCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D02BE0AE1C0434DB008374C0 /* PRMRSearchCell.m */; };
891892
D031F5DB1BFAD6690008E964 /* FRDLivelyButton.m in Sources */ = {isa = PBXBuildFile; fileRef = D031F5DA1BFAD6690008E964 /* FRDLivelyButton.m */; };
892893
D066BB3A1BF30EB9005AB5D6 /* ProjectSquareViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D066BB391BF30EB9005AB5D6 /* ProjectSquareViewController.m */; };
893894
D066BB3D1BF38844005AB5D6 /* ProjectAboutMeListCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D066BB3C1BF38844005AB5D6 /* ProjectAboutMeListCell.m */; };
@@ -2337,6 +2338,8 @@
23372338
C613B8719C3D38FED828A1E2 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
23382339
D000E0481BFC45CF00A33C2B /* CategorySearchBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CategorySearchBar.h; sourceTree = "<group>"; };
23392340
D000E0491BFC45CF00A33C2B /* CategorySearchBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CategorySearchBar.m; sourceTree = "<group>"; };
2341+
D02BE0AD1C0434DB008374C0 /* PRMRSearchCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PRMRSearchCell.h; sourceTree = "<group>"; };
2342+
D02BE0AE1C0434DB008374C0 /* PRMRSearchCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PRMRSearchCell.m; sourceTree = "<group>"; };
23402343
D031F5D91BFAD6690008E964 /* FRDLivelyButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FRDLivelyButton.h; sourceTree = "<group>"; };
23412344
D031F5DA1BFAD6690008E964 /* FRDLivelyButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FRDLivelyButton.m; sourceTree = "<group>"; };
23422345
D066BB381BF30EB9005AB5D6 /* ProjectSquareViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProjectSquareViewController.h; sourceTree = "<group>"; };
@@ -4868,6 +4871,8 @@
48684871
D0C448171C03187100DC1C4B /* TaskSearchCell.m */,
48694872
D0C448191C034C3F00DC1C4B /* TopicSearchCell.h */,
48704873
D0C4481A1C034C3F00DC1C4B /* TopicSearchCell.m */,
4874+
D02BE0AD1C0434DB008374C0 /* PRMRSearchCell.h */,
4875+
D02BE0AE1C0434DB008374C0 /* PRMRSearchCell.m */,
48714876
);
48724877
path = Cell;
48734878
sourceTree = "<group>";
@@ -5827,6 +5832,7 @@
58275832
4ECE8ADD1A3943E80021E29C /* NSObject+ObjectMap.m in Sources */,
58285833
4E8765661A22E5B40090CFB9 /* SWCellScrollView.m in Sources */,
58295834
8E1C3DEB19E7D58A00EF3032 /* ActionSheetCustomPicker.m in Sources */,
5835+
D02BE0AF1C0434DB008374C0 /* PRMRSearchCell.m in Sources */,
58305836
8EA6D14619E240C40076D59C /* TweetSendViewController.m in Sources */,
58315837
8EA6D1B819E240C40076D59C /* PrivateMessages.m in Sources */,
58325838
8E64ED7F19ED0CE3006E99DA /* QBAssetsCollectionViewCell.m in Sources */,

Coding_iOS/Controllers/AllSearchDisplayVC.m

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//
88

99
#import "AllSearchDisplayVC.h"
10-
1110
#import "TopicHotkeyView.h"
1211
#import "Coding_NetAPIManager.h"
1312
#import "ODRefreshControl.h"
@@ -19,7 +18,6 @@
1918
#import "CSMyTopicVC.h"
2019
#import "UserInfoViewController.h"
2120
#import "WebViewController.h"
22-
2321
#import "CSHotTopicPagesVC.h"
2422
#import "CSTopicDetailVC.h"
2523
#import "PublicSearchModel.h"
@@ -33,6 +31,7 @@
3331
#import "UserSearchCell.h"
3432
#import "TaskSearchCell.h"
3533
#import "TopicSearchCell.h"
34+
#import "PRMRSearchCell.h"
3635

3736
// nav--------
3837
#import "TweetDetailViewController.h"
@@ -158,7 +157,7 @@ - (void)initSearchResultsTableView {
158157
[tableView registerClass:[UserSearchCell class] forCellReuseIdentifier:@"UserSearchCell"];
159158
[tableView registerClass:[TaskSearchCell class] forCellReuseIdentifier:@"TaskSearchCell"];
160159
[tableView registerClass:[TopicSearchCell class] forCellReuseIdentifier:@"TopicSearchCell"];
161-
160+
[tableView registerClass:[PRMRSearchCell class] forCellReuseIdentifier:@"PRMRSearchCell"];
162161

163162
tableView.dataSource = self;
164163
tableView.delegate = self;
@@ -343,6 +342,11 @@ - (void)goToTopic:(ProjectTopic*)curTopic{
343342
[self.parentVC.navigationController pushViewController:vc animated:YES];
344343
}
345344

345+
- (void)goToMRDetail:(MRPR *)curMR{
346+
UIViewController *vc = [BaseViewController analyseVCFromLinkStr:curMR.path];
347+
[self.parentVC.navigationController pushViewController:vc animated:YES];
348+
}
349+
346350

347351
#pragma mark -
348352
#pragma mark Search Data Request
@@ -387,6 +391,12 @@ -(void)reloadDisplayData{
387391
case eSearchType_Topic:
388392
[self.dateSource addObjectsFromArray:_searchPros.project_topics.list];
389393
break;
394+
case eSearchType_Merge:
395+
[self.dateSource addObjectsFromArray:_searchPros.merge_requests.list];
396+
break;
397+
case eSearchType_Pull:
398+
[self.dateSource addObjectsFromArray:_searchPros.pull_requests.list];
399+
break;
390400
default:
391401
break;
392402
}
@@ -417,6 +427,12 @@ - (void)refreshHeaderTitle{
417427
case eSearchType_Topic:
418428
titleStr=[NSString stringWithFormat:@"共搜索到 %ld 个与\"%@\"相关的讨论", [_searchPros.project_topics.totalRow longValue],self.searchBar.text];
419429
break;
430+
case eSearchType_Merge:
431+
titleStr=[NSString stringWithFormat:@"共搜索到 %ld 个与\"%@\"相关的合并请求", [_searchPros.merge_requests.totalRow longValue],self.searchBar.text];
432+
break;
433+
case eSearchType_Pull:
434+
titleStr=[NSString stringWithFormat:@"共搜索到 %ld 个与\"%@\"相关的pull请求", [_searchPros.pull_requests.totalRow longValue],self.searchBar.text];
435+
break;
420436
default:
421437
break;
422438
}
@@ -476,7 +492,6 @@ - (void)requestDataWithPage:(NSInteger)page {
476492
curTopic.content= [[[resultA objectAtIndex:i] objectForKey:@"content"] firstObject];
477493
}
478494
}
479-
480495
switch (_curSearchType) {
481496
case eSearchType_Project:
482497
[weakSelf.dateSource addObjectsFromArray:_searchPros.projects.list];
@@ -496,6 +511,12 @@ - (void)requestDataWithPage:(NSInteger)page {
496511
case eSearchType_Topic:
497512
[weakSelf.dateSource addObjectsFromArray:_searchPros.project_topics.list];
498513
break;
514+
case eSearchType_Merge:
515+
[weakSelf.dateSource addObjectsFromArray:_searchPros.merge_requests.list];
516+
break;
517+
case eSearchType_Pull:
518+
[weakSelf.dateSource addObjectsFromArray:_searchPros.pull_requests.list];
519+
break;
499520
default:
500521
break;
501522
}
@@ -589,6 +610,18 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
589610
cell.curTopic = topic;
590611
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
591612
return cell;
613+
}else if(_curSearchType==eSearchType_Merge){
614+
PRMRSearchCell *cell = [tableView dequeueReusableCellWithIdentifier:@"PRMRSearchCell" forIndexPath:indexPath];
615+
MRPR *curMRPR =_dateSource[indexPath.row];
616+
cell.curMRPR = curMRPR;
617+
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
618+
return cell;
619+
}else if(_curSearchType==eSearchType_Pull){
620+
PRMRSearchCell *cell = [tableView dequeueReusableCellWithIdentifier:@"PRMRSearchCell" forIndexPath:indexPath];
621+
MRPR *curMRPR =_dateSource[indexPath.row];
622+
cell.curMRPR = curMRPR;
623+
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
624+
return cell;
592625
}else{
593626
return nil;
594627
}
@@ -608,14 +641,18 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
608641
return kTaskSearchCellHeight;
609642
}else if(_curSearchType==eSearchType_Topic){
610643
return kTopicSearchCellHeight;
644+
}else if (_currentPage==eSearchType_Pull){
645+
return [PRMRSearchCell cellHeight];
646+
}else if (_currentPage==eSearchType_Merge){
647+
return [PRMRSearchCell cellHeight];
611648
}else{
612649
return 100;
613650
}
614651
}
615652

616653
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
617654
[tableView deselectRowAtIndexPath:indexPath animated:NO];
618-
if (_curSearchType==eSearchType_Tweet) {
655+
if(_curSearchType==eSearchType_Tweet) {
619656
[tableView deselectRowAtIndexPath:indexPath animated:YES];
620657
[self goToTweet:_dateSource[indexPath.row]];
621658
}else if(_curSearchType==eSearchType_Project){
@@ -627,7 +664,9 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
627664
}else if (_curSearchType==eSearchType_Task){
628665
[self goToTask:_dateSource[indexPath.row]];
629666
}else if (_curSearchType==eSearchType_Topic){
630-
[self goToTopic:_dateSource[indexPath.row]];
667+
[self goToMRDetail:_dateSource[indexPath.row]];
668+
}else if (_curSearchType==eSearchType_Merge){
669+
[self goToMRDetail:_dateSource[indexPath.row]];
631670
}
632671
}
633672

Coding_iOS/Controllers/MRListViewController.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,5 @@ - (void)goToMRDetail:(MRPR *)curMR{
176176
vc.curMRPR = curMR;
177177
vc.curProject = _curProject;
178178
[self.navigationController pushViewController:vc animated:YES];
179-
180179
}
181180
@end

Coding_iOS/Controllers/MRPRAcceptViewController.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ - (void)viewDidLoad{
5555
}];
5656
tableView;
5757
});
58-
5958
_myTableView.tableFooterView = [self tableFooterView];
6059
}
6160

Coding_iOS/Controllers/NewProject/NewProject.storyboard

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9059" systemVersion="14F1021" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
33
<dependencies>
44
<deployment identifier="iOS"/>
55
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
@@ -22,7 +22,7 @@
2222
<rect key="frame" x="0.0" y="22" width="320" height="80"/>
2323
<autoresizingMask key="autoresizingMask"/>
2424
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="NCB-uM-JeI" id="AGo-cn-Hlv">
25-
<rect key="frame" x="0.0" y="0.0" width="320" height="79.5"/>
25+
<rect key="frame" x="0.0" y="0.0" width="320" height="79"/>
2626
<autoresizingMask key="autoresizingMask"/>
2727
<subviews>
2828
<imageView clipsSubviews="YES" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="gEV-Jy-c1F">
@@ -73,7 +73,7 @@
7373
<rect key="frame" x="0.0" y="102" width="320" height="120"/>
7474
<autoresizingMask key="autoresizingMask"/>
7575
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="vWq-sb-hDA" id="bll-G0-AM2">
76-
<rect key="frame" x="0.0" y="0.0" width="320" height="119.5"/>
76+
<rect key="frame" x="0.0" y="0.0" width="320" height="119"/>
7777
<autoresizingMask key="autoresizingMask"/>
7878
<subviews>
7979
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="apI-xl-HB2">
@@ -114,7 +114,7 @@
114114
<rect key="frame" x="0.0" y="244" width="320" height="44"/>
115115
<autoresizingMask key="autoresizingMask"/>
116116
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Vxv-hb-Gy3" id="539-D8-tG7">
117-
<rect key="frame" x="0.0" y="0.0" width="287" height="43.5"/>
117+
<rect key="frame" x="0.0" y="0.0" width="287" height="43"/>
118118
<autoresizingMask key="autoresizingMask"/>
119119
<subviews>
120120
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="项目类型" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mqK-Pz-sv5">
@@ -208,7 +208,7 @@
208208
<rect key="frame" x="0.0" y="22" width="320" height="44"/>
209209
<autoresizingMask key="autoresizingMask"/>
210210
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="xHN-2n-1RB" id="3rC-YE-NlS">
211-
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
211+
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
212212
<autoresizingMask key="autoresizingMask"/>
213213
<animations/>
214214
</tableViewCellContentView>

Coding_iOS/Controllers/ProjectSetting/ProjectSetting.storyboard

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@
510510
</scene>
511511
</scenes>
512512
<resources>
513-
<image name="icon_project_private.png" width="10" height="10"/>
513+
<image name="icon_project_private.png" width="24" height="24"/>
514514
<image name="taskOwner.png" width="28" height="28"/>
515515
</resources>
516516
</document>

Coding_iOS/Views/Cell/MRPRListCell.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ - (void)setCurMRPR:(MRPR *)curMRPR{
6666
[_imgView sd_setImageWithURL:[_curMRPR.author.avatar urlImageWithCodePathResize:2*kMRPRListCell_UserWidth] placeholderImage:kPlaceholderMonkeyRoundWidth(2*kMRPRListCell_UserWidth)];
6767
_titleLabel.attributedText = [self attributeTitle];
6868
_subTitleLabel.attributedText = [self attributeTail];
69-
7069
}
7170

7271
- (NSAttributedString *)attributeTitle{
@@ -80,7 +79,6 @@ - (NSAttributedString *)attributeTitle{
8079
NSForegroundColorAttributeName : [UIColor colorWithHexString:@"0x222222"]}
8180
range:NSMakeRange(iidStr.length + 1, titleStr.length)];
8281
return attrString;
83-
8482
}
8583

8684
- (NSAttributedString *)attributeTail{
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// PRMRSearchCell.h
3+
// Coding_iOS
4+
//
5+
// Created by jwill on 15/11/24.
6+
// Copyright © 2015年 Coding. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
#import "MRPR.h"
11+
12+
@interface PRMRSearchCell : UITableViewCell
13+
@property (strong, nonatomic) MRPR *curMRPR;
14+
15+
+ (CGFloat)cellHeight;
16+
@end

0 commit comments

Comments
 (0)