Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
galaxy-iOS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile-group
galaxy-iOS
Commits
3eda72be
Commit
3eda72be
authored
Jan 14, 2025
by
Alex朱枝文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化新消息到来的隐藏效果、优化从后台回来IM状态断开
parent
5f72409f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
6 deletions
+36
-6
YHLivePlayerViewController.swift
.../LivestreamSales(直播销售)/C/YHLivePlayerViewController.swift
+12
-1
YHLiveMessageListView.swift
...dules/LivestreamSales(直播销售)/V/YHLiveMessageListView.swift
+24
-5
No files found.
galaxy/galaxy/Classes/Modules/LivestreamSales(直播销售)/C/YHLivePlayerViewController.swift
View file @
3eda72be
...
...
@@ -904,6 +904,9 @@ extension YHLivePlayerViewController {
@objc
private
func
handleAppWillEnterForeground
()
{
if
YHLoginManager
.
shared
.
isLogin
()
{
joinLiveRoom
(
id
:
liveId
,
callback
:
{
_
,
_
in
})
if
let
roomId
=
roomId
{
setupChatRoom
(
roomId
:
roomId
)
}
}
}
/*
...
...
@@ -976,7 +979,9 @@ extension YHLivePlayerViewController {
if
#available(iOS 16.0, *)
{
windowScene
.
requestGeometryUpdate
(
.
iOS
(
interfaceOrientations
:
orientationMask
))
}
else
{
// let orientation: UIInterfaceOrientation = orientationMask == .portrait ? .portrait : .landscapeRight
// UIDevice.current.setValue(orientation.rawValue, forKey: "orientation")
// UIViewController.attemptRotationToDeviceOrientation()
}
}
...
...
@@ -987,6 +992,9 @@ extension YHLivePlayerViewController {
if
#available(iOS 16.0, *)
{
windowScene
.
requestGeometryUpdate
(
.
iOS
(
interfaceOrientations
:
orientationMask
))
}
else
{
// let orientation: UIInterfaceOrientation = .portrait
// UIDevice.current.setValue(orientation.rawValue, forKey: "orientation")
// UIViewController.attemptRotationToDeviceOrientation()
}
bottomInputBar
.
isHidden
=
false
messageListView
.
isHidden
=
false
...
...
@@ -1002,6 +1010,9 @@ extension YHLivePlayerViewController {
if
#available(iOS 16.0, *)
{
windowScene
.
requestGeometryUpdate
(
.
iOS
(
interfaceOrientations
:
orientationMask
))
}
else
{
// let orientation: UIInterfaceOrientation = .landscapeRight
// UIDevice.current.setValue(orientation.rawValue, forKey: "orientation")
// UIViewController.attemptRotationToDeviceOrientation()
}
bottomInputBar
.
isHidden
=
true
messageListView
.
isHidden
=
true
...
...
galaxy/galaxy/Classes/Modules/LivestreamSales(直播销售)/V/YHLiveMessageListView.swift
View file @
3eda72be
...
...
@@ -47,6 +47,9 @@ class YHLiveMessageListView: UIView {
make
.
top
.
equalToSuperview
()
make
.
left
.
bottom
.
right
.
equalToSuperview
()
}
// 添加 KVO
tableView
.
addObserver
(
self
,
forKeyPath
:
"contentSize"
,
options
:
.
new
,
context
:
nil
)
}
// MARK: - Public Methods
...
...
@@ -63,12 +66,20 @@ class YHLiveMessageListView: UIView {
messages
.
removeAll
()
tableView
.
reloadData
()
}
}
// MARK: - UITableViewDelegate & UITableViewDataSource
deinit
{
// 移除 KVO
tableView
.
removeObserver
(
self
,
forKeyPath
:
"contentSize"
)
}
extension
YHLiveMessageListView
:
UITableViewDelegate
,
UITableViewDataSource
{
func
scrollViewDidScroll
(
_
scrollView
:
UIScrollView
)
{
override
func
observeValue
(
forKeyPath
keyPath
:
String
?,
of
object
:
Any
?,
change
:
[
NSKeyValueChangeKey
:
Any
]?,
context
:
UnsafeMutableRawPointer
?)
{
if
keyPath
==
"contentSize"
{
fadeCells
()
}
}
private
func
fadeCells
()
{
// 内容大小变化
let
fadeRange
:
CGFloat
=
50
tableView
.
visibleCells
.
forEach
{
cell
in
...
...
@@ -76,7 +87,7 @@ extension YHLiveMessageListView: UITableViewDelegate, UITableViewDataSource {
let
cellRect
=
tableView
.
rectForRow
(
at
:
indexPath
)
// 因为视图是倒置的,所以我们需要用 tableView 的高度来计算正确的位置
let
cellPositionFromBottom
=
tableView
.
bounds
.
height
-
(
cellRect
.
origin
.
y
-
scroll
View
.
contentOffset
.
y
)
-
cellRect
.
height
let
cellPositionFromBottom
=
tableView
.
bounds
.
height
-
(
cellRect
.
origin
.
y
-
table
View
.
contentOffset
.
y
)
-
cellRect
.
height
if
cellPositionFromBottom
>=
0
&&
cellPositionFromBottom
<=
fadeRange
{
let
progress
=
cellPositionFromBottom
/
fadeRange
...
...
@@ -88,6 +99,14 @@ extension YHLiveMessageListView: UITableViewDelegate, UITableViewDataSource {
}
}
}
}
// MARK: - UITableViewDelegate & UITableViewDataSource
extension
YHLiveMessageListView
:
UITableViewDelegate
,
UITableViewDataSource
{
func
scrollViewDidScroll
(
_
scrollView
:
UIScrollView
)
{
fadeCells
()
}
func
tableView
(
_
tableView
:
UITableView
,
heightForRowAt
indexPath
:
IndexPath
)
->
CGFloat
{
return
UITableView
.
automaticDimension
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment