diff --git a/yinmeng-ios.xcodeproj/project.pbxproj b/yinmeng-ios.xcodeproj/project.pbxproj index beff110..bdbf33a 100644 --- a/yinmeng-ios.xcodeproj/project.pbxproj +++ b/yinmeng-ios.xcodeproj/project.pbxproj @@ -87,6 +87,7 @@ 239EA6512BAE998E00570127 /* YYTextAsyncLayer+YinTextAsyncLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 239EA6502BAE998E00570127 /* YYTextAsyncLayer+YinTextAsyncLayer.m */; }; 239EA6532BAEA73100570127 /* RoomChatScreenContentCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 239EA6522BAEA73100570127 /* RoomChatScreenContentCell.swift */; }; 239EA65A2BAEB48A00570127 /* RoomDynamicEffectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 239EA6592BAEB48A00570127 /* RoomDynamicEffectView.swift */; }; + 239EA65F2BAED9B900570127 /* YinCustomAttachmentCoding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 239EA65E2BAED9B900570127 /* YinCustomAttachmentCoding.swift */; }; 23EE96E02B9EB22100475D69 /* RoomMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE96DF2B9EB22100475D69 /* RoomMenuView.swift */; }; 23EE96E22B9EB22F00475D69 /* RoomSendTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE96E12B9EB22F00475D69 /* RoomSendTextView.swift */; }; 23EE96E62B9EE79A00475D69 /* RoomVCViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23EE96E52B9EE79A00475D69 /* RoomVCViewModel.swift */; }; @@ -254,6 +255,7 @@ 239EA6502BAE998E00570127 /* YYTextAsyncLayer+YinTextAsyncLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "YYTextAsyncLayer+YinTextAsyncLayer.m"; sourceTree = ""; }; 239EA6522BAEA73100570127 /* RoomChatScreenContentCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomChatScreenContentCell.swift; sourceTree = ""; }; 239EA6592BAEB48A00570127 /* RoomDynamicEffectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomDynamicEffectView.swift; sourceTree = ""; }; + 239EA65E2BAED9B900570127 /* YinCustomAttachmentCoding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YinCustomAttachmentCoding.swift; sourceTree = ""; }; 23EE96DF2B9EB22100475D69 /* RoomMenuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomMenuView.swift; sourceTree = ""; }; 23EE96E12B9EB22F00475D69 /* RoomSendTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomSendTextView.swift; sourceTree = ""; }; 23EE96E52B9EE79A00475D69 /* RoomVCViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RoomVCViewModel.swift; sourceTree = ""; }; @@ -859,6 +861,7 @@ isa = PBXGroup; children = ( E8479E4C2B8DDBC5009AF878 /* ChatAttributeTool.swift */, + 239EA65E2BAED9B900570127 /* YinCustomAttachmentCoding.swift */, ); path = Tool; sourceTree = ""; @@ -1434,6 +1437,7 @@ E8E4AB212B901CD50096D77C /* ChatMoreMenuView.swift in Sources */, E86A43D32B8773C90084C04D /* APPUtils.swift in Sources */, 23EE96E62B9EE79A00475D69 /* RoomVCViewModel.swift in Sources */, + 239EA65F2BAED9B900570127 /* YinCustomAttachmentCoding.swift in Sources */, E86A43CB2B874C6F0084C04D /* AuthPrivacyView.swift in Sources */, 23630BB62BAD2725003AD25D /* RoomTopView.swift in Sources */, 234E2E0C2B9879D400433CF7 /* RoomQuitClickCell.swift in Sources */, diff --git a/yinmeng-ios/AppDelegate.swift b/yinmeng-ios/AppDelegate.swift index 98630b3..badee82 100644 --- a/yinmeng-ios/AppDelegate.swift +++ b/yinmeng-ios/AppDelegate.swift @@ -68,6 +68,7 @@ var window: UIWindow? let opt = NIMSDKOption(appKey: AppKeys.nimAppid) opt.apnsCername = "yinmeng_anps" NIMSDK.shared().register(with: opt) + NIMCustomObject.registerCustomDecoder(YinCustomAttachmentCoding()) } } diff --git a/yinmeng-ios/Base/Security/yinmeng-ios-Bridging-Header.h b/yinmeng-ios/Base/Security/yinmeng-ios-Bridging-Header.h index c5eb981..ec2af48 100644 --- a/yinmeng-ios/Base/Security/yinmeng-ios-Bridging-Header.h +++ b/yinmeng-ios/Base/Security/yinmeng-ios-Bridging-Header.h @@ -16,3 +16,4 @@ #import #import #import "UIView+VAP.h" + diff --git a/yinmeng-ios/Modules/Chat/Model/ChatCustomMsgModel.swift b/yinmeng-ios/Modules/Chat/Model/ChatCustomMsgModel.swift index 3a0d7fc..aeda557 100644 --- a/yinmeng-ios/Modules/Chat/Model/ChatCustomMsgModel.swift +++ b/yinmeng-ios/Modules/Chat/Model/ChatCustomMsgModel.swift @@ -17,7 +17,10 @@ class ChatCustomMsgModel: NSObject, HandyJSON,NIMCustomAttachment { var data:[String:Any] = [:] // encodeAttachment func encode() -> String { - return self.toJSONString() ?? "" + if let text = self.toJSONString(){ + return text + } + return "" } } diff --git a/yinmeng-ios/Modules/Chat/Tool/YinCustomAttachmentCoding.swift b/yinmeng-ios/Modules/Chat/Tool/YinCustomAttachmentCoding.swift new file mode 100644 index 0000000..409e772 --- /dev/null +++ b/yinmeng-ios/Modules/Chat/Tool/YinCustomAttachmentCoding.swift @@ -0,0 +1,40 @@ +// +// YinCustomAttachmentCoding.swift +// yinmeng-ios +// +// Created by duoban on 2024/3/23. +// + +import UIKit +import MJExtension + +class YinCustomAttachmentCoding: NSObject,NIMCustomAttachmentCoding { + func decodeAttachment(_ content: String?) -> NIMCustomAttachment? { + + if let text = content as? NSString{ + if var data = text.mj_JSONObject() as? [String : Any],let first = data["first"] as? Int,let second = data["second"] as? Int,let dic = data["data"]{ + + if let _dic = dic as? [String : Any]{ + let model = ChatCustomMsgModel() + model.first = first + model.second = second + model.data = _dic + return model + + } + if let _dic = dic as? NSString,let getDic = _dic.mj_JSONObject(),let getData = getDic as? [String:Any]{ + let model = ChatCustomMsgModel() + model.first = first + model.second = second + model.data = getData + return model + } + + } + } + return nil + } + + + +} diff --git a/yinmeng-ios/Modules/Room/Tool/YinRoomAudioManager.swift b/yinmeng-ios/Modules/Room/Tool/YinRoomAudioManager.swift index 0c278bc..366acb5 100644 --- a/yinmeng-ios/Modules/Room/Tool/YinRoomAudioManager.swift +++ b/yinmeng-ios/Modules/Room/Tool/YinRoomAudioManager.swift @@ -17,6 +17,7 @@ class YinRoomAudioManager: NSObject { func dealWithChatData(roomData:RoomDataModel){ type = roomData.audioSdkType == "trtc" ? .trtc : .agora if type == .trtc{ + roomTRTCManager.initRTRC() roomTRTCManager.roomData = roomData roomTRTCManager.setTRTC() }else{ diff --git a/yinmeng-ios/Modules/Room/Tool/YinRoomTRTCManager.swift b/yinmeng-ios/Modules/Room/Tool/YinRoomTRTCManager.swift index 9bc3a41..20ad127 100644 --- a/yinmeng-ios/Modules/Room/Tool/YinRoomTRTCManager.swift +++ b/yinmeng-ios/Modules/Room/Tool/YinRoomTRTCManager.swift @@ -11,11 +11,8 @@ class YinRoomTRTCManager: NSObject { - override init() { - super.init() - initRTRC() - } - private func initRTRC(){ + + func initRTRC(){ let cloud = TRTCCloud.sharedInstance() let params = TRTCAudioVolumeEvaluateParams() params.interval = 900 diff --git a/yinmeng-ios/Modules/Room/VC/RoomVC.swift b/yinmeng-ios/Modules/Room/VC/RoomVC.swift index ec5f89f..1d6a728 100644 --- a/yinmeng-ios/Modules/Room/VC/RoomVC.swift +++ b/yinmeng-ios/Modules/Room/VC/RoomVC.swift @@ -181,7 +181,7 @@ class RoomVC: BaseViewController, HiddenNavigationBarProtocol { } } - + private func requestData(){ let uid = AuthManager.userUid @@ -301,7 +301,9 @@ extension RoomVC : NIMChatManagerDelegate, NIMChatroomManagerDelegate, NIMLoginM if msg.messageType == .notification{ if let notMsg = msg.messageObject as? NIMNotificationObject,let content = notMsg.content as? NIMChatroomNotificationContent{ + switch content.eventType { + case .enter: updateOnlineNum(num: 1) chatScreenView.getMsgListWithHistory() @@ -315,7 +317,10 @@ extension RoomVC : NIMChatManagerDelegate, NIMChatroomManagerDelegate, NIMLoginM case .exit: updateOnlineNum(num: -1) break - + case .closed: + print("111") + break + default: break diff --git a/yinmeng-ios/Modules/Room/View/MicSeatView/View/MicSeatSuperView/NormalMicSeatSuperView.swift b/yinmeng-ios/Modules/Room/View/MicSeatView/View/MicSeatSuperView/NormalMicSeatSuperView.swift index a5b8eaf..3bd2d77 100644 --- a/yinmeng-ios/Modules/Room/View/MicSeatView/View/MicSeatSuperView/NormalMicSeatSuperView.swift +++ b/yinmeng-ios/Modules/Room/View/MicSeatView/View/MicSeatSuperView/NormalMicSeatSuperView.swift @@ -337,7 +337,7 @@ extension NormalMicSeatSuperView:UICollectionViewDelegate,UICollectionViewDataSo user.user = userData }else if changeType == 2,let i = Int(pos){ let user = roomUserList[i] - if let cell = collectionView.cellForItem(at: IndexPath(row: i, section: 0)) as? NormalMicSeatCell{ + if collectionView.cellForItem(at: IndexPath(row: i, section: 0)) is NormalMicSeatCell{ user.user = nil } @@ -349,6 +349,16 @@ extension NormalMicSeatSuperView:UICollectionViewDelegate,UICollectionViewDataSo + break + case .queueBatchChange: + for item in content.targets ?? [] { + for model in roomUserList { + if let uid = model.user?.uid, item.userId == "\(uid)"{ + model.user = nil + } + } + } + collectionView.reloadData() break case .exit: for member in content.targets ?? []{ diff --git a/yinmeng-ios/Modules/Room/View/MicSeatView/View/MicSeatSuperView/SubView/NormalMicSeatView.swift b/yinmeng-ios/Modules/Room/View/MicSeatView/View/MicSeatSuperView/SubView/NormalMicSeatView.swift index 5e77a5f..173c08f 100644 --- a/yinmeng-ios/Modules/Room/View/MicSeatView/View/MicSeatSuperView/SubView/NormalMicSeatView.swift +++ b/yinmeng-ios/Modules/Room/View/MicSeatView/View/MicSeatSuperView/SubView/NormalMicSeatView.swift @@ -28,9 +28,11 @@ class NormalMicSeatView: UIView { if isOwner { nameView.text = "" + giftValueView.numView.text = "0" avatarView.image = UIImage(named: "yin_room_mic_position_normal") }else{ nameView.text = "号麦位" + giftValueView.numView.text = "0" avatarView.image = UIImage(named: "yin_room_mic_position_normal") postionView.backgroundColor = ThemeColor(hexStr: "#FFFFFF", alpha: 0.2) } diff --git a/yinmeng-ios/Modules/Room/View/RoomDynamicEffectView/View/RoomDynamicEffectView.swift b/yinmeng-ios/Modules/Room/View/RoomDynamicEffectView/View/RoomDynamicEffectView.swift index 27e4e2c..1cf69eb 100644 --- a/yinmeng-ios/Modules/Room/View/RoomDynamicEffectView/View/RoomDynamicEffectView.swift +++ b/yinmeng-ios/Modules/Room/View/RoomDynamicEffectView/View/RoomDynamicEffectView.swift @@ -140,7 +140,9 @@ extension RoomDynamicEffectView:SVGAPlayerDelegate,HWDMP4PlayDelegate { svgaView.isHidden = true } func dealWithCustomMsg(msg:NIMMessage){ - + if let obj = msg.messageObject{ + print(obj) + } if let obj = msg.messageObject as? NIMCustomObject,let customObj = obj.attachment as? ChatCustomMsgModel{ if customObj.first == 3 || customObj.first == 12{ if let model = Deserialized.toModel(with: customObj.data),let gift = model.gift == nil ? model.giftInfo : model.gift { diff --git a/yinmeng-ios/Modules/Room/View/SendGift/View/SendGiftUserView.swift b/yinmeng-ios/Modules/Room/View/SendGift/View/SendGiftUserView.swift index 216cd1b..cb489de 100644 --- a/yinmeng-ios/Modules/Room/View/SendGift/View/SendGiftUserView.swift +++ b/yinmeng-ios/Modules/Room/View/SendGift/View/SendGiftUserView.swift @@ -40,7 +40,7 @@ class SendGiftUserView: UIView { make.centerY.equalTo(self) } collectionView.snp.makeConstraints { make in - make.height.equalTo(UIDevice.scaleWidth(width: 43)) + make.height.equalTo(UIDevice.scaleWidth(width: 46)) make.leading.equalTo(textVeiw.snp.trailing).offset((UIDevice.scaleWidth(width: 10))) make.trailing.equalTo(allUserBtn.snp.leading).offset(-UIDevice.scaleWidth(width:10)) make.centerY.equalTo(self) @@ -94,7 +94,7 @@ class SendGiftUserView: UIView { private lazy var collectionView:UICollectionView = { let flowLayout = UICollectionViewFlowLayout() flowLayout.scrollDirection = .horizontal - flowLayout.itemSize = CGSize(width: UIDevice.scaleWidth(width: 38), height: UIDevice.scaleWidth(width: 43)) + flowLayout.itemSize = CGSize(width: UIDevice.scaleWidth(width: 38), height: UIDevice.scaleWidth(width: 46)) flowLayout.minimumInteritemSpacing = UIDevice.scaleWidth(width: 4) flowLayout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) let _collectionView = UICollectionView(frame: .zero,collectionViewLayout: flowLayout)