私信功能:私聊限制
This commit is contained in:
@@ -103,6 +103,10 @@
|
||||
18F403CB2758C66800A6C548 /* MessageContentText.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F403CA2758C66800A6C548 /* MessageContentText.m */; };
|
||||
18F403EE2758CF2F00A6C548 /* MessageContentImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F403ED2758CF2F00A6C548 /* MessageContentImage.m */; };
|
||||
18F4043A275E20D900A6C548 /* TRTCRtcImpl.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F40439275E20D900A6C548 /* TRTCRtcImpl.m */; };
|
||||
18F404B7276095D700A6C548 /* SessionChatLimitView.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F404B6276095D700A6C548 /* SessionChatLimitView.m */; };
|
||||
18F404BB2760982000A6C548 /* ChatLimitModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F404BA2760982000A6C548 /* ChatLimitModel.m */; };
|
||||
18F404C3276098F100A6C548 /* Api+Message.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F404C2276098F100A6C548 /* Api+Message.m */; };
|
||||
18F404C927609A4300A6C548 /* MessagePresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F404C827609A4300A6C548 /* MessagePresenter.m */; };
|
||||
73FFADDC93E195344047A2EC /* Pods_xplan_ios.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CACF623970097D653132D69A /* Pods_xplan_ios.framework */; };
|
||||
9B0E1C5926E77022005D4442 /* BaseNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B0E1C5826E77022005D4442 /* BaseNavigationController.m */; };
|
||||
9B7D804A2753783D003DAC0C /* SessionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7D80492753783D003DAC0C /* SessionViewController.m */; };
|
||||
@@ -500,6 +504,15 @@
|
||||
18F403ED2758CF2F00A6C548 /* MessageContentImage.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessageContentImage.m; sourceTree = "<group>"; };
|
||||
18F40438275E20D900A6C548 /* TRTCRtcImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TRTCRtcImpl.h; sourceTree = "<group>"; };
|
||||
18F40439275E20D900A6C548 /* TRTCRtcImpl.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TRTCRtcImpl.m; sourceTree = "<group>"; };
|
||||
18F404B5276095D700A6C548 /* SessionChatLimitView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SessionChatLimitView.h; sourceTree = "<group>"; };
|
||||
18F404B6276095D700A6C548 /* SessionChatLimitView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SessionChatLimitView.m; sourceTree = "<group>"; };
|
||||
18F404B92760982000A6C548 /* ChatLimitModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ChatLimitModel.h; sourceTree = "<group>"; };
|
||||
18F404BA2760982000A6C548 /* ChatLimitModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ChatLimitModel.m; sourceTree = "<group>"; };
|
||||
18F404C1276098F100A6C548 /* Api+Message.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Api+Message.h"; sourceTree = "<group>"; };
|
||||
18F404C2276098F100A6C548 /* Api+Message.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "Api+Message.m"; sourceTree = "<group>"; };
|
||||
18F404C6276099DF00A6C548 /* MessageProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessageProtocol.h; sourceTree = "<group>"; };
|
||||
18F404C727609A4300A6C548 /* MessagePresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessagePresenter.h; sourceTree = "<group>"; };
|
||||
18F404C827609A4300A6C548 /* MessagePresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessagePresenter.m; sourceTree = "<group>"; };
|
||||
7DB00EC07F1D0ADFF900B38D /* Pods-xplan-ios.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-xplan-ios.debug.xcconfig"; path = "Target Support Files/Pods-xplan-ios/Pods-xplan-ios.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
9B0E1C5726E77022005D4442 /* BaseNavigationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BaseNavigationController.h; sourceTree = "<group>"; };
|
||||
9B0E1C5826E77022005D4442 /* BaseNavigationController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BaseNavigationController.m; sourceTree = "<group>"; };
|
||||
@@ -1412,15 +1425,11 @@
|
||||
18A61BCC274F72ED00A09A54 /* Message */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
18EE3FF72754B01D00A452BF /* NIMViews */,
|
||||
18EE3FF52754AFD900A452BF /* SessionList */,
|
||||
9B7D804727537819003DAC0C /* Session */,
|
||||
18EE3FEC2750CE6D00A452BF /* NIMMessageUtils.h */,
|
||||
18EE3FED2750CE6D00A452BF /* NIMMessageUtils.m */,
|
||||
18EE3FEF2750D2AD00A452BF /* NIMTimeUtils.h */,
|
||||
18EE3FF02750D2AD00A452BF /* NIMTimeUtils.m */,
|
||||
18EE40192754BA9F00A452BF /* NIMMessageMaker.h */,
|
||||
18EE40182754BA9F00A452BF /* NIMMessageMaker.m */,
|
||||
18F404B8276097F200A6C548 /* Model */,
|
||||
18F404BD276098A800A6C548 /* Api */,
|
||||
18F404BC2760989300A6C548 /* View */,
|
||||
18F404C4276099B300A6C548 /* Presenter */,
|
||||
18F404C5276099C800A6C548 /* Protocol */,
|
||||
);
|
||||
path = Message;
|
||||
sourceTree = "<group>";
|
||||
@@ -1506,6 +1515,57 @@
|
||||
path = Content;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
18F404B8276097F200A6C548 /* Model */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
18F404B92760982000A6C548 /* ChatLimitModel.h */,
|
||||
18F404BA2760982000A6C548 /* ChatLimitModel.m */,
|
||||
);
|
||||
path = Model;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
18F404BC2760989300A6C548 /* View */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
18EE3FF72754B01D00A452BF /* NIMViews */,
|
||||
18EE3FF52754AFD900A452BF /* SessionList */,
|
||||
9B7D804727537819003DAC0C /* Session */,
|
||||
18EE3FEC2750CE6D00A452BF /* NIMMessageUtils.h */,
|
||||
18EE3FED2750CE6D00A452BF /* NIMMessageUtils.m */,
|
||||
18EE3FEF2750D2AD00A452BF /* NIMTimeUtils.h */,
|
||||
18EE3FF02750D2AD00A452BF /* NIMTimeUtils.m */,
|
||||
18EE40192754BA9F00A452BF /* NIMMessageMaker.h */,
|
||||
18EE40182754BA9F00A452BF /* NIMMessageMaker.m */,
|
||||
);
|
||||
path = View;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
18F404BD276098A800A6C548 /* Api */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
18F404C1276098F100A6C548 /* Api+Message.h */,
|
||||
18F404C2276098F100A6C548 /* Api+Message.m */,
|
||||
);
|
||||
path = Api;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
18F404C4276099B300A6C548 /* Presenter */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
18F404C727609A4300A6C548 /* MessagePresenter.h */,
|
||||
18F404C827609A4300A6C548 /* MessagePresenter.m */,
|
||||
);
|
||||
path = Presenter;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
18F404C5276099C800A6C548 /* Protocol */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
18F404C6276099DF00A6C548 /* MessageProtocol.h */,
|
||||
);
|
||||
path = Protocol;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9B7D804727537819003DAC0C /* Session */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -1513,6 +1573,8 @@
|
||||
9B7D80492753783D003DAC0C /* SessionViewController.m */,
|
||||
9B7D80542753C595003DAC0C /* SendMessageView.h */,
|
||||
9B7D80552753C595003DAC0C /* SendMessageView.m */,
|
||||
18F404B5276095D700A6C548 /* SessionChatLimitView.h */,
|
||||
18F404B6276095D700A6C548 /* SessionChatLimitView.m */,
|
||||
9B7D804B27537950003DAC0C /* MessageCell.h */,
|
||||
9B7D804C27537950003DAC0C /* MessageCell.m */,
|
||||
18F403A72758B67900A6C548 /* Content */,
|
||||
@@ -2692,6 +2754,7 @@
|
||||
9B7D80502753AA9D003DAC0C /* UITableView+NIMScrollToBottom.m in Sources */,
|
||||
18E7B22626E8CDCF0064BC9B /* XplanFlutterBoostDelegate.m in Sources */,
|
||||
E8EEB8F326FC2050007C6EBA /* SDWaitingView.m in Sources */,
|
||||
18F404B7276095D700A6C548 /* SessionChatLimitView.m in Sources */,
|
||||
E8788942273A55AD00BF1D57 /* XPGiftUsersView.m in Sources */,
|
||||
E8659909273E800D00EE349D /* XPGiftCollectionViewFlowLayout.m in Sources */,
|
||||
E8B846CB26FDD7CD00A777FE /* XPMineRechargeViewController.m in Sources */,
|
||||
@@ -2753,6 +2816,7 @@
|
||||
E8C21501274B76F60079E6BF /* XPRoomAnimationHitView.m in Sources */,
|
||||
E8AC722426F47E5E007D6E91 /* XPMineFeedbackViewController.m in Sources */,
|
||||
9B7D804D27537950003DAC0C /* MessageCell.m in Sources */,
|
||||
18F404C927609A4300A6C548 /* MessagePresenter.m in Sources */,
|
||||
E81366E326F0A1FC0076364C /* LoginBindPhoneViewController.m in Sources */,
|
||||
189DD68426E1FDBB00AB55B1 /* XCHUDTool.m in Sources */,
|
||||
189DD73F26E21C3F00AB55B1 /* YYUtility+Carrier.m in Sources */,
|
||||
@@ -2806,6 +2870,7 @@
|
||||
E8680718271967B00024F48F /* MicroView.m in Sources */,
|
||||
E8B825CD26EA18C8009E8E9F /* ThemeColor.m in Sources */,
|
||||
E88B5CBD26FB3BDF00DA9178 /* XPTeenagerAlertView.m in Sources */,
|
||||
18F404C3276098F100A6C548 /* Api+Message.m in Sources */,
|
||||
E8C6FFED27550CC2004DC9F0 /* HomeSearchResultModel.m in Sources */,
|
||||
E8AEAEF327141C7C0017FCE0 /* XPRoomMessageContainerView.m in Sources */,
|
||||
E8C6FFE02754EEF9004DC9F0 /* XPHomeSearchViewController.m in Sources */,
|
||||
@@ -2827,6 +2892,7 @@
|
||||
E81366E726F0A49E0076364C /* NSString+Utils.m in Sources */,
|
||||
E87A26F627587C48002DDC7A /* XPHomeContainerViewController.m in Sources */,
|
||||
E8EEB90126FC31B6007C6EBA /* XPMineUserInfoPresenter.m in Sources */,
|
||||
18F404BB2760982000A6C548 /* ChatLimitModel.m in Sources */,
|
||||
189DD56526DE465A00AB55B1 /* LoginViewController.m in Sources */,
|
||||
E824544B26F5BBB800BE8163 /* XPMineModifPayPwdViewController.m in Sources */,
|
||||
E8EEB8FE26FC2DF8007C6EBA /* XPMineUserInfoCustomNavView.m in Sources */,
|
||||
|
18
xplan-ios/Main/Message/Api/Api+Message.h
Normal file
18
xplan-ios/Main/Message/Api/Api+Message.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// Api+Message.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by zu on 2021/12/8.
|
||||
//
|
||||
|
||||
#import "Api.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface Api (Message)
|
||||
|
||||
+ (void)getChatLimit:(HttpRequestHelperCompletion)complection;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
16
xplan-ios/Main/Message/Api/Api+Message.m
Normal file
16
xplan-ios/Main/Message/Api/Api+Message.m
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// Api+Message.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by zu on 2021/12/8.
|
||||
//
|
||||
|
||||
#import "Api+Message.h"
|
||||
|
||||
@implementation Api (Message)
|
||||
|
||||
+ (void)getChatLimit:(HttpRequestHelperCompletion)complection {
|
||||
[self makeRequest:@"privateChat/limit" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, nil];
|
||||
}
|
||||
|
||||
@end
|
21
xplan-ios/Main/Message/Model/ChatLimitModel.h
Normal file
21
xplan-ios/Main/Message/Model/ChatLimitModel.h
Normal file
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// ChatLimitModel.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by zu on 2021/12/8.
|
||||
//
|
||||
|
||||
#import "NSObject+MJExtension.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface ChatLimitModel : NSObject
|
||||
|
||||
@property (nonatomic, assign) BOOL chat;
|
||||
@property (nonatomic, copy) NSString * message;
|
||||
@property (nonatomic, copy) NSString * wealthLevel;
|
||||
@property (nonatomic, copy) NSString * charmLevel;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
12
xplan-ios/Main/Message/Model/ChatLimitModel.m
Normal file
12
xplan-ios/Main/Message/Model/ChatLimitModel.m
Normal file
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// ChatLimitModel.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by zu on 2021/12/8.
|
||||
//
|
||||
|
||||
#import "ChatLimitModel.h"
|
||||
|
||||
@implementation ChatLimitModel
|
||||
|
||||
@end
|
18
xplan-ios/Main/Message/Presenter/MessagePresenter.h
Normal file
18
xplan-ios/Main/Message/Presenter/MessagePresenter.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// MessagePresenter.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by zu on 2021/12/8.
|
||||
//
|
||||
|
||||
#import "BaseMvpPresenter.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MessagePresenter : BaseMvpPresenter
|
||||
|
||||
- (void)getChatLimit;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
22
xplan-ios/Main/Message/Presenter/MessagePresenter.m
Normal file
22
xplan-ios/Main/Message/Presenter/MessagePresenter.m
Normal file
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// MessagePresenter.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by zu on 2021/12/8.
|
||||
//
|
||||
|
||||
#import "MessagePresenter.h"
|
||||
#import "Api+Message.h"
|
||||
#import "ChatLimitModel.h"
|
||||
#import "MessageProtocol.h"
|
||||
|
||||
@implementation MessagePresenter
|
||||
|
||||
- (void)getChatLimit {
|
||||
[Api getChatLimit:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
ChatLimitModel *chatLimit = [ChatLimitModel modelWithJSON:data.data];
|
||||
[[self getView] onGetLimitChat:chatLimit];
|
||||
} showLoading:NO errorToast:NO]];
|
||||
}
|
||||
|
||||
@end
|
20
xplan-ios/Main/Message/Protocol/MessageProtocol.h
Normal file
20
xplan-ios/Main/Message/Protocol/MessageProtocol.h
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// MessageProtocol.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by zu on 2021/12/8.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class ChatLimitModel;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol MessageProtocol <NSObject>
|
||||
|
||||
- (void)onGetLimitChat:(ChatLimitModel *)chatLimit;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -15,8 +15,12 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@end
|
||||
|
||||
#define VIEW_HEIGHT (kSafeAreaBottomHeight + 50)
|
||||
|
||||
@interface SendMessageView : UIView
|
||||
|
||||
@property (nonatomic, assign, getter=isSendDisabled) BOOL sendDisabled;
|
||||
|
||||
@property (nonatomic, weak) id<SendMessageViewDelegate> delegate;
|
||||
|
||||
@end
|
@@ -47,6 +47,16 @@
|
||||
self.sendButton.enabled = self.inputView.text.length > 0;
|
||||
}
|
||||
|
||||
- (void)setSendDisabled:(BOOL)sendDisabled {
|
||||
self.userInteractionEnabled = !sendDisabled;
|
||||
if (sendDisabled) {
|
||||
self.inputView.text = @"";
|
||||
self.inputView.placeholder = @"暂时无法私聊";
|
||||
} else {
|
||||
self.inputView.placeholder = @"请输入消息";
|
||||
}
|
||||
}
|
||||
|
||||
- (void)keyboardWillShow:(NSNotification *)notification {
|
||||
[self.superview bringSubviewToFront:self];
|
||||
NSDictionary *info = [notification userInfo];
|
19
xplan-ios/Main/Message/View/Session/SessionChatLimitView.h
Normal file
19
xplan-ios/Main/Message/View/Session/SessionChatLimitView.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// SessionLimitChatView.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by zu on 2021/12/8.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "ChatLimitModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SessionChatLimitView : UIView
|
||||
|
||||
- (instancetype)initWithChatLimit:(ChatLimitModel *)chatLimit;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
75
xplan-ios/Main/Message/View/Session/SessionChatLimitView.m
Normal file
75
xplan-ios/Main/Message/View/Session/SessionChatLimitView.m
Normal file
@@ -0,0 +1,75 @@
|
||||
//
|
||||
// SessionLimitChatView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by zu on 2021/12/8.
|
||||
//
|
||||
|
||||
#import "SessionChatLimitView.h"
|
||||
#import "ThemeColor.h"
|
||||
#import "XPMacro.h"
|
||||
#import "UIView+NIM.h"
|
||||
#import "XPWebViewController.h"
|
||||
#import <YYText/YYText.h>
|
||||
#import <Masonry/Masonry.h>
|
||||
#import <ReactiveObjC/ReactiveObjC.h>
|
||||
|
||||
@interface SessionChatLimitView()
|
||||
|
||||
@property (nonatomic, strong) UIView *bgView;
|
||||
@property (nonatomic, strong) YYLabel *textLabel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SessionChatLimitView
|
||||
|
||||
- (instancetype)initWithChatLimit:(ChatLimitModel *)chatLimit {
|
||||
if (self = [super initWithFrame:CGRectMake(0, 0, KScreenWidth, 50)]) {
|
||||
[self addSubview:self.bgView];
|
||||
[self.bgView addSubview:self.textLabel];
|
||||
|
||||
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.center.mas_equalTo(self);
|
||||
}];
|
||||
|
||||
[self.textLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.left.right.bottom.mas_equalTo(self.bgView).insets(UIEdgeInsetsMake(10, 10, 10, 10));
|
||||
}];
|
||||
|
||||
[self initLabel:chatLimit.charmLevel.integerValue wealthLevel:chatLimit.wealthLevel.integerValue];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)initLabel:(NSInteger)charmLevel wealthLevel:(NSInteger)wealthLevel {
|
||||
NSInteger charm = charmLevel > 0 ? charmLevel : 3;
|
||||
NSInteger wealth = wealthLevel > 0 ? wealthLevel : 3;
|
||||
UIColor *highlightColor = ThemeColor.appMainColor;
|
||||
NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"仅财富等级≥%zd或魅力等级≥%zd的用户可发起聊天", wealth, charm] attributes:@{NSFontAttributeName: [UIFont systemFontOfSize: 12],NSForegroundColorAttributeName: ThemeColor.mainTextColor}];;
|
||||
NSRange wealthLevelRange = [attStr.mutableString rangeOfString:[NSString stringWithFormat:@"财富等级≥%zd", wealth]];
|
||||
NSRange charmLevelRange = [attStr.mutableString rangeOfString:[NSString stringWithFormat:@"魅力等级≥%zd", charm]];
|
||||
[attStr yy_setColor:highlightColor range:wealthLevelRange];
|
||||
[attStr yy_setColor:highlightColor range:charmLevelRange];
|
||||
self.textLabel.attributedText = attStr;
|
||||
}
|
||||
|
||||
- (UIView *)bgView {
|
||||
if (!_bgView) {
|
||||
_bgView = [UIView new];
|
||||
_bgView.backgroundColor = ThemeColor.appCellBackgroundColor;
|
||||
_bgView.layer.masksToBounds = YES;
|
||||
_bgView.layer.cornerRadius = 8.0;
|
||||
}
|
||||
return _bgView;
|
||||
}
|
||||
|
||||
- (YYLabel *)textLabel {
|
||||
if (!_textLabel) {
|
||||
_textLabel = [[YYLabel alloc] init];
|
||||
_textLabel.textAlignment = NSTextAlignmentCenter;
|
||||
_textLabel.numberOfLines = 0;
|
||||
}
|
||||
return _textLabel;
|
||||
}
|
||||
|
||||
@end
|
@@ -8,6 +8,7 @@
|
||||
#import "SessionViewController.h"
|
||||
#import "MessageCell.h"
|
||||
#import "SendMessageView.h"
|
||||
#import "SessionChatLimitView.h"
|
||||
#import "UITableView+NIMScrollToBottom.h"
|
||||
|
||||
#import "NIMMessageMaker.h"
|
||||
@@ -15,7 +16,10 @@
|
||||
|
||||
#import <Masonry/Masonry.h>
|
||||
|
||||
@interface SessionViewController ()<UITableViewDelegate, UITableViewDataSource, NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMMediaManagerDelegate, SendMessageViewDelegate>
|
||||
#import "MessagePresenter.h"
|
||||
#import "MessageProtocol.h"
|
||||
|
||||
@interface SessionViewController ()<MessageProtocol, UITableViewDelegate, UITableViewDataSource, NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMMediaManagerDelegate, SendMessageViewDelegate>
|
||||
|
||||
@property (nonatomic, strong) NIMSession * session;
|
||||
@property (nonatomic, strong) NSMutableArray<NIMMessage *> * messages;
|
||||
@@ -34,6 +38,10 @@
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
- (MessagePresenter *)createPresenter {
|
||||
return [[MessagePresenter alloc] init];
|
||||
}
|
||||
|
||||
- (instancetype)initWithSession:(NIMSession *)session {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
@@ -89,6 +97,8 @@
|
||||
}];
|
||||
|
||||
[[NIMSDK sharedSDK].conversationManager markAllMessagesReadInSession:self.session];
|
||||
|
||||
[self.presenter getChatLimit];
|
||||
}
|
||||
|
||||
- (void)keyboardWillShow:(NSNotification *)notification {
|
||||
@@ -102,6 +112,18 @@
|
||||
} completion:nil];
|
||||
}
|
||||
|
||||
#pragma mark - MessageProtocol
|
||||
- (void)onGetLimitChat:(ChatLimitModel *)chatLimit {
|
||||
BOOL chatDisabled = !chatLimit.chat && self.messages.count <= 0;
|
||||
if (chatDisabled) {
|
||||
SessionChatLimitView *chatLimitView = [[SessionChatLimitView alloc] initWithChatLimit:chatLimit];
|
||||
self.sessionTableView.tableHeaderView = chatLimitView;
|
||||
} else {
|
||||
self.sessionTableView.tableHeaderView = nil;
|
||||
}
|
||||
self.sendMessageView.sendDisabled = chatDisabled;
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDataSource
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
||||
return 1;
|
||||
@@ -205,6 +227,7 @@
|
||||
if (!_sendMessageView) {
|
||||
_sendMessageView = [[SendMessageView alloc] init];
|
||||
_sendMessageView.delegate = self;
|
||||
_sendMessageView.sendDisabled = YES;
|
||||
}
|
||||
return _sendMessageView;
|
||||
}
|
Reference in New Issue
Block a user