Skip to content

Commit 1a31936

Browse files
Tangjianing123MinTate
authored andcommitted
【iOS】update version to 1.4.3
1 parent 48b0153 commit 1a31936

13 files changed

Lines changed: 162 additions & 9 deletions

File tree

ReleaseNotes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## 发布日志
22

3+
### Version 1.4.3 @ 2023.07.28
4+
- iOS: 修复了两个人同时进行屏幕共享,会面重叠问题;
5+
36
### Version 1.4.2 @ 2023.07.24
47
- Android & iOS: 修复了频繁获取用户信息时,偶现Crash;
58
- Android & iOS: 修复了部分场景下,关闭麦克风导致的音频音量回调异常问题;

iOS/Example/DemoApp.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@
865865
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
866866
CODE_SIGN_IDENTITY = "iPhone Developer";
867867
CODE_SIGN_STYLE = Manual;
868-
CURRENT_PROJECT_VERSION = 2;
868+
CURRENT_PROJECT_VERSION = 3;
869869
DEVELOPMENT_TEAM = F8A3GH6Q4W;
870870
ENABLE_BITCODE = NO;
871871
INFOPLIST_FILE = "$(SRCROOT)/App/Info.plist";
@@ -900,7 +900,7 @@
900900
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
901901
CODE_SIGN_IDENTITY = "iPhone Distribution";
902902
CODE_SIGN_STYLE = Manual;
903-
CURRENT_PROJECT_VERSION = 2;
903+
CURRENT_PROJECT_VERSION = 3;
904904
DEVELOPMENT_TEAM = FN2V63AD2J;
905905
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = FN2V63AD2J;
906906
ENABLE_BITCODE = NO;

iOS/Example/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def tool
1212
pod 'Alamofire'
1313
pod 'TUICore'
1414
pod 'TUIChat'
15-
pod 'TUIRoomEngine','1.4.2'
15+
pod 'TUIRoomEngine','1.4.3'
1616
pod 'TXLiteAVSDK_TRTC'
1717
pod 'TXAppBasic'
1818
pod 'TIMCommon'

iOS/TUIBeauty/TUIBeauty.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |spec|
22
spec.name = 'TUIBeauty'
3-
spec.version = '1.4.2'
3+
spec.version = '1.4.3'
44
spec.platform = :ios
55
spec.ios.deployment_target = '9.0'
66
spec.license = { :type => 'MIT', :file => 'LICENSE' }

iOS/TUIRoomKit/Resources/Localized/en.lproj/TUIRoomKitLocalized.strings

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,7 @@
157157
"TUIRoom.device.set" = "Meeting Settings";
158158
"TUIRoom.mic.set" = "Join the conference and turn on the microphone";
159159
"TUIRoom.camera.set" = "Join the conference and turn on the camera";
160+
"TUIRoom.sharing.screen" = "You are sharing your screen";
161+
"TUIRoom.stop.share.screen" = "Stop screen sharing";
162+
"TUIRoom.screen.recording" = "Screen recording";
163+

iOS/TUIRoomKit/Resources/Localized/zh-Hans.lproj/TUIRoomKitLocalized.strings

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,7 @@
155155
"TUIRoom.device.set" = "快速会议设置";
156156
"TUIRoom.mic.set" = "入会开启麦克风";
157157
"TUIRoom.camera.set" = "入会开启摄像头";
158+
"TUIRoom.sharing.screen" = "您正在共享屏幕";
159+
"TUIRoom.stop.share.screen" = "停止共享";
160+
"TUIRoom.screen.recording" = "屏幕录制中";
161+

iOS/TUIRoomKit/Source/Model/EngineEventCenter.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,10 +383,11 @@ extension EngineEventCenter: TUIRoomObserver {
383383
}
384384
}
385385

