修复优化bug

This commit is contained in:
liyuhua
2024-03-23 18:21:29 +08:00
parent 2b5a1eb2a5
commit 43e5f14a83
12 changed files with 78 additions and 12 deletions

View File

@@ -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 = "<group>"; };
239EA6522BAEA73100570127 /* RoomChatScreenContentCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomChatScreenContentCell.swift; sourceTree = "<group>"; };
239EA6592BAEB48A00570127 /* RoomDynamicEffectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomDynamicEffectView.swift; sourceTree = "<group>"; };
239EA65E2BAED9B900570127 /* YinCustomAttachmentCoding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YinCustomAttachmentCoding.swift; sourceTree = "<group>"; };
23EE96DF2B9EB22100475D69 /* RoomMenuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomMenuView.swift; sourceTree = "<group>"; };
23EE96E12B9EB22F00475D69 /* RoomSendTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomSendTextView.swift; sourceTree = "<group>"; };
23EE96E52B9EE79A00475D69 /* RoomVCViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RoomVCViewModel.swift; sourceTree = "<group>"; };
@@ -859,6 +861,7 @@
isa = PBXGroup;
children = (
E8479E4C2B8DDBC5009AF878 /* ChatAttributeTool.swift */,
239EA65E2BAED9B900570127 /* YinCustomAttachmentCoding.swift */,
);
path = Tool;
sourceTree = "<group>";
@@ -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 */,

View File

@@ -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())
}
}

View File

@@ -16,3 +16,4 @@
#import <NIMSDK/NIMSDK.h>
#import <YYText/YYText.h>
#import "UIView+VAP.h"

View File

@@ -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 ""
}
}

View File

@@ -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
}
}

View File

@@ -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{

View File

@@ -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

View File

@@ -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,6 +317,9 @@ extension RoomVC : NIMChatManagerDelegate, NIMChatroomManagerDelegate, NIMLoginM
case .exit:
updateOnlineNum(num: -1)
break
case .closed:
print("111")
break
default:

View File

@@ -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 ?? []{

View File

@@ -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)
}

View File

@@ -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<RectiveGiftModel>.toModel(with: customObj.data),let gift = model.gift == nil ? model.giftInfo : model.gift {

View File

@@ -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)