动态分享举报点击查看图片

This commit is contained in:
fengshuo
2022-06-27 20:04:54 +08:00
parent 1a13c09723
commit 37d4f2a4e2
29 changed files with 559 additions and 47 deletions

View File

@@ -953,6 +953,8 @@
E8F1558D28124D5200EE8C06 /* MessageConentAudioView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8F1558C28124D5200EE8C06 /* MessageConentAudioView.m */; };
E8F1559028125E2D00EE8C06 /* MessageAudioCenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E8F1558F28125E2D00EE8C06 /* MessageAudioCenter.m */; };
E8F1559328129EBA00EE8C06 /* ContentSecretaryModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8F1559228129EBA00EE8C06 /* ContentSecretaryModel.m */; };
E8F65C1F286998C9009BB5B9 /* XPMineShareViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8F65C1E286998C9009BB5B9 /* XPMineShareViewController.m */; };
E8F65C222869A36F009BB5B9 /* ContentShareMonentsModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8F65C212869A36F009BB5B9 /* ContentShareMonentsModel.m */; };
E8F9168427EC913C00F10D8F /* XPHomeLittleGameViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8F9168327EC913C00F10D8F /* XPHomeLittleGameViewController.m */; };
E8F9168727EC927C00F10D8F /* XPHomeLittleGamePesenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E8F9168627EC927C00F10D8F /* XPHomeLittleGamePesenter.m */; };
E8F9168B27EC940E00F10D8F /* XPHomeLittleGameTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E8F9168A27EC940E00F10D8F /* XPHomeLittleGameTableViewCell.m */; };
@@ -2873,6 +2875,10 @@
E8F1558F28125E2D00EE8C06 /* MessageAudioCenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessageAudioCenter.m; sourceTree = "<group>"; };
E8F1559128129EBA00EE8C06 /* ContentSecretaryModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ContentSecretaryModel.h; sourceTree = "<group>"; };
E8F1559228129EBA00EE8C06 /* ContentSecretaryModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ContentSecretaryModel.m; sourceTree = "<group>"; };
E8F65C1D286998C9009BB5B9 /* XPMineShareViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineShareViewController.h; sourceTree = "<group>"; };
E8F65C1E286998C9009BB5B9 /* XPMineShareViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineShareViewController.m; sourceTree = "<group>"; };
E8F65C202869A36F009BB5B9 /* ContentShareMonentsModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ContentShareMonentsModel.h; sourceTree = "<group>"; };
E8F65C212869A36F009BB5B9 /* ContentShareMonentsModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ContentShareMonentsModel.m; sourceTree = "<group>"; };
E8F9168227EC913C00F10D8F /* XPHomeLittleGameViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeLittleGameViewController.h; sourceTree = "<group>"; };
E8F9168327EC913C00F10D8F /* XPHomeLittleGameViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPHomeLittleGameViewController.m; sourceTree = "<group>"; };
E8F9168527EC927C00F10D8F /* XPHomeLittleGamePesenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeLittleGamePesenter.h; sourceTree = "<group>"; };
@@ -5307,6 +5313,8 @@
E86507E7281A8212006951B0 /* ContentTweetModel.m */,
E86E79CE28A4E0B2006DAF48 /* ContentRistAlertModel.h */,
E86E79CF28A4E0B2006DAF48 /* ContentRistAlertModel.m */,
E8F65C202869A36F009BB5B9 /* ContentShareMonentsModel.h */,
E8F65C212869A36F009BB5B9 /* ContentShareMonentsModel.m */,
);
path = SessionContent;
sourceTree = "<group>";
@@ -6075,6 +6083,8 @@
E896EFA12771AE9400AD2CC1 /* XPMineFriendViewController.m */,
E84CBCDF28436D3C00D43221 /* XPMineContactViewController.h */,
E84CBCE028436D3C00D43221 /* XPMineContactViewController.m */,
E8F65C1D286998C9009BB5B9 /* XPMineShareViewController.h */,
E8F65C1E286998C9009BB5B9 /* XPMineShareViewController.m */,
E84CBCE2284372D800D43221 /* XPRoomHalfMessageView.h */,
E84CBCE3284372D800D43221 /* XPRoomHalfMessageView.m */,
E8DAC5AA2858305A00012CFD /* XPRoomMessageBubbleView.h */,
@@ -7844,6 +7854,7 @@
E8751E6628A6465A0056EF44 /* XPSailingRankSubView.m in Sources */,
E86B911E2810351A0007DEE7 /* MessageToolMenuCollectionViewCell.m in Sources */,
9B2EA7C32804052E00ED17BF /* AnchorPKMicroView.m in Sources */,
E8F65C1F286998C9009BB5B9 /* XPMineShareViewController.m in Sources */,
181D7F1B2726CE2A00B7C059 /* StageView.m in Sources */,
18EE3FF12750D2AD00A452BF /* NIMTimeUtils.m in Sources */,
E8ACEFEF27C8C45100F66D1A /* XPHomeHapppyRoomTableViewCell.m in Sources */,
@@ -8226,6 +8237,7 @@
E8DEC99E2764A5B60078CB70 /* XPRoomMoreMenuViewController.m in Sources */,
E82325F2274E2DE6003A3332 /* XPUserCardViewController.m in Sources */,
E8E859D228264C2300EE4857 /* HTTPServer.m in Sources */,
E8F65C222869A36F009BB5B9 /* ContentShareMonentsModel.m in Sources */,
E8C167182806A03800ECB15C /* XPSuperAdminSetPresenter.m in Sources */,
9B6E856E281AABAB0041A321 /* XPRoomRecommendModel.m in Sources */,
E801274B27E327DA00BAC3F2 /* XPRoomPKTypeTableViewCell.m in Sources */,

View File

