Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
P
PhoneManager
Project
Project
Details
Activity
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yang
PhoneManager
Commits
c41d849d
Commit
c41d849d
authored
Apr 14, 2025
by
CZ1004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页优化
parent
321e2eec
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
774 additions
and
284 deletions
+774
-284
AppDelegate.swift
PhoneManager/AppDelegate.swift
+262
-1
CompressCompletedViewController.swift
...Compress/Controller/CompressCompletedViewController.swift
+2
-0
HomeInfoViewController.swift
...lass/Session/Home/Controller/HomeInfoViewController.swift
+4
-0
HomePhotosDetailViewController.swift
...sion/Home/Controller/HomePhotosDetailViewController.swift
+2
-0
HomeVideoDetailController.swift
...s/Session/Home/Controller/HomeVideoDetailController.swift
+1
-0
HomeViewController.swift
...er/Class/Session/Home/Controller/HomeViewController.swift
+167
-2
HomeView.swift
PhoneManager/Class/Session/Home/View/HomeView.swift
+10
-1
HomePhotosModel .swift
...ager/Class/Session/Home/View/Model/HomePhotosModel .swift
+226
-139
HomeOtherCollectionCell.swift
...lass/Session/Home/View/cell/HomeOtherCollectionCell.swift
+1
-1
HomeTitleCollectionCell.swift
...lass/Session/Home/View/cell/HomeTitleCollectionCell.swift
+2
-2
PMShowImgVideoController.swift
...nager/Class/Session/Secret/PMShowImgVideoController.swift
+1
-1
PhotoAndVideoMananger.swift
...l/Class/PhotoAndVideoMananger/PhotoAndVideoMananger.swift
+96
-137
No files found.
PhoneManager/AppDelegate.swift
View file @
c41d849d
This diff is collapsed.
Click to expand it.
PhoneManager/Class/Session/Compress/Controller/CompressCompletedViewController.swift
View file @
c41d849d
...
...
@@ -305,6 +305,8 @@ class CompressCompletedViewController : BaseViewController{
}){
success
,
error
in
if
(
success
){
self
.
updateCompressData
(
flag
:
data
.
ident
)
var
deleteModel
=
AssetModel
(
localIdentifier
:
data
.
ident
,
assetSize
:
data
.
orgSize
,
createDate
:
data
.
createDate
)
PhotoDataManager
.
manager
.
removeDataWhenDeleteInPage
(
data
:
[
deleteModel
])
print
(
"删除文件成功"
)
}
else
{
if
let
error
=
error
{
...
...
PhoneManager/Class/Session/Home/Controller/HomeInfoViewController.swift
View file @
c41d849d
...
...
@@ -67,6 +67,10 @@ class HomeInfoViewController:BaseViewController {
}
}
}
// 删除缓存数据
PhotoDataManager
.
manager
.
removeDataWhenDeleteInPage
(
data
:
array
as!
[
AssetModel
])
if
HomePayModel
.
share
.
isNoAd
==
false
{
if
self
.
type
==
.
duplicates
{
// 重复
HomePayViewController
.
show
{
...
...
PhoneManager/Class/Session/Home/Controller/HomePhotosDetailViewController.swift
View file @
c41d849d
...
...
@@ -357,8 +357,10 @@ extension HomePhotosDetailViewController:WaterfallMutiSectionDelegate,UICollecti
print
(
"删除文件成功"
)
// 移除当前总数据源的数据
for
item
in
self
.
selectedModel
{
// 移除当前数据
self
.
resourceData
.
removeAll
{
$0
.
localIdentifier
==
item
.
localIdentifier
}
}
PhotoDataManager
.
manager
.
removeDataWhenDeleteInPage
(
data
:
self
.
selectedModel
)
}
else
{
if
let
error
=
error
{
print
(
"删除文件时出错:
\(
error
.
localizedDescription
)
"
)
...
...
PhoneManager/Class/Session/Home/Controller/HomeVideoDetailController.swift
View file @
c41d849d
...
...
@@ -332,6 +332,7 @@ extension HomeVideoDetailController:WaterfallMutiSectionDelegate,UICollectionVie
for
item
in
self
.
selectedModel
{
self
.
resourceData
.
removeAll
{
$0
.
localIdentifier
==
item
.
localIdentifier
}
}
PhotoDataManager
.
manager
.
removeDataWhenDeleteInPage
(
data
:
self
.
selectedModel
)
}
else
{
if
let
error
=
error
{
print
(
"删除文件时出错:
\(
error
.
localizedDescription
)
"
)
...
...
PhoneManager/Class/Session/Home/Controller/HomeViewController.swift
View file @
c41d849d
...
...
@@ -18,9 +18,40 @@ class HomeViewController:BaseViewController {
super
.
viewDidLoad
()
let
dataUpdated
=
Notification
.
Name
(
"DataUpdatedNotification"
)
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
handleDataUpdated(_:)
)
,
name
:
dataUpdated
,
object
:
nil
)
// 视频
let
homeVideoResourceUpdate
=
Notification
.
Name
(
"HomeVideoResourceUpdate"
)
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
handleHomeVideoResourceUpdate(_:)
)
,
name
:
homeVideoResourceUpdate
,
object
:
nil
)
// 相似视频
let
homeSimilarVideoResourceUpdate
=
Notification
.
Name
(
"HomeSimilarVideoResourceUpdate"
)
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
handleHomeSimilarVideoResourceUpdate(_:)
)
,
name
:
homeSimilarVideoResourceUpdate
,
object
:
nil
)
// 相似截图
let
homeSimilarScreenshotResourceUpdate
=
Notification
.
Name
(
"HomeSimilarScreenshotResourceUpdate"
)
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
handleHomeSimilarScreenshotResourceUpdate(_:)
)
,
name
:
homeSimilarScreenshotResourceUpdate
,
object
:
nil
)
// 屏幕截图
let
homeScreenShotResourceUpdate
=
Notification
.
Name
(
"HomeScreenShotResourceUpdate"
)
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
handleHomeScreenShotResourceUpdate(_:)
)
,
name
:
homeScreenShotResourceUpdate
,
object
:
nil
)
// 其他
let
homeOtherResourceUpdate
=
Notification
.
Name
(
"HomeOtherResourceUpdate"
)
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
handleHomeOtherResourceUpdate(_:)
)
,
name
:
homeOtherResourceUpdate
,
object
:
nil
)
// 重复图片
let
homeDupImageResourceUpdate
=
Notification
.
Name
(
"HomeDupImageResourceUpdate"
)
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
handleHomeDupImageResourceUpdate(_:)
)
,
name
:
homeDupImageResourceUpdate
,
object
:
nil
)
// 相似图片
let
homeSimilarImageResourceUpdate
=
Notification
.
Name
(
"HomeSimilarImageResourceUpdate"
)
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
handleHomeSimilarImageResourceUpdate(_:)
)
,
name
:
homeSimilarImageResourceUpdate
,
object
:
nil
)
view
.
backgroundColor
=
.
green
homeView
=
HomeView
(
frame
:
view
.
bounds
)
...
...
@@ -120,12 +151,16 @@ class HomeViewController:BaseViewController {
}
func
setupData
()
{
// 详情数据
PhotoDataManager
.
manager
.
loadFromFileSystem
(
resultModel
:
{[
weak
self
]
model
in
self
?
.
homeView
?
.
model
=
model
DispatchQueue
.
main
.
async
{
self
?
.
homeView
?
.
model
=
model
self
?
.
homeView
?
.
collectionView
.
reloadData
()
}
})
...
...
@@ -149,6 +184,18 @@ class HomeViewController:BaseViewController {
}
override
func
viewWillAppear
(
_
animated
:
Bool
)
{
super
.
viewWillAppear
(
animated
)
// 可能是删除数据,重新获取下
PhotoDataManager
.
manager
.
loadFromFileSystem
(
resultModel
:
{[
weak
self
]
model
in
DispatchQueue
.
main
.
async
{
self
?
.
homeView
?
.
model
=
model
self
?
.
homeView
?
.
collectionView
.
reloadData
()
}
})
}
override
func
viewDidAppear
(
_
animated
:
Bool
)
{
super
.
viewDidAppear
(
animated
)
...
...
@@ -183,8 +230,126 @@ class HomeViewController:BaseViewController {
}
}
// 重复图片
@objc
func
handleHomeDupImageResourceUpdate
(
_
notification
:
Notification
)
{
PhotoDataManager
.
manager
.
loadFromFileSystem
{[
weak
self
]
model
in
guard
let
self
else
{
return
}
let
count
=
self
.
homeView
?
.
model
?
.
titleModelArray
[
0
]
.
assets
.
count
self
.
homeView
?
.
model
=
model
DispatchQueue
.
main
.
async
{
if
self
.
homeView
?
.
dupHeadCell
!=
nil
&&
count
==
0
&&
model
.
titleModelArray
[
0
]
.
assets
.
count
!=
0
{
self
.
homeView
?
.
collectionView
.
reloadItems
(
at
:
[
IndexPath
(
row
:
0
,
section
:
0
)])
}
let
tempCell
=
self
.
homeView
?
.
collectionView
.
cellForItem
(
at
:
IndexPath
(
row
:
0
,
section
:
0
))
if
let
homeTitleCell
=
tempCell
as?
HomeTitleCollectionCell
{
var
tempCount
:
Int
=
0
for
item
in
model
.
titleModelArray
[
0
]
.
assets
{
tempCount
=
tempCount
+
item
.
count
}
homeTitleCell
.
fileLabel
?
.
text
=
"
\(
tempCount
)
"
+
" Photos "
+
(
model
.
titleModelArray
[
0
]
.
allFileSize
>
0
?
"(
\(
formatFileSize
(
model
.
titleModelArray
[
0
]
.
allFileSize
)
)
)"
:
"(Calculating...)"
)
}
}
}
}
@objc
func
handleHomeSimilarImageResourceUpdate
(
_
notification
:
Notification
)
{
PhotoDataManager
.
manager
.
loadFromFileSystem
{[
weak
self
]
model
in
guard
let
self
else
{
return
}
let
count
=
self
.
homeView
?
.
model
?
.
titleModelArray
[
1
]
.
assets
.
count
self
.
homeView
?
.
model
=
model
DispatchQueue
.
main
.
async
{
if
self
.
homeView
?
.
similarHeadCell
!=
nil
&&
count
==
0
&&
model
.
titleModelArray
[
1
]
.
assets
.
count
!=
0
{
self
.
homeView
?
.
collectionView
.
reloadItems
(
at
:
[
IndexPath
(
row
:
1
,
section
:
0
)])
}
let
tempCell
=
self
.
homeView
?
.
collectionView
.
cellForItem
(
at
:
IndexPath
(
row
:
1
,
section
:
0
))
if
let
homeTitleCell
=
tempCell
as?
HomeTitleCollectionCell
{
var
tempCount
:
Int
=
0
for
item
in
model
.
titleModelArray
[
1
]
.
assets
{
tempCount
=
tempCount
+
item
.
count
}
homeTitleCell
.
fileLabel
?
.
text
=
"
\(
tempCount
)
"
+
" Photos "
+
(
model
.
titleModelArray
[
1
]
.
allFileSize
>
0
?
"(
\(
formatFileSize
(
model
.
titleModelArray
[
1
]
.
allFileSize
)
)
)"
:
"(Calculating...)"
)
}
}
}
}
@objc
func
handleHomeVideoResourceUpdate
(
_
notification
:
Notification
)
{
PhotoDataManager
.
manager
.
loadFromFileSystem
{[
weak
self
]
model
in
guard
let
self
else
{
return
}
let
count
=
self
.
homeView
?
.
model
?
.
otherModelArray
[
0
]
.
assets
.
count
self
.
homeView
?
.
model
=
model
DispatchQueue
.
main
.
async
{
if
count
==
0
{
self
.
homeView
?
.
collectionView
.
reloadItems
(
at
:
[
IndexPath
(
row
:
0
,
section
:
1
)])
}
}
}
}
@objc
func
handleHomeSimilarScreenshotResourceUpdate
(
_
notification
:
Notification
)
{
PhotoDataManager
.
manager
.
loadFromFileSystem
{[
weak
self
]
model
in
guard
let
self
else
{
return
}
let
count
=
self
.
homeView
?
.
model
?
.
otherModelArray
[
1
]
.
assets
.
count
self
.
homeView
?
.
model
=
model
DispatchQueue
.
main
.
async
{
if
count
==
0
&&
model
.
otherModelArray
[
1
]
.
assets
.
count
!=
0
{
self
.
homeView
?
.
collectionView
.
reloadItems
(
at
:
[
IndexPath
(
row
:
1
,
section
:
1
)])
}
let
tempCell
=
self
.
homeView
?
.
collectionView
.
cellForItem
(
at
:
IndexPath
(
row
:
1
,
section
:
1
))
if
let
otherCell
=
tempCell
as?
HomeOtherCollectionCell
{
var
tempCount
:
Int
=
0
for
item
in
model
.
otherModelArray
[
1
]
.
assets
{
tempCount
=
tempCount
+
item
.
count
}
otherCell
.
countLabel
.
text
=
"
\(
tempCount
)
Photos"
}
}
}
}
@objc
func
handleHomeScreenShotResourceUpdate
(
_
notification
:
Notification
)
{
PhotoDataManager
.
manager
.
loadFromFileSystem
{[
weak
self
]
model
in
guard
let
self
else
{
return
}
let
count
=
self
.
homeView
?
.
model
?
.
otherModelArray
[
2
]
.
assets
.
count
self
.
homeView
?
.
model
=
model
DispatchQueue
.
main
.
async
{
if
count
==
0
{
self
.
homeView
?
.
collectionView
.
reloadItems
(
at
:
[
IndexPath
(
row
:
2
,
section
:
1
)])
}
}
}
}
@objc
func
handleHomeSimilarVideoResourceUpdate
(
_
notification
:
Notification
)
{
PhotoDataManager
.
manager
.
loadFromFileSystem
{[
weak
self
]
model
in
guard
let
self
else
{
return
}
let
count
=
self
.
homeView
?
.
model
?
.
otherModelArray
[
3
]
.
assets
.
count
self
.
homeView
?
.
model
=
model
DispatchQueue
.
main
.
async
{
if
count
==
0
{
self
.
homeView
?
.
collectionView
.
reloadItems
(
at
:
[
IndexPath
(
row
:
3
,
section
:
1
)])
}
}
}
}
@objc
func
handleHomeOtherResourceUpdate
(
_
notification
:
Notification
)
{
PhotoDataManager
.
manager
.
loadFromFileSystem
{[
weak
self
]
model
in
guard
let
self
else
{
return
}
let
count
=
self
.
homeView
?
.
model
?
.
otherModelArray
[
4
]
.
assets
.
count
self
.
homeView
?
.
model
=
model
DispatchQueue
.
main
.
async
{
if
count
==
0
{
self
.
homeView
?
.
collectionView
.
reloadItems
(
at
:
[
IndexPath
(
row
:
4
,
section
:
1
)])
}
}
}
}
@objc
func
handleDataUpdated
(
_
notification
:
Notification
)
{
...
...
PhoneManager/Class/Session/Home/View/HomeView.swift
View file @
c41d849d
...
...
@@ -16,6 +16,10 @@ class HomeView:UIView {
private
var
bottomView
:
UIView
?
var
dupHeadCell
:
HomeTitleCollectionCell
?
var
similarHeadCell
:
HomeTitleCollectionCell
?
var
titleCallBack
:(
HomePhotosModel
,
PhotsFileType
)
->
Void
=
{
model
,
type
in
}
var
indexCallBack
:
callBack
<
Any
>
=
{
index
in
}
...
...
@@ -32,7 +36,7 @@ class HomeView:UIView {
guard
let
self
else
{
return
}
self
.
collectionView
.
reloadData
()
//
self.collectionView.reloadData()
}
}
}
...
...
@@ -235,6 +239,11 @@ extension HomeView:WaterfallMutiSectionDelegate,UICollectionViewDataSource,UICol
case
0
:
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
HomeTitleCollectionCell
.
identifiers
,
for
:
indexPath
)
as!
HomeTitleCollectionCell
cell
.
model
=
model
?
.
titleModelArray
[
indexPath
.
row
]
if
indexPath
.
row
==
0
{
self
.
dupHeadCell
=
cell
}
else
{
self
.
similarHeadCell
=
cell
}
return
cell
case
1
:
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
HomeOtherCollectionCell
.
identifier
,
for
:
indexPath
)
as!
HomeOtherCollectionCell
...
...
PhoneManager/Class/Session/Home/View/Model/HomePhotosModel .swift
View file @
c41d849d
This diff is collapsed.
Click to expand it.
PhoneManager/Class/Session/Home/View/cell/HomeOtherCollectionCell.swift
View file @
c41d849d
...
...
@@ -31,7 +31,7 @@ class HomeOtherCollectionCell: UICollectionViewCell {
}()
let
countLabel
:
UILabel
=
{
public
var
countLabel
:
UILabel
=
{
let
label
=
UILabel
()
label
.
textColor
=
.
white
label
.
font
=
.
systemFont
(
ofSize
:
10
,
weight
:
.
medium
)
...
...
PhoneManager/Class/Session/Home/View/cell/HomeTitleCollectionCell.swift
View file @
c41d849d
...
...
@@ -14,9 +14,9 @@ class HomeTitleCollectionCell:UICollectionViewCell {
private
var
titleLabel
:
UILabel
?
p
rivate
var
fileLabel
:
UILabel
?
p
ublic
var
fileLabel
:
UILabel
?
p
rivate
var
collectionView
:
UICollectionView
?
p
ublic
var
collectionView
:
UICollectionView
?
private
var
nextImage
:
UIImageView
?
...
...
PhoneManager/Class/Session/Secret/PMShowImgVideoController.swift
View file @
c41d849d
...
...
@@ -173,7 +173,7 @@ extension PMShowImgVideoController : UICollectionViewDelegate,UICollectionViewDa
return
cell
}
else
{
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
PMShowItemCellID
,
for
:
indexPath
)
as!
PMShowItemCell
cell
.
icon
=
self
.
homeDataSource
!
[
indexPath
.
row
]
.
image
!
cell
.
icon
=
self
.
homeDataSource
!
[
indexPath
.
row
]
.
image
cell
.
isCurrent
=
(
self
.
currentIdx
==
indexPath
.
row
)
return
cell
}
...
...
PhoneManager/Class/Tool/Class/PhotoAndVideoMananger/PhotoAndVideoMananger.swift
View file @
c41d849d
This diff is collapsed.
Click to expand it.
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