消息模块-私聊头像可以点击
This commit is contained in:
@@ -696,6 +696,8 @@
|
|||||||
E8DEC9A42764A6600078CB70 /* XPMoreMenuPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DEC9A32764A6600078CB70 /* XPMoreMenuPresenter.m */; };
|
E8DEC9A42764A6600078CB70 /* XPMoreMenuPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DEC9A32764A6600078CB70 /* XPMoreMenuPresenter.m */; };
|
||||||
E8DEC9A82764A68B0078CB70 /* Api+MoreMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DEC9A72764A68B0078CB70 /* Api+MoreMenu.m */; };
|
E8DEC9A82764A68B0078CB70 /* Api+MoreMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DEC9A72764A68B0078CB70 /* Api+MoreMenu.m */; };
|
||||||
E8DEC9AC2764A6CD0078CB70 /* XPRoomMoreMenuCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DEC9AB2764A6CD0078CB70 /* XPRoomMoreMenuCollectionViewCell.m */; };
|
E8DEC9AC2764A6CD0078CB70 /* XPRoomMoreMenuCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DEC9AB2764A6CD0078CB70 /* XPRoomMoreMenuCollectionViewCell.m */; };
|
||||||
|
E8E20BDB281645300033B688 /* SessionInfoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E20BDA281645300033B688 /* SessionInfoViewController.m */; };
|
||||||
|
E8E20BDE28164D3A0033B688 /* SessionNavView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E20BDD28164D3A0033B688 /* SessionNavView.m */; };
|
||||||
E8E5E18B27C332EE00F457D8 /* XPHomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E5E18A27C332EE00F457D8 /* XPHomeViewController.m */; };
|
E8E5E18B27C332EE00F457D8 /* XPHomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E5E18A27C332EE00F457D8 /* XPHomeViewController.m */; };
|
||||||
E8E5E18E27C3331E00F457D8 /* XPHomeRecommendViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E5E18D27C3331E00F457D8 /* XPHomeRecommendViewController.m */; };
|
E8E5E18E27C3331E00F457D8 /* XPHomeRecommendViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E5E18D27C3331E00F457D8 /* XPHomeRecommendViewController.m */; };
|
||||||
E8E5E19127C369F000F457D8 /* XPHomeRecommendListView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E5E19027C369F000F457D8 /* XPHomeRecommendListView.m */; };
|
E8E5E19127C369F000F457D8 /* XPHomeRecommendListView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8E5E19027C369F000F457D8 /* XPHomeRecommendListView.m */; };
|
||||||
@@ -2134,6 +2136,10 @@
|
|||||||
E8DEC9A72764A68B0078CB70 /* Api+MoreMenu.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "Api+MoreMenu.m"; sourceTree = "<group>"; };
|
E8DEC9A72764A68B0078CB70 /* Api+MoreMenu.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "Api+MoreMenu.m"; sourceTree = "<group>"; };
|
||||||
E8DEC9AA2764A6CD0078CB70 /* XPRoomMoreMenuCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMoreMenuCollectionViewCell.h; sourceTree = "<group>"; };
|
E8DEC9AA2764A6CD0078CB70 /* XPRoomMoreMenuCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMoreMenuCollectionViewCell.h; sourceTree = "<group>"; };
|
||||||
E8DEC9AB2764A6CD0078CB70 /* XPRoomMoreMenuCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMoreMenuCollectionViewCell.m; sourceTree = "<group>"; };
|
E8DEC9AB2764A6CD0078CB70 /* XPRoomMoreMenuCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMoreMenuCollectionViewCell.m; sourceTree = "<group>"; };
|
||||||
|
E8E20BD9281645300033B688 /* SessionInfoViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SessionInfoViewController.h; sourceTree = "<group>"; };
|
||||||
|
E8E20BDA281645300033B688 /* SessionInfoViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SessionInfoViewController.m; sourceTree = "<group>"; };
|
||||||
|
E8E20BDC28164D3A0033B688 /* SessionNavView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SessionNavView.h; sourceTree = "<group>"; };
|
||||||
|
E8E20BDD28164D3A0033B688 /* SessionNavView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SessionNavView.m; sourceTree = "<group>"; };
|
||||||
E8E5E18927C332EE00F457D8 /* XPHomeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeViewController.h; sourceTree = "<group>"; };
|
E8E5E18927C332EE00F457D8 /* XPHomeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeViewController.h; sourceTree = "<group>"; };
|
||||||
E8E5E18A27C332EE00F457D8 /* XPHomeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPHomeViewController.m; sourceTree = "<group>"; };
|
E8E5E18A27C332EE00F457D8 /* XPHomeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPHomeViewController.m; sourceTree = "<group>"; };
|
||||||
E8E5E18C27C3331E00F457D8 /* XPHomeRecommendViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeRecommendViewController.h; sourceTree = "<group>"; };
|
E8E5E18C27C3331E00F457D8 /* XPHomeRecommendViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeRecommendViewController.h; sourceTree = "<group>"; };
|
||||||
@@ -3147,6 +3153,8 @@
|
|||||||
children = (
|
children = (
|
||||||
9B7D80482753783D003DAC0C /* SessionViewController.h */,
|
9B7D80482753783D003DAC0C /* SessionViewController.h */,
|
||||||
9B7D80492753783D003DAC0C /* SessionViewController.m */,
|
9B7D80492753783D003DAC0C /* SessionViewController.m */,
|
||||||
|
E8E20BD9281645300033B688 /* SessionInfoViewController.h */,
|
||||||
|
E8E20BDA281645300033B688 /* SessionInfoViewController.m */,
|
||||||
9B9DFD9827DB2194000F95B3 /* XPSessionMessageHeadView.h */,
|
9B9DFD9827DB2194000F95B3 /* XPSessionMessageHeadView.h */,
|
||||||
9B9DFD9927DB2194000F95B3 /* XPSessionMessageHeadView.m */,
|
9B9DFD9927DB2194000F95B3 /* XPSessionMessageHeadView.m */,
|
||||||
E86B911828102AF90007DEE7 /* SessionToolbarView.h */,
|
E86B911828102AF90007DEE7 /* SessionToolbarView.h */,
|
||||||
@@ -3157,6 +3165,8 @@
|
|||||||
9B7D804C27537950003DAC0C /* MessageCell.m */,
|
9B7D804C27537950003DAC0C /* MessageCell.m */,
|
||||||
E8D55C9E281186D6006935A5 /* SessionAudioRecordView.h */,
|
E8D55C9E281186D6006935A5 /* SessionAudioRecordView.h */,
|
||||||
E8D55C9F281186D6006935A5 /* SessionAudioRecordView.m */,
|
E8D55C9F281186D6006935A5 /* SessionAudioRecordView.m */,
|
||||||
|
E8E20BDC28164D3A0033B688 /* SessionNavView.h */,
|
||||||
|
E8E20BDD28164D3A0033B688 /* SessionNavView.m */,
|
||||||
18F403A72758B67900A6C548 /* Content */,
|
18F403A72758B67900A6C548 /* Content */,
|
||||||
E86B911B281034F10007DEE7 /* Cell */,
|
E86B911B281034F10007DEE7 /* Cell */,
|
||||||
);
|
);
|
||||||
@@ -6538,6 +6548,7 @@
|
|||||||
E8AC721026F43955007D6E91 /* UIImageConstant.m in Sources */,
|
E8AC721026F43955007D6E91 /* UIImageConstant.m in Sources */,
|
||||||
E81C27A026EEF83D0031E639 /* XPHtmlUrl.m in Sources */,
|
E81C27A026EEF83D0031E639 /* XPHtmlUrl.m in Sources */,
|
||||||
E8F1558D28124D5200EE8C06 /* MessageConentAudioView.m in Sources */,
|
E8F1558D28124D5200EE8C06 /* MessageConentAudioView.m in Sources */,
|
||||||
|
E8E20BDB281645300033B688 /* SessionInfoViewController.m in Sources */,
|
||||||
E800807C27FD84980055A8AB /* GuildInfoModel.m in Sources */,
|
E800807C27FD84980055A8AB /* GuildInfoModel.m in Sources */,
|
||||||
E8A03DF0276303D40098D9EA /* XPCandyTreeRankTableViewCell.m in Sources */,
|
E8A03DF0276303D40098D9EA /* XPCandyTreeRankTableViewCell.m in Sources */,
|
||||||
9BCF58532798FDA1008401A4 /* XPSkillCardModel.m in Sources */,
|
9BCF58532798FDA1008401A4 /* XPSkillCardModel.m in Sources */,
|
||||||
@@ -6606,6 +6617,7 @@
|
|||||||
E8A6C29F27CF5FE500AC7442 /* HomeLiveRoomModel.m in Sources */,
|
E8A6C29F27CF5FE500AC7442 /* HomeLiveRoomModel.m in Sources */,
|
||||||
E84150B827747B8B00A7F548 /* XPFirstRechargeViewController.m in Sources */,
|
E84150B827747B8B00A7F548 /* XPFirstRechargeViewController.m in Sources */,
|
||||||
9BBC02872786D75C0007C24B /* XPNobleUpgradeLevelView.m in Sources */,
|
9BBC02872786D75C0007C24B /* XPNobleUpgradeLevelView.m in Sources */,
|
||||||
|
E8E20BDE28164D3A0033B688 /* SessionNavView.m in Sources */,
|
||||||
9B92A3442797EE6500AD168F /* XPMatchManagePresenter.m in Sources */,
|
9B92A3442797EE6500AD168F /* XPMatchManagePresenter.m in Sources */,
|
||||||
E88B5CBD26FB3BDF00DA9178 /* XPTeenagerAlertView.m in Sources */,
|
E88B5CBD26FB3BDF00DA9178 /* XPTeenagerAlertView.m in Sources */,
|
||||||
9B86D87D2817EA0900494FCD /* XPNobleSettingViewController.m in Sources */,
|
9B86D87D2817EA0900494FCD /* XPNobleSettingViewController.m in Sources */,
|
||||||
|
22
xplan-ios/Assets.xcassets/SessionMessage/message_session_nav_like.imageset/Contents.json
vendored
Normal file
22
xplan-ios/Assets.xcassets/SessionMessage/message_session_nav_like.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "message_session_nav_like@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "message_session_nav_like@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 568 B |
Binary file not shown.
After Width: | Height: | Size: 902 B |
22
xplan-ios/Assets.xcassets/SessionMessage/message_session_nav_report.imageset/Contents.json
vendored
Normal file
22
xplan-ios/Assets.xcassets/SessionMessage/message_session_nav_report.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "message_session_nav_report@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "message_session_nav_report@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 418 B |
Binary file not shown.
After Width: | Height: | Size: 776 B |
@@ -16,7 +16,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/// 获取用户信息
|
/// 获取用户信息
|
||||||
/// @param uid 用户uid
|
/// @param uid 用户uid
|
||||||
- (void)getUserInfo:(NSString *)uid;
|
- (void)getUserInfo:(NSString *)uid;
|
||||||
|
///是否关注当前用户
|
||||||
|
- (void)getFansLike:(NSString *)likeUid;
|
||||||
|
/// 关注用户
|
||||||
|
/// @param targetUid 目标用户的uid
|
||||||
|
- (void)attentionUser:(NSString *)targetUid;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
#import "MessageProtocol.h"
|
#import "MessageProtocol.h"
|
||||||
#import "Api+Mine.h"
|
#import "Api+Mine.h"
|
||||||
#import "UserInfoModel.h"
|
#import "UserInfoModel.h"
|
||||||
|
#import "AccountInfoStorage.h"
|
||||||
|
|
||||||
@implementation MessagePresenter
|
@implementation MessagePresenter
|
||||||
|
|
||||||
@@ -30,4 +31,24 @@
|
|||||||
}] uid:uid page:@"1" pageSize:@"20"];
|
}] uid:uid page:@"1" pageSize:@"20"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///是否关注当前用户
|
||||||
|
- (void)getFansLike:(NSString *)likeUid {
|
||||||
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||||
|
[Api attentionStatusCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||||
|
BOOL isLike = [data.data boolValue];
|
||||||
|
[[self getView] getFansLikeSuccess:isLike];
|
||||||
|
}] uid:uid isLikeUid:likeUid];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 关注用户
|
||||||
|
/// @param targetUid 目标用户的uid
|
||||||
|
- (void)attentionUser:(NSString *)targetUid {
|
||||||
|
NSString * uid = [[AccountInfoStorage instance] getUid];
|
||||||
|
NSString * ticket = [[AccountInfoStorage instance] getTicket];
|
||||||
|
NSString * type = @"1";
|
||||||
|
[Api attentionCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||||
|
[[self getView] attentionUserSuccess:targetUid];
|
||||||
|
} showLoading:YES] uid:uid likedUid:targetUid ticket:ticket type:type];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@@ -17,7 +17,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
///获取用户信息成功
|
///获取用户信息成功
|
||||||
- (void)onGetSessionUserInfoSuccess:(UserInfoModel *)userInfo;
|
- (void)onGetSessionUserInfoSuccess:(UserInfoModel *)userInfo;
|
||||||
|
///获取粉丝喜欢成功
|
||||||
|
- (void)getFansLikeSuccess:(BOOL)isLike;
|
||||||
|
///关注成功
|
||||||
|
- (void)attentionUserSuccess:(NSString *)uid;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -15,8 +15,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
///更新消息成功
|
///更新消息成功
|
||||||
- (void)updateMessageSuccess:(NIMMessage *)message;
|
- (void)updateMessageSuccess:(NIMMessage *)message;
|
||||||
|
|
||||||
@end
|
- (void)didTapAvatar:(NSString *)uid;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@interface MessageCell : UITableViewCell
|
@interface MessageCell : UITableViewCell
|
||||||
|
|
||||||
+ (CGFloat)measureHeight:(NIMMessage *)message;
|
+ (CGFloat)measureHeight:(NIMMessage *)message;
|
||||||
|
@@ -51,7 +51,8 @@
|
|||||||
消息内容实体
|
消息内容实体
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, strong) UIView<MessageContentProtocol> * messageContent;
|
@property (nonatomic, strong) UIView<MessageContentProtocol> * messageContent;
|
||||||
|
///当前的消息
|
||||||
|
@property (nonatomic,strong) NIMMessage *currentMessage;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation MessageCell
|
@implementation MessageCell
|
||||||
@@ -121,6 +122,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)renderWithMessage:(NIMMessage *)message {
|
- (void)renderWithMessage:(NIMMessage *)message {
|
||||||
|
self.currentMessage = message;
|
||||||
NSString * avatarUrl = [[NIMSDK sharedSDK].userManager userInfo:message.from].userInfo.avatarUrl;
|
NSString * avatarUrl = [[NIMSDK sharedSDK].userManager userInfo:message.from].userInfo.avatarUrl;
|
||||||
avatarUrl = [avatarUrl stringByReplacingOccurrencesOfString:@"https" withString:@"http"];
|
avatarUrl = [avatarUrl stringByReplacingOccurrencesOfString:@"https" withString:@"http"];
|
||||||
BOOL isSelf = [[NIMSDK sharedSDK].loginManager.currentAccount isEqualToString:message.from];
|
BOOL isSelf = [[NIMSDK sharedSDK].loginManager.currentAccount isEqualToString:message.from];
|
||||||
@@ -276,6 +278,19 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - Event Response
|
||||||
|
- (void)rightAvatarTapRecognizer {
|
||||||
|
if (self.delegate && [self.delegate respondsToSelector:@selector(didTapAvatar:)]) {
|
||||||
|
[self.delegate didTapAvatar:self.currentMessage.from];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)leftAvatarTapRecognizer {
|
||||||
|
if (self.delegate && [self.delegate respondsToSelector:@selector(didTapAvatar:)]) {
|
||||||
|
[self.delegate didTapAvatar:self.currentMessage.from];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - Getters And Setters
|
#pragma mark - Getters And Setters
|
||||||
- (NetImageView *)leftAvatar {
|
- (NetImageView *)leftAvatar {
|
||||||
if (!_leftAvatar) {
|
if (!_leftAvatar) {
|
||||||
@@ -287,6 +302,9 @@
|
|||||||
_leftAvatar.layer.masksToBounds = YES;
|
_leftAvatar.layer.masksToBounds = YES;
|
||||||
_leftAvatar.layer.cornerRadius = 45.f / 2;
|
_leftAvatar.layer.cornerRadius = 45.f / 2;
|
||||||
_leftAvatar.hidden = YES;
|
_leftAvatar.hidden = YES;
|
||||||
|
_leftAvatar.userInteractionEnabled = YES;
|
||||||
|
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(leftAvatarTapRecognizer)];
|
||||||
|
[_leftAvatar addGestureRecognizer:tap];
|
||||||
}
|
}
|
||||||
return _leftAvatar;
|
return _leftAvatar;
|
||||||
}
|
}
|
||||||
@@ -301,6 +319,9 @@
|
|||||||
_rightAvatar.layer.masksToBounds = YES;
|
_rightAvatar.layer.masksToBounds = YES;
|
||||||
_rightAvatar.layer.cornerRadius = 45.f / 2;
|
_rightAvatar.layer.cornerRadius = 45.f / 2;
|
||||||
_rightAvatar.hidden = YES;
|
_rightAvatar.hidden = YES;
|
||||||
|
_rightAvatar.userInteractionEnabled = YES;
|
||||||
|
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(rightAvatarTapRecognizer)];
|
||||||
|
[_rightAvatar addGestureRecognizer:tap];
|
||||||
}
|
}
|
||||||
return _rightAvatar;
|
return _rightAvatar;
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,17 @@
|
|||||||
|
//
|
||||||
|
// SessionInfoViewController.h
|
||||||
|
// xplan-ios
|
||||||
|
//
|
||||||
|
// Created by 冯硕 on 2022/4/25.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "BaseViewController.h"
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface SessionInfoViewController : BaseViewController
|
||||||
|
///用户的id
|
||||||
|
@property (nonatomic,copy) NSString *userId;
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
297
xplan-ios/Main/Message/View/Session/SessionInfoViewController.m
Normal file
297
xplan-ios/Main/Message/View/Session/SessionInfoViewController.m
Normal file
@@ -0,0 +1,297 @@
|
|||||||
|
//
|
||||||
|
// SessionInfoViewController.m
|
||||||
|
// xplan-ios
|
||||||
|
//
|
||||||
|
// Created by 冯硕 on 2022/4/25.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "SessionInfoViewController.h"
|
||||||
|
///Third
|
||||||
|
#import <Masonry/Masonry.h>
|
||||||
|
#import <NIMSDK/NIMSDK.h>
|
||||||
|
///Tool
|
||||||
|
#import "ThemeColor.h"
|
||||||
|
#import "NetImageView.h"
|
||||||
|
#import "TTPopup.h"
|
||||||
|
#import "XPHtmlUrl.h"
|
||||||
|
///View
|
||||||
|
#import "XPWebViewController.h"
|
||||||
|
#import "XPMineUserInfoViewController.h"
|
||||||
|
|
||||||
|
@interface SessionInfoViewController ()
|
||||||
|
///最外面的容器
|
||||||
|
@property (nonatomic,strong) UIStackView *stackView;
|
||||||
|
///用户信息的view
|
||||||
|
@property (nonatomic,strong) UIView * infoView;
|
||||||
|
///头像
|
||||||
|
@property (nonatomic,strong) NetImageView *avatarImageView;
|
||||||
|
///昵称
|
||||||
|
@property (nonatomic,strong) UILabel *nickLabel;
|
||||||
|
///个人主页
|
||||||
|
@property (nonatomic,strong) UILabel *titleLabel;
|
||||||
|
///箭头
|
||||||
|
@property (nonatomic,strong) UIImageView *arrowImageView;
|
||||||
|
///显示举报 加入黑名单
|
||||||
|
@property (nonatomic,strong) UIStackView *contentStackView;
|
||||||
|
///举报
|
||||||
|
@property (nonatomic,strong) UIButton *reportButton;
|
||||||
|
///分割线
|
||||||
|
@property (nonatomic,strong) UIView * lineView;
|
||||||
|
///加入黑名单
|
||||||
|
@property (nonatomic,strong) UIButton *blackButton;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation SessionInfoViewController
|
||||||
|
|
||||||
|
- (void)viewDidLoad {
|
||||||
|
[super viewDidLoad];
|
||||||
|
[self initData];
|
||||||
|
[self initSubViews];
|
||||||
|
[self initSubViewConstraints];
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - Private Method
|
||||||
|
- (void)initData {
|
||||||
|
[[NIMSDK sharedSDK].userManager fetchUserInfos:@[self.userId] completion:^(NSArray<NIMUser *> * _Nullable users, NSError * _Nullable error) {
|
||||||
|
if (!error) {
|
||||||
|
NIMUser * user = users.firstObject;
|
||||||
|
self.avatarImageView.imageUrl = user.userInfo.avatarUrl;
|
||||||
|
self.nickLabel.text = user.userInfo.nickName;
|
||||||
|
} else {
|
||||||
|
[self showErrorToast:@"用户信息请求失败,请重试"];
|
||||||
|
[self.navigationController popViewControllerAnimated:YES];
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
|
||||||
|
self.blackButton.selected = [[NIMSDK sharedSDK].userManager isUserInBlackList:self.userId];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)initSubViews {
|
||||||
|
self.title = @"加入黑名单";
|
||||||
|
[self.view addSubview:self.stackView];
|
||||||
|
|
||||||
|
[self.stackView addArrangedSubview:self.infoView];
|
||||||
|
[self.stackView addArrangedSubview:self.contentStackView];
|
||||||
|
|
||||||
|
[self.infoView addSubview:self.avatarImageView];
|
||||||
|
[self.infoView addSubview:self.nickLabel];
|
||||||
|
[self.infoView addSubview:self.titleLabel];
|
||||||
|
[self.infoView addSubview:self.arrowImageView];
|
||||||
|
|
||||||
|
[self.contentStackView addArrangedSubview:self.reportButton];
|
||||||
|
[self.contentStackView addArrangedSubview:self.lineView];
|
||||||
|
[self.contentStackView addArrangedSubview:self.blackButton];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)initSubViewConstraints {
|
||||||
|
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.left.right.mas_equalTo(self.view);
|
||||||
|
make.top.mas_equalTo(self.view).offset(10);
|
||||||
|
}];
|
||||||
|
|
||||||
|
[self.infoView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.height.mas_equalTo(60);
|
||||||
|
}];
|
||||||
|
|
||||||
|
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.size.mas_equalTo(CGSizeMake(40, 40));
|
||||||
|
make.left.mas_equalTo(self.infoView).offset(15);
|
||||||
|
make.centerY.mas_equalTo(self.infoView);
|
||||||
|
}];
|
||||||
|
|
||||||
|
[self.nickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.centerY.mas_equalTo(self.infoView);
|
||||||
|
make.left.mas_equalTo(self.avatarImageView.mas_right).offset(5);
|
||||||
|
make.right.mas_lessThanOrEqualTo(self.titleLabel.mas_left).offset(-5);
|
||||||
|
}];
|
||||||
|
|
||||||
|
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.right.mas_equalTo(self.arrowImageView.mas_left).offset(-5);
|
||||||
|
make.centerY.mas_equalTo(self.infoView);
|
||||||
|
}];
|
||||||
|
|
||||||
|
[self.arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.size.mas_equalTo(CGSizeMake(6.5, 11));
|
||||||
|
make.centerY.mas_equalTo(self.infoView);
|
||||||
|
make.right.mas_equalTo(self.infoView).offset(-10);
|
||||||
|
}];
|
||||||
|
|
||||||
|
[self.reportButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.height.mas_equalTo(44);
|
||||||
|
}];
|
||||||
|
|
||||||
|
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.height.mas_equalTo(0.5);
|
||||||
|
}];
|
||||||
|
|
||||||
|
[self.blackButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.height.mas_equalTo(44);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - Event Response
|
||||||
|
- (void)blackButtonAction:(UIButton *)sender {
|
||||||
|
NSString *title = nil;
|
||||||
|
NSString *message = nil;
|
||||||
|
BOOL isInBlack = [[NIMSDK sharedSDK].userManager isUserInBlackList:self.userId];
|
||||||
|
if (!isInBlack) {
|
||||||
|
title = @"加入黑名单";
|
||||||
|
message = @"加入黑名单,你将不再收到对方的消息";
|
||||||
|
} else {
|
||||||
|
title = @"移除黑名单";
|
||||||
|
message = @"移除黑名单,你将正常收到对方的消息";
|
||||||
|
}
|
||||||
|
|
||||||
|
TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
||||||
|
config.title = title;
|
||||||
|
config.message = message;
|
||||||
|
[TTPopup alertWithConfig:config confirmHandler:^{
|
||||||
|
if (isInBlack) {
|
||||||
|
[[NIMSDK sharedSDK].userManager removeFromBlackBlackList:self.userId completion:^(NSError * _Nullable error) {
|
||||||
|
if (error == nil) {
|
||||||
|
[self showErrorToast:@"已经成功将对方移除黑名单"];
|
||||||
|
self.blackButton.selected = NO;
|
||||||
|
} else {
|
||||||
|
[self showErrorToast:error.description];
|
||||||
|
}
|
||||||
|
|
||||||
|
}];
|
||||||
|
} else {
|
||||||
|
[[NIMSDK sharedSDK].userManager addToBlackList:self.userId completion:^(NSError * _Nullable error) {
|
||||||
|
if (error == nil) {
|
||||||
|
[self showErrorToast:@"已经成功将对方加入黑名单"];
|
||||||
|
self.blackButton.selected = YES;
|
||||||
|
} else {
|
||||||
|
[self showErrorToast:error.description];
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
} cancelHandler:^{
|
||||||
|
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)reportButtonAction:(UIButton *)sender {
|
||||||
|
XPWebViewController *webVC = [[XPWebViewController alloc] init];
|
||||||
|
NSString *urlstr = [NSString stringWithFormat:@"%@?reportUid=%@&source=CHAT",URLWithType(kReportRoomURL),self.userId];
|
||||||
|
webVC.url = urlstr;
|
||||||
|
[self.navigationController pushViewController:webVC animated:YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)didTapUserRecognizer {
|
||||||
|
XPMineUserInfoViewController * mineVC = [[XPMineUserInfoViewController alloc] init];
|
||||||
|
mineVC.uid = self.userId.integerValue;
|
||||||
|
[self.navigationController pushViewController:mineVC animated:YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - Getters And Setters
|
||||||
|
- (UIStackView *)stackView {
|
||||||
|
if (!_stackView) {
|
||||||
|
_stackView = [[UIStackView alloc] init];
|
||||||
|
_stackView.axis = UILayoutConstraintAxisVertical;
|
||||||
|
_stackView.distribution = UIStackViewDistributionFill;
|
||||||
|
_stackView.alignment = UIStackViewAlignmentFill;
|
||||||
|
_stackView.spacing = 20;
|
||||||
|
}
|
||||||
|
return _stackView;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UIView *)infoView {
|
||||||
|
if (!_infoView) {
|
||||||
|
_infoView = [[UIView alloc] init];
|
||||||
|
_infoView.backgroundColor = [ThemeColor appCellBackgroundColor];
|
||||||
|
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapUserRecognizer)];
|
||||||
|
[_infoView addGestureRecognizer:tap];
|
||||||
|
}
|
||||||
|
return _infoView;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NetImageView *)avatarImageView {
|
||||||
|
if (!_avatarImageView) {
|
||||||
|
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||||
|
config.imageType = ImageTypeUserIcon;
|
||||||
|
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||||
|
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
|
||||||
|
_avatarImageView.layer.masksToBounds = YES;
|
||||||
|
_avatarImageView.layer.cornerRadius = 20;
|
||||||
|
}
|
||||||
|
return _avatarImageView;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UILabel *)nickLabel {
|
||||||
|
if (!_nickLabel) {
|
||||||
|
_nickLabel = [[UILabel alloc] init];
|
||||||
|
_nickLabel.font = [UIFont systemFontOfSize:15];
|
||||||
|
_nickLabel.textColor = [ThemeColor mainTextColor];
|
||||||
|
}
|
||||||
|
return _nickLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UILabel *)titleLabel {
|
||||||
|
if (!_titleLabel) {
|
||||||
|
_titleLabel = [[UILabel alloc] init];
|
||||||
|
_titleLabel.font = [UIFont systemFontOfSize:14];
|
||||||
|
_titleLabel.text = @"个人主页";
|
||||||
|
_titleLabel.textColor = [ThemeColor secondTextColor];
|
||||||
|
}
|
||||||
|
return _titleLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UIImageView *)arrowImageView {
|
||||||
|
if (!_arrowImageView) {
|
||||||
|
_arrowImageView = [[UIImageView alloc] init];
|
||||||
|
_arrowImageView.userInteractionEnabled = YES;
|
||||||
|
_arrowImageView.image = [UIImage imageNamed:@"room_setting_arrow"];
|
||||||
|
}
|
||||||
|
return _arrowImageView;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (UIStackView *)contentStackView {
|
||||||
|
if (!_contentStackView) {
|
||||||
|
_contentStackView = [[UIStackView alloc] init];
|
||||||
|
_contentStackView.axis = UILayoutConstraintAxisVertical;
|
||||||
|
_contentStackView.distribution = UIStackViewDistributionFill;
|
||||||
|
_contentStackView.alignment = UIStackViewAlignmentFill;
|
||||||
|
_contentStackView.spacing = 0;
|
||||||
|
}
|
||||||
|
return _contentStackView;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UIButton *)reportButton {
|
||||||
|
if (!_reportButton) {
|
||||||
|
_reportButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
|
[_reportButton setTitle:@"举报" forState:UIControlStateNormal];
|
||||||
|
[_reportButton setTitleColor:[ThemeColor mainTextColor] forState:UIControlStateNormal];
|
||||||
|
_reportButton.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
|
||||||
|
[_reportButton setBackgroundColor:[ThemeColor appCellBackgroundColor]];
|
||||||
|
[_reportButton addTarget:self action:@selector(reportButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||||
|
}
|
||||||
|
return _reportButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UIView *)lineView {
|
||||||
|
if (!_lineView) {
|
||||||
|
_lineView = [[UIView alloc] init];
|
||||||
|
_lineView.backgroundColor = [ThemeColor dividerColor];
|
||||||
|
}
|
||||||
|
return _lineView;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UIButton *)blackButton {
|
||||||
|
if (!_blackButton) {
|
||||||
|
_blackButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
|
[_blackButton setTitle:@"加入黑名单" forState:UIControlStateNormal];
|
||||||
|
[_blackButton setTitle:@"移除黑名单" forState:UIControlStateSelected];
|
||||||
|
[_blackButton setTitleColor:[ThemeColor mainTextColor] forState:UIControlStateNormal];
|
||||||
|
[_blackButton setTitleColor:[ThemeColor mainTextColor] forState:UIControlStateSelected];
|
||||||
|
_blackButton.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
|
||||||
|
[_blackButton setBackgroundColor:[ThemeColor appCellBackgroundColor]];
|
||||||
|
[_blackButton addTarget:self action:@selector(blackButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||||
|
}
|
||||||
|
return _blackButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@end
|
31
xplan-ios/Main/Message/View/Session/SessionNavView.h
Normal file
31
xplan-ios/Main/Message/View/Session/SessionNavView.h
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
//
|
||||||
|
// SessionNavView.h
|
||||||
|
// xplan-ios
|
||||||
|
//
|
||||||
|
// Created by 冯硕 on 2022/4/25.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
@class SessionNavView;
|
||||||
|
@protocol SessionNavViewDelegate <NSObject>
|
||||||
|
///点击了举报
|
||||||
|
- (void)sessionNavView:(SessionNavView *)view didClickReport:(UIButton *)sender;
|
||||||
|
///点击了关注
|
||||||
|
- (void)sessionNavView:(SessionNavView *)view didClickLike:(UIButton *)sender;
|
||||||
|
///点击了返回
|
||||||
|
- (void)sessionNavView:(SessionNavView *)view didClickBack:(UIButton *)sender;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface SessionNavView : UIView
|
||||||
|
@property (nonatomic,copy) NSString *userId;
|
||||||
|
///标题
|
||||||
|
@property (nonatomic,copy) NSString *title;
|
||||||
|
///是否已经喜欢了
|
||||||
|
@property (nonatomic,assign) BOOL isLike;
|
||||||
|
///代理
|
||||||
|
@property (nonatomic,weak) id<SessionNavViewDelegate> delegate;
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
206
xplan-ios/Main/Message/View/Session/SessionNavView.m
Normal file
206
xplan-ios/Main/Message/View/Session/SessionNavView.m
Normal file
@@ -0,0 +1,206 @@
|
|||||||
|
//
|
||||||
|
// SessionNavView.m
|
||||||
|
// xplan-ios
|
||||||
|
//
|
||||||
|
// Created by 冯硕 on 2022/4/25.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "SessionNavView.h"
|
||||||
|
///Third
|
||||||
|
#import <Masonry/Masonry.h>
|
||||||
|
#import <NIMSDK/NIMSDK.h>
|
||||||
|
///Tool
|
||||||
|
#import "ThemeColor.h"
|
||||||
|
#import "XPMacro.h"
|
||||||
|
|
||||||
|
@interface SessionNavView ()
|
||||||
|
|
||||||
|
///返回按钮
|
||||||
|
@property (nonatomic,strong) UIButton *backButton;
|
||||||
|
///用户信息的容器
|
||||||
|
@property (nonatomic,strong) UIStackView *infoStackView;
|
||||||
|
///名字的容器
|
||||||
|
@property (nonatomic,strong) UIStackView *nickStackView;
|
||||||
|
///标题
|
||||||
|
@property (nonatomic,strong) UILabel *nickLabel;
|
||||||
|
///是否关注
|
||||||
|
@property (nonatomic,strong) UIButton *likeButton;
|
||||||
|
///加入黑名单
|
||||||
|
@property (nonatomic,strong) UILabel *subTitleLabel;
|
||||||
|
///举报
|
||||||
|
@property (nonatomic,strong) UIButton *reportButton;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation SessionNavView
|
||||||
|
- (instancetype)initWithFrame:(CGRect)frame {
|
||||||
|
self = [super initWithFrame:frame];
|
||||||
|
if (self) {
|
||||||
|
[self initSubViews];
|
||||||
|
[self initSubViewConstraints];
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - Private Method
|
||||||
|
- (void)initSubViews {
|
||||||
|
self.backgroundColor = [ThemeColor appCellBackgroundColor];
|
||||||
|
[self addSubview:self.backButton];
|
||||||
|
[self addSubview:self.infoStackView];
|
||||||
|
[self addSubview:self.reportButton];
|
||||||
|
|
||||||
|
[self.infoStackView addArrangedSubview:self.nickStackView];
|
||||||
|
[self.infoStackView addArrangedSubview:self.subTitleLabel];
|
||||||
|
|
||||||
|
[self.nickStackView addArrangedSubview:self.nickLabel];
|
||||||
|
[self.nickStackView addArrangedSubview:self.likeButton];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)initSubViewConstraints {
|
||||||
|
[self.backButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.size.mas_equalTo(CGSizeMake(22, 22));
|
||||||
|
make.left.mas_equalTo(self).offset(8);
|
||||||
|
make.top.mas_equalTo(statusbarHeight + 14);
|
||||||
|
}];
|
||||||
|
|
||||||
|
[self.infoStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.centerX.mas_equalTo(self);
|
||||||
|
make.centerY.mas_equalTo(self.backButton);
|
||||||
|
}];
|
||||||
|
|
||||||
|
[self.likeButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.size.mas_equalTo(CGSizeMake(22, 22));
|
||||||
|
}];
|
||||||
|
|
||||||
|
[self.reportButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.size.mas_equalTo(CGSizeMake(30, 30 ));
|
||||||
|
make.right.mas_equalTo(self).offset(-15);
|
||||||
|
make.centerY.mas_equalTo(self.backButton);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - Event Response
|
||||||
|
- (void)reportButtonAction:(UIButton *)sender {
|
||||||
|
if (self.delegate && [self.delegate respondsToSelector:@selector(sessionNavView:didClickReport:)]) {
|
||||||
|
[self.delegate sessionNavView:self didClickReport:sender];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)backButtonAction:(UIButton *)sender {
|
||||||
|
if (self.delegate && [self.delegate respondsToSelector:@selector(sessionNavView:didClickBack:)]) {
|
||||||
|
[self.delegate sessionNavView:self didClickBack:sender];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)likeButtonAction:(UIButton *)sender {
|
||||||
|
if (self.delegate && [self.delegate respondsToSelector:@selector(sessionNavView:didClickLike:)]) {
|
||||||
|
[self.delegate sessionNavView:self didClickLike:sender];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - Getters And Setters
|
||||||
|
- (void)setUserId:(NSString *)userId {
|
||||||
|
_userId = userId;
|
||||||
|
if (_userId.length > 0) {
|
||||||
|
[[NIMSDK sharedSDK].userManager fetchUserInfos:@[self.userId] completion:^(NSArray<NIMUser *> * _Nullable users, NSError * _Nullable error) {
|
||||||
|
if (!error) {
|
||||||
|
self.title = users[0].userInfo.nickName;
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
self.subTitleLabel.hidden = ![[NIMSDK sharedSDK].userManager isUserInBlackList:self.userId];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setTitle:(NSString *)title {
|
||||||
|
_title = title;
|
||||||
|
if (_title) {
|
||||||
|
NSString * nick = title;
|
||||||
|
if (nick.length > 10 ) {
|
||||||
|
nick = [nick substringToIndex:10];
|
||||||
|
}
|
||||||
|
self.nickLabel.text = nick;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setIsLike:(BOOL)isLike {
|
||||||
|
_isLike = isLike;
|
||||||
|
self.likeButton.hidden = _isLike;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UIButton *)backButton {
|
||||||
|
if (!_backButton) {
|
||||||
|
_backButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
|
[_backButton setImage:[UIImage imageNamed:@"common_nav_back"] forState:UIControlStateNormal];
|
||||||
|
[_backButton setImage:[UIImage imageNamed:@"common_nav_back"] forState:UIControlStateSelected];
|
||||||
|
[_backButton addTarget:self action:@selector(backButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||||
|
}
|
||||||
|
return _backButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UIStackView *)infoStackView {
|
||||||
|
if (!_infoStackView) {
|
||||||
|
_infoStackView = [[UIStackView alloc] init];
|
||||||
|
_infoStackView.axis = UILayoutConstraintAxisVertical;
|
||||||
|
_infoStackView.distribution = UIStackViewDistributionFill;
|
||||||
|
_infoStackView.alignment = UIStackViewAlignmentFill;
|
||||||
|
_infoStackView.spacing = 3;
|
||||||
|
}
|
||||||
|
return _infoStackView;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UIStackView *)nickStackView {
|
||||||
|
if (!_nickStackView) {
|
||||||
|
_nickStackView = [[UIStackView alloc] init];
|
||||||
|
_nickStackView.axis = UILayoutConstraintAxisHorizontal;
|
||||||
|
_nickStackView.distribution = UIStackViewDistributionFill;
|
||||||
|
_nickStackView.alignment = UIStackViewAlignmentFill;
|
||||||
|
_nickStackView.spacing = 3;
|
||||||
|
}
|
||||||
|
return _nickStackView;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UILabel *)nickLabel {
|
||||||
|
if (!_nickLabel) {
|
||||||
|
_nickLabel = [[UILabel alloc] init];
|
||||||
|
_nickLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightMedium];
|
||||||
|
_nickLabel.textColor = [ThemeColor mainTextColor];
|
||||||
|
_nickLabel.textAlignment = NSTextAlignmentCenter;
|
||||||
|
}
|
||||||
|
return _nickLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UIButton *)likeButton {
|
||||||
|
if (!_likeButton) {
|
||||||
|
_likeButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
|
[_likeButton setImage:[UIImage imageNamed:@"message_session_nav_like"] forState:UIControlStateNormal];
|
||||||
|
[_likeButton setImage:[UIImage imageNamed:@"message_session_nav_like"] forState:UIControlStateSelected];
|
||||||
|
[_likeButton addTarget:self action:@selector(likeButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||||
|
_likeButton.hidden = NO;
|
||||||
|
}
|
||||||
|
return _likeButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UILabel *)subTitleLabel {
|
||||||
|
if (!_subTitleLabel) {
|
||||||
|
_subTitleLabel = [[UILabel alloc] init];
|
||||||
|
_subTitleLabel.font = [UIFont systemFontOfSize:11];
|
||||||
|
_subTitleLabel.textColor = [ThemeColor secondTextColor];
|
||||||
|
_subTitleLabel.text = @"已经加入黑名单";
|
||||||
|
_subTitleLabel.hidden = YES;
|
||||||
|
_subTitleLabel.textAlignment = NSTextAlignmentCenter;
|
||||||
|
}
|
||||||
|
return _subTitleLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UIButton *)reportButton {
|
||||||
|
if (!_reportButton) {
|
||||||
|
_reportButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
|
[_reportButton setImage:[UIImage imageNamed:@"message_session_nav_report"] forState:UIControlStateNormal];
|
||||||
|
[_reportButton setImage:[UIImage imageNamed:@"message_session_nav_report"] forState:UIControlStateSelected];
|
||||||
|
[_reportButton addTarget:self action:@selector(reportButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||||
|
}
|
||||||
|
return _reportButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@end
|
@@ -286,11 +286,9 @@
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)audioButtonAction:(UIButton *)sender {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)audioTouchDownAction {
|
- (void)audioTouchDownAction {
|
||||||
|
self.audioButton.selected = YES;
|
||||||
///开始录音
|
///开始录音
|
||||||
if (!self.audioRecordView.superview) {
|
if (!self.audioRecordView.superview) {
|
||||||
[[UIApplication sharedApplication].keyWindow addSubview:self.audioRecordView];
|
[[UIApplication sharedApplication].keyWindow addSubview:self.audioRecordView];
|
||||||
@@ -304,12 +302,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)audioTouchUpOutsideAction {
|
- (void)audioTouchUpOutsideAction {
|
||||||
|
self.audioButton.selected = NO;
|
||||||
///取消录音
|
///取消录音
|
||||||
[self.audioRecordView cancelAudioRecord];
|
[self.audioRecordView cancelAudioRecord];
|
||||||
[self.audioRecordView removeFromSuperview];
|
[self.audioRecordView removeFromSuperview];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)audioTouchUpInsideAction {
|
- (void)audioTouchUpInsideAction {
|
||||||
|
self.audioButton.selected = NO;
|
||||||
///手指抬起 完成录音
|
///手指抬起 完成录音
|
||||||
[self.audioRecordView finishAudioRecord];
|
[self.audioRecordView finishAudioRecord];
|
||||||
[self.audioRecordView removeFromSuperview];
|
[self.audioRecordView removeFromSuperview];
|
||||||
@@ -417,7 +417,6 @@
|
|||||||
_audioButton.layer.masksToBounds = YES;
|
_audioButton.layer.masksToBounds = YES;
|
||||||
_audioButton.layer.cornerRadius = 4;
|
_audioButton.layer.cornerRadius = 4;
|
||||||
_audioButton.backgroundColor = UIColorFromRGB(0xF1F1FA);
|
_audioButton.backgroundColor = UIColorFromRGB(0xF1F1FA);
|
||||||
[_audioButton addTarget:self action:@selector(audioButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
||||||
_audioButton.hidden = YES;
|
_audioButton.hidden = YES;
|
||||||
}
|
}
|
||||||
return _audioButton;
|
return _audioButton;
|
||||||
|
@@ -29,16 +29,19 @@
|
|||||||
#import "MessageCell.h"
|
#import "MessageCell.h"
|
||||||
#import "SessionChatLimitView.h"
|
#import "SessionChatLimitView.h"
|
||||||
#import "XPSendGiftView.h"
|
#import "XPSendGiftView.h"
|
||||||
|
#import "SessionNavView.h"
|
||||||
|
#import "SessionInfoViewController.h"
|
||||||
///P
|
///P
|
||||||
#import "MessagePresenter.h"
|
#import "MessagePresenter.h"
|
||||||
#import "MessageProtocol.h"
|
#import "MessageProtocol.h"
|
||||||
|
|
||||||
|
|
||||||
@interface SessionViewController ()<MessageProtocol, UITableViewDelegate, UITableViewDataSource, NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMMediaManagerDelegate, XPSessionMessageHeadViewDelegate, MessageCellDelegate, SessionToolbarViewDelegate, TZImagePickerControllerDelegate>
|
@interface SessionViewController ()<MessageProtocol, UITableViewDelegate, UITableViewDataSource, NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMMediaManagerDelegate, XPSessionMessageHeadViewDelegate, MessageCellDelegate, SessionToolbarViewDelegate, TZImagePickerControllerDelegate, SessionNavViewDelegate>
|
||||||
|
|
||||||
@property (nonatomic, strong) NIMSession * session;
|
@property (nonatomic, strong) NIMSession * session;
|
||||||
@property (nonatomic, strong) NSMutableArray<NIMMessage *> * messages;
|
@property (nonatomic, strong) NSMutableArray<NIMMessage *> * messages;
|
||||||
|
///导航栏
|
||||||
|
@property (nonatomic,strong) SessionNavView *sessionNavView;
|
||||||
@property (nonatomic, strong) UITableView * sessionTableView;
|
@property (nonatomic, strong) UITableView * sessionTableView;
|
||||||
///跟随进房卡片
|
///跟随进房卡片
|
||||||
@property (nonatomic, strong) XPSessionMessageHeadView *followInRoomView;
|
@property (nonatomic, strong) XPSessionMessageHeadView *followInRoomView;
|
||||||
@@ -51,6 +54,10 @@
|
|||||||
|
|
||||||
@implementation SessionViewController
|
@implementation SessionViewController
|
||||||
|
|
||||||
|
- (BOOL)isHiddenNavBar {
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
[[NIMSDK sharedSDK].chatManager removeDelegate:self];
|
[[NIMSDK sharedSDK].chatManager removeDelegate:self];
|
||||||
[[NIMSDK sharedSDK].conversationManager removeDelegate:self];
|
[[NIMSDK sharedSDK].conversationManager removeDelegate:self];
|
||||||
@@ -79,7 +86,11 @@
|
|||||||
[self initHeaderAndFooterRrfresh];
|
[self initHeaderAndFooterRrfresh];
|
||||||
[[NIMSDK sharedSDK].chatManager addDelegate:self];
|
[[NIMSDK sharedSDK].chatManager addDelegate:self];
|
||||||
[[NIMSDK sharedSDK].conversationManager addDelegate:self];
|
[[NIMSDK sharedSDK].conversationManager addDelegate:self];
|
||||||
[self.presenter getUserInfo:self.session.sessionId];
|
}
|
||||||
|
|
||||||
|
- (void)viewWillAppear:(BOOL)animated {
|
||||||
|
[super viewWillAppear:animated];
|
||||||
|
[self.presenter getFansLike:self.session.sessionId];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)initHeaderAndFooterRrfresh {
|
- (void)initHeaderAndFooterRrfresh {
|
||||||
@@ -120,25 +131,26 @@
|
|||||||
|
|
||||||
#pragma mark - Private Method
|
#pragma mark - Private Method
|
||||||
- (void)initViews {
|
- (void)initViews {
|
||||||
NIMUser * user = [[NIMSDK sharedSDK].userManager userInfo:self.session.sessionId];
|
[self.view addSubview:self.sessionNavView];
|
||||||
if (user) {
|
|
||||||
self.title = user.userInfo.nickName;
|
|
||||||
} else {
|
|
||||||
self.title = @"加载中……";
|
|
||||||
}
|
|
||||||
|
|
||||||
[self.view addSubview:self.followInRoomView];
|
[self.view addSubview:self.followInRoomView];
|
||||||
[self.view addSubview:self.sessionTableView];
|
[self.view addSubview:self.sessionTableView];
|
||||||
[self.view addSubview:self.toolbarView];
|
[self.view addSubview:self.toolbarView];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)initLayout {
|
- (void)initLayout {
|
||||||
|
[self.sessionNavView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.height.mas_equalTo(kNavigationHeight);
|
||||||
|
make.left.top.right.mas_equalTo(self.view);
|
||||||
|
}];
|
||||||
|
|
||||||
[self.followInRoomView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.followInRoomView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.left.right.top.mas_equalTo(self.view);
|
make.left.right.mas_equalTo(self.view);
|
||||||
|
make.top.mas_equalTo(self.sessionNavView.mas_bottom);
|
||||||
make.height.mas_equalTo(80);
|
make.height.mas_equalTo(80);
|
||||||
}];
|
}];
|
||||||
[self.sessionTableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.sessionTableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.left.right.top.mas_equalTo(self.view);
|
make.left.right.mas_equalTo(self.view);
|
||||||
|
make.top.mas_equalTo(self.sessionNavView.mas_bottom);
|
||||||
make.bottom.mas_equalTo(self.toolbarView.mas_top);
|
make.bottom.mas_equalTo(self.toolbarView.mas_top);
|
||||||
}];
|
}];
|
||||||
|
|
||||||
@@ -149,15 +161,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)initData {
|
- (void)initData {
|
||||||
[[NIMSDK sharedSDK].userManager fetchUserInfos:@[self.session.sessionId] completion:^(NSArray<NIMUser *> * _Nullable users, NSError * _Nullable error) {
|
NIMUser * user = [[NIMSDK sharedSDK].userManager userInfo:self.session.sessionId];
|
||||||
if (!error) {
|
if (user) {
|
||||||
self.title = users[0].userInfo.nickName;
|
self.sessionNavView.title = user.userInfo.nickName;
|
||||||
}
|
} else {
|
||||||
}];
|
self.sessionNavView.title = @"加载中……";
|
||||||
|
}
|
||||||
[[NIMSDK sharedSDK].conversationManager markAllMessagesReadInSession:self.session];
|
[[NIMSDK sharedSDK].conversationManager markAllMessagesReadInSession:self.session];
|
||||||
|
|
||||||
[self.presenter getChatLimitReceiverUid:self.session.sessionId];
|
[self.presenter getChatLimitReceiverUid:self.session.sessionId];
|
||||||
|
[self.presenter getUserInfo:self.session.sessionId];
|
||||||
|
self.sessionNavView.userId = self.session.sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - MessageProtocol
|
#pragma mark - MessageProtocol
|
||||||
@@ -175,14 +188,27 @@
|
|||||||
///获取用户信息成功
|
///获取用户信息成功
|
||||||
- (void)onGetSessionUserInfoSuccess:(UserInfoModel *)userInfo {
|
- (void)onGetSessionUserInfoSuccess:(UserInfoModel *)userInfo {
|
||||||
_userInfo = userInfo;
|
_userInfo = userInfo;
|
||||||
|
if (userInfo.nick.length > 0) {
|
||||||
|
self.sessionNavView.title = userInfo.nick;
|
||||||
|
}
|
||||||
if (userInfo.roomUid) {
|
if (userInfo.roomUid) {
|
||||||
self.followInRoomView.hidden = NO;
|
self.followInRoomView.hidden = NO;
|
||||||
self.followInRoomView.userInfo = userInfo;
|
self.followInRoomView.userInfo = userInfo;
|
||||||
[self.sessionTableView mas_updateConstraints:^(MASConstraintMaker *make) {
|
[self.sessionTableView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||||
make.top.mas_equalTo(self.view).mas_offset(80);
|
make.top.mas_equalTo(self.sessionNavView.mas_bottom).mas_offset(80);
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)getFansLikeSuccess:(BOOL)isLike {
|
||||||
|
self.sessionNavView.isLike = isLike;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)attentionUserSuccess:(NSString *)uid {
|
||||||
|
if ([uid isEqualToString:self.session.sessionId]) {
|
||||||
|
self.sessionNavView.isLike = YES;
|
||||||
|
}
|
||||||
|
}
|
||||||
#pragma mark - MessageCellDelegate
|
#pragma mark - MessageCellDelegate
|
||||||
- (void)updateMessageSuccess:(NIMMessage *)message {
|
- (void)updateMessageSuccess:(NIMMessage *)message {
|
||||||
if ([message.session.sessionId isEqualToString:self.session.sessionId]) {
|
if ([message.session.sessionId isEqualToString:self.session.sessionId]) {
|
||||||
@@ -190,6 +216,29 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)didTapAvatar:(NSString *)uid {
|
||||||
|
if (uid.length > 0) {
|
||||||
|
XPMineUserInfoViewController * infoVC = [[XPMineUserInfoViewController alloc] init];
|
||||||
|
infoVC.uid = uid.integerValue;
|
||||||
|
[self.navigationController pushViewController:infoVC animated:YES];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - SessionNavViewDelegate
|
||||||
|
- (void)sessionNavView:(SessionNavView *)view didClickLike:(UIButton *)sender {
|
||||||
|
[self.presenter attentionUser:self.session.sessionId];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)sessionNavView:(SessionNavView *)view didClickBack:(UIButton *)sender {
|
||||||
|
[self.navigationController popViewControllerAnimated:YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)sessionNavView:(SessionNavView *)view didClickReport:(UIButton *)sender {
|
||||||
|
SessionInfoViewController * reportVC = [[SessionInfoViewController alloc] init];
|
||||||
|
reportVC.userId = self.session.sessionId;
|
||||||
|
[self.navigationController pushViewController:reportVC animated:YES];
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - UITableViewDataSource
|
#pragma mark - UITableViewDataSource
|
||||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
||||||
return 1;
|
return 1;
|
||||||
@@ -412,4 +461,12 @@
|
|||||||
return _toolbarView;
|
return _toolbarView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (SessionNavView *)sessionNavView {
|
||||||
|
if (!_sessionNavView) {
|
||||||
|
_sessionNavView = [[SessionNavView alloc] init];
|
||||||
|
_sessionNavView.delegate = self;
|
||||||
|
}
|
||||||
|
return _sessionNavView;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
Reference in New Issue
Block a user