@@ -34,6 +34,13 @@ typedef NS_ENUM(NSUInteger, ShareType) {
@property (nonatomic,assign) NSInteger shareType;
///分享房间的uid
@property (nonatomic,assign) NSInteger roomUid;
#pragma mark - 动态分享
///被分享动态的那个人
@property (nonatomic,copy) NSString *uid;
///动态分享
@property (nonatomic,copy) NSString *dynamicId;
///话题id
@property (nonatomic,copy) NSString *worldId;
@end

View File

@@ -14,8 +14,11 @@
///Tool
#import "XPMacro.h"
#import "ThemeColor.h"
#import "XCCurrentVCStackManager.h"
#import "TTPopup.h"
///View
#import "XPShareItemCell.h"
#import "XPMineShareViewController.h"
@interface XPShareView()<UICollectionViewDataSource,UICollectionViewDelegate>
///
@@ -110,13 +113,25 @@
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
XPShareItemCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPShareItemCell class]) forIndexPath:indexPath];
XPShareItem * item = [self.items objectAtIndex:indexPath.item];
item.disable = [self isInstallClient:[self getSharePlatformType:item.type]];
if (item.type == XPShareItemTagAppFriends) {
item.disable = YES;
} else {
item.disable = [self isInstallClient:[self getSharePlatformType:item.type]];
}
cell.shareItem = item;
return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
[collectionView deselectItemAtIndexPath:indexPath animated:YES];
XPShareItem * item = [self.items objectAtIndex:indexPath.item];
if (item.type == XPShareItemTagAppFriends) {
[TTPopup dismiss];
XPMineShareViewController * shareVC = [[XPMineShareViewController alloc] init];
shareVC.shareType = MineShareType_Monents;
shareVC.shareInfo = self.shareInfo;
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:shareVC animated:YES];
return;
}
self.shareInfo.shareType = item.type;
NSMutableDictionary *shareParams = [NSMutableDictionary dictionary];
NSString * title = [self.shareInfo shareTitle].length > 0 ? self.shareInfo.shareTitle : @"";

View File

@@ -73,5 +73,13 @@ typedef NS_ENUM(NSInteger, RoomPKResultType) {
RoomPKResultType_Red = 2, //红方胜
};
typedef NS_ENUM(NSInteger, ContactUseingType) {
///默认
ContactUseingType_Normal = 0,
///在房间内
ContactUseingType_In_Room = 1,
///分享
ContactUseingType_Share = 2,
};
#endif /* XPEnum_h */

View File

@@ -77,7 +77,9 @@ typedef NS_ENUM(NSUInteger, URLType) {
///活动地址
kSailingActivityURL,
///网络整治乱象
kNetworkRenovateURL
kNetworkRenovateURL,
///动态分享
kMonentsShareURL,
};
NSString * const URLWithType(URLType type);

View File

@@ -50,7 +50,8 @@ NSString * const URLWithType(URLType type) {
@(kSailingActivityURL) : @"activity/act-sail/more.html", ///
@(kSailingPlayDescdURL) : @"activity/act-sail/play_explain.html", ///
@(kSailingRecordURL) : @"activity/act-sail/win_record.html", ///
@(kNetworkRenovateURL) : @"activity/activemodel/index.html?code=ZBGG"///
@(kNetworkRenovateURL) : @"activity/activemodel/index.html?code=ZBGG",///
@(kMonentsShareURL) : @"modules/world/share-page/index.html",///
};
NSString * url = [dic objectForKey:@(type)];

View File

@@ -0,0 +1,27 @@
//
// ContentShareMonentsModel.h
// xplan-ios
//
// Created by 冯硕 on 2022/6/27.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface ContentShareMonentsModel : NSObject
///动态内容
@property (nonatomic,copy) NSString *content;
///动态id
@property (nonatomic,copy) NSString *dynamicId;
///头像
@property (nonatomic,copy) NSString *avatar;
///标题
@property (nonatomic,copy) NSString *title;
///跳转类型
@property (nonatomic,assign) NSInteger routerType;
///跳转的id
@property (nonatomic,copy) NSString *routerValue;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,12 @@
//
// ContentShareMonentsModel.m
// xplan-ios
//
// Created by on 2022/6/27.
//
#import "ContentShareMonentsModel.h"
@implementation ContentShareMonentsModel
@end

View File

@@ -35,7 +35,7 @@ NS_ASSUME_NONNULL_BEGIN
///贵族信息
@property (nonatomic, strong) UserVipInfoVo *userVipInfoVO;
///是否在房间中 本地字段
@property (nonatomic,assign) BOOL isInRoom;
@property (nonatomic,assign) ContactUseingType useingType;
@end

View File

