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
e3c81dec
Commit
e3c81dec
authored
May 13, 2025
by
CZ1004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【新增】垃圾桶功能
parent
07f47302
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
636 additions
and
31 deletions
+636
-31
AppDelegate.swift
PhoneManager/AppDelegate.swift
+20
-0
Contents.json
...nager/Assets.xcassets/Home/Frame 2.imageset/Contents.json
+23
-0
Frame.png
PhoneManager/Assets.xcassets/Home/Frame 2.imageset/Frame.png
+0
-0
Frame@2x.png
...anager/Assets.xcassets/Home/Frame 2.imageset/Frame@2x.png
+0
-0
Frame@3x.png
...anager/Assets.xcassets/Home/Frame 2.imageset/Frame@3x.png
+0
-0
Contents.json
...ets.xcassets/Home/Group_1171275102.imageset/Contents.json
+23
-0
Group_1171275102.png
...ssets/Home/Group_1171275102.imageset/Group_1171275102.png
+0
-0
Group_1171275102@2x.png
...ts/Home/Group_1171275102.imageset/Group_1171275102@2x.png
+0
-0
Group_1171275102@3x.png
...ts/Home/Group_1171275102.imageset/Group_1171275102@3x.png
+0
-0
HomePhotosDetailViewController.swift
...Page/Home/Controller/HomePhotosDetailViewController.swift
+7
-21
PhotoRemoveViewController.swift
...lass/Page/Home/Controller/PhotoRemoveViewController.swift
+327
-0
PhotoSlideViewController.swift
...Class/Page/Home/Controller/PhotoSlideViewController.swift
+4
-3
AnchorRotatableView.swift
PhoneManager/Class/Page/Home/View/AnchorRotatableView.swift
+0
-7
PhotoRemoveNavView.swift
PhoneManager/Class/Page/Home/View/PhotoRemoveNavView.swift
+76
-0
PhotosRemoveBaseView.swift
PhoneManager/Class/Page/Home/View/PhotosRemoveBaseView.swift
+85
-0
TrashSubView.swift
PhoneManager/Class/Page/Home/View/TrashSubView.swift
+69
-0
Singleton.swift
PhoneManager/Class/Tool/Singleton/Singleton.swift
+2
-0
No files found.
PhoneManager/AppDelegate.swift
View file @
e3c81dec
...
@@ -51,6 +51,26 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
...
@@ -51,6 +51,26 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
return
true
return
true
}
}
func
applicationWillTerminate
(
_
application
:
UIApplication
)
{
// 保存单利中所有垃圾桶的数据
saveDataToTrashDB
()
}
func
saveDataToTrashDB
(){
let
data
=
Singleton
.
shared
.
trashData
var
count
=
0
for
(
key
,
value
)
in
data
{
for
item
in
value
{
let
success
=
TrashDatabase
.
shared
.
insert
(
localIdentifier
:
item
.
localIdentifier
,
assetSize
:
item
.
assetSize
,
createDate
:
item
.
createDate
,
mediaType
:
key
.
dbType
)
if
success
{
count
=
count
+
1
}
}
}
Singleton
.
shared
.
trashData
=
[:]
Print
(
"保留单利数据到数据库--
\(
count
)
条"
)
}
func
applicationDidBecomeActive
(
_
application
:
UIApplication
)
{
func
applicationDidBecomeActive
(
_
application
:
UIApplication
)
{
NotificationCenter
.
default
.
post
(
name
:
Notification
.
Name
(
"applicationDidBecomeActive"
),
object
:
nil
)
NotificationCenter
.
default
.
post
(
name
:
Notification
.
Name
(
"applicationDidBecomeActive"
),
object
:
nil
)
...
...
PhoneManager/Assets.xcassets/Home/Frame 2.imageset/Contents.json
0 → 100644
View file @
e3c81dec
{
"images"
:
[
{
"filename"
:
"Frame.png"
,
"idiom"
:
"universal"
,
"scale"
:
"1x"
},
{
"filename"
:
"Frame@2x.png"
,
"idiom"
:
"universal"
,
"scale"
:
"2x"
},
{
"filename"
:
"Frame@3x.png"
,
"idiom"
:
"universal"
,
"scale"
:
"3x"
}
],
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
PhoneManager/Assets.xcassets/Home/Frame 2.imageset/Frame.png
0 → 100644
View file @
e3c81dec
3.42 KB
PhoneManager/Assets.xcassets/Home/Frame 2.imageset/Frame@2x.png
0 → 100644
View file @
e3c81dec
10.2 KB
PhoneManager/Assets.xcassets/Home/Frame 2.imageset/Frame@3x.png
0 → 100644
View file @
e3c81dec
19.8 KB
PhoneManager/Assets.xcassets/Home/Group_1171275102.imageset/Contents.json
0 → 100644
View file @
e3c81dec
{
"images"
:
[
{
"filename"
:
"Group_1171275102.png"
,
"idiom"
:
"universal"
,
"scale"
:
"1x"
},
{
"filename"
:
"Group_1171275102@2x.png"
,
"idiom"
:
"universal"
,
"scale"
:
"2x"
},
{
"filename"
:
"Group_1171275102@3x.png"
,
"idiom"
:
"universal"
,
"scale"
:
"3x"
}
],
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
PhoneManager/Assets.xcassets/Home/Group_1171275102.imageset/Group_1171275102.png
0 → 100644
View file @
e3c81dec
3.91 KB
PhoneManager/Assets.xcassets/Home/Group_1171275102.imageset/Group_1171275102@2x.png
0 → 100644
View file @
e3c81dec
11.8 KB
PhoneManager/Assets.xcassets/Home/Group_1171275102.imageset/Group_1171275102@3x.png
0 → 100644
View file @
e3c81dec
23.4 KB
PhoneManager/Class/Page/Home/Controller/HomePhotosDetailViewController.swift
View file @
e3c81dec
...
@@ -308,29 +308,15 @@ extension HomePhotosDetailViewController:WaterfallMutiSectionDelegate,UICollecti
...
@@ -308,29 +308,15 @@ extension HomePhotosDetailViewController:WaterfallMutiSectionDelegate,UICollecti
cell
.
cellCallBack
=
{[
weak
self
]
ident
,
order
in
cell
.
cellCallBack
=
{[
weak
self
]
ident
,
order
in
guard
let
self
else
{
return
}
guard
let
self
else
{
return
}
DispatchQueue
.
main
.
async
{
DispatchQueue
.
main
.
async
{
// 点击之后跳转详情页面
// 点击之后跳转详情页面
let
vc
=
PMShowImgVideoController
()
if
self
.
mediaType
==
.
screenshots
{
vc
.
state
=
.
similarPhotos
let
vc
=
PhotoRemoveViewController
(
data
:
self
.
resourceData
,
currentIndex
:
indexPath
.
row
,
mediaType
:
.
shot
)
vc
.
currentIdx
=
0
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
vc
.
oldPageIndexPath
=
indexPath
let
dataSource
=
ImageSeletedCollectionItem
()
dataSource
.
isSeleted
=
cell
.
choose
dataSource
.
id
=
ident
// 获取image
dataSource
.
image
=
PhotoAndVideoMananger
.
mananger
.
getImageFromAssetID
(
id
:
ident
.
localIdentifier
)
vc
.
homeDataSource
=
[
dataSource
]
vc
.
backOrgPageCallBack
=
{[
weak
self
]
index
,
data
in
guard
let
self
else
{
return
}
if
let
data
=
data
{
if
let
item
=
data
.
first
{
cell
.
choose
=
item
.
isSeleted
??
false
}
}
}
}
if
self
.
mediaType
==
.
Other
{
let
vc
=
PhotoRemoveViewController
(
data
:
self
.
resourceData
,
currentIndex
:
indexPath
.
row
,
mediaType
:
.
other
)
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
}
}
}
}
cell
.
clickCallBack
=
{[
weak
self
]
click
,
order
in
cell
.
clickCallBack
=
{[
weak
self
]
click
,
order
in
...
...
PhoneManager/Class/Page/Home/Controller/PhotoRemoveViewController.swift
0 → 100644
View file @
e3c81dec
This diff is collapsed.
Click to expand it.
PhoneManager/Class/Page/Home/Controller/PhotoSlideViewController.swift
View file @
e3c81dec
...
@@ -21,13 +21,13 @@ class PhotoSlideViewController: BaseViewController {
...
@@ -21,13 +21,13 @@ class PhotoSlideViewController: BaseViewController {
private
lazy
var
topView
:
AnchorRotatableView
=
{
private
lazy
var
topView
:
AnchorRotatableView
=
{
let
view
=
AnchorRotatableView
()
let
view
=
AnchorRotatableView
()
view
.
configure
(
anchorPoint
:
CGPoint
(
x
:
0.5
,
y
:
0.5
))
return
view
return
view
}()
}()
private
lazy
var
bottomView
:
AnchorRotatableView
=
{
private
lazy
var
bottomView
:
AnchorRotatableView
=
{
let
view
=
AnchorRotatableView
()
let
view
=
AnchorRotatableView
()
view
.
configure
(
anchorPoint
:
CGPoint
(
x
:
0.5
,
y
:
0.5
))
return
view
return
view
}()
}()
...
@@ -119,7 +119,8 @@ class PhotoSlideViewController: BaseViewController {
...
@@ -119,7 +119,8 @@ class PhotoSlideViewController: BaseViewController {
updateCardTransform
(
translation
:
translation
)
updateCardTransform
(
translation
:
translation
)
updateButtons
(
progress
:
progress
,
translation
:
translation
)
updateButtons
(
progress
:
progress
,
translation
:
translation
)
case
.
ended
,
.
cancelled
:
case
.
ended
,
.
cancelled
:
endDragAnimation
(
velocity
:
velocity
)
break
// endDragAnimation(velocity: velocity)
default
:
break
default
:
break
}
}
}
}
...
...
PhoneManager/Class/Page/Home/View/AnchorRotatableView.swift
View file @
e3c81dec
...
@@ -40,10 +40,3 @@ class AnchorRotatableView: UIView {
...
@@ -40,10 +40,3 @@ class AnchorRotatableView: UIView {
}
}
extension
AnchorRotatableView
{
func
configure
(
anchorPoint
:
CGPoint
)
{
layer
.
anchorPoint
=
anchorPoint
}
}
PhoneManager/Class/Page/Home/View/PhotoRemoveNavView.swift
0 → 100644
View file @
e3c81dec
//
// PhotoRemoveNavView.swift
// PhoneManager
//
// Created by edy on 2025/5/13.
//
import
UIKit
class
PhotoRemoveNavView
:
UIView
{
public
var
backButton
:
UIButton
!
public
var
titleLbel
:
UILabel
!
public
var
resetButton
:
UIButton
!
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
setupUI
()
}
required
init
?(
coder
:
NSCoder
)
{
fatalError
(
"init(coder:) has not been implemented"
)
}
private
func
setupUI
()
{
backgroundColor
=
.
white
backButton
=
UIButton
()
backButton
.
setImage
(
UIImage
(
named
:
"nav_back"
),
for
:
.
normal
)
backButton
.
addTarget
(
self
,
action
:
#selector(
backBtnClick
)
,
for
:
.
touchUpInside
)
self
.
addSubview
(
backButton
)
backButton
.
snp
.
makeConstraints
{
make
in
make
.
centerY
.
equalTo
(
navCenterY
)
make
.
left
.
equalToSuperview
()
.
offset
(
marginLR
)
make
.
width
.
height
.
equalTo
(
iconWH
)
}
titleLbel
=
UILabel
()
titleLbel
.
textColor
=
UIColor
(
red
:
0.07
,
green
:
0.07
,
blue
:
0.07
,
alpha
:
1
)
titleLbel
.
font
=
UIFont
.
systemFont
(
ofSize
:
12
,
weight
:
.
medium
)
self
.
addSubview
(
titleLbel
)
titleLbel
.
snp
.
makeConstraints
{
make
in
make
.
centerX
.
equalToSuperview
()
make
.
top
.
equalToSuperview
()
.
offset
(
6
+
statusBarHeight
)
make
.
height
.
equalTo
(
22
)
}
resetButton
=
UIButton
()
resetButton
.
setImage
(
UIImage
(
named
:
"nav_back"
),
for
:
.
normal
)
resetButton
.
addTarget
(
self
,
action
:
#selector(
resetButtonAction
)
,
for
:
.
touchUpInside
)
resetButton
.
isHidden
=
true
self
.
addSubview
(
resetButton
)
resetButton
.
snp
.
makeConstraints
{
make
in
make
.
centerY
.
equalTo
(
navCenterY
)
make
.
right
.
equalToSuperview
()
.
offset
(
-
marginLR
)
make
.
width
.
height
.
equalTo
(
iconWH
)
}
}
@objc
private
func
backBtnClick
()
{
self
.
responderViewController
()?
.
navigationController
?
.
popViewController
(
animated
:
true
)
}
@objc
private
func
resetButtonAction
()
{
}
}
PhoneManager/Class/Page/Home/View/PhotosRemoveBaseView.swift
0 → 100644
View file @
e3c81dec
//
// AnchorRotatableView.swift
// AIClean
//
// Created by 赵前 on 2025/5/10.
//
import
Foundation
import
UIKit
class
PhotosRemoveBaseView
:
UIView
{
var
currentIndex
:
Int
?
var
initialCenter
:
CGPoint
=
.
zero
private
let
imageView
=
UIImageView
()
private
let
leftButton
=
UIButton
()
private
let
rightButton
=
UIButton
()
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
setupUI
()
}
required
init
?(
coder
:
NSCoder
)
{
fatalError
(
"init(coder:) has not been implemented"
)
}
private
func
setupUI
()
{
// 配置图片视图
imageView
.
contentMode
=
.
scaleAspectFill
imageView
.
layer
.
cornerRadius
=
20
imageView
.
clipsToBounds
=
true
addSubview
(
imageView
)
// 配置按钮
let
buttonSize
:
CGFloat
=
300
leftButton
.
frame
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
buttonSize
,
height
:
buttonSize
)
leftButton
.
setImage
(
UIImage
(
named
:
"Frame 2"
),
for
:
.
normal
)
// 替换你的图标
leftButton
.
tintColor
=
.
white
leftButton
.
alpha
=
0
addSubview
(
leftButton
)
rightButton
.
frame
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
buttonSize
,
height
:
buttonSize
)
rightButton
.
setImage
(
UIImage
(
named
:
"Group_1171275102"
),
for
:
.
normal
)
// 替换你的图标
rightButton
.
tintColor
=
.
white
rightButton
.
alpha
=
0
addSubview
(
rightButton
)
leftButton
.
center
=
cWindow
!.
center
rightButton
.
center
=
cWindow
!.
center
}
func
configure
(
with
image
:
UIImage
)
{
imageView
.
image
=
image
imageView
.
frame
=
bounds
}
func
showLeftButton
()
{
UIView
.
animate
(
withDuration
:
0.2
)
{
self
.
leftButton
.
alpha
=
1
self
.
rightButton
.
alpha
=
0
}
}
func
showRightButton
()
{
UIView
.
animate
(
withDuration
:
0.2
)
{
self
.
rightButton
.
alpha
=
1
self
.
leftButton
.
alpha
=
0
}
}
func
hideButtons
()
{
UIView
.
animate
(
withDuration
:
0.2
)
{
self
.
leftButton
.
alpha
=
0
self
.
rightButton
.
alpha
=
0
self
.
leftButton
.
center
=
cWindow
!.
center
self
.
rightButton
.
center
=
cWindow
!.
center
}
}
}
PhoneManager/Class/Page/Home/View/TrashSubView.swift
0 → 100644
View file @
e3c81dec
//
// TrashSubView.swift
// PhoneManager
//
// Created by edy on 2025/5/13.
//
import
UIKit
class
TrashSubView
:
UIView
{
lazy
var
resourceCountlabel
:
UILabel
=
{
let
label
=
UILabel
()
label
.
font
=
UIFont
.
systemFont
(
ofSize
:
24
,
weight
:
.
semibold
)
label
.
textColor
=
UIColor
(
red
:
0
,
green
:
0
,
blue
:
0
,
alpha
:
1
)
return
label
}()
lazy
var
tipLabel
:
UILabel
=
{
let
label
=
UILabel
()
label
.
text
=
"The photo in the trash can"
label
.
font
=
UIFont
.
systemFont
(
ofSize
:
12
,
weight
:
.
semibold
)
label
.
textColor
=
UIColor
(
red
:
0
,
green
:
0
,
blue
:
0
,
alpha
:
1
)
label
.
numberOfLines
=
0
return
label
}()
lazy
var
emptyButton
:
UIButton
=
{
let
button
=
UIButton
(
type
:
.
custom
)
button
.
setImage
(
UIImage
(
named
:
"ic_delete_duplicates"
),
for
:
.
normal
)
button
.
backgroundColor
=
UIColor
(
red
:
0
,
green
:
0.51
,
blue
:
1
,
alpha
:
1
)
button
.
setTitle
(
"Empty the garbage"
,
for
:
.
normal
)
button
.
setTitleColor
(
.
white
,
for
:
.
normal
)
button
.
titleLabel
?
.
font
=
UIFont
.
systemFont
(
ofSize
:
12
,
weight
:
.
semibold
)
button
.
layer
.
cornerRadius
=
19
button
.
clipsToBounds
=
true
return
button
}()
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
self
.
addSubview
(
self
.
resourceCountlabel
)
self
.
addSubview
(
self
.
tipLabel
)
self
.
addSubview
(
self
.
emptyButton
)
self
.
resourceCountlabel
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalToSuperview
()
.
offset
(
16
)
make
.
centerY
.
equalToSuperview
()
make
.
height
.
equalTo
(
22
)
make
.
width
.
equalTo
(
30
)
}
self
.
tipLabel
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalToSuperview
()
.
offset
(
17
)
make
.
bottom
.
equalToSuperview
()
.
offset
(
-
17
)
make
.
left
.
equalTo
(
self
.
resourceCountlabel
.
snp
.
right
)
.
offset
(
11
)
make
.
width
.
equalTo
(
100
)
}
self
.
emptyButton
.
snp
.
makeConstraints
{
make
in
make
.
right
.
equalToSuperview
()
.
offset
(
-
9
)
make
.
height
.
equalTo
(
38
)
make
.
centerY
.
equalToSuperview
()
make
.
width
.
equalTo
(
145
)
}
}
required
init
?(
coder
:
NSCoder
)
{
fatalError
(
"init(coder:) has not been implemented"
)
}
}
PhoneManager/Class/Tool/Singleton/Singleton.swift
View file @
e3c81dec
...
@@ -19,6 +19,8 @@ class Singleton {
...
@@ -19,6 +19,8 @@ class Singleton {
var
maxDeleteCount
:
Int
=
25
var
maxDeleteCount
:
Int
=
25
var
trashData
:
[
TrashTypeEnum
:
[
AssetModel
]]
=
[:]
var
photoPermission
:
PrivacyType
?
var
photoPermission
:
PrivacyType
?
...
...
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