商店包版本修改 此commit置顶 1.0.3

This commit is contained in:
liyuhua
2024-03-25 11:47:10 +08:00
parent 7e299b9212
commit 60dcf38ea2
7 changed files with 83 additions and 28 deletions

View File

@@ -12,5 +12,5 @@ enum H5Utils:String {
case user = "modules/rule/protocol.html" case user = "modules/rule/protocol.html"
case logoff = "modules/logout/index.html" case logoff = "modules/logout/index.html"
case pay = "mew/modules/rule/rechargeAgreement.html" case pay = "mew/modules/rule/rechargeAgreement.html"
case rank = "modules/room_rank/index.html" case rank = "modules/roomRank/index.html"
} }

View File

@@ -24,5 +24,6 @@ struct RoomDataModel : HandyJSON {
var defUser = "" var defUser = ""
var type:Int = 3 var type:Int = 3
var audioSdkType = "" var audioSdkType = ""
var showGiftValue = false
} }

View File

@@ -8,24 +8,40 @@
import UIKit import UIKit
class YinRoomAgoraManager: NSObject { class YinRoomAgoraManager: NSObject {
func initAgora(){
func initAgora(roomUid:String){ let manager = AgoraRtcEngineKit.sharedEngine(withAppId: AppKeys.agoraKey, delegate: self)
manager.setClientRole(.audience) manager.setChannelProfile(.liveBroadcasting)
let i = manager.joinChannel(byToken: nil, channelId: roomUid, info: nil, uid: UInt(AuthManager.userUid)) { c, uid, e in manager.startLastmileProbeTest(nil)
self.manager.muteAllRemoteAudioStreams(false) manager.setParameters("{\"che.audio.keep.audiosession\":true}")
manager.enableAudio()
manager.disableVideo()
manager.enableAudioVolumeIndication(900, smooth: 3, reportVad: true)
manager.setAudioProfile(.musicStandard)
manager.setAudioScenario(.gameStreaming)
#if DEBUG
manager.setLogFilter(0x000f)
#else
manager.setLogFilter(0)
#endif
self.manager = manager
}
func setAgora(roomUid:String){
manager?.setClientRole(.audience)
manager?.joinChannel(byToken: nil, channelId: roomUid, info: nil, uid: UInt(AuthManager.userUid)) { c, uid, e in
self.manager?.muteAllRemoteAudioStreams(false)
self.muteLocalAudio(mute: false) self.muteLocalAudio(mute: false)
} }
print(i)
} }
func muteLocalAudio(mute:Bool){ func muteLocalAudio(mute:Bool){
manager.muteLocalAudioStream(mute) manager?.muteLocalAudioStream(mute)
} }
func setBroadcast(isChange:Bool){ func setBroadcast(isChange:Bool){
manager.setClientRole(isChange ? .broadcaster : .audience) manager?.setClientRole(isChange ? .broadcaster : .audience)
} }
func exitRoom(){ func exitRoom(){
manager.leaveChannel { stats in manager?.leaveChannel { stats in
} }
} }
@@ -34,23 +50,7 @@ class YinRoomAgoraManager: NSObject {
func destroySharedIntance(){ func destroySharedIntance(){
AgoraRtcEngineKit.destroy() AgoraRtcEngineKit.destroy()
} }
private lazy var manager:AgoraRtcEngineKit = { private var manager:AgoraRtcEngineKit?
let _manager = AgoraRtcEngineKit.sharedEngine(withAppId: AppKeys.agoraKey, delegate: self)
_manager.setChannelProfile(.liveBroadcasting)
_manager.startLastmileProbeTest(nil)
_manager.setParameters("{\"che.audio.keep.audiosession\":true}")
_manager.enableAudio()
_manager.disableVideo()
_manager.enableAudioVolumeIndication(900, smooth: 3, reportVad: true)
_manager.setAudioProfile(.musicStandard)
_manager.setAudioScenario(.gameStreaming)
#if DEBUG
_manager.setLogFilter(0x000f)
#else
_manager.setLogFilter(0)
#endif
return _manager
}()
} }
extension YinRoomAgoraManager:AgoraRtcEngineDelegate{ extension YinRoomAgoraManager:AgoraRtcEngineDelegate{
func rtcEngine(_ engine: AgoraRtcEngineKit, reportAudioVolumeIndicationOfSpeakers speakers: [AgoraRtcAudioVolumeInfo], totalVolume: Int) { func rtcEngine(_ engine: AgoraRtcEngineKit, reportAudioVolumeIndicationOfSpeakers speakers: [AgoraRtcAudioVolumeInfo], totalVolume: Int) {

View File

@@ -14,14 +14,22 @@ case trtc,agora
class YinRoomAudioManager: NSObject { class YinRoomAudioManager: NSObject {
static let share = YinRoomAudioManager() static let share = YinRoomAudioManager()
var type:YinRoomAudioManagerType = .trtc var type:YinRoomAudioManagerType = .trtc
var roomId = ""
func dealWithChatData(roomData:RoomDataModel){ func dealWithChatData(roomData:RoomDataModel){
if roomId == roomData.roomId{
return
}
roomId = roomData.roomId
type = roomData.audioSdkType == "trtc" ? .trtc : .agora type = roomData.audioSdkType == "trtc" ? .trtc : .agora
if type == .trtc{ if type == .trtc{
roomTRTCManager.initRTRC() roomTRTCManager.initRTRC()
roomTRTCManager.roomData = roomData roomTRTCManager.roomData = roomData
roomTRTCManager.setTRTC() roomTRTCManager.setTRTC()
}else{ }else{
agoraManager.initAgora(roomUid: roomData.roomId) agoraManager.initAgora()
agoraManager.setAgora(roomUid: roomData.roomId)
} }
} }
@@ -54,6 +62,7 @@ class YinRoomAudioManager: NSObject {
}else{ }else{
agoraManager.destroySharedIntance() agoraManager.destroySharedIntance()
} }
roomId = ""
} }

View File

@@ -332,6 +332,7 @@ extension RoomVC : NIMChatManagerDelegate, NIMChatroomManagerDelegate, NIMLoginM
}else if msg.messageType == .custom{ }else if msg.messageType == .custom{
chatScreenView.dealWithCustomMsg(msg: msg) chatScreenView.dealWithCustomMsg(msg: msg)
roomEffectView.dealWithCustomMsg(msg: msg) roomEffectView.dealWithCustomMsg(msg: msg)
micSeatView.dealWithCustomMsg(msg: msg)
startPlayAnimation(msg: msg) startPlayAnimation(msg: msg)
} }
micSeatView.dealWithNotMessage(msg: msg) micSeatView.dealWithNotMessage(msg: msg)
@@ -389,6 +390,7 @@ extension RoomVC : NIMChatManagerDelegate, NIMChatroomManagerDelegate, NIMLoginM
chatScreenView.dealWithCustomMsg(msg: message) chatScreenView.dealWithCustomMsg(msg: message)
roomEffectView.dealWithCustomMsg(msg: message) roomEffectView.dealWithCustomMsg(msg: message)
startPlayAnimation(msg: message) startPlayAnimation(msg: message)
micSeatView.dealWithCustomMsg(msg: message)
} }
} }
func updateOnlineNum(num:Int){ func updateOnlineNum(num:Int){

View File

@@ -348,6 +348,11 @@ extension NormalMicSeatSuperView:UICollectionViewDelegate,UICollectionViewDataSo
if pos == "-1"{ if pos == "-1"{
if changeType == 1{ if changeType == 1{
roomOwnerView.user = userData roomOwnerView.user = userData
if userData.uid == AuthManager.userUid,let showGiftValue = roomData?.showGiftValue,showGiftValue == true{
upMicAction(index: pos)
}
}else if changeType == 2{ }else if changeType == 2{
roomOwnerView.user = nil roomOwnerView.user = nil
@@ -356,6 +361,9 @@ extension NormalMicSeatSuperView:UICollectionViewDelegate,UICollectionViewDataSo
if changeType == 1,let i = Int(pos){ if changeType == 1,let i = Int(pos){
let user = roomUserList[i] let user = roomUserList[i]
user.user = userData user.user = userData
if userData.uid == AuthManager.userUid,let showGiftValue = roomData?.showGiftValue,showGiftValue == true{
upMicAction(index: pos)
}
}else if changeType == 2,let i = Int(pos){ }else if changeType == 2,let i = Int(pos){
let user = roomUserList[i] let user = roomUserList[i]
if collectionView.cellForItem(at: IndexPath(row: i, section: 0)) is NormalMicSeatCell{ if collectionView.cellForItem(at: IndexPath(row: i, section: 0)) is NormalMicSeatCell{
@@ -396,6 +404,33 @@ extension NormalMicSeatSuperView:UICollectionViewDelegate,UICollectionViewDataSo
updateGiftNumber() updateGiftNumber()
} }
} }
func upMicGiftValue(position:String){
guard let roomUid = roomData?.uid else{return}
let params = ["uid":"\(AuthManager.userUid)","roomUid":roomUid,"position":position,"micUid":"\(AuthManager.userUid)"] as [String : Any]
RequestPost(path: "room/gift/value/up/mic", parma: params) { data in
guard let _data = data as? [String : Any],let sessionId = self.roomData?.roomId else{return}
let msg = NIMMessage()
let customModel = ChatCustomMsgModel()
customModel.first = 42
customModel.second = 421
customModel.data = _data
let obj = NIMCustomObject()
obj.attachment = customModel
msg.messageObject = obj
let session = NIMSession(sessionId, type: .chatroom)
try? NIMSDK.shared().chatManager.send(msg, to: session)
} fail: { code, message in
}
}
func dealWithCustomMsg(msg:NIMMessage){
if let obj = msg.messageObject as? NIMCustomObject,let customObj = obj.attachment as? ChatCustomMsgModel{
if customObj.first == 3 || customObj.first == 12{
updateGiftNumber()
}
}
}
func updateGiftNumber(){ func updateGiftNumber(){
guard let roomUid = roomData?.uid else { guard let roomUid = roomData?.uid else {
self.collectionView.reloadData() self.collectionView.reloadData()

View File

@@ -119,7 +119,15 @@ class RoomTopView: UIView {
if let _didClickTypeBlcok = didClickTypeBlcok{ if let _didClickTypeBlcok = didClickTypeBlcok{
_didClickTypeBlcok(2,getUrl) _didClickTypeBlcok(2,getUrl)
} }
return
} }
if let roomUid = roomData?.uid{
let getUrl = "yinmeng/\(H5Utils.rank.rawValue)" + "?roomUid=" + roomUid
if let _didClickTypeBlcok = didClickTypeBlcok{
_didClickTypeBlcok(2,getUrl)
}
}
getRankList()
} }
//MARK: - bntTarget //MARK: - bntTarget
var roomData:RoomDataModel? = nil{ var roomData:RoomDataModel? = nil{