@@ -113,7 +113,7 @@
self.avatarImageView.imageUrl = _fansInfo.avatar;
self.nickLabel.text = _fansInfo.nick;
self.signLabel.text = _fansInfo.userDesc && _fansInfo.userDesc.length > 0? _fansInfo.userDesc : @"这个人很懒还没有签名";
if (!_fansInfo.isInRoom) {
if (_fansInfo.useingType != ContactUseingType_In_Room && _fansInfo.useingType != ContactUseingType_Share) {
self.experImageView.hidden = NO;
self.charmImageView.hidden = NO;
self.nobleImageView.hidden = NO;

View File

@@ -115,7 +115,7 @@
self.nickLabel.text = _fansInfo.nick;
self.signLabel.text = _fansInfo.userDesc && _fansInfo.userDesc.length > 0? _fansInfo.userDesc : @"这个人很懒还没有签名";
if (!_fansInfo.isInRoom) {
if (_fansInfo.useingType != ContactUseingType_In_Room && _fansInfo.useingType != ContactUseingType_Share) {
self.experImageView.hidden = NO;
self.charmImageView.hidden = NO;
self.nobleImageView.hidden = NO;
@@ -135,7 +135,7 @@
BOOL isMyFriend = [[NIMSDK sharedSDK].userManager isMyFriend:_fansInfo.uid];
self.attentionButton.enabled = !isMyFriend;
self.attentionButton.hidden = _fansInfo.isInRoom;
self.attentionButton.hidden = NO;
UIImage* image = self.experImageView.image;
if (image) {
CGFloat scale = image.size.width / image.size.height;

View File

@@ -7,11 +7,20 @@
#import "MvpViewController.h"
#import <JXCategoryView/JXCategoryListContainerView.h>
#import "XPEnum.h"
NS_ASSUME_NONNULL_BEGIN
@class XPMineAttentionViewController, FansInfoModel;
@protocol XPMineAttentionViewControllerDelegate <NSObject>
- (void)xPMineAttentionViewController:(XPMineAttentionViewController *)viewController didSelectItem:(FansInfoModel *)userInfo;
@end
@interface XPMineAttentionViewController : MvpViewController<JXCategoryListContentViewDelegate>
//是否在房间内
@property (nonatomic,assign) BOOL isInRoom;
///类型
@property (nonatomic,assign) ContactUseingType type;
///代理
@property (nonatomic,weak) id<XPMineAttentionViewControllerDelegate> delegate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -43,7 +43,7 @@
@implementation XPMineAttentionViewController
- (BOOL)isHiddenNavBar {
return self.isInRoom ? YES : NO;
return self.type == ContactUseingType_In_Room ? YES : NO;
}
- (XPMineAttentionPresenter *)createPresenter {
@@ -132,7 +132,7 @@
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return self.datasource.count > 0 ? 65 : self.isInRoom ? (KScreenHeight - kNavigationHeight) : (KScreenHeight - 200 - kNavigationHeight);
return self.datasource.count > 0 ? 65 : self.type == ContactUseingType_In_Room ? (KScreenHeight - kNavigationHeight) : (KScreenHeight - 200 - kNavigationHeight);
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
@@ -143,7 +143,7 @@
}
cell.delegate = self;
FansInfoModel * fansInfo = [self.datasource objectAtIndex:indexPath.row];
fansInfo.isInRoom = self.isInRoom;
fansInfo.useingType = self.type;
cell.fansInfo = fansInfo;
return cell;
}
@@ -159,15 +159,17 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if (self.datasource.count > 0) {
if (self.isInRoom) {
FansInfoModel * fansInfoModel = [self.datasource objectAtIndex:indexPath.row];
FansInfoModel * fansInfoModel = [self.datasource objectAtIndex:indexPath.row];
if (self.type == ContactUseingType_In_Room) {
SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:[NIMSession session:fansInfoModel.uid type:NIMSessionTypeP2P]];
sessionVC.openType = SessionListOpenTypeRoom;
[self.navigationController pushViewController:sessionVC animated:YES];
} else if(self.type == ContactUseingType_Share){
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineAttentionViewController:didSelectItem:)]) {
[self.delegate xPMineAttentionViewController:self didSelectItem:fansInfoModel];
}
} else {
XPMineUserInfoViewController * userInfoVC = [[XPMineUserInfoViewController alloc] init];
FansInfoModel * fansInfoModel = [self.datasource objectAtIndex:indexPath.row];
fansInfoModel.isInRoom = self.isInRoom;
userInfoVC.uid = fansInfoModel.uid.integerValue;
[self.navigationController pushViewController:userInfoVC animated:YES];
}

View File

@@ -146,7 +146,7 @@
- (XPMineAttentionViewController *)attentionVC {
if (!_attentionVC) {
_attentionVC = [[XPMineAttentionViewController alloc] init];
_attentionVC.isInRoom = YES;
_attentionVC.type = ContactUseingType_In_Room;
}
return _attentionVC;
}
@@ -154,7 +154,7 @@
- (XPMineFriendViewController *)friendVC {
if (!_friendVC) {
_friendVC = [[XPMineFriendViewController alloc] init];
_friendVC.isInRoom = YES;
_friendVC.type = ContactUseingType_In_Room;
}
return _friendVC;
}
@@ -162,7 +162,7 @@
- (XPMineFansViewController *)fansVC {
if (!_fansVC) {
_fansVC = [[XPMineFansViewController alloc] init];
_fansVC.isInRoom = YES;
_fansVC.type = ContactUseingType_In_Room;
}
return _fansVC;
}

View File

@@ -7,11 +7,21 @@
#import "MvpViewController.h"
#import <JXCategoryView/JXCategoryListContainerView.h>
#import "XPEnum.h"
NS_ASSUME_NONNULL_BEGIN
@class XPMineFansViewController, FansInfoModel;
@protocol XPMineFansViewControllerDelegate <NSObject>
- (void)xPMineFansViewController:(XPMineFansViewController *)view didSelectItem:(FansInfoModel *)userInfo;
@end
@interface XPMineFansViewController : MvpViewController<JXCategoryListContentViewDelegate>
///是否在房间内
@property (nonatomic,assign) BOOL isInRoom;
///类型
@property (nonatomic,assign) ContactUseingType type;
///代理
@property (nonatomic,weak) id<XPMineFansViewControllerDelegate> delegate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -38,7 +38,7 @@
@implementation XPMineFansViewController
- (BOOL)isHiddenNavBar {
return self.isInRoom ? YES : NO;
return self.type == ContactUseingType_In_Room ? YES : NO;
}
- (XPMineFansPresenter *)createPresenter {
@@ -142,7 +142,7 @@
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return self.datasource.count > 0 ? 65 : self.isInRoom ? (KScreenHeight - kNavigationHeight) : (KScreenHeight - 200 - kNavigationHeight);
return self.datasource.count > 0 ? 65 : self.type == ContactUseingType_In_Room ? (KScreenHeight - kNavigationHeight) : (KScreenHeight - 200 - kNavigationHeight);
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
@@ -153,7 +153,7 @@
}
cell.delegate = self;
FansInfoModel * fansInfo = [self.datasource objectAtIndex:indexPath.row];
fansInfo.isInRoom = self.isInRoom;
fansInfo.useingType = self.type;
cell.fansInfo = fansInfo;
return cell;
}
@@ -169,14 +169,17 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if (self.datasource.count > 0) {
if (self.isInRoom) {
FansInfoModel * fansInfoModel = [self.datasource objectAtIndex:indexPath.row];
FansInfoModel * fansInfoModel = [self.datasource objectAtIndex:indexPath.row];
if (self.type == ContactUseingType_In_Room) {
SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:[NIMSession session:fansInfoModel.uid type:NIMSessionTypeP2P]];
sessionVC.openType = SessionListOpenTypeRoom;
[self.navigationController pushViewController:sessionVC animated:YES];
} else if(self.type == ContactUseingType_Share) {
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineFansViewController:didSelectItem:)]) {
[self.delegate xPMineFansViewController:self didSelectItem:fansInfoModel];
}
} else {
XPMineUserInfoViewController * userInfoVC = [[XPMineUserInfoViewController alloc] init];
FansInfoModel * fansInfoModel = [self.datasource objectAtIndex:indexPath.row];
userInfoVC.uid = fansInfoModel.uid.integerValue;
[self.navigationController pushViewController:userInfoVC animated:YES];
}

