创建消息好友列表
This commit is contained in:
@@ -212,6 +212,7 @@
|
|||||||
8CD77FFB2B3272CA00F4CFF3 /* MewAlertPopup.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CD77FFA2B3272CA00F4CFF3 /* MewAlertPopup.m */; };
|
8CD77FFB2B3272CA00F4CFF3 /* MewAlertPopup.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CD77FFA2B3272CA00F4CFF3 /* MewAlertPopup.m */; };
|
||||||
8CD77FFF2B32832C00F4CFF3 /* MewAlertModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CD77FFE2B32832C00F4CFF3 /* MewAlertModel.m */; };
|
8CD77FFF2B32832C00F4CFF3 /* MewAlertModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CD77FFE2B32832C00F4CFF3 /* MewAlertModel.m */; };
|
||||||
8CD780032B32B72300F4CFF3 /* MewMineFriendTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CD780022B32B72300F4CFF3 /* MewMineFriendTableViewCell.m */; };
|
8CD780032B32B72300F4CFF3 /* MewMineFriendTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CD780022B32B72300F4CFF3 /* MewMineFriendTableViewCell.m */; };
|
||||||
|
8CD780072B3379C800F4CFF3 /* MewCATransitionAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CD780062B3379C800F4CFF3 /* MewCATransitionAnimation.m */; };
|
||||||
FFDAAB800AD6BB4653B4427F /* Pods_yinmeng_ios.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1797344FB85F47F60D0CC2A0 /* Pods_yinmeng_ios.framework */; };
|
FFDAAB800AD6BB4653B4427F /* Pods_yinmeng_ios.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1797344FB85F47F60D0CC2A0 /* Pods_yinmeng_ios.framework */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
@@ -657,6 +658,8 @@
|
|||||||
8CD77FFE2B32832C00F4CFF3 /* MewAlertModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MewAlertModel.m; sourceTree = "<group>"; };
|
8CD77FFE2B32832C00F4CFF3 /* MewAlertModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MewAlertModel.m; sourceTree = "<group>"; };
|
||||||
8CD780012B32B72300F4CFF3 /* MewMineFriendTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MewMineFriendTableViewCell.h; sourceTree = "<group>"; };
|
8CD780012B32B72300F4CFF3 /* MewMineFriendTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MewMineFriendTableViewCell.h; sourceTree = "<group>"; };
|
||||||
8CD780022B32B72300F4CFF3 /* MewMineFriendTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MewMineFriendTableViewCell.m; sourceTree = "<group>"; };
|
8CD780022B32B72300F4CFF3 /* MewMineFriendTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MewMineFriendTableViewCell.m; sourceTree = "<group>"; };
|
||||||
|
8CD780052B3379C800F4CFF3 /* MewCATransitionAnimation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MewCATransitionAnimation.h; sourceTree = "<group>"; };
|
||||||
|
8CD780062B3379C800F4CFF3 /* MewCATransitionAnimation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MewCATransitionAnimation.m; sourceTree = "<group>"; };
|
||||||
A22C3BCB2715A2E8FDECEA30 /* Pods-yinmeng-ios.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-yinmeng-ios.release.xcconfig"; path = "Target Support Files/Pods-yinmeng-ios/Pods-yinmeng-ios.release.xcconfig"; sourceTree = "<group>"; };
|
A22C3BCB2715A2E8FDECEA30 /* Pods-yinmeng-ios.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-yinmeng-ios.release.xcconfig"; path = "Target Support Files/Pods-yinmeng-ios/Pods-yinmeng-ios.release.xcconfig"; sourceTree = "<group>"; };
|
||||||
E9E8A33E3FDD457C53D1E6D7 /* Pods-yinmeng-ios.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-yinmeng-ios.debug.xcconfig"; path = "Target Support Files/Pods-yinmeng-ios/Pods-yinmeng-ios.debug.xcconfig"; sourceTree = "<group>"; };
|
E9E8A33E3FDD457C53D1E6D7 /* Pods-yinmeng-ios.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-yinmeng-ios.debug.xcconfig"; path = "Target Support Files/Pods-yinmeng-ios/Pods-yinmeng-ios.debug.xcconfig"; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
@@ -1214,6 +1217,7 @@
|
|||||||
237054422B1F3B3200F5DE14 /* Tool */ = {
|
237054422B1F3B3200F5DE14 /* Tool */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
8CD780042B33799C00F4CFF3 /* CATransitionAnimation */,
|
||||||
8CD77FF82B32727800F4CFF3 /* MewAlertView */,
|
8CD77FF82B32727800F4CFF3 /* MewAlertView */,
|
||||||
237054432B1F3B3200F5DE14 /* YYUtility */,
|
237054432B1F3B3200F5DE14 /* YYUtility */,
|
||||||
237054492B1F3B3200F5DE14 /* UIImage */,
|
237054492B1F3B3200F5DE14 /* UIImage */,
|
||||||
@@ -2226,6 +2230,15 @@
|
|||||||
path = Model;
|
path = Model;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
8CD780042B33799C00F4CFF3 /* CATransitionAnimation */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
8CD780052B3379C800F4CFF3 /* MewCATransitionAnimation.h */,
|
||||||
|
8CD780062B3379C800F4CFF3 /* MewCATransitionAnimation.m */,
|
||||||
|
);
|
||||||
|
path = CATransitionAnimation;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
B603F71B608343F0E1A79C4B /* Frameworks */ = {
|
B603F71B608343F0E1A79C4B /* Frameworks */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@@ -2407,6 +2420,7 @@
|
|||||||
237053F22B1F3B1700F5DE14 /* MewConstant.m in Sources */,
|
237053F22B1F3B1700F5DE14 /* MewConstant.m in Sources */,
|
||||||
237054DE2B204C4E00F5DE14 /* MewUserVipInfoVo.m in Sources */,
|
237054DE2B204C4E00F5DE14 /* MewUserVipInfoVo.m in Sources */,
|
||||||
237054AD2B1F3B3200F5DE14 /* YYReachability.m in Sources */,
|
237054AD2B1F3B3200F5DE14 /* YYReachability.m in Sources */,
|
||||||
|
8CD780072B3379C800F4CFF3 /* MewCATransitionAnimation.m in Sources */,
|
||||||
237054DB2B204ADE00F5DE14 /* MewUserInfoModel.m in Sources */,
|
237054DB2B204ADE00F5DE14 /* MewUserInfoModel.m in Sources */,
|
||||||
8C9C843A2B0C697A00A601BC /* MewBaseRtcImpl.m in Sources */,
|
8C9C843A2B0C697A00A601BC /* MewBaseRtcImpl.m in Sources */,
|
||||||
8CD77FE82B3211C800F4CFF3 /* MewSessionFanPartyModel.m in Sources */,
|
8CD77FE82B3211C800F4CFF3 /* MewSessionFanPartyModel.m in Sources */,
|
||||||
|
@@ -0,0 +1,23 @@
|
|||||||
|
//
|
||||||
|
// MewCATransitionAnimation.h
|
||||||
|
// yinmeng-ios
|
||||||
|
//
|
||||||
|
// Created by 触海 on 2023/12/20.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface MewCATransitionAnimation : NSObject
|
||||||
|
|
||||||
|
@property (nonatomic, strong, readonly) CATransition *transition;
|
||||||
|
|
||||||
|
/// 初始化
|
||||||
|
+ (MewCATransitionAnimation *)Mew_TranstionAnimationDuration:(CFTimeInterval)duration
|
||||||
|
timing:(CAMediaTimingFunctionName)timing
|
||||||
|
type:(CATransitionType)type subType:(CATransitionSubtype)subType;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,47 @@
|
|||||||
|
//
|
||||||
|
// MewCATransitionAnimation.m
|
||||||
|
// yinmeng-ios
|
||||||
|
//
|
||||||
|
// Created by 触海 on 2023/12/20.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "MewCATransitionAnimation.h"
|
||||||
|
|
||||||
|
@interface MewCATransitionAnimation()
|
||||||
|
@property (nonatomic, strong) CATransition *_transtion;
|
||||||
|
@property (nonatomic, assign) CFTimeInterval duration;
|
||||||
|
@property (nonatomic, assign) CATransitionType type;
|
||||||
|
@property (nonatomic, assign) CATransitionSubtype subType;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation MewCATransitionAnimation
|
||||||
|
|
||||||
|
/// 初始化
|
||||||
|
+ (MewCATransitionAnimation *)Mew_TranstionAnimationDuration:(CFTimeInterval)duration
|
||||||
|
timing:(CAMediaTimingFunctionName)timing
|
||||||
|
type:(CATransitionType)type subType:(CATransitionSubtype)subType {
|
||||||
|
MewCATransitionAnimation *animation = [[MewCATransitionAnimation alloc] init];
|
||||||
|
animation.duration = duration;
|
||||||
|
animation.type = type;
|
||||||
|
animation.subType = subType;
|
||||||
|
animation._transtion = [animation transtionAnimationWithName:timing];
|
||||||
|
return animation;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#pragma mark - Get
|
||||||
|
- (CATransition *)transition {
|
||||||
|
return __transtion;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - Private Method
|
||||||
|
/// 创建CATransition
|
||||||
|
- (CATransition *)transtionAnimationWithName:(CAMediaTimingFunctionName)timingName {
|
||||||
|
CATransition *transition = [CATransition animation];
|
||||||
|
transition.duration = self.duration;
|
||||||
|
transition.timingFunction = [CAMediaTimingFunction functionWithName:timingName];
|
||||||
|
transition.type = self.type;
|
||||||
|
transition.subtype = self.subType;
|
||||||
|
return transition;
|
||||||
|
}
|
||||||
|
@end
|
@@ -8,13 +8,17 @@
|
|||||||
#import "MewBaseViewController.h"
|
#import "MewBaseViewController.h"
|
||||||
#import "MewEnum.h"
|
#import "MewEnum.h"
|
||||||
#import <JXCategoryView/JXCategoryView.h>
|
#import <JXCategoryView/JXCategoryView.h>
|
||||||
|
@class MewUserInfoModel;
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
typedef void(^didSelectFriendClouseEvent)(MewUserInfoModel *userInfo);
|
||||||
@interface MewMessageFriendViewController : MewBaseViewController<JXCategoryListContentViewDelegate>
|
@interface MewMessageFriendViewController : MewBaseViewController<JXCategoryListContentViewDelegate>
|
||||||
|
|
||||||
/// 初始化
|
/// 分享好友
|
||||||
- (instancetype)initWithOpenMessageType:(MewOpenFriendType)type;
|
@property (nonatomic, weak) didSelectFriendClouseEvent gotoShareFriendComplted;
|
||||||
|
@property (nonatomic, assign) MewOpenFriendType friendType;
|
||||||
|
@property (nonatomic, strong) UIViewController *currentViewController;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
/// View
|
/// View
|
||||||
#import "MewEmptyTableViewCell.h"
|
#import "MewEmptyTableViewCell.h"
|
||||||
#import "MewMineFriendTableViewCell.h"
|
#import "MewMineFriendTableViewCell.h"
|
||||||
|
#import "MewSessionViewController.h"
|
||||||
/// Net
|
/// Net
|
||||||
#import "Api+Mine.h"
|
#import "Api+Mine.h"
|
||||||
/// Third
|
/// Third
|
||||||
@@ -18,6 +19,7 @@
|
|||||||
#import "NSArray+MewSafe.h"
|
#import "NSArray+MewSafe.h"
|
||||||
#import "MewEnum.h"
|
#import "MewEnum.h"
|
||||||
#import "MewMacro.h"
|
#import "MewMacro.h"
|
||||||
|
#import "MewCATransitionAnimation.h"
|
||||||
|
|
||||||
@interface MewMessageFriendViewController ()<UITableViewDelegate, UITableViewDataSource>
|
@interface MewMessageFriendViewController ()<UITableViewDelegate, UITableViewDataSource>
|
||||||
|
|
||||||
@@ -29,26 +31,22 @@
|
|||||||
@property (nonatomic, assign) NSInteger page;
|
@property (nonatomic, assign) NSInteger page;
|
||||||
/** 是否有更多数据 */
|
/** 是否有更多数据 */
|
||||||
@property (nonatomic, assign) BOOL hasMoreData;
|
@property (nonatomic, assign) BOOL hasMoreData;
|
||||||
@property (nonatomic, assign) MewOpenMessageType friendType;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation MewMessageFriendViewController
|
@implementation MewMessageFriendViewController
|
||||||
|
|
||||||
|
- (BOOL)mew_isHiddenNavBar {
|
||||||
|
return self.friendType != Mew_OpenFriendType_Share;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - Life Cycle
|
#pragma mark - Life Cycle
|
||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
self.view.backgroundColor = UIColor.redColor;
|
[self loadFriendUids];
|
||||||
}
|
[self loadRequestUserInfos];
|
||||||
|
|
||||||
#pragma mark - Init
|
|
||||||
- (instancetype)initWithOpenMessageType:(MewOpenFriendType)type {
|
|
||||||
self = [super init];
|
|
||||||
if (self) {
|
|
||||||
[self setUI];
|
[self setUI];
|
||||||
}
|
}
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - Load Data
|
#pragma mark - Load Data
|
||||||
- (void)loadFriendUids {
|
- (void)loadFriendUids {
|
||||||
@@ -64,10 +62,10 @@
|
|||||||
if (self.friendUids.count == 0) return;
|
if (self.friendUids.count == 0) return;
|
||||||
|
|
||||||
NSString *uidStrings = [self.friendUids componentsJoinedByString:@","];
|
NSString *uidStrings = [self.friendUids componentsJoinedByString:@","];
|
||||||
[Api Mew_GetUserInfos:uidStrings completion:^(MewBaseModel * _Nonnull data, NSInteger code, NSString * _Nonnull msg) {
|
[Api Mew_GetUserInfos:^(MewBaseModel * _Nonnull data, NSInteger code, NSString * _Nonnull msg) {
|
||||||
self.friendModels = [MewUserInfoModel mewModelsWithArray:data.data];
|
self.friendModels = [MewUserInfoModel mewModelsWithArray:data.data];
|
||||||
[self.friendTableView reloadData];
|
[self.friendTableView reloadData];
|
||||||
}];
|
} uids:uidStrings];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - UITableViewDelegate, UITableViewDataSource
|
#pragma mark - UITableViewDelegate, UITableViewDataSource
|
||||||
@@ -91,6 +89,32 @@
|
|||||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
if (self.friendModels.count == 0) return;
|
if (self.friendModels.count == 0) return;
|
||||||
|
|
||||||
|
MewUserInfoModel *model = [self.friendModels mewSafeObjectAtIndex:indexPath.row];
|
||||||
|
|
||||||
|
// 分享好友
|
||||||
|
if (self.friendType == Mew_OpenFriendType_Share && self.gotoShareFriendComplted) {
|
||||||
|
self.gotoShareFriendComplted(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NIMSession *session = [NIMSession session:[NSString stringWithFormat:@"%ld", model.uid] type:NIMSessionTypeP2P];
|
||||||
|
MewSessionViewController *controller = [[MewSessionViewController alloc] initWithSession:session];
|
||||||
|
// 消息中心选中好友
|
||||||
|
if (self.friendType == Mew_OpenFriendType_Normal) {
|
||||||
|
controller.openType = Mew_OpenMessageType_Normal;
|
||||||
|
[self.navigationController pushViewController:controller animated:YES];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 房间内选中好友
|
||||||
|
if (self.friendType == Mew_OpenFriendType_In_Room) {
|
||||||
|
controller.openType = Mew_OpenMessageType_In_Room;
|
||||||
|
CATransition *transition = [MewCATransitionAnimation Mew_TranstionAnimationDuration:0.3f timing:kCAMediaTimingFunctionEaseInEaseOut type:kCATransitionPush subType:kCATransitionFromRight].transition;
|
||||||
|
[self.currentViewController.view.layer addAnimation:transition forKey:nil];
|
||||||
|
[self.currentViewController addChildViewController:controller];
|
||||||
|
[self.currentViewController.view addSubview:controller.view];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -14,9 +14,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@interface MewMessageSessionViewController : MewBaseViewController<JXCategoryListContentViewDelegate>
|
@interface MewMessageSessionViewController : MewBaseViewController<JXCategoryListContentViewDelegate>
|
||||||
|
|
||||||
/// 初始化
|
|
||||||
- (instancetype)initWithSessionType:(MewOpenMessageType)type;
|
|
||||||
|
|
||||||
|
@property (nonatomic, assign) MewOpenMessageType messageType;
|
||||||
/// 当前控制器,因为房间内聊天没有控制器去 push 或者做其他的操作
|
/// 当前控制器,因为房间内聊天没有控制器去 push 或者做其他的操作
|
||||||
@property (nonatomic, weak) UIViewController *currentController;
|
@property (nonatomic, weak) UIViewController *currentController;
|
||||||
|
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
#import "NSArray+MewSafe.h"
|
#import "NSArray+MewSafe.h"
|
||||||
#import "MewTimeIntervalUtils.h"
|
#import "MewTimeIntervalUtils.h"
|
||||||
#import "MewAlertPopup.h"
|
#import "MewAlertPopup.h"
|
||||||
|
#import "MewCATransitionAnimation.h"
|
||||||
/// View
|
/// View
|
||||||
#import "MewMessageSessionHeaderView.h"
|
#import "MewMessageSessionHeaderView.h"
|
||||||
#import "MewYoungerView.h"
|
#import "MewYoungerView.h"
|
||||||
@@ -32,7 +33,6 @@
|
|||||||
|
|
||||||
@interface MewMessageSessionViewController () <UITableViewDelegate, UITableViewDataSource, MewMessageSessionHeaderViewDelegate,
|
@interface MewMessageSessionViewController () <UITableViewDelegate, UITableViewDataSource, MewMessageSessionHeaderViewDelegate,
|
||||||
NIMLoginManagerDelegate, NIMConversationManagerDelegate>
|
NIMLoginManagerDelegate, NIMConversationManagerDelegate>
|
||||||
@property (nonatomic, assign) MewOpenMessageType type;
|
|
||||||
|
|
||||||
/**会话头部视图**/
|
/**会话头部视图**/
|
||||||
@property (nonatomic, strong) MewMessageSessionHeaderView *sessionHeaderView;
|
@property (nonatomic, strong) MewMessageSessionHeaderView *sessionHeaderView;
|
||||||
@@ -66,31 +66,22 @@
|
|||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
self.view.backgroundColor = UIColor.whiteColor;
|
self.view.backgroundColor = UIColor.whiteColor;
|
||||||
|
[self addNIMNoti];
|
||||||
|
[[NIMSDKConfig sharedConfig] setShouldSyncStickTopSessionInfos:YES];
|
||||||
|
[self loadRequestSessionDatas];
|
||||||
|
[self setUI];
|
||||||
|
[self setUIConstraints];
|
||||||
[self loadRequestUserInfoModel];
|
[self loadRequestUserInfoModel];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewDidAppear:(BOOL)animated {
|
- (void)viewDidAppear:(BOOL)animated {
|
||||||
[super viewDidAppear:animated];
|
[super viewDidAppear:animated];
|
||||||
if (self.type != Mew_OpenMessageType_Normal) { return; }
|
if (self.messageType != Mew_OpenMessageType_Normal) { return; }
|
||||||
[self loadRequestFansPartyModel];
|
[self loadRequestFansPartyModel];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Init
|
|
||||||
- (instancetype)initWithSessionType:(MewOpenMessageType)type {
|
|
||||||
self = [super init];
|
|
||||||
if (self) {
|
|
||||||
self.type = type;
|
|
||||||
[self addNIMNoti];
|
|
||||||
[[NIMSDKConfig sharedConfig] setShouldSyncStickTopSessionInfos:YES];
|
|
||||||
[self loadRequestSessionDatas];
|
|
||||||
[self setUI];
|
|
||||||
[self setUIConstraints];
|
|
||||||
|
|
||||||
}
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - Public Method
|
#pragma mark - Public Method
|
||||||
/// 已读全部信息
|
/// 已读全部信息
|
||||||
@@ -115,12 +106,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
NSArray<NIMRecentSession *> *allRecentSessions = [NIMSDK sharedSDK].conversationManager.allRecentSessions;
|
NSArray<NIMRecentSession *> *allRecentSessions = [NIMSDK sharedSDK].conversationManager.allRecentSessions;
|
||||||
// NSMutableArray<NSString *> *uidArray = [NSMutableArray array];
|
|
||||||
NSMutableArray<NIMRecentSession *> *sessionArray = [NSMutableArray array];
|
NSMutableArray<NIMRecentSession *> *sessionArray = [NSMutableArray array];
|
||||||
__block int unreadCount = 0;
|
__block int unreadCount = 0;
|
||||||
[allRecentSessions enumerateObjectsUsingBlock:^(NIMRecentSession * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
[allRecentSessions enumerateObjectsUsingBlock:^(NIMRecentSession * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||||
BOOL isContainerOffice = [[MewClientConfig shareConfig] mew_isContainerOfficeMsgUid:obj.session.sessionId];
|
BOOL isContainerOffice = [[MewClientConfig shareConfig] mew_isContainerOfficeMsgUid:obj.session.sessionId];
|
||||||
if (self.type == Mew_OpenMessageType_Normal && isContainerOffice) {
|
if (self.messageType == Mew_OpenMessageType_Normal && isContainerOffice) {
|
||||||
[self.sessionHeaderView mew_updateBadgeViewWithSessionId:obj.session.sessionId unreadCount:obj.unreadCount];
|
[self.sessionHeaderView mew_updateBadgeViewWithSessionId:obj.session.sessionId unreadCount:obj.unreadCount];
|
||||||
} else {
|
} else {
|
||||||
if (obj.session.sessionId.integerValue > 0) {
|
if (obj.session.sessionId.integerValue > 0) {
|
||||||
@@ -154,7 +144,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)loadRequestFansPartyModel {
|
- (void)loadRequestFansPartyModel {
|
||||||
if (self.type == Mew_OpenMessageType_In_Room) { return; }
|
if (self.messageType == Mew_OpenMessageType_In_Room) { return; }
|
||||||
[Api Mew_RequestFansParty:^(MewBaseModel * _Nonnull data, NSInteger code, NSString * _Nonnull msg) {
|
[Api Mew_RequestFansParty:^(MewBaseModel * _Nonnull data, NSInteger code, NSString * _Nonnull msg) {
|
||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
NSArray<MewSessionFanPartyModel *> *fans = [MewSessionFanPartyModel mewModelsWithArray:data.data];
|
NSArray<MewSessionFanPartyModel *> *fans = [MewSessionFanPartyModel mewModelsWithArray:data.data];
|
||||||
@@ -190,15 +180,11 @@
|
|||||||
|
|
||||||
NIMRecentSession *selectSession = [self.recentSessions mewSafeObjectAtIndex:indexPath.row];
|
NIMRecentSession *selectSession = [self.recentSessions mewSafeObjectAtIndex:indexPath.row];
|
||||||
MewSessionViewController *controller = [[MewSessionViewController alloc] initWithSession:selectSession.session];
|
MewSessionViewController *controller = [[MewSessionViewController alloc] initWithSession:selectSession.session];
|
||||||
controller.openType = self.type;
|
controller.openType = self.messageType;
|
||||||
if (self.type == Mew_OpenMessageType_Normal) {
|
if (self.messageType == Mew_OpenMessageType_Normal) {
|
||||||
[self.navigationController pushViewController:controller animated:YES];
|
[self.navigationController pushViewController:controller animated:YES];
|
||||||
} else {
|
} else {
|
||||||
CATransition *transition = [CATransition animation];
|
CATransition *transition = [MewCATransitionAnimation Mew_TranstionAnimationDuration:0.3f timing:kCAMediaTimingFunctionEaseInEaseOut type:kCATransitionPush subType:kCATransitionFromRight].transition;
|
||||||
transition.duration = 0.3f;
|
|
||||||
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
|
|
||||||
transition.type = kCATransitionPush;
|
|
||||||
transition.subtype = kCATransitionFromRight;
|
|
||||||
[self.currentController.view.layer addAnimation:transition forKey:nil];
|
[self.currentController.view.layer addAnimation:transition forKey:nil];
|
||||||
[self.currentController.view addSubview:controller.view];
|
[self.currentController.view addSubview:controller.view];
|
||||||
[self.currentController addChildViewController:controller];
|
[self.currentController addChildViewController:controller];
|
||||||
@@ -223,7 +209,7 @@
|
|||||||
/// 添加最近会话
|
/// 添加最近会话
|
||||||
- (void)didAddRecentSession:(NIMRecentSession *)recentSession totalUnreadCount:(NSInteger)totalUnreadCount {
|
- (void)didAddRecentSession:(NIMRecentSession *)recentSession totalUnreadCount:(NSInteger)totalUnreadCount {
|
||||||
BOOL isContainerOffice = [[MewClientConfig shareConfig] mew_isContainerOfficeMsgUid:recentSession.session.sessionId];
|
BOOL isContainerOffice = [[MewClientConfig shareConfig] mew_isContainerOfficeMsgUid:recentSession.session.sessionId];
|
||||||
if (self.type != Mew_OpenMessageType_In_Room && isContainerOffice) {
|
if (self.messageType != Mew_OpenMessageType_In_Room && isContainerOffice) {
|
||||||
[self.sessionHeaderView mew_updateBadgeViewWithSessionId:recentSession.session.sessionId unreadCount:recentSession.unreadCount];
|
[self.sessionHeaderView mew_updateBadgeViewWithSessionId:recentSession.session.sessionId unreadCount:recentSession.unreadCount];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -246,7 +232,7 @@
|
|||||||
- (void)didUpdateRecentSession:(NIMRecentSession *)recentSession totalUnreadCount:(NSInteger)totalUnreadCount {
|
- (void)didUpdateRecentSession:(NIMRecentSession *)recentSession totalUnreadCount:(NSInteger)totalUnreadCount {
|
||||||
NSString *sessionId = recentSession.session.sessionId;
|
NSString *sessionId = recentSession.session.sessionId;
|
||||||
BOOL isContainer = [[MewClientConfig shareConfig] mew_isContainerOfficeMsgUid:sessionId];
|
BOOL isContainer = [[MewClientConfig shareConfig] mew_isContainerOfficeMsgUid:sessionId];
|
||||||
if (self.type != Mew_OpenMessageType_In_Room && isContainer) {
|
if (self.messageType != Mew_OpenMessageType_In_Room && isContainer) {
|
||||||
[self.sessionHeaderView mew_updateBadgeViewWithSessionId:sessionId unreadCount:recentSession.unreadCount];
|
[self.sessionHeaderView mew_updateBadgeViewWithSessionId:sessionId unreadCount:recentSession.unreadCount];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -348,7 +334,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
NSString *badgeString = badge > 0 ? [NSString stringWithFormat:@"%ld", badge] : nil;
|
NSString *badgeString = badge > 0 ? [NSString stringWithFormat:@"%ld", badge] : nil;
|
||||||
[self.tabBarController.tabBar.items[3] setBadgeValue:badgeString];
|
NSInteger itemCount = self.tabBarController.tabBar.items.count;
|
||||||
|
NSInteger messageIndex = itemCount > 3 ? itemCount - 2 : itemCount - 1;
|
||||||
|
[self.tabBarController.tabBar.items[messageIndex] setBadgeValue:badgeString];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 找到重新插入最近消息的index
|
/// 找到重新插入最近消息的index
|
||||||
@@ -401,7 +389,7 @@
|
|||||||
- (void)setUI {
|
- (void)setUI {
|
||||||
[self.view addSubview:self.sessionListTableView];
|
[self.view addSubview:self.sessionListTableView];
|
||||||
|
|
||||||
if (self.type == Mew_OpenMessageType_In_Room) { return; }
|
if (self.messageType == Mew_OpenMessageType_In_Room) { return; }
|
||||||
self.view.backgroundColor = UIColor.clearColor;
|
self.view.backgroundColor = UIColor.clearColor;
|
||||||
[self.view addSubview:self.sessionHeaderView];
|
[self.view addSubview:self.sessionHeaderView];
|
||||||
}
|
}
|
||||||
@@ -410,14 +398,14 @@
|
|||||||
- (void)setUIConstraints {
|
- (void)setUIConstraints {
|
||||||
[self.sessionListTableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.sessionListTableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.left.right.bottom.mas_equalTo(self.view);
|
make.left.right.bottom.mas_equalTo(self.view);
|
||||||
if (self.type == Mew_OpenMessageType_Normal) {
|
if (self.messageType == Mew_OpenMessageType_Normal) {
|
||||||
make.top.mas_equalTo(self.sessionHeaderView.mas_bottom);
|
make.top.mas_equalTo(self.sessionHeaderView.mas_bottom);
|
||||||
} else {
|
} else {
|
||||||
make.top.mas_equalTo(self.view);
|
make.top.mas_equalTo(self.view);
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
|
|
||||||
if (self.type == Mew_OpenMessageType_In_Room) { return; }
|
if (self.messageType == Mew_OpenMessageType_In_Room) { return; }
|
||||||
[self.sessionHeaderView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.sessionHeaderView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.left.right.mas_equalTo(0);
|
make.left.right.mas_equalTo(0);
|
||||||
make.top.mas_equalTo(8);
|
make.top.mas_equalTo(8);
|
||||||
@@ -464,6 +452,4 @@
|
|||||||
return _sessionHeaderView;
|
return _sessionHeaderView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@@ -46,12 +46,9 @@
|
|||||||
[self setUI];
|
[self setUI];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - JXCategoryListContainerViewDelegate
|
#pragma mark - JXCategoryListContainerViewDelegate
|
||||||
- (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView {
|
- (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView {
|
||||||
return self.navTitleView.titles.count;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index {
|
- (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index {
|
||||||
@@ -60,7 +57,6 @@
|
|||||||
} else {
|
} else {
|
||||||
return self.friendController;
|
return self.friendController;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -96,7 +92,8 @@
|
|||||||
|
|
||||||
[self.listContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.listContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.top.mas_equalTo(self.navTitleView.mas_bottom);
|
make.top.mas_equalTo(self.navTitleView.mas_bottom);
|
||||||
make.left.right.bottom.mas_equalTo(0);
|
make.left.right.mas_equalTo(0);
|
||||||
|
make.bottom.mas_equalTo(0);
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[self.allReadButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.allReadButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
@@ -127,6 +124,7 @@
|
|||||||
return _navTitleView;
|
return _navTitleView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (JXCategoryListContainerView *)listContainerView {
|
- (JXCategoryListContainerView *)listContainerView {
|
||||||
if (!_listContainerView) {
|
if (!_listContainerView) {
|
||||||
_listContainerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self];
|
_listContainerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self];
|
||||||
@@ -139,7 +137,7 @@
|
|||||||
|
|
||||||
- (MewMessageSessionViewController *)sessionController {
|
- (MewMessageSessionViewController *)sessionController {
|
||||||
if (!_sessionController) {
|
if (!_sessionController) {
|
||||||
_sessionController = [[MewMessageSessionViewController alloc] initWithSessionType:Mew_OpenMessageType_Normal];
|
_sessionController = [[MewMessageSessionViewController alloc] init];
|
||||||
}
|
}
|
||||||
return _sessionController;
|
return _sessionController;
|
||||||
}
|
}
|
||||||
|
@@ -13,7 +13,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@interface MewMineFriendTableViewCell : UITableViewCell
|
@interface MewMineFriendTableViewCell : UITableViewCell
|
||||||
/// 用户信息
|
/// 用户信息
|
||||||
@property (nonatomic, strong) MewUserInfoModel *userInfo;
|
@property (nonatomic, strong) MewUserInfoModel *userInfo;
|
||||||
|
/// 是否在房间内
|
||||||
|
@property (nonatomic, assign, getter=isInRoom) BOOL inRoom;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@@ -6,6 +6,32 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "MewMineFriendTableViewCell.h"
|
#import "MewMineFriendTableViewCell.h"
|
||||||
|
/// View
|
||||||
|
#import "NetImageView.h"
|
||||||
|
/// Tool
|
||||||
|
#import "MewThemeColor.h"
|
||||||
|
#import "MewMacro.h"
|
||||||
|
|
||||||
|
|
||||||
|
@interface MewMineFriendTableViewCell()
|
||||||
|
//头像
|
||||||
|
@property (nonatomic, strong) NetImageView *iconImageView;
|
||||||
|
//水平容器
|
||||||
|
@property (nonatomic, strong) UIStackView *horStackView;
|
||||||
|
//昵称
|
||||||
|
@property (nonatomic, strong) UILabel *nickNameLabel;
|
||||||
|
//性别
|
||||||
|
@property (nonatomic, strong) UIImageView *generImageView;
|
||||||
|
//等级
|
||||||
|
@property (nonatomic, strong) NetImageView *levelImageView;
|
||||||
|
//魅力等级
|
||||||
|
@property (nonatomic, strong) NetImageView *charmLevelImageView;
|
||||||
|
//签名
|
||||||
|
@property (nonatomic, strong) UILabel *personSignLabel;
|
||||||
|
// 分割线
|
||||||
|
@property (nonatomic, strong) UIView *lineView;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation MewMineFriendTableViewCell
|
@implementation MewMineFriendTableViewCell
|
||||||
|
|
||||||
@@ -23,6 +49,80 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - Get
|
||||||
|
- (NetImageView *)iconImageView {
|
||||||
|
if (!_iconImageView) {
|
||||||
|
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||||
|
config.imageType = ImageTypeUserIcon;
|
||||||
|
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||||
|
_iconImageView = [[NetImageView alloc] initWithConfig:config];
|
||||||
|
_iconImageView.layer.masksToBounds = YES;
|
||||||
|
_iconImageView.layer.cornerRadius = 55/2;
|
||||||
|
}
|
||||||
|
return _iconImageView;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UIStackView *)horStackView {
|
||||||
|
if (!_horStackView) {
|
||||||
|
_horStackView = [[UIStackView alloc] init];
|
||||||
|
_horStackView.axis = UILayoutConstraintAxisHorizontal;
|
||||||
|
_horStackView.distribution = UIStackViewDistributionFill;
|
||||||
|
_horStackView.alignment = UIStackViewAlignmentCenter;
|
||||||
|
_horStackView.spacing = 10;
|
||||||
|
}
|
||||||
|
return _horStackView;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UILabel *)nickNameLabel {
|
||||||
|
if (!_nickNameLabel) {
|
||||||
|
_nickNameLabel = [[UILabel alloc] init];
|
||||||
|
_nickNameLabel.font = kFontRegular(15);
|
||||||
|
_nickNameLabel.textColor = MewThemeColor.mewMainTextColor;
|
||||||
|
}
|
||||||
|
return _nickNameLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UIImageView *)generImageView {
|
||||||
|
if (!_generImageView) {
|
||||||
|
_generImageView = [[UIImageView alloc] init];
|
||||||
|
_generImageView.userInteractionEnabled = YES;
|
||||||
|
}
|
||||||
|
return _generImageView;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NetImageView *)levelImageView {
|
||||||
|
if (!_levelImageView) {
|
||||||
|
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||||
|
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||||
|
_levelImageView = [[NetImageView alloc] initWithConfig:config];
|
||||||
|
}
|
||||||
|
return _levelImageView;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NetImageView *)charmLevelImageView {
|
||||||
|
if (!_charmLevelImageView) {
|
||||||
|
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||||
|
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||||
|
_charmLevelImageView = [[NetImageView alloc] initWithConfig:config];
|
||||||
|
}
|
||||||
|
return _charmLevelImageView;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UILabel *)personSignLabel {
|
||||||
|
if (!_personSignLabel) {
|
||||||
|
_personSignLabel = [[UILabel alloc] init];
|
||||||
|
_personSignLabel.textColor = MewThemeColor.mewSecondTextColor;
|
||||||
|
_personSignLabel.font = kFontRegular(12);
|
||||||
|
}
|
||||||
|
return _personSignLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UIView *)lineView {
|
||||||
|
if (!_lineView) {
|
||||||
|
_lineView = [[UIView alloc] init];
|
||||||
|
_lineView.backgroundColor = MewThemeColor.mewDividerColor;
|
||||||
|
}
|
||||||
|
return _lineView;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@@ -6,13 +6,14 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "MewMvpViewController.h"
|
#import "MewMvpViewController.h"
|
||||||
|
#import "MewEnum.h"
|
||||||
@class NIMSession;
|
@class NIMSession;
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@interface MewSessionViewController : MewMvpViewController
|
@interface MewSessionViewController : MewMvpViewController
|
||||||
|
|
||||||
@property (nonatomic, assign) NSInteger openType;
|
@property (nonatomic, assign) MewOpenMessageType openType;
|
||||||
- (instancetype)initWithSession:(NIMSession *)session;
|
- (instancetype)initWithSession:(NIMSession *)session;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@@ -37,7 +37,6 @@
|
|||||||
|
|
||||||
@interface MewSessionViewController ()<MewSessionToolbarViewDelegate,MewSessionNavViewDelegate,MewSessionMessageCellDelegate,MewMessageProtocol,
|
@interface MewSessionViewController ()<MewSessionToolbarViewDelegate,MewSessionNavViewDelegate,MewSessionMessageCellDelegate,MewMessageProtocol,
|
||||||
UITableViewDelegate, UITableViewDataSource,
|
UITableViewDelegate, UITableViewDataSource,
|
||||||
MewSessionMessageManagerDelegate,
|
|
||||||
NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMMediaManagerDelegate,TZImagePickerControllerDelegate>
|
NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMMediaManagerDelegate,TZImagePickerControllerDelegate>
|
||||||
///导航栏
|
///导航栏
|
||||||
@property (nonatomic,strong) MewSessionNavView *sessionNavView;
|
@property (nonatomic,strong) MewSessionNavView *sessionNavView;
|
||||||
@@ -65,18 +64,12 @@
|
|||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
|
|
||||||
[[NIMManager sharedManager] addNIMListener];
|
self.view.backgroundColor = UIColor.whiteColor;
|
||||||
[[MewSessionMessageManager shared] addProtocol:self];
|
|
||||||
|
|
||||||
|
|
||||||
[self initViews];
|
[self initViews];
|
||||||
|
|
||||||
|
[[NIMSDK sharedSDK].chatManager addDelegate:self];
|
||||||
|
[[NIMSDK sharedSDK].conversationManager addDelegate:self];
|
||||||
self.view.backgroundColor = [UIColor whiteColor];
|
[self mew_initHeaderAndFooterRefresh];
|
||||||
// [[NIMSDK sharedSDK].chatManager addDelegate:self];
|
|
||||||
// [[NIMSDK sharedSDK].conversationManager addDelegate:self];
|
|
||||||
// [self mew_initHeaderAndFooterRefresh];
|
|
||||||
[IQKeyboardManager sharedManager].enable = NO;
|
[IQKeyboardManager sharedManager].enable = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,43 +187,43 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - NIMChatManagerDelegate, NIMMediaManagerDelegate (云信通知回调)
|
#pragma mark - NIMChatManagerDelegate, NIMMediaManagerDelegate (云信通知回调)
|
||||||
- (NIMSession *)getCurrentSession {
|
//- (NIMSession *)getCurrentSession {
|
||||||
return self.session;
|
// return self.session;
|
||||||
}
|
//}
|
||||||
|
|
||||||
- (void)recvMessages:(NSArray<NIMMessage *> *)messages {
|
//- (void)recvMessages:(NSArray<NIMMessage *> *)messages {
|
||||||
// 8714013 7067608
|
//// 8714013 7067608
|
||||||
|
//
|
||||||
NSLog(@"接收到的消息的数据是:%@",messages);
|
// NSLog(@"接收到的消息的数据是:%@",messages);
|
||||||
// [self.messages addObjectsFromArray:messages];
|
//// [self.messages addObjectsFromArray:messages];
|
||||||
self.messages = [messages mutableCopy];
|
// self.messages = [messages mutableCopy];
|
||||||
[self.sessionTableView reloadData];
|
// [self.sessionTableView reloadData];
|
||||||
[self.sessionTableView nim_scrollToBottom:YES];
|
// [self.sessionTableView nim_scrollToBottom:YES];
|
||||||
[[NIMSDK sharedSDK].conversationManager markAllMessagesReadInSession:self.session];
|
// [[NIMSDK sharedSDK].conversationManager markAllMessagesReadInSession:self.session];
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 接收聊天
|
// 接收聊天
|
||||||
//- (void)onRecvMessages:(NSArray<NIMMessage *> *)messages {
|
- (void)onRecvMessages:(NSArray<NIMMessage *> *)messages {
|
||||||
// NIMMessage *message = messages.firstObject;
|
NIMMessage *message = messages.firstObject;
|
||||||
// NIMSession *session = message.session;
|
NIMSession *session = message.session;
|
||||||
// if (![session isEqual:self.session] || !messages.count) {
|
if (![session isEqual:self.session] || !messages.count) {
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
//
|
|
||||||
// for (NIMMessage *message in messages) {
|
for (NIMMessage *message in messages) {
|
||||||
// if (message.isDeleted) {
|
if (message.isDeleted) {
|
||||||
// continue;
|
continue;
|
||||||
// }
|
}
|
||||||
// [self.messages addObject:message];
|
[self.messages addObject:message];
|
||||||
// }
|
}
|
||||||
// [self.sessionTableView reloadData];
|
[self.sessionTableView reloadData];
|
||||||
// [self.sessionTableView nim_scrollToBottom:YES];
|
[self.sessionTableView nim_scrollToBottom:YES];
|
||||||
//
|
|
||||||
// [[NIMSDK sharedSDK].conversationManager markAllMessagesReadInSession:self.session];
|
[[NIMSDK sharedSDK].conversationManager markAllMessagesReadInSession:self.session];
|
||||||
//}
|
}
|
||||||
|
|
||||||
// 发送聊天
|
// 发送聊天
|
||||||
- (void)sendMessage:(NIMMessage *)message didCompleteWithError:(NSError *)error {
|
- (void)sendMessage:(NIMMessage *)message didCompleteWithError:(NSError *)error {
|
||||||
@@ -326,27 +319,27 @@
|
|||||||
|
|
||||||
/// 刷新头部数据
|
/// 刷新头部数据
|
||||||
- (void)mew_headerRefresh {
|
- (void)mew_headerRefresh {
|
||||||
// if (self.messages.count > 0) {
|
if (self.messages.count > 0) {
|
||||||
// [[[NIMSDK sharedSDK] conversationManager] messagesInSession:self.session message:self.messages.firstObject limit:20 completion:^(NSError * _Nullable error, NSArray<NIMMessage *> * _Nullable messages) {
|
[[[NIMSDK sharedSDK] conversationManager] messagesInSession:self.session message:self.messages.firstObject limit:20 completion:^(NSError * _Nullable error, NSArray<NIMMessage *> * _Nullable messages) {
|
||||||
// [self.sessionTableView.mj_header endRefreshing];
|
[self.sessionTableView.mj_header endRefreshing];
|
||||||
// if (error == nil && messages.count > 0) {
|
if (error == nil && messages.count > 0) {
|
||||||
// for (int i = ((int)messages.count - 1); i > 0; i--) {
|
for (int i = ((int)messages.count - 1); i > 0; i--) {
|
||||||
// NIMMessage *message = [messages mewSafeObjectAtIndex:i];
|
NIMMessage *message = [messages mewSafeObjectAtIndex:i];
|
||||||
// [self.messages insertObject:message atIndex:0];
|
[self.messages insertObject:message atIndex:0];
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// [self.sessionTableView reloadData];
|
[self.sessionTableView reloadData];
|
||||||
// }];
|
}];
|
||||||
// } else {
|
} else {
|
||||||
// [[[NIMSDK sharedSDK] conversationManager] messagesInSession:self.session message:nil limit:20 completion:^(NSError * _Nullable error, NSArray<NIMMessage *> * _Nullable messages) {
|
[[[NIMSDK sharedSDK] conversationManager] messagesInSession:self.session message:nil limit:20 completion:^(NSError * _Nullable error, NSArray<NIMMessage *> * _Nullable messages) {
|
||||||
// [self.sessionTableView.mj_header endRefreshing];
|
[self.sessionTableView.mj_header endRefreshing];
|
||||||
// if (error == nil) {
|
if (error == nil) {
|
||||||
// [self.messages addObjectsFromArray:messages];
|
[self.messages addObjectsFromArray:messages];
|
||||||
// }
|
}
|
||||||
// [self.sessionTableView reloadData];
|
[self.sessionTableView reloadData];
|
||||||
// [self.sessionTableView nim_scrollToBottom:NO];
|
[self.sessionTableView nim_scrollToBottom:NO];
|
||||||
// }];
|
}];
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)initData {
|
- (void)initData {
|
||||||
|
@@ -119,7 +119,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/// 获取批量的用户数组
|
/// 获取批量的用户数组
|
||||||
/// @param uids 用户ids
|
/// @param uids 用户ids
|
||||||
/// @param completion 完成
|
/// @param completion 完成
|
||||||
+ (void)Mew_GetUserInfos:(NSString *)uids completion:(MewHttpRequestHelperCompletion)completion;
|
+ (void)Mew_GetUserInfos:(MewHttpRequestHelperCompletion)completion uids:(NSString *)uids;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@@ -144,7 +144,7 @@
|
|||||||
/// 获取批量的用户数组
|
/// 获取批量的用户数组
|
||||||
/// @param uids 用户ids
|
/// @param uids 用户ids
|
||||||
/// @param completion 完成
|
/// @param completion 完成
|
||||||
+ (void)Mew_GetUserInfos:(NSString *)uids completion:(MewHttpRequestHelperCompletion)completion {
|
+ (void)Mew_GetUserInfos:(MewHttpRequestHelperCompletion)completion uids:(NSString *)uids {
|
||||||
[self makeRequest:@"user/list" method:MewHttpRequestHelperMethodGET completion:completion, __FUNCTION__, uids, nil];
|
[self makeRequest:@"user/list" method:MewHttpRequestHelperMethodGET completion:completion, __FUNCTION__, uids, nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user