386-
func onKickedOutOfRoom(roomId: String, message: String) {
386+
func onKickedOutOfRoom(roomId: String, reason: TUIKickedOutOfRoomReason, message: String) {
387387
guard let observers = engineObserverMap[.onKickedOutOfRoom] else { return }
388388
let param = [
389389
"roomId" : roomId,
390+
"reason" : reason,
390391
"message" : message,
391392
] as [String : Any]
392393
observers.forEach { responder in
@@ -499,6 +500,7 @@ extension EngineEventCenter: TUIRoomObserver {
499500
}
500501

501502
func onUserScreenCaptureStopped(reason: Int) {
503+
engineManager.store.isSomeoneSharing = false
502504
guard let observers = engineObserverMap[.onUserScreenCaptureStopped] else { return }
503505
let param = [
504506
"reason" : reason,
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
//
2+
// ScreenCaptureMaskView.swift
3+
// TUIRoomKit
4+
//
5+
// Created by 唐佳宁 on 2023/7/17.
6+
// 开启屏幕共享的蒙层View
7+
//
8+
9+
import Foundation
10+
11+
class ScreenCaptureMaskView: UIView {
12+
let sharingScreenLabel: UILabel = {
13+
let label = UILabel()
14+
label.text = .sharingScreenText
15+
label.textColor = .white
16+
label.textAlignment = .center
17+
label.adjustsFontSizeToFitWidth = true
18+
label.font = UIFont(name: "PingFangSC-Regular", size: 18)
19+
return label
20+
}()
21+
22+
let stopScreenButton: UIButton = {
23+
let button = UIButton(type: .custom)
24+
button.backgroundColor = .red
25+
button.setTitle(.stopShareScreen, for: .normal)
26+
button.setTitleColor(.white, for: .normal)
27+
button.isEnabled = true
28+
button.layer.cornerRadius = 12
29+
return button
30+
}()
31+
32+
let screenRecordingLabel: UILabel = {
33+
let label = UILabel()
34+
label.textColor = .white
35+
label.backgroundColor = .black
36+
label.text = .screenRecordingText
37+
label.numberOfLines = 0
38+
label.textAlignment = .center
39+
label.font = UIFont(name: "PingFangSC-Regular", size: 18)
40+
return label
41+
}()
42+
43+
// MARK: - view layout
44+
private var isViewReady: Bool = false
45+
override func didMoveToWindow() {
46+
super.didMoveToWindow()
47+
guard !isViewReady else { return }
48+
backgroundColor = UIColor(0x1B1E26)
49+
constructViewHierarchy()
50+
activateConstraints()
51+
bindInteraction()
52+
isViewReady = true
53+
}
54+
55+
private func constructViewHierarchy() {
56+
addSubview(sharingScreenLabel)
57+
addSubview(stopScreenButton)
58+
addSubview(screenRecordingLabel)
59+
}
60+
61+
private func activateConstraints() {
62+
sharingScreenLabel.snp.makeConstraints { make in
63+
make.centerX.equalToSuperview()
64+
make.centerY.equalToSuperview().offset(-40)
65+
}
66+
stopScreenButton.snp.makeConstraints { make in
67+
make.centerX.equalToSuperview()
68+
make.height.equalTo(50)
69+
make.width.equalTo(100)
70+
make.centerY.equalToSuperview().offset(40)
71+
}
72+
screenRecordingLabel.snp.makeConstraints { make in
73+
make.top.equalTo(sharingScreenLabel)
74+
make.right.equalTo(safeAreaLayoutGuide.snp.right)
75+
make.width.equalTo(30)
76+
make.height.equalTo(150)
77+
}
78+
}
79+
80+
private func bindInteraction() {
81+
stopScreenButton.addTarget(self, action: #selector(stopScreenCaptureAction(sender:)), for: .touchUpInside)
82+
}
83+
84+
@objc func stopScreenCaptureAction(sender: UIButton) {
85+
EngineManager.shared.roomEngine.stopScreenCapture()
86+
}
87+
88+
class func show() {
89+
let frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height)
90+
let currentWindow = RoomRouter.getCurrentWindow()
91+
currentWindow?.addSubview(ScreenCaptureMaskView(frame: frame))
92+
}
93+
94+
class func dismiss() {
95+
guard let currentWindow = RoomRouter.getCurrentWindow() else { return }
96+
for view in currentWindow.subviews where view is ScreenCaptureMaskView {
97+
view.removeFromSuperview()
98+
}
99+
}
100+
}
101+
102+
private extension String {
103+
static var sharingScreenText: String {
104+
localized("TUIRoom.sharing.screen")
105+
}
106+
static var stopShareScreen: String {
107+
localized("TUIRoom.stop.share.screen")
108+
}
109+
static var screenRecordingText: String {
110+
localized("TUIRoom.screen.recording")
111+
}
112+
}

iOS/TUIRoomKit/Source/View/RoomRouter.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,16 @@ class RoomRouter {
161161
shared.getCurrentWindowViewController()?.view.makeToast(toast)
162162
}
163163

164+
class func getCurrentWindow() -> UIWindow? {
165+
if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene {
166+
if let keyWindow = windowScene.windows.first {
167+
return keyWindow
168+
}
169+
}
170+
return UIApplication.shared.windows.first(where: { $0.windowLevel == .normal && $0.isHidden == false &&
171+
CGRectEqualToRect($0.bounds , UIScreen.main.bounds )})
172+
}
173+
164174
deinit {
165175
debugPrint("deinit \(self)")
166176
}

iOS/TUIRoomKit/Source/View/ViewModel/RoomMainViewModel.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ class RoomMainViewModel: NSObject {
9797
EngineEventCenter.shared.subscribeEngine(event: .onRequestCancelled, observer: self)
9898
EngineEventCenter.shared.subscribeEngine(event: .onUserRoleChanged, observer: self)
9999
EngineEventCenter.shared.subscribeEngine(event: .onSendMessageForUserDisableChanged, observer: self)
100+
EngineEventCenter.shared.subscribeEngine(event: .onUserVideoStateChanged, observer: self)
101+
EngineEventCenter.shared.subscribeEngine(event: .onUserScreenCaptureStopped, observer: self)
100102
EngineEventCenter.shared.subscribeUIEvent(key: .TUIRoomKitService_ShowBeautyView, responder: self)
101103
}
102104

@@ -107,6 +109,8 @@ class RoomMainViewModel: NSObject {
107109
EngineEventCenter.shared.unsubscribeEngine(event: .onRequestCancelled, observer: self)
108110
EngineEventCenter.shared.unsubscribeEngine(event: .onUserRoleChanged, observer: self)
109111
EngineEventCenter.shared.unsubscribeEngine(event: .onSendMessageForUserDisableChanged, observer: self)
112+
EngineEventCenter.shared.unsubscribeEngine(event: .onUserVideoStateChanged, observer: self)
113+
EngineEventCenter.shared.unsubscribeEngine(event: .onUserScreenCaptureStopped, observer: self)
110114
EngineEventCenter.shared.unsubscribeUIEvent(key: .TUIRoomKitService_ShowBeautyView, responder: self)
111115
}
112116
private func setVideoEncoderParam() {
@@ -359,6 +363,17 @@ extension RoomMainViewModel: RoomEngineEventResponder {
359363
viewResponder?.showSelfBecomeRoomOwnerAlert()
360364
}
361365
}
366+
if name == .onUserVideoStateChanged {
367+
guard let userId = param?["userId"] as? String else { return }
368+
guard let streamType = param?["streamType"] as? TUIVideoStreamType else { return }
369+
guard let hasVideo = param?["hasVideo"] as? Bool else { return }
370+
if userId == currentUser.userId, streamType == .screenStream, hasVideo {
371+
ScreenCaptureMaskView.show()
372+
}
373+
}
374+
if name == .onUserScreenCaptureStopped {
375+
ScreenCaptureMaskView.dismiss()
376+
}
362377
}
363378
}
364379

0 commit comments

Comments
 (0)