View File

@@ -7,11 +7,19 @@
#import "MvpViewController.h"
#import <JXCategoryView/JXCategoryListContainerView.h>
#import "XPEnum.h"
NS_ASSUME_NONNULL_BEGIN
@class XPMineFriendViewController, UserInfoModel;
@protocol XPMineFriendViewControllerDelegate <NSObject>
- (void)xPMineFriendViewController:(XPMineFriendViewController *)viewController didSelectItem:(UserInfoModel *)userInfo;
@end
@interface XPMineFriendViewController : MvpViewController<JXCategoryListContentViewDelegate>
//是否在房间内
@property (nonatomic,assign) BOOL isInRoom;
///类型
@property (nonatomic,assign) ContactUseingType type;
///代理
@property (nonatomic,weak) id<XPMineFriendViewControllerDelegate> delegate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -41,7 +41,7 @@
}
- (BOOL)isHiddenNavBar {
return self.isInRoom ? YES : NO;
return self.type == ContactUseingType_In_Room ? YES : NO;
}
- (void)viewDidLoad {
@@ -74,7 +74,7 @@
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return self.datasource.count > 0 ? 65 : self.isInRoom ? (KScreenHeight - kNavigationHeight) : (KScreenHeight - 200 - kNavigationHeight);
return self.datasource.count > 0 ? 65 : self.type == ContactUseingType_In_Room ? (KScreenHeight - kNavigationHeight) : (KScreenHeight - 200 - kNavigationHeight);
}
@@ -100,9 +100,15 @@
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if (self.datasource.count > 0) {
UserInfoModel * userInfo = [self.datasource objectAtIndex:indexPath.row];
SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:[NIMSession session:[NSString stringWithFormat:@"%ld", userInfo.uid] type:NIMSessionTypeP2P]];
sessionVC.openType = SessionListOpenTypeRoom;
[self.navigationController pushViewController:sessionVC animated:YES];
if (self.type == ContactUseingType_Share) {
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineFriendViewController:didSelectItem:)]) {
[self.delegate xPMineFriendViewController:self didSelectItem:userInfo];
}
} else {
SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:[NIMSession session:[NSString stringWithFormat:@"%ld", userInfo.uid] type:NIMSessionTypeP2P]];
sessionVC.openType = SessionListOpenTypeRoom;
[self.navigationController pushViewController:sessionVC animated:YES];
}
}
}

View File

