Skip to content

Commit a7b4527

Browse files
committed
赞赏的人 - 列表
1 parent bbcc48d commit a7b4527

File tree

9 files changed

+77
-25
lines changed

9 files changed

+77
-25
lines changed

Coding_iOS.xcodeproj/project.pbxproj

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5000,6 +5000,7 @@
50005000
8E47700D198770E700997D05 /* Frameworks */,
50015001
8E47700E198770E700997D05 /* Resources */,
50025002
96A9263FF11A4AA8B5F6BB6B /* Copy Pods Resources */,
5003+
E02AF118462CF977ED1C152E /* Embed Pods Frameworks */,
50035004
);
50045005
buildRules = (
50055006
);
@@ -5193,7 +5194,6 @@
51935194
4E0849811A918A7F00BD27F6 /* coding_emoji_39@2x.png in Resources */,
51945195
4EF17EDD1B3C3112003CDD2D /* intro_tip_0@3x.png in Resources */,
51955196
8E97CE9F1A0C7E26006F9AD7 /* coding_emoji_08@2x.png in Resources */,
5196-
4E6383E51B3272CF00D98648 /* info_Nav@2x.png in Resources */,
51975197
4E5D130D1C0ECB3400985AEB /* tweet_btn_liked@2x.png in Resources */,
51985198
4E93F2451B85C4C300017916 /* FileInfoViewController.xib in Resources */,
51995199
0A782FDE1AB5B78B00E96661 /* TweetSendCreateLocationCell.xib in Resources */,
@@ -5325,7 +5325,6 @@
53255325
4E96E7DE1A1B537E0037C098 /* icon_file_music@2x.png in Resources */,
53265326
8EA6D1A119E240C40076D59C /* tipIcon_UserFollow@2x.png in Resources */,
53275327
4E095A7F1B6B1E40008DC439 /* calendar_0xF5A523@2x.png in Resources */,
5328-
8EA6D18319E240C40076D59C /* me_normal@2x.png in Resources */,
53295328
4E5D13181C0EF48200985AEB /* button_close@2x.png in Resources */,
53305329
4EF17EDC1B3C3112003CDD2D /* intro_tip_0@2x.png in Resources */,
53315330
8EA6D19719E240C40076D59C /* tipIcon_Project@2x.png in Resources */,
@@ -5468,7 +5467,6 @@
54685467
4E217F121A70EDC700F6DF88 /* SVWebViewControllerActivityChrome@2x.png in Resources */,
54695468
4E217F161A70EDC700F6DF88 /* SVWebViewControllerActivitySafari@2x.png in Resources */,
54705469
4EF17EE21B3C3112003CDD2D /* intro_tip_3@2x.png in Resources */,
5471-
8E97CE511A0A3410006F9AD7 /* addBtn_Nav@2x.png in Resources */,
54725470
4E5D130F1C0ECB3400985AEB /* tweet_btn_reward@2x.png in Resources */,
54735471
4E6383D51B32665700D98648 /* project_item_mr_pr@2x.png in Resources */,
54745472
8E80296D19F4E23100A470A2 /* creator_image@2x.png in Resources */,
@@ -5577,6 +5575,21 @@
55775575
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n";
55785576
showEnvVarsInLog = 0;
55795577
};
5578+
E02AF118462CF977ED1C152E /* Embed Pods Frameworks */ = {
5579+
isa = PBXShellScriptBuildPhase;
5580+
buildActionMask = 2147483647;
5581+
files = (
5582+
);
5583+
inputPaths = (
5584+
);
5585+
name = "Embed Pods Frameworks";
5586+
outputPaths = (
5587+
);
5588+
runOnlyForDeploymentPostprocessing = 0;
5589+
shellPath = /bin/sh;
5590+
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-frameworks.sh\"\n";
5591+
showEnvVarsInLog = 0;
5592+
};
55805593
/* End PBXShellScriptBuildPhase section */
55815594

55825595
/* Begin PBXSourcesBuildPhase section */
@@ -6188,7 +6201,7 @@
61886201
"$(PROJECT_DIR)/Coding_iOS/Util/Audio/opencore-amr-iOS/lib",
61896202
"$(PROJECT_DIR)/Coding_iOS/Vendor/UMSocial_Sdk_4.3.0_Extra/SinaSSO",
61906203
);
6191-
PRODUCT_BUNDLE_IDENTIFIER = com.zzb.dis;
6204+
PRODUCT_BUNDLE_IDENTIFIER = net.coding.CodingForiOS;
61926205
PRODUCT_NAME = Coding_iOS;
61936206
PROVISIONING_PROFILE = "";
61946207
TARGETED_DEVICE_FAMILY = 1;
@@ -6227,7 +6240,7 @@
62276240
"$(PROJECT_DIR)/Coding_iOS/Util/Audio/opencore-amr-iOS/lib",
62286241
"$(PROJECT_DIR)/Coding_iOS/Vendor/UMSocial_Sdk_4.3.0_Extra/SinaSSO",
62296242
);
6230-
PRODUCT_BUNDLE_IDENTIFIER = com.zzb.dis;
6243+
PRODUCT_BUNDLE_IDENTIFIER = net.coding.CodingForiOS;
62316244
PRODUCT_NAME = Coding_iOS;
62326245
PROVISIONING_PROFILE = "";
62336246
TARGETED_DEVICE_FAMILY = 1;

