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
36d4c4e3
Commit
36d4c4e3
authored
May 12, 2025
by
CZ1004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【新增】首页筛选
parent
52802867
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
906 additions
and
7 deletions
+906
-7
Contents.json
...nager/Assets.xcassets/Home/Frame 1.imageset/Contents.json
+23
-0
Frame.png
PhoneManager/Assets.xcassets/Home/Frame 1.imageset/Frame.png
+0
-0
Frame@2x.png
...anager/Assets.xcassets/Home/Frame 1.imageset/Frame@2x.png
+0
-0
Frame@3x.png
...anager/Assets.xcassets/Home/Frame 1.imageset/Frame@3x.png
+0
-0
Contents.json
...Manager/Assets.xcassets/Home/Frame.imageset/Contents.json
+23
-0
Frame.png
PhoneManager/Assets.xcassets/Home/Frame.imageset/Frame.png
+0
-0
Frame@2x.png
...eManager/Assets.xcassets/Home/Frame.imageset/Frame@2x.png
+0
-0
Frame@3x.png
...eManager/Assets.xcassets/Home/Frame.imageset/Frame@3x.png
+0
-0
DateSelectButtonView.swift
...anager/Class/Session/Home/View/DateSelectButtonView.swift
+67
-0
HomeInfoView.swift
PhoneManager/Class/Session/Home/View/HomeInfoView.swift
+128
-0
ResourceFilterBoxView.swift
...nager/Class/Session/Home/View/ResourceFilterBoxView.swift
+369
-0
YearMonthPickerView.swift
...Manager/Class/Session/Home/View/YearMonthPickerView.swift
+164
-0
HomeInfoTableViewCell.swift
.../Class/Session/Home/View/cell/HomeInfoTableViewCell.swift
+28
-4
ImageSeletedCollectionCell.swift
...s/Session/Home/View/cell/ImageSeletedCollectionCell.swift
+50
-3
ResourceFilterBoxTableViewCell.swift
...ssion/Home/View/cell/ResourceFilterBoxTableViewCell.swift
+49
-0
SettingModel.swift
PhoneManager/Class/Session/Settings/Model/SettingModel.swift
+2
-0
SettingViewController.swift
...ssion/Settings/ViewController/SettingViewController.swift
+3
-0
No files found.
PhoneManager/Assets.xcassets/Home/Frame 1.imageset/Contents.json
0 → 100644
View file @
36d4c4e3
{
"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 1.imageset/Frame.png
0 → 100644
View file @
36d4c4e3
345 Bytes
PhoneManager/Assets.xcassets/Home/Frame 1.imageset/Frame@2x.png
0 → 100644
View file @
36d4c4e3
470 Bytes
PhoneManager/Assets.xcassets/Home/Frame 1.imageset/Frame@3x.png
0 → 100644
View file @
36d4c4e3
526 Bytes
PhoneManager/Assets.xcassets/Home/Frame.imageset/Contents.json
0 → 100644
View file @
36d4c4e3
{
"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.imageset/Frame.png
0 → 100644
View file @
36d4c4e3
314 Bytes
PhoneManager/Assets.xcassets/Home/Frame.imageset/Frame@2x.png
0 → 100644
View file @
36d4c4e3
500 Bytes
PhoneManager/Assets.xcassets/Home/Frame.imageset/Frame@3x.png
0 → 100644
View file @
36d4c4e3
691 Bytes
PhoneManager/Class/Session/Home/View/DateSelectButtonView.swift
0 → 100644
View file @
36d4c4e3
//
// DateSelectButtonView.swift
// PhoneManager
//
// Created by edy on 2025/5/12.
//
import
Foundation
class
DateSelectButtonView
:
UIView
{
var
type
:
PikerDateType
?
lazy
var
dateButton
:
UIButton
=
{
let
button
=
UIButton
(
type
:
.
custom
)
button
.
setTitle
(
"Start date"
,
for
:
.
normal
)
button
.
titleLabel
?
.
font
=
UIFont
.
systemFont
(
ofSize
:
14
,
weight
:
.
semibold
)
button
.
setTitleColor
(
UIColor
(
red
:
0.07
,
green
:
0.07
,
blue
:
0.07
,
alpha
:
1
),
for
:
.
normal
)
button
.
backgroundColor
=
UIColor
(
red
:
0.9
,
green
:
0.9
,
blue
:
0.9
,
alpha
:
1
)
button
.
layer
.
borderColor
=
UIColor
(
red
:
0.96
,
green
:
0.96
,
blue
:
0.96
,
alpha
:
1
)
.
cgColor
button
.
layer
.
borderWidth
=
1.0
button
.
layer
.
cornerRadius
=
21
button
.
clipsToBounds
=
true
return
button
}()
lazy
var
closeButton
:
UIButton
=
{
let
button
=
UIButton
(
type
:
.
custom
)
button
.
setImage
(
UIImage
(
named
:
"ic_close_charging"
),
for
:
.
normal
)
button
.
addTarget
(
self
,
action
:
#selector(
closeButtonAction
)
,
for
:
.
touchUpInside
)
return
button
}()
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
self
.
addSubview
(
dateButton
)
self
.
addSubview
(
closeButton
)
self
.
dateButton
.
snp
.
makeConstraints
{
make
in
make
.
left
.
bottom
.
right
.
equalToSuperview
()
make
.
top
.
equalToSuperview
()
.
offset
(
4
)
}
self
.
closeButton
.
snp
.
makeConstraints
{
make
in
make
.
width
.
height
.
equalTo
(
16
)
make
.
top
.
equalToSuperview
()
make
.
right
.
equalToSuperview
()
.
offset
(
-
5
)
}
}
required
init
?(
coder
:
NSCoder
)
{
fatalError
(
"init(coder:) has not been implemented"
)
}
@objc
func
closeButtonAction
(){
reSetButtonTitle
()
}
func
reSetButtonTitle
()
{
DispatchQueue
.
main
.
async
{
let
title
=
self
.
type
==
.
start
?
"Start date"
:
"Over date"
self
.
dateButton
.
setTitle
(
title
,
for
:
.
normal
)
self
.
closeButton
.
isHidden
=
true
}
}
}
PhoneManager/Class/Session/Home/View/HomeInfoView.swift
View file @
36d4c4e3
...
@@ -42,6 +42,7 @@ class HomeInfoView :UIView {
...
@@ -42,6 +42,7 @@ class HomeInfoView :UIView {
lazy
var
headerView
:
HomeInfoTitleView
=
{
lazy
var
headerView
:
HomeInfoTitleView
=
{
let
sview
:
HomeInfoTitleView
=
HomeInfoTitleView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
width
,
height
:
84
))
let
sview
:
HomeInfoTitleView
=
HomeInfoTitleView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
width
,
height
:
84
))
sview
.
titleLabel
.
text
=
self
.
titleText
sview
.
titleLabel
.
text
=
self
.
titleText
sview
.
filterButton
.
isHidden
=
self
.
type
!=
.
similar
tableView
.
addSubview
(
sview
)
tableView
.
addSubview
(
sview
)
return
sview
return
sview
}()
}()
...
@@ -101,6 +102,38 @@ class HomeInfoView :UIView {
...
@@ -101,6 +102,38 @@ class HomeInfoView :UIView {
super
.
init
(
frame
:
frame
)
super
.
init
(
frame
:
frame
)
setupUI
()
setupUI
()
self
.
headerView
.
sortViewSubmitCallBack
=
{[
weak
self
]
filterModel
in
guard
let
self
else
{
return
}
// 从源头获取相似数据
PhotoDataManager
.
manager
.
loadFromFileSystem
(
resultModel
:
{[
weak
self
]
model
in
guard
let
self
else
{
return
}
let
tempData
=
self
.
filterDataByDate
(
orgModels
:
model
.
titleModelArray
[
1
]
.
assets
,
startDate
:
filterModel
.
startDate
,
endDate
:
filterModel
.
endDate
)
// 重新更新下数据源
self
.
ids
=
self
.
sortData
(
source
:
tempData
,
type
:
filterModel
.
sortType
)
var
tempModels
:
[
HomeInfoTableItem
]
=
[]
for
array
in
self
.
ids
??
[]
{
var
smodels
:[
ImageSeletedCollectionItem
]
=
[]
for
id
in
array
{
let
smodel
=
ImageSeletedCollectionItem
()
smodel
.
id
=
id
smodel
.
isSeleted
=
false
smodels
.
append
(
smodel
)
}
let
smodel
=
HomeInfoTableItem
()
smodel
.
type
=
type
smodel
.
smodels
=
smodels
smodel
.
titleText
=
titleText
tempModels
.
append
(
smodel
)
}
models
=
tempModels
DispatchQueue
.
main
.
async
{
// FIXME: 闪屏
self
.
tableView
.
reloadSections
(
IndexSet
(
integer
:
0
),
with
:
.
automatic
)
}
})
}
}
}
required
init
?(
coder
:
NSCoder
)
{
required
init
?(
coder
:
NSCoder
)
{
...
@@ -275,6 +308,7 @@ extension HomeInfoView:UITableViewDataSource,UITableViewDelegate {
...
@@ -275,6 +308,7 @@ extension HomeInfoView:UITableViewDataSource,UITableViewDelegate {
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
HomeInfoTableViewCell
.
identifier
,
for
:
indexPath
)
as!
HomeInfoTableViewCell
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
HomeInfoTableViewCell
.
identifier
,
for
:
indexPath
)
as!
HomeInfoTableViewCell
cell
.
type
=
self
.
type
cell
.
model
=
models
[
indexPath
.
row
]
cell
.
model
=
models
[
indexPath
.
row
]
...
@@ -303,10 +337,62 @@ extension HomeInfoView:UITableViewDataSource,UITableViewDelegate {
...
@@ -303,10 +337,62 @@ extension HomeInfoView:UITableViewDataSource,UITableViewDelegate {
return
UIView
()
return
UIView
()
}
}
func
filterDataByDate
(
orgModels
:
[[
AssetModel
]],
startDate
:
Date
?
,
endDate
:
Date
?)
->
[[
AssetModel
]]{
var
tempArray
:
[[
AssetModel
]]
=
[]
for
item
in
orgModels
{
var
array
=
item
if
startDate
!=
nil
{
array
=
array
.
filter
({
$0
.
createDate
>
startDate
!
})
}
if
endDate
!=
nil
{
array
=
array
.
filter
({
$0
.
createDate
<
endDate
!
})
}
if
array
.
count
>
2
{
tempArray
.
append
(
item
)
}
}
return
tempArray
}
func
sortData
(
source
:
[[
AssetModel
]],
type
:
ResouceSortType
)
->
[[
AssetModel
]]
{
switch
type
{
case
.
largest
:
return
source
.
sorted
{
subArray1
,
subArray2
in
let
sum1
=
subArray1
.
reduce
(
0
)
{
$0
+
$1
.
assetSize
}
let
sum2
=
subArray2
.
reduce
(
0
)
{
$0
+
$1
.
assetSize
}
return
sum1
>
sum2
}
case
.
smallest
:
return
source
.
sorted
{
subArray1
,
subArray2
in
let
sum1
=
subArray1
.
reduce
(
0
)
{
$0
+
$1
.
assetSize
}
let
sum2
=
subArray2
.
reduce
(
0
)
{
$0
+
$1
.
assetSize
}
return
sum1
<
sum2
}
case
.
latest
:
return
source
.
sorted
{
subArray1
,
subArray2
in
guard
let
max1
=
subArray1
.
max
(
by
:
{
$0
.
createDate
<
$1
.
createDate
})?
.
createDate
else
{
return
false
}
guard
let
max2
=
subArray2
.
max
(
by
:
{
$0
.
createDate
<
$1
.
createDate
})?
.
createDate
else
{
return
true
}
return
max1
>
max2
}
case
.
oldest
:
return
source
.
sorted
{
subArray1
,
subArray2
in
guard
let
min1
=
subArray1
.
min
(
by
:
{
$0
.
createDate
<
$1
.
createDate
})?
.
createDate
else
{
return
false
}
guard
let
min2
=
subArray2
.
min
(
by
:
{
$0
.
createDate
<
$1
.
createDate
})?
.
createDate
else
{
return
true
}
return
min1
<
min2
}
}
}
}
}
class
HomeInfoTitleView
:
UIView
{
class
HomeInfoTitleView
:
UIView
{
var
sortViewSubmitCallBack
:
(
ResourceFilterBoxModel
)
->
Void
=
{
model
in
}
lazy
var
titleLabel
:
UILabel
=
{
lazy
var
titleLabel
:
UILabel
=
{
let
sview
:
UILabel
=
UILabel
()
let
sview
:
UILabel
=
UILabel
()
...
@@ -333,6 +419,23 @@ class HomeInfoTitleView:UIView {
...
@@ -333,6 +419,23 @@ class HomeInfoTitleView:UIView {
return
sview
return
sview
}()
}()
// 筛选按钮
lazy
var
filterButton
:
UIButton
=
{
let
button
=
UIButton
(
type
:
.
custom
)
button
.
setImage
(
UIImage
(
named
:
"Frame 1"
),
for
:
.
normal
)
button
.
setTitle
(
"The largest"
,
for
:
.
normal
)
button
.
layer
.
cornerRadius
=
14
button
.
clipsToBounds
=
true
button
.
backgroundColor
=
UIColor
(
red
:
0
,
green
:
0.51
,
blue
:
1
,
alpha
:
0.1000
)
button
.
titleLabel
?
.
font
=
UIFont
.
systemFont
(
ofSize
:
12
,
weight
:
.
semibold
)
button
.
setTitleColor
(
UIColor
(
red
:
0.07
,
green
:
0.07
,
blue
:
0.07
,
alpha
:
1
),
for
:
.
normal
)
button
.
addTarget
(
self
,
action
:
#selector(
filterButtonAction
)
,
for
:
.
touchUpInside
)
button
.
isHidden
=
true
return
button
}()
override
init
(
frame
:
CGRect
)
{
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
super
.
init
(
frame
:
frame
)
...
@@ -348,6 +451,15 @@ class HomeInfoTitleView:UIView {
...
@@ -348,6 +451,15 @@ class HomeInfoTitleView:UIView {
backgroundColor
=
.
white
backgroundColor
=
.
white
addSubview
(
titleLabel
)
addSubview
(
titleLabel
)
addSubview
(
numberLabel
)
addSubview
(
numberLabel
)
addSubview
(
self
.
filterButton
)
self
.
filterButton
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalToSuperview
()
.
offset
(
35
)
make
.
right
.
equalToSuperview
()
.
offset
(
-
15
)
make
.
height
.
equalTo
(
28
)
make
.
width
.
equalTo
(
98
)
}
}
}
func
changeContent
(
title
:
String
,
allNumber
:
Int
,
seletedCount
:
Int
)
{
func
changeContent
(
title
:
String
,
allNumber
:
Int
,
seletedCount
:
Int
)
{
...
@@ -381,6 +493,20 @@ class HomeInfoTitleView:UIView {
...
@@ -381,6 +493,20 @@ class HomeInfoTitleView:UIView {
numberLabel
.
attributedText
=
attributedString2
numberLabel
.
attributedText
=
attributedString2
numberLabel
.
y
=
height
-
numberLabel
.
height
-
8
numberLabel
.
y
=
height
-
numberLabel
.
height
-
8
}
}
@objc
func
filterButtonAction
(){
if
let
cWindow
=
cWindow
{
let
filterView
:
ResourceFilterBoxView
=
ResourceFilterBoxView
.
init
(
frame
:
cWindow
.
bounds
)
cWindow
.
addSubview
(
filterView
)
filterView
.
submitCallBack
=
{
model
in
DispatchQueue
.
main
.
async
{
self
.
filterButton
.
setTitle
(
model
.
sortType
.
rawValue
,
for
:
.
normal
)
}
self
.
sortViewSubmitCallBack
(
model
)
}
}
}
}
}
...
@@ -437,5 +563,7 @@ class HomeInfoDeleteView:UIView {
...
@@ -437,5 +563,7 @@ class HomeInfoDeleteView:UIView {
callBack
(
OperStatus
.
delete
)
callBack
(
OperStatus
.
delete
)
}
}
}
}
PhoneManager/Class/Session/Home/View/ResourceFilterBoxView.swift
0 → 100644
View file @
36d4c4e3
This diff is collapsed.
Click to expand it.
PhoneManager/Class/Session/Home/View/YearMonthPickerView.swift
0 → 100644
View file @
36d4c4e3
//
// YearMonthPickerView.swift
// PhoneManager
//
// Created by edy on 2025/5/12.
//
import
Foundation
enum
PikerDateType
{
case
start
case
end
}
class
YearMonthPickerView
:
UIView
{
var
type
:
PikerDateType
=
.
start
// MARK: - Properties
private
var
selectedYear
:
Int
=
0
private
var
selectedMonth
:
Int
=
0
var
onCancel
:
(()
->
Void
)?
var
onConfirm
:
((
_
type
:
PikerDateType
,
_
year
:
Int
,
_
month
:
Int
)
->
Void
)?
private
let
pickerView
:
UIPickerView
=
{
let
picker
=
UIPickerView
()
picker
.
backgroundColor
=
.
white
return
picker
}()
private
let
years
=
Array
(
Array
(
Calendar
.
current
.
component
(
.
year
,
from
:
Date
())
-
30
...
Calendar
.
current
.
component
(
.
year
,
from
:
Date
()))
.
reversed
())
private
lazy
var
months
:
[
String
]
=
{
let
formatter
=
DateFormatter
()
formatter
.
locale
=
Locale
(
identifier
:
"en_US"
)
return
formatter
.
monthSymbols
}()
// MARK: - Initialization
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
setupView
()
}
required
init
?(
coder
:
NSCoder
)
{
super
.
init
(
coder
:
coder
)
setupView
()
}
// MARK: - Setup
private
func
setupView
()
{
backgroundColor
=
.
white
layer
.
cornerRadius
=
12
layer
.
masksToBounds
=
true
// 按钮容器
let
buttonContainer
=
UIView
()
buttonContainer
.
backgroundColor
=
UIColor
(
red
:
0.9
,
green
:
0.9
,
blue
:
0.9
,
alpha
:
1
)
buttonContainer
.
translatesAutoresizingMaskIntoConstraints
=
false
// 取消按钮
let
cancelButton
=
UIButton
(
type
:
.
system
)
cancelButton
.
setTitle
(
"Cancel"
,
for
:
.
normal
)
cancelButton
.
contentHorizontalAlignment
=
.
left
cancelButton
.
addTarget
(
self
,
action
:
#selector(
cancelAction
)
,
for
:
.
touchUpInside
)
cancelButton
.
translatesAutoresizingMaskIntoConstraints
=
false
cancelButton
.
setTitleColor
(
UIColor
(
red
:
0.6
,
green
:
0.6
,
blue
:
0.6
,
alpha
:
1
),
for
:
.
normal
)
cancelButton
.
titleLabel
?
.
font
=
UIFont
.
systemFont
(
ofSize
:
14
,
weight
:
.
medium
)
// 确认按钮
let
confirmButton
=
UIButton
(
type
:
.
system
)
confirmButton
.
setTitle
(
"Completed"
,
for
:
.
normal
)
confirmButton
.
contentHorizontalAlignment
=
.
right
confirmButton
.
addTarget
(
self
,
action
:
#selector(
confirmAction
)
,
for
:
.
touchUpInside
)
confirmButton
.
translatesAutoresizingMaskIntoConstraints
=
false
cancelButton
.
setTitleColor
(
UIColor
(
red
:
0.07
,
green
:
0.07
,
blue
:
0.07
,
alpha
:
1
),
for
:
.
normal
)
cancelButton
.
titleLabel
?
.
font
=
UIFont
.
systemFont
(
ofSize
:
14
,
weight
:
.
medium
)
buttonContainer
.
addSubview
(
cancelButton
)
buttonContainer
.
addSubview
(
confirmButton
)
// 按钮容器约束
NSLayoutConstraint
.
activate
([
buttonContainer
.
heightAnchor
.
constraint
(
equalToConstant
:
42
),
cancelButton
.
leadingAnchor
.
constraint
(
equalTo
:
buttonContainer
.
leadingAnchor
,
constant
:
16
),
cancelButton
.
centerYAnchor
.
constraint
(
equalTo
:
buttonContainer
.
centerYAnchor
),
confirmButton
.
trailingAnchor
.
constraint
(
equalTo
:
buttonContainer
.
trailingAnchor
,
constant
:
-
16
),
confirmButton
.
centerYAnchor
.
constraint
(
equalTo
:
buttonContainer
.
centerYAnchor
)
])
// 主布局
let
stackView
=
UIStackView
(
arrangedSubviews
:
[
buttonContainer
,
pickerView
])
stackView
.
axis
=
.
vertical
stackView
.
spacing
=
0
stackView
.
translatesAutoresizingMaskIntoConstraints
=
false
addSubview
(
stackView
)
NSLayoutConstraint
.
activate
([
stackView
.
topAnchor
.
constraint
(
equalTo
:
topAnchor
),
stackView
.
leadingAnchor
.
constraint
(
equalTo
:
leadingAnchor
),
stackView
.
trailingAnchor
.
constraint
(
equalTo
:
trailingAnchor
),
stackView
.
bottomAnchor
.
constraint
(
equalTo
:
bottomAnchor
)
])
pickerView
.
delegate
=
self
pickerView
.
dataSource
=
self
// 设置初始选择
let
currentYear
=
Calendar
.
current
.
component
(
.
year
,
from
:
Date
())
let
currentMonth
=
Calendar
.
current
.
component
(
.
month
,
from
:
Date
())
selectedYear
=
currentYear
selectedMonth
=
currentMonth
-
1
if
let
yearIndex
=
years
.
firstIndex
(
of
:
currentYear
)
{
pickerView
.
selectRow
(
yearIndex
,
inComponent
:
1
,
animated
:
false
)
}
pickerView
.
tintColor
=
.
red
pickerView
.
selectRow
(
currentMonth
-
1
,
inComponent
:
0
,
animated
:
false
)
}
// MARK: - 按钮操作
@objc
private
func
cancelAction
()
{
onCancel
?()
}
@objc
private
func
confirmAction
()
{
onConfirm
?(
self
.
type
,
selectedYear
,
selectedMonth
+
1
)
}
}
// MARK: - UIPickerView DataSource & Delegate
extension
YearMonthPickerView
:
UIPickerViewDataSource
,
UIPickerViewDelegate
{
func
numberOfComponents
(
in
pickerView
:
UIPickerView
)
->
Int
{
return
2
}
func
pickerView
(
_
pickerView
:
UIPickerView
,
numberOfRowsInComponent
component
:
Int
)
->
Int
{
return
component
==
0
?
months
.
count
:
years
.
count
}
func
pickerView
(
_
pickerView
:
UIPickerView
,
titleForRow
row
:
Int
,
forComponent
component
:
Int
)
->
String
?
{
return
component
==
0
?
months
[
row
]
:
"
\(
years
.
reversed
()[
row
]
)
"
}
func
pickerView
(
_
pickerView
:
UIPickerView
,
didSelectRow
row
:
Int
,
inComponent
component
:
Int
)
{
if
component
==
0
{
selectedMonth
=
row
}
else
{
selectedYear
=
years
.
reversed
()[
row
]
}
}
func
pickerView
(
_
pickerView
:
UIPickerView
,
widthForComponent
component
:
Int
)
->
CGFloat
{
return
component
==
0
?
self
.
width
/
2
:
self
.
width
/
2
}
}
PhoneManager/Class/Session/Home/View/cell/HomeInfoTableViewCell.swift
View file @
36d4c4e3
...
@@ -20,6 +20,8 @@ class HomeInfoTableViewCell:UITableViewCell {
...
@@ -20,6 +20,8 @@ class HomeInfoTableViewCell:UITableViewCell {
private
var
seletedAllBtn
:
UIButton
?
private
var
seletedAllBtn
:
UIButton
?
var
type
:
PhotsFileType
?
var
callBack
:
callBack
<
Any
>
=
{
text
in
}
var
callBack
:
callBack
<
Any
>
=
{
text
in
}
override
init
(
style
:
UITableViewCell
.
CellStyle
,
reuseIdentifier
:
String
?)
{
override
init
(
style
:
UITableViewCell
.
CellStyle
,
reuseIdentifier
:
String
?)
{
...
@@ -115,10 +117,27 @@ class HomeInfoTableViewCell:UITableViewCell {
...
@@ -115,10 +117,27 @@ class HomeInfoTableViewCell:UITableViewCell {
UIView
.
transition
(
with
:
collectionView
!
,
duration
:
0.3
,
options
:
.
transitionCrossDissolve
,
animations
:
{
UIView
.
transition
(
with
:
collectionView
!
,
duration
:
0.3
,
options
:
.
transitionCrossDissolve
,
animations
:
{
self
.
collectionView
?
.
reloadData
()
self
.
collectionView
?
.
reloadData
()
// self.reloadCollectionView()
},
completion
:
nil
)
},
completion
:
nil
)
}
}
}
}
// 重新刷新下集合
func
reloadCollectionView
(){
DispatchQueue
.
main
.
async
{
if
let
collectionView
=
self
.
collectionView
{
for
section
in
0
..<
collectionView
.
numberOfSections
{
for
item
in
0
..<
collectionView
.
numberOfItems
(
inSection
:
section
)
{
UIView
.
transition
(
with
:
collectionView
,
duration
:
0.3
,
options
:
.
transitionCrossDissolve
,
animations
:
{
collectionView
.
reloadItems
(
at
:
[
IndexPath
(
row
:
item
,
section
:
section
)])
},
completion
:
nil
)
}
}
}
}
}
@objc
func
seletedAllBtnClick
()
{
@objc
func
seletedAllBtnClick
()
{
DispatchQueue
.
main
.
async
{[
weak
self
]
in
DispatchQueue
.
main
.
async
{[
weak
self
]
in
...
@@ -195,6 +214,11 @@ extension HomeInfoTableViewCell:UICollectionViewDelegate,UICollectionViewDataSou
...
@@ -195,6 +214,11 @@ extension HomeInfoTableViewCell:UICollectionViewDelegate,UICollectionViewDataSou
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
ImageSeletedCollectionCell
.
identifiers
,
for
:
indexPath
)
as!
ImageSeletedCollectionCell
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
ImageSeletedCollectionCell
.
identifiers
,
for
:
indexPath
)
as!
ImageSeletedCollectionCell
// 显示保留按钮或者最佳匹配结果按钮
cell
.
allKeepButton
.
isHidden
=
indexPath
.
item
!=
0
||
self
.
type
==
.
duplicates
cell
.
bestResultButton
.
isHidden
=
indexPath
.
item
!=
0
||
self
.
type
==
.
duplicates
cell
.
model
=
model
?
.
smodels
?[
indexPath
.
row
]
cell
.
model
=
model
?
.
smodels
?[
indexPath
.
row
]
cell
.
photsFileType
=
model
?
.
type
cell
.
photsFileType
=
model
?
.
type
...
...
PhoneManager/Class/Session/Home/View/cell/ImageSeletedCollectionCell.swift
View file @
36d4c4e3
...
@@ -19,6 +19,34 @@ class ImageSeletedCollectionCell:UICollectionViewCell {
...
@@ -19,6 +19,34 @@ class ImageSeletedCollectionCell:UICollectionViewCell {
var
callBack
:
callBack
<
Any
>
=
{
text
in
}
var
callBack
:
callBack
<
Any
>
=
{
text
in
}
lazy
var
allKeepButton
:
UIButton
=
{
let
button
=
UIButton
(
type
:
.
custom
)
button
.
backgroundColor
=
UIColor
(
red
:
0.33
,
green
:
0.77
,
blue
:
0.49
,
alpha
:
1
)
button
.
layer
.
cornerRadius
=
7
button
.
clipsToBounds
=
true
button
.
setTitle
(
"All retained"
,
for
:
.
normal
)
button
.
setTitleColor
(
.
white
,
for
:
.
normal
)
button
.
titleLabel
?
.
font
=
UIFont
.
systemFont
(
ofSize
:
9
,
weight
:
.
semibold
)
button
.
addTarget
(
self
,
action
:
#selector(
allKeepButtonAction
)
,
for
:
.
touchUpInside
)
button
.
isHidden
=
true
return
button
}()
lazy
var
bestResultButton
:
UIButton
=
{
let
button
=
UIButton
(
type
:
.
custom
)
button
.
layer
.
cornerRadius
=
8
button
.
clipsToBounds
=
true
button
.
backgroundColor
=
UIColor
(
red
:
0
,
green
:
0.51
,
blue
:
1
,
alpha
:
1
)
button
.
setTitle
(
"Best result"
,
for
:
.
normal
)
button
.
setImage
(
UIImage
(
named
:
"Frame"
),
for
:
.
normal
)
button
.
setTitleColor
(
.
white
,
for
:
.
normal
)
button
.
isHidden
=
true
button
.
titleLabel
?
.
font
=
UIFont
.
systemFont
(
ofSize
:
10
,
weight
:
.
semibold
)
return
button
}()
override
init
(
frame
:
CGRect
)
{
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
super
.
init
(
frame
:
frame
)
...
@@ -132,9 +160,6 @@ class ImageSeletedCollectionCell:UICollectionViewCell {
...
@@ -132,9 +160,6 @@ class ImageSeletedCollectionCell:UICollectionViewCell {
self
.
backgroundColor
=
.
clear
self
.
backgroundColor
=
.
clear
}
}
func
addViews
()
{
func
addViews
()
{
...
@@ -142,6 +167,22 @@ class ImageSeletedCollectionCell:UICollectionViewCell {
...
@@ -142,6 +167,22 @@ class ImageSeletedCollectionCell:UICollectionViewCell {
self
.
addSubview
(
backImageView
!
)
self
.
addSubview
(
backImageView
!
)
self
.
addSubview
(
seletedBtn
!
)
self
.
addSubview
(
seletedBtn
!
)
self
.
addSubview
(
self
.
extensionView
)
self
.
addSubview
(
self
.
extensionView
)
self
.
addSubview
(
self
.
allKeepButton
)
self
.
addSubview
(
self
.
bestResultButton
)
self
.
allKeepButton
.
snp
.
makeConstraints
{
make
in
make
.
top
.
left
.
equalToSuperview
()
make
.
width
.
equalTo
(
58
)
make
.
height
.
equalTo
(
14
)
}
self
.
bestResultButton
.
snp
.
makeConstraints
{
make
in
make
.
left
.
bottom
.
equalToSuperview
()
make
.
width
.
equalTo
(
81
)
make
.
height
.
equalTo
(
16
)
}
}
}
@objc
func
seletedBtnClick
()
{
@objc
func
seletedBtnClick
()
{
...
@@ -178,3 +219,9 @@ class ImageSeletedCollectionCell:UICollectionViewCell {
...
@@ -178,3 +219,9 @@ class ImageSeletedCollectionCell:UICollectionViewCell {
}
}
extension
ImageSeletedCollectionCell
{
@objc
func
allKeepButtonAction
(){
Print
(
"点击了全部保留按钮"
)
}
}
PhoneManager/Class/Session/Home/View/cell/ResourceFilterBoxTableViewCell.swift
0 → 100644
View file @
36d4c4e3
//
// ResourceFilterBoxTableViewCell.swift
// PhoneManager
//
// Created by edy on 2025/5/12.
//
import
Foundation
class
ResourceFilterBoxTableViewCell
:
UITableViewCell
{
var
cellTag
:
Int
=
0
var
callBack
:
callBack
<
Any
>
=
{
cellTag
in
}
override
init
(
style
:
UITableViewCell
.
CellStyle
,
reuseIdentifier
:
String
?)
{
super
.
init
(
style
:
style
,
reuseIdentifier
:
reuseIdentifier
)
self
.
selectionStyle
=
.
none
self
.
contentView
.
addSubview
(
self
.
selectButton
)
self
.
selectButton
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalToSuperview
()
.
offset
(
0
)
make
.
right
.
equalToSuperview
()
.
offset
(
0
)
make
.
top
.
equalToSuperview
()
.
offset
(
7
)
make
.
bottom
.
equalToSuperview
()
.
offset
(
-
7
)
}
}
required
init
?(
coder
:
NSCoder
)
{
fatalError
(
"init(coder:) has not been implemented"
)
}
lazy
var
selectButton
:
UIButton
=
{
let
view
=
UIButton
(
type
:
UIButton
.
ButtonType
.
custom
)
view
.
backgroundColor
=
UIColor
(
red
:
0.95
,
green
:
0.96
,
blue
:
0.99
,
alpha
:
1
)
view
.
layer
.
cornerRadius
=
12
view
.
clipsToBounds
=
true
view
.
setTitleColor
(
UIColor
(
red
:
0.2
,
green
:
0.2
,
blue
:
0.2
,
alpha
:
1
),
for
:
.
normal
)
view
.
addTarget
(
self
,
action
:
#selector(
selectAction
)
,
for
:
.
touchUpInside
)
view
.
layer
.
borderColor
=
UIColor
(
red
:
0
,
green
:
0.51
,
blue
:
1
,
alpha
:
1
)
.
cgColor
return
view
}()
@objc
func
selectAction
(){
callBack
(
self
.
cellTag
)
}
}
PhoneManager/Class/Session/Settings/Model/SettingModel.swift
View file @
36d4c4e3
...
@@ -60,6 +60,8 @@ func getSettingViewInfo() -> [SettingModel] {
...
@@ -60,6 +60,8 @@ func getSettingViewInfo() -> [SettingModel] {
[
RowInfoModel
(
imageName
:
"ic_more_setting"
,
title
:
"More Apps From Us"
)]),
[
RowInfoModel
(
imageName
:
"ic_more_setting"
,
title
:
"More Apps From Us"
)]),
SettingModel
(
sectionTitle
:
"UTILITIES"
,
rowInfo
:
SettingModel
(
sectionTitle
:
"UTILITIES"
,
rowInfo
:
[
RowInfoModel
(
imageName
:
"ic_widgets_setting"
,
title
:
"Widgets"
)]),
[
RowInfoModel
(
imageName
:
"ic_widgets_setting"
,
title
:
"Widgets"
)]),
SettingModel
(
sectionTitle
:
"OTHERS"
,
rowInfo
:
[
RowInfoModel
(
imageName
:
"ic_list_setting"
,
title
:
"Keep List"
)]),
// SettingModel(sectionTitle: "SECRET SPACE",rowInfo: [
// SettingModel(sectionTitle: "SECRET SPACE",rowInfo: [
// RowInfoModel(imageName: "ic_pin_setting",title: "Use PIN")]),
// RowInfoModel(imageName: "ic_pin_setting",title: "Use PIN")]),
SettingModel
(
sectionTitle
:
"STAY IN TOUCH"
,
rowInfo
:
SettingModel
(
sectionTitle
:
"STAY IN TOUCH"
,
rowInfo
:
...
...
PhoneManager/Class/Session/Settings/ViewController/SettingViewController.swift
View file @
36d4c4e3
...
@@ -159,6 +159,9 @@ class SettingViewController : BaseViewController , UITableViewDelegate, UITableV
...
@@ -159,6 +159,9 @@ class SettingViewController : BaseViewController , UITableViewDelegate, UITableV
self
.
navigationController
?
.
pushViewController
(
widget
,
animated
:
true
)
self
.
navigationController
?
.
pushViewController
(
widget
,
animated
:
true
)
break
break
case
3
:
case
3
:
// 保留列表
break
case
4
:
if
indexPath
.
row
==
0
{
// 评分
if
indexPath
.
row
==
0
{
// 评分
self
.
review
()
self
.
review
()
}
else
if
indexPath
.
row
==
1
{
// 分享
}
else
if
indexPath
.
row
==
1
{
// 分享
...
...
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