@@ -0,0 +1,24 @@
//
// XPMineShareViewController.h
// xplan-ios
//
// Created by 冯硕 on 2022/6/27.
//
#import "BaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@class XPShareInfoModel;
typedef NS_ENUM(NSInteger, MineShareType) {
///分享动态
MineShareType_Monents = 1,
};
@interface XPMineShareViewController : BaseViewController
@property (nonatomic,strong) XPShareInfoModel *shareInfo;
///分享的类型
@property (nonatomic,assign) MineShareType shareType;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,224 @@
//
// XPMineShareViewController.m
// xplan-ios
//
// Created by on 2022/6/27.
//
#import "XPMineShareViewController.h"
///Third
#import <Masonry/Masonry.h>
#import <NIMSDK/NIMSDK.h>
#import <JXCategoryView/JXCategoryView.h>
#import <JXCategoryView/JXCategoryListContainerView.h>
///Tool
#import "ThemeColor.h"
#import "XPMacro.h"
#import "TTPopup.h"
///Model
#import "XPShareInfoModel.h"
#import "FansInfoModel.h"
#import "UserInfoModel.h"
#import "AttachMentModel.h"
#import "ContentShareMonentsModel.h"
///View
#import "SessionViewController.h"
#import "SessionListViewController.h"
#import "XPMineFriendViewController.h"
#import "XPMineAttentionViewController.h"
#import "XPMineFansViewController.h"
@interface XPMineShareViewController ()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate, XPMineAttentionViewControllerDelegate, XPMineFansViewControllerDelegate, XPMineFriendViewControllerDelegate>
///
@property (nonatomic,strong) NSArray<NSString *> *titles;
///
@property (nonatomic,strong) JXCategoryTitleView *titleView;
@property (nonatomic, strong) JXCategoryListContainerView *listContainerView;
///
@property (nonatomic,strong) XPMineFriendViewController *friendVC;
///
@property (nonatomic,strong) XPMineAttentionViewController *attentionVC;
///
@property (nonatomic,strong) XPMineFansViewController *fansVC;
///id
@property (nonatomic,copy) NSString *sessionId;
@end
@implementation XPMineShareViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self initSubViews];
[self initSubViewConstraints];
}
#pragma mark - Private Method
- (void)initSubViews {
self.title = @"选择好友";
[self.view addSubview:self.titleView];
[self.view addSubview:self.listContainerView];
}
- (void)initSubViewConstraints {
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.mas_equalTo(self.view);
make.height.mas_equalTo(50);
}];
[self.listContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.mas_equalTo(self.view);
make.top.mas_equalTo(self.titleView.mas_bottom);
}];
}
- (void)sendCustomMessage:(AttachmentModel *)attachment {
NIMMessage *message = [[NIMMessage alloc]init];
NIMCustomObject *object = [[NIMCustomObject alloc] init];
object.attachment = attachment;
message.messageObject = object;
NIMSessionType sessionType = NIMSessionTypeP2P;
//
NIMSession *session = [NIMSession session:self.sessionId type:sessionType];
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil];
}
- (void)shareToUser:(NSString *)nick {
NSString * title;
AttachmentModel * attachment = [[AttachmentModel alloc] init];
switch (self.shareType) {
case MineShareType_Monents:
{
title = [NSString stringWithFormat:@"确认分享给%@吗?", nick];
attachment.first = CustomMessageType_Monents;
attachment.second = Custom_Message_Sub_Monents_Share;
ContentShareMonentsModel * shareInfo = [[ContentShareMonentsModel alloc] init];
shareInfo.avatar = self.shareInfo.shareImageUrl;
shareInfo.title = self.shareInfo.shareTitle;
shareInfo.content = self.shareInfo.shareContent;
shareInfo.routerValue = self.shareInfo.dynamicId;
shareInfo.routerType = 50;
attachment.data = shareInfo.model2dictionary;
}
break;
default:
break;
}
if (title.length > 0) {
[TTPopup alertWithMessage:title confirmHandler:^{
[self sendCustomMessage:attachment];
} cancelHandler:^{
}];
}
}
#pragma mark - JXCategoryListContainerViewDelegate
- (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView {
return self.titles.count;
}
// index `JXCategoryListContentViewDelegate`
- (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index {
if (index == 0) {
return self.friendVC;
} else if(index == 1) {
return self.fansVC;
} else {
return self.attentionVC;
}
}
#pragma mark - XPMineAttentionViewControllerDelegate
///
- (void)xPMineAttentionViewController:(XPMineAttentionViewController *)viewController didSelectItem:(FansInfoModel *)userInfo {
self.sessionId = userInfo.uid;
[self shareToUser:userInfo.nick];
}
#pragma mark - XPMineFansViewControllerDelegate
///
- (void)xPMineFansViewController:(XPMineFansViewController *)view didSelectItem:(FansInfoModel *)userInfo {
self.sessionId = userInfo.uid;
[self shareToUser:userInfo.nick];
}
#pragma mark - XPMineFriendViewControllerDelegate
///
- (void)xPMineFriendViewController:(XPMineFriendViewController *)viewController didSelectItem:(UserInfoModel *)userInfo {
self.sessionId = [NSString stringWithFormat:@"%ld", userInfo.uid];
[self shareToUser:userInfo.nick];
}
#pragma mark - Getters And Setters
- (JXCategoryListContainerView *)listContainerView {
if (!_listContainerView) {
_listContainerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self];
_listContainerView.listCellBackgroundColor = [UIColor clearColor];
}
return _listContainerView;
}
- (NSArray<NSString *> *)titles {
if (!_titles) {
_titles = @[@"好友",@"粉丝", @"关注"];
}
return _titles;
}
- (JXCategoryTitleView *)titleView {
if (!_titleView) {
_titleView = [[JXCategoryTitleView alloc] initWithFrame:CGRectZero];
_titleView.backgroundColor =[UIColor clearColor];
_titleView.titleColor = UIColorFromRGB(0x444444);
_titleView.titleSelectedColor = [ThemeColor mainTextColor];
_titleView.titleFont = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
_titleView.titleSelectedFont = [UIFont systemFontOfSize:18 weight:UIFontWeightHeavy];
_titleView.titleLabelAnchorPointStyle = JXCategoryTitleLabelAnchorPointStyleCenter;
_titleView.contentScrollViewClickTransitionAnimationEnabled = NO;
_titleView.averageCellSpacingEnabled = NO;
_titleView.defaultSelectedIndex = 0;
_titleView.titles = self.titles;
_titleView.delegate = self;
_titleView.cellSpacing = 0;
_titleView.cellWidth = (CGFloat)KScreenWidth/ 3.0;
_titleView.listContainer = self.listContainerView;
JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init];
lineView.indicatorColor = [ThemeColor appMainColor];
lineView.indicatorWidth = 8.f;
lineView.indicatorHeight = 4.f;
lineView.indicatorCornerRadius = 2.f;
_titleView.indicators = @[lineView];
}
return _titleView;
}
- (XPMineAttentionViewController *)attentionVC {
if (!_attentionVC) {
_attentionVC = [[XPMineAttentionViewController alloc] init];
_attentionVC.type = ContactUseingType_Share;
_attentionVC.delegate = self;
}
return _attentionVC;
}
- (XPMineFriendViewController *)friendVC {
if (!_friendVC) {
_friendVC = [[XPMineFriendViewController alloc] init];
_friendVC.type = ContactUseingType_Share;
_friendVC.delegate = self;
}
return _friendVC;
}
- (XPMineFansViewController *)fansVC {
if (!_fansVC) {
_fansVC = [[XPMineFansViewController alloc] init];
_fansVC.type = ContactUseingType_Share;
_fansVC.delegate = self;
}
return _fansVC;
}
@end

View File

