Skip to content

Commit 852f172

Browse files
wanghenghengEase
authored and
Ease
committed
通知界面改版
1 parent eb6534e commit 852f172

File tree

10 files changed

+110
-17
lines changed

10 files changed

+110
-17
lines changed

Coding_iOS.xcodeproj/project.pbxproj

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@
148148
4E4972DF1BB535B400F3AC15 /* tipIcon_ProjectTweet@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E4972DD1BB535B400F3AC15 /* tipIcon_ProjectTweet@2x.png */; settings = {ASSET_TAGS = (); }; };
149149
4E4972E01BB535B400F3AC15 /* tipIcon_ProjectTweetComment@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E4972DE1BB535B400F3AC15 /* tipIcon_ProjectTweetComment@2x.png */; settings = {ASSET_TAGS = (); }; };
150150
4E4972E21BB5395B00F3AC15 /* tipIcon_CommitLineNote@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E4972E11BB5395B00F3AC15 /* tipIcon_CommitLineNote@2x.png */; settings = {ASSET_TAGS = (); }; };
151+
4E4972E41BB543A900F3AC15 /* tipIcon_Depot@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E4972E31BB543A900F3AC15 /* tipIcon_Depot@2x.png */; settings = {ASSET_TAGS = (); }; };
152+
4E4972E81BB5446900F3AC15 /* tips_menu_icon_mkread@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E4972E61BB5446900F3AC15 /* tips_menu_icon_mkread@2x.png */; settings = {ASSET_TAGS = (); }; };
153+
4E4972E91BB5446900F3AC15 /* tips_menu_icon_status@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E4972E71BB5446900F3AC15 /* tips_menu_icon_status@2x.png */; settings = {ASSET_TAGS = (); }; };
151154
4E4ABBEA1A653027004760D9 /* WebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E4ABBE91A653027004760D9 /* WebViewController.m */; };
152155
4E4D6A581B1C5DC000FD2E49 /* MRPRCommentCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E4D6A571B1C5DC000FD2E49 /* MRPRCommentCell.m */; };
153156
4E4D6A5B1B1C5DDF00FD2E49 /* MRPRCommentCCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E4D6A5A1B1C5DDF00FD2E49 /* MRPRCommentCCell.m */; };
@@ -285,6 +288,7 @@
285288
4E76D4DE1A5A7B4A0094A35E /* text_clear_btn@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E76D4DD1A5A7B4A0094A35E /* text_clear_btn@2x.png */; };
286289
4E787DE21B0329B300F06E83 /* ProjectLineNote.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E787DE11B0329B300F06E83 /* ProjectLineNote.m */; };
287290
4E787DE51B03342000F06E83 /* ProjectActivity.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E787DE41B03342000F06E83 /* ProjectActivity.m */; };
291+
4E86FEE51BB556D6005E53F3 /* tipIcon_ProjectFileComment.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E86FEE41BB556D6005E53F3 /* tipIcon_ProjectFileComment.png */; settings = {ASSET_TAGS = (); }; };
288292
4E8765651A22E5B40090CFB9 /* NSMutableArray+SWUtilityButtons.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E87655A1A22E5B40090CFB9 /* NSMutableArray+SWUtilityButtons.m */; };
289293
4E8765661A22E5B40090CFB9 /* SWCellScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E87655C1A22E5B40090CFB9 /* SWCellScrollView.m */; };
290294
4E8765671A22E5B40090CFB9 /* SWLongPressGestureRecognizer.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E87655E1A22E5B40090CFB9 /* SWLongPressGestureRecognizer.m */; };
@@ -1121,6 +1125,9 @@
11211125
4E4972DD1BB535B400F3AC15 /* tipIcon_ProjectTweet@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "tipIcon_ProjectTweet@2x.png"; sourceTree = "<group>"; };
11221126
4E4972DE1BB535B400F3AC15 /* tipIcon_ProjectTweetComment@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "tipIcon_ProjectTweetComment@2x.png"; sourceTree = "<group>"; };
11231127
4E4972E11BB5395B00F3AC15 /* tipIcon_CommitLineNote@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "tipIcon_CommitLineNote@2x.png"; sourceTree = "<group>"; };
1128+
4E4972E31BB543A900F3AC15 /* tipIcon_Depot@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "tipIcon_Depot@2x.png"; sourceTree = "<group>"; };
1129+
4E4972E61BB5446900F3AC15 /* tips_menu_icon_mkread@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "tips_menu_icon_mkread@2x.png"; sourceTree = "<group>"; };
1130+
4E4972E71BB5446900F3AC15 /* tips_menu_icon_status@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "tips_menu_icon_status@2x.png"; sourceTree = "<group>"; };
11241131
4E4ABBE81A653027004760D9 /* WebViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebViewController.h; sourceTree = "<group>"; };
11251132
4E4ABBE91A653027004760D9 /* WebViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WebViewController.m; sourceTree = "<group>"; };
11261133
4E4D6A561B1C5DC000FD2E49 /* MRPRCommentCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MRPRCommentCell.h; sourceTree = "<group>"; };
@@ -1329,6 +1336,7 @@
13291336
4E787DE11B0329B300F06E83 /* ProjectLineNote.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProjectLineNote.m; sourceTree = "<group>"; };
13301337
4E787DE31B03342000F06E83 /* ProjectActivity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProjectActivity.h; sourceTree = "<group>"; };
13311338
4E787DE41B03342000F06E83 /* ProjectActivity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProjectActivity.m; sourceTree = "<group>"; };
1339+
4E86FEE41BB556D6005E53F3 /* tipIcon_ProjectFileComment.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tipIcon_ProjectFileComment.png; sourceTree = "<group>"; };
13321340
4E8765591A22E5B40090CFB9 /* NSMutableArray+SWUtilityButtons.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableArray+SWUtilityButtons.h"; sourceTree = "<group>"; };
13331341
4E87655A1A22E5B40090CFB9 /* NSMutableArray+SWUtilityButtons.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableArray+SWUtilityButtons.m"; sourceTree = "<group>"; };
13341342
4E87655B1A22E5B40090CFB9 /* SWCellScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWCellScrollView.h; sourceTree = "<group>"; };
@@ -2556,6 +2564,15 @@
25562564
path = emotion_monkey_gif;
25572565
sourceTree = "<group>";
25582566
};
2567+
4E4972E51BB5446900F3AC15 /* tips_menu */ = {
2568+
isa = PBXGroup;
2569+
children = (
2570+
4E4972E61BB5446900F3AC15 /* tips_menu_icon_mkread@2x.png */,
2571+
4E4972E71BB5446900F3AC15 /* tips_menu_icon_status@2x.png */,
2572+
);
2573+
path = tips_menu;
2574+
sourceTree = "<group>";
2575+
};
25592576
4E53EB4C1AF9CC520034FE1C /* RKSwipeBetweenViewControllers */ = {
25602577
isa = PBXGroup;
25612578
children = (
@@ -3911,6 +3928,7 @@
39113928
8EA6CF5D19E240C40076D59C /* Images */ = {
39123929
isa = PBXGroup;
39133930
children = (
3931+
4E4972E51BB5446900F3AC15 /* tips_menu */,
39143932
4E2BF3C61B96CDF800A5A0A8 /* share_btn */,
39153933
4E2BF3BD1B95B97A00A5A0A8 /* tweet_btn */,
39163934
4E93F2341B84356500017916 /* file_menu_icon */,
@@ -4107,6 +4125,8 @@
41074125
4E4972DD1BB535B400F3AC15 /* tipIcon_ProjectTweet@2x.png */,
41084126
4E4972DE1BB535B400F3AC15 /* tipIcon_ProjectTweetComment@2x.png */,
41094127
4E4972E11BB5395B00F3AC15 /* tipIcon_CommitLineNote@2x.png */,
4128+
4E4972E31BB543A900F3AC15 /* tipIcon_Depot@2x.png */,
4129+
4E86FEE41BB556D6005E53F3 /* tipIcon_ProjectFileComment.png */,
41104130
);
41114131
path = tip_icons;
41124132
sourceTree = "<group>";
@@ -4794,13 +4814,15 @@
47944814
8E8F7B2E19EF6306006BA8BD /* btn_followed_yes@2x.png in Resources */,
47954815
8E8F7B3319EF6306006BA8BD /* btn_project_add@2x.png in Resources */,
47964816
4E6383D11B32665700D98648 /* project_item_activity@2x.png in Resources */,
4817+
4E4972E91BB5446900F3AC15 /* tips_menu_icon_status@2x.png in Resources */,
47974818
4EAE068E1B78484D00179F4B /* user_info_point@2x.png in Resources */,
47984819
4E9113AA1A1CB19900AC9431 /* icon_file_state_goon@2x.png in Resources */,
47994820
4EF17EDA1B3C3112003CDD2D /* intro_icon_5@3x.png in Resources */,
48004821
8E64ED8319ED0CE3006E99DA /* QBImagePickerController.strings in Resources */,
48014822
8E97CE671A0A3424006F9AD7 /* keyboard_emotion_monkey@2x.png in Resources */,
48024823
4E217F0F1A70EDC700F6DF88 /* SVWebViewControllerActivityChrome-iPad.png in Resources */,
48034824
8E97CEA51A0C7E26006F9AD7 /* coding_emoji_14@2x.png in Resources */,
4825+
4E4972E81BB5446900F3AC15 /* tips_menu_icon_mkread@2x.png in Resources */,
48044826
8E97CEA61A0C7E26006F9AD7 /* coding_emoji_15@2x.png in Resources */,
48054827
8EA6D17819E240C40076D59C /* placeholder_monkey_round_40@2x.png in Resources */,
48064828
8EA6D15C19E240C40076D59C /* login_email@2x.png in Resources */,
@@ -4904,6 +4926,7 @@
49044926
4E96E7DB1A1B537E0037C098 /* icon_file_code@2x.png in Resources */,
49054927
4EF17ED51B3C3112003CDD2D /* intro_icon_3@2x.png in Resources */,
49064928
8EA6D19B19E240C40076D59C /* tipIcon_PullRequestComment@2x.png in Resources */,
4929+
4E4972E41BB543A900F3AC15 /* tipIcon_Depot@2x.png in Resources */,
49074930
8EF6434119FE696B00F7EEB0 /* cell_checkmark@2x.png in Resources */,
49084931
4EF17ED61B3C3112003CDD2D /* intro_icon_3@3x.png in Resources */,
49094932
4E4D6ABE1B252C5300FD2E49 /* timeBtn_Nav@2x.png in Resources */,
@@ -5090,6 +5113,7 @@
50905113
B9A00D7F1ACA3A05008BA008 /* ProjectSetting.storyboard in Resources */,
50915114
8EA6D19219E240C40076D59C /* timeline_icon_unread@2x.png in Resources */,
50925115
4E095A6D1B69F920008DC439 /* banner__page_selected@2x.png in Resources */,
5116+
4E86FEE51BB556D6005E53F3 /* tipIcon_ProjectFileComment.png in Resources */,
50935117
4E217F141A70EDC700F6DF88 /* SVWebViewControllerActivitySafari-iPad@2x.png in Resources */,
50945118
4EF91F641B00B62B0021C951 /* icon_not_locationed@2x.png in Resources */,
50955119
4E6383EA1B32791600D98648 /* checkbox_unchecked@2x.png in Resources */,

Coding_iOS/Controllers/TipsViewController.m

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#import "SVPullToRefresh.h"
1919
#import "EditTaskViewController.h"
2020
#import "WebViewController.h"
21+
#import "KxMenu.h"
2122

2223
@interface TipsViewController ()
2324
@property (nonatomic, strong) UITableView *myTableView;
@@ -87,15 +88,13 @@ - (void)didReceiveMemoryWarning
8788
}
8889

8990
- (void)refresh{
90-
if (_myCodingTips.isLoading) {
91-
return;
92-
}
9391
_myCodingTips.willLoadMore = NO;
9492
[self sendRequest];
9593
}
9694

9795
- (void)refreshMore{
98-
if (_myCodingTips.isLoading || !_myCodingTips.canLoadMore) {
96+
if (!_myCodingTips.canLoadMore) {
97+
[_myTableView.infiniteScrollingView stopAnimating];
9998
return;
10099
}
101100
_myCodingTips.willLoadMore = YES;
@@ -169,13 +168,31 @@ - (void)p_markReadTip:(CodingTip *)tip{
169168
}
170169

171170
- (void)rightNavBtnClicked{
172-
@weakify(self);
173-
[[UIActionSheet bk_actionSheetCustomWithTitle:@"将本页的未读通知全部标记为已读?" buttonTitles:@[@"全部标为已读"] destructiveTitle:nil cancelTitle:@"取消" andDidDismissBlock:^(UIActionSheet *sheet, NSInteger index) {
174-
if (index == 0) {
175-
@strongify(self);
176-
[self p_markReadAll];
177-
}
178-
}] showInView:self.view];
171+
172+
if ([KxMenu isShowingInView:self.view]) {
173+
[KxMenu dismissMenu:YES];
174+
}else{
175+
[KxMenu setTitleFont:[UIFont systemFontOfSize:14]];
176+
[KxMenu setTintColor:[UIColor whiteColor]];
177+
[KxMenu setLineColor:[UIColor colorWithHexString:@"0xdddddd"]];
178+
NSArray *menuItems = @[
179+
[KxMenuItem menuItem:_myCodingTips.onlyUnread? @"查看全部": @"查看未读" image:[UIImage imageNamed:@"tips_menu_icon_status"] target:self action:@selector(p_changeTipStatus)],
180+
[KxMenuItem menuItem:@"全部标注已读" image:[UIImage imageNamed:@"tips_menu_icon_mkread"] target:self action:@selector(p_markReadAll)],
181+
];
182+
[menuItems setValue:[UIColor colorWithHexString:@"0x222222"] forKey:@"foreColor"];
183+
CGRect senderFrame = CGRectMake(kScreen_Width - (kDevice_Is_iPhone6Plus? 30: 26), 0, 0, 0);
184+
[KxMenu showMenuInView:self.view
185+
fromRect:senderFrame
186+
menuItems:menuItems];
187+
}
188+
189+
// @weakify(self);
190+
// [[UIActionSheet bk_actionSheetCustomWithTitle:@"将本页的未读通知全部标记为已读?" buttonTitles:@[@"全部标为已读"] destructiveTitle:nil cancelTitle:@"取消" andDidDismissBlock:^(UIActionSheet *sheet, NSInteger index) {
191+
// if (index == 0) {
192+
// @strongify(self);
193+
// [self p_markReadAll];
194+
// }
195+
// }] showInView:self.view];
179196
}
180197

181198
- (void)p_markReadAll{
@@ -193,6 +210,12 @@ - (void)p_markReadAll{
193210
}];
194211
}
195212

213+
- (void)p_changeTipStatus{
214+
_myCodingTips.onlyUnread = !_myCodingTips.onlyUnread;
215+
[_myTableView reloadData];
216+
[self refresh];
217+
}
218+
196219
#pragma mark analyseHtmlMediaItem
197220
- (void)analyseHtmlMediaItem:(HtmlMediaItem *)item andTip:(CodingTip *)tip{
198221

597 Bytes
Loading
Loading
Loading
Loading

Coding_iOS/Models/CodingTip.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ - (void)adjust{
4545
_target_type_ColorName = @"0x379FD3";
4646
}
4747
_target_type_imageName = [NSString stringWithFormat:@"tipIcon_%@", _target_type];
48+
49+
NSRange range = [_htmlMedia.contentDisplay rangeByTrimmingLeftCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
50+
if (range.location > 0) {
51+
for (HtmlMediaItem *item in _htmlMedia.mediaItems) {
52+
item.range = NSMakeRange(item.range.location - range.location, item.range.length);
53+
}
54+
[_htmlMedia.contentDisplay deleteCharactersInRange:NSMakeRange(0, range.location)];
55+
}
4856
_content = _htmlMedia.contentDisplay;
4957
}
5058

Coding_iOS/Models/CodingTips.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
@property (readwrite, nonatomic, strong) NSDictionary *propertyArrayMap;
1616
@property (readwrite, nonatomic, strong) NSMutableArray *list;
1717
@property (assign, nonatomic) NSInteger type;
18+
@property (assign, nonatomic) BOOL onlyUnread;
1819

1920
+(CodingTips *)codingTipsWithType:(NSInteger)type;
2021
- (NSString *)toTipsPath;

Coding_iOS/Models/CodingTips.m

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@ - (instancetype)init
2424
return self;
2525
}
2626

27+
- (void)setOnlyUnread:(BOOL)onlyUnread{
28+
if (_onlyUnread != onlyUnread) {
29+
_onlyUnread = onlyUnread;
30+
//初始化数据
31+
_page = [NSNumber numberWithInteger:1];
32+
_pageSize = [NSNumber numberWithInteger:20];
33+
_canLoadMore = YES;
34+
if (_list) {
35+
[_list removeAllObjects];
36+
}
37+
}
38+
}
39+
2740
+(CodingTips *)codingTipsWithType:(NSInteger)type{
2841
CodingTips *tips = [[CodingTips alloc] init];
2942
tips.type = type;
@@ -43,7 +56,13 @@ - (void)configWithObj:(CodingTips *)tips{
4356
}
4457

4558
- (NSString *)toTipsPath{
46-
return [NSString stringWithFormat:@"api/notification"];
59+
NSString *path;
60+
if (_onlyUnread) {
61+
path = @"api/notification/unread-list";
62+
}else{
63+
path = @"api/notification";
64+
}
65+
return path;
4766
}
4867
- (NSDictionary *)toTipsParams{
4968
NSDictionary *params;

Coding_iOS/Views/Cell/CodingTipCell.m

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#import "CodingTipCell.h"
1313
@interface CodingTipCell ()
1414
@property (strong, nonatomic) UITapImageView *ownerImgView;
15+
@property (strong, nonatomic) UILabel *ownerL;
1516
@property (strong, nonatomic) UIButton *ownerNameBtn;
1617
@property (strong, nonatomic) UILabel *timeLabel;
1718

@@ -42,6 +43,21 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
4243
if (!self.ownerImgView) {
4344
self.ownerImgView = [[UITapImageView alloc] initWithFrame:CGRectMake(kPaddingLeftWidth, 15, user_icon_width, user_icon_width)];
4445
[self.ownerImgView doCircleFrame];
46+
47+
_ownerL = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, user_icon_width, user_icon_width)];
48+
_ownerL.backgroundColor = [UIColor clearColor];
49+
_ownerL.font = [UIFont fontWithName:@"Chalkduster" size:20];
50+
// PartyLetPlain
51+
// Chalkduster
52+
_ownerL.textColor = [UIColor colorWithHexString:@"0x999999"];
53+
_ownerL.textAlignment = NSTextAlignmentCenter;
54+
[self.ownerImgView addSubview:_ownerL];
55+
56+
@weakify(self);
57+
[_ownerImgView addTapBlock:^(id obj) {
58+
@strongify(self);
59+
[self userBtnClicked];
60+
}];
4561
[self.contentView addSubview:self.ownerImgView];
4662
}
4763
if (!self.ownerNameBtn) {
@@ -97,12 +113,14 @@ - (void)setCurTip:(CodingTip *)curTip{
97113
return;
98114
}
99115
//owner头像
100-
__weak __typeof(self)weakSelf = self;
101-
[self.ownerImgView setImageWithUrl:[@"" urlImageWithCodePathResizeToView:_ownerImgView] placeholderImage:kPlaceholderMonkeyRoundWidth(40.0) tapBlock:^(id obj) {
102-
[weakSelf userBtnClicked];
103-
}];
116+
// [self.ownerImgView sd_setImageWithURL:[@"" urlImageWithCodePathResizeToView:_ownerImgView] placeholderImage:kPlaceholderMonkeyRoundWidth(40.0)];
117+
NSString *userName = curTip.user_item.displayStr;
118+
119+
NSString *pinyin = [userName transformToPinyin];
120+
NSString *username_first = pinyin.length > 0? [[pinyin substringToIndex:1] uppercaseString]: @"C";
121+
_ownerL.text = username_first;
104122
//owner姓名
105-
[self.ownerNameBtn setUserTitle:curTip.user_item.displayStr font:[UIFont systemFontOfSize:17] maxWidth:(kCodingTipCell_WidthContent -80)];
123+
[self.ownerNameBtn setUserTitle:userName font:[UIFont systemFontOfSize:17] maxWidth:(kCodingTipCell_WidthContent -80)];
106124
//时间
107125
_timeLabel.text = _curTip.target_type;
108126

0 commit comments

Comments
 (0)