Skip to content

Commit 0bd3e5b

Browse files
committed
推送更新数据
项目首页的线对齐
1 parent 3ca017a commit 0bd3e5b

6 files changed

Lines changed: 79 additions & 32 deletions

File tree

Coding_iOS/Controllers/EditTaskViewController.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ typedef NS_ENUM(NSInteger, TaskEditType) {
1919
@interface EditTaskViewController : BaseViewController<UITableViewDataSource, UITableViewDelegate, UIMessageInputViewDelegate>
2020
@property (strong, nonatomic) Task *myTask, *myCopyTask;
2121
@property (copy, nonatomic) void(^taskChangedBlock)(Task *curTask, TaskEditType type);
22-
22+
- (void)queryToRefreshTaskDetail;
2323
@end

Coding_iOS/Controllers/RootControllers/BaseViewController.m

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,18 @@ + (void)handleNotificationInfo:(NSDictionary *)userInfo applicationState:(UIAppl
129129
[[UnReadManager shareManager] updateUnRead];
130130
}
131131
}
132+
132133
+ (UIViewController *)analyseVCFromLinkStr:(NSString *)linkStr{
133134
return [self analyseVCFromLinkStr:linkStr justForRefreshData:NO isNewVC:nil];
134135
}
136+
137+
138+
//解析linkStr,返回对应的VC。
139+
//如果justForRefreshData的值为YES,且当前最顶部显示的VC就是解析结果,那么就只是更新数据,并设置isNewVC的值为NO
140+
//如果isNewVC参数的值nil,则会强制修改justForRefreshData的值为NO。
135141
+ (UIViewController *)analyseVCFromLinkStr:(NSString *)linkStr justForRefreshData:(BOOL)justForRefreshData isNewVC:(BOOL *)isNewVC{
136142
NSLog(@"\n analyseVCFromLinkStr : %@", linkStr);
143+
137144
if (!linkStr || linkStr.length <= 0) {
138145
return nil;
139146
}else if (![linkStr hasPrefix:@"/"] && ![linkStr hasPrefix:kNetPath_Code_Base]){
@@ -142,10 +149,13 @@ + (UIViewController *)analyseVCFromLinkStr:(NSString *)linkStr justForRefreshDat
142149

143150
UIViewController *analyseVC = nil;
144151
UIViewController *tempVC = nil;
152+
if (!isNewVC) {
153+
justForRefreshData = NO;
154+
}
145155
if (justForRefreshData) {
156+
*isNewVC = YES;
146157
tempVC = [BaseViewController presentingVC];
147158
}
148-
149159

150160
NSString *userRegexStr = @"/u/([^/]+)$";
151161
NSString *userTweetRegexStr = @"/u/([^/]+)/bubble$";
@@ -172,12 +182,29 @@ + (UIViewController *)analyseVCFromLinkStr:(NSString *)linkStr justForRefreshDat
172182
//冒泡
173183
NSString *user_global_key = matchedCaptures[1];
174184
NSString *pp_id = matchedCaptures[2];
185+
if ([tempVC isKindOfClass:[TweetDetailViewController class]]) {
186+
TweetDetailViewController *vc = (TweetDetailViewController *)tempVC;
187+
if ([vc.curTweet.pp_id isEqualToString:pp_id]
188+
&& [vc.curTweet.user_global_key isEqualToString:user_global_key]) {
189+
[vc refreshTweet];
190+
*isNewVC = NO;
191+
return vc;
192+
}
193+
}
175194
TweetDetailViewController *vc = [[TweetDetailViewController alloc] init];
176195
vc.curTweet = [Tweet tweetWithGlobalKey:user_global_key andPPID:pp_id];
177196
analyseVC = vc;
178197
}else if ((matchedCaptures = [linkStr captureComponentsMatchedByRegex:topicRegexStr]).count > 0){
179198
//讨论
180199
NSString *topic_id = matchedCaptures[3];
200+
if ([tempVC isKindOfClass:[TopicDetailViewController class]]) {
201+
TopicDetailViewController *vc = (TopicDetailViewController *)tempVC;
202+
if ([vc.curTopic.id.stringValue isEqualToString:topic_id]) {
203+
[vc refreshTopic];
204+
*isNewVC = NO;
205+
return vc;
206+
}
207+
}
181208
TopicDetailViewController *vc = [[TopicDetailViewController alloc] init];
182209
vc.curTopic = [ProjectTopic topicWithId:[NSNumber numberWithInteger:topic_id.integerValue]];
183210
analyseVC = vc;
@@ -186,7 +213,16 @@ + (UIViewController *)analyseVCFromLinkStr:(NSString *)linkStr justForRefreshDat
186213
NSString *user_global_key = matchedCaptures[1];
187214
NSString *project_name = matchedCaptures[2];
188215
NSString *taskId = matchedCaptures[3];
189-
216+
NSString *backend_project_path = [NSString stringWithFormat:@"/user/%@/project/%@", user_global_key, project_name];
217+
if ([tempVC isKindOfClass:[EditTaskViewController class]]) {
218+
EditTaskViewController *vc = (EditTaskViewController *)tempVC;
219+
if ([vc.myTask.backend_project_path isEqualToString:backend_project_path]
220+
&& [vc.myTask.id.stringValue isEqualToString:taskId]) {
221+
[vc queryToRefreshTaskDetail];
222+
*isNewVC = NO;
223+
return vc;
224+
}
225+
}
190226
EditTaskViewController *vc = [[EditTaskViewController alloc] init];
191227
vc.myTask = [Task taskWithBackend_project_path:[NSString stringWithFormat:@"/user/%@/project/%@", user_global_key, project_name] andId:taskId];
192228
@weakify(vc);
@@ -208,11 +244,11 @@ + (UIViewController *)analyseVCFromLinkStr:(NSString *)linkStr justForRefreshDat
208244
}else if ((matchedCaptures = [linkStr captureComponentsMatchedByRegex:conversionRegexStr]).count > 0) {
209245
//私信
210246
NSString *user_global_key = matchedCaptures[1];
211-
212247
if ([tempVC isKindOfClass:[ConversationViewController class]]) {
213248
ConversationViewController *vc = (ConversationViewController *)tempVC;
214249
if ([vc.myPriMsgs.curFriend.global_key isEqualToString:user_global_key]) {
215250
[vc refreshLoadMore:NO];
251+
*isNewVC = NO;
216252
return vc;
217253
}
218254
}
@@ -226,10 +262,12 @@ + (void)presentLinkStr:(NSString *)linkStr{
226262
if (!linkStr || linkStr.length == 0) {
227263
return;
228264
}
229-
BOOL *isNewVC;
230-
UIViewController *vc = [self analyseVCFromLinkStr:linkStr justForRefreshData:YES isNewVC:isNewVC];
231-
if (vc && *isNewVC) {
232-
[self presentVC:vc];
265+
BOOL isNewVC = YES;
266+
UIViewController *vc = [self analyseVCFromLinkStr:linkStr justForRefreshData:YES isNewVC:&isNewVC];
267+
if (vc) {
268+
if (isNewVC) {
269+
[self presentVC:vc];
270+
}
233271
}else{
234272
//网页
235273
WebViewController *webVc = [WebViewController webVCWithUrlStr:linkStr];

Coding_iOS/Controllers/TopicDetailViewController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@
1414
@interface TopicDetailViewController : BaseViewController<UITableViewDataSource, UITableViewDelegate, UIMessageInputViewDelegate>
1515
@property (strong, nonatomic) ProjectTopic *curTopic;
1616
@property (nonatomic, copy) void (^deleteTopicBlock)(ProjectTopic *);
17+
- (void)refreshTopic;
1718
@end

Coding_iOS/Controllers/TweetDetailViewController.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515
@interface TweetDetailViewController : BaseViewController<UITableViewDataSource, UITableViewDelegate, UIScrollViewDelegate, TTTAttributedLabelDelegate, UIMessageInputViewDelegate>
1616
@property (strong, nonatomic) Tweet *curTweet;
17-
1817
@property (copy, nonatomic) void(^deleteTweetBlock)(Tweet *);
1918

19+
- (void)refreshTweet;
20+
2021
@end

Coding_iOS/Views/Cell/ProjectInfoCell.m

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,23 +132,18 @@ - (void)layoutSubviews{
132132
make.height.mas_equalTo(20);
133133
}];
134134
[_recommendedView mas_makeConstraints:^(MASConstraintMaker *make) {
135-
make.right.mas_lessThanOrEqualTo(self.contentView.mas_right).offset(-pading);
135+
make.right.mas_lessThanOrEqualTo(self.contentView.mas_right);
136136
make.left.equalTo(_proTitleL.mas_right).offset(5);
137137
make.centerY.equalTo(_proTitleL.mas_centerY);
138138
make.size.mas_equalTo(is_recommended? CGSizeMake(20, 20): CGSizeZero);
139139
}];
140140
[_proInfoL mas_makeConstraints:^(MASConstraintMaker *make) {
141141
make.left.equalTo(_proTitleL);
142-
make.right.equalTo(self.contentView.mas_right).offset(-pading);
142+
make.right.equalTo(self.contentView.mas_right);
143143
make.centerY.equalTo(_proImgView.mas_centerY).offset(kProjectInfoCell_ProImgViewWidth/5);
144144
make.height.mas_equalTo(15);
145145
}];
146-
[_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
147-
make.left.equalTo(_proImgView.mas_left);
148-
make.right.equalTo(self.contentView.mas_right).offset(-pading);
149-
make.bottom.equalTo(self.contentView);
150-
make.height.mas_equalTo(1.0);
151-
}];
146+
[_lineView setFrame:CGRectMake(pading, [ProjectInfoCell cellHeight] - 1.0, kScreen_Width - 2*pading, 1.0)];
152147
}
153148

154149
#pragma mark TTTAttributedLabelDelegate

Podfile.lock

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ PODS:
1717
- BlocksKit/DynamicDelegate
1818
- FontAwesome+iOS (0.1.4)
1919
- hpple (0.2.0)
20+
- MarqueeLabel (2.2.1)
2021
- Masonry (0.5.3)
2122
- MBProgressHUD (0.9)
2223
- MMMarkdown (0.3)
@@ -46,6 +47,7 @@ PODS:
4647
- POP+MCAnimate/Internal
4748
- PPiAwesomeButton (1.5.2):
4849
- FontAwesome+iOS
50+
- RBBAnimation (0.3.0)
4951
- ReactiveCocoa (2.3.1):
5052
- ReactiveCocoa/UI (= 2.3.1)
5153
- ReactiveCocoa/Core (2.3.1):
@@ -54,6 +56,10 @@ PODS:
5456
- ReactiveCocoa/UI (2.3.1):
5557
- ReactiveCocoa/Core
5658
- RegexKitLite (4.0)
59+
- SDCAlertView (2.4.1):
60+
- RBBAnimation (~> 0.3)
61+
- SDCAutoLayout (~> 2.0)
62+
- SDCAutoLayout (2.0.3)
5763
- TPKeyboardAvoiding (1.2.4)
5864
- TTTAttributedLabel (1.10.1)
5965
- UIImage+BlurredFrame (0.0.4)
@@ -62,6 +68,7 @@ DEPENDENCIES:
6268
- APParallaxHeader
6369
- BlocksKit (= 2.2.5)
6470
- hpple (= 0.2.0)
71+
- MarqueeLabel
6572
- Masonry (= 0.5.3)
6673
- MBProgressHUD (= 0.9)
6774
- MMMarkdown (= 0.3)
@@ -70,26 +77,31 @@ DEPENDENCIES:
7077
- PPiAwesomeButton
7178
- ReactiveCocoa (= 2.3.1)
7279
- RegexKitLite (= 4.0)
80+
- SDCAlertView (~> 2.4.1)
7381
- TPKeyboardAvoiding (= 1.2.4)
7482
- TTTAttributedLabel (= 1.10.1)
7583
- UIImage+BlurredFrame (= 0.0.4)
7684

7785
SPEC CHECKSUMS:
78-
APParallaxHeader: 6e7cc27c052be34e1a5655dc2fab6c40eecbbe55
79-
BlocksKit: 4439e7f30a9f90743462ca63545a15c1f4304cef
80-
FontAwesome+iOS: 816c20304edef4ca92835de669577005cbaaf261
81-
hpple: f4eb7c21a8db83ec264e5d614ec7509e10e5adec
82-
Masonry: 35368c2ca9577ca87722c12fc52c4bad9b1c1516
83-
MBProgressHUD: 2038dbcf3dce73215abed6001657043d53aa79a8
84-
MMMarkdown: 95af8920c647512d1efa2ac8ac1932baf3266e2c
85-
NYXImagesKit: 1c9f228ae78fab475d267b3b3a1308e0fba11731
86-
pop: 2f14a1ea61339767af9e66741b418c831b3844df
87-
POP+MCAnimate: 528a556e3754a0b406adc481b02ec2984cfd1032
88-
PPiAwesomeButton: 9c57f5b72e3a36eaa4f5b811fbdb90913e5cdb21
89-
ReactiveCocoa: dca75777b9d18990c8714a3a6f2149f29b4d1462
86+
APParallaxHeader: 854bc48a2487ca12c702f8a236fec0d89cdac5c3
87+
BlocksKit: 7f422b971407001178d181a43b99014ea2591fe6
88+
FontAwesome+iOS: 9070b682a9255ca0fdc34bcfb129ad0ba2b73b87
89+
hpple: 3b765f96fc2cd56ad1a49aef6f7be5cb2aa64b57
90+
MarqueeLabel: c024bab67a1558e8e127132be3b6d66a702405fe
91+
Masonry: 9f515466afe48632562342a40a1c224071a1a022
92+
MBProgressHUD: d8e7ea388dc1549a42e0d219067cf5f2c898fb66
93+
MMMarkdown: 13af1af50e5f476f1097797f43ea2bd76c83067a
94+
NYXImagesKit: 8163e3335a40eaa173ca5bbbf81fafb57d3947eb
95+
pop: 628ffc631644601567ee8bfaaaea493ebd7d0923
96+
POP+MCAnimate: a99e209148c602512de487f1160a44bf78572024
97+
PPiAwesomeButton: 16f7279582fd36f65186b24b83ef876217363eb5
98+
RBBAnimation: cb6cb419f511434ce932f7d0fabf369612fafb4e
99+
ReactiveCocoa: 334468a83b2c5f669f7cfb9a084415ee23219b4f
90100
RegexKitLite: c0e4c12e6e7de0769f3a3ed679f0f61604170661
91-
TPKeyboardAvoiding: 925e1e1912597d1a4956697eec3bd9656552153c
92-
TTTAttributedLabel: 94bb04f1e005616002dd2cee0262a0082e533627
93-
UIImage+BlurredFrame: 0c38f5760d72125c47d16001a88faaac573bd35d
101+
SDCAlertView: ff4c6c76ccdfcd0fa20e0ee5e044630f93fb3d12
102+
SDCAutoLayout: e6885bb39ab8e2ec2ff84d158f38035f025f7420
103+
TPKeyboardAvoiding: 0a40dfbb0af7c8bdae1dd457496dccfd217d85f6
104+
TTTAttributedLabel: c8f3801a6463b9c9b82b0c84c465fdda9751892a
105+
UIImage+BlurredFrame: ad2f7195c6947ea3117c7d202f75a51958d5061a
94106

95107
COCOAPODS: 0.35.0

0 commit comments

Comments
 (0)