聊天大厅接口对接
@@ -217,6 +217,17 @@
|
||||
235714642BE8BEA0004C81D6 /* CALayer+Animation.m in Sources */ = {isa = PBXBuildFile; fileRef = 235714632BE8BEA0004C81D6 /* CALayer+Animation.m */; };
|
||||
235714672BE8C009004C81D6 /* MSSessionScrollingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 235714662BE8C009004C81D6 /* MSSessionScrollingView.m */; };
|
||||
2357146B2BEA0110004C81D6 /* MSSessionPublicChatHallTopModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 2357146A2BEA0110004C81D6 /* MSSessionPublicChatHallTopModel.m */; };
|
||||
2357146E2BEB816B004C81D6 /* MSSessionPublicChatHallHeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2357146D2BEB816B004C81D6 /* MSSessionPublicChatHallHeadView.m */; };
|
||||
235714712BEB97BD004C81D6 /* MSSessionScrollingItemView.m in Sources */ = {isa = PBXBuildFile; fileRef = 235714702BEB97BD004C81D6 /* MSSessionScrollingItemView.m */; };
|
||||
235714742BEC6E3D004C81D6 /* MSSessionReleaseHeadlinesView.m in Sources */ = {isa = PBXBuildFile; fileRef = 235714732BEC6E3D004C81D6 /* MSSessionReleaseHeadlinesView.m */; };
|
||||
235714772BEC9E5E004C81D6 /* MSSessionContextHeadlinesView.m in Sources */ = {isa = PBXBuildFile; fileRef = 235714762BEC9E5E004C81D6 /* MSSessionContextHeadlinesView.m */; };
|
||||
2357147A2BECA102004C81D6 /* MessageHeadlinesModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 235714792BECA102004C81D6 /* MessageHeadlinesModel.m */; };
|
||||
235714802BECB217004C81D6 /* MSSessionReleaseHeadlinesPayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2357147F2BECB217004C81D6 /* MSSessionReleaseHeadlinesPayView.m */; };
|
||||
235714862BECC24F004C81D6 /* MessageContentHeadLinesText.m in Sources */ = {isa = PBXBuildFile; fileRef = 235714852BECC24F004C81D6 /* MessageContentHeadLinesText.m */; };
|
||||
235714892BECC38F004C81D6 /* MessageHeadlinesTextModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 235714882BECC38F004C81D6 /* MessageHeadlinesTextModel.m */; };
|
||||
2357148C2BECEE33004C81D6 /* MSSessionPublicChatHalTextCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 2357148B2BECEE33004C81D6 /* MSSessionPublicChatHalTextCell.m */; };
|
||||
2357148F2BEDC94D004C81D6 /* MSSessionPublicChatHalImageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 2357148E2BEDC94D004C81D6 /* MSSessionPublicChatHalImageCell.m */; };
|
||||
235714922BEDC9B1004C81D6 /* MSSessionPublicChatHalImageModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 235714912BEDC9B1004C81D6 /* MSSessionPublicChatHalImageModel.m */; };
|
||||
235A451A2B04A352009753F5 /* PIRoomActivityWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = 235A45192B04A352009753F5 /* PIRoomActivityWebView.m */; };
|
||||
235A451D2B04A452009753F5 /* PIRoomActivityWebCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 235A451C2B04A452009753F5 /* PIRoomActivityWebCell.m */; };
|
||||
235A45232B04BEB6009753F5 /* PIBaseModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 235A45222B04BEB6009753F5 /* PIBaseModel.m */; };
|
||||
@@ -1940,6 +1951,28 @@
|
||||
235714682BE8C055004C81D6 /* MSSessionScrollingProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSSessionScrollingProtocol.h; sourceTree = "<group>"; };
|
||||
235714692BEA0110004C81D6 /* MSSessionPublicChatHallTopModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSSessionPublicChatHallTopModel.h; sourceTree = "<group>"; };
|
||||
2357146A2BEA0110004C81D6 /* MSSessionPublicChatHallTopModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSSessionPublicChatHallTopModel.m; sourceTree = "<group>"; };
|
||||
2357146C2BEB816B004C81D6 /* MSSessionPublicChatHallHeadView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSSessionPublicChatHallHeadView.h; sourceTree = "<group>"; };
|
||||
2357146D2BEB816B004C81D6 /* MSSessionPublicChatHallHeadView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSSessionPublicChatHallHeadView.m; sourceTree = "<group>"; };
|
||||
2357146F2BEB97BD004C81D6 /* MSSessionScrollingItemView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSSessionScrollingItemView.h; sourceTree = "<group>"; };
|
||||
235714702BEB97BD004C81D6 /* MSSessionScrollingItemView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSSessionScrollingItemView.m; sourceTree = "<group>"; };
|
||||
235714722BEC6E3D004C81D6 /* MSSessionReleaseHeadlinesView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSSessionReleaseHeadlinesView.h; sourceTree = "<group>"; };
|
||||
235714732BEC6E3D004C81D6 /* MSSessionReleaseHeadlinesView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSSessionReleaseHeadlinesView.m; sourceTree = "<group>"; };
|
||||
235714752BEC9E5E004C81D6 /* MSSessionContextHeadlinesView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSSessionContextHeadlinesView.h; sourceTree = "<group>"; };
|
||||
235714762BEC9E5E004C81D6 /* MSSessionContextHeadlinesView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSSessionContextHeadlinesView.m; sourceTree = "<group>"; };
|
||||
235714782BECA102004C81D6 /* MessageHeadlinesModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessageHeadlinesModel.h; sourceTree = "<group>"; };
|
||||
235714792BECA102004C81D6 /* MessageHeadlinesModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessageHeadlinesModel.m; sourceTree = "<group>"; };
|
||||
2357147E2BECB217004C81D6 /* MSSessionReleaseHeadlinesPayView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSSessionReleaseHeadlinesPayView.h; sourceTree = "<group>"; };
|
||||
2357147F2BECB217004C81D6 /* MSSessionReleaseHeadlinesPayView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSSessionReleaseHeadlinesPayView.m; sourceTree = "<group>"; };
|
||||
235714842BECC24F004C81D6 /* MessageContentHeadLinesText.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessageContentHeadLinesText.h; sourceTree = "<group>"; };
|
||||
235714852BECC24F004C81D6 /* MessageContentHeadLinesText.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessageContentHeadLinesText.m; sourceTree = "<group>"; };
|
||||
235714872BECC38F004C81D6 /* MessageHeadlinesTextModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessageHeadlinesTextModel.h; sourceTree = "<group>"; };
|
||||
235714882BECC38F004C81D6 /* MessageHeadlinesTextModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessageHeadlinesTextModel.m; sourceTree = "<group>"; };
|
||||
2357148A2BECEE33004C81D6 /* MSSessionPublicChatHalTextCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSSessionPublicChatHalTextCell.h; sourceTree = "<group>"; };
|
||||
2357148B2BECEE33004C81D6 /* MSSessionPublicChatHalTextCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSSessionPublicChatHalTextCell.m; sourceTree = "<group>"; };
|
||||
2357148D2BEDC94D004C81D6 /* MSSessionPublicChatHalImageCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSSessionPublicChatHalImageCell.h; sourceTree = "<group>"; };
|
||||
2357148E2BEDC94D004C81D6 /* MSSessionPublicChatHalImageCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSSessionPublicChatHalImageCell.m; sourceTree = "<group>"; };
|
||||
235714902BEDC9B1004C81D6 /* MSSessionPublicChatHalImageModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSSessionPublicChatHalImageModel.h; sourceTree = "<group>"; };
|
||||
235714912BEDC9B1004C81D6 /* MSSessionPublicChatHalImageModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSSessionPublicChatHalImageModel.m; sourceTree = "<group>"; };
|
||||
235A45182B04A352009753F5 /* PIRoomActivityWebView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PIRoomActivityWebView.h; sourceTree = "<group>"; };
|
||||
235A45192B04A352009753F5 /* PIRoomActivityWebView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PIRoomActivityWebView.m; sourceTree = "<group>"; };
|
||||
235A451B2B04A452009753F5 /* PIRoomActivityWebCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PIRoomActivityWebCell.h; sourceTree = "<group>"; };
|
||||
@@ -5114,6 +5147,10 @@
|
||||
9B88E20B28C5EB8300D26FBA /* MessageContentRedPacketView.m */,
|
||||
E8778AE22988B57B00CF139B /* MessageContentRevokeView.h */,
|
||||
E8778AE32988B57B00CF139B /* MessageContentRevokeView.m */,
|
||||
235714752BEC9E5E004C81D6 /* MSSessionContextHeadlinesView.h */,
|
||||
235714762BEC9E5E004C81D6 /* MSSessionContextHeadlinesView.m */,
|
||||
235714842BECC24F004C81D6 /* MessageContentHeadLinesText.h */,
|
||||
235714852BECC24F004C81D6 /* MessageContentHeadLinesText.m */,
|
||||
);
|
||||
path = Content;
|
||||
sourceTree = "<group>";
|
||||
@@ -7268,6 +7305,12 @@
|
||||
E82107862987E49100DE7040 /* MessageRedPacketModel.m */,
|
||||
E8778ADF2988B4C300CF139B /* MessageRevokeModel.h */,
|
||||
E8778AE02988B4C300CF139B /* MessageRevokeModel.m */,
|
||||
235714782BECA102004C81D6 /* MessageHeadlinesModel.h */,
|
||||
235714792BECA102004C81D6 /* MessageHeadlinesModel.m */,
|
||||
235714872BECC38F004C81D6 /* MessageHeadlinesTextModel.h */,
|
||||
235714882BECC38F004C81D6 /* MessageHeadlinesTextModel.m */,
|
||||
235714902BEDC9B1004C81D6 /* MSSessionPublicChatHalImageModel.h */,
|
||||
235714912BEDC9B1004C81D6 /* MSSessionPublicChatHalImageModel.m */,
|
||||
);
|
||||
path = SesssionModel;
|
||||
sourceTree = "<group>";
|
||||
@@ -8703,6 +8746,10 @@
|
||||
children = (
|
||||
9B7D804B27537950003DAC0C /* MessageCell.h */,
|
||||
9B7D804C27537950003DAC0C /* MessageCell.m */,
|
||||
2357148A2BECEE33004C81D6 /* MSSessionPublicChatHalTextCell.h */,
|
||||
2357148B2BECEE33004C81D6 /* MSSessionPublicChatHalTextCell.m */,
|
||||
2357148D2BEDC94D004C81D6 /* MSSessionPublicChatHalImageCell.h */,
|
||||
2357148E2BEDC94D004C81D6 /* MSSessionPublicChatHalImageCell.m */,
|
||||
E875A1B629755EE200AB1BBD /* SessionUserInfoTableViewCell.h */,
|
||||
E875A1B729755EE200AB1BBD /* SessionUserInfoTableViewCell.m */,
|
||||
E885D531297798E1004DC088 /* SessionSettingTableViewCell.h */,
|
||||
@@ -9521,6 +9568,14 @@
|
||||
E885D5382977D10E004DC088 /* SessionSettingUserView.m */,
|
||||
235714652BE8C009004C81D6 /* MSSessionScrollingView.h */,
|
||||
235714662BE8C009004C81D6 /* MSSessionScrollingView.m */,
|
||||
2357146F2BEB97BD004C81D6 /* MSSessionScrollingItemView.h */,
|
||||
235714702BEB97BD004C81D6 /* MSSessionScrollingItemView.m */,
|
||||
2357146C2BEB816B004C81D6 /* MSSessionPublicChatHallHeadView.h */,
|
||||
2357146D2BEB816B004C81D6 /* MSSessionPublicChatHallHeadView.m */,
|
||||
235714722BEC6E3D004C81D6 /* MSSessionReleaseHeadlinesView.h */,
|
||||
235714732BEC6E3D004C81D6 /* MSSessionReleaseHeadlinesView.m */,
|
||||
2357147E2BECB217004C81D6 /* MSSessionReleaseHeadlinesPayView.h */,
|
||||
2357147F2BECB217004C81D6 /* MSSessionReleaseHeadlinesPayView.m */,
|
||||
);
|
||||
path = View;
|
||||
sourceTree = "<group>";
|
||||
@@ -11114,6 +11169,7 @@
|
||||
9B9BBF83288FBFB3004E2E74 /* XPNewUserRoomGiftView.m in Sources */,
|
||||
E838369A298A59C100112E1C /* MessageTipsView.m in Sources */,
|
||||
E8899C852785CC69007944BE /* XPRoomDatingAnimationView.m in Sources */,
|
||||
235714862BECC24F004C81D6 /* MessageContentHeadLinesText.m in Sources */,
|
||||
2331C16F2A5EB71000E1D940 /* XPNobleCenterNavView.m in Sources */,
|
||||
E85E7B1B2A4EB0D200B6D00A /* XPMineMainIncomeStatisViewController.m in Sources */,
|
||||
E84BF7D4277C383700EF8877 /* XPRoomSettingInputView.m in Sources */,
|
||||
@@ -11171,6 +11227,7 @@
|
||||
E8EEB8F726FC2673007C6EBA /* UserPhoto.m in Sources */,
|
||||
E81061002987CDCC00B772F0 /* MessageTweetModel.m in Sources */,
|
||||
E87DF4CC2A42C960009C1185 /* HomeBannerInfoModel.m in Sources */,
|
||||
235714892BECC38F004C81D6 /* MessageHeadlinesTextModel.m in Sources */,
|
||||
E8664EDF27E45EC7000171BA /* XPRoomPKRecordPresenter.m in Sources */,
|
||||
238B37B62AC55A2C00BFC9D5 /* XPTreasureFairyShopingRecordCell.m in Sources */,
|
||||
23FF25762ABD66B90064E904 /* XPFreeGiftsObtainView.m in Sources */,
|
||||
@@ -11201,6 +11258,7 @@
|
||||
9BAC92F528E6E63000147DD8 /* XPRoomInsideOperationCell.m in Sources */,
|
||||
9BE570BC28F65B7200D491A5 /* XPMineCollectRoomCell.m in Sources */,
|
||||
E86A16C22856D635004228B8 /* XPSessionFindNewGreetTableViewCell.m in Sources */,
|
||||
235714742BEC6E3D004C81D6 /* MSSessionReleaseHeadlinesView.m in Sources */,
|
||||
E824544E26F5BC1A00BE8163 /* XPMineModifPayPwdView.m in Sources */,
|
||||
E86E79CD28A4E045006DAF48 /* MessageContentRiskAlertView.m in Sources */,
|
||||
E855515B280559FE005F293F /* NSDate+DateUtils.m in Sources */,
|
||||
@@ -11622,6 +11680,7 @@
|
||||
E85E7B372A4EB0D300B6D00A /* XPMineGuildListCell.m in Sources */,
|
||||
E85E7B502A4EB0D300B6D00A /* XPMineGuildListVC.m in Sources */,
|
||||
E824546126F5F4E400BE8163 /* XPMineResetPayPwdViewController.m in Sources */,
|
||||
235714772BEC9E5E004C81D6 /* MSSessionContextHeadlinesView.m in Sources */,
|
||||
2357146B2BEA0110004C81D6 /* MSSessionPublicChatHallTopModel.m in Sources */,
|
||||
E81D58822720082A003063FE /* MicroWaveView.m in Sources */,
|
||||
E8A73F8728586A6F00FD9CBC /* XPGiftWeekStarCollectionViewCell.m in Sources */,
|
||||
@@ -11853,6 +11912,7 @@
|
||||
E86F6185284F4E4800E8EC9A /* RoomHalfHourRankModel.m in Sources */,
|
||||
9B208A362779B50100F9E54A /* GiftNobleInfoModel.m in Sources */,
|
||||
E80A086227F2AC190027B30C /* RoomPKDetailInfoModel.m in Sources */,
|
||||
2357146E2BEB816B004C81D6 /* MSSessionPublicChatHallHeadView.m in Sources */,
|
||||
238B37CD2AC55A2C00BFC9D5 /* XPTreasureFailyResultView.m in Sources */,
|
||||
E824545126F5CE6E00BE8163 /* XPMineModifPayPwdPresenter.m in Sources */,
|
||||
1464C5ED29A4784F00AF7C94 /* XPMineSimpleUserInfoViewController.m in Sources */,
|
||||
@@ -11895,6 +11955,7 @@
|
||||
E81060EE2987C35700B772F0 /* MessageTextClickModel.m in Sources */,
|
||||
E87AE8C5284E1A8400CAFBB3 /* XPRoomNewUserGreetView.m in Sources */,
|
||||
E8A3540728FEBD460014A784 /* XPWishGiftCreateItemViewController.m in Sources */,
|
||||
235714802BECB217004C81D6 /* MSSessionReleaseHeadlinesPayView.m in Sources */,
|
||||
E87E627B2A3F5A0D002F68C9 /* XPNewHomeRecommendPresenter.m in Sources */,
|
||||
14DCAD08299B36A500A7DD31 /* XPLoginPwdViewController.m in Sources */,
|
||||
E81060F42987C6B200B772F0 /* MessageOpenLiveModel.m in Sources */,
|
||||
@@ -11969,12 +12030,14 @@
|
||||
E878894C273A607C00BF1D57 /* XPGiftUserCollectionViewCell.m in Sources */,
|
||||
23E9E9A72A80F1C300B792F2 /* XPNewMineHallIncomeVC.m in Sources */,
|
||||
2331C1712A5EB71000E1D940 /* XPNobleCenterTableHeadView.m in Sources */,
|
||||
2357148C2BECEE33004C81D6 /* MSSessionPublicChatHalTextCell.m in Sources */,
|
||||
181D7F212727D9DB00B7C059 /* SocialStageView.m in Sources */,
|
||||
E8AB630D28ADD8C60023B0D2 /* XPMonentTopicContainerViewController.m in Sources */,
|
||||
23E9EA7C2A83977400B792F2 /* MessageContentTreasureFairyView.m in Sources */,
|
||||
E8D4DE472940473500EC788D /* GiftTwelveStarFirstModel.m in Sources */,
|
||||
E87DF4FB2A42CCDE009C1185 /* XPHomeRedommendCollectionViewCell.m in Sources */,
|
||||
2368ECDA2BC3C02800EDF4C9 /* XPMineSwitchLanguageVC.m in Sources */,
|
||||
235714712BEB97BD004C81D6 /* MSSessionScrollingItemView.m in Sources */,
|
||||
187EEEF026E89FE8002833B2 /* AccountInfoStorage.m in Sources */,
|
||||
2331C1B82A60F32D00E1D940 /* XPRoomHalfWebView.m in Sources */,
|
||||
9BFE0D8E2898C8C300F53C24 /* XPAnchorCardSkillCollectionViewCell.m in Sources */,
|
||||
@@ -12169,11 +12232,13 @@
|
||||
E884C36C2743951B00E1EBED /* GiftReceiveInfoModel.m in Sources */,
|
||||
E85E7BB62A4ED59900B6D00A /* XPIncomeRecordGoldDetailsCell.m in Sources */,
|
||||
9B7B606227BB96E40070BB72 /* XPRoomAnchorInfoCardView.m in Sources */,
|
||||
2357147A2BECA102004C81D6 /* MessageHeadlinesModel.m in Sources */,
|
||||
E87DF4FE2A42CD7E009C1185 /* XPRoomSearchRecommendHeadView.m in Sources */,
|
||||
23CEFC4D2AFB8FC100576D89 /* BSXWDateUtil.m in Sources */,
|
||||
E85E7B442A4EB0D300B6D00A /* XPMineExchangeAuthorityCell.m in Sources */,
|
||||
E80B0734280D740600A79F63 /* MessageContentGuildView.m in Sources */,
|
||||
E8395334276A03C300CF2F24 /* XPMineDressUpPresenter.m in Sources */,
|
||||
2357148F2BEDC94D004C81D6 /* MSSessionPublicChatHalImageCell.m in Sources */,
|
||||
E85E7B212A4EB0D300B6D00A /* XPNewMineGuildIncomeRecordViewController.m in Sources */,
|
||||
23A439742AA1CF7C002E6039 /* XPNewHomeHeadView.m in Sources */,
|
||||
189DD75926E6003C00AB55B1 /* Api.m in Sources */,
|
||||
@@ -12264,6 +12329,7 @@
|
||||
236BA4982BB6AFED00C7C73A /* PINoblePrivilegeEmptyCell.m in Sources */,
|
||||
E88C729C2828F37D0047FB2B /* XPRoomMusicLibraryEmptyTableViewCell.m in Sources */,
|
||||
E85E7B0A2A4EB0D200B6D00A /* XPGuildManagerPerPresenter.m in Sources */,
|
||||
235714922BEDC9B1004C81D6 /* MSSessionPublicChatHalImageModel.m in Sources */,
|
||||
9B85F3562806DD8A006EDF51 /* XPAnchorPKFinishView.m in Sources */,
|
||||
238B37D72AC55A2C00BFC9D5 /* XPTreasureFairyTrialsBallView.m in Sources */,
|
||||
E85E7BA12A4EC99300B6D00A /* XPMineGiveDiamondModel.m in Sources */,
|
||||
|
22
YuMi/Assets.xcassets/chat/ms_message_headlines_text_left.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "ms_message_headlines_text_left@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "ms_message_headlines_text_left@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 450 B |
After Width: | Height: | Size: 705 B |
22
YuMi/Assets.xcassets/chat/ms_message_headlines_text_right.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "ms_message_headlines_text_right@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "ms_message_headlines_text_right@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 461 B |
After Width: | Height: | Size: 741 B |
22
YuMi/Assets.xcassets/chat/ms_message_send_headline_bnt.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "ms_message_send_headline_bnt@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "ms_message_send_headline_bnt@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
YuMi/Assets.xcassets/chat/ms_message_send_headline_bnt.imageset/ms_message_send_headline_bnt@2x.png
vendored
Normal file
After Width: | Height: | Size: 7.1 KiB |
BIN
YuMi/Assets.xcassets/chat/ms_message_send_headline_bnt.imageset/ms_message_send_headline_bnt@3x.png
vendored
Normal file
After Width: | Height: | Size: 11 KiB |
22
YuMi/Assets.xcassets/chat/ms_message_send_headline_bnt_ar.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "ms_message_send_headline_bnt_ar@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "ms_message_send_headline_bnt_ar@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 7.4 KiB |
After Width: | Height: | Size: 12 KiB |
22
YuMi/Assets.xcassets/chat/ms_message_send_headline_bnt_en.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "ms_message_send_headline_bnt_en@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "ms_message_send_headline_bnt_en@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 7.5 KiB |
After Width: | Height: | Size: 12 KiB |
22
YuMi/Assets.xcassets/chat/ms_public_chat_hall_add_icon.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "ms_public_chat_hall_add_icon@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "ms_public_chat_hall_add_icon@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
YuMi/Assets.xcassets/chat/ms_public_chat_hall_add_icon.imageset/ms_public_chat_hall_add_icon@2x.png
vendored
Normal file
After Width: | Height: | Size: 553 B |
BIN
YuMi/Assets.xcassets/chat/ms_public_chat_hall_add_icon.imageset/ms_public_chat_hall_add_icon@3x.png
vendored
Normal file
After Width: | Height: | Size: 960 B |
22
YuMi/Assets.xcassets/chat/ms_public_chat_hall_head_bg.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "ms_public_chat_hall_head_bg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "ms_public_chat_hall_head_bg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
YuMi/Assets.xcassets/chat/ms_public_chat_hall_head_bg.imageset/ms_public_chat_hall_head_bg@2x.png
vendored
Normal file
After Width: | Height: | Size: 59 KiB |
BIN
YuMi/Assets.xcassets/chat/ms_public_chat_hall_head_bg.imageset/ms_public_chat_hall_head_bg@3x.png
vendored
Normal file
After Width: | Height: | Size: 111 KiB |
22
YuMi/Assets.xcassets/chat/ms_public_chat_hall_head_broadcast_bg.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "ms_public_chat_hall_head_broadcast_bg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "ms_public_chat_hall_head_broadcast_bg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 109 KiB |
22
YuMi/Assets.xcassets/chat/ms_public_chat_hall_head_enter_bg.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "ms_public_chat_hall_head_enter_bg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "ms_public_chat_hall_head_enter_bg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 112 KiB |
22
YuMi/Assets.xcassets/jm/IncomeRecord/ms_headlines_pay_icon.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "ms_headlines_pay_icon@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "ms_headlines_pay_icon@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
YuMi/Assets.xcassets/jm/IncomeRecord/ms_headlines_pay_icon.imageset/ms_headlines_pay_icon@2x.png
vendored
Normal file
After Width: | Height: | Size: 543 B |
BIN
YuMi/Assets.xcassets/jm/IncomeRecord/ms_headlines_pay_icon.imageset/ms_headlines_pay_icon@3x.png
vendored
Normal file
After Width: | Height: | Size: 908 B |
@@ -20,6 +20,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
+(void)getPublicChatHallTopText:(HttpRequestHelperCompletion)complection;
|
||||
///获取聊天室数据
|
||||
+(void)getPublicChatHallList:(HttpRequestHelperCompletion)complection;
|
||||
///获取支付金额;
|
||||
+(void)getPublicChatHallTopTextPayMoney:(HttpRequestHelperCompletion)complection;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -23,10 +23,14 @@
|
||||
}
|
||||
///获取聊天室发送头条
|
||||
+(void)getPublicChatHallTopText:(HttpRequestHelperCompletion)complection{
|
||||
[self makeRequest:@"publicChatTopRecord/send" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, nil];
|
||||
[self makeRequest:@"publicChatTopRecord/getTop" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, nil];
|
||||
}
|
||||
///获取聊天室数据
|
||||
+(void)getPublicChatHallList:(HttpRequestHelperCompletion)complection{
|
||||
[self makeRequest:@"publicChatTopRecord/getChatForTop50" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, nil];
|
||||
}
|
||||
///获取支付金额
|
||||
+(void)getPublicChatHallTopTextPayMoney:(HttpRequestHelperCompletion)complection{
|
||||
[self makeRequest:@"/publicChatTopRecord/payMoney" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, nil];
|
||||
}
|
||||
@end
|
||||
|
@@ -120,6 +120,8 @@ typedef NS_ENUM(NSUInteger, CustomMessageType) {
|
||||
CustomMessageType_Super_Gift = 106,
|
||||
///通用飘屏
|
||||
CustomMessageType_General_Floating_Screen = 107,
|
||||
///聊天大厅上头条
|
||||
CustomMessageType_Chat_Hall_Headlinesn = 108,
|
||||
};
|
||||
|
||||
|
||||
@@ -653,6 +655,13 @@ typedef NS_ENUM(NSUInteger, CustomMessageTypeGeneralFloatingScreen) {
|
||||
Custom_Message_Sub_General_Floating_Screen_One_Room = 1071,//单房间
|
||||
Custom_Message_Sub_General_Floating_Screen_All_Room = 1072,///全部房间
|
||||
};
|
||||
///聊天大厅上头条
|
||||
//CustomMessageType_Chat_Hall_Headlinesn = 108,
|
||||
typedef NS_ENUM(NSUInteger, CustomMessageTypeChatHallHeadlinesn) {
|
||||
///所有房间
|
||||
Custom_Message_Sub_Chat_Hall_Headlinesn = 1081,//单房间
|
||||
|
||||
};
|
||||
@interface AttachmentModel : PIBaseModel<NIMCustomAttachment>
|
||||
@property (nonatomic,assign) int first;
|
||||
@property (nonatomic,assign) int second;
|
||||
|
@@ -15,6 +15,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property(nonatomic,assign) BOOL isTop;
|
||||
@property(nonatomic,copy) NSString *partitionId;
|
||||
@property(nonatomic,assign) NSString *recordStatus;
|
||||
@property(nonatomic,copy) NSString *nick;
|
||||
@property(nonatomic,assign) NSInteger endTime;
|
||||
@property(nonatomic,assign) NSInteger startTime;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -21,6 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic,copy)NSString *toAvatar;
|
||||
@property(nonatomic,copy) NSString *toNick;
|
||||
@property(nonatomic,copy) NSString *toUid;
|
||||
@property(nonatomic,assign) CGFloat width;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -8,5 +8,8 @@
|
||||
#import "MSSessionScrollingModel.h"
|
||||
|
||||
@implementation MSSessionScrollingModel
|
||||
|
||||
-(void)setContent:(NSString *)content{
|
||||
_content = content;
|
||||
_width = [UILabel getWidthWithText:_content height:kGetScaleWidth(11.5) font:kFontMedium(12)] + 5;
|
||||
}
|
||||
@end
|
||||
|
@@ -34,6 +34,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
-(void)getPublicChatHallTopText;
|
||||
///获取聊天室数据
|
||||
-(void)getPublicChatHallList;
|
||||
///获取支付金额;
|
||||
-(void)getPublicChatHallTopTextPayMoney;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -14,6 +14,8 @@
|
||||
#import "AccountInfoStorage.h"
|
||||
#import "NIMMessageUtils.h"
|
||||
#import "XPMessageRemoteExtModel.h"
|
||||
#import "MSSessionScrollingModel.h"
|
||||
#import "MSSessionPublicChatHallTopModel.h"
|
||||
|
||||
@implementation MessagePresenter
|
||||
|
||||
@@ -108,19 +110,27 @@
|
||||
///聊天室发送头条
|
||||
-(void)sendPublicChatHallTopTextWithcontent:(NSString *)content{
|
||||
[Api sendPublicChatHallTopText:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
|
||||
[[self getView]sendPublicChatHallTopTextSuccess];
|
||||
} showLoading:YES errorToast:YES] content:content];
|
||||
}
|
||||
///获取聊天室发送头条
|
||||
-(void)getPublicChatHallTopText{
|
||||
[Api getPublicChatHallTopText:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
|
||||
MSSessionPublicChatHallTopModel *model = [MSSessionPublicChatHallTopModel modelWithDictionary:data.data];
|
||||
[[self getView]getPublicChatHallTopTextSuccess:model];
|
||||
}]];
|
||||
}
|
||||
///获取聊天室数据
|
||||
-(void)getPublicChatHallList{
|
||||
[Api getPublicChatHallList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
|
||||
}];
|
||||
[Api getPublicChatHallList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
NSArray *list = [MSSessionScrollingModel modelsWithArray:data.data];
|
||||
[[self getView]getPublicChatHallListSuccess:list];
|
||||
}]];
|
||||
}
|
||||
///获取支付金额;
|
||||
-(void)getPublicChatHallTopTextPayMoney{
|
||||
[Api getPublicChatHallTopTextPayMoney:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
[[self getView]getPublicChatHallTopTextPayMoneySuccess:[NSString stringWithFormat:@"%@",data.data]];
|
||||
}]];
|
||||
}
|
||||
@end
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class ChatLimitModel, UserInfoModel,NIMChatroom;
|
||||
@class ChatLimitModel, UserInfoModel,NIMChatroom,MSSessionPublicChatHallTopModel,MSSessionScrollingModel;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -28,6 +28,14 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
-(void)enterPublicChatHallSuccess:(NIMChatroom *)chatRoom;
|
||||
///进入聊天室失败
|
||||
-(void)enterPublicChatHallFail:(NSInteger)code;
|
||||
///发送聊天室头条成功
|
||||
-(void)sendPublicChatHallTopTextSuccess;
|
||||
///获取发送聊天室头条
|
||||
-(void)getPublicChatHallTopTextSuccess:(MSSessionPublicChatHallTopModel *)model;
|
||||
///获取聊天室数据
|
||||
-(void)getPublicChatHallListSuccess:(NSArray<MSSessionScrollingModel *> *)list;
|
||||
///获取支付金额;
|
||||
-(void)getPublicChatHallTopTextPayMoneySuccess:(NSString *)money;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// MSSessionPublicChatHalImageCell.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/10.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MSSessionPublicChatHalImageCell : UITableViewCell
|
||||
- (void)render:(nonnull MessageBaseModel *)model ;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,425 @@
|
||||
//
|
||||
// MSSessionPublicChatHalImageCell.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/10.
|
||||
//
|
||||
#import "DJDKMIMOMColor.h"
|
||||
#import "NSObject+MJExtension.h"
|
||||
#import "QEmotionHelper.h"
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
#import <Masonry/Masonry.h>
|
||||
#import "SpriteSheetImageManager.h"
|
||||
#import "MessageHeadlinesTextModel.h"
|
||||
#import "XPMessageRemoteExtModel.h"
|
||||
#import "MSSessionPublicChatHalImageCell.h"
|
||||
#import "MSSessionPublicChatHalImageModel.h"
|
||||
#import "SDPhotoBrowser.h"
|
||||
|
||||
@interface MSSessionPublicChatHalImageCell()<SDPhotoBrowserDelegate>
|
||||
@property(nonatomic,strong) MSSessionPublicChatHalImageModel * imageModel;
|
||||
|
||||
///当前的消息
|
||||
@property (nonatomic,strong) NIMMessage *message;
|
||||
|
||||
///头饰
|
||||
@property (nonatomic,strong) YYAnimatedImageView *headWearImageView;
|
||||
///头饰
|
||||
@property (nonatomic,strong) YYAnimatedImageView *rightHeadWearImageView;
|
||||
///头饰播放
|
||||
@property (nonatomic, strong) SpriteSheetImageManager *manager;
|
||||
|
||||
/**
|
||||
左侧头像(私聊对象)
|
||||
*/
|
||||
@property (nonatomic, strong) NetImageView * leftAvatar;
|
||||
/**
|
||||
右侧头像(自己)
|
||||
*/
|
||||
@property (nonatomic, strong) NetImageView * rightAvatar;
|
||||
@property(nonatomic,strong) YYLabel *leftNameView;
|
||||
|
||||
@property(nonatomic,strong) UIImageView *leftBgImage;
|
||||
@property(nonatomic,strong) UIImageView *rightBgImage;
|
||||
///气泡
|
||||
@property (nonatomic,strong) NetImageView *leftBubbleImageView;
|
||||
///气泡
|
||||
@property (nonatomic,strong) NetImageView *rightBubbleImageView;
|
||||
|
||||
@property(nonatomic,strong) NetImageView *leftPicImageView;
|
||||
@property(nonatomic,strong) NetImageView *rightPicImageView;
|
||||
@end
|
||||
@implementation MSSessionPublicChatHalImageCell
|
||||
|
||||
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
|
||||
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
|
||||
if(self){
|
||||
[self installUI];
|
||||
[self installConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)installUI{
|
||||
self.contentView.backgroundColor = [UIColor clearColor];
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
self.selectionStyle = 0;
|
||||
[self addSubview:self.leftAvatar];
|
||||
[self addSubview:self.headWearImageView];
|
||||
[self addSubview:self.rightAvatar];
|
||||
[self addSubview:self.rightHeadWearImageView];
|
||||
[self addSubview:self.leftNameView];
|
||||
[self addSubview:self.leftBgImage];
|
||||
[self addSubview:self.rightBgImage];
|
||||
[self addSubview:self.leftBubbleImageView];
|
||||
[self addSubview:self.rightBubbleImageView];
|
||||
[self.leftBgImage addSubview:self.leftPicImageView];
|
||||
[self.rightBgImage addSubview:self.rightPicImageView];
|
||||
|
||||
|
||||
}
|
||||
-(void)installConstraints{
|
||||
[self.leftAvatar mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(kGetScaleWidth(15));
|
||||
make.width.height.mas_equalTo(kGetScaleWidth(48));
|
||||
make.top.mas_equalTo(kGetScaleWidth(10));
|
||||
}];
|
||||
[self.headWearImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.leftAvatar).with.insets(UIEdgeInsetsMake(kGetScaleWidth(10),kGetScaleWidth(10),kGetScaleWidth(10),kGetScaleWidth(10)));
|
||||
}];
|
||||
[self.leftNameView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(kGetScaleWidth(21));
|
||||
make.height.mas_equalTo(kGetScaleWidth(14));
|
||||
make.leading.mas_equalTo(kGetScaleWidth(72));
|
||||
make.width.mas_lessThanOrEqualTo(kGetScaleWidth(240));
|
||||
|
||||
}];
|
||||
[self.rightAvatar mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.width.height.equalTo(self.leftAvatar);
|
||||
make.trailing.mas_equalTo(-kGetScaleWidth(15));
|
||||
}];
|
||||
[self.rightHeadWearImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.rightAvatar).with.insets(UIEdgeInsetsMake(-kGetScaleWidth(10),-kGetScaleWidth(10),-kGetScaleWidth(10),-kGetScaleWidth(10)));
|
||||
}];
|
||||
[self.leftBgImage mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(kGetScaleWidth(72));
|
||||
make.width.mas_equalTo(kGetScaleWidth(52));
|
||||
make.height.mas_equalTo(kGetScaleWidth(36));
|
||||
make.top.mas_equalTo(kGetScaleWidth(45));
|
||||
}];
|
||||
[self.rightBgImage mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.trailing.mas_equalTo(-kGetScaleWidth(72));
|
||||
make.centerY.equalTo(self.rightAvatar);
|
||||
make.width.mas_equalTo(kGetScaleWidth(52));
|
||||
make.height.mas_greaterThanOrEqualTo(kGetScaleWidth(36));
|
||||
}];
|
||||
|
||||
|
||||
[self.leftBubbleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.leftBgImage);
|
||||
}];
|
||||
|
||||
[self.rightBubbleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.rightBgImage);
|
||||
|
||||
}];
|
||||
|
||||
[self.leftPicImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.leftBgImage).with.insets(UIEdgeInsetsMake(kGetScaleWidth(10),kGetScaleWidth(10),kGetScaleWidth(10),kGetScaleWidth(10)));
|
||||
}];
|
||||
|
||||
|
||||
[self.rightPicImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.rightBgImage).with.insets(UIEdgeInsetsMake(kGetScaleWidth(10),kGetScaleWidth(10),kGetScaleWidth(10),kGetScaleWidth(10)));
|
||||
|
||||
}];
|
||||
|
||||
self.leftAvatar.hidden = YES;
|
||||
self.leftNameView.hidden = YES;
|
||||
self.leftBgImage.hidden = YES;
|
||||
self.headWearImageView.hidden = YES;
|
||||
|
||||
self.leftBubbleImageView.hidden = YES;
|
||||
self.rightAvatar.hidden = YES;
|
||||
self.rightBgImage.hidden = YES;
|
||||
self.rightHeadWearImageView.hidden = YES;
|
||||
self.rightBubbleImageView.hidden = YES;
|
||||
|
||||
}
|
||||
#pragma mark - 懒加载
|
||||
|
||||
|
||||
- (void)render:(nonnull MessageBaseModel *)model {
|
||||
self.message = model.message;
|
||||
|
||||
|
||||
MSSessionPublicChatHalImageModel * imageModel = (MSSessionPublicChatHalImageModel *)model;
|
||||
self.imageModel = imageModel;
|
||||
XPMessageRemoteExtModel *extModel = imageModel.extModel;
|
||||
if(extModel == nil)return;
|
||||
self.leftAvatar.hidden = YES;
|
||||
self.leftNameView.hidden = YES;
|
||||
self.leftBgImage.hidden = YES;
|
||||
self.headWearImageView.hidden = YES;
|
||||
self.leftPicImageView.hidden = YES;
|
||||
self.rightPicImageView.hidden = YES;
|
||||
self.leftBubbleImageView.hidden = YES;
|
||||
self.rightAvatar.hidden = YES;
|
||||
self.rightBgImage.hidden = YES;
|
||||
self.rightHeadWearImageView.hidden = YES;
|
||||
self.rightBubbleImageView.hidden = YES;
|
||||
|
||||
if(imageModel.isSelf){
|
||||
|
||||
[self.rightPicImageView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(model.contentSize.height);
|
||||
make.width.mas_equalTo(model.contentSize.width);
|
||||
}];
|
||||
if (imageModel.image) {
|
||||
self.rightPicImageView.image = imageModel.image;
|
||||
}else {
|
||||
[self.rightPicImageView loadImageWithUrl:imageModel.imageUrl completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) {
|
||||
self.rightPicImageView.image = image;
|
||||
}];
|
||||
}
|
||||
[self.rightBgImage mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.trailing.mas_equalTo(-kGetScaleWidth(72));
|
||||
make.top.mas_equalTo(kGetScaleWidth(21));
|
||||
make.width.mas_equalTo(model.contentSize.width+kGetScaleWidth(10));
|
||||
make.height.mas_equalTo(model.contentSize.height+kGetScaleWidth(10));
|
||||
}];
|
||||
|
||||
|
||||
|
||||
self.rightAvatar.hidden = NO;
|
||||
self.rightBgImage.hidden = NO;
|
||||
self.rightHeadWearImageView.hidden = NO;
|
||||
self.rightBubbleImageView.hidden = NO;
|
||||
self.leftPicImageView.hidden = YES;
|
||||
self.rightPicImageView.hidden = NO;
|
||||
self.rightAvatar.image = nil;
|
||||
[self.rightAvatar loadImageWithUrl:extModel.avatar completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) {
|
||||
self.rightAvatar.image = image;
|
||||
}];
|
||||
|
||||
self.rightBubbleImageView.image = nil;
|
||||
|
||||
self.rightBgImage.image = [self resizableImage:kImage(@"ms_message_headlines_text_right")];
|
||||
[self.rightBubbleImageView loadImageWithUrl:extModel.iosBubbleUrl completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) {
|
||||
self.rightBgImage.image = nil;
|
||||
UIImage *image1 = [UIImage imageWithCGImage:image.CGImage scale:2.0 orientation:UIImageOrientationUp];
|
||||
self.rightBubbleImageView.image = [self resizableImage:image1];
|
||||
}];
|
||||
NSString *headwearUrl = extModel.headwearUrl;
|
||||
if (headwearUrl.length > 0) {
|
||||
NSURL *url = [NSURL URLWithString:headwearUrl];
|
||||
@kWeakify(self);
|
||||
[self.manager loadSpriteSheetImageWithURL:url completionBlock:^(YYSpriteSheetImage * _Nullable sprit) {
|
||||
@kStrongify(self);
|
||||
self.rightHeadWearImageView.image = sprit;
|
||||
} failureBlock:^(NSError * _Nullable error) {
|
||||
}];
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
[self.leftPicImageView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(model.contentSize.height);
|
||||
make.width.mas_equalTo(model.contentSize.width);
|
||||
}];
|
||||
if (imageModel.image) {
|
||||
self.leftPicImageView.image = imageModel.image;
|
||||
}else {
|
||||
[self.leftPicImageView loadImageWithUrl:imageModel.imageUrl completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) {
|
||||
self.leftPicImageView.image = image;
|
||||
}];
|
||||
}
|
||||
[self.leftBgImage mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(kGetScaleWidth(45));
|
||||
make.leading.mas_equalTo(kGetScaleWidth(72));
|
||||
make.width.mas_equalTo(model.contentSize.width+kGetScaleWidth(10));
|
||||
make.height.mas_equalTo(model.contentSize.height+kGetScaleWidth(10));
|
||||
}];
|
||||
NSString *headwearUrl = extModel.headwearUrl;
|
||||
if (headwearUrl.length > 0) {
|
||||
NSURL *url = [NSURL URLWithString:headwearUrl];
|
||||
@kWeakify(self);
|
||||
[self.manager loadSpriteSheetImageWithURL:url completionBlock:^(YYSpriteSheetImage * _Nullable sprit) {
|
||||
@kStrongify(self);
|
||||
self.headWearImageView.image = sprit;
|
||||
} failureBlock:^(NSError * _Nullable error) {
|
||||
}];
|
||||
}
|
||||
self.leftAvatar.hidden = NO;
|
||||
self.leftNameView.hidden = NO;
|
||||
self.leftBgImage.hidden = NO;
|
||||
self.headWearImageView.hidden = NO;
|
||||
self.leftPicImageView.hidden = NO;
|
||||
self.rightPicImageView.hidden = YES;
|
||||
self.leftBubbleImageView.hidden = NO;
|
||||
self.leftAvatar.image = nil;
|
||||
[self.leftAvatar loadImageWithUrl:extModel.avatar completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) {
|
||||
self.leftAvatar.image = image;
|
||||
}];
|
||||
self.leftBgImage.image = [self resizableImage:kImage(@"ms_message_headlines_text_left")];
|
||||
|
||||
[self.leftBubbleImageView loadImageWithUrl:extModel.iosBubbleUrl completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) {
|
||||
self.leftBgImage.image = nil;
|
||||
|
||||
UIImage *image1 = [UIImage imageWithCGImage:image.CGImage scale:2.0 orientation:UIImageOrientationUp];
|
||||
self.leftBubbleImageView.image = [self resizableImage:image1];
|
||||
}];
|
||||
self.leftNameView.attributedText = imageModel.nameAtt;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
#pragma mark - SDPhotoBrowserDelegate
|
||||
- (NSURL *)photoBrowser:(SDPhotoBrowser *)browser highQualityImageURLForIndex:(NSInteger)index {
|
||||
return [NSURL URLWithString:self.imageModel.url];
|
||||
}
|
||||
|
||||
- (UIImage *)photoBrowser:(SDPhotoBrowser *)browser placeholderImageForIndex:(NSInteger)index {
|
||||
return [UIImageConstant defalutBannerPlaceholder];
|
||||
}
|
||||
- (UIImage *)photoBrowser:(SDPhotoBrowser *)browser highQualityImageForIndex:(NSInteger)index{
|
||||
if(self.imageModel.url == nil && self.imageModel.image != nil){
|
||||
return self.imageModel.image;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
-(void)didLeftTapImage{
|
||||
SDPhotoBrowser *browser = [[SDPhotoBrowser alloc]init];
|
||||
browser.sourceImagesContainerView = self;
|
||||
browser.delegate = self;
|
||||
browser.imageCount = 1;
|
||||
browser.currentImageIndex = 0;
|
||||
browser.isMe = NO;
|
||||
[browser show];
|
||||
}
|
||||
-(void)didRigthTapImage{
|
||||
SDPhotoBrowser *browser = [[SDPhotoBrowser alloc]init];
|
||||
browser.sourceImagesContainerView = self;
|
||||
browser.delegate = self;
|
||||
browser.imageCount = 1;
|
||||
browser.currentImageIndex = 0;
|
||||
browser.isMe = NO;
|
||||
[browser show];
|
||||
}
|
||||
- (UIImage*)resizableImage:(UIImage *)image {
|
||||
//图片拉伸区域
|
||||
CGFloat top = (image.size.height - 1) / 2;
|
||||
CGFloat left = (image.size.width - 1) / 2;
|
||||
CGFloat right = (image.size.width - 1) / 2;
|
||||
CGFloat bottom = (image.size.height - 1) / 2;
|
||||
return [image resizableImageWithCapInsets:UIEdgeInsetsMake(top, left, bottom, right) resizingMode:UIImageResizingModeStretch];
|
||||
}
|
||||
- (NetImageView *)leftAvatar{
|
||||
if(!_leftAvatar){
|
||||
NetImageConfig *config = [NetImageConfig new];
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_leftAvatar = [[NetImageView alloc]initWithConfig:config];
|
||||
_leftAvatar.layer.cornerRadius = kGetScaleWidth(48)/2;
|
||||
_leftAvatar.layer.masksToBounds = YES;
|
||||
}
|
||||
return _leftAvatar;
|
||||
}
|
||||
- (NetImageView *)rightAvatar{
|
||||
if(!_rightAvatar){
|
||||
NetImageConfig *config = [NetImageConfig new];
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_rightAvatar = [[NetImageView alloc]initWithConfig:config];
|
||||
_rightAvatar.layer.cornerRadius = kGetScaleWidth(48)/2;
|
||||
_rightAvatar.layer.masksToBounds = YES;
|
||||
}
|
||||
return _rightAvatar;
|
||||
}
|
||||
- (YYLabel *)leftNameView{
|
||||
if(!_leftNameView){
|
||||
_leftNameView = [YYLabel new];
|
||||
}
|
||||
return _leftNameView;
|
||||
}
|
||||
|
||||
- (UIImageView *)leftBgImage{
|
||||
if(!_leftBgImage){
|
||||
_leftBgImage = [UIImageView new];
|
||||
_leftBgImage.userInteractionEnabled = YES;
|
||||
_leftBgImage.image = [self resizableImage:kImage(@"ms_message_headlines_text_left")];
|
||||
}
|
||||
return _leftBgImage;
|
||||
}
|
||||
- (UIImageView *)rightBgImage{
|
||||
if(!_rightBgImage){
|
||||
_rightBgImage = [UIImageView new];
|
||||
_rightBgImage.userInteractionEnabled = YES;
|
||||
_rightBgImage.image = [self resizableImage:kImage(@"ms_message_headlines_text_right")];
|
||||
}
|
||||
return _rightBgImage;
|
||||
}
|
||||
- (NetImageView *)leftBubbleImageView{
|
||||
if(!_leftBubbleImageView){
|
||||
_leftBubbleImageView = [[NetImageView alloc] init];
|
||||
|
||||
}
|
||||
return _leftBubbleImageView;
|
||||
}
|
||||
- (NetImageView *)rightBubbleImageView{
|
||||
if(!_rightBubbleImageView){
|
||||
_rightBubbleImageView = [[NetImageView alloc] init];
|
||||
|
||||
|
||||
|
||||
}
|
||||
return _rightBubbleImageView;
|
||||
}
|
||||
|
||||
|
||||
- (YYAnimatedImageView *)headWearImageView {
|
||||
if (!_headWearImageView) {
|
||||
_headWearImageView = [[YYAnimatedImageView alloc] init];
|
||||
_headWearImageView.backgroundColor = [UIColor clearColor];
|
||||
_headWearImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _headWearImageView;
|
||||
}
|
||||
- (YYAnimatedImageView *)rightHeadWearImageView {
|
||||
if (!_rightHeadWearImageView) {
|
||||
_rightHeadWearImageView = [[YYAnimatedImageView alloc] init];
|
||||
_rightHeadWearImageView.backgroundColor = [UIColor clearColor];
|
||||
_rightHeadWearImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
|
||||
}
|
||||
return _rightHeadWearImageView;
|
||||
}
|
||||
- (SpriteSheetImageManager *)manager {
|
||||
if (!_manager) {
|
||||
_manager = [[SpriteSheetImageManager alloc] init];
|
||||
}
|
||||
return _manager;
|
||||
}
|
||||
- (NetImageView *)leftPicImageView{
|
||||
if(!_leftPicImageView){
|
||||
_leftPicImageView = [NetImageView new];
|
||||
_leftPicImageView.userInteractionEnabled = YES;
|
||||
_leftPicImageView.layer.masksToBounds = YES;
|
||||
_leftPicImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didLeftTapImage)];
|
||||
[_leftPicImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _leftPicImageView;
|
||||
}
|
||||
- (NetImageView *)rightPicImageView{
|
||||
if(!_rightPicImageView){
|
||||
_rightPicImageView = [NetImageView new];
|
||||
_rightPicImageView.userInteractionEnabled = YES;
|
||||
_rightPicImageView.layer.masksToBounds = YES;
|
||||
_rightPicImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didRigthTapImage)];
|
||||
[_rightPicImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _rightPicImageView;
|
||||
}
|
||||
@end
|
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// MSSessionPublicChatHalTextCell.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/9.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "MessageBaseModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MSSessionPublicChatHalTextCell : UITableViewCell
|
||||
- (void)render:(nonnull MessageBaseModel *)model ;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// MSSessionPublicChatHalTextCell.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/9.
|
||||
//
|
||||
|
||||
#import "MSSessionPublicChatHalTextCell.h"
|
||||
#import "MessageContentHeadLinesText.h"
|
||||
@interface MSSessionPublicChatHalTextCell ()
|
||||
@property(nonatomic,strong) MessageContentHeadLinesText *textView;
|
||||
|
||||
@end
|
||||
@implementation MSSessionPublicChatHalTextCell
|
||||
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
|
||||
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
|
||||
if(self){
|
||||
[self installUI];
|
||||
[self installConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
- (void)render:(nonnull MessageBaseModel *)model {
|
||||
[self.textView render:model];
|
||||
}
|
||||
-(void)installUI{
|
||||
self.contentView.backgroundColor = [UIColor clearColor];
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
self.selectionStyle = 0;
|
||||
[self.contentView addSubview:self.textView];
|
||||
}
|
||||
-(void)installConstraints{
|
||||
[self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.contentView);
|
||||
}];
|
||||
}
|
||||
#pragma mark - 懒加载
|
||||
- (MessageContentHeadLinesText *)textView{
|
||||
if(!_textView){
|
||||
_textView = [[MessageContentHeadLinesText alloc]initWithFrame:CGRectZero];
|
||||
}
|
||||
return _textView;
|
||||
}
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
@@ -246,7 +246,7 @@
|
||||
[self.messageContent mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.top.trailing.bottom.mas_equalTo(self.messageBackground);
|
||||
}];
|
||||
|
||||
[self.messageContent.superview layoutIfNeeded];
|
||||
if (model.isHiddenAvatar) {
|
||||
self.leftAvatar.hidden= YES;
|
||||
self.rightAvatar.hidden = YES;
|
||||
|
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// MSSessionContextHeadlinesView.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/9.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "MessageContentProtocol.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MSSessionContextHeadlinesView : UIView<MessageContentProtocol>
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// MSSessionContextHeadlinesView.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/9.
|
||||
//
|
||||
|
||||
#import "MSSessionContextHeadlinesView.h"
|
||||
#import "MSSessionPublicChatHallTopModel.h"
|
||||
#import "MessageBaseModel.h"
|
||||
#import "MessageHeadlinesModel.h"
|
||||
#import "MSSessionScrollingModel.h"
|
||||
#import "AttachmentModel.h"
|
||||
@interface MSSessionContextHeadlinesView()
|
||||
@property(nonatomic,strong) UILabel *textView;
|
||||
///消息的信息
|
||||
@property (nonatomic,strong) MSSessionPublicChatHallTopModel *messageInfo;
|
||||
@property (nonatomic,strong) AttachmentModel *attachment;
|
||||
@property (nonatomic,strong) NIMMessage *message;
|
||||
@end
|
||||
@implementation MSSessionContextHeadlinesView
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
[self addSubview:self.textView];
|
||||
[self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.trailing.equalTo(self).inset(kGetScaleWidth(15));
|
||||
make.centerY.equalTo(self);
|
||||
}];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)render:(nonnull MessageBaseModel *)model {
|
||||
self.superview.backgroundColor = [UIColor clearColor];
|
||||
self.message = model.message;
|
||||
MessageHeadlinesModel *obj = (MessageHeadlinesModel *)model;
|
||||
MSSessionPublicChatHallTopModel * info = obj.info;
|
||||
self.messageInfo = info;
|
||||
self.textView.attributedText = obj.textAtt;
|
||||
|
||||
}
|
||||
#pragma mark - 懒加载
|
||||
- (UILabel *)textView{
|
||||
if(!_textView){
|
||||
_textView = [UILabel new];
|
||||
_textView.numberOfLines = 2;
|
||||
}
|
||||
return _textView;
|
||||
}
|
||||
|
||||
@end
|
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// MessageContentHeadLinesText.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/9.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "MessageBaseModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MessageContentHeadLinesText : UIView
|
||||
- (void)render:(nonnull MessageBaseModel *)model;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,342 @@
|
||||
//
|
||||
// MessageContentHeadLinesText.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/9.
|
||||
//
|
||||
|
||||
#import "MessageContentHeadLinesText.h"
|
||||
#import "DJDKMIMOMColor.h"
|
||||
#import "NSObject+MJExtension.h"
|
||||
#import "QEmotionHelper.h"
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
#import <Masonry/Masonry.h>
|
||||
#import "SpriteSheetImageManager.h"
|
||||
#import "MessageHeadlinesTextModel.h"
|
||||
#import "XPMessageRemoteExtModel.h"
|
||||
|
||||
#define MESSAGE_TEXT_PADDING 10
|
||||
@interface MessageContentHeadLinesText()
|
||||
/**
|
||||
消息文本
|
||||
*/
|
||||
@property (nonatomic, strong) YYLabel * messageText;
|
||||
@property (nonatomic, strong) YYLabel * rightMessageText;
|
||||
///当前的消息
|
||||
@property (nonatomic,strong) NIMMessage *message;
|
||||
|
||||
///头饰
|
||||
@property (nonatomic,strong) YYAnimatedImageView *headWearImageView;
|
||||
///头饰
|
||||
@property (nonatomic,strong) YYAnimatedImageView *rightHeadWearImageView;
|
||||
///头饰播放
|
||||
@property (nonatomic, strong) SpriteSheetImageManager *manager;
|
||||
|
||||
/**
|
||||
左侧头像(私聊对象)
|
||||
*/
|
||||
@property (nonatomic, strong) NetImageView * leftAvatar;
|
||||
/**
|
||||
右侧头像(自己)
|
||||
*/
|
||||
@property (nonatomic, strong) NetImageView * rightAvatar;
|
||||
@property(nonatomic,strong) YYLabel *leftNameView;
|
||||
|
||||
@property(nonatomic,strong) UIImageView *leftBgImage;
|
||||
@property(nonatomic,strong) UIImageView *rightBgImage;
|
||||
///气泡
|
||||
@property (nonatomic,strong) NetImageView *leftBubbleImageView;
|
||||
///气泡
|
||||
@property (nonatomic,strong) NetImageView *rightBubbleImageView;
|
||||
@end
|
||||
@implementation MessageContentHeadLinesText
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self addSubview:self.leftAvatar];
|
||||
[self addSubview:self.headWearImageView];
|
||||
[self addSubview:self.rightAvatar];
|
||||
[self addSubview:self.rightHeadWearImageView];
|
||||
[self addSubview:self.leftNameView];
|
||||
[self addSubview:self.leftBgImage];
|
||||
[self addSubview:self.rightBgImage];
|
||||
[self addSubview:self.leftBubbleImageView];
|
||||
[self addSubview:self.rightBubbleImageView];
|
||||
[self.leftBgImage addSubview:self.messageText];
|
||||
[self.rightBgImage addSubview:self.rightMessageText];
|
||||
|
||||
[self.leftAvatar mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(kGetScaleWidth(15));
|
||||
make.width.height.mas_equalTo(kGetScaleWidth(48));
|
||||
make.top.mas_equalTo(kGetScaleWidth(10));
|
||||
}];
|
||||
[self.headWearImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.leftAvatar).with.insets(UIEdgeInsetsMake(-kGetScaleWidth(10),-kGetScaleWidth(10),-kGetScaleWidth(10),-kGetScaleWidth(10)));
|
||||
}];
|
||||
[self.leftNameView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(kGetScaleWidth(21));
|
||||
make.height.mas_equalTo(kGetScaleWidth(14));
|
||||
make.leading.mas_equalTo(kGetScaleWidth(71.5));
|
||||
make.width.mas_lessThanOrEqualTo(kGetScaleWidth(240));
|
||||
|
||||
}];
|
||||
[self.rightAvatar mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.width.height.equalTo(self.leftAvatar);
|
||||
make.trailing.mas_equalTo(-kGetScaleWidth(15));
|
||||
}];
|
||||
[self.rightHeadWearImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.rightAvatar).with.insets(UIEdgeInsetsMake(-kGetScaleWidth(10),-kGetScaleWidth(10),-kGetScaleWidth(10),-kGetScaleWidth(10)));
|
||||
}];
|
||||
[self.leftBgImage mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(kGetScaleWidth(72));
|
||||
make.width.mas_equalTo(kGetScaleWidth(52));
|
||||
make.height.mas_equalTo(kGetScaleWidth(36));
|
||||
make.top.mas_equalTo(kGetScaleWidth(45));
|
||||
}];
|
||||
[self.rightBgImage mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.trailing.mas_equalTo(-kGetScaleWidth(72));
|
||||
make.top.mas_equalTo(kGetScaleWidth(21));
|
||||
make.width.mas_equalTo(kGetScaleWidth(52));
|
||||
make.height.mas_greaterThanOrEqualTo(kGetScaleWidth(36));
|
||||
}];
|
||||
|
||||
|
||||
[self.leftBubbleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.leftBgImage);
|
||||
}];
|
||||
[self.messageText mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.leftBgImage).with.insets(UIEdgeInsetsMake(kGetScaleWidth(10),kGetScaleWidth(10),kGetScaleWidth(10),kGetScaleWidth(10)));
|
||||
}];
|
||||
[self.rightBubbleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.rightBgImage);
|
||||
|
||||
}];
|
||||
|
||||
[self.rightMessageText mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.rightBgImage).with.insets(UIEdgeInsetsMake(kGetScaleWidth(10),kGetScaleWidth(10),kGetScaleWidth(10),kGetScaleWidth(10)));
|
||||
|
||||
}];
|
||||
self.leftAvatar.hidden = YES;
|
||||
self.leftNameView.hidden = YES;
|
||||
self.leftBgImage.hidden = YES;
|
||||
self.headWearImageView.hidden = YES;
|
||||
self.messageText.hidden = YES;
|
||||
self.leftBubbleImageView.hidden = YES;
|
||||
self.rightAvatar.hidden = YES;
|
||||
self.rightBgImage.hidden = YES;
|
||||
self.rightHeadWearImageView.hidden = YES;
|
||||
self.rightBubbleImageView.hidden = YES;
|
||||
self.rightMessageText.hidden = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)render:(nonnull MessageBaseModel *)model {
|
||||
self.message = model.message;
|
||||
|
||||
|
||||
MessageHeadlinesTextModel * textModel = (MessageHeadlinesTextModel *)model;
|
||||
XPMessageRemoteExtModel *extModel = textModel.extModel;
|
||||
if(extModel == nil)return;
|
||||
self.leftAvatar.hidden = YES;
|
||||
self.leftNameView.hidden = YES;
|
||||
self.leftBgImage.hidden = YES;
|
||||
self.headWearImageView.hidden = YES;
|
||||
self.messageText.hidden = YES;
|
||||
self.leftBubbleImageView.hidden = YES;
|
||||
self.rightAvatar.hidden = YES;
|
||||
self.rightBgImage.hidden = YES;
|
||||
self.rightHeadWearImageView.hidden = YES;
|
||||
self.rightBubbleImageView.hidden = YES;
|
||||
self.rightMessageText.hidden = YES;
|
||||
if(textModel.isSelf){
|
||||
[self.rightBgImage mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.trailing.mas_equalTo(-kGetScaleWidth(72));
|
||||
make.top.mas_equalTo(kGetScaleWidth(21));
|
||||
make.width.mas_equalTo(textModel.width);
|
||||
make.height.mas_equalTo(textModel.imageHeight);
|
||||
}];
|
||||
self.rightAvatar.hidden = NO;
|
||||
self.rightBgImage.hidden = NO;
|
||||
self.rightHeadWearImageView.hidden = NO;
|
||||
self.rightBubbleImageView.hidden = NO;
|
||||
self.rightMessageText.hidden = NO;
|
||||
self.rightAvatar.image = nil;
|
||||
[self.rightAvatar loadImageWithUrl:extModel.avatar completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) {
|
||||
self.rightAvatar.image = image;
|
||||
}];
|
||||
self.rightMessageText.text = self.message.text;
|
||||
self.rightBubbleImageView.image = nil;
|
||||
|
||||
self.rightBgImage.image = [self resizableImage:kImage(@"ms_message_headlines_text_right")];
|
||||
[self.rightBubbleImageView loadImageWithUrl:extModel.iosBubbleUrl completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) {
|
||||
self.rightBgImage.image = nil;
|
||||
UIImage *image1 = [UIImage imageWithCGImage:image.CGImage scale:2.0 orientation:UIImageOrientationUp];
|
||||
self.rightBubbleImageView.image = [self resizableImage:image1];
|
||||
}];
|
||||
NSString *headwearUrl = extModel.headwearUrl;
|
||||
if (headwearUrl.length > 0) {
|
||||
NSURL *url = [NSURL URLWithString:headwearUrl];
|
||||
@kWeakify(self);
|
||||
[self.manager loadSpriteSheetImageWithURL:url completionBlock:^(YYSpriteSheetImage * _Nullable sprit) {
|
||||
@kStrongify(self);
|
||||
self.rightHeadWearImageView.image = sprit;
|
||||
} failureBlock:^(NSError * _Nullable error) {
|
||||
}];
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
[self.leftBgImage mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(kGetScaleWidth(72));
|
||||
make.width.mas_equalTo(textModel.width);
|
||||
make.height.mas_equalTo(textModel.imageHeight);
|
||||
make.top.mas_equalTo(kGetScaleWidth(45));
|
||||
}];
|
||||
NSString *headwearUrl = extModel.headwearUrl;
|
||||
if (headwearUrl.length > 0) {
|
||||
NSURL *url = [NSURL URLWithString:headwearUrl];
|
||||
@kWeakify(self);
|
||||
[self.manager loadSpriteSheetImageWithURL:url completionBlock:^(YYSpriteSheetImage * _Nullable sprit) {
|
||||
@kStrongify(self);
|
||||
self.headWearImageView.image = sprit;
|
||||
} failureBlock:^(NSError * _Nullable error) {
|
||||
}];
|
||||
}
|
||||
self.leftAvatar.hidden = NO;
|
||||
self.leftNameView.hidden = NO;
|
||||
self.leftBgImage.hidden = NO;
|
||||
self.headWearImageView.hidden = NO;
|
||||
self.messageText.hidden = NO;
|
||||
self.leftBubbleImageView.hidden = NO;
|
||||
self.leftAvatar.image = nil;
|
||||
[self.leftAvatar loadImageWithUrl:extModel.avatar completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) {
|
||||
self.leftAvatar.image = image;
|
||||
}];
|
||||
self.leftBgImage.image = [self resizableImage:kImage(@"ms_message_headlines_text_left")];
|
||||
self.messageText.textColor = [UIColor whiteColor];
|
||||
[self.leftBubbleImageView loadImageWithUrl:extModel.iosBubbleUrl completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) {
|
||||
self.leftBgImage.image = nil;
|
||||
self.messageText.textColor = UIColorFromRGB(0x333333);
|
||||
UIImage *image1 = [UIImage imageWithCGImage:image.CGImage scale:2.0 orientation:UIImageOrientationUp];
|
||||
self.leftBubbleImageView.image = [self resizableImage:image1];
|
||||
}];
|
||||
self.leftNameView.attributedText = textModel.nameAtt;
|
||||
self.messageText.text = self.message.text;
|
||||
}
|
||||
- (UIImage*)resizableImage:(UIImage *)image {
|
||||
//图片拉伸区域
|
||||
CGFloat top = (image.size.height - 1) / 2;
|
||||
CGFloat left = (image.size.width - 1) / 2;
|
||||
CGFloat right = (image.size.width - 1) / 2;
|
||||
CGFloat bottom = (image.size.height - 1) / 2;
|
||||
return [image resizableImageWithCapInsets:UIEdgeInsetsMake(top, left, bottom, right) resizingMode:UIImageResizingModeStretch];
|
||||
}
|
||||
- (NetImageView *)leftAvatar{
|
||||
if(!_leftAvatar){
|
||||
NetImageConfig *config = [NetImageConfig new];
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_leftAvatar = [[NetImageView alloc]initWithConfig:config];
|
||||
_leftAvatar.layer.cornerRadius = kGetScaleWidth(48)/2;
|
||||
_leftAvatar.layer.masksToBounds = YES;
|
||||
}
|
||||
return _leftAvatar;
|
||||
}
|
||||
- (NetImageView *)rightAvatar{
|
||||
if(!_rightAvatar){
|
||||
NetImageConfig *config = [NetImageConfig new];
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_rightAvatar = [[NetImageView alloc]initWithConfig:config];
|
||||
_rightAvatar.layer.cornerRadius = kGetScaleWidth(48)/2;
|
||||
_rightAvatar.layer.masksToBounds = YES;
|
||||
}
|
||||
return _rightAvatar;
|
||||
}
|
||||
- (YYLabel *)leftNameView{
|
||||
if(!_leftNameView){
|
||||
_leftNameView = [YYLabel new];
|
||||
}
|
||||
return _leftNameView;
|
||||
}
|
||||
|
||||
- (UIImageView *)leftBgImage{
|
||||
if(!_leftBgImage){
|
||||
_leftBgImage = [UIImageView new];
|
||||
_leftBgImage.image = [self resizableImage:kImage(@"ms_message_headlines_text_left")];
|
||||
}
|
||||
return _leftBgImage;
|
||||
}
|
||||
- (UIImageView *)rightBgImage{
|
||||
if(!_rightBgImage){
|
||||
_rightBgImage = [UIImageView new];
|
||||
_rightBgImage.image = [self resizableImage:kImage(@"ms_message_headlines_text_right")];
|
||||
}
|
||||
return _rightBgImage;
|
||||
}
|
||||
- (NetImageView *)leftBubbleImageView{
|
||||
if(!_leftBubbleImageView){
|
||||
_leftBubbleImageView = [[NetImageView alloc] init];
|
||||
|
||||
}
|
||||
return _leftBubbleImageView;
|
||||
}
|
||||
- (NetImageView *)rightBubbleImageView{
|
||||
if(!_rightBubbleImageView){
|
||||
_rightBubbleImageView = [[NetImageView alloc] init];
|
||||
|
||||
|
||||
|
||||
}
|
||||
return _rightBubbleImageView;
|
||||
}
|
||||
- (YYLabel *)messageText {
|
||||
if (!_messageText) {
|
||||
_messageText = [[YYLabel alloc]initWithFrame:CGRectZero];
|
||||
_messageText.preferredMaxLayoutWidth = kGetScaleWidth(240);
|
||||
_messageText.textColor = DJDKMIMOMColor.mainTextColor;
|
||||
_messageText.numberOfLines = 0;
|
||||
_messageText.font = kFontMedium(14);
|
||||
_messageText.textColor = [UIColor whiteColor];
|
||||
_messageText.textAlignment = NSTextAlignmentLeft;
|
||||
_messageText.userInteractionEnabled = YES;
|
||||
}
|
||||
return _messageText;
|
||||
}
|
||||
- (YYLabel *)rightMessageText{
|
||||
if(!_rightMessageText){
|
||||
_rightMessageText = [[YYLabel alloc]initWithFrame:CGRectZero];
|
||||
_rightMessageText.preferredMaxLayoutWidth = kGetScaleWidth(240);
|
||||
_rightMessageText.textColor = DJDKMIMOMColor.mainTextColor;
|
||||
_rightMessageText.numberOfLines = 0;
|
||||
_rightMessageText.font = kFontMedium(14);
|
||||
_rightMessageText.textColor = UIColorFromRGB(0x333333);
|
||||
_rightMessageText.textAlignment = NSTextAlignmentLeft;
|
||||
_rightMessageText.userInteractionEnabled = YES;
|
||||
}
|
||||
return _rightMessageText;
|
||||
}
|
||||
- (YYAnimatedImageView *)headWearImageView {
|
||||
if (!_headWearImageView) {
|
||||
_headWearImageView = [[YYAnimatedImageView alloc] init];
|
||||
_headWearImageView.backgroundColor = [UIColor clearColor];
|
||||
_headWearImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _headWearImageView;
|
||||
}
|
||||
- (YYAnimatedImageView *)rightHeadWearImageView {
|
||||
if (!_rightHeadWearImageView) {
|
||||
_rightHeadWearImageView = [[YYAnimatedImageView alloc] init];
|
||||
_rightHeadWearImageView.backgroundColor = [UIColor clearColor];
|
||||
_rightHeadWearImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _rightHeadWearImageView;
|
||||
}
|
||||
- (SpriteSheetImageManager *)manager {
|
||||
if (!_manager) {
|
||||
_manager = [[SpriteSheetImageManager alloc] init];
|
||||
}
|
||||
return _manager;
|
||||
}
|
||||
|
||||
@end
|
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// MSSessionPublicChatHalImageModel.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/10.
|
||||
//
|
||||
|
||||
#import "MessageBaseModel.h"
|
||||
#import "XPMessageRemoteExtModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MSSessionPublicChatHalImageModel : MessageBaseModel
|
||||
@property(nonatomic,strong) NSMutableAttributedString *nameAtt;
|
||||
@property(nonatomic,assign) BOOL isSelf ;
|
||||
@property(nonatomic,strong) XPMessageRemoteExtModel *extModel;
|
||||
@property (nonatomic,strong) UIImage *image;
|
||||
@property (nonatomic,copy) NSString *imageUrl;
|
||||
@property(nonatomic,strong) NSString *url;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,102 @@
|
||||
//
|
||||
// MSSessionPublicChatHalImageModel.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/10.
|
||||
//
|
||||
|
||||
#import "MSSessionPublicChatHalImageModel.h"
|
||||
#define MESSAGE_IMAGE_MAX_SIZE (CONTENT_WIDTH_MAX)
|
||||
#define MESSAGE_IMAGE_Min_SIZE (CONTENT_WIDTH_MAX -100)
|
||||
@implementation MSSessionPublicChatHalImageModel
|
||||
- (instancetype)initWithMessage:(NIMMessage *)message {
|
||||
if (self = [super initWithMessage:message]) {
|
||||
self.messageType = SessionMessageType_Image;
|
||||
XPMessageRemoteExtModel *extModel = [XPMessageRemoteExtModel modelWithJSON:message.remoteExt[message.from]];
|
||||
self.extModel = extModel;
|
||||
self.isSelf = [[NIMSDK sharedSDK].loginManager.currentAccount isEqualToString:message.from];
|
||||
NSString *name = extModel.nick.length > 6 ? [NSString stringWithFormat:@"%@...",[extModel.nick substringToIndex:6]] : extModel.nick;
|
||||
self.nameAtt = [self createTextAttribute:name color:UIColorFromRGB(0x333333) font:kFontBold(14)];
|
||||
[self.nameAtt appendAttributedString:[self createSapceAttribute:2]];
|
||||
if (extModel.experUrl) {
|
||||
[self.nameAtt appendAttributedString:[self createUrlImageAttribute:extModel.experUrl size:CGSizeMake(kGetScaleWidth(36), kGetScaleWidth(18))]];
|
||||
[self.nameAtt appendAttributedString:[self createSapceAttribute:2]];
|
||||
}
|
||||
if (extModel.charmUrl) {
|
||||
[self.nameAtt appendAttributedString:[self createUrlImageAttribute:extModel.charmUrl size:CGSizeMake(kGetScaleWidth(36), kGetScaleWidth(18))]];
|
||||
[self.nameAtt appendAttributedString:[self createSapceAttribute:2]];
|
||||
}
|
||||
NIMImageObject * imageObject = (NIMImageObject*)message.messageObject;
|
||||
CGFloat attachmentImageMinWidth = (MESSAGE_IMAGE_Min_SIZE);
|
||||
CGFloat attachmentImageMinHeight = (MESSAGE_IMAGE_Min_SIZE);
|
||||
CGFloat attachmemtImageMaxWidth = (MESSAGE_IMAGE_MAX_SIZE);
|
||||
CGFloat attachmentImageMaxHeight = (MESSAGE_IMAGE_MAX_SIZE);
|
||||
CGSize imageSize;
|
||||
if (!CGSizeEqualToSize(imageObject.size, CGSizeZero)) {
|
||||
imageSize = imageObject.size;
|
||||
}else {
|
||||
UIImage *image = [UIImage imageWithContentsOfFile:imageObject.thumbPath];
|
||||
imageSize = image ? image.size : CGSizeZero;
|
||||
}
|
||||
CGSize contentSize = [UIImage sizeWithImageOriginSize:imageSize
|
||||
minSize:CGSizeMake(attachmentImageMinWidth, attachmentImageMinHeight)
|
||||
maxSize:CGSizeMake(attachmemtImageMaxWidth, attachmentImageMaxHeight)];
|
||||
self.contentSize = contentSize;
|
||||
self.height = contentSize.height + kGetScaleWidth(40) + (self.isSelf ? 0 : kGetScaleWidth(65));
|
||||
UIImage *image = [UIImage imageWithContentsOfFile:imageObject.thumbPath];
|
||||
if (image) {
|
||||
self.image = image;
|
||||
}else {
|
||||
self.imageUrl = imageObject.url;
|
||||
}
|
||||
self.url = imageObject.url;
|
||||
|
||||
self.isHiddenAvatar = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
- (NSMutableAttributedString *)createUrlImageAttribute:(NSString *)imageUrl size:(CGSize)size {
|
||||
NetImageConfig *config = [[NetImageConfig alloc]init];
|
||||
///先这样吧
|
||||
config.autoLoad = YES;
|
||||
NetImageView *imageView = [[NetImageView alloc]initWithUrl:imageUrl config:config];
|
||||
|
||||
imageView.bounds = CGRectMake(0, 0, size.width, size.height);
|
||||
imageView.layer.masksToBounds = YES;
|
||||
imageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
NSMutableAttributedString * attrString = [NSMutableAttributedString yy_attachmentStringWithContent:imageView contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(imageView.bounds.size.width, imageView.bounds.size.height) alignToFont:[UIFont systemFontOfSize:15.0] alignment:YYTextVerticalAlignmentCenter];
|
||||
return attrString;
|
||||
}
|
||||
/// 占位的富文本
|
||||
/// @param width 需要的间隙
|
||||
- (NSMutableAttributedString *)createSapceAttribute:(CGFloat)width {
|
||||
UIView *spaceView = [[UIView alloc]init];
|
||||
spaceView.backgroundColor = [UIColor clearColor];
|
||||
spaceView.bounds = CGRectMake(0, 0, width, 10);
|
||||
NSMutableAttributedString * attribute = [NSMutableAttributedString yy_attachmentStringWithContent:spaceView contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(spaceView.frame.size.width, spaceView.frame.size.height) alignToFont:[UIFont systemFontOfSize:15.0] alignment:YYTextVerticalAlignmentCenter];
|
||||
return attribute;
|
||||
}
|
||||
/// 生成一个富文本
|
||||
/// @param text 富文本的文字
|
||||
/// @param color 文字的颜色
|
||||
/// @param font 文字的大小
|
||||
- (NSMutableAttributedString *)createTextAttribute:(NSString *)text color:(UIColor *)color font:(UIFont *)font {
|
||||
if (text == nil || text.length <= 0) {
|
||||
text = @"";
|
||||
}
|
||||
NSMutableAttributedString *attribute = [[NSMutableAttributedString alloc] initWithString:text attributes:nil];
|
||||
attribute.yy_font = font;
|
||||
attribute.yy_color = color;
|
||||
attribute.yy_paragraphStyle = [self paragraphStyle];
|
||||
return attribute;
|
||||
}
|
||||
/// 设置文本的样式 间隙 缩进 ...
|
||||
- (NSMutableParagraphStyle *)paragraphStyle {
|
||||
NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc] init];
|
||||
paraStyle.lineSpacing = 4.0f;//行间距
|
||||
// 强制排版(从左到右)
|
||||
paraStyle.alignment = NSTextAlignmentLeft;
|
||||
paraStyle.baseWritingDirection = NSWritingDirectionLeftToRight;
|
||||
return paraStyle;
|
||||
}
|
||||
@end
|
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// MessageHeadlinesModel.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/9.
|
||||
//
|
||||
|
||||
#import "MessageBaseModel.h"
|
||||
#import "MSSessionPublicChatHallTopModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MessageHeadlinesModel : MessageBaseModel
|
||||
@property(nonatomic,strong) MSSessionPublicChatHallTopModel * info;
|
||||
@property(nonatomic,strong) NSMutableAttributedString *textAtt;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// MessageHeadlinesModel.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/9.
|
||||
//
|
||||
|
||||
#import "MessageHeadlinesModel.h"
|
||||
#import "AttachmentModel.h"
|
||||
|
||||
@implementation MessageHeadlinesModel
|
||||
- (instancetype)initWithMessage:(NIMMessage *)message {
|
||||
if (self = [super initWithMessage:message]) {
|
||||
self.messageType = SessionMessageType_Custom;
|
||||
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||
AttachmentModel * attach = (AttachmentModel *)obj.attachment;
|
||||
MSSessionPublicChatHallTopModel * info = [MSSessionPublicChatHallTopModel modelWithJSON:attach.data];
|
||||
self.info = info;
|
||||
self.contentSize = CGSizeMake(KScreenWidth, 20);
|
||||
if (info.nick != nil){
|
||||
NSString *text = [NSString stringWithFormat:YMLocalizedString(@"MSSessionContextHeadlinesView0"),info.nick];
|
||||
self.textAtt = [[NSMutableAttributedString alloc]initWithString:text attributes:@{NSFontAttributeName:kFontMedium(9),NSForegroundColorAttributeName:UIColorFromRGB(0x333333)}];
|
||||
[self.textAtt addAttributes:@{NSForegroundColorAttributeName:UIColorFromRGB(0xDE3446)} range:[text rangeOfString:info.nick]];
|
||||
}
|
||||
|
||||
self.height = (20 + CONTENT_PADDING_V_TOTAL);
|
||||
self.isHiddenAvatar = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *)cellContent:(MessageBaseModel *)model {
|
||||
return @"MSSessionContextHeadlinesView";
|
||||
}
|
||||
@end
|
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// MessageHeadlinesTextModel.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/9.
|
||||
//
|
||||
|
||||
#import "MessageBaseModel.h"
|
||||
#import "XPMessageRemoteExtModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MessageHeadlinesTextModel : MessageBaseModel
|
||||
|
||||
@property(nonatomic,strong) NSMutableAttributedString *nameAtt;
|
||||
@property(nonatomic,assign) BOOL isSelf ;
|
||||
@property(nonatomic,strong) XPMessageRemoteExtModel *extModel;
|
||||
@property(nonatomic,assign) CGFloat width;
|
||||
@property(nonatomic,assign) CGFloat imageHeight;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,94 @@
|
||||
//
|
||||
// MessageHeadlinesTextModel.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/9.
|
||||
//
|
||||
|
||||
#import "MessageHeadlinesTextModel.h"
|
||||
#import "QEmotionHelper.h"
|
||||
|
||||
@implementation MessageHeadlinesTextModel
|
||||
- (instancetype)initWithMessage:(NIMMessage *)message {
|
||||
if (self = [super initWithMessage:message]) {
|
||||
self.messageType = SessionMessageType_Text;
|
||||
XPMessageRemoteExtModel *extModel = [XPMessageRemoteExtModel modelWithJSON:message.remoteExt[message.from]];
|
||||
self.extModel = extModel;
|
||||
self.isSelf = [[NIMSDK sharedSDK].loginManager.currentAccount isEqualToString:message.from];
|
||||
NSString *name = extModel.nick.length > 6 ? [NSString stringWithFormat:@"%@...",[extModel.nick substringToIndex:6]] : extModel.nick;
|
||||
self.nameAtt = [self createTextAttribute:name color:UIColorFromRGB(0x333333) font:kFontBold(14)];
|
||||
[self.nameAtt appendAttributedString:[self createSapceAttribute:2]];
|
||||
if (extModel.experUrl) {
|
||||
[self.nameAtt appendAttributedString:[self createUrlImageAttribute:extModel.experUrl size:CGSizeMake(kGetScaleWidth(36), kGetScaleWidth(18))]];
|
||||
[self.nameAtt appendAttributedString:[self createSapceAttribute:2]];
|
||||
}
|
||||
if (extModel.charmUrl) {
|
||||
[self.nameAtt appendAttributedString:[self createUrlImageAttribute:extModel.charmUrl size:CGSizeMake(kGetScaleWidth(36), kGetScaleWidth(18))]];
|
||||
[self.nameAtt appendAttributedString:[self createSapceAttribute:2]];
|
||||
}
|
||||
NSString * messageText = message.text;
|
||||
if (!messageText) {
|
||||
messageText = YMLocalizedString(@"MessageTextModel0");
|
||||
}
|
||||
CGFloat width = [UILabel getWidthWithText:messageText height:kGetScaleWidth(36) font:kFontMedium(14)];
|
||||
|
||||
width = width > kGetScaleWidth(200) ? kGetScaleWidth(200) : width;
|
||||
self.width = width >= kGetScaleWidth(220) ? kGetScaleWidth(220) : (width + kGetScaleWidth(25));
|
||||
CGFloat height = [UILabel getLabelHeightWithText:messageText width:width font:kFontMedium(14)] + kGetScaleWidth(25);
|
||||
self.imageHeight = height;
|
||||
self.height = (self.isSelf ? kGetScaleWidth(35) : kGetScaleWidth(65)) + height;
|
||||
|
||||
self.isHiddenAvatar = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
- (NSMutableAttributedString *)createUrlImageAttribute:(NSString *)imageUrl size:(CGSize)size {
|
||||
NetImageConfig *config = [[NetImageConfig alloc]init];
|
||||
///先这样吧
|
||||
config.autoLoad = YES;
|
||||
NetImageView *imageView = [[NetImageView alloc]initWithUrl:imageUrl config:config];
|
||||
|
||||
imageView.bounds = CGRectMake(0, 0, size.width, size.height);
|
||||
imageView.layer.masksToBounds = YES;
|
||||
imageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
NSMutableAttributedString * attrString = [NSMutableAttributedString yy_attachmentStringWithContent:imageView contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(imageView.bounds.size.width, imageView.bounds.size.height) alignToFont:[UIFont systemFontOfSize:15.0] alignment:YYTextVerticalAlignmentCenter];
|
||||
return attrString;
|
||||
}
|
||||
/// 占位的富文本
|
||||
/// @param width 需要的间隙
|
||||
- (NSMutableAttributedString *)createSapceAttribute:(CGFloat)width {
|
||||
UIView *spaceView = [[UIView alloc]init];
|
||||
spaceView.backgroundColor = [UIColor clearColor];
|
||||
spaceView.bounds = CGRectMake(0, 0, width, 10);
|
||||
NSMutableAttributedString * attribute = [NSMutableAttributedString yy_attachmentStringWithContent:spaceView contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(spaceView.frame.size.width, spaceView.frame.size.height) alignToFont:[UIFont systemFontOfSize:15.0] alignment:YYTextVerticalAlignmentCenter];
|
||||
return attribute;
|
||||
}
|
||||
/// 生成一个富文本
|
||||
/// @param text 富文本的文字
|
||||
/// @param color 文字的颜色
|
||||
/// @param font 文字的大小
|
||||
- (NSMutableAttributedString *)createTextAttribute:(NSString *)text color:(UIColor *)color font:(UIFont *)font {
|
||||
if (text == nil || text.length <= 0) {
|
||||
text = @"";
|
||||
}
|
||||
NSMutableAttributedString *attribute = [[NSMutableAttributedString alloc] initWithString:text attributes:nil];
|
||||
attribute.yy_font = font;
|
||||
attribute.yy_color = color;
|
||||
attribute.yy_paragraphStyle = [self paragraphStyle];
|
||||
return attribute;
|
||||
}
|
||||
/// 设置文本的样式 间隙 缩进 ...
|
||||
- (NSMutableParagraphStyle *)paragraphStyle {
|
||||
NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc] init];
|
||||
paraStyle.lineSpacing = 4.0f;//行间距
|
||||
// 强制排版(从左到右)
|
||||
paraStyle.alignment = NSTextAlignmentLeft;
|
||||
paraStyle.baseWritingDirection = NSWritingDirectionLeftToRight;
|
||||
return paraStyle;
|
||||
}
|
||||
|
||||
- (NSString *)cellContent:(MessageBaseModel *)model {
|
||||
return @"MessageContentHeadLinesText";
|
||||
}
|
||||
|
||||
@end
|
@@ -21,13 +21,17 @@
|
||||
#import "QPhotoImageModel.h"
|
||||
#import "AttachmentModel.h"
|
||||
#import "MessageBaseModel.h"
|
||||
#import "MessageTextModel.h"
|
||||
#import "MessageHeadlinesTextModel.h"
|
||||
#import "MessageAudioModel.h"
|
||||
#import "MessageTimeModel.h"
|
||||
#import "MessageImageModel.h"
|
||||
#import "MessageUnSupportModel.h"
|
||||
#import "MessageTipsModel.h"
|
||||
#import "XPMessageRemoteExtModel.h"
|
||||
#import "MSSessionPublicChatHalImageModel.h"
|
||||
#import "MSSessionPublicChatHalImageCell.h"
|
||||
///View
|
||||
#import "MSSessionPublicChatHalTextCell.h"
|
||||
#import "MessageCell.h"
|
||||
#import "XPMineUserInfoViewController.h"
|
||||
#import "SessionNavView.h"
|
||||
@@ -41,8 +45,14 @@
|
||||
#import "MessageProtocol.h"
|
||||
#import "Api+Message.h"
|
||||
#import "XPRoomMessageConstant.h"
|
||||
|
||||
@interface MSSessionPublicChatHallVC ()<SessionNavViewDelegate,MessageProtocol, UITableViewDelegate, UITableViewDataSource, NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMMediaManagerDelegate, MessageCellDelegate, TZImagePickerControllerDelegate, SessionNavViewDelegate, QInputBarViewDelegate, QInputBarViewDataSource,InputBoardDataSource ,InputBoardDelegate , QEmotionBoardViewDelegate, QinputPhotoViewDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate,NIMChatroomManager>
|
||||
#import "MSSessionPublicChatHallHeadView.h"
|
||||
#import "MSSessionReleaseHeadlinesView.h"
|
||||
#import "MessageHeadlinesModel.h"
|
||||
#import "Api+Mine.h"
|
||||
#import "XPIncomeRecordModel.h"
|
||||
#import "XPCandyTreeInsufficientBalanceView.h"
|
||||
#import "XPIAPRechargeViewController.h"
|
||||
@interface MSSessionPublicChatHallVC ()<SessionNavViewDelegate,MessageProtocol, UITableViewDelegate, UITableViewDataSource, NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMMediaManagerDelegate, MessageCellDelegate, TZImagePickerControllerDelegate, SessionNavViewDelegate, QInputBarViewDelegate, QInputBarViewDataSource,InputBoardDataSource ,InputBoardDelegate , QEmotionBoardViewDelegate, QinputPhotoViewDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate,MSSessionReleaseHeadlinesViewDelegate,XPCandyTreeInsufficientBalanceViewDelegate>
|
||||
@property (nonatomic, strong) NIMSession * session;
|
||||
@property (nonatomic, strong) NSMutableArray<MessageBaseModel *> * messages;
|
||||
@property (nonatomic,strong) SessionNavView *sessionNavView;
|
||||
@@ -51,12 +61,16 @@
|
||||
@property(nonatomic,strong)QInputBarView *inputBarView;
|
||||
@property(nonatomic,strong)QKeyboardManager *keyboardManager;
|
||||
@property (nonatomic, strong) UserInfoModel *userInfo;
|
||||
@property(nonatomic,strong) MSSessionPublicChatHallHeadView *headView;
|
||||
///相册
|
||||
@property (nonatomic,strong) QinputPhotoView *photoView;
|
||||
///
|
||||
@property (nonatomic,strong) NSArray *phototArray;
|
||||
@property(nonatomic,assign) BOOL isLoadHistoryMessage;
|
||||
@property(nonatomic,copy) NSString *publicChatMessageRoomId;
|
||||
@property(nonatomic,copy) NSString *releaseCoins;
|
||||
@property(nonatomic,copy) NSString *myCoins;
|
||||
@property(nonatomic,strong) UIButton *sendBtn;
|
||||
@end
|
||||
|
||||
@implementation MSSessionPublicChatHallVC
|
||||
@@ -67,16 +81,27 @@
|
||||
- (void)dealloc {
|
||||
[[NIMSDK sharedSDK].chatManager removeDelegate:self];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(setHeadViewData) object:nil];
|
||||
[self.presenter exitNIMRoom:self.publicChatMessageRoomId];
|
||||
}
|
||||
|
||||
- (MessagePresenter *)createPresenter {
|
||||
return [[MessagePresenter alloc] init];
|
||||
}
|
||||
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
[Api requestRecordIncome:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if(code == 200){
|
||||
XPIncomeRecordModel *model = [XPIncomeRecordModel modelWithDictionary:data.data];
|
||||
self.myCoins = @(model.diamonds).stringValue;
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
self.view.backgroundColor = [UIColor whiteColor];
|
||||
self.isLoadHistoryMessage = YES;
|
||||
[self initViews];
|
||||
[self initLayout];
|
||||
@@ -109,26 +134,66 @@
|
||||
MessageBaseModel * model;
|
||||
switch (message.messageType) {
|
||||
case NIMMessageTypeText:
|
||||
model = [[MessageTextModel alloc] initWithMessage:message];
|
||||
break;
|
||||
case NIMMessageTypeAudio:
|
||||
model = [[MessageAudioModel alloc] initWithMessage:message];
|
||||
model = [[MessageHeadlinesTextModel alloc] initWithMessage:message];
|
||||
break;
|
||||
case NIMMessageTypeImage:
|
||||
model = [[MessageImageModel alloc] initWithMessage:message];
|
||||
model = [[MSSessionPublicChatHalImageModel alloc] initWithMessage:message];
|
||||
break;
|
||||
case NIMMessageTypeTip:
|
||||
model = [[MessageTipsModel alloc] initWithMessage:message];
|
||||
case NIMMessageTypeCustom:
|
||||
model = [self modelTransformCustomMessage:message];
|
||||
break;
|
||||
|
||||
default:
|
||||
model = [[MessageUnSupportModel alloc] initWithMessage:message];
|
||||
break;
|
||||
break;
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
- (MessageBaseModel *)modelTransformCustomMessage:(NIMMessage *)message {
|
||||
MessageBaseModel * model;
|
||||
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
|
||||
if (attachment.first == CustomMessageType_Chat_Hall_Headlinesn && attachment.second == Custom_Message_Sub_Chat_Hall_Headlinesn) {
|
||||
model = [[MessageHeadlinesModel alloc] initWithMessage:message];
|
||||
MSSessionPublicChatHallTopModel *topModel = [MSSessionPublicChatHallTopModel modelWithDictionary:attachment.data];
|
||||
self.headView.topModel = topModel;
|
||||
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(setHeadViewData) object:nil];
|
||||
[self setTime:topModel];
|
||||
}
|
||||
return model;
|
||||
}
|
||||
-(void)setTime:(MSSessionPublicChatHallTopModel *)topModel{
|
||||
NSInteger time = topModel.endTime/1000 - topModel.startTime/1000;
|
||||
[self performSelector:@selector(setHeadViewData) withObject:nil afterDelay:time];
|
||||
|
||||
}
|
||||
-(void)setHeadViewData{
|
||||
self.headView.topModel = nil;
|
||||
}
|
||||
-(BOOL)isCanAddMsg:(NIMMessage *)message{
|
||||
BOOL isCanAdd = NO;
|
||||
switch (message.messageType) {
|
||||
case NIMMessageTypeText:
|
||||
isCanAdd = YES;
|
||||
break;
|
||||
case NIMMessageTypeImage:
|
||||
isCanAdd = YES;
|
||||
break;
|
||||
case NIMMessageTypeCustom:
|
||||
{
|
||||
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
|
||||
if (attachment.first == CustomMessageType_Chat_Hall_Headlinesn && attachment.second == Custom_Message_Sub_Chat_Hall_Headlinesn) {
|
||||
isCanAdd = YES;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
return isCanAdd;
|
||||
}
|
||||
|
||||
|
||||
- (UINavigationController *)getKeyWindowNav {
|
||||
@@ -151,6 +216,7 @@
|
||||
}
|
||||
|
||||
- (void)addTimeMessage:(NIMMessage *)message {
|
||||
if ([self isCanAddMsg:message] == NO){return;}
|
||||
if (self.messages.count > 0) {
|
||||
NIMMessage * lastMessage = self.messages.lastObject.message;
|
||||
CGFloat dur = message.timestamp - lastMessage.timestamp;
|
||||
@@ -164,14 +230,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)addRevokeMessage:(NIMMessage *)message title:(NSString *)title {
|
||||
NIMMessage * revokeMessage = [[NIMMessage alloc] init];
|
||||
[revokeMessage setValue:self.session forKey:@"session"];
|
||||
[revokeMessage setValue:@(NIMMessageTypeTip) forKey:@"messageType"];
|
||||
revokeMessage.timestamp = [PLTimeUtil getNowTimeTimestampMillisecond].longLongValue;
|
||||
revokeMessage.text = title;
|
||||
[[NIMSDK sharedSDK].conversationManager saveMessage:revokeMessage forSession:self.session completion:nil];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Private Method
|
||||
|
||||
@@ -179,13 +238,14 @@
|
||||
// 初始化输入工具条,frame可以先这样临时设置,下面的addBottomInputBarView方法会重置输入条frame
|
||||
// 如果你想要自定义输入条View,请参考TextFieldViewController代码
|
||||
QInputBarViewConfiguration *inputBarViewConfiguration = [QInputBarViewConfiguration defaultInputBarViewConfiguration];
|
||||
inputBarViewConfiguration.voiceButtonHidden = NO;//隐藏语音按钮
|
||||
inputBarViewConfiguration.voiceButtonHidden = YES;//隐藏语音按钮
|
||||
inputBarViewConfiguration.extendButtonHidden = YES;//隐藏拓展按钮
|
||||
inputBarViewConfiguration.toolHidden = NO;
|
||||
inputBarViewConfiguration.giftButtonHidden = NO;
|
||||
inputBarViewConfiguration.giftButtonHidden = YES;
|
||||
inputBarViewConfiguration.cameraButtonHidden = NO;
|
||||
inputBarViewConfiguration.photoButtonHidden = NO;
|
||||
_inputBarView = [[QInputBarView alloc] initWithFrame:CGRectMake(0,0,self.view.frame.size.width,inputBarViewConfiguration.inputViewHeight)];
|
||||
|
||||
[_inputBarView setupWithConfiguration:inputBarViewConfiguration];
|
||||
_inputBarView.delegate = self;
|
||||
//keyboard管理类,用来管理键盘,各大面板的切换
|
||||
@@ -193,6 +253,7 @@
|
||||
_keyboardManager.dataSource = self;
|
||||
//因为addBottomInputBarView方法会立刻触发delegate,所以这里需要先设置delegate
|
||||
_keyboardManager.delegate = self;
|
||||
|
||||
[_keyboardManager addBottomInputBarView:_inputBarView belowViewController:NO];
|
||||
//把输入框(如果有的话)绑定给管理类
|
||||
[_keyboardManager bindTextView:_inputBarView.inputTextView];
|
||||
@@ -201,7 +262,10 @@
|
||||
|
||||
- (void)initViews {
|
||||
[self.view addSubview:self.sessionNavView];
|
||||
[self.view addSubview:self.headView];
|
||||
[self.view addSubview:self.sessionTableView];
|
||||
[self.view addSubview:self.sendBtn];
|
||||
|
||||
[self initInputView];
|
||||
}
|
||||
|
||||
@@ -210,21 +274,38 @@
|
||||
make.height.mas_equalTo(kNavigationHeight);
|
||||
make.leading.top.trailing.mas_equalTo(self.view);
|
||||
}];
|
||||
[self.headView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.sessionNavView.mas_bottom).mas_offset(kGetScaleWidth(0));
|
||||
make.leading.trailing.equalTo(self.view).inset(kGetScaleWidth(0));
|
||||
make.height.mas_equalTo(kGetScaleWidth(99));
|
||||
}];
|
||||
[self.sendBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.height.mas_equalTo(kGetScaleWidth(50));
|
||||
make.trailing.mas_equalTo(-kGetScaleWidth(12.5));
|
||||
make.top.equalTo(self.headView.mas_bottom).mas_offset(kGetScaleWidth(247));
|
||||
}];
|
||||
}
|
||||
-(void)clickReleaseBtnAction{
|
||||
MSSessionReleaseHeadlinesView *releaseView = [[MSSessionReleaseHeadlinesView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||
releaseView.golds = self.releaseCoins;
|
||||
releaseView.myCoins = self.myCoins;
|
||||
releaseView.delegate = self;
|
||||
[TTPopup popupView:releaseView style:TTPopupStyleAlert];
|
||||
}
|
||||
-(void)sendHeadlineBtnAction{
|
||||
[self clickReleaseBtnAction];
|
||||
}
|
||||
|
||||
- (void)viewDidLayoutSubviews{
|
||||
|
||||
}
|
||||
|
||||
- (void)initData {
|
||||
// NIMUser * user = [[NIMSDK sharedSDK].userManager userInfo:self.session.sessionId];
|
||||
// if (user) {
|
||||
// self.sessionNavView.title = user.userInfo.nickName;
|
||||
// } else {
|
||||
// self.sessionNavView.title = YMLocalizedString(@"XNDJTDDLoadingTool0");
|
||||
// }
|
||||
|
||||
[self.presenter getUserInfo:self.session.sessionId];
|
||||
self.sessionNavView.title = YMLocalizedString(@"MSSessionPublicChatHallVC0");
|
||||
[self showLoading];
|
||||
[self.presenter getUserInfoWithUid:[AccountInfoStorage instance].getUid];
|
||||
[self.presenter getPublicChatHallTopTextPayMoney];
|
||||
[self.presenter getPublicChatHallTopText];
|
||||
|
||||
}
|
||||
|
||||
- (BOOL)isExistMessages:(NIMMessage *)message{
|
||||
@@ -243,15 +324,30 @@
|
||||
return isExist;
|
||||
}
|
||||
|
||||
- (void)sendPublicChatHallTopTextSuccess{
|
||||
[Api requestRecordIncome:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if(code == 200){
|
||||
XPIncomeRecordModel *model = [XPIncomeRecordModel modelWithDictionary:data.data];
|
||||
self.myCoins = @(model.diamonds).stringValue;
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
-(void)getPublicChatHallTopTextPayMoneySuccess:(NSString *)money{
|
||||
self.releaseCoins = money;
|
||||
}
|
||||
- (void)getPublicChatHallTopTextSuccess:(MSSessionPublicChatHallTopModel *)model{
|
||||
self.headView.topModel = model;
|
||||
if(model != nil){
|
||||
[self setTime:model];
|
||||
}
|
||||
|
||||
}
|
||||
///获取用户信息成功
|
||||
- (void)onGetSessionUserInfoSuccess:(UserInfoModel *)userInfo {
|
||||
- (void)onGetUserInfoSuccess:(UserInfoModel *)userInfo {
|
||||
_userInfo = userInfo;
|
||||
self.sessionNavView.userInfo = userInfo;
|
||||
self.publicChatMessageRoomId = [ClientConfig shareConfig].configInfo.publicChatRoomIdMap[_userInfo.partitionId];
|
||||
self.publicChatMessageRoomId = [NSString stringWithFormat:@"%@",[ClientConfig shareConfig].configInfo.publicChatRoomIdMap[_userInfo.partitionId]];
|
||||
|
||||
if(self.publicChatMessageRoomId.length > 0){
|
||||
_session = [NIMSession session:self.publicChatMessageRoomId type:NIMSessionTypeChatroom];
|
||||
@@ -271,26 +367,62 @@
|
||||
}
|
||||
|
||||
- (void)handleFetchHistoryMessage {
|
||||
|
||||
NSString *roomId = self.publicChatMessageRoomId;
|
||||
NIMHistoryMessageSearchOption *option = [[NIMHistoryMessageSearchOption alloc] init];
|
||||
option.limit = 100;
|
||||
option.startTime = 0;
|
||||
option.order = NIMMessageSearchOrderAsc;
|
||||
option.messageTypes = @[@(NIMMessageTypeText),@(NIMMessageTypeImage),@(NIMMessageTypeAudio)];
|
||||
option.messageTypes = @[@(NIMMessageTypeText),@(NIMMessageTypeImage)];
|
||||
[[NIMSDK sharedSDK].chatroomManager fetchMessageHistory:roomId option:option result:^(NSError * _Nullable error, NSArray<NIMMessage *> * _Nullable messages) {
|
||||
if(error != nil){
|
||||
self.isLoadHistoryMessage = NO;
|
||||
}
|
||||
NIMHistoryMessageSearchOption *option = [[NIMHistoryMessageSearchOption alloc] init];
|
||||
option.limit = [ClientConfig shareConfig].configInfo.roomMessageCount;
|
||||
option.order = NIMMessageSearchOrderDesc;
|
||||
option.messageTypes = @[@(NIMMessageTypeText),@(NIMMessageTypeCustom)];
|
||||
[[NIMSDK sharedSDK].chatroomManager fetchMessageHistory:roomId option:option result:^(NSError * _Nullable error, NSArray<NIMMessage *> * _Nullable messages) {
|
||||
if(error != nil){
|
||||
self.isLoadHistoryMessage = NO;
|
||||
|
||||
//如果拉取的数量等于请求的数量,说明这个时间点以后的消息数量大于等于需要拉取的数量,直接拉取最新的50条
|
||||
if (messages.count == 100) {
|
||||
NIMHistoryMessageSearchOption *option = [[NIMHistoryMessageSearchOption alloc] init];
|
||||
option.limit = 100;
|
||||
option.order = NIMMessageSearchOrderDesc;
|
||||
option.messageTypes = @[@(NIMMessageTypeText),@(NIMMessageTypeImage)];
|
||||
[[NIMSDK sharedSDK].chatroomManager fetchMessageHistory:roomId option:option result:^(NSError * _Nullable error, NSArray<NIMMessage *> * _Nullable messages) {
|
||||
if(error != nil){
|
||||
self.isLoadHistoryMessage = NO;
|
||||
}
|
||||
[self hideHUD];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{///回到主线程
|
||||
if (self.messages.count > kRoomMessageMaxLength) {
|
||||
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
|
||||
NSArray *needRemoveMsgArray = [self.messages objectsAtIndexes:set];
|
||||
[self.messages removeObjectsInArray:needRemoveMsgArray];
|
||||
}else{
|
||||
|
||||
for (NIMMessage *message in messages.reverseObjectEnumerator) {
|
||||
[self addTimeMessage:message];
|
||||
if (message.isDeleted) {
|
||||
continue;
|
||||
}
|
||||
if ([self isCanAddMsg:message]){
|
||||
[self addTimeMessage:message];
|
||||
MessageBaseModel * model = [self modeTransformMessage:message];
|
||||
[self.messages addObject:model];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// 执行插入
|
||||
|
||||
[self.sessionTableView reloadData];
|
||||
//执行插入动画并滚动
|
||||
if(self.messages.count > 0){
|
||||
NSIndexPath *ip = [NSIndexPath indexPathForRow:self.messages.count-1 inSection:0]; //取最后一行数据
|
||||
[self.sessionTableView scrollToRowAtIndexPath:ip atScrollPosition:UITableViewScrollPositionBottom animated:YES]; //滚动到最后一行
|
||||
|
||||
}
|
||||
});
|
||||
}];
|
||||
return;
|
||||
}
|
||||
dispatch_async(dispatch_get_main_queue(), ^{///回到主线程
|
||||
///
|
||||
if (self.messages.count > kRoomMessageMaxLength) {
|
||||
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
|
||||
NSArray *needRemoveMsgArray = [self.messages objectsAtIndexes:set];
|
||||
@@ -302,8 +434,12 @@
|
||||
if (message.isDeleted) {
|
||||
continue;
|
||||
}
|
||||
MessageBaseModel * model = [self modeTransformMessage:message];
|
||||
[self.messages addObject:model];
|
||||
if ([self isCanAddMsg:message]){
|
||||
[self addTimeMessage:message];
|
||||
MessageBaseModel * model = [self modeTransformMessage:message];
|
||||
[self.messages addObject:model];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// 执行插入
|
||||
@@ -315,11 +451,12 @@
|
||||
[self.sessionTableView scrollToRowAtIndexPath:ip atScrollPosition:UITableViewScrollPositionBottom animated:YES]; //滚动到最后一行
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}];
|
||||
|
||||
|
||||
}];
|
||||
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - MessageCellDelegate
|
||||
@@ -336,7 +473,21 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark - MSSessionReleaseHeadlinesViewDelegate
|
||||
- (void)releaseHeadlinesWithText:(NSString *)text{
|
||||
if (self.myCoins.integerValue < self.releaseCoins.integerValue){
|
||||
XPCandyTreeInsufficientBalanceView *balanceView = [[XPCandyTreeInsufficientBalanceView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||
balanceView.delegate = self;
|
||||
[self. view addSubview:balanceView];
|
||||
return;
|
||||
}
|
||||
[self.presenter sendPublicChatHallTopTextWithcontent:text];
|
||||
}
|
||||
-(void)payBalanceAction{
|
||||
XPIAPRechargeViewController * webVC =[[XPIAPRechargeViewController alloc] init];
|
||||
webVC.type = @"4";
|
||||
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:webVC animated:YES];
|
||||
}
|
||||
|
||||
#pragma mark - SessionNavViewDelegate
|
||||
|
||||
@@ -362,6 +513,17 @@
|
||||
- (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
|
||||
|
||||
MessageBaseModel * message = [self.messages safeObjectAtIndex1:indexPath.row];
|
||||
if(message.messageType == SessionMessageType_Text){
|
||||
MSSessionPublicChatHalTextCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([MSSessionPublicChatHalTextCell class]) forIndexPath:indexPath];
|
||||
[cell render:message];
|
||||
|
||||
return cell;
|
||||
}else if (message.messageType == SessionMessageType_Image){
|
||||
MSSessionPublicChatHalImageCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([MSSessionPublicChatHalImageCell class]) forIndexPath:indexPath];
|
||||
[cell render:message];
|
||||
return cell;
|
||||
}
|
||||
|
||||
NSString * identifier = [message cellContent:message];
|
||||
///从复用池中获取所需要的cell
|
||||
MessageCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier];
|
||||
@@ -381,7 +543,10 @@
|
||||
MessageBaseModel *msg = [self.messages safeObjectAtIndex1:indexPath.row];
|
||||
return msg.height;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
MessageBaseModel *m = [self.messages safeObjectAtIndex1:indexPath.row];
|
||||
NSLog(@"%@",m.message.remoteExt);
|
||||
}
|
||||
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
|
||||
[self.keyboardManager hideAllBoardView];
|
||||
}
|
||||
@@ -392,8 +557,6 @@
|
||||
return;
|
||||
}
|
||||
NIMMessage *message = messages.firstObject;
|
||||
NIMSession *session = message.session;
|
||||
|
||||
if (self.messages.count > kRoomMessageMaxLength) {
|
||||
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
|
||||
NSArray *needRemoveMsgArray = [self.messages objectsAtIndexes:set];
|
||||
@@ -404,11 +567,19 @@
|
||||
if (message.isDeleted) {
|
||||
continue;
|
||||
}
|
||||
MessageBaseModel * model = [self modeTransformMessage:message];
|
||||
[self.messages addObject:model];
|
||||
if ([self isCanAddMsg:message]){
|
||||
[self addTimeMessage:message];
|
||||
MessageBaseModel * model = [self modeTransformMessage:message];
|
||||
[self.messages addObject:model];
|
||||
}
|
||||
|
||||
}
|
||||
[self.sessionTableView reloadData];
|
||||
[self.sessionTableView nim_scrollToBottom:YES];
|
||||
if(self.messages.count > 0){
|
||||
NSIndexPath *ip = [NSIndexPath indexPathForRow:self.messages.count-1 inSection:0]; //取最后一行数据
|
||||
[self.sessionTableView scrollToRowAtIndexPath:ip atScrollPosition:UITableViewScrollPositionBottom animated:YES]; //滚动到最后一行
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -420,8 +591,11 @@
|
||||
[self addTimeMessage:message];
|
||||
|
||||
if (![self isExistMessages:message]) {
|
||||
MessageBaseModel * model = [self modeTransformMessage:message];
|
||||
[self.messages addObject:model];
|
||||
if ([self isCanAddMsg:message]){
|
||||
[self addTimeMessage:message];
|
||||
MessageBaseModel * model = [self modeTransformMessage:message];
|
||||
[self.messages addObject:model];
|
||||
}
|
||||
}
|
||||
|
||||
if (message.yidunAntiSpamRes) {
|
||||
@@ -434,7 +608,11 @@
|
||||
}
|
||||
}
|
||||
[self.sessionTableView reloadData];
|
||||
[self.sessionTableView nim_scrollToBottom:YES];
|
||||
if(self.messages.count > 0){
|
||||
NSIndexPath *ip = [NSIndexPath indexPathForRow:self.messages.count-1 inSection:0]; //取最后一行数据
|
||||
[self.sessionTableView scrollToRowAtIndexPath:ip atScrollPosition:UITableViewScrollPositionBottom animated:YES]; //滚动到最后一行
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -445,27 +623,46 @@
|
||||
- (void)sendTextMessage:(NSString *)text {
|
||||
|
||||
NIMMessage *message = [NIMMessageMaker msgWithText:text];
|
||||
|
||||
message.remoteExt = [self getRemoteExt];
|
||||
[[[NIMSDK sharedSDK] chatManager] sendMessage:message toSession:self.session error:nil];
|
||||
|
||||
|
||||
|
||||
}
|
||||
-(NSDictionary *)getRemoteExt{
|
||||
UserInfoModel *userInfo = self.userInfo;
|
||||
XPMessageRemoteExtModel *extModel = [[XPMessageRemoteExtModel alloc] init];
|
||||
extModel.defUser = userInfo.defUser;
|
||||
extModel.erbanNo = userInfo.erbanNo;
|
||||
extModel.carName = userInfo.carName;
|
||||
extModel.inRoomNameplatePic = userInfo.nameplatePic;
|
||||
extModel.inRoomNameplateWord = userInfo.nameplateWord;
|
||||
extModel.isCustomWord = userInfo.isCustomWord;
|
||||
extModel.charmUrl = userInfo.userLevelVo.charmUrl;
|
||||
extModel.experLevelSeq = userInfo.userLevelVo.experLevelSeq;
|
||||
extModel.experUrl = userInfo.userLevelVo.experUrl;
|
||||
extModel.newUser = userInfo.newUser;
|
||||
extModel.vipIcon = userInfo.userVipInfoVO.vipIcon;
|
||||
extModel.androidBubbleUrl = userInfo.androidBubbleUrl;
|
||||
extModel.iosBubbleUrl = userInfo.iosBubbleUrl;
|
||||
extModel.fromSayHelloChannel = userInfo.fromSayHelloChannel;
|
||||
extModel.avatar = self.userInfo.avatar;
|
||||
extModel.nick = self.userInfo.nick;
|
||||
NSString * headwearUrl= self.userInfo.headwearEffect.length > 0 ? self.userInfo.headwearEffect : self.userInfo.headwearPic;
|
||||
extModel.headwearUrl = headwearUrl;
|
||||
NSMutableDictionary *remoteExt = [NSMutableDictionary dictionaryWithObject:extModel.model2dictionary forKey:[AccountInfoStorage instance].getUid];
|
||||
|
||||
return remoteExt;
|
||||
|
||||
}
|
||||
|
||||
- (void)audioRecordCompletion:(NSString *)recordPath {
|
||||
|
||||
NIMMessage *message = [NIMMessageMaker msgWithAudio:recordPath];
|
||||
|
||||
[[[NIMSDK sharedSDK] chatManager] sendMessage:message toSession:self.session error:nil];
|
||||
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - TZImagePickerControllerDelegate
|
||||
- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray<UIImage *> *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto infos:(NSArray<NSDictionary *> *)infos {
|
||||
[photos enumerateObjectsUsingBlock:^(UIImage * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj) {
|
||||
NIMMessage * message = [NIMMessageMaker msgWithImage:obj];
|
||||
message.remoteExt = [self getRemoteExt];
|
||||
// 发送消息
|
||||
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:self.session error:nil];
|
||||
|
||||
@@ -652,10 +849,14 @@
|
||||
#pragma mark - InputBoardDelegate
|
||||
- (void)keyboardManager:(QKeyboardManager *)keyboardManager onWholeInputViewHeightDidChange:(CGFloat)wholeInputViewHeight reason:(WholeInputViewHeightDidChangeReason)reason {
|
||||
[UIView animateWithDuration:0.2 animations:^{
|
||||
[self.sessionTableView nim_scrollToBottom:NO];
|
||||
if(self.messages.count > 0){
|
||||
NSIndexPath *ip = [NSIndexPath indexPathForRow:self.messages.count-1 inSection:0]; //取最后一行数据
|
||||
[self.sessionTableView scrollToRowAtIndexPath:ip atScrollPosition:UITableViewScrollPositionBottom animated:NO]; //滚动到最后一行
|
||||
|
||||
}
|
||||
[self.sessionTableView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.trailing.mas_equalTo(self.view);
|
||||
make.top.mas_equalTo(self.sessionNavView.mas_bottom);
|
||||
make.top.mas_equalTo(self.headView.mas_bottom);
|
||||
make.bottom.mas_equalTo(self.view).offset(-wholeInputViewHeight - kSafeAreaBottomHeight);
|
||||
}];
|
||||
}];
|
||||
@@ -713,7 +914,7 @@
|
||||
}
|
||||
// 发送消息
|
||||
NIMMessage * message = [NIMMessageMaker msgWithImage:image];
|
||||
|
||||
message.remoteExt = [self getRemoteExt];
|
||||
|
||||
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:self.session error:nil];
|
||||
[view resetChoosePhotos];
|
||||
@@ -744,7 +945,7 @@
|
||||
UIImageWriteToSavedPhotosAlbum(selectedPhoto, nil, nil, nil);
|
||||
}
|
||||
NIMMessage * message = [NIMMessageMaker msgWithImage:selectedPhoto];
|
||||
|
||||
message.remoteExt = [self getRemoteExt];
|
||||
// 发送消息
|
||||
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:self.session error:nil];
|
||||
|
||||
@@ -781,6 +982,10 @@
|
||||
_sessionTableView.backgroundColor = UIColor.clearColor;
|
||||
_sessionTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_sessionTableView.showsVerticalScrollIndicator = NO;
|
||||
[_sessionTableView registerClass:[MSSessionPublicChatHalTextCell class] forCellReuseIdentifier:NSStringFromClass([MSSessionPublicChatHalTextCell class])];
|
||||
[_sessionTableView registerClass:[MSSessionPublicChatHalImageCell class] forCellReuseIdentifier:NSStringFromClass([MSSessionPublicChatHalImageCell class])];
|
||||
|
||||
|
||||
if (@available(iOS 11.0, *)) {
|
||||
_sessionTableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
}
|
||||
@@ -796,6 +1001,21 @@
|
||||
}
|
||||
return _sessionNavView;
|
||||
}
|
||||
|
||||
- (MSSessionPublicChatHallHeadView *)headView{
|
||||
if(!_headView){
|
||||
_headView = [[MSSessionPublicChatHallHeadView alloc]initWithFrame:CGRectZero];
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickReleaseBtnAction)];
|
||||
[_headView addGestureRecognizer:tap];
|
||||
}
|
||||
return _headView;
|
||||
}
|
||||
- (UIButton *)sendBtn{
|
||||
if(!_sendBtn){
|
||||
_sendBtn = [UIButton new];
|
||||
[_sendBtn setBackgroundImage:[UIImage getLanguageImage:@"ms_message_send_headline_bnt"] forState:UIControlStateNormal];
|
||||
[_sendBtn addTarget:self action:@selector(sendHeadlineBtnAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _sendBtn;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// MSSessionPublicChatHallHeadView.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/8.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "MSSessionPublicChatHallTopModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MSSessionPublicChatHallHeadView : UIView
|
||||
|
||||
@property(nonatomic,strong) MSSessionPublicChatHallTopModel *__nullable topModel;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,103 @@
|
||||
//
|
||||
// MSSessionPublicChatHallHeadView.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/8.
|
||||
//
|
||||
|
||||
#import "MSSessionPublicChatHallHeadView.h"
|
||||
@interface MSSessionPublicChatHallHeadView()
|
||||
@property(nonatomic,strong) UIImageView *bgImageView;
|
||||
@property(nonatomic,strong) UILabel *textView;
|
||||
@property(nonatomic,strong) UIImageView *addIocnView;
|
||||
@property(nonatomic,strong) UILabel *contentView;
|
||||
@end
|
||||
@implementation MSSessionPublicChatHallHeadView
|
||||
|
||||
-(instancetype)initWithFrame:(CGRect)frame{
|
||||
self = [super initWithFrame:frame];
|
||||
if(self){
|
||||
[self installUI];
|
||||
[self installConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)installUI{
|
||||
[self addSubview:self.bgImageView];
|
||||
[self.bgImageView addSubview:self.addIocnView];
|
||||
[self.bgImageView addSubview:self.textView];
|
||||
[self.bgImageView addSubview:self.contentView];
|
||||
}
|
||||
-(void)setTopModel:(MSSessionPublicChatHallTopModel *)topModel{
|
||||
_topModel = topModel;
|
||||
if(_topModel == nil){
|
||||
self.contentView.hidden = YES;
|
||||
|
||||
self.addIocnView.hidden = NO;
|
||||
self.textView.hidden = NO;
|
||||
_bgImageView.image = kImage(@"ms_public_chat_hall_head_bg");
|
||||
self.contentView.text = @"";
|
||||
return;
|
||||
}
|
||||
self.contentView.hidden = NO;
|
||||
|
||||
self.addIocnView.hidden = YES;
|
||||
self.textView.hidden = YES;
|
||||
self.contentView.text = _topModel.content;
|
||||
_bgImageView.image = [kImage(@"ms_public_chat_hall_head_broadcast_bg") ms_SetImageForRTL];
|
||||
}
|
||||
-(void)installConstraints{
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self);
|
||||
}];
|
||||
[self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
|
||||
make.height.mas_equalTo(kGetScaleWidth(10.5));
|
||||
make.bottom.mas_equalTo(-kGetScaleWidth(36));
|
||||
make.centerX.equalTo(self.bgImageView).mas_offset(kGetScaleWidth(8));
|
||||
}];
|
||||
|
||||
[self.addIocnView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.height.mas_equalTo(kGetScaleWidth(13));
|
||||
make.centerY.equalTo(self.textView);
|
||||
make.trailing.equalTo(self.textView.mas_leading).mas_offset(-kGetScaleWidth(3));
|
||||
}];
|
||||
|
||||
[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(kGetScaleWidth(45.5));
|
||||
make.centerY.equalTo(self.bgImageView);
|
||||
make.trailing.mas_equalTo(-kGetScaleWidth(23.5));
|
||||
}];
|
||||
}
|
||||
#pragma mark - 懒加载
|
||||
- (UIImageView *)bgImageView{
|
||||
if(!_bgImageView){
|
||||
_bgImageView = [UIImageView new];
|
||||
_bgImageView.image = kImage(@"ms_public_chat_hall_head_bg");
|
||||
_bgImageView.userInteractionEnabled = YES;
|
||||
}
|
||||
return _bgImageView;
|
||||
}
|
||||
- (UIImageView *)addIocnView{
|
||||
if(!_addIocnView){
|
||||
_addIocnView = [UIImageView new];
|
||||
_addIocnView.image = kImage(@"ms_public_chat_hall_add_icon");
|
||||
}
|
||||
return _addIocnView;
|
||||
}
|
||||
|
||||
-(UILabel *)textView{
|
||||
if(!_textView){
|
||||
_textView = [UILabel labelInitWithText:YMLocalizedString(@"MSSessionPublicChatHallVC1") font:kFontBold(11) textColor:UIColorFromRGB(0xF9DB3B)];
|
||||
}
|
||||
return _textView;
|
||||
}
|
||||
- (UILabel *)contentView{
|
||||
if(!_contentView){
|
||||
_contentView = [UILabel labelInitWithText:@"" font:kFontBold(9) textColor:UIColorFromRGB(0xFFFADF)];
|
||||
_contentView.numberOfLines = 0;
|
||||
_contentView.textAlignment = NSTextAlignmentCenter;
|
||||
}
|
||||
return _contentView;
|
||||
}
|
||||
@end
|
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// MSSessionReleaseHeadlinesPayView.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/9.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol MSSessionReleaseHeadlinesPayViewDelegate <NSObject>
|
||||
|
||||
-(void)payReleaseHeadlines;
|
||||
|
||||
@end
|
||||
|
||||
@interface MSSessionReleaseHeadlinesPayView : UIView
|
||||
@property(nonatomic,copy) NSString *coins;
|
||||
@property(nonatomic,weak) id<MSSessionReleaseHeadlinesPayViewDelegate>delegate;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,148 @@
|
||||
//
|
||||
// MSSessionReleaseHeadlinesPayView.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/9.
|
||||
//
|
||||
|
||||
#import "MSSessionReleaseHeadlinesPayView.h"
|
||||
@interface MSSessionReleaseHeadlinesPayView()
|
||||
@property(nonatomic,strong) UILabel *titleView;
|
||||
@property(nonatomic,strong) UILabel *numView;
|
||||
@property(nonatomic,strong) UILabel *coinsView;
|
||||
@property(nonatomic,strong) UIImageView *chooseImageView;
|
||||
@property(nonatomic,strong) UIButton *payBtn;
|
||||
@property(nonatomic,strong) UIView *bgView;
|
||||
@property(nonatomic,strong) UIButton *backBtn;
|
||||
@end
|
||||
@implementation MSSessionReleaseHeadlinesPayView
|
||||
|
||||
-(instancetype)initWithFrame:(CGRect)frame{
|
||||
self = [super initWithFrame:frame];
|
||||
if(self){
|
||||
[self installUI];
|
||||
[self installConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)installUI{
|
||||
self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.6];
|
||||
[self addSubview:self.backBtn];
|
||||
[self addSubview:self.bgView];
|
||||
[self.bgView addSubview:self.titleView];
|
||||
[self.bgView addSubview:self.numView];
|
||||
[self.bgView addSubview:self.coinsView];
|
||||
[self.bgView addSubview:self.chooseImageView];
|
||||
[self.bgView addSubview:self.payBtn];
|
||||
}
|
||||
-(void)backAction{
|
||||
[self removeFromSuperview];
|
||||
}
|
||||
-(void)installConstraints{
|
||||
[self.backBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self);
|
||||
}];
|
||||
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.leading.trailing.equalTo(self).inset(kGetScaleWidth(0));
|
||||
make.height.mas_equalTo(kGetScaleWidth(245));
|
||||
}];
|
||||
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(kGetScaleWidth(19));
|
||||
make.centerX.equalTo(self.bgView);
|
||||
}];
|
||||
[self.numView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(kGetScaleWidth(52));
|
||||
make.centerX.equalTo(self.bgView);
|
||||
}];
|
||||
[self.chooseImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.height.mas_equalTo(kGetScaleWidth(18));
|
||||
make.trailing.mas_equalTo(-kGetScaleWidth(27));
|
||||
make.top.mas_equalTo(kGetScaleWidth(100));
|
||||
}];
|
||||
[self.coinsView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(kGetScaleWidth(27));
|
||||
make.centerY.equalTo(self.chooseImageView);
|
||||
make.trailing.equalTo(self.chooseImageView.mas_leading).mas_offset(-kGetScaleWidth(5));
|
||||
}];
|
||||
[self.payBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(kGetScaleWidth(208));
|
||||
make.height.mas_equalTo(kGetScaleWidth(40));
|
||||
make.centerX.equalTo(self.bgView);
|
||||
make.top.mas_equalTo(kGetScaleWidth(178));
|
||||
}];
|
||||
}
|
||||
-(void)payBtnAction{
|
||||
[self removeFromSuperview];
|
||||
if(self.delegate && [self.delegate respondsToSelector:@selector(payReleaseHeadlines)]){
|
||||
[self.delegate payReleaseHeadlines];
|
||||
}
|
||||
}
|
||||
- (void)setCoins:(NSString *)coins{
|
||||
_coins = coins;
|
||||
UIImage *iconImage = kImage(@"exchange_gold_icon");
|
||||
|
||||
UIFont *font = kFontMedium(11);
|
||||
NSMutableAttributedString *textAtt = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"%@(%@%@)",YMLocalizedString(@"XPNobleCenterPayView2"),YMLocalizedString(@"XPNobleCenterPayView1"),_coins] attributes:@{NSFontAttributeName:font,NSForegroundColorAttributeName:UIColorFromRGB(0x333333)}];
|
||||
NSTextAttachment * attachment = [[NSTextAttachment alloc] init];
|
||||
attachment.bounds = CGRectMake(0, roundf(font.capHeight - iconImage.size.height)/2.f, iconImage.size.width, iconImage.size.height);;
|
||||
attachment.image = iconImage;
|
||||
[textAtt insertAttributedString:[NSMutableAttributedString attributedStringWithAttachment:attachment] atIndex:0];
|
||||
[textAtt addAttributes:@{NSFontAttributeName:kFontMedium(14)} range:[textAtt.string rangeOfString:YMLocalizedString(@"XPNobleCenterPayView2")]];
|
||||
_coinsView.attributedText = textAtt;
|
||||
}
|
||||
#pragma mark - 懒加载
|
||||
- (UIView *)bgView{
|
||||
if(!_bgView){
|
||||
_bgView = [UIView new];
|
||||
_bgView.backgroundColor = [UIColor whiteColor];
|
||||
[_bgView setCornerWithLeftTopCorner:kGetScaleWidth(20) rightTopCorner:kGetScaleWidth(20) bottomLeftCorner:0 bottomRightCorner:0 size:CGSizeMake(KScreenWidth, kGetScaleWidth(245))];
|
||||
}
|
||||
return _bgView;
|
||||
}
|
||||
- (UILabel *)titleView{
|
||||
if(!_titleView){
|
||||
_titleView = [UILabel labelInitWithText:YMLocalizedString(@"XPNobleCenterPayView0") font:kFontMedium(15) textColor:UIColorFromRGB(0x333333)];
|
||||
}
|
||||
return _titleView;
|
||||
}
|
||||
- (UILabel *)numView{
|
||||
if(!_numView){
|
||||
_numView = [UILabel labelInitWithText:@"0" font:kFontBold(19) textColor:UIColorFromRGB(0x7C5EFD)];
|
||||
}
|
||||
return _numView;
|
||||
}
|
||||
- (UILabel *)coinsView{
|
||||
if(!_coinsView){
|
||||
_coinsView = [UILabel new];
|
||||
}
|
||||
return _coinsView;
|
||||
}
|
||||
- (UIImageView *)chooseImageView{
|
||||
if(!_chooseImageView){
|
||||
_chooseImageView = [UIImageView new];
|
||||
_chooseImageView.image = kImage(@"ms_headlines_pay_icon");
|
||||
}
|
||||
return _chooseImageView;
|
||||
}
|
||||
- (UIButton *)payBtn{
|
||||
if(!_payBtn){
|
||||
_payBtn = [UIButton new];
|
||||
UIImage *image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x7E5AFF),UIColorFromRGB(0x52CAD3)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(kGetScaleWidth(208),kGetScaleWidth(40))];
|
||||
[_payBtn setBackgroundImage:image forState:UIControlStateNormal];
|
||||
_payBtn.layer.cornerRadius = kGetScaleWidth(40)/2;
|
||||
_payBtn.layer.masksToBounds = YES;
|
||||
[_payBtn setTitle:YMLocalizedString(@"XPMineConfirmGiveDiamondView0") forState:UIControlStateNormal];
|
||||
[_payBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
_payBtn.titleLabel.font = kFontMedium(16);
|
||||
[_payBtn addTarget:self action:@selector(payBtnAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _payBtn;
|
||||
}
|
||||
- (UIButton *)backBtn{
|
||||
if(!_backBtn){
|
||||
_backBtn = [UIButton new];
|
||||
[_backBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _backBtn;
|
||||
}
|
||||
@end
|
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// MSSessionReleaseHeadlinesView.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/9.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol MSSessionReleaseHeadlinesViewDelegate <NSObject>
|
||||
|
||||
-(void)releaseHeadlinesWithText:(NSString *)text;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface MSSessionReleaseHeadlinesView : UIView
|
||||
@property(nonatomic,copy) NSString *golds;
|
||||
@property(nonatomic,copy) NSString *myCoins;
|
||||
@property(nonatomic,weak) id<MSSessionReleaseHeadlinesViewDelegate>delegate;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,207 @@
|
||||
//
|
||||
// MSSessionReleaseHeadlinesView.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/9.
|
||||
//
|
||||
|
||||
#import "MSSessionReleaseHeadlinesView.h"
|
||||
#import "MSSessionReleaseHeadlinesPayView.h"
|
||||
@interface MSSessionReleaseHeadlinesView()<UITextViewDelegate,MSSessionReleaseHeadlinesPayViewDelegate>
|
||||
@property(nonatomic,strong) UIView *bgView;
|
||||
@property(nonatomic,strong) SZTextView *textView;
|
||||
@property(nonatomic,strong) UIView *bgTextView;
|
||||
@property(nonatomic,strong) UIButton *releaseBtn;
|
||||
@property(nonatomic,strong) UIButton *backBtn;
|
||||
@end
|
||||
@implementation MSSessionReleaseHeadlinesView
|
||||
|
||||
-(instancetype)initWithFrame:(CGRect)frame{
|
||||
self = [super initWithFrame:frame];
|
||||
if(self){
|
||||
[self installUI];
|
||||
[self installConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)installUI{
|
||||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(keyboardWillShow:)name:UIKeyboardWillShowNotification object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
|
||||
self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.6];
|
||||
[self addSubview:self.backBtn];
|
||||
[self addSubview:self.bgView];
|
||||
[self.bgView addSubview:self.bgTextView];
|
||||
[self.bgView addSubview:self.releaseBtn];
|
||||
[self.bgTextView addSubview:self.textView];
|
||||
}
|
||||
-(void)installConstraints{
|
||||
[self.backBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self);
|
||||
}];
|
||||
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.trailing.leading.equalTo(self);
|
||||
make.bottom.mas_equalTo(0);
|
||||
make.height.mas_equalTo(kGetScaleWidth(245));
|
||||
}];
|
||||
[self.bgTextView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(kGetScaleWidth(20));
|
||||
make.leading.trailing.equalTo(self.bgView).inset(kGetScaleWidth(16));
|
||||
make.height.mas_equalTo(kGetScaleWidth(132));
|
||||
}];
|
||||
[self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(kGetScaleWidth(10));
|
||||
make.leading.bottom.trailing.equalTo(self.bgTextView).inset(kGetScaleWidth(6));
|
||||
|
||||
}];
|
||||
[self.releaseBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self.bgView);
|
||||
make.width.mas_equalTo(kGetScaleWidth(208));
|
||||
make.height.mas_equalTo(kGetScaleWidth(40));
|
||||
make.top.equalTo(self.bgTextView.mas_bottom).mas_offset(kGetScaleWidth(26));
|
||||
}];
|
||||
}
|
||||
-(void)releaseBtnAction{
|
||||
if(self.textView.text.length == 0){
|
||||
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"MSSessionReleaseHeadlinesView0")];
|
||||
return;
|
||||
}
|
||||
[self.textView resignFirstResponder];
|
||||
MSSessionReleaseHeadlinesPayView *payView = [[MSSessionReleaseHeadlinesPayView alloc]initWithFrame:CGRectZero];
|
||||
payView.coins = self.myCoins;
|
||||
payView.delegate = self;
|
||||
[self addSubview:payView];
|
||||
[payView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self);
|
||||
}];
|
||||
|
||||
|
||||
}
|
||||
-(void)payReleaseHeadlines{
|
||||
if(self.delegate && [self.delegate respondsToSelector:@selector(releaseHeadlinesWithText:)]){
|
||||
[self.delegate releaseHeadlinesWithText:self.textView.text];
|
||||
}
|
||||
[TTPopup dismiss];
|
||||
}
|
||||
- (void)keyboardWillShow:(NSNotification *)notification
|
||||
|
||||
{
|
||||
NSDictionary *userInfo = [notification userInfo];
|
||||
CGFloat curkeyBoardHeight = [[[notification userInfo]objectForKey:@"UIKeyboardBoundsUserInfoKey"]CGRectValue].size.height;
|
||||
CGRect begin = [[[notification userInfo]objectForKey:@"UIKeyboardFrameBeginUserInfoKey"]CGRectValue];
|
||||
CGRect end = [[[notification userInfo]objectForKey:@"UIKeyboardFrameEndUserInfoKey"]CGRectValue];
|
||||
// 第三方键盘回调三次问题,监听仅执行最后一次
|
||||
|
||||
if( begin.size.height > 0 && (begin.origin.y - end.origin.y > 0)){
|
||||
CGFloat keyBoardHeight = curkeyBoardHeight;
|
||||
CGFloat animationDuration = [userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue];
|
||||
[self.bgView.superview layoutIfNeeded];
|
||||
[UIView animateWithDuration:animationDuration animations:^{
|
||||
[self.bgView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.mas_equalTo(-keyBoardHeight);
|
||||
}];
|
||||
[self.bgView.superview layoutIfNeeded];
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
- (void)keyboardWillHide:(NSNotification *)notification{
|
||||
|
||||
//获取键盘的高度
|
||||
NSDictionary *userInfo = [notification userInfo];
|
||||
NSValue *keyboardValue = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];
|
||||
CGFloat animationDuration = [userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue];
|
||||
//做自定义事件
|
||||
[self.bgView.superview layoutIfNeeded];
|
||||
[UIView animateWithDuration:animationDuration animations:^{
|
||||
[self.bgView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.mas_equalTo(0);
|
||||
}];
|
||||
|
||||
[self.bgView.superview layoutIfNeeded];
|
||||
}completion:^(BOOL finished) {
|
||||
|
||||
}];
|
||||
|
||||
}
|
||||
-(void)dealloc{
|
||||
[[NSNotificationCenter defaultCenter]removeObserver:self];
|
||||
}
|
||||
-(void)backAction{
|
||||
[TTPopup dismiss];
|
||||
}
|
||||
-(void)setGolds:(NSString *)golds{
|
||||
_golds = golds;
|
||||
UIImage *iconImage = kImage(@"exchange_gold_icon");
|
||||
|
||||
UIFont *font = kFontMedium(16);
|
||||
NSMutableAttributedString *textAtt = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:YMLocalizedString(@"MSSessionReleaseHeadlinesView1"),_golds] attributes:@{NSFontAttributeName:font,NSForegroundColorAttributeName:[UIColor whiteColor]}];
|
||||
NSTextAttachment * attachment = [[NSTextAttachment alloc] init];
|
||||
attachment.bounds = CGRectMake(0, roundf(font.capHeight - iconImage.size.height)/2.f, iconImage.size.width, iconImage.size.height);;
|
||||
attachment.image = iconImage;
|
||||
[textAtt insertAttributedString:[NSMutableAttributedString attributedStringWithAttachment:attachment] atIndex:0];
|
||||
[_releaseBtn setAttributedTitle:textAtt forState:UIControlStateNormal];
|
||||
}
|
||||
#pragma mark - UITextViewDelegate
|
||||
- (void)textViewDidChange:(UITextView *)textView {
|
||||
if (textView.text.length > 100) {
|
||||
|
||||
textView.text = [textView.text substringToIndex:100];
|
||||
}
|
||||
|
||||
}
|
||||
- (NSInteger)getToInt:(NSString*)strtemp
|
||||
{
|
||||
NSStringEncoding enc = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000);
|
||||
NSData* da = [strtemp dataUsingEncoding:enc];
|
||||
return [da length];
|
||||
}
|
||||
#pragma mark - 懒加载
|
||||
- (UIView *)bgView{
|
||||
if(!_bgView){
|
||||
_bgView = [UIView new];
|
||||
_bgView.backgroundColor = [UIColor whiteColor];
|
||||
[_bgView setCornerWithLeftTopCorner:kGetScaleWidth(19) rightTopCorner:kGetScaleWidth(19) bottomLeftCorner:0 bottomRightCorner:0 size:CGSizeMake(KScreenWidth, kGetScaleWidth(245))];
|
||||
}
|
||||
return _bgView;
|
||||
}
|
||||
- (SZTextView *)textView {
|
||||
if (!_textView) {
|
||||
_textView = [[SZTextView alloc] init];
|
||||
_textView.textColor = [DJDKMIMOMColor mainTextColor];
|
||||
_textView.font = kFontMedium(13);
|
||||
_textView.placeholder = YMLocalizedString(@"MSSessionReleaseHeadlinesView0");
|
||||
_textView.placeholderTextColor = UIColorFromRGB(0x999999);
|
||||
_textView.backgroundColor = [UIColor clearColor];
|
||||
_textView.delegate = self;
|
||||
}
|
||||
return _textView;
|
||||
}
|
||||
- (UIView *)bgTextView{
|
||||
if(!_bgTextView){
|
||||
_bgTextView = [UIView new];
|
||||
_bgTextView.backgroundColor = UIColorFromRGB(0xF5F5F5);
|
||||
_bgTextView.layer.cornerRadius = kGetScaleWidth(16);
|
||||
_bgTextView.layer.masksToBounds = YES;
|
||||
}
|
||||
return _bgTextView;
|
||||
}
|
||||
- (UIButton *)releaseBtn{
|
||||
if(!_releaseBtn){
|
||||
_releaseBtn = [UIButton new];
|
||||
UIImage *image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x7E5AFF),UIColorFromRGB(0x52CAD3)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(kGetScaleWidth(208),kGetScaleWidth(40))];
|
||||
[_releaseBtn setBackgroundImage:image forState:UIControlStateNormal];
|
||||
_releaseBtn.layer.cornerRadius = kGetScaleWidth(40)/2;
|
||||
_releaseBtn.layer.masksToBounds = YES;
|
||||
[_releaseBtn addTarget:self action:@selector(releaseBtnAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _releaseBtn;
|
||||
}
|
||||
- (UIButton *)backBtn{
|
||||
if(!_backBtn){
|
||||
_backBtn = [UIButton new];
|
||||
[_backBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _backBtn;
|
||||
}
|
||||
@end
|
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// MSSessionScrollingItemView.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/8.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "MSSessionScrollingModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MSSessionScrollingItemView : UIView
|
||||
@property(nonatomic,strong) MSSessionScrollingModel *model;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,62 @@
|
||||
//
|
||||
// MSSessionScrollingItemView.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/5/8.
|
||||
//
|
||||
|
||||
#import "MSSessionScrollingItemView.h"
|
||||
@interface MSSessionScrollingItemView()
|
||||
@property(nonatomic,strong) NetImageView *avatarVeiw;
|
||||
@property(nonatomic,strong) UILabel *textView;
|
||||
@end
|
||||
@implementation MSSessionScrollingItemView
|
||||
|
||||
-(instancetype)initWithFrame:(CGRect)frame{
|
||||
self = [super initWithFrame:frame];
|
||||
if(self){
|
||||
[self installUI];
|
||||
[self installConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)setModel:(MSSessionScrollingModel *)model{
|
||||
_model = model;
|
||||
_avatarVeiw.imageUrl = _model.fromAvatar;
|
||||
_textView.text = _model.content;
|
||||
}
|
||||
-(void)installUI{
|
||||
[self addSubview:self.avatarVeiw];
|
||||
[self addSubview:self.textView];
|
||||
}
|
||||
-(void)installConstraints{
|
||||
[self.avatarVeiw mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.height.mas_equalTo(kGetScaleWidth(27));
|
||||
make.leading.top.equalTo(self);
|
||||
}];
|
||||
[self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.equalTo(self.avatarVeiw.mas_trailing).mas_offset(kGetScaleWidth(5.5));
|
||||
make.trailing.mas_equalTo(-kGetScaleWidth(0));
|
||||
make.height.mas_equalTo(kGetScaleWidth(11.5));
|
||||
make.centerY.equalTo(self.avatarVeiw);
|
||||
}];
|
||||
|
||||
}
|
||||
#pragma mark - 懒加载
|
||||
- (NetImageView *)avatarVeiw{
|
||||
if(!_avatarVeiw){
|
||||
NetImageConfig *config = [NetImageConfig new];
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_avatarVeiw = [[NetImageView alloc]initWithConfig:config];
|
||||
_avatarVeiw.layer.cornerRadius = kGetScaleWidth(27)/2;
|
||||
_avatarVeiw.layer.masksToBounds = YES;
|
||||
}
|
||||
return _avatarVeiw;
|
||||
}
|
||||
- (UILabel *)textView{
|
||||
if(!_textView){
|
||||
_textView = [UILabel labelInitWithText:@"" font:kFontMedium(12) textColor:UIColorFromRGB(0xFFFCED)];
|
||||
}
|
||||
return _textView;
|
||||
}
|
||||
@end
|
@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@protocol MSSessionScrollingViewDelegate <NSObject>
|
||||
@property (nonatomic,readonly)NSTimeInterval curTime;
|
||||
- (UIView *)MSSessionScrollingView:(MSSessionScrollingView *)view scrollingWithModel:(id<MSSessionScrollingProtocol>)model;
|
||||
- (void)MSSessionScrollingView:(MSSessionScrollingView *)view didClickView:(UIView *)scrollingView atPoint:(CGPoint)point;
|
||||
- (void)MSSessionScrollingView:(MSSessionScrollingView *)view didClickView:(UIView *__nullable)scrollingView atPoint:(CGPoint)point;
|
||||
|
||||
@end
|
||||
|
||||
|
@@ -9,7 +9,7 @@
|
||||
#import "CALayer+Animation.h"
|
||||
|
||||
static const CGFloat ktimerSec = 0.1;
|
||||
static const CGFloat kDandaoCount = 5;
|
||||
static const CGFloat kDandaoCount = 3;
|
||||
|
||||
@interface MSSessionScrollingView()
|
||||
@property (nonatomic,weak)NSTimer *timer;
|
||||
@@ -17,13 +17,13 @@ static const CGFloat kDandaoCount = 5;
|
||||
@property (nonatomic,strong)NSMutableArray *leftTimeList;
|
||||
@property (nonatomic,strong)NSMutableArray *scrollingList;
|
||||
|
||||
|
||||
@end
|
||||
@implementation MSSessionScrollingView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(ms_ClickView:)];
|
||||
[self addGestureRecognizer:tap];
|
||||
|
||||
[self installUI];
|
||||
[self installConstraints];
|
||||
}
|
||||
@@ -31,23 +31,16 @@ static const CGFloat kDandaoCount = 5;
|
||||
}
|
||||
-(void)installUI{
|
||||
|
||||
|
||||
}
|
||||
-(void)installConstraints{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (void)ms_ClickView:(UITapGestureRecognizer *)tap {
|
||||
CGPoint point = [tap locationInView:tap.view];
|
||||
for (UIView *danmuView in self.scrollingList) {
|
||||
CGRect frame = danmuView.layer.presentationLayer.frame;
|
||||
BOOL isContain = CGRectContainsPoint(frame, point);
|
||||
if (isContain) {
|
||||
if ([self.delegate respondsToSelector:@selector(MSSessionScrollingView:didClickView:atPoint:)]) {
|
||||
[self.delegate MSSessionScrollingView:self didClickView:danmuView atPoint:point];
|
||||
}
|
||||
break;
|
||||
}
|
||||
if ([self.delegate respondsToSelector:@selector(MSSessionScrollingView:didClickView:atPoint:)]) {
|
||||
[self.delegate MSSessionScrollingView:self didClickView:nil atPoint:CGPointMake(0, 0)];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,4 +210,5 @@ static const CGFloat kDandaoCount = 5;
|
||||
}
|
||||
return _scrollingList;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -64,7 +64,6 @@
|
||||
[self addSubview:self.infoStackView];
|
||||
[self addSubview:self.reportButton];
|
||||
[self addSubview:self.likeButton];
|
||||
|
||||
[self.infoStackView addArrangedSubview:self.nickLabel];
|
||||
[self.infoStackView addArrangedSubview:self.stackView];
|
||||
|
||||
@@ -125,6 +124,7 @@
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setUserInfo:(UserInfoModel *)userInfo {
|
||||
_userInfo = userInfo;
|
||||
if (self.isPublicChatHall == YES){return;}
|
||||
if (_userInfo) {
|
||||
NSString * userId = [NSString stringWithFormat:@"%ld", userInfo.uid];
|
||||
self.userId = userId;
|
||||
@@ -137,9 +137,12 @@
|
||||
}
|
||||
}];
|
||||
}
|
||||
self.subTitleLabel.hidden = ![[NIMSDK sharedSDK].userManager isUserInBlackList:userId];
|
||||
self.liveView.hidden = ([[NIMSDK sharedSDK].userManager isUserInBlackList:userId] || _userInfo.roomUid.length <= 0);
|
||||
self.reportButton.hidden = [NIMMessageUtils isOfficalAccount:self.userId] || self.isInRoom;
|
||||
|
||||
self.subTitleLabel.hidden = ![[NIMSDK sharedSDK].userManager isUserInBlackList:userId];
|
||||
self.liveView.hidden = ([[NIMSDK sharedSDK].userManager isUserInBlackList:userId] || _userInfo.roomUid.length <= 0);
|
||||
self.reportButton.hidden = [NIMMessageUtils isOfficalAccount:self.userId] || self.isInRoom;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,9 +150,11 @@
|
||||
_title = title;
|
||||
if (_title) {
|
||||
NSString * nick = title;
|
||||
if (nick.length > 10 ) {
|
||||
nick = [nick substringToIndex:10];
|
||||
}
|
||||
if(self.isPublicChatHall == NO){
|
||||
if (nick.length > 10 ) {
|
||||
nick = [nick substringToIndex:10];
|
||||
}
|
||||
}
|
||||
self.nickLabel.text = nick;
|
||||
}
|
||||
}
|
||||
|
@@ -15,8 +15,12 @@
|
||||
#import "SessionListViewController.h"
|
||||
#import "XPMineFriendViewController.h"
|
||||
#import "XPMineFansViewController.h"
|
||||
|
||||
@interface XPSessionMainViewController ()<JXCategoryViewDelegate,JXPagerViewDelegate,JXPagerMainTableViewGestureDelegate>
|
||||
#import "MSSessionScrollingView.h"
|
||||
#import "MSSessionScrollingItemView.h"
|
||||
#import "MessagePresenter.h"
|
||||
#import "MessageProtocol.h"
|
||||
#import "MSSessionPublicChatHallVC.h"
|
||||
@interface XPSessionMainViewController ()<JXCategoryViewDelegate,JXPagerViewDelegate,JXPagerMainTableViewGestureDelegate,MSSessionScrollingViewDelegate>
|
||||
@property (nonatomic, strong) JXCategoryTitleView *titleView;
|
||||
@property (nonatomic, strong) JXCategoryIndicatorImageView *lineView;
|
||||
@property (nonatomic, strong) JXPagerView *pagingView;
|
||||
@@ -33,16 +37,23 @@
|
||||
@property (nonatomic,strong) XPMineFansViewController *fansVC;
|
||||
///清除已读
|
||||
@property (nonatomic,strong) UIButton * allCleanBtn;
|
||||
|
||||
@property(nonatomic,strong) MSSessionScrollingView *scrollingView;
|
||||
@property(nonatomic,strong) UIImageView *bgImageView;
|
||||
@property(nonatomic,strong) UILabel *textView;
|
||||
@end
|
||||
|
||||
@implementation XPSessionMainViewController
|
||||
- (MessagePresenter *)createPresenter {
|
||||
return [[MessagePresenter alloc] init];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
[self getDataList];
|
||||
|
||||
}
|
||||
- (BOOL)isHiddenNavBar {
|
||||
return YES;
|
||||
@@ -50,28 +61,59 @@
|
||||
-(void)dealloc{
|
||||
[[NSNotificationCenter defaultCenter]removeObserver:self];
|
||||
}
|
||||
-(void)getDataList{
|
||||
[self.presenter getPublicChatHallList];
|
||||
}
|
||||
-(void)getPublicChatHallListSuccess:(NSArray<MSSessionScrollingModel *> *)list{
|
||||
NSMutableArray *l = [NSMutableArray new];
|
||||
for (MSSessionScrollingModel *obj in list) {
|
||||
obj.beginTime = 3;
|
||||
obj.endTime = 8;
|
||||
}
|
||||
self.scrollingView.modelList = [[NSMutableArray alloc]initWithArray:list];
|
||||
}
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(getTabBarItemBadge:) name:@"kGetTabBarItemBadge" object:nil];
|
||||
self.view.backgroundColor = [UIColor clearColor];
|
||||
self.headView = [UIView new];
|
||||
|
||||
[self.view addSubview:self.headBgImageView];
|
||||
[self.view addSubview:self.pagingView];
|
||||
[self.view addSubview:self.allCleanBtn];
|
||||
|
||||
[self.view addSubview:self.bgImageView];
|
||||
[self.bgImageView addSubview:self.textView];
|
||||
[self.bgImageView addSubview:self.scrollingView];
|
||||
}
|
||||
- (void)initSubViewConstraints {
|
||||
[self.headBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.top.trailing.equalTo(self.view);
|
||||
make.height.mas_equalTo(196);
|
||||
}];
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(kStatusBarHeight);
|
||||
make.height.mas_equalTo(kGetScaleWidth(99));
|
||||
make.leading.trailing.equalTo(self.view);
|
||||
}];
|
||||
[self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(kGetScaleWidth(13));
|
||||
make.centerX.equalTo(self.bgImageView);
|
||||
}];
|
||||
[self.scrollingView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(0);
|
||||
make.top.mas_equalTo(kGetScaleWidth(35));
|
||||
make.trailing.mas_equalTo(-kGetScaleWidth(0));
|
||||
make.bottom.mas_equalTo(kGetScaleWidth(10));
|
||||
}];
|
||||
|
||||
[self.pagingView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.leading.trailing.equalTo(self.view);
|
||||
make.leading.trailing.equalTo(self.view);
|
||||
make.bottom.mas_equalTo(-1);
|
||||
make.top.equalTo(self.bgImageView.mas_bottom).mas_offset(-50);
|
||||
}];
|
||||
[self.allCleanBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.height.mas_equalTo(30);
|
||||
make.top.mas_equalTo(67);
|
||||
make.top.mas_equalTo(67+kGetScaleWidth(115));
|
||||
make.trailing.mas_equalTo(-15);
|
||||
}];
|
||||
|
||||
@@ -141,6 +183,25 @@
|
||||
- (void)allReadButtonClick:(UIButton *)sender {
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:@"kAllReadAction" object:nil];
|
||||
}
|
||||
#pragma mark- MSSessionScrollingViewDelegate
|
||||
- (UIView *)MSSessionScrollingView:(MSSessionScrollingView *)view scrollingWithModel:(MSSessionScrollingModel*)model{
|
||||
MSSessionScrollingItemView *scrollingView = [[MSSessionScrollingItemView alloc]initWithFrame:CGRectMake(0, 0, model.width + kGetScaleWidth(32.5), kGetScaleWidth(27))];
|
||||
scrollingView.model = model;
|
||||
|
||||
return scrollingView;
|
||||
}
|
||||
- (void)MSSessionScrollingView:(MSSessionScrollingView *)view didClickView:(UIView *)scrollingView atPoint:(CGPoint)point{
|
||||
|
||||
}
|
||||
-(void)clickPublicChatHallAction{
|
||||
MSSessionPublicChatHallVC *vc =[MSSessionPublicChatHallVC new];
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
-(NSTimeInterval)curTime {
|
||||
static double time = 0;
|
||||
time += 0.1 ;
|
||||
return time;
|
||||
}
|
||||
#pragma mark -懒加载
|
||||
- (JXCategoryTitleView *)titleView {
|
||||
if (!_titleView) {
|
||||
@@ -236,6 +297,29 @@
|
||||
}
|
||||
return _allCleanBtn;
|
||||
}
|
||||
- (MSSessionScrollingView *)scrollingView{
|
||||
if(!_scrollingView){
|
||||
_scrollingView = [[MSSessionScrollingView alloc]initWithFrame:CGRectZero];
|
||||
_scrollingView.delegate = self;
|
||||
}
|
||||
return _scrollingView;
|
||||
}
|
||||
- (UIImageView *)bgImageView{
|
||||
if(!_bgImageView){
|
||||
_bgImageView = [UIImageView new];
|
||||
_bgImageView.userInteractionEnabled = YES;
|
||||
_bgImageView.image = kImage(@"ms_public_chat_hall_head_enter_bg");
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickPublicChatHallAction)];
|
||||
[_bgImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _bgImageView;
|
||||
}
|
||||
- (UILabel *)textView{
|
||||
if(!_textView){
|
||||
_textView = [UILabel labelInitWithText:YMLocalizedString(@"MSSessionPublicChatHallVC0") font:kFontBold(17) textColor:UIColorFromRGB(0xFFDDA2)];
|
||||
}
|
||||
return _textView;
|
||||
}
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
|
@@ -68,6 +68,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property(nonatomic,copy) NSString *nameplateWord;
|
||||
///是否自定义铭牌,
|
||||
@property(nonatomic,assign) BOOL isCustomWord;
|
||||
@property(nonatomic,copy) NSString * headwearUrl;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -3600,3 +3600,12 @@
|
||||
"MJRefreshHeaderNoneLastDateText" = "No record";
|
||||
//MSRoomGameWebVC
|
||||
"MSRoomGameWebVC0"="Are you sure you want to exit the game?";
|
||||
///MSSessionPublicChatHallVC
|
||||
"MSSessionPublicChatHallVC0"="Public Chat Hall";
|
||||
"MSSessionPublicChatHallVC1"="I want headlines~";
|
||||
///MSSessionReleaseHeadlinesView
|
||||
"MSSessionReleaseHeadlinesView0"="Enter your headline content~ (100 characters max)";
|
||||
"MSSessionReleaseHeadlinesView1"=" %@ makes headlines";
|
||||
///MSSessionContextHeadlinesView
|
||||
"MSSessionContextHeadlinesView0"="Honorable %@, you've made the headlines~";
|
||||
|
||||
|
@@ -3256,3 +3256,12 @@
|
||||
"MJRefreshHeaderNoneLastDateText" = "无记录";
|
||||
//MSRoomGameWebVC
|
||||
"MSRoomGameWebVC0"="确定退出游戏吗?";
|
||||
///MSSessionPublicChatHallVC
|
||||
"MSSessionPublicChatHallVC0"="公聊厅";
|
||||
"MSSessionPublicChatHallVC1"="我要上头条~";
|
||||
///MSSessionReleaseHeadlinesView
|
||||
"MSSessionReleaseHeadlinesView0"="请输入想上头条的内容~(仅限100字)";
|
||||
"MSSessionReleaseHeadlinesView1"=" %@上头条";
|
||||
|
||||
///MSSessionContextHeadlinesView
|
||||
"MSSessionContextHeadlinesView0"="尊貴的%@,上頭條啦~";
|
||||
|
@@ -3250,3 +3250,11 @@
|
||||
"MJRefreshHeaderNoneLastDateText" = "無記錄";
|
||||
//MSRoomGameWebVC
|
||||
"MSRoomGameWebVC0"="確定退出遊戲嗎?";
|
||||
///MSSessionPublicChatHallVC
|
||||
"MSSessionPublicChatHallVC0"="公聊廳";
|
||||
"MSSessionPublicChatHallVC1"="我要上頭條~";
|
||||
///MSSessionReleaseHeadlinesView
|
||||
"MSSessionReleaseHeadlinesView0"="請輸入想上頭條的內容~(僅限100字)";
|
||||
"MSSessionReleaseHeadlinesView1"=" %@上頭條";
|
||||
///MSSessionContextHeadlinesView
|
||||
"MSSessionContextHeadlinesView0"="尊貴的%@,上頭條啦~";
|
||||
|