@@ -37,7 +37,7 @@ typedef NS_ENUM(NSInteger, MonentsContentType) {
///喜欢的次数
@property (nonatomic,copy) NSString *likeCount;
///我是否已经点赞
@property (nonatomic, assign) BOOL like;
@property (nonatomic, assign) BOOL isLike;
///评论的次数
@property (nonatomic,copy) NSString *commentCount;
//发布时间

View File

@@ -13,6 +13,7 @@
#import "ThemeColor.h"
#import "NetImageView.h"
#import "XPMonentsLayoutConfig.h"
#import "SDPhotoBrowser.h"
///Model
#import "MonentsInfoModel.h"
///View
@@ -22,7 +23,7 @@
#import "XPMoentsTopicView.h"
#import "XPMonentsContentView.h"
#import "XPMonentsLayoutConfig.h"
@interface XPMonentsTableViewCell ()<XPMonentsTooBarViewDelegate, XPMonentsTooBarViewDelegate>
@interface XPMonentsTableViewCell ()<XPMonentsTooBarViewDelegate, XPMonentsTooBarViewDelegate, XPMonentsPhotoViewDelegate, SDPhotoBrowserDelegate>
/// stackView
@property (nonatomic,strong) UIView * backView;
///
@@ -98,6 +99,28 @@
}
}
#pragma mark - SDPhotoBrowserDelegate
- (NSURL *)photoBrowser:(SDPhotoBrowser *)browser highQualityImageURLForIndex:(NSInteger)index {
MonentsPicInfoModel *picinfo = [self.monentsInfo.dynamicResList objectAtIndex:index];
return [NSURL URLWithString:picinfo.resUrl];
}
- (UIImage *)photoBrowser:(SDPhotoBrowser *)browser placeholderImageForIndex:(NSInteger)index {
return [UIImageConstant defalutBannerPlaceholder];
}
#pragma mark - XPMonentsPhotoViewDelegate
- (void)xPMonentsPhotoView:(XPMonentsPhotoView *)view didClickImage:(NSInteger)index {
NSInteger count = self.monentsInfo.dynamicResList.count;
SDPhotoBrowser *browser = [[SDPhotoBrowser alloc]init];
browser.sourceImagesContainerView = self;
browser.delegate = self;
browser.imageCount = count;
browser.currentImageIndex = index;
browser.isMe = NO;
[browser show];
}
#pragma mark - Getters And Setters
- (void)setMonentsInfo:(MonentsInfoModel *)monentsInfo {
_monentsInfo = monentsInfo;
@@ -145,6 +168,7 @@
- (XPMonentsPhotoView *)photoView {
if (!_photoView) {
_photoView = [[XPMonentsPhotoView alloc] init];
_photoView.delegate = self;
}
return _photoView;
}

View File

@@ -8,10 +8,18 @@
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class MonentsPicInfoModel;
@class MonentsPicInfoModel, XPMonentsPhotoView;
@protocol XPMonentsPhotoViewDelegate <NSObject>
- (void)xPMonentsPhotoView:(XPMonentsPhotoView *)view didClickImage:(NSInteger)index;
@end
@interface XPMonentsPhotoView : UIView
///发布的内容
@property (nonatomic,copy) NSArray<MonentsPicInfoModel *> *dynamicResList;
///代理
@property (nonatomic,weak) id<XPMonentsPhotoViewDelegate> delegate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -67,6 +67,15 @@
}];
}
#pragma mark - Event Response
- (void)tapImageView:(UITapGestureRecognizer *)tap {
NetImageView * imageView = (NetImageView *)tap.view;
if (imageView.imageUrl.length > 0 && self.delegate && [self.delegate respondsToSelector:@selector(xPMonentsPhotoView:didClickImage:)]) {
[self.delegate xPMonentsPhotoView:self didClickImage:imageView.tag - 1001];
}
}
#pragma mark - Getters And Setters
- (void)setDynamicResList:(NSArray<MonentsPicInfoModel *> *)dynamicResList {
_dynamicResList = dynamicResList;
@@ -136,6 +145,10 @@
_firstImageView.layer.masksToBounds = YES;
_firstImageView.layer.cornerRadius = 12;
_firstImageView.contentMode = UIViewContentModeScaleAspectFill;
_firstImageView.tag = 1000 + 1;
_firstImageView.userInteractionEnabled = YES;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
[_firstImageView addGestureRecognizer:tap];
}
return _firstImageView;
}
@@ -149,6 +162,10 @@
_secondImageView.layer.masksToBounds = YES;
_secondImageView.layer.cornerRadius = 12;
_secondImageView.contentMode = UIViewContentModeScaleAspectFill;
_secondImageView.tag = 1000 + 2;
_secondImageView.userInteractionEnabled = YES;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
[_secondImageView addGestureRecognizer:tap];
}
return _secondImageView;
}
@@ -162,6 +179,10 @@
_thirdImageView.layer.masksToBounds = YES;
_thirdImageView.layer.cornerRadius = 12;
_thirdImageView.contentMode = UIViewContentModeScaleAspectFill;
_thirdImageView.tag = 1000 + 3;
_thirdImageView.userInteractionEnabled = YES;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
[_thirdImageView addGestureRecognizer:tap];
}
return _thirdImageView;
}
@@ -176,6 +197,11 @@
_fourthImageView.layer.masksToBounds = YES;
_fourthImageView.layer.cornerRadius = 12;
_fourthImageView.contentMode = UIViewContentModeScaleAspectFill;
_fourthImageView.tag = 1000 + 4;
_fourthImageView.userInteractionEnabled = YES;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
[_fourthImageView addGestureRecognizer:tap];
}
return _fourthImageView;
}
@@ -189,6 +215,10 @@
_fifthImageView.layer.masksToBounds = YES;
_fifthImageView.layer.cornerRadius = 12;
_fifthImageView.contentMode = UIViewContentModeScaleAspectFill;
_fifthImageView.tag = 1000 + 5;
_fifthImageView.userInteractionEnabled = YES;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
[_fifthImageView addGestureRecognizer:tap];
}
return _fifthImageView;
}
@@ -203,6 +233,10 @@
_sixthImageView.layer.masksToBounds = YES;
_sixthImageView.layer.cornerRadius = 12;
_sixthImageView.contentMode = UIViewContentModeScaleAspectFill;
_sixthImageView.tag = 1000 + 6;
_sixthImageView.userInteractionEnabled = YES;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
[_sixthImageView addGestureRecognizer:tap];
}
return _sixthImageView;
}
@@ -217,6 +251,10 @@
_sevenImageView.layer.masksToBounds = YES;
_sevenImageView.layer.cornerRadius = 12;
_sevenImageView.contentMode = UIViewContentModeScaleAspectFill;
_sevenImageView.tag = 1000 + 7;
_sevenImageView.userInteractionEnabled = YES;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
[_sevenImageView addGestureRecognizer:tap];
}
return _sevenImageView;
}
@@ -231,6 +269,10 @@
_eighthImageView.layer.masksToBounds = YES;
_eighthImageView.layer.cornerRadius = 12;
_eighthImageView.contentMode = UIViewContentModeScaleAspectFill;
_eighthImageView.tag = 1000 + 8;
_eighthImageView.userInteractionEnabled = YES;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
[_eighthImageView addGestureRecognizer:tap];
}
return _eighthImageView;
}
@@ -245,6 +287,10 @@
_ninthImageView.layer.masksToBounds = YES;
_ninthImageView.layer.cornerRadius = 12;
_ninthImageView.contentMode = UIViewContentModeScaleAspectFill;
_ninthImageView.tag = 1000 + 9;
_ninthImageView.userInteractionEnabled = YES;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
[_ninthImageView addGestureRecognizer:tap];
}
return _ninthImageView;
}