Coding_iOS/Controllers/LikersViewController.m

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717

1818
@interface LikersViewController ()
19+
@property (strong, nonatomic) NSArray *like_reward_users;
1920

2021
@property (strong, nonatomic) UITableView *myTableView;
2122

@@ -39,7 +40,7 @@ - (void)viewDidLoad
3940
{
4041
[super viewDidLoad];
4142
// Do any additional setup after loading the view.
42-
self.title = @"点赞的人";
43+
self.title = @"赞赏的人";
4344
_myTableView = ({
4445
UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
4546
tableView.backgroundColor = [UIColor clearColor];
@@ -70,37 +71,49 @@ - (void)refresh{
7071
if (_curTweet.isLoading) {
7172
return;
7273
}
73-
if (_curTweet.like_users.count <= 0) {
74+
if (_like_reward_users.count <= 0) {
7475
[self.view beginLoading];
7576
}
7677
__weak typeof(self) weakSelf = self;
77-
[[Coding_NetAPIManager sharedManager] request_Tweet_Likers_WithObj:_curTweet andBlock:^(id data, NSError *error) {
78+
[[Coding_NetAPIManager sharedManager] request_Tweet_LikesAndRewards_WithObj:_curTweet andBlock:^(id data, NSError *error) {
7879
[weakSelf.view endLoading];
7980
[weakSelf.myRefreshControl endRefreshing];
80-
if (data) {
81-
weakSelf.curTweet.like_users = data;
82-
weakSelf.curTweet.likes = [NSNumber numberWithInteger:weakSelf.curTweet.like_users.count];
83-
[weakSelf.myTableView reloadData];
81+
if ([data isKindOfClass:[NSDictionary class]]) {
82+
[weakSelf refreshWithData:data];
8483
}
8584
}];
8685
}
86+
87+
- (void)refreshWithData:(NSDictionary *)data{
88+
if (data[@"likeUsers"]) {
89+
_curTweet.like_users = [NSObject arrayFromJSON:data[@"likeUsers"] ofObjects:@"User"];
90+
}
91+
if (data[@"rewardUsers"]) {
92+
_curTweet.reward_users = [NSObject arrayFromJSON:data[@"rewardUsers"] ofObjects:@"User"];
93+
}
94+
_like_reward_users = [_curTweet like_reward_users];
95+
[self.myTableView reloadData];
96+
}
97+
8798
#pragma mark Table M
8899
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
89-
if (_curTweet.like_users) {
90-
return [_curTweet.like_users count];
100+
if (_like_reward_users) {
101+
return [_like_reward_users count];
91102
}else{
92103
return 0;
93104
}
94105
}
95106

96107
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
97-
UserCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_UserCell];
98-
if (cell == nil) {
99-
cell = [[UserCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kCellIdentifier_UserCell];
100-
}
101-
User *curUser = [_curTweet.like_users objectAtIndex:indexPath.row];
108+
UserCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_UserCell forIndexPath:indexPath];
109+
110+
cell.userIconView.layer.borderColor = [UIColor colorWithHexString:@"0xFFAE03"].CGColor;
111+
112+
User *curUser = [_like_reward_users objectAtIndex:indexPath.row];
102113
cell.curUser = curUser;
103114
cell.usersType = UsersTypeTweetLikers;
115+
116+
cell.userIconView.layer.borderWidth = [_curTweet rewardedBy:curUser]? 1.0: 0;
104117
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:60];
105118
return cell;
106119
}
@@ -111,7 +124,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
111124

112125
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
113126
[tableView deselectRowAtIndexPath:indexPath animated:YES];
114-
User *user = [_curTweet.like_users objectAtIndex:indexPath.row];
127+
User *user = [_like_reward_users objectAtIndex:indexPath.row];
115128
UserInfoViewController *vc = [[UserInfoViewController alloc] init];
116129
vc.curUser = user;
117130
[self.navigationController pushViewController:vc animated:YES];

Coding_iOS/Models/Tweet.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@
5555
- (NSString *)toDoCommentPath;
5656
- (NSDictionary *)toDoCommentParams;
5757

58+
- (NSString *)toLikesAndRewardsPath;
59+
- (NSDictionary *)toLikesAndRewardsParams;
60+
5861
- (NSString *)toLikersPath;
5962
- (NSDictionary *)toLikersParams;
6063

Coding_iOS/Models/Tweet.m

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@ - (BOOL)hasMoreComments{
8484
}
8585

8686
- (NSArray *)like_reward_users{
87-
if (_reward_users.count > 0) {
88-
NSLog(@"_reward_users.count > 0");
89-
}
9087
NSMutableArray *like_reward_users = _like_users.count > 0? _like_users.mutableCopy: @[].mutableCopy;//点赞的人多,用点赞的人列表做基
9188
[_reward_users enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(User *obj, NSUInteger idx, BOOL *stop) {
9289
__block NSInteger originalIndex = NSNotFound;
@@ -134,6 +131,16 @@ - (NSString *)toDoCommentPath{
134131
- (NSDictionary *)toDoCommentParams{
135132
return @{@"content" : [self.nextCommentStr aliasedString]};
136133
}
134+
135+
136+
- (NSString *)toLikesAndRewardsPath{
137+
return [NSString stringWithFormat:@"api/tweet/%d/allLikesAndRewards", _id.intValue];
138+
}
139+
- (NSDictionary *)toLikesAndRewardsParams{
140+
return @{@"page" : [NSNumber numberWithInteger:1],
141+
@"pageSize" : [NSNumber numberWithInteger:500]};
142+
}
143+
137144
- (NSString *)toLikersPath{
138145
return [NSString stringWithFormat:@"api/tweet/%d/likes", _id.intValue];
139146
}

Coding_iOS/Util/Manager/Coding_NetAPIManager.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ typedef NS_ENUM(NSUInteger, VerifyType){
162162
- (void)request_Tweet_DoComment_WithObj:(Tweet *)tweet andBlock:(void (^)(id data, NSError *error))block;
163163
- (void)request_Tweet_DoTweet_WithObj:(Tweet *)tweet andBlock:(void (^)(id data, NSError *error))block;
164164
- (void)request_Tweet_Likers_WithObj:(Tweet *)tweet andBlock:(void (^)(id data, NSError *error))block;
165+
- (void)request_Tweet_LikesAndRewards_WithObj:(Tweet *)tweet andBlock:(void (^)(id data, NSError *error))block;
165166
- (void)request_Tweet_Comments_WithObj:(Tweet *)tweet andBlock:(void (^)(id data, NSError *error))block;
166167
- (void)request_Tweet_Delete_WithObj:(Tweet *)tweet andBlock:(void (^)(id data, NSError *error))block;
167168
- (void)request_TweetComment_Delete_WithTweet:(Tweet *)tweet andComment:(Comment *)comment andBlock:(void (^)(id data, NSError *error))block;

Coding_iOS/Util/Manager/Coding_NetAPIManager.m

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,6 +1554,20 @@ - (void)request_Tweet_Likers_WithObj:(Tweet *)tweet andBlock:(void (^)(id data,
15541554
}
15551555
}];
15561556
}
1557+
- (void)request_Tweet_LikesAndRewards_WithObj:(Tweet *)tweet andBlock:(void (^)(id data, NSError *error))block{
1558+
tweet.isLoading = YES;
1559+
[[CodingNetAPIClient sharedJsonClient] requestJsonDataWithPath:[tweet toLikesAndRewardsPath] withParams:[tweet toLikesAndRewardsParams] withMethodType:Get andBlock:^(id data, NSError *error) {
1560+
tweet.isLoading = NO;
1561+
if (data) {
1562+
[MobClick event:kUmeng_Event_Request_Get label:@"冒泡_赞赏的人_列表"];
1563+
1564+
id resultData = [data valueForKeyPath:@"data"];
1565+
block(resultData, nil);
1566+
}else{
1567+
block(nil, error);
1568+
}
1569+
}];
1570+
}
15571571
- (void)request_Tweet_Comments_WithObj:(Tweet *)tweet andBlock:(void (^)(id data, NSError *error))block{
15581572
tweet.isLoading = YES;
15591573
[[CodingNetAPIClient sharedJsonClient] requestJsonDataWithPath:[tweet toCommentsPath] withParams:[tweet toCommentsParams] withMethodType:Get andBlock:^(id data, NSError *error) {

Coding_iOS/Views/Cell/UserCell.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#import "Users.h"
1414

1515
@interface UserCell : UITableViewCell
16+
@property (strong, nonatomic) UIImageView *userIconView;
17+
1618
@property (strong, nonatomic) User *curUser;
1719
@property (assign, nonatomic) UsersType usersType;
1820
@property (nonatomic,copy) void(^leftBtnClickedBlock)(User *curUser);

Coding_iOS/Views/Cell/UserCell.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#import "Coding_NetAPIManager.h"
1111

1212
@interface UserCell ()
13-
@property (strong, nonatomic) UIImageView *userIconView;
1413
@property (strong, nonatomic) UILabel *userNameLabel;
1514
@property (strong, nonatomic) UIButton *rightBtn;
1615
@property (strong, nonatomic) UIActivityIndicatorView *sendingStatus;

Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,4 @@ SPEC CHECKSUMS:
128128
UMengAnalytics: 092c24aef47b6ac3c76ad51543f91156a8d7b645
129129
UMengSocial: 85882abe5b20aa38ad558ece71360e16b5d50909
130130

131-
COCOAPODS: 0.38.2
131+
COCOAPODS: 0.39.0

0 commit comments

Comments
 (0)