消息模块-消息底部操作栏
@@ -172,7 +172,6 @@
|
||||
9B7D804A2753783D003DAC0C /* SessionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7D80492753783D003DAC0C /* SessionViewController.m */; };
|
||||
9B7D804D27537950003DAC0C /* MessageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7D804C27537950003DAC0C /* MessageCell.m */; };
|
||||
9B7D80502753AA9D003DAC0C /* UITableView+NIMScrollToBottom.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7D804E2753AA9D003DAC0C /* UITableView+NIMScrollToBottom.m */; };
|
||||
9B7D80562753C595003DAC0C /* SendMessageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7D80552753C595003DAC0C /* SendMessageView.m */; };
|
||||
9B7D8857279C099C00785A25 /* XPSkillCardListPropCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B7D8856279C099C00785A25 /* XPSkillCardListPropCell.m */; };
|
||||
9B8585D3278837CE00D7D5C6 /* NobleLevelUpModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B8585D2278837CE00D7D5C6 /* NobleLevelUpModel.m */; };
|
||||
9B8585F52788699400D7D5C6 /* FBKVOController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B8585F42788699400D7D5C6 /* FBKVOController.m */; };
|
||||
@@ -438,6 +437,8 @@
|
||||
E8659909273E800D00EE349D /* XPGiftCollectionViewFlowLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = E8659908273E800D00EE349D /* XPGiftCollectionViewFlowLayout.m */; };
|
||||
E866B6E52759F96F009B002A /* XPMiniRoomView.m in Sources */ = {isa = PBXBuildFile; fileRef = E866B6E42759F96F009B002A /* XPMiniRoomView.m */; };
|
||||
E8680718271967B00024F48F /* MicroView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8680717271967B00024F48F /* MicroView.m */; };
|
||||
E86B911A28102AF90007DEE7 /* SessionToolbarView.m in Sources */ = {isa = PBXBuildFile; fileRef = E86B911928102AF90007DEE7 /* SessionToolbarView.m */; };
|
||||
E86B911E2810351A0007DEE7 /* MessageToolMenuCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E86B911D2810351A0007DEE7 /* MessageToolMenuCollectionViewCell.m */; };
|
||||
E872308926E89BE000B90D4F /* LoginPhoneViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E872308826E89BE000B90D4F /* LoginPhoneViewController.m */; };
|
||||
E872308D26E89DAA00B90D4F /* LoginInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = E872308C26E89DAA00B90D4F /* LoginInputView.m */; };
|
||||
E872309326E8D31500B90D4F /* LoginVerifCodeView.m in Sources */ = {isa = PBXBuildFile; fileRef = E872309226E8D31500B90D4F /* LoginVerifCodeView.m */; };
|
||||
@@ -681,6 +682,7 @@
|
||||
E8D48250278D68BA003C1D08 /* XPAcrpssRoomPKPanelView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8D4824F278D68BA003C1D08 /* XPAcrpssRoomPKPanelView.m */; };
|
||||
E8D48253278D8228003C1D08 /* AcrossRoomPKPanelModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8D48252278D8228003C1D08 /* AcrossRoomPKPanelModel.m */; };
|
||||
E8D48256278D83AE003C1D08 /* XPAcrossRoomPKPanelUserView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8D48255278D83AE003C1D08 /* XPAcrossRoomPKPanelUserView.m */; };
|
||||
E8D55C9D28113218006935A5 /* MessageMenuModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8D55C9C28113218006935A5 /* MessageMenuModel.m */; };
|
||||
E8DACCFB2766EDC60052092C /* MicroGiftValueView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DACCFA2766EDC60052092C /* MicroGiftValueView.m */; };
|
||||
E8DACCFE27673F870052092C /* GiftValueInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DACCFD27673F870052092C /* GiftValueInfoModel.m */; };
|
||||
E8DBB6F927B639A300AA285D /* LittleGameStageView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DBB6F827B639A300AA285D /* LittleGameStageView.m */; };
|
||||
@@ -1070,8 +1072,6 @@
|
||||
9B7D804C27537950003DAC0C /* MessageCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessageCell.m; sourceTree = "<group>"; };
|
||||
9B7D804E2753AA9D003DAC0C /* UITableView+NIMScrollToBottom.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITableView+NIMScrollToBottom.m"; sourceTree = "<group>"; };
|
||||
9B7D804F2753AA9D003DAC0C /* UITableView+NIMScrollToBottom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITableView+NIMScrollToBottom.h"; sourceTree = "<group>"; };
|
||||
9B7D80542753C595003DAC0C /* SendMessageView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SendMessageView.h; sourceTree = "<group>"; };
|
||||
9B7D80552753C595003DAC0C /* SendMessageView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SendMessageView.m; sourceTree = "<group>"; };
|
||||
9B7D8855279C099C00785A25 /* XPSkillCardListPropCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPSkillCardListPropCell.h; sourceTree = "<group>"; };
|
||||
9B7D8856279C099C00785A25 /* XPSkillCardListPropCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPSkillCardListPropCell.m; sourceTree = "<group>"; };
|
||||
9B8585D1278837CE00D7D5C6 /* NobleLevelUpModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NobleLevelUpModel.h; sourceTree = "<group>"; };
|
||||
@@ -1614,6 +1614,10 @@
|
||||
E866B6E42759F96F009B002A /* XPMiniRoomView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMiniRoomView.m; sourceTree = "<group>"; };
|
||||
E8680716271967B00024F48F /* MicroView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MicroView.h; sourceTree = "<group>"; };
|
||||
E8680717271967B00024F48F /* MicroView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MicroView.m; sourceTree = "<group>"; };
|
||||
E86B911828102AF90007DEE7 /* SessionToolbarView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SessionToolbarView.h; sourceTree = "<group>"; };
|
||||
E86B911928102AF90007DEE7 /* SessionToolbarView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SessionToolbarView.m; sourceTree = "<group>"; };
|
||||
E86B911C2810351A0007DEE7 /* MessageToolMenuCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessageToolMenuCollectionViewCell.h; sourceTree = "<group>"; };
|
||||
E86B911D2810351A0007DEE7 /* MessageToolMenuCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessageToolMenuCollectionViewCell.m; sourceTree = "<group>"; };
|
||||
E872308726E89BE000B90D4F /* LoginPhoneViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginPhoneViewController.h; sourceTree = "<group>"; };
|
||||
E872308826E89BE000B90D4F /* LoginPhoneViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoginPhoneViewController.m; sourceTree = "<group>"; };
|
||||
E872308B26E89DAA00B90D4F /* LoginInputView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginInputView.h; sourceTree = "<group>"; };
|
||||
@@ -2101,6 +2105,8 @@
|
||||
E8D48252278D8228003C1D08 /* AcrossRoomPKPanelModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AcrossRoomPKPanelModel.m; sourceTree = "<group>"; };
|
||||
E8D48254278D83AE003C1D08 /* XPAcrossRoomPKPanelUserView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAcrossRoomPKPanelUserView.h; sourceTree = "<group>"; };
|
||||
E8D48255278D83AE003C1D08 /* XPAcrossRoomPKPanelUserView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAcrossRoomPKPanelUserView.m; sourceTree = "<group>"; };
|
||||
E8D55C9B28113218006935A5 /* MessageMenuModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessageMenuModel.h; sourceTree = "<group>"; };
|
||||
E8D55C9C28113218006935A5 /* MessageMenuModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessageMenuModel.m; sourceTree = "<group>"; };
|
||||
E8DACCF92766EDC60052092C /* MicroGiftValueView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MicroGiftValueView.h; sourceTree = "<group>"; };
|
||||
E8DACCFA2766EDC60052092C /* MicroGiftValueView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MicroGiftValueView.m; sourceTree = "<group>"; };
|
||||
E8DACCFC27673F870052092C /* GiftValueInfoModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiftValueInfoModel.h; sourceTree = "<group>"; };
|
||||
@@ -2863,6 +2869,7 @@
|
||||
18F404B8276097F200A6C548 /* Model */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E8D55C9A281131F1006935A5 /* SessionToolBar */,
|
||||
E83ABEFA280EB5A000322EE4 /* SessionContent */,
|
||||
18F404B92760982000A6C548 /* ChatLimitModel.h */,
|
||||
18F404BA2760982000A6C548 /* ChatLimitModel.m */,
|
||||
@@ -3132,13 +3139,14 @@
|
||||
9B7D80492753783D003DAC0C /* SessionViewController.m */,
|
||||
9B9DFD9827DB2194000F95B3 /* XPSessionMessageHeadView.h */,
|
||||
9B9DFD9927DB2194000F95B3 /* XPSessionMessageHeadView.m */,
|
||||
9B7D80542753C595003DAC0C /* SendMessageView.h */,
|
||||
9B7D80552753C595003DAC0C /* SendMessageView.m */,
|
||||
E86B911828102AF90007DEE7 /* SessionToolbarView.h */,
|
||||
E86B911928102AF90007DEE7 /* SessionToolbarView.m */,
|
||||
18F404B5276095D700A6C548 /* SessionChatLimitView.h */,
|
||||
18F404B6276095D700A6C548 /* SessionChatLimitView.m */,
|
||||
9B7D804B27537950003DAC0C /* MessageCell.h */,
|
||||
9B7D804C27537950003DAC0C /* MessageCell.m */,
|
||||
18F403A72758B67900A6C548 /* Content */,
|
||||
E86B911B281034F10007DEE7 /* Cell */,
|
||||
);
|
||||
path = Session;
|
||||
sourceTree = "<group>";
|
||||
@@ -4508,6 +4516,15 @@
|
||||
path = MicroView;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E86B911B281034F10007DEE7 /* Cell */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E86B911C2810351A0007DEE7 /* MessageToolMenuCollectionViewCell.h */,
|
||||
E86B911D2810351A0007DEE7 /* MessageToolMenuCollectionViewCell.m */,
|
||||
);
|
||||
path = Cell;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E872308A26E89D5100B90D4F /* CustomView */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -5678,6 +5695,15 @@
|
||||
path = UserInfo;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E8D55C9A281131F1006935A5 /* SessionToolBar */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E8D55C9B28113218006935A5 /* MessageMenuModel.h */,
|
||||
E8D55C9C28113218006935A5 /* MessageMenuModel.m */,
|
||||
);
|
||||
path = SessionToolBar;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E8DBB6FA27B63CC300AA285D /* LittleGame */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -6182,6 +6208,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E8E5E1AF27C3920100F457D8 /* XPHomeRecommendPresenter.m in Sources */,
|
||||
E86B911E2810351A0007DEE7 /* MessageToolMenuCollectionViewCell.m in Sources */,
|
||||
9B2EA7C32804052E00ED17BF /* AnchorPKMicroView.m in Sources */,
|
||||
181D7F1B2726CE2A00B7C059 /* StageView.m in Sources */,
|
||||
18EE3FF12750D2AD00A452BF /* NIMTimeUtils.m in Sources */,
|
||||
@@ -6313,6 +6340,7 @@
|
||||
E800806527FD37A20055A8AB /* XPGuildHeaderView.m in Sources */,
|
||||
9B2A12D52783EEC700CED41B /* XPNobleCenterTableHeadView.m in Sources */,
|
||||
9BEE3D11278584FE00C83219 /* XPNobleCenterEmptyView.m in Sources */,
|
||||
E8D55C9D28113218006935A5 /* MessageMenuModel.m in Sources */,
|
||||
9BCF585F27995363008401A4 /* XPSkillCardSelectPropView.m in Sources */,
|
||||
E8A03DFC276350A60098D9EA /* XPCandyTreeGiftView.m in Sources */,
|
||||
189DD73E26E21C3F00AB55B1 /* YYUtility.m in Sources */,
|
||||
@@ -6360,6 +6388,7 @@
|
||||
E855516128059228005F293F /* XPMineGuildIncomeDetailViewController.m in Sources */,
|
||||
E8A1E45B27620F4900B294CA /* XPRoomHalfWebView.m in Sources */,
|
||||
9B7D80562753C595003DAC0C /* SendMessageView.m in Sources */,
|
||||
E8A88D3027E85EEA00CA8837 /* RoomPKInfoModel.m in Sources */,
|
||||
E8A86E0527BA38DB001C21F9 /* NSString+RW.m in Sources */,
|
||||
E800162C2803FE4900D6D17A /* GuildIncomeRecordModel.m in Sources */,
|
||||
E83ABF03280EC90C00322EE4 /* ContentApplicationShareModel.m in Sources */,
|
||||
@@ -6421,6 +6450,7 @@
|
||||
E8AC721326F46ADD007D6E91 /* XPMineSettingViewController.m in Sources */,
|
||||
18E7B32126F098650064BC9B /* UserInfoSkillVo.m in Sources */,
|
||||
E8AC722726F482A4007D6E91 /* XPMineFeedbackPresenter.m in Sources */,
|
||||
E86B911A28102AF90007DEE7 /* SessionToolbarView.m in Sources */,
|
||||
18AAF3F0279EA59300CD7DAD /* MessageContentTextClickable.m in Sources */,
|
||||
E8C6FFCC27548120004DC9F0 /* Api+Home.m in Sources */,
|
||||
186A534E26FC6ED900D67B2C /* TTPopupService.m in Sources */,
|
||||
|
22
xplan-ios/Assets.xcassets/SessionMessage/message_session_menu_gift.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "message_session_menu_gift@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "message_session_menu_gift@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 2.4 KiB |
22
xplan-ios/Assets.xcassets/SessionMessage/message_session_menu_photo.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "message_session_menu_photo@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "message_session_menu_photo@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 3.1 KiB |
22
xplan-ios/Assets.xcassets/SessionMessage/message_session_tool_audio.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "message_session_tool_audio@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "message_session_tool_audio@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 823 B |
After Width: | Height: | Size: 1.2 KiB |
22
xplan-ios/Assets.xcassets/SessionMessage/message_session_tool_more_normal.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "message_session_tool_more_normal@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "message_session_tool_more_normal@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 635 B |
After Width: | Height: | Size: 1014 B |
22
xplan-ios/Assets.xcassets/SessionMessage/message_session_tool_text.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "message_session_tool_text@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "message_session_tool_text@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 807 B |
After Width: | Height: | Size: 1.3 KiB |
@@ -45,7 +45,7 @@
|
||||
self.navigationBar.barTintColor = [ThemeColor appBackgroundColor];
|
||||
self.navigationBar.tintColor = [UIColor whiteColor];
|
||||
self.navigationBar.translucent = NO;
|
||||
|
||||
self.view.backgroundColor = [ThemeColor appBackgroundColor];
|
||||
[self.navigationBar setTitleTextAttributes:@{
|
||||
NSFontAttributeName:[UIFont systemFontOfSize:18 weight:UIFontWeightMedium],
|
||||
NSForegroundColorAttributeName:[ThemeColor mainTextColor]
|
||||
|
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// MessageMenuModel.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/4/21.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSInteger, MessageMenuType) {
|
||||
///发送图片
|
||||
MessageMenuType_Photo = 1,
|
||||
///送礼物
|
||||
MessageMenuType_Gift
|
||||
};
|
||||
|
||||
@interface MessageMenuModel : NSObject
|
||||
///图片
|
||||
@property (nonatomic,strong) NSString *imageName;
|
||||
///类型
|
||||
@property (nonatomic,assign) MessageMenuType type;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// MessageMenuModel.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/4/21.
|
||||
//
|
||||
|
||||
#import "MessageMenuModel.h"
|
||||
|
||||
@implementation MessageMenuModel
|
||||
|
||||
@end
|
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// MessageToolMenuCollectionViewCell.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/4/20.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MessageToolMenuCollectionViewCell : UICollectionViewCell
|
||||
@property (nonatomic,copy) NSString *imageName;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// MessageToolMenuCollectionViewCell.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/4/20.
|
||||
//
|
||||
|
||||
#import "MessageToolMenuCollectionViewCell.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
@interface MessageToolMenuCollectionViewCell ()
|
||||
|
||||
@property (nonatomic,strong) UIImageView *logoImageView;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation MessageToolMenuCollectionViewCell
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self.contentView addSubview:self.logoImageView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.logoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.contentView);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setImageName:(NSString *)imageName {
|
||||
_imageName = imageName;
|
||||
if (_imageName) {
|
||||
self.logoImageView.image = [UIImage imageNamed:_imageName];
|
||||
}
|
||||
}
|
||||
|
||||
- (UIImageView *)logoImageView {
|
||||
if (!_logoImageView) {
|
||||
_logoImageView = [[UIImageView alloc] init];
|
||||
_logoImageView.userInteractionEnabled = YES;
|
||||
}
|
||||
return _logoImageView;
|
||||
}
|
||||
|
||||
@end
|
@@ -1,28 +0,0 @@
|
||||
//
|
||||
// SendMessageView.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by zu on 2021/11/28.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol SendMessageViewDelegate <NSObject>
|
||||
|
||||
- (void)sendTextMessage:(NSString *)text;
|
||||
|
||||
@end
|
||||
|
||||
#define VIEW_HEIGHT (kSafeAreaBottomHeight + 50)
|
||||
|
||||
@interface SendMessageView : UIView
|
||||
|
||||
@property (nonatomic, assign, getter=isSendDisabled) BOOL sendDisabled;
|
||||
|
||||
@property (nonatomic, weak) id<SendMessageViewDelegate> delegate;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -1,199 +0,0 @@
|
||||
//
|
||||
// SendMessageView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by zu on 2021/11/28.
|
||||
//
|
||||
|
||||
#import "SendMessageView.h"
|
||||
#import <Masonry/Masonry.h>
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
#import "ThemeColor.h"
|
||||
#import "XPMacro.h"
|
||||
#import "UIImage+Utils.h"
|
||||
|
||||
@interface SendMessageView ()
|
||||
|
||||
@property (nonatomic, strong) UIStackView *stackView;
|
||||
@property (nonatomic, strong) UIView *inputBackgroundView;
|
||||
@property (nonatomic, strong) UITextField *inputView;
|
||||
@property (nonatomic, strong) UIButton *sendButton;
|
||||
|
||||
@end
|
||||
|
||||
#define VIEW_HEIGHT (kSafeAreaBottomHeight + 50)
|
||||
|
||||
@implementation SendMessageView
|
||||
|
||||
- (void)dealloc {
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super initWithFrame:CGRectMake(0, KScreenHeight - VIEW_HEIGHT, KScreenWidth, VIEW_HEIGHT)];
|
||||
if (self) {
|
||||
[self addNotification];
|
||||
[self initViews];
|
||||
[self initLayout];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)sendMessage:(UIButton *)sender {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(sendTextMessage:)]) {
|
||||
[self.delegate sendTextMessage:self.inputView.text];
|
||||
}
|
||||
self.inputView.text = @"";
|
||||
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];
|
||||
CGRect keyboardFrame = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
|
||||
NSNumber *curve = [info objectForKey:UIKeyboardAnimationCurveUserInfoKey];
|
||||
CGFloat duration = [[info objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue];
|
||||
|
||||
CGRect newFrame = self.frame;
|
||||
newFrame.origin.y = self.superview.frame.size.height - keyboardFrame.size.height - 50;
|
||||
|
||||
UIViewAnimationOptions options = (UIViewAnimationOptions)curve << 16;
|
||||
[UIView animateWithDuration:duration delay:0.0 options:options animations:^{
|
||||
self.frame = newFrame;
|
||||
[self mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.equalTo(self.superview);
|
||||
make.bottom.equalTo(self.superview).offset(-keyboardFrame.size.height + kSafeAreaBottomHeight);
|
||||
make.height.equalTo(@(VIEW_HEIGHT));
|
||||
}];
|
||||
} completion:nil];
|
||||
}
|
||||
|
||||
- (void)keyboardWillHidden:(NSNotification *)notification {
|
||||
NSDictionary *info = [notification userInfo];
|
||||
NSNumber *curve = [info objectForKey:UIKeyboardAnimationCurveUserInfoKey];
|
||||
CGFloat duration = [[info objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue];
|
||||
|
||||
CGRect newFrame = self.frame;
|
||||
newFrame.origin.y = self.superview.frame.size.height - VIEW_HEIGHT;
|
||||
|
||||
UIViewAnimationOptions options = (UIViewAnimationOptions)curve << 16;
|
||||
[UIView animateWithDuration:duration delay:0.0 options:options animations:^{
|
||||
self.frame = newFrame;
|
||||
[self mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.left.right.equalTo(self.superview);
|
||||
make.height.equalTo(@(VIEW_HEIGHT));
|
||||
}];
|
||||
} completion:nil];
|
||||
}
|
||||
|
||||
-(void)textFieldEditChanged:(NSNotification *)notification{
|
||||
self.sendButton.enabled = self.inputView.text.length > 0;
|
||||
}
|
||||
|
||||
- (void)initViews {
|
||||
self.backgroundColor = [ThemeColor appCellBackgroundColor];
|
||||
[self addSubview:self.stackView];
|
||||
[self.inputBackgroundView addSubview:self.inputView];
|
||||
[self.stackView addArrangedSubview:self.inputBackgroundView];
|
||||
[self.stackView addArrangedSubview:self.sendButton];
|
||||
}
|
||||
|
||||
- (void)initLayout {
|
||||
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self).offset(15);
|
||||
make.right.mas_equalTo(self).offset(-15);
|
||||
make.top.mas_equalTo(self);
|
||||
make.bottom.mas_equalTo(self).offset(-kSafeAreaBottomHeight);
|
||||
}];
|
||||
|
||||
[self.sendButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(50);
|
||||
make.top.bottom.mas_equalTo(self.stackView).inset(10);
|
||||
}];
|
||||
|
||||
[self.inputBackgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(36);
|
||||
make.left.mas_equalTo(self.stackView);
|
||||
make.right.mas_equalTo(self.sendButton.mas_left).offset(-15);
|
||||
}];
|
||||
|
||||
[self.inputView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.inputBackgroundView).offset(8);
|
||||
make.right.mas_equalTo(self.inputBackgroundView).offset(-8);
|
||||
make.centerY.mas_equalTo(self.inputBackgroundView);
|
||||
}];
|
||||
|
||||
[self mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(VIEW_HEIGHT);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)addNotification {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHidden:) name:UIKeyboardWillHideNotification object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textFieldEditChanged:) name:UITextFieldTextDidChangeNotification object:self.inputView];
|
||||
}
|
||||
|
||||
- (UIStackView *)stackView {
|
||||
if (!_stackView) {
|
||||
_stackView = [[UIStackView alloc] init];
|
||||
_stackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
_stackView.distribution = UIStackViewDistributionFill;
|
||||
_stackView.alignment = UIStackViewAlignmentCenter;
|
||||
_stackView.spacing = 10;
|
||||
}
|
||||
return _stackView;
|
||||
}
|
||||
|
||||
- (UITextField *)inputView{
|
||||
if (!_inputView) {
|
||||
_inputView = [[UITextField alloc] init];
|
||||
NSAttributedString * attribute = [[NSAttributedString alloc] initWithString:@"请输入消息" attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:15], NSForegroundColorAttributeName : [ThemeColor secondTextColor]}];
|
||||
_inputView.attributedPlaceholder = attribute;
|
||||
_inputView.borderStyle = UITextBorderStyleNone;
|
||||
_inputView.tintColor = [ThemeColor appMainColor];
|
||||
_inputView.textColor = [ThemeColor mainTextColor];
|
||||
_inputView.font = [UIFont systemFontOfSize:13.f];
|
||||
[_inputView setContentHuggingPriority:UILayoutPriorityDefaultLow forAxis:UILayoutConstraintAxisHorizontal];
|
||||
|
||||
}
|
||||
return _inputView;
|
||||
}
|
||||
|
||||
- (UIView *)inputBackgroundView {
|
||||
if (!_inputBackgroundView) {
|
||||
_inputBackgroundView = [[UIView alloc] init];
|
||||
_inputBackgroundView.backgroundColor = [ThemeColor appBackgroundColor];
|
||||
_inputBackgroundView.layer.masksToBounds = YES;
|
||||
_inputBackgroundView.layer.cornerRadius = 4.f;
|
||||
}
|
||||
return _inputBackgroundView;
|
||||
}
|
||||
|
||||
- (UIButton *)sendButton{
|
||||
if (!_sendButton) {
|
||||
_sendButton = [[UIButton alloc] init];
|
||||
[_sendButton setTitle:@"发送" forState:UIControlStateNormal];
|
||||
_sendButton.titleLabel.textColor = [ThemeColor mainTextColor];
|
||||
_sendButton.titleLabel.font = [UIFont systemFontOfSize:15];
|
||||
[_sendButton setBackgroundImage:[UIImage imageWithColor:[ThemeColor disableButtonColor] ]forState:UIControlStateDisabled];
|
||||
[_sendButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
|
||||
_sendButton.enabled = NO;
|
||||
_sendButton.layer.cornerRadius = 5.0;
|
||||
_sendButton.layer.masksToBounds = YES;
|
||||
[_sendButton addTarget:self action:@selector(sendMessage:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _sendButton;
|
||||
}
|
||||
|
||||
@end
|
27
xplan-ios/Main/Message/View/Session/SessionToolbarView.h
Normal file
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// MessageToolbarView.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/4/20.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class MessageMenuModel;
|
||||
@protocol SessionToolbarViewDelegate <NSObject>
|
||||
|
||||
- (void)keyboardWillChangeFrame:(CGRect)rect;
|
||||
- (void)sendTextMessage:(NSString *)text;
|
||||
- (void)didSelectMenuItem:(MessageMenuModel *)info;
|
||||
@end
|
||||
|
||||
@interface SessionToolbarView : UIView
|
||||
///代理
|
||||
@property (nonatomic,weak) id<SessionToolbarViewDelegate> delegate;
|
||||
@property (nonatomic, assign, getter=isSendDisabled) BOOL sendDisabled;
|
||||
///折叠 菜单view
|
||||
- (void)foldMenuView;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
386
xplan-ios/Main/Message/View/Session/SessionToolbarView.m
Normal file
@@ -0,0 +1,386 @@
|
||||
//
|
||||
// MessageToolbarView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/4/20.
|
||||
//
|
||||
|
||||
#import "SessionToolbarView.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "XPMacro.h"
|
||||
///Model
|
||||
#import "MessageMenuModel.h"
|
||||
///View
|
||||
#import "MessageToolMenuCollectionViewCell.h"
|
||||
|
||||
#define TOOL_HEIGHT 60
|
||||
#define MENU_HEIGHT 130
|
||||
|
||||
@interface SessionToolbarView ()<UICollectionViewDelegate, UICollectionViewDataSource, UITextFieldDelegate>
|
||||
///最大的那个容器
|
||||
@property (nonatomic,strong) UIStackView *stackView;
|
||||
///上部分的功能的容器
|
||||
@property (nonatomic,strong) UIStackView *toolStackView;
|
||||
///切换语音和文字的按钮
|
||||
@property (nonatomic,strong) UIButton *changeButton;
|
||||
///更多按钮
|
||||
@property (nonatomic,strong) UIButton *moreButton;
|
||||
///语音和输入框的
|
||||
@property (nonatomic,strong) UIStackView *audioStackView;
|
||||
///输入框背景
|
||||
@property (nonatomic,strong) UIView * inputBackView;
|
||||
///输入框
|
||||
@property (nonatomic,strong) UITextField *inputView;
|
||||
///语音
|
||||
@property (nonatomic,strong) UIButton *audioButton;
|
||||
///列表
|
||||
@property (nonatomic,strong) UICollectionView *collectionView;
|
||||
///底部的view
|
||||
@property (nonatomic,strong) UIView * placeView;
|
||||
///菜单数据
|
||||
@property (nonatomic,strong) NSArray<MessageMenuModel *> *menuList;
|
||||
@end
|
||||
|
||||
@implementation SessionToolbarView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self addNotification];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
#pragma mark - Public Method
|
||||
- (void)foldMenuView {
|
||||
[self.inputView resignFirstResponder];
|
||||
if (self.collectionView.hidden == NO) {
|
||||
self.collectionView.hidden = YES;
|
||||
self.moreButton.selected = NO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)addNotification {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHidden:) name:UIKeyboardWillHideNotification object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
|
||||
}
|
||||
|
||||
- (void)initSubViews {
|
||||
self.backgroundColor = [ThemeColor appCellBackgroundColor];
|
||||
[self addSubview:self.stackView];
|
||||
|
||||
[self.stackView addArrangedSubview:self.toolStackView];
|
||||
[self.stackView addArrangedSubview:self.collectionView];
|
||||
[self.stackView addArrangedSubview:self.placeView];
|
||||
|
||||
[self.toolStackView addArrangedSubview:self.changeButton];
|
||||
[self.toolStackView addArrangedSubview:self.audioStackView];
|
||||
[self.toolStackView addArrangedSubview:self.moreButton];
|
||||
|
||||
[self.audioStackView addArrangedSubview:self.inputBackView];
|
||||
[self.audioStackView addArrangedSubview:self.audioButton];
|
||||
|
||||
[self.inputBackView addSubview:self.inputView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.mas_equalTo(self.stackView);
|
||||
}];
|
||||
|
||||
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self).inset(15);
|
||||
make.top.mas_equalTo(self);
|
||||
}];
|
||||
|
||||
[self.toolStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(TOOL_HEIGHT);
|
||||
}];
|
||||
|
||||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(MENU_HEIGHT);
|
||||
}];
|
||||
|
||||
[self.placeView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(kSafeAreaBottomHeight);
|
||||
}];
|
||||
|
||||
[self.changeButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(40, 40));
|
||||
}];
|
||||
|
||||
[self.moreButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(40, 40));
|
||||
}];
|
||||
|
||||
[self.audioStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(40);
|
||||
}];
|
||||
|
||||
[self.inputBackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(34);
|
||||
}];
|
||||
|
||||
[self.audioButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(34);
|
||||
}];
|
||||
|
||||
[self.inputView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.inputBackView.mas_left).offset(16);
|
||||
make.top.bottom.mas_equalTo(self.inputBackView);
|
||||
make.right.mas_equalTo(self.inputBackView).offset(-5);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - UICollectionViewDelegate And UICollectionViewDatasource
|
||||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
|
||||
return self.menuList.count;
|
||||
}
|
||||
|
||||
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
MessageToolMenuCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([MessageToolMenuCollectionViewCell class]) forIndexPath:indexPath];
|
||||
MessageMenuModel * model = [self.menuList objectAtIndex:indexPath.row];
|
||||
cell.imageName = model.imageName;
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
[collectionView deselectItemAtIndexPath:indexPath animated:YES];
|
||||
if (self.menuList.count > 0) {
|
||||
MessageMenuModel * model = [self.menuList objectAtIndex:indexPath.row];
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(didSelectMenuItem:)]) {
|
||||
[self.delegate didSelectMenuItem:model];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - UITextFieldDelegate
|
||||
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
|
||||
if (textField.text.length >0) {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(sendTextMessage:)]) {
|
||||
[self.delegate sendTextMessage:textField.text];
|
||||
textField.text = nil;
|
||||
}
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)keyboardWillShow:(NSNotification *)notification {
|
||||
if (self.collectionView.hidden == NO) {
|
||||
self.collectionView.hidden = YES;
|
||||
self.moreButton.selected = NO;
|
||||
}
|
||||
NSDictionary *userInfo = [notification userInfo];
|
||||
CGRect keyboardEndFrame = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
|
||||
if (CGRectIsNull(keyboardEndFrame)) {
|
||||
return;
|
||||
}
|
||||
UIViewAnimationCurve animationCurve = [userInfo[UIKeyboardAnimationCurveUserInfoKey] integerValue];
|
||||
NSInteger animationCurveOption = (animationCurve << 16);
|
||||
double animationDuration = [userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue];
|
||||
[UIView animateWithDuration:animationDuration delay:0.0 options:animationCurveOption animations:^{
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(keyboardWillChangeFrame:)]) {
|
||||
[self.delegate keyboardWillChangeFrame:keyboardEndFrame];
|
||||
}
|
||||
} completion:^(BOOL finished) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)keyboardWillHidden:(NSNotification*)notification {
|
||||
CGRect keyboardEndFrame = CGRectMake(0, 0, 0, 0);
|
||||
[UIView animateWithDuration:0.25 animations:^{
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(keyboardWillChangeFrame:)]) {
|
||||
[self.delegate keyboardWillChangeFrame:keyboardEndFrame];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)changeButtonAction:(UIButton *)sender {
|
||||
sender.selected = !sender.selected;
|
||||
self.inputBackView.hidden = sender.selected;
|
||||
self.audioButton.hidden = !sender.selected;
|
||||
self.collectionView.hidden = YES;
|
||||
self.moreButton.selected = NO;
|
||||
if (sender.selected) {
|
||||
[self.inputView resignFirstResponder];
|
||||
} else {
|
||||
[self.inputView becomeFirstResponder];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)moreButtonAction:(UIButton *)sender {
|
||||
sender.selected = !sender.selected;
|
||||
self.collectionView.hidden = !sender.selected;
|
||||
[self.inputView resignFirstResponder];
|
||||
CGRect keyboardEndFrame = CGRectMake(0, 0, 0, 0);
|
||||
[UIView animateWithDuration:0.25 animations:^{
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(keyboardWillChangeFrame:)]) {
|
||||
[self.delegate keyboardWillChangeFrame:keyboardEndFrame];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)audioButtonAction:(UIButton *)sender {
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setSendDisabled:(BOOL)sendDisabled {
|
||||
self.userInteractionEnabled = !sendDisabled;
|
||||
if (sendDisabled) {
|
||||
self.inputView.text = @"";
|
||||
NSAttributedString * attribute = [[NSAttributedString alloc] initWithString:@"暂时无法私聊" attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:15], NSForegroundColorAttributeName : [ThemeColor secondTextColor]}];
|
||||
self.inputView.attributedPlaceholder = attribute;
|
||||
} else {
|
||||
NSAttributedString * attribute = [[NSAttributedString alloc] initWithString:@"请输入消息" attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:15], NSForegroundColorAttributeName : [ThemeColor secondTextColor]}];
|
||||
self.inputView.attributedPlaceholder = attribute;
|
||||
}
|
||||
}
|
||||
|
||||
- (UIStackView *)stackView {
|
||||
if (!_stackView) {
|
||||
_stackView = [[UIStackView alloc] init];
|
||||
_stackView.axis = UILayoutConstraintAxisVertical;
|
||||
_stackView.distribution = UIStackViewDistributionFill;
|
||||
_stackView.alignment = UIStackViewAlignmentFill;
|
||||
_stackView.spacing = 0;
|
||||
}
|
||||
return _stackView;
|
||||
}
|
||||
|
||||
- (UIStackView *)toolStackView {
|
||||
if (!_toolStackView) {
|
||||
_toolStackView = [[UIStackView alloc] init];
|
||||
_toolStackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
_toolStackView.distribution = UIStackViewDistributionFill;
|
||||
_toolStackView.alignment = UIStackViewAlignmentCenter;
|
||||
_toolStackView.spacing = 8;
|
||||
}
|
||||
return _toolStackView;
|
||||
}
|
||||
|
||||
- (UIButton *)changeButton {
|
||||
if (!_changeButton) {
|
||||
_changeButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_changeButton setImage:[UIImage imageNamed:@"message_session_tool_text"] forState:UIControlStateNormal];
|
||||
[_changeButton setImage:[UIImage imageNamed:@"message_session_tool_audio"] forState:UIControlStateSelected];
|
||||
[_changeButton addTarget:self action:@selector(changeButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _changeButton;
|
||||
}
|
||||
|
||||
- (UIStackView *)audioStackView {
|
||||
if (!_audioStackView) {
|
||||
_audioStackView = [[UIStackView alloc] init];
|
||||
_audioStackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
_audioStackView.distribution = UIStackViewDistributionFill;
|
||||
_audioStackView.alignment = UIStackViewAlignmentCenter;
|
||||
_audioStackView.spacing = 0;
|
||||
}
|
||||
return _audioStackView;
|
||||
}
|
||||
|
||||
- (UIView *)inputBackView {
|
||||
if (!_inputBackView) {
|
||||
_inputBackView = [[UIView alloc] init];
|
||||
_inputBackView.backgroundColor = UIColorFromRGB(0xF1F1FA);
|
||||
_inputBackView.layer.masksToBounds = YES;
|
||||
_inputBackView.layer.cornerRadius = 17;
|
||||
}
|
||||
return _inputBackView;
|
||||
}
|
||||
|
||||
- (UITextField *)inputView{
|
||||
if (!_inputView) {
|
||||
_inputView = [[UITextField alloc] init];
|
||||
NSAttributedString * attribute = [[NSAttributedString alloc] initWithString:@"请输入消息" attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:15], NSForegroundColorAttributeName : [ThemeColor secondTextColor]}];
|
||||
_inputView.attributedPlaceholder = attribute;
|
||||
_inputView.borderStyle = UITextBorderStyleNone;
|
||||
_inputView.tintColor = [ThemeColor appMainColor];
|
||||
_inputView.textColor = [ThemeColor mainTextColor];
|
||||
_inputView.font = [UIFont systemFontOfSize:12.f];
|
||||
_inputView.delegate = self;
|
||||
_inputView.autocorrectionType = UITextAutocorrectionTypeNo;
|
||||
_inputView.returnKeyType = UIReturnKeySend;
|
||||
}
|
||||
return _inputView;
|
||||
}
|
||||
|
||||
- (UIButton *)audioButton {
|
||||
if (!_audioButton) {
|
||||
_audioButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_audioButton setTitle:@"按住说话" forState:UIControlStateNormal];
|
||||
[_audioButton setTitleColor:[ThemeColor mainTextColor] forState:UIControlStateNormal];
|
||||
_audioButton.titleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightBold];
|
||||
_audioButton.layer.masksToBounds = YES;
|
||||
_audioButton.layer.cornerRadius = 17;
|
||||
_audioButton.backgroundColor = UIColorFromRGB(0xF1F1FA);
|
||||
[_audioButton addTarget:self action:@selector(audioButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
_audioButton.hidden = YES;
|
||||
}
|
||||
return _audioButton;
|
||||
}
|
||||
|
||||
- (UIButton *)moreButton {
|
||||
if (!_moreButton) {
|
||||
_moreButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_moreButton setImage:[UIImage imageNamed:@"message_session_tool_more_normal"] forState:UIControlStateNormal];
|
||||
[_moreButton setImage:[UIImage imageNamed:@"message_session_tool_more_select"] forState:UIControlStateSelected];
|
||||
[_moreButton addTarget:self action:@selector(moreButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _moreButton;
|
||||
}
|
||||
|
||||
- (UICollectionView *)collectionView{
|
||||
if (!_collectionView) {
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
|
||||
layout.itemSize = CGSizeMake(48, 48);
|
||||
layout.minimumLineSpacing = 24;
|
||||
layout.minimumInteritemSpacing = 10;
|
||||
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
||||
_collectionView.dataSource = self;
|
||||
_collectionView.delegate = self;
|
||||
_collectionView.backgroundColor = [UIColor clearColor];
|
||||
_collectionView.hidden = YES;
|
||||
[_collectionView registerClass:[MessageToolMenuCollectionViewCell class] forCellWithReuseIdentifier:NSStringFromClass([MessageToolMenuCollectionViewCell class])];
|
||||
}
|
||||
return _collectionView;
|
||||
}
|
||||
|
||||
- (UIView *)placeView {
|
||||
if (!_placeView) {
|
||||
_placeView = [[UIView alloc] init];
|
||||
_placeView.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return _placeView;
|
||||
}
|
||||
|
||||
- (NSArray<MessageMenuModel *> *)menuList {
|
||||
if (!_menuList) {
|
||||
MessageMenuModel * phototModel = [[MessageMenuModel alloc] init];
|
||||
phototModel.imageName = @"message_session_menu_photo";
|
||||
phototModel.type= MessageMenuType_Photo;
|
||||
|
||||
MessageMenuModel * giftModel = [[MessageMenuModel alloc] init];
|
||||
giftModel.imageName = @"message_session_menu_gift";
|
||||
giftModel.type= MessageMenuType_Gift;
|
||||
|
||||
_menuList = @[phototModel, giftModel];
|
||||
}
|
||||
return _menuList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@end
|
@@ -6,40 +6,41 @@
|
||||
//
|
||||
|
||||
#import "SessionViewController.h"
|
||||
#import "MessageCell.h"
|
||||
#import "SendMessageView.h"
|
||||
#import "SessionChatLimitView.h"
|
||||
#import "UITableView+NIMScrollToBottom.h"
|
||||
|
||||
#import <Masonry/Masonry.h>
|
||||
#import <IQKeyboardManager/IQKeyboardManager.h>
|
||||
///Tool
|
||||
#import "XCCurrentVCStackManager.h"
|
||||
#import "NIMMessageMaker.h"
|
||||
#import "XPMacro.h"
|
||||
|
||||
#import <Masonry/Masonry.h>
|
||||
|
||||
#import "MessagePresenter.h"
|
||||
#import "MessageProtocol.h"
|
||||
#import "UITableView+NIMScrollToBottom.h"
|
||||
///Model
|
||||
#import "RoomInfoModel.h"
|
||||
#import "UserInfoModel.h"
|
||||
#import "MessageMenuModel.h"
|
||||
///View
|
||||
#import "XPSessionMessageHeadView.h"
|
||||
#import "XPMineUserInfoViewController.h"
|
||||
#import "XPRoomViewController.h"
|
||||
#import "RoomHostDelegate.h"
|
||||
///Model
|
||||
#import "RoomInfoModel.h"
|
||||
#import "UserInfoModel.h"
|
||||
///Tool
|
||||
#import "XCCurrentVCStackManager.h"
|
||||
#import "SessionToolbarView.h"
|
||||
#import "MessageCell.h"
|
||||
#import "SessionChatLimitView.h"
|
||||
///P
|
||||
#import "MessagePresenter.h"
|
||||
#import "MessageProtocol.h"
|
||||
|
||||
@interface SessionViewController ()<MessageProtocol, UITableViewDelegate, UITableViewDataSource, NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMMediaManagerDelegate, SendMessageViewDelegate, XPSessionMessageHeadViewDelegate, MessageCellDelegate>
|
||||
|
||||
@interface SessionViewController ()<MessageProtocol, UITableViewDelegate, UITableViewDataSource, NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMMediaManagerDelegate, XPSessionMessageHeadViewDelegate, MessageCellDelegate, SessionToolbarViewDelegate>
|
||||
|
||||
@property (nonatomic, strong) NIMSession * session;
|
||||
@property (nonatomic, strong) NSMutableArray<NIMMessage *> * messages;
|
||||
|
||||
@property (nonatomic, strong) UITableView * sessionTableView;
|
||||
@property (nonatomic, strong) SendMessageView * sendMessageView;
|
||||
///跟随进房卡片
|
||||
@property (nonatomic, strong) XPSessionMessageHeadView *followInRoomView;
|
||||
@property (nonatomic, strong) UserInfoModel *userInfo;
|
||||
|
||||
///输入框
|
||||
@property (nonatomic,strong) SessionToolbarView *toolbarView;
|
||||
@end
|
||||
|
||||
@implementation SessionViewController
|
||||
@@ -59,18 +60,19 @@
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_session = session;
|
||||
[self initViews];
|
||||
[self initLayout];
|
||||
[self initViews];
|
||||
[self initLayout];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[IQKeyboardManager sharedManager].enable = NO;
|
||||
[IQKeyboardManager sharedManager].enableAutoToolbar = NO;
|
||||
[self initData];
|
||||
[[NIMSDK sharedSDK].chatManager addDelegate:self];
|
||||
[[NIMSDK sharedSDK].conversationManager addDelegate:self];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
|
||||
[self.presenter getUserInfo:self.session.sessionId];
|
||||
}
|
||||
|
||||
@@ -84,7 +86,7 @@
|
||||
|
||||
[self.view addSubview:self.followInRoomView];
|
||||
[self.view addSubview:self.sessionTableView];
|
||||
[self.view addSubview:self.sendMessageView];
|
||||
[self.view addSubview:self.toolbarView];
|
||||
}
|
||||
|
||||
- (void)initLayout {
|
||||
@@ -94,12 +96,13 @@
|
||||
}];
|
||||
[self.sessionTableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.top.mas_equalTo(self.view);
|
||||
make.bottom.mas_equalTo(self.sendMessageView.mas_top);
|
||||
make.bottom.mas_equalTo(self.toolbarView.mas_top);
|
||||
}];
|
||||
|
||||
[self.sendMessageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.bottom.mas_equalTo(self.view);
|
||||
}];
|
||||
[self.toolbarView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.view);
|
||||
make.bottom.mas_equalTo(self.view);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)initData {
|
||||
@@ -119,17 +122,6 @@
|
||||
[self.presenter getChatLimitReceiverUid:self.session.sessionId];
|
||||
}
|
||||
|
||||
- (void)keyboardWillShow:(NSNotification *)notification {
|
||||
NSDictionary *info = [notification userInfo];
|
||||
NSNumber *curve = [info objectForKey:UIKeyboardAnimationCurveUserInfoKey];
|
||||
CGFloat duration = [[info objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue];
|
||||
|
||||
UIViewAnimationOptions options = (UIViewAnimationOptions)curve << 16;
|
||||
[UIView animateWithDuration:duration delay:0.0 options:options animations:^{
|
||||
[self.sessionTableView nim_scrollToBottom:YES];
|
||||
} completion:nil];
|
||||
}
|
||||
|
||||
#pragma mark - MessageProtocol
|
||||
- (void)onGetLimitChat:(ChatLimitModel *)chatLimit {
|
||||
BOOL chatDisabled = !chatLimit.chat && self.messages.count <= 0;
|
||||
@@ -139,7 +131,7 @@
|
||||
} else {
|
||||
self.sessionTableView.tableHeaderView = nil;
|
||||
}
|
||||
self.sendMessageView.sendDisabled = chatDisabled;
|
||||
self.toolbarView.sendDisabled = chatDisabled;
|
||||
}
|
||||
|
||||
///获取用户信息成功
|
||||
@@ -190,6 +182,10 @@
|
||||
return [MessageCell measureHeight:msg];
|
||||
}
|
||||
|
||||
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
|
||||
[self.toolbarView foldMenuView];
|
||||
}
|
||||
|
||||
#pragma mark - NIMChatManagerDelegate
|
||||
- (void)onRecvMessages:(NSArray<NIMMessage *> *)messages {
|
||||
NIMMessage *message = messages.firstObject;
|
||||
@@ -270,12 +266,33 @@
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - SendMessageViewDelegate
|
||||
- (void)sendTextMessage:(NSString *)text {
|
||||
NIMMessage *message = [NIMMessageMaker msgWithText:text];
|
||||
[[[NIMSDK sharedSDK] chatManager] sendMessage:message toSession:self.session error:nil];
|
||||
#pragma mark - MessageToolbarViewDelegate
|
||||
- (void)keyboardWillChangeFrame:(CGRect)rect {
|
||||
CGFloat heightFromBottom = rect.size.height;
|
||||
heightFromBottom = MAX(0.0, heightFromBottom);
|
||||
[self.toolbarView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.mas_equalTo(self.view).offset(-heightFromBottom);
|
||||
}];
|
||||
[self.sessionTableView nim_scrollToBottom:YES];
|
||||
}
|
||||
|
||||
- (void)sendTextMessage:(NSString *)text {
|
||||
NIMMessage *message = [NIMMessageMaker msgWithText:text];
|
||||
[[[NIMSDK sharedSDK] chatManager] sendMessage:message toSession:self.session error:nil];
|
||||
}
|
||||
|
||||
- (void)didSelectMenuItem:(MessageMenuModel *)info {
|
||||
switch (info.type) {
|
||||
case MessageMenuType_Photo:
|
||||
break;
|
||||
case MessageMenuType_Gift:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (NSArray<NIMMessage *> *)messages {
|
||||
if (!_messages) {
|
||||
_messages = [[NSMutableArray alloc] init];
|
||||
@@ -283,6 +300,12 @@
|
||||
return _messages;
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)closeKeyBoard {
|
||||
[self.view endEditing:YES];
|
||||
[self.toolbarView foldMenuView];
|
||||
}
|
||||
|
||||
- (UITableView *)sessionTableView {
|
||||
if (!_sessionTableView) {
|
||||
_sessionTableView = [[UITableView alloc] init];
|
||||
@@ -297,20 +320,6 @@
|
||||
return _sessionTableView;
|
||||
}
|
||||
|
||||
- (void)closeKeyBoard {
|
||||
[self.view endEditing:YES];
|
||||
[self.sessionTableView endEditing:YES];
|
||||
}
|
||||
|
||||
- (SendMessageView *)sendMessageView {
|
||||
if (!_sendMessageView) {
|
||||
_sendMessageView = [[SendMessageView alloc] init];
|
||||
_sendMessageView.delegate = self;
|
||||
_sendMessageView.sendDisabled = YES;
|
||||
}
|
||||
return _sendMessageView;
|
||||
}
|
||||
|
||||
- (XPSessionMessageHeadView *)followInRoomView {
|
||||
if (!_followInRoomView) {
|
||||
_followInRoomView = [[XPSessionMessageHeadView alloc] init];
|
||||
@@ -320,4 +329,12 @@
|
||||
return _followInRoomView;
|
||||
}
|
||||
|
||||
- (SessionToolbarView *)toolbarView {
|
||||
if (!_toolbarView) {
|
||||
_toolbarView = [[SessionToolbarView alloc] init];
|
||||
_toolbarView.delegate = self;
|
||||
}
|
||||
return _toolbarView;
|
||||
}
|
||||
|
||||
@end
|
||||
|