View File

@@ -15,6 +15,10 @@
#import "XPShareView.h"
#import "XCHUDTool.h"
#import "XPMacro.h"
#import "ApiHost.h"
#import "XPHtmlUrl.h"
#import "AccountInfoStorage.h"
#import "Api+Monents.h"
///Model
#import "MonentsInfoModel.h"
///View
@@ -143,7 +147,7 @@
}
- (void)shareButtonAction:(UIButton *)sender {
XPShareItem *friend = [XPShareItem itemWitTag:XPShareItemTagMoments title:@"好友" imageName:@"share_wechat_circle_normal" disableImageName:@"share_wechat_circle_disable"];
XPShareItem *friend = [XPShareItem itemWitTag:XPShareItemTagAppFriends title:@"好友" imageName:@"share_friend" disableImageName:@"share_friend"];
XPShareItem *cycle = [XPShareItem itemWitTag:XPShareItemTagMoments title:@"朋友圈" imageName:@"share_wechat_circle_normal" disableImageName:@"share_wechat_circle_disable"];
XPShareItem *wechat = [XPShareItem itemWitTag:XPShareItemTagWeChat title:@"微信好友" imageName:@"share_wechat_normal" disableImageName:@"share_wechat_disable"];
XPShareItem *qq = [XPShareItem itemWitTag:XPShareItemTagQQ title:@"QQ好友" imageName:@"share_qq_normal" disableImageName:@"share_qq_disable"];
@@ -152,6 +156,19 @@
CGFloat margin = 15;
CGSize itemSize = CGSizeMake((KScreenWidth-2*margin)/4, 65);
XPShareInfoModel * shareInfo = [[XPShareInfoModel alloc] init];
NSString * title= self.monentsInfo.nick;
if (self.monentsInfo.nick.length > 6) {
title = [title substringToIndex:6];
}
shareInfo.shareTitle = [NSString stringWithFormat:@"%@发布了一条动态", title];
shareInfo.shareContent = self.monentsInfo.content;
shareInfo.shareImageUrl = self.monentsInfo.avatar;
NSString * uid = [AccountInfoStorage instance].getUid;
NSString *urlStr = [NSString stringWithFormat:@"%@/%@?uid=%@&dynamicId=%@&worldId=%ld",API_HOST_URL, URLWithType(kMonentsShareURL), uid, self.monentsInfo.dynamicId, self.monentsInfo.worldId];
shareInfo.shareUrl = urlStr;
shareInfo.dynamicId = self.monentsInfo.dynamicId;
shareInfo.uid = self.monentsInfo.uid;
shareInfo.worldId = [NSString stringWithFormat:@"%ld", self.monentsInfo.worldId];
XPShareView *shareView = [[XPShareView alloc] initWithItems:items itemSize:itemSize shareInfo:shareInfo];
shareView.delegate = self;
[TTPopup popupView:shareView style:TTPopupStyleActionSheet];
@@ -164,6 +181,9 @@
}
- (void)shareView:(XPShareView *)shareView didSuccess:(XPShareInfoModel *)shareInfo{
[Api userShareMonents:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
} dynamicId:shareInfo.dynamicId uid:shareInfo.uid worldId:shareInfo.worldId shareUid:[AccountInfoStorage instance].getUid];
[TTPopup dismiss];
}
@@ -175,7 +195,7 @@
- (void)setMonentsInfo:(MonentsInfoModel *)monentsInfo {
_monentsInfo = monentsInfo;
if (_monentsInfo) {
self.likeButton.selected = _monentsInfo.like;
self.likeButton.selected = _monentsInfo.isLike;
self.likeLabel.text = _monentsInfo.likeCount.length > 0 ? _monentsInfo.likeCount : @"0";
self.commentLabel.text = _monentsInfo.commentCount.length > 0 ? _monentsInfo.commentCount : @"0";
}

View File

@@ -22,7 +22,7 @@
#import "XPMonentsTableViewCell.h"
#import "XPMonentsEmptyTableViewCell.h"
@interface XPMonentsAttentionViewController ()<UITableViewDelegate, UITableViewDataSource,XPMonentsAttentionProtocol>
@interface XPMonentsAttentionViewController ()<UITableViewDelegate, UITableViewDataSource,XPMonentsAttentionProtocol, XPMonentsTableViewCellDelegate>
///
@property (nonatomic,strong) UITableView *tableView;
///
@@ -114,12 +114,18 @@
if (self.datasource.count > 0) {
XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
MonentsInfoModel * monentsInfo = [self.datasource objectAtIndex:indexPath.row];
cell.delegate = self;
cell.monentsInfo = monentsInfo;
return cell;
}
XPMonentsEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsEmptyTableViewCell class])];
return cell;
}
#pragma mark - XPMonentsTableViewCellDelegate
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClickLike:(MonentsInfoModel *)monentsInfo {
[self.presenter likeMonent:monentsInfo.dynamicId status:!monentsInfo.isLike likedUid:monentsInfo.uid worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
}
#pragma mark -JXCategoryListContainerViewDelegate
- (UIView *)listView {
return self.view;
@@ -157,6 +163,20 @@
}
}
- (void)likeMonentsSuccess:(NSString *)dynamicId status:(BOOL)status {
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj.dynamicId isEqualToString:dynamicId]) {
if (status) {
obj.isLike += 1;
} else {
obj.isLike -= 1;
}
*stop = YES;
}
}];
[self.tableView reloadData];
}
#pragma mark - Getters And Setters
- (UITableView *)tableView {
if (!_tableView) {

View File

@@ -23,7 +23,7 @@
#import "XPMonentDetailPresenter.h"
#import "XPMonentsDetailProtocol.h"
@interface XPMonentsDetailViewController ()<UITableViewDelegate, UITableViewDataSource, XPMonentsDetailProtocol, XPMonentsCommentTableViewCellDelegate>
@interface XPMonentsDetailViewController ()<UITableViewDelegate, UITableViewDataSource, XPMonentsDetailProtocol, XPMonentsCommentTableViewCellDelegate, XPMonentsTableViewCellDelegate>
///
@property (nonatomic,strong) UITableView *tableView;
///
@@ -147,6 +147,7 @@
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section ==0) {
XPMonentsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMonentsTableViewCell class])];
cell.delegate = self;
cell.monentsInfo = self.monentsInfo;
return cell;
} else {
@@ -167,6 +168,11 @@
[self.presenter getMonentsCommentReplyList:self.monentsInfo.dynamicId commentId:commentInfo.commentId timestamp:commentInfo.replyInfo.nextTimestamp];
}
#pragma mark - XPMonentsTableViewCellDelegate
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClickLike:(MonentsInfoModel *)monentsInfo {
[self.presenter likeMonent:monentsInfo.dynamicId status:!monentsInfo.isLike likedUid:monentsInfo.uid worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
}
#pragma mark - XPMonentsDetailProtocol
- (void)getMonentsDetailSuccess:(MonentsInfoModel *)commentInfo {
self.monentsInfo = commentInfo;
@@ -209,6 +215,21 @@
}
}
- (void)likeMonentsSuccess:(NSString *)dynamicId status:(BOOL)status {
if ([self.monentsInfo.dynamicId isEqualToString:dynamicId]) {
NSInteger count = self.monentsInfo.likeCount.integerValue;
self.monentsInfo.isLike = status;
if (status) {
count += 1;
} else {
count -= 1;
}
self.monentsInfo.likeCount = [NSString stringWithFormat:@"%ld", count];
[self.tableView reloadData];
}
}
#pragma mark - Getters And Setters
- (UITableView *)tableView {
if (!_tableView) {

View File

@@ -134,7 +134,7 @@
}
#pragma mark - XPMonentsTableViewCellDelegate
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClickLike:(MonentsInfoModel *)monentsInfo {
[self.presenter likeMonent:monentsInfo.dynamicId status:!monentsInfo.like likedUid:monentsInfo.uid worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
[self.presenter likeMonent:monentsInfo.dynamicId status:!monentsInfo.isLike likedUid:monentsInfo.uid worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
}
#pragma mark -JXCategoryListContainerViewDelegate
@@ -177,11 +177,14 @@
- (void)likeMonentsSuccess:(NSString *)dynamicId status:(BOOL)status {
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj.dynamicId isEqualToString:dynamicId]) {
NSInteger count = obj.likeCount.integerValue;
obj.isLike = status;
if (status) {
obj.like += 1;
count += 1;
} else {
obj.like -= 1;
count -= 1;
}
obj.likeCount = [NSString stringWithFormat:@"%ld", count];
*stop = YES;
}
}];

View File

@@ -137,7 +137,7 @@
}
#pragma mark - XPMonentsTableViewCellDelegate
- (void)xPMonentsTableViewCell:(XPMonentsTableViewCell *)view didClickLike:(MonentsInfoModel *)monentsInfo {
[self.presenter likeMonent:monentsInfo.dynamicId status:!monentsInfo.like likedUid:monentsInfo.uid worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
[self.presenter likeMonent:monentsInfo.dynamicId status:!monentsInfo.isLike likedUid:monentsInfo.uid worldId:[NSString stringWithFormat:@"%ld", monentsInfo.worldId]];
}
#pragma mark -JXCategoryListContainerViewDelegate
@@ -184,9 +184,9 @@
[self.datasource enumerateObjectsUsingBlock:^(MonentsInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj.dynamicId isEqualToString:dynamicId]) {
if (status) {
obj.like += 1;
obj.isLike += 1;
} else {
obj.like -= 1;
obj.isLike -= 1;
}
*stop = YES;
}