Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
S
ShorthandMaster
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
lmj
ShorthandMaster
Commits
446c75f7
Commit
446c75f7
authored
Sep 29, 2020
by
lmj_521aiau@163.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
icloud 优化
parent
1a7e95d5
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
278 additions
and
277 deletions
+278
-277
SHMineViewController.swift
ShorthandMaster/Mine/SHMineViewController.swift
+14
-10
SHRecordModel.swift
ShorthandMaster/Record/Model/SHRecordModel.swift
+1
-0
Record.storyboard
ShorthandMaster/Record/Record.storyboard
+6
-6
SHRecordDetailsVC.swift
ShorthandMaster/Record/SHRecordDetailsVC.swift
+8
-5
SHRecordListViewController.swift
ShorthandMaster/Record/SHRecordListViewController.swift
+16
-87
SHRecordMoveFileVC.swift
ShorthandMaster/Record/SHRecordMoveFileVC.swift
+35
-24
SHRecordViewController.swift
ShorthandMaster/Record/SHRecordViewController.swift
+11
-15
SHAVAudioManager.swift
ShorthandMaster/Share/Managers/SHAVAudioManager.swift
+2
-1
SHCloudManager.swift
ShorthandMaster/Share/Managers/SHCloudManager.swift
+185
-129
No files found.
ShorthandMaster/Mine/SHMineViewController.swift
View file @
446c75f7
...
@@ -73,7 +73,7 @@ class SHMineViewController: SHBaseViewController {
...
@@ -73,7 +73,7 @@ class SHMineViewController: SHBaseViewController {
}
}
func
sortType
(){
func
sortType
(){
UIAlertController
.
showActionSheet
(
withTitle
:
""
,
message
:
""
,
cancelBtnTitle
:
"取消"
,
otherBtnTitles
:
sortTypes
)
{
(
index
)
in
UIAlertController
.
showActionSheet
(
withTitle
:
nil
,
message
:
nil
,
cancelBtnTitle
:
"取消"
,
otherBtnTitles
:
sortTypes
)
{
(
index
)
in
if
index
==
0
{
if
index
==
0
{
return
return
}
}
...
@@ -153,6 +153,7 @@ extension SHMineViewController:UITableViewDelegate, UITableViewDataSource{
...
@@ -153,6 +153,7 @@ extension SHMineViewController:UITableViewDelegate, UITableViewDataSource{
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
tableView
.
deselectRow
(
at
:
indexPath
,
animated
:
true
)
switch
indexPath
.
section
{
switch
indexPath
.
section
{
case
0
:
case
0
:
sortType
()
sortType
()
...
@@ -178,7 +179,18 @@ extension SHMineViewController:UITableViewDelegate, UITableViewDataSource{
...
@@ -178,7 +179,18 @@ extension SHMineViewController:UITableViewDelegate, UITableViewDataSource{
self
.
navigationController
?
.
pushViewController
(
webView
,
animated
:
true
)
self
.
navigationController
?
.
pushViewController
(
webView
,
animated
:
true
)
break
break
case
3
:
case
3
:
SHStoreManager
.
restorePurchases
(
success
:
{
SHUserAccountManager
.
shared
.
getUserInfo
({
(
model
)
in
if
model
.
isMember
{
self
.
getUserInfo
()
MBProgressHUD
.
showSuccess
(
"恢复成功"
)
}
else
{
MBProgressHUD
.
showError
(
"恢复失败,请稍后再试"
)
}
},
failure
:
{
MBProgressHUD
.
showError
(
"恢复失败,请稍后再试"
)
})
},
toView
:
self
.
view
)
break
break
default
:
default
:
break
break
...
@@ -188,13 +200,5 @@ extension SHMineViewController:UITableViewDelegate, UITableViewDataSource{
...
@@ -188,13 +200,5 @@ extension SHMineViewController:UITableViewDelegate, UITableViewDataSource{
default
:
default
:
break
break
}
}
// let webView = SHWebViewController()
// webView.url = SHUserAccountManager.shared.h5_urlDic["user"] as? String
// webView.title = "付费用户协议"
// self.navigationController?.pushViewController(webView, animated: true)
// let delete = UIStoryboard.init(name: "Mine", bundle: nil).instantiateViewController(withIdentifier: "SHDeleteDetailsViewController") as! SHDeleteDetailsViewController
// self.navigationController?.pushViewController(delete, animated: true)
}
}
}
}
ShorthandMaster/Record/Model/SHRecordModel.swift
View file @
446c75f7
...
@@ -32,6 +32,7 @@ class SHRecordModel: NSObject{
...
@@ -32,6 +32,7 @@ class SHRecordModel: NSObject{
@objc
var
selected
:
Bool
=
false
@objc
var
selected
:
Bool
=
false
@objc
var
icloud
:
Bool
=
false
@objc
var
icloud
:
Bool
=
false
@objc
var
processing
:
Bool
=
false
override
func
setValue
(
_
value
:
Any
?,
forUndefinedKey
key
:
String
)
{
override
func
setValue
(
_
value
:
Any
?,
forUndefinedKey
key
:
String
)
{
...
...
ShorthandMaster/Record/Record.storyboard
View file @
446c75f7
...
@@ -193,13 +193,13 @@
...
@@ -193,13 +193,13 @@
<rect
key=
"frame"
x=
"0.0"
y=
"100"
width=
"414"
height=
"678"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"100"
width=
"414"
height=
"678"
/>
<subviews>
<subviews>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"点击右上角添加笔记"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"JlT-EC-bWg"
>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"点击右上角添加笔记"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"JlT-EC-bWg"
>
<rect
key=
"frame"
x=
"1
15.5"
y=
"395"
width=
"183.5"
height=
"24
"
/>
<rect
key=
"frame"
x=
"1
24.5"
y=
"396"
width=
"165.5"
height=
"21.5
"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"
20
"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"
18
"
/>
<color
key=
"textColor"
red=
"0.40000000000000002"
green=
"0.40000000000000002"
blue=
"0.40000000000000002"
alpha=
"0.84705882349999995"
colorSpace=
"calibratedRGB"
/>
<color
key=
"textColor"
red=
"0.40000000000000002"
green=
"0.40000000000000002"
blue=
"0.40000000000000002"
alpha=
"0.84705882349999995"
colorSpace=
"calibratedRGB"
/>
<nil
key=
"highlightedColor"
/>
<nil
key=
"highlightedColor"
/>
</label>
</label>
<imageView
clipsSubviews=
"YES"
userInteractionEnabled=
"NO"
contentMode=
"scaleAspectFit"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
image=
"recordlist_no_data"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"1ji-L1-Qj7"
>
<imageView
clipsSubviews=
"YES"
userInteractionEnabled=
"NO"
contentMode=
"scaleAspectFit"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
image=
"recordlist_no_data"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"1ji-L1-Qj7"
>
<rect
key=
"frame"
x=
"123.5"
y=
"27
2
"
width=
"167"
height=
"103"
/>
<rect
key=
"frame"
x=
"123.5"
y=
"27
3
"
width=
"167"
height=
"103"
/>
</imageView>
</imageView>
</subviews>
</subviews>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
/>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
/>
...
@@ -334,13 +334,13 @@
...
@@ -334,13 +334,13 @@
<rect
key=
"frame"
x=
"0.0"
y=
"44"
width=
"414"
height=
"758"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"44"
width=
"414"
height=
"758"
/>
<subviews>
<subviews>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"这个笔记本里还没有笔记"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"QYS-Yf-f9g"
>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"这个笔记本里还没有笔记"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"QYS-Yf-f9g"
>
<rect
key=
"frame"
x=
"
95"
y=
"367"
width=
"224.5"
height=
"24
"
/>
<rect
key=
"frame"
x=
"
106"
y=
"368.5"
width=
"202"
height=
"21.5
"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"
20
"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"
18
"
/>
<color
key=
"textColor"
red=
"0.40000000000000002"
green=
"0.40000000000000002"
blue=
"0.40000000000000002"
alpha=
"0.84705882349999995"
colorSpace=
"calibratedRGB"
/>
<color
key=
"textColor"
red=
"0.40000000000000002"
green=
"0.40000000000000002"
blue=
"0.40000000000000002"
alpha=
"0.84705882349999995"
colorSpace=
"calibratedRGB"
/>
<nil
key=
"highlightedColor"
/>
<nil
key=
"highlightedColor"
/>
</label>
</label>
<imageView
clipsSubviews=
"YES"
userInteractionEnabled=
"NO"
contentMode=
"scaleAspectFit"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
image=
"recordlist_no_data"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"QrU-uf-U0R"
>
<imageView
clipsSubviews=
"YES"
userInteractionEnabled=
"NO"
contentMode=
"scaleAspectFit"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
image=
"recordlist_no_data"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"QrU-uf-U0R"
>
<rect
key=
"frame"
x=
"123.5"
y=
"24
4
"
width=
"167"
height=
"103"
/>
<rect
key=
"frame"
x=
"123.5"
y=
"24
5.5
"
width=
"167"
height=
"103"
/>
</imageView>
</imageView>
</subviews>
</subviews>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
/>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
/>
...
...
ShorthandMaster/Record/SHRecordDetailsVC.swift
View file @
446c75f7
...
@@ -128,11 +128,12 @@ class SHRecordDetailsVC: SHBaseViewController {
...
@@ -128,11 +128,12 @@ class SHRecordDetailsVC: SHBaseViewController {
@objc
func
editClick
(
_
restore
:
Bool
){
@objc
func
editClick
(
_
restore
:
Bool
){
self
.
markAlertViewShow
(
false
)
self
.
bottomView
?
.
cancel
=
true
if
restore
==
false
{
if
restore
==
false
{
if
currentModel
.
dataSources
.
count
==
0
{
if
currentModel
.
dataSources
.
count
==
0
{
return
return
}
}
edit
=
!
edit
edit
=
!
edit
}
else
{
}
else
{
edit
=
false
edit
=
false
...
@@ -210,7 +211,9 @@ extension SHRecordDetailsVC {
...
@@ -210,7 +211,9 @@ extension SHRecordDetailsVC {
//MARK:icloud上传Models
//MARK:icloud上传Models
func
icloundUpload
(
_
index
:
NSInteger
){
func
icloundUpload
(
_
index
:
NSInteger
){
let
model
=
currentModel
.
dataSources
[
index
]
let
model
=
currentModel
.
dataSources
[
index
]
if
model
.
processing
==
true
{
return
}
var
contains
=
false
var
contains
=
false
for
folderModel
in
SHCloudManager
.
shared
.
icloudFolderModels
{
for
folderModel
in
SHCloudManager
.
shared
.
icloudFolderModels
{
if
currentModel
.
id
==
folderModel
.
id
{
if
currentModel
.
id
==
folderModel
.
id
{
...
@@ -219,10 +222,12 @@ extension SHRecordDetailsVC {
...
@@ -219,10 +222,12 @@ extension SHRecordDetailsVC {
}
}
}
}
model
.
processing
=
true
if
contains
{
if
contains
{
SHCloudManager
.
shared
.
addNewRecord
(
model
)
{
(
result
,
models
)
in
SHCloudManager
.
shared
.
addNewRecord
(
model
)
{
(
result
,
models
)
in
if
result
{
if
result
{
model
.
icloud
=
true
model
.
icloud
=
true
model
.
processing
=
false
SHCloudManager
.
shared
.
modifyFolder
(
self
.
currentModel
)
{
(
result
,
models
)
in
SHCloudManager
.
shared
.
modifyFolder
(
self
.
currentModel
)
{
(
result
,
models
)
in
if
result
{
if
result
{
self
.
updateocloudUI
()
self
.
updateocloudUI
()
...
@@ -234,6 +239,7 @@ extension SHRecordDetailsVC {
...
@@ -234,6 +239,7 @@ extension SHRecordDetailsVC {
SHCloudManager
.
shared
.
addNewRecord
(
model
)
{
(
result
,
models
)
in
SHCloudManager
.
shared
.
addNewRecord
(
model
)
{
(
result
,
models
)
in
if
result
{
if
result
{
model
.
icloud
=
true
model
.
icloud
=
true
model
.
processing
=
false
SHCloudManager
.
shared
.
addNewFolder
(
self
.
currentModel
)
{
(
result
,
models
)
in
SHCloudManager
.
shared
.
addNewFolder
(
self
.
currentModel
)
{
(
result
,
models
)
in
if
result
{
if
result
{
self
.
updateocloudUI
()
self
.
updateocloudUI
()
...
@@ -310,11 +316,8 @@ extension SHRecordDetailsVC {
...
@@ -310,11 +316,8 @@ extension SHRecordDetailsVC {
if
self
.
currentModel
.
dataSources
.
count
==
0
{
if
self
.
currentModel
.
dataSources
.
count
==
0
{
self
.
editClick
(
true
)
self
.
editClick
(
true
)
self
.
markAlertViewShow
(
false
)
self
.
bottomView
?
.
cancel
=
true
}
}
self
.
selectRecordModels
=
[]
self
.
selectRecordModels
=
[]
// edit = false
DispatchQueue
.
main
.
async
{
DispatchQueue
.
main
.
async
{
self
.
tableView
?
.
reloadData
()
self
.
tableView
?
.
reloadData
()
}
}
...
...
ShorthandMaster/Record/SHRecordListViewController.swift
View file @
446c75f7
...
@@ -158,93 +158,23 @@ class SHRecordListViewController: SHBaseViewController {
...
@@ -158,93 +158,23 @@ class SHRecordListViewController: SHBaseViewController {
}
}
}
}
var
list
=
keyValueStore
.
object
(
forKey
:
"Folderlist"
)
as?
[
Dictionary
<
String
,
Any
>
]
switch
CRUserDefaults
.
sortType
{
if
list
==
nil
{
case
0
:
list
=
keyValueStore
.
object
(
forKey
:
"list"
)
as?
[
Dictionary
<
String
,
Any
>
]
dataSources
.
sort
{
(
model0
,
model1
)
->
Bool
in
}
return
model0
.
createDate
.
compare
(
model1
.
createDate
)
==
ComparisonResult
.
orderedDescending
list
=
nil
if
let
list
=
list
{
var
folderModel
=
SHRecordFolderModel
()
if
let
sub
=
list
.
first
{
folderModel
=
getDataDictWith
(
dict
:
sub
)
if
folderModel
.
id
.
length
==
0
{
folderModel
.
createDate
=
nowDate
folderModel
.
modifyDate
=
nowDate
folderModel
.
name
=
"未知"
;
folderModel
.
id
=
nowDate
.
milliStamp
for
dic
in
list
.
reversed
(){
var
model
=
SHRecordModel
()
model
=
getDataDictWith
(
dict
:
dic
)
folderModel
.
dataSources
.
append
(
model
)
}
let
modifyDateSortDataSources
=
folderModel
.
dataSources
.
sorted
{
(
model0
,
model1
)
->
Bool
in
return
model0
.
modifyDate
.
compare
(
model1
.
modifyDate
)
==
ComparisonResult
.
orderedDescending
}
folderModel
.
modifyDate
=
modifyDateSortDataSources
.
first
?
.
modifyDate
??
nowDate
let
modelDict
=
getDictWith
(
obj
:
folderModel
)
keyValueStore
.
set
([
modelDict
],
forKey
:
"Folderlist"
)
keyValueStore
.
synchronize
()
print
(
"synchronize ===
\(
keyValueStore
.
synchronize
()
)
"
)
}
}
}
topDataSources
.
sort
{
(
model0
,
model1
)
->
Bool
in
// let modityList = keyValueStore.object(forKey: "Folderlist") as? [Dictionary<String, Any>]
return
model0
.
createDate
.
compare
(
model1
.
createDate
)
==
ComparisonResult
.
orderedDescending
// if let list = modityList {
// for dict in list.reversed(){
// var model = SHRecordFolderModel()
// model = getDataDictWith(dict: dict)
// if model.top == true {
// topDataSources.append(model)
// }else{
// dataSources.append(model)
// }
// }
// }
dataSources
=
dataSources
.
filterDuplicates
({
$0
.
id
})
topDataSources
=
topDataSources
.
filterDuplicates
({
$0
.
id
})
switch
CRUserDefaults
.
sortType
{
case
0
:
dataSources
.
sort
{
(
model0
,
model1
)
->
Bool
in
return
model0
.
createDate
.
compare
(
model1
.
createDate
)
==
ComparisonResult
.
orderedDescending
}
topDataSources
.
sort
{
(
model0
,
model1
)
->
Bool
in
return
model0
.
createDate
.
compare
(
model1
.
createDate
)
==
ComparisonResult
.
orderedDescending
}
break
default
:
dataSources
.
sort
{
(
model0
,
model1
)
->
Bool
in
return
model0
.
modifyDate
.
compare
(
model1
.
modifyDate
)
==
ComparisonResult
.
orderedDescending
}
topDataSources
.
sort
{
(
model0
,
model1
)
->
Bool
in
return
model0
.
modifyDate
.
compare
(
model1
.
modifyDate
)
==
ComparisonResult
.
orderedDescending
}
break
}
}
}
else
{
break
switch
CRUserDefaults
.
sortType
{
default
:
case
0
:
dataSources
.
sort
{
(
model0
,
model1
)
->
Bool
in
dataSources
.
sort
{
(
model0
,
model1
)
->
Bool
in
return
model0
.
modifyDate
.
compare
(
model1
.
modifyDate
)
==
ComparisonResult
.
orderedDescending
return
model0
.
createDate
.
compare
(
model1
.
createDate
)
==
ComparisonResult
.
orderedDescending
}
}
topDataSources
.
sort
{
(
model0
,
model1
)
->
Bool
in
topDataSources
.
sort
{
(
model0
,
model1
)
->
Bool
in
return
model0
.
modifyDate
.
compare
(
model1
.
modifyDate
)
==
ComparisonResult
.
orderedDescending
return
model0
.
createDate
.
compare
(
model1
.
createDate
)
==
ComparisonResult
.
orderedDescending
}
break
default
:
dataSources
.
sort
{
(
model0
,
model1
)
->
Bool
in
return
model0
.
modifyDate
.
compare
(
model1
.
modifyDate
)
==
ComparisonResult
.
orderedDescending
}
topDataSources
.
sort
{
(
model0
,
model1
)
->
Bool
in
return
model0
.
modifyDate
.
compare
(
model1
.
modifyDate
)
==
ComparisonResult
.
orderedDescending
}
break
}
}
break
}
}
dataSources
=
topDataSources
+
dataSources
dataSources
=
topDataSources
+
dataSources
...
@@ -260,7 +190,6 @@ class SHRecordListViewController: SHBaseViewController {
...
@@ -260,7 +190,6 @@ class SHRecordListViewController: SHBaseViewController {
self
.
view
.
sendSubviewToBack
(
maskView
)
self
.
view
.
sendSubviewToBack
(
maskView
)
}
}
markCountLab
?
.
text
=
"笔记本总数:
\(
dataSources
.
count
)
"
markCountLab
?
.
text
=
"笔记本总数:
\(
dataSources
.
count
)
"
}
}
@objc
func
mineCilck
(){
@objc
func
mineCilck
(){
...
@@ -541,7 +470,7 @@ extension SHRecordListViewController: UITableViewDelegate, UITableViewDataSource
...
@@ -541,7 +470,7 @@ extension SHRecordListViewController: UITableViewDelegate, UITableViewDataSource
self
.
removeModel
(
indexPath
)
self
.
removeModel
(
indexPath
)
completionHandler
(
tru
e
)
completionHandler
(
fals
e
)
}
}
deleteAction
.
image
=
UIImage
.
init
(
named
:
"recordlist_delete"
)
deleteAction
.
image
=
UIImage
.
init
(
named
:
"recordlist_delete"
)
deleteAction
.
backgroundColor
=
UIColor
.
init
(
hexStr
:
"E93425"
)
deleteAction
.
backgroundColor
=
UIColor
.
init
(
hexStr
:
"E93425"
)
...
@@ -550,7 +479,7 @@ extension SHRecordListViewController: UITableViewDelegate, UITableViewDataSource
...
@@ -550,7 +479,7 @@ extension SHRecordListViewController: UITableViewDelegate, UITableViewDataSource
self
.
renameModel
(
indexPath
)
self
.
renameModel
(
indexPath
)
completionHandler
(
tru
e
)
completionHandler
(
fals
e
)
}
}
renameAction
.
image
=
UIImage
.
init
(
named
:
"recordlist_rename"
)
renameAction
.
image
=
UIImage
.
init
(
named
:
"recordlist_rename"
)
renameAction
.
backgroundColor
=
UIColor
.
init
(
hexStr
:
"BCBCBC"
)
renameAction
.
backgroundColor
=
UIColor
.
init
(
hexStr
:
"BCBCBC"
)
...
...
ShorthandMaster/Record/SHRecordMoveFileVC.swift
View file @
446c75f7
...
@@ -151,7 +151,7 @@ class SHRecordMoveFileVC: SHBaseViewController {
...
@@ -151,7 +151,7 @@ class SHRecordMoveFileVC: SHBaseViewController {
}
}
}
}
}
}
MBProgressHUD
.
show
(
"正在
处理
中,请稍后..."
,
view
:
nil
)
MBProgressHUD
.
show
(
"正在
转移
中,请稍后..."
,
view
:
nil
)
let
list
=
CRUserDefaults
.
recordList
let
list
=
CRUserDefaults
.
recordList
if
var
recordList
=
list
{
if
var
recordList
=
list
{
//增
//增
...
@@ -183,32 +183,43 @@ class SHRecordMoveFileVC: SHBaseViewController {
...
@@ -183,32 +183,43 @@ class SHRecordMoveFileVC: SHBaseViewController {
}
}
SHCloudManager
.
shared
.
modifyFolder
(
self
.
currentModel
)
{
(
result
,
models
)
in
SHCloudManager
.
shared
.
modifyFolder
(
self
.
currentModel
)
{
(
result
,
models
)
in
if
result
{
var
contains
=
false
var
contains
=
false
for
folderModel
in
SHCloudManager
.
shared
.
icloudFolderModels
{
let
folderRecord
=
SHCloudManager
.
shared
.
icloudFolderModels
.
filter
({
$0
.
id
==
targetModel
.
id
if
targetModel
.
id
==
folderModel
.
id
{
})
.
first
contains
=
true
break
if
folderRecord
!=
nil
{
contains
=
true
}
if
contains
{
SHCloudManager
.
shared
.
modifyFolder
(
targetModel
)
{
(
result
,
models
)
in
if
result
{
self
.
saveSuccessCallBack
?(
self
.
currentModel
)
DispatchQueue
.
main
.
async
{
MBProgressHUD
.
hide
()
self
.
navigationController
?
.
dismiss
(
animated
:
true
,
completion
:
nil
)
}
}
}
}
}
if
contains
{
}
else
{
SHCloudManager
.
shared
.
modifyFolder
(
targetModel
)
{
(
result
,
models
)
in
if
result
{
let
folderRecord
=
targetModel
.
dataSources
.
filter
({
$0
.
icloud
==
true
self
.
saveSuccessCallBack
?(
self
.
currentModel
)
})
.
first
DispatchQueue
.
main
.
async
{
if
folderRecord
==
nil
{
MBProgressHUD
.
hide
(
)
self
.
saveSuccessCallBack
?(
self
.
currentModel
)
self
.
navigationController
?
.
dismiss
(
animated
:
true
,
completion
:
nil
)
DispatchQueue
.
main
.
async
{
}
MBProgressHUD
.
hide
()
}
self
.
navigationController
?
.
dismiss
(
animated
:
true
,
completion
:
nil
)
}
}
}
else
{
return
SHCloudManager
.
shared
.
addNewFolder
(
targetModel
)
{
(
result
,
models
)
in
}
if
result
{
SHCloudManager
.
shared
.
addNewFolder
(
targetModel
)
{
(
result
,
models
)
in
self
.
saveSuccessCallBack
?(
self
.
currentModel
)
if
result
{
DispatchQueue
.
main
.
async
{
self
.
saveSuccessCallBack
?(
self
.
currentModel
)
MBProgressHUD
.
hide
()
DispatchQueue
.
main
.
async
{
self
.
navigationController
?
.
dismiss
(
animated
:
true
,
completion
:
nil
)
MBProgressHUD
.
hide
(
)
}
self
.
navigationController
?
.
dismiss
(
animated
:
true
,
completion
:
nil
)
}
}
}
}
}
}
...
...
ShorthandMaster/Record/SHRecordViewController.swift
View file @
446c75f7
...
@@ -263,10 +263,6 @@ class SHRecordViewController: SHBaseViewController{
...
@@ -263,10 +263,6 @@ class SHRecordViewController: SHBaseViewController{
func
saveContent
(){
func
saveContent
(){
// if currentTxt?.length == 0 {
// return
// }
let
nowDate
=
Date
()
let
nowDate
=
Date
()
let
model
=
SHRecordModel
()
let
model
=
SHRecordModel
()
model
.
recordingType
=
0
model
.
recordingType
=
0
...
@@ -279,17 +275,17 @@ class SHRecordViewController: SHBaseViewController{
...
@@ -279,17 +275,17 @@ class SHRecordViewController: SHBaseViewController{
model
.
pcmPathFile
=
pcm_file_path
model
.
pcmPathFile
=
pcm_file_path
model
.
during
=
seconds
model
.
during
=
seconds
image_file_paths
=
[]
//
image_file_paths = []
image_indexs
=
[]
//
image_indexs = []
let
images
=
[
"recordlist_no_data_search"
,
"recordlist_no_data"
]
//
let images = ["recordlist_no_data_search", "recordlist_no_data"]
for
(
index
,
imageStr
)
in
images
.
enumerated
(){
//
for (index, imageStr) in images.enumerated(){
let
image
=
UIImage
.
init
(
named
:
imageStr
)
//
let image = UIImage.init(named: imageStr)
let
filePath
=
DocumentPath
+
image_file_path
+
"
\(
index
)
.jpeg"
//
let filePath = DocumentPath+image_file_path+"\(index).jpeg"
let
imageData
=
image
!.
jpegData
(
compressionQuality
:
1
)
//
let imageData = image!.jpegData(compressionQuality: 1)
try
?
imageData
?
.
write
(
to
:
URL
(
fileURLWithPath
:
filePath
))
//
try? imageData?.write(to: URL(fileURLWithPath: filePath))
image_file_paths
.
append
(
image_file_path
+
"
\(
index
)
.jpeg"
)
//
image_file_paths.append(image_file_path+"\(index).jpeg")
image_indexs
.
append
(
index
)
//
image_indexs.append(index)
}
//
}
model
.
imagesPath
=
[]
model
.
imagesPath
=
[]
model
.
imagesIndex
=
[]
model
.
imagesIndex
=
[]
...
...
ShorthandMaster/Share/Managers/SHAVAudioManager.swift
View file @
446c75f7
...
@@ -177,6 +177,7 @@ class SHAVAudioManager: NSObject {
...
@@ -177,6 +177,7 @@ class SHAVAudioManager: NSObject {
let
lowPassResults
=
pow
(
10
,
(
0.05
*
(
self
.
monitor
?
.
peakPower
(
forChannel
:
0
))
!
));
let
lowPassResults
=
pow
(
10
,
(
0.05
*
(
self
.
monitor
?
.
peakPower
(
forChannel
:
0
))
!
));
decibelsCallBack
?(
lowPassResults
)
decibelsCallBack
?(
lowPassResults
)
// print("lowPassResults == \(lowPassResults)")
// print("decibels == \(decibels)")
// print("decibels == \(decibels)")
if
decibels
>
-
44
{
if
decibels
>
-
44
{
if
recognitionTask
?
.
isCancelled
==
true
&&
self
.
state
==
SHRecordState
.
start
{
if
recognitionTask
?
.
isCancelled
==
true
&&
self
.
state
==
SHRecordState
.
start
{
...
@@ -260,7 +261,7 @@ class SHAVAudioManager: NSObject {
...
@@ -260,7 +261,7 @@ class SHAVAudioManager: NSObject {
return
$0
+
" "
+
$1
return
$0
+
" "
+
$1
}}
}}
)
)
if
recorderResult
.
hasSuffix
(
"
\n
"
)
{
if
recorderResult
.
hasSuffix
(
"
\n
"
)
||
recorderResult
.
length
==
0
{
recorderResult
=
recorderResult
+
processStr
recorderResult
=
recorderResult
+
processStr
}
else
{
}
else
{
recorderResult
=
recorderResult
+
" "
+
processStr
recorderResult
=
recorderResult
+
" "
+
processStr
...
...
ShorthandMaster/Share/Managers/SHCloudManager.swift
View file @
446c75f7
...
@@ -41,6 +41,7 @@ class SHCloudManager: NSObject {
...
@@ -41,6 +41,7 @@ class SHCloudManager: NSObject {
container
.
accountStatus
{
(
status
,
statusError
)
in
container
.
accountStatus
{
(
status
,
statusError
)
in
if
let
error
=
statusError
{
if
let
error
=
statusError
{
MBProgressHUD
.
showError
(
"未知错误,终止操作"
)
self
.
statusHandler
?(
false
)
self
.
statusHandler
?(
false
)
print
(
"
\(
error
.
localizedDescription
)
"
)
print
(
"
\(
error
.
localizedDescription
)
"
)
}
else
{
}
else
{
...
@@ -48,7 +49,12 @@ class SHCloudManager: NSObject {
...
@@ -48,7 +49,12 @@ class SHCloudManager: NSObject {
case
.
available
:
case
.
available
:
self
.
statusHandler
?(
true
)
self
.
statusHandler
?(
true
)
break
;
break
;
case
.
noAccount
:
MBProgressHUD
.
showError
(
"请确认您的iCloid是否开启"
)
self
.
statusHandler
?(
false
)
break
;
default
:
default
:
MBProgressHUD
.
showError
(
"未知错误,终止操作"
)
self
.
statusHandler
?(
false
)
self
.
statusHandler
?(
false
)
break
;
break
;
}
}
...
@@ -60,18 +66,24 @@ class SHCloudManager: NSObject {
...
@@ -60,18 +66,24 @@ class SHCloudManager: NSObject {
completionHandler
=
handler
completionHandler
=
handler
let
predicate
=
NSPredicate
.
init
(
value
:
true
)
self
.
cheakAccountStatus
{
result
in
let
query
=
CKQuery
.
init
(
recordType
:
recordFolderName
,
predicate
:
predicate
)
if
result
==
true
{
let
predicate
=
NSPredicate
.
init
(
value
:
true
)
let
query
=
CKQuery
.
init
(
recordType
:
self
.
recordFolderName
,
predicate
:
predicate
)
dateBase
.
perform
(
query
,
inZoneWith
:
nil
)
{
(
records
,
queryError
)
in
self
.
dateBase
.
perform
(
query
,
inZoneWith
:
nil
)
{
(
records
,
queryError
)
in
if
let
error
=
queryError
{
if
let
error
=
queryError
{
print
(
"
\(
error
.
localizedDescription
)
"
)
print
(
"
\(
error
.
localizedDescription
)
"
)
self
.
completionHandler
?(
false
,
[])
}
else
{
self
.
folderResults
=
records
??
[]
self
.
getAllRecordDataSource
(
handler
)
// self.cleanAllFolder()
}
}
}
else
{
self
.
completionHandler
?(
false
,
[])
self
.
completionHandler
?(
false
,
[])
}
else
{
self
.
folderResults
=
records
??
[]
self
.
getAllRecordDataSource
(
handler
)
// self.cleanAllFolder()
}
}
}
}
}
}
...
@@ -80,19 +92,25 @@ class SHCloudManager: NSObject {
...
@@ -80,19 +92,25 @@ class SHCloudManager: NSObject {
completionHandler
=
handler
completionHandler
=
handler
let
predicate
=
NSPredicate
.
init
(
value
:
true
)
self
.
cheakAccountStatus
{
result
in
let
query
=
CKQuery
.
init
(
recordType
:
recordName
,
predicate
:
predicate
)
if
result
==
true
{
let
predicate
=
NSPredicate
.
init
(
value
:
true
)
let
query
=
CKQuery
.
init
(
recordType
:
self
.
recordName
,
predicate
:
predicate
)
dateBase
.
perform
(
query
,
inZoneWith
:
nil
)
{
(
records
,
queryError
)
in
self
.
dateBase
.
perform
(
query
,
inZoneWith
:
nil
)
{
(
records
,
queryError
)
in
if
let
error
=
queryError
{
if
let
error
=
queryError
{
print
(
"
\(
error
.
localizedDescription
)
"
)
print
(
"
\(
error
.
localizedDescription
)
"
)
self
.
completionHandler
?(
false
,
[])
}
else
{
self
.
recordResults
=
records
??
[]
self
.
mapDataSource
()
self
.
completionHandler
?(
true
,
self
.
icloudFolderModels
)
// self.cleanAllRecord()
}
}
}
else
{
self
.
completionHandler
?(
false
,
[])
self
.
completionHandler
?(
false
,
[])
}
else
{
self
.
recordResults
=
records
??
[]
self
.
mapDataSource
()
self
.
completionHandler
?(
true
,
self
.
icloudFolderModels
)
// self.cleanAllRecord()
}
}
}
}
}
}
...
@@ -196,15 +214,21 @@ class SHCloudManager: NSObject {
...
@@ -196,15 +214,21 @@ class SHCloudManager: NSObject {
folderRecord
.
setValue
(
model
.
modifyDate
,
forKey
:
"modifyDate"
)
folderRecord
.
setValue
(
model
.
modifyDate
,
forKey
:
"modifyDate"
)
folderRecord
.
setValue
(
model
.
top
,
forKey
:
"top"
)
folderRecord
.
setValue
(
model
.
top
,
forKey
:
"top"
)
folderRecord
.
setValue
(
recordPaths
,
forKey
:
"recordPaths"
)
folderRecord
.
setValue
(
recordPaths
,
forKey
:
"recordPaths"
)
dateBase
.
save
(
folderRecord
)
{
(
subscription
,
saveError
)
in
self
.
cheakAccountStatus
{
result
in
if
let
error
=
saveError
{
if
result
==
true
{
print
(
"
\(
error
.
localizedDescription
)
"
)
self
.
dateBase
.
save
(
folderRecord
)
{
(
subscription
,
saveError
)
in
if
let
error
=
saveError
{
print
(
"
\(
error
.
localizedDescription
)
"
)
self
.
completionHandler
?(
false
,
[])
}
else
{
self
.
folderResults
.
append
(
folderRecord
)
self
.
mapDataSource
()
self
.
completionHandler
?(
true
,
self
.
icloudFolderModels
)
}
}
}
else
{
self
.
completionHandler
?(
false
,
[])
self
.
completionHandler
?(
false
,
[])
}
else
{
self
.
folderResults
.
append
(
folderRecord
)
self
.
mapDataSource
()
self
.
completionHandler
?(
true
,
self
.
icloudFolderModels
)
}
}
}
}
}
}
...
@@ -217,46 +241,53 @@ class SHCloudManager: NSObject {
...
@@ -217,46 +241,53 @@ class SHCloudManager: NSObject {
return
item
[
"pathFile"
]
==
recordModel
.
pathFile
return
item
[
"pathFile"
]
==
recordModel
.
pathFile
})
.
first
})
.
first
if
recording
==
nil
{
if
recording
!=
nil
{
let
documentsFile
=
DocumentPath
.
appending
(
recordModel
.
pathFile
)
self
.
completionHandler
?(
false
,
[])
let
url
=
URL
.
init
(
fileURLWithPath
:
documentsFile
)
return
}
let
documentsFile
=
DocumentPath
.
appending
(
recordModel
.
pathFile
)
let
url
=
URL
.
init
(
fileURLWithPath
:
documentsFile
)
let
asset
=
CKAsset
.
init
(
fileURL
:
url
)
let
nowDate
=
Date
()
let
record
=
CKRecord
.
init
(
recordType
:
recordName
)
record
.
setValue
(
recordModel
.
recordingType
,
forKey
:
"recordingType"
)
record
.
setValue
(
recordModel
.
rename
,
forKey
:
"title"
)
record
.
setValue
(
recordModel
.
pathFile
,
forKey
:
"pathFile"
)
record
.
setValue
(
recordModel
.
address
,
forKey
:
"address"
)
record
.
setValue
(
recordModel
.
txt
,
forKey
:
"content"
)
record
.
setValue
(
recordModel
.
during
,
forKey
:
"during"
)
record
.
setValue
(
nowDate
,
forKey
:
"createTime"
)
record
.
setValue
(
nowDate
,
forKey
:
"modifyDate"
)
record
.
setValue
(
asset
,
forKey
:
"recordAsset"
)
record
.
setValue
(
recordModel
.
imagesIndex
,
forKey
:
"imagesIndex"
)
record
.
setValue
(
recordModel
.
imagesPath
,
forKey
:
"imagesPath"
)
var
imageAssets
:[
CKAsset
]
=
[]
for
path
in
recordModel
.
imagesPath
{
let
imageFile
=
DocumentPath
.
appending
(
path
)
let
url
=
URL
.
init
(
fileURLWithPath
:
imageFile
)
let
asset
=
CKAsset
.
init
(
fileURL
:
url
)
let
asset
=
CKAsset
.
init
(
fileURL
:
url
)
let
nowDate
=
Date
()
imageAssets
.
append
(
asset
)
}
let
record
=
CKRecord
.
init
(
recordType
:
recordName
)
record
.
setValue
(
imageAssets
,
forKey
:
"imagesAsset"
)
record
.
setValue
(
recordModel
.
recordingType
,
forKey
:
"recordingType"
)
record
.
setValue
(
recordModel
.
rename
,
forKey
:
"title"
)
self
.
cheakAccountStatus
{
result
in
record
.
setValue
(
recordModel
.
pathFile
,
forKey
:
"pathFile"
)
if
result
==
true
{
record
.
setValue
(
recordModel
.
address
,
forKey
:
"address"
)
self
.
dateBase
.
save
(
record
)
{
(
subscription
,
saveError
)
in
record
.
setValue
(
recordModel
.
txt
,
forKey
:
"content"
)
if
let
error
=
saveError
{
record
.
setValue
(
recordModel
.
during
,
forKey
:
"during"
)
print
(
"
\(
error
.
localizedDescription
)
"
)
record
.
setValue
(
nowDate
,
forKey
:
"createTime"
)
self
.
completionHandler
?(
false
,
[])
record
.
setValue
(
nowDate
,
forKey
:
"modifyDate"
)
}
else
{
record
.
setValue
(
asset
,
forKey
:
"recordAsset"
)
self
.
recordResults
.
append
(
record
)
self
.
mapDataSource
()
record
.
setValue
(
recordModel
.
imagesIndex
,
forKey
:
"imagesIndex"
)
self
.
completionHandler
?(
true
,
self
.
icloudFolderModels
)
record
.
setValue
(
recordModel
.
imagesPath
,
forKey
:
"imagesPath"
)
}
var
imageAssets
:[
CKAsset
]
=
[]
for
path
in
recordModel
.
imagesPath
{
let
imageFile
=
DocumentPath
.
appending
(
path
)
let
url
=
URL
.
init
(
fileURLWithPath
:
imageFile
)
let
asset
=
CKAsset
.
init
(
fileURL
:
url
)
imageAssets
.
append
(
asset
)
}
record
.
setValue
(
imageAssets
,
forKey
:
"imagesAsset"
)
dateBase
.
save
(
record
)
{
(
subscription
,
saveError
)
in
if
let
error
=
saveError
{
print
(
"
\(
error
.
localizedDescription
)
"
)
self
.
completionHandler
?(
false
,
[])
}
else
{
self
.
recordResults
.
append
(
record
)
self
.
mapDataSource
()
self
.
completionHandler
?(
true
,
self
.
icloudFolderModels
)
}
}
}
else
{
self
.
completionHandler
?(
false
,
[])
}
}
}
else
{
}
}
}
}
...
@@ -276,30 +307,40 @@ class SHCloudManager: NSObject {
...
@@ -276,30 +307,40 @@ class SHCloudManager: NSObject {
return
item
[
"id"
]
==
folderModel
.
id
return
item
[
"id"
]
==
folderModel
.
id
})
.
first
})
.
first
dateBase
.
fetch
(
withRecordID
:
folderRecord
!.
recordID
)
{
(
record
,
fetchError
)
in
if
folderRecord
==
nil
{
self
.
completionHandler
?(
false
,
[])
if
let
error
=
fetchError
{
return
print
(
"
\(
error
.
localizedDescription
)
"
)
}
self
.
completionHandler
?(
false
,
[])
}
else
{
self
.
cheakAccountStatus
{
result
in
let
nowDate
=
Date
()
if
result
==
true
{
record
?[
"recordPaths"
]
=
recordPaths
self
.
dateBase
.
fetch
(
withRecordID
:
folderRecord
!.
recordID
)
{
(
record
,
fetchError
)
in
record
?[
"modifyDate"
]
=
nowDate
if
let
error
=
fetchError
{
self
.
dateBase
.
save
(
record
!
)
{
(
saveRecord
,
saveError
)
in
if
let
error
=
saveError
{
print
(
"
\(
error
.
localizedDescription
)
"
)
print
(
"
\(
error
.
localizedDescription
)
"
)
self
.
completionHandler
?(
false
,
[])
self
.
completionHandler
?(
false
,
[])
}
else
{
}
else
{
if
let
index
=
self
.
folderResults
.
firstIndex
(
where
:
{
let
nowDate
=
Date
()
$0
[
"id"
]
==
folderModel
.
id
record
?[
"recordPaths"
]
=
recordPaths
}){
record
?[
"modifyDate"
]
=
nowDate
self
.
folderResults
[
index
]
=
saveRecord
!
self
.
dateBase
.
save
(
record
!
)
{
(
saveRecord
,
saveError
)
in
if
let
error
=
saveError
{
print
(
"
\(
error
.
localizedDescription
)
"
)
self
.
completionHandler
?(
false
,
[])
}
else
{
if
let
index
=
self
.
folderResults
.
firstIndex
(
where
:
{
$0
[
"id"
]
==
folderModel
.
id
}){
self
.
folderResults
[
index
]
=
saveRecord
!
}
self
.
mapDataSource
()
self
.
completionHandler
?(
true
,
self
.
icloudFolderModels
)
}
}
}
self
.
mapDataSource
()
self
.
completionHandler
?(
true
,
self
.
icloudFolderModels
)
}
}
}
}
}
else
{
self
.
completionHandler
?(
false
,
[])
}
}
}
}
}
}
...
@@ -312,32 +353,37 @@ class SHCloudManager: NSObject {
...
@@ -312,32 +353,37 @@ class SHCloudManager: NSObject {
return
item
[
"pathFile"
]
==
recordModel
.
pathFile
return
item
[
"pathFile"
]
==
recordModel
.
pathFile
})
.
first
})
.
first
dateBase
.
fetch
(
withRecordID
:
recording
!.
recordID
)
{
(
record
,
fetchError
)
in
self
.
cheakAccountStatus
{
result
in
if
result
==
true
{
if
let
error
=
fetchError
{
self
.
dateBase
.
fetch
(
withRecordID
:
recording
!.
recordID
)
{
(
record
,
fetchError
)
in
print
(
"
\(
error
.
localizedDescription
)
"
)
if
let
error
=
fetchError
{
self
.
completionHandler
?(
false
,
[])
}
else
{
let
nowDate
=
Date
()
record
?
.
setValue
(
nowDate
,
forKey
:
"modifyDate"
)
self
.
dateBase
.
save
(
record
!
)
{
(
saveRecord
,
saveError
)
in
if
let
error
=
saveError
{
print
(
"
\(
error
.
localizedDescription
)
"
)
print
(
"
\(
error
.
localizedDescription
)
"
)
self
.
completionHandler
?(
false
,
[])
self
.
completionHandler
?(
false
,
[])
}
else
{
}
else
{
if
let
index
=
self
.
recordResults
.
firstIndex
(
where
:
{
let
nowDate
=
Date
()
$0
[
"pathFile"
]
==
recordModel
.
pathFile
record
?
.
setValue
(
nowDate
,
forKey
:
"modifyDate"
)
}){
self
.
recordResults
[
index
]
=
saveRecord
!
self
.
dateBase
.
save
(
record
!
)
{
(
saveRecord
,
saveError
)
in
if
let
error
=
saveError
{
print
(
"
\(
error
.
localizedDescription
)
"
)
self
.
completionHandler
?(
false
,
[])
}
else
{
if
let
index
=
self
.
recordResults
.
firstIndex
(
where
:
{
$0
[
"pathFile"
]
==
recordModel
.
pathFile
}){
self
.
recordResults
[
index
]
=
saveRecord
!
}
self
.
mapDataSource
()
self
.
completionHandler
?(
true
,
self
.
icloudFolderModels
)
}
}
}
self
.
mapDataSource
()
self
.
completionHandler
?(
true
,
self
.
icloudFolderModels
)
}
}
}
}
}
else
{
self
.
completionHandler
?(
false
,
[])
}
}
}
}
}
}
...
@@ -355,19 +401,25 @@ class SHCloudManager: NSObject {
...
@@ -355,19 +401,25 @@ class SHCloudManager: NSObject {
return
return
}
}
dateBase
.
delete
(
withRecordID
:
folderRecord
!.
recordID
)
{
(
recordID
,
deleteError
)
in
self
.
cheakAccountStatus
{
result
in
if
result
==
true
{
if
let
error
=
deleteError
{
self
.
dateBase
.
delete
(
withRecordID
:
folderRecord
!.
recordID
)
{
(
recordID
,
deleteError
)
in
print
(
"
\(
error
.
localizedDescription
)
"
)
self
.
completionHandler
?(
false
,
[])
if
let
error
=
deleteError
{
}
else
{
print
(
"
\(
error
.
localizedDescription
)
"
)
if
let
index
=
self
.
folderResults
.
firstIndex
(
where
:
{
self
.
completionHandler
?(
false
,
[])
$0
[
"id"
]
==
folderModel
.
id
}
else
{
}){
if
let
index
=
self
.
folderResults
.
firstIndex
(
where
:
{
self
.
folderResults
.
remove
(
at
:
index
)
$0
[
"id"
]
==
folderModel
.
id
}){
self
.
folderResults
.
remove
(
at
:
index
)
}
self
.
mapDataSource
()
self
.
completionHandler
?(
true
,
self
.
icloudFolderModels
)
}
}
}
self
.
mapDataSource
()
}
else
{
self
.
completionHandler
?(
true
,
self
.
icloudFolderModels
)
self
.
completionHandler
?(
false
,
[]
)
}
}
}
}
}
}
...
@@ -384,20 +436,24 @@ class SHCloudManager: NSObject {
...
@@ -384,20 +436,24 @@ class SHCloudManager: NSObject {
self
.
completionHandler
?(
false
,
[])
self
.
completionHandler
?(
false
,
[])
return
return
}
}
self
.
cheakAccountStatus
{
result
in
dateBase
.
delete
(
withRecordID
:
record
!.
recordID
)
{
(
recordID
,
deleteError
)
in
if
result
==
true
{
self
.
dateBase
.
delete
(
withRecordID
:
record
!.
recordID
)
{
(
recordID
,
deleteError
)
in
if
let
error
=
deleteError
{
if
let
error
=
deleteError
{
print
(
"
\(
error
.
localizedDescription
)
"
)
print
(
"
\(
error
.
localizedDescription
)
"
)
self
.
completionHandler
?(
false
,
[])
self
.
completionHandler
?(
false
,
[])
}
else
{
}
else
{
if
let
index
=
self
.
recordResults
.
firstIndex
(
where
:
{
if
let
index
=
self
.
recordResults
.
firstIndex
(
where
:
{
$0
[
"pathFile"
]
==
recordModel
.
pathFile
$0
[
"pathFile"
]
==
recordModel
.
pathFile
}){
}){
self
.
recordResults
.
remove
(
at
:
index
)
self
.
recordResults
.
remove
(
at
:
index
)
}
self
.
mapDataSource
()
self
.
completionHandler
?(
true
,
self
.
icloudFolderModels
)
}
}
}
self
.
mapDataSource
()
}
else
{
self
.
completionHandler
?(
true
,
self
.
icloudFolderModels
)
self
.
completionHandler
?(
false
,
[]
)
}
}
}
}
}
}
...
...
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