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
7eca89d2
Commit
7eca89d2
authored
Sep 27, 2020
by
zhangzhe
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'branch_1.0.1' of gitlab.huolea.com:lmi/shorthandmaster into branch_1.0.1
parents
486b54c9
fd240c61
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
147 additions
and
150 deletions
+147
-150
CRConstants.swift
ShorthandMaster/Contstants/CRConstants.swift
+1
-0
SHInputController.swift
ShorthandMaster/Input/Controller/SHInputController.swift
+9
-11
SHDeleteDetailsViewController.swift
ShorthandMaster/Mine/SHDeleteDetailsViewController.swift
+6
-6
SHRecordModel.swift
ShorthandMaster/Record/Model/SHRecordModel.swift
+7
-2
SHRecordDetailsVC.swift
ShorthandMaster/Record/SHRecordDetailsVC.swift
+3
-7
SHRecordListViewController.swift
ShorthandMaster/Record/SHRecordListViewController.swift
+28
-15
SHRecordShowViewController.swift
ShorthandMaster/Record/SHRecordShowViewController.swift
+56
-41
SHRecordViewController.swift
ShorthandMaster/Record/SHRecordViewController.swift
+17
-60
SHCloudManager.swift
ShorthandMaster/Share/Managers/SHCloudManager.swift
+20
-8
No files found.
ShorthandMaster/Contstants/CRConstants.swift
View file @
7eca89d2
...
@@ -28,3 +28,4 @@ let SCREEN_HEIGHT: CGFloat = UIScreen.main.bounds.height
...
@@ -28,3 +28,4 @@ let SCREEN_HEIGHT: CGFloat = UIScreen.main.bounds.height
let
kAutoWidth
=
SCREEN_WIDTH
/
375
let
kAutoWidth
=
SCREEN_WIDTH
/
375
let
kAutoHeight
=
SCREEN_HEIGHT
/
667
let
kAutoHeight
=
SCREEN_HEIGHT
/
667
let
DocumentPath
=
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!
ShorthandMaster/Input/Controller/SHInputController.swift
View file @
7eca89d2
...
@@ -134,7 +134,7 @@ class SHInputController: SHBaseViewController
...
@@ -134,7 +134,7 @@ class SHInputController: SHBaseViewController
// MARK: 点击navigationBar右侧按钮
// MARK: 点击navigationBar右侧按钮
@objc
func
didSelectedNavRightButton
()
@objc
func
didSelectedNavRightButton
()
{
{
self
.
dataModel
.
imageArray
=
SHInputViewModel
.
getImageArrayWithTextView
(
textView
:
self
.
shInputView
.
textView
)
//
self.dataModel.imageArray = SHInputViewModel.getImageArrayWithTextView(textView: self.shInputView.textView)
self
.
dataModel
.
txt
=
self
.
shInputView
.
textView
.
text
.
substring
(
self
.
dataModel
.
rename
.
length
,
length
:
self
.
shInputView
.
textView
.
text
.
length
-
self
.
dataModel
.
rename
.
length
)
!
self
.
dataModel
.
txt
=
self
.
shInputView
.
textView
.
text
.
substring
(
self
.
dataModel
.
rename
.
length
,
length
:
self
.
shInputView
.
textView
.
text
.
length
-
self
.
dataModel
.
rename
.
length
)
!
...
@@ -149,8 +149,6 @@ class SHInputController: SHBaseViewController
...
@@ -149,8 +149,6 @@ class SHInputController: SHBaseViewController
let
modelDictionary
=
getDictWith
(
obj
:
self
.
dataModel
)
let
modelDictionary
=
getDictWith
(
obj
:
self
.
dataModel
)
recordList
?
.
append
(
<
#
T
#
#newElement
:
Dictionary
<
String
,
Any
>
##
Dictionary
<
String
,
Any
>
#
>
)
CRUserDefaults
.
recordList
=
[
modelDictionary
]
CRUserDefaults
.
recordList
=
[
modelDictionary
]
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
...
@@ -556,8 +554,8 @@ extension SHInputController
...
@@ -556,8 +554,8 @@ extension SHInputController
self
.
shInputView
.
bottomView
.
goOnAudioButton
.
isHidden
=
true
self
.
shInputView
.
bottomView
.
goOnAudioButton
.
isHidden
=
true
self
.
shInputView
.
bottomView
.
stopAudioButton
.
isHidden
=
false
self
.
shInputView
.
bottomView
.
stopAudioButton
.
isHidden
=
false
let
mp3Path
:
String
=
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!
+
"/recorder.mp3"
let
mp3Path
:
String
=
DocumentPath
+
"/recorder.mp3"
let
pcmPath
:
String
=
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!
+
"/xbMixData.caf"
let
pcmPath
:
String
=
DocumentPath
+
"/xbMixData.caf"
recorder_mp3
.
configMp3Path
(
mp3Path
,
pcmPath
:
pcmPath
)
recorder_mp3
.
configMp3Path
(
mp3Path
,
pcmPath
:
pcmPath
)
...
@@ -578,8 +576,8 @@ extension SHInputController
...
@@ -578,8 +576,8 @@ extension SHInputController
recorder_mp3
.
pause
()
recorder_mp3
.
pause
()
let
mp3Path
:
String
=
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!
+
"/recorder.mp3"
let
mp3Path
:
String
=
DocumentPath
+
"/recorder.mp3"
let
pcmPath
:
String
=
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!
+
"/xbMixData.caf"
let
pcmPath
:
String
=
DocumentPath
+
"/xbMixData.caf"
print
(
"mp3Path"
+
mp3Path
)
print
(
"mp3Path"
+
mp3Path
)
print
(
"pcmPath"
+
pcmPath
)
print
(
"pcmPath"
+
pcmPath
)
...
@@ -595,8 +593,8 @@ extension SHInputController
...
@@ -595,8 +593,8 @@ extension SHInputController
recorder_mp3
.
start
()
recorder_mp3
.
start
()
let
mp3Path
:
String
=
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!
+
"/recorder.mp3"
let
mp3Path
:
String
=
DocumentPath
+
"/recorder.mp3"
let
pcmPath
:
String
=
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!
+
"/xbMixData.caf"
let
pcmPath
:
String
=
DocumentPath
+
"/xbMixData.caf"
print
(
"mp3Path"
+
mp3Path
)
print
(
"mp3Path"
+
mp3Path
)
print
(
"pcmPath"
+
pcmPath
)
print
(
"pcmPath"
+
pcmPath
)
...
@@ -612,8 +610,8 @@ extension SHInputController
...
@@ -612,8 +610,8 @@ extension SHInputController
recorder_mp3
.
stop
()
recorder_mp3
.
stop
()
let
mp3Path
:
String
=
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!
+
"/recorder.mp3"
let
mp3Path
:
String
=
DocumentPath
+
"/recorder.mp3"
let
pcmPath
:
String
=
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!
+
"/xbMixData.caf"
let
pcmPath
:
String
=
DocumentPath
+
"/xbMixData.caf"
print
(
"mp3Path"
+
mp3Path
)
print
(
"mp3Path"
+
mp3Path
)
print
(
"pcmPath"
+
pcmPath
)
print
(
"pcmPath"
+
pcmPath
)
...
...
ShorthandMaster/Mine/SHDeleteDetailsViewController.swift
View file @
7eca89d2
...
@@ -25,10 +25,10 @@ class SHDeleteDetailsViewController: SHBaseViewController {
...
@@ -25,10 +25,10 @@ class SHDeleteDetailsViewController: SHBaseViewController {
func
prepareDateSource
(){
func
prepareDateSource
(){
dataSource
=
[]
dataSource
=
[]
var
list
=
CRUserDefaults
.
recordList
//
var list = CRUserDefaults.recordList
for
(
index
,
dic
)
in
(
list
??
[])
.
enumerated
(){
//
for (index, dic) in (list ?? []).enumerated(){
let
model
=
SHRecordModel
()
//
let model = SHRecordModel()
model
.
setValuesForKeys
(
dic
)
//
model.setValuesForKeys(dic)
// if model.delete == true{
// if model.delete == true{
// if model.deleteDate.daysBetweenDate(toDate: Date.init()) > 30 {
// if model.deleteDate.daysBetweenDate(toDate: Date.init()) > 30 {
// list?.remove(at: index)
// list?.remove(at: index)
...
@@ -36,8 +36,8 @@ class SHDeleteDetailsViewController: SHBaseViewController {
...
@@ -36,8 +36,8 @@ class SHDeleteDetailsViewController: SHBaseViewController {
// dataSource.append(model)
// dataSource.append(model)
// }
// }
// }
// }
}
//
}
CRUserDefaults
.
recordList
=
list
//
CRUserDefaults.recordList = list
}
}
func
removeModel
(
_
indexPath
:
IndexPath
){
func
removeModel
(
_
indexPath
:
IndexPath
){
...
...
ShorthandMaster/Record/Model/SHRecordModel.swift
View file @
7eca89d2
...
@@ -19,15 +19,20 @@ class SHRecordModel: NSObject{
...
@@ -19,15 +19,20 @@ class SHRecordModel: NSObject{
@objc
var
rename
:
String
=
""
@objc
var
rename
:
String
=
""
@objc
var
txt
:
String
=
""
@objc
var
txt
:
String
=
""
//录音资源
@objc
var
pathFile
:
String
=
""
@objc
var
pathFile
:
String
=
""
@objc
var
pcmPathFile
:
String
=
""
@objc
var
pcmPathFile
:
String
=
""
@objc
var
assetFileUrlPath
:
String
=
""
//录音时间 估算
@objc
var
during
:
NSInteger
=
0
@objc
var
during
:
NSInteger
=
0
//照片资源
@objc
var
images
:
[
String
]
=
[]
@objc
var
imagesPath
:
[
String
]
=
[]
@objc
var
imagesIndex
:
[
String
]
=
[]
@objc
var
selected
:
Bool
=
false
@objc
var
selected
:
Bool
=
false
@objc
var
icloud
:
Bool
=
false
@objc
var
icloud
:
Bool
=
false
@objc
var
fileData
:
Data
=
Data
()
override
func
setValue
(
_
value
:
Any
?,
forUndefinedKey
key
:
String
)
{
override
func
setValue
(
_
value
:
Any
?,
forUndefinedKey
key
:
String
)
{
}
}
...
...
ShorthandMaster/Record/SHRecordDetailsVC.swift
View file @
7eca89d2
...
@@ -388,12 +388,8 @@ extension SHRecordDetailsVC: UITableViewDelegate, UITableViewDataSource{
...
@@ -388,12 +388,8 @@ extension SHRecordDetailsVC: UITableViewDelegate, UITableViewDataSource{
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
// let show = UIStoryboard.init(name: "Record", bundle: nil).instantiateViewController(withIdentifier: "SHRecordShowViewController") as! SHRecordShowViewController
let
show
=
UIStoryboard
.
init
(
name
:
"Record"
,
bundle
:
nil
)
.
instantiateViewController
(
withIdentifier
:
"SHRecordShowViewController"
)
as!
SHRecordShowViewController
// if self.searchBarVC.isActive {
show
.
model
=
currentModel
.
dataSources
[
indexPath
.
row
]
// show.model = searchDataSource[indexPath.row]
self
.
navigationController
?
.
pushViewController
(
show
,
animated
:
true
)
// }else{
// show.model = dataSources[indexPath.row]
// }
// self.navigationController?.pushViewController(show, animated: true)
}
}
}
}
ShorthandMaster/Record/SHRecordListViewController.swift
View file @
7eca89d2
...
@@ -42,12 +42,6 @@ class SHRecordListViewController: SHBaseViewController {
...
@@ -42,12 +42,6 @@ class SHRecordListViewController: SHBaseViewController {
return
searchBarVC
return
searchBarVC
}()
}()
override
func
viewWillAppear
(
_
animated
:
Bool
)
{
super
.
viewWillAppear
(
animated
)
// prepareDateSource()
// self.tableView?.reloadData()
}
override
func
viewDidAppear
(
_
animated
:
Bool
)
{
override
func
viewDidAppear
(
_
animated
:
Bool
)
{
super
.
viewDidAppear
(
animated
)
super
.
viewDidAppear
(
animated
)
prepareDateSource
()
prepareDateSource
()
...
@@ -59,20 +53,40 @@ class SHRecordListViewController: SHBaseViewController {
...
@@ -59,20 +53,40 @@ class SHRecordListViewController: SHBaseViewController {
self
.
searchBarVC
.
isActive
=
false
self
.
searchBarVC
.
isActive
=
false
}
}
@objc
func
hehe
(
_
d
:
NSUbiquitousKeyValueStore
){
print
(
"
\(
d
)
"
)
}
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
hehe
)
,
name
:
NSUbiquitousKeyValueStore
.
didChangeExternallyNotification
,
object
:
keyValueStore
)
let
url
=
FileManager
.
default
.
url
(
forUbiquityContainerIdentifier
:
nil
)
let
url
=
FileManager
.
default
.
url
(
forUbiquityContainerIdentifier
:
nil
)
print
(
url
as
Any
)
print
(
url
as
Any
)
SHCloudManager
.
shared
.
getAllFolderDataSource
{
(
result
,
sss
)
in
SHCloudManager
.
shared
.
getAllFolderDataSource
{
(
result
,
models
)
in
if
result
{
var
localFolder
:[
SHRecordFolderModel
]
=
[]
if
var
list
=
CRUserDefaults
.
recordList
{
for
dict
in
list
{
var
folderModel
=
SHRecordFolderModel
()
folderModel
=
getDataDictWith
(
dict
:
dict
)
localFolder
.
append
(
folderModel
)
}
for
model
in
models
{
let
containModel
=
localFolder
.
filter
{
$0
.
id
==
model
.
id
}
.
first
if
containModel
==
nil
{
list
.
append
(
getDictWith
(
obj
:
model
))
}
}
CRUserDefaults
.
recordList
=
list
}
else
{
var
list
:[
Dictionary
<
String
,
Any
>
]
=
[]
for
model
in
models
{
list
.
append
(
getDictWith
(
obj
:
model
))
}
CRUserDefaults
.
recordList
=
list
}
DispatchQueue
.
main
.
async
{
self
.
prepareDateSource
()
}
}
}
}
setupUI
()
setupUI
()
...
@@ -89,7 +103,6 @@ class SHRecordListViewController: SHBaseViewController {
...
@@ -89,7 +103,6 @@ class SHRecordListViewController: SHBaseViewController {
let
leftImage
=
UIImage
.
init
(
named
:
"record_nav_setting"
)?
.
withRenderingMode
(
.
alwaysOriginal
)
let
leftImage
=
UIImage
.
init
(
named
:
"record_nav_setting"
)?
.
withRenderingMode
(
.
alwaysOriginal
)
self
.
navigationItem
.
leftBarButtonItem
=
UIBarButtonItem
.
init
(
image
:
leftImage
,
style
:
.
plain
,
target
:
self
,
action
:
#selector(
mineCilck
)
)
self
.
navigationItem
.
leftBarButtonItem
=
UIBarButtonItem
.
init
(
image
:
leftImage
,
style
:
.
plain
,
target
:
self
,
action
:
#selector(
mineCilck
)
)
searchView
=
searchBarVC
.
searchBar
searchView
=
searchBarVC
.
searchBar
searchView
.
frame
=
CGRect
(
x
:
8
,
y
:
0
,
width
:
SCREEN_WIDTH
-
16
,
height
:
56
)
searchView
.
frame
=
CGRect
(
x
:
8
,
y
:
0
,
width
:
SCREEN_WIDTH
-
16
,
height
:
56
)
self
.
tableHeaderView
?
.
addSubview
(
searchView
)
self
.
tableHeaderView
?
.
addSubview
(
searchView
)
...
...
ShorthandMaster/Record/SHRecordShowViewController.swift
View file @
7eca89d2
...
@@ -88,7 +88,7 @@ class SHRecordShowViewController: SHBaseViewController {
...
@@ -88,7 +88,7 @@ class SHRecordShowViewController: SHBaseViewController {
/*
/*
func prepareRecognition(){
func prepareRecognition(){
let documentsFile =
(NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first)!
.appending(model!.pathFile)
let documentsFile =
DocumentPath
.appending(model!.pathFile)
// let s = FileManager.default.fileExists(atPath: documentsFile)
// let s = FileManager.default.fileExists(atPath: documentsFile)
...
@@ -157,38 +157,38 @@ class SHRecordShowViewController: SHBaseViewController {
...
@@ -157,38 +157,38 @@ class SHRecordShowViewController: SHBaseViewController {
AlertControllerTool
.
alertController
(
withTitle
:
"文件重命名"
,
message
:
""
,
textField
:
"请输入新文件名"
,
cancelTitle
:
"取消"
,
cancel
:
{
AlertControllerTool
.
alertController
(
withTitle
:
"文件重命名"
,
message
:
""
,
textField
:
"请输入新文件名"
,
cancelTitle
:
"取消"
,
cancel
:
{
},
confirm
:
"确认"
,
confirmBlock
:
{
message
in
},
confirm
:
"确认"
,
confirmBlock
:
{
message
in
if
let
rename
:
String
=
message
as?
String
{
//
if let rename:String = message as? String {
self
.
model
!.
rename
=
rename
//
self.model!.rename = rename
self
.
setNavTitle
(
self
.
model
!.
rename
)
//
self.setNavTitle(self.model!.rename)
//
if
var
list
=
CRUserDefaults
.
recordList
{
//
if var list = CRUserDefaults.recordList {
for
(
index
,
dic
)
in
list
.
enumerated
(){
//
for (index, dic) in list.enumerated(){
if
dic
[
"pathFile"
]
as!
String
==
self
.
model
!.
pathFile
{
//
if dic["pathFile"] as! String == self.model!.pathFile{
var
subDic
=
dic
//
var subDic = dic
subDic
[
"rename"
]
=
rename
//
subDic["rename"] = rename
list
[
index
]
=
subDic
//
list[index] = subDic
break
//
break
}
//
}
}
//
}
CRUserDefaults
.
recordList
=
list
//
CRUserDefaults.recordList = list
}
//
}
//
let
keyValueStore
=
NSUbiquitousKeyValueStore
.
default
//
let keyValueStore = NSUbiquitousKeyValueStore.default
let
list
=
keyValueStore
.
object
(
forKey
:
"list"
)
as?
[
Dictionary
<
String
,
Any
>
]
//
let list = keyValueStore.object(forKey: "list") as? [Dictionary<String, Any>]
//
if
var
list
=
list
{
//
if var list = list {
for
(
index
,
dic
)
in
list
.
enumerated
(){
//
for (index, dic) in list.enumerated(){
if
dic
[
"pathFile"
]
as!
String
==
self
.
model
!.
pathFile
{
//
if dic["pathFile"] as! String == self.model!.pathFile{
var
subDic
=
dic
//
var subDic = dic
subDic
[
"rename"
]
=
rename
//
subDic["rename"] = rename
list
[
index
]
=
subDic
//
list[index] = subDic
break
//
break
}
//
}
}
//
}
keyValueStore
.
set
(
list
,
forKey
:
"list"
)
//
keyValueStore.set(list, forKey: "list")
keyValueStore
.
synchronize
()
//
keyValueStore.synchronize()
}
//
}
}
//
}
},
finish
:
nil
)
},
finish
:
nil
)
}
}
...
@@ -223,12 +223,25 @@ class SHRecordShowViewController: SHBaseViewController {
...
@@ -223,12 +223,25 @@ class SHRecordShowViewController: SHBaseViewController {
}
}
do
{
do
{
// documentsFile =
(NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first)!
.appending(model!.pcmPathFile)
// documentsFile =
DocumentPath
.appending(model!.pcmPathFile)
let
documentsFile
=
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!
.
appending
(
model
!.
pathFile
)
let
documentsFile
=
DocumentPath
.
appending
(
model
!.
pathFile
)
if
FileManager
.
default
.
fileExists
(
atPath
:
documentsFile
)
==
false
{
if
FileManager
.
default
.
fileExists
(
atPath
:
documentsFile
)
==
false
{
player
=
try
AVAudioPlayer
.
init
(
data
:
model
!.
fileData
)
player
=
try
AVAudioPlayer
(
contentsOf
:
URL
(
fileURLWithPath
:
model
!.
assetFileUrlPath
))
//写入
if
let
videoData
=
try
?
Data
(
contentsOf
:
URL
(
fileURLWithPath
:
model
!.
assetFileUrlPath
)){
let
range
:
Range
=
model
!.
pathFile
.
range
(
of
:
"/record.mp3"
)
!
let
location
:
Int
=
model
!.
pathFile
.
distance
(
from
:
model
!.
pathFile
.
startIndex
,
to
:
range
.
lowerBound
)
let
subStr
=
model
!.
pathFile
.
prefix
(
location
)
let
documentsFile_sub
=
DocumentPath
+
subStr
try!
FileManager
.
default
.
createDirectory
(
atPath
:
documentsFile_sub
,
withIntermediateDirectories
:
true
,
attributes
:
nil
)
SHMp3RecordManager
.
shared
()
.
write
(
videoData
,
path
:
documentsFile
)
}
}
else
{
}
else
{
player
=
try
AVAudioPlayer
(
contentsOf
:
URL
(
fileURLWithPath
:
documentsFile
))
player
=
try
AVAudioPlayer
(
contentsOf
:
URL
(
fileURLWithPath
:
documentsFile
))
}
}
...
@@ -303,7 +316,7 @@ class SHRecordShowViewController: SHBaseViewController {
...
@@ -303,7 +316,7 @@ class SHRecordShowViewController: SHBaseViewController {
let
location
:
Int
=
model
!.
pathFile
.
distance
(
from
:
model
!.
pathFile
.
startIndex
,
to
:
range
.
lowerBound
)
let
location
:
Int
=
model
!.
pathFile
.
distance
(
from
:
model
!.
pathFile
.
startIndex
,
to
:
range
.
lowerBound
)
let
subStr
=
model
!.
pathFile
.
prefix
(
location
)
let
subStr
=
model
!.
pathFile
.
prefix
(
location
)
let
documentsFile
=
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!
+
subStr
+
"/
\(
model
!.
rename
)
.pdf"
let
documentsFile
=
DocumentPath
+
subStr
+
"/
\(
model
!.
rename
)
.pdf"
try
PDFGenerator
.
generate
(
self
.
recordTextView
!
,
to
:
documentsFile
)
try
PDFGenerator
.
generate
(
self
.
recordTextView
!
,
to
:
documentsFile
)
//此三方会把传入控件约束移除 需重新添加
//此三方会把传入控件约束移除 需重新添加
...
@@ -335,7 +348,7 @@ class SHRecordShowViewController: SHBaseViewController {
...
@@ -335,7 +348,7 @@ class SHRecordShowViewController: SHBaseViewController {
do
{
do
{
let
documentsFile_mp3
=
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!
.
appending
(
model
!.
pathFile
)
let
documentsFile_mp3
=
DocumentPath
.
appending
(
model
!.
pathFile
)
let
fileURL_wav
=
URL
.
init
(
fileURLWithPath
:
documentsFile_mp3
)
let
fileURL_wav
=
URL
.
init
(
fileURLWithPath
:
documentsFile_mp3
)
//没有 先创建 有 直接拿
//没有 先创建 有 直接拿
...
@@ -344,11 +357,13 @@ class SHRecordShowViewController: SHBaseViewController {
...
@@ -344,11 +357,13 @@ class SHRecordShowViewController: SHBaseViewController {
let
location
:
Int
=
model
!.
pathFile
.
distance
(
from
:
model
!.
pathFile
.
startIndex
,
to
:
range
.
lowerBound
)
let
location
:
Int
=
model
!.
pathFile
.
distance
(
from
:
model
!.
pathFile
.
startIndex
,
to
:
range
.
lowerBound
)
let
subStr
=
model
!.
pathFile
.
prefix
(
location
)
let
subStr
=
model
!.
pathFile
.
prefix
(
location
)
let
documentsFile_sub
=
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!
+
subStr
let
documentsFile_sub
=
DocumentPath
+
subStr
try!
FileManager
.
default
.
createDirectory
(
atPath
:
documentsFile_sub
,
withIntermediateDirectories
:
true
,
attributes
:
nil
)
try!
FileManager
.
default
.
createDirectory
(
atPath
:
documentsFile_sub
,
withIntermediateDirectories
:
true
,
attributes
:
nil
)
SHMp3RecordManager
.
shared
()
.
write
(
model
!.
fileData
,
path
:
documentsFile_mp3
)
if
let
videoData
=
try
?
Data
(
contentsOf
:
URL
(
fileURLWithPath
:
model
!.
assetFileUrlPath
)){
SHMp3RecordManager
.
shared
()
.
write
(
videoData
,
path
:
documentsFile_mp3
)
}
}
}
// let data_wav = try Data.init(contentsOf: fileURL_wav)
// let data_wav = try Data.init(contentsOf: fileURL_wav)
...
@@ -357,7 +372,7 @@ class SHRecordShowViewController: SHBaseViewController {
...
@@ -357,7 +372,7 @@ class SHRecordShowViewController: SHBaseViewController {
let
location
:
Int
=
model
!.
pathFile
.
distance
(
from
:
model
!.
pathFile
.
startIndex
,
to
:
range
.
lowerBound
)
let
location
:
Int
=
model
!.
pathFile
.
distance
(
from
:
model
!.
pathFile
.
startIndex
,
to
:
range
.
lowerBound
)
let
subStr
=
model
!.
pathFile
.
prefix
(
location
)
let
subStr
=
model
!.
pathFile
.
prefix
(
location
)
let
documentsFile_rename
=
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!
+
subStr
+
"/
\(
model
!.
rename
)
.mp3"
let
documentsFile_rename
=
DocumentPath
+
subStr
+
"/
\(
model
!.
rename
)
.mp3"
let
fileURL_rename
=
URL
.
init
(
fileURLWithPath
:
documentsFile_rename
)
let
fileURL_rename
=
URL
.
init
(
fileURLWithPath
:
documentsFile_rename
)
if
FileManager
.
default
.
fileExists
(
atPath
:
documentsFile_rename
)
==
false
{
if
FileManager
.
default
.
fileExists
(
atPath
:
documentsFile_rename
)
==
false
{
...
...
ShorthandMaster/Record/SHRecordViewController.swift
View file @
7eca89d2
...
@@ -45,9 +45,10 @@ class SHRecordViewController: SHBaseViewController{
...
@@ -45,9 +45,10 @@ class SHRecordViewController: SHBaseViewController{
private
var
recordTime
=
0.00
private
var
recordTime
=
0.00
// url : 录音文件的路径
// url : 录音文件的路径
var
wav_file_path
=
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
?
.
appending
(
"/record.wav"
)
var
wav_file_path
=
DocumentPath
.
appending
(
"/record.wav"
)
var
mp3_file_path
=
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
?
.
appending
(
"/record.mp3"
)
var
mp3_file_path
=
DocumentPath
.
appending
(
"/record.mp3"
)
var
pcm_file_path
=
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
?
.
appending
(
"/xbMixData.caf"
)
var
pcm_file_path
=
DocumentPath
.
appending
(
"/xbMixData.caf"
)
var
images_file_path
:[
String
]
=
[]
var
session
:
AVAudioSession
{
var
session
:
AVAudioSession
{
let
session
:
AVAudioSession
=
AVAudioSession
.
sharedInstance
()
let
session
:
AVAudioSession
=
AVAudioSession
.
sharedInstance
()
...
@@ -314,7 +315,7 @@ class SHRecordViewController: SHBaseViewController{
...
@@ -314,7 +315,7 @@ class SHRecordViewController: SHBaseViewController{
AVEncoderAudioQualityKey
:
NSNumber
(
value
:
Int32
(
AVAudioQuality
.
min
.
rawValue
))
AVEncoderAudioQualityKey
:
NSNumber
(
value
:
Int32
(
AVAudioQuality
.
min
.
rawValue
))
]
]
do
{
do
{
let
recorder
=
try
AVAudioRecorder
(
url
:
URL
(
fileURLWithPath
:
wav_file_path
!
),
settings
:
configDic
)
let
recorder
=
try
AVAudioRecorder
(
url
:
URL
(
fileURLWithPath
:
wav_file_path
),
settings
:
configDic
)
recorder
.
isMeteringEnabled
=
true
recorder
.
isMeteringEnabled
=
true
// 准备录音(系统会给我们分配一些资源)
// 准备录音(系统会给我们分配一些资源)
recorder
.
prepareToRecord
()
recorder
.
prepareToRecord
()
...
@@ -328,13 +329,13 @@ class SHRecordViewController: SHBaseViewController{
...
@@ -328,13 +329,13 @@ class SHRecordViewController: SHBaseViewController{
private
func
configPathFile
(){
private
func
configPathFile
(){
let
fileManager
=
FileManager
.
default
let
fileManager
=
FileManager
.
default
let
fileArr
=
SHRecordViewController
.
getAllFilePath
(
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!
)
let
fileArr
=
SHRecordViewController
.
getAllFilePath
(
DocumentPath
)
let
subFile
=
Date
()
.
format
(
"yyyyMMdd"
)
let
subFile
=
Date
()
.
format
(
"yyyyMMdd"
)
var
exist
=
false
var
exist
=
false
let
time
=
Date
.
init
()
.
timeStamp
let
time
=
Date
.
init
()
.
timeStamp
for
(
_
,
documentsFile
)
in
fileArr
!.
enumerated
()
{
for
(
_
,
documentsFile
)
in
fileArr
!.
enumerated
()
{
if
documentsFile
==
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
?
.
appending
(
"/
\(
subFile
)
"
)
{
if
documentsFile
==
DocumentPath
.
appending
(
"/
\(
subFile
)
"
)
{
let
path
=
documentsFile
.
appending
(
time
)
let
path
=
documentsFile
.
appending
(
time
)
mp3_file_path
=
"/"
+
subFile
+
time
+
"/record.mp3"
mp3_file_path
=
"/"
+
subFile
+
time
+
"/record.mp3"
...
@@ -342,21 +343,21 @@ class SHRecordViewController: SHBaseViewController{
...
@@ -342,21 +343,21 @@ class SHRecordViewController: SHBaseViewController{
try!
fileManager
.
createDirectory
(
atPath
:
path
,
withIntermediateDirectories
:
true
,
attributes
:
nil
)
try!
fileManager
.
createDirectory
(
atPath
:
path
,
withIntermediateDirectories
:
true
,
attributes
:
nil
)
recorder_mp3
.
configMp3Path
(
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!+
mp3_file_path
!
,
pcmPath
:
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!+
pcm_file_path
!
)
recorder_mp3
.
configMp3Path
(
DocumentPath
+
mp3_file_path
,
pcmPath
:
DocumentPath
+
pcm_file_path
)
exist
=
true
exist
=
true
break
break
}
}
}
}
if
exist
==
false
{
if
exist
==
false
{
let
path
=
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
?
.
appending
(
"/
\(
subFile
)
"
)
.
appending
(
time
))
!
let
path
=
(
DocumentPath
.
appending
(
"/
\(
subFile
)
"
)
.
appending
(
time
))
mp3_file_path
=
"/"
+
subFile
+
time
+
"/record.mp3"
mp3_file_path
=
"/"
+
subFile
+
time
+
"/record.mp3"
pcm_file_path
=
"/"
+
subFile
+
time
+
"/xbMixData.caf"
pcm_file_path
=
"/"
+
subFile
+
time
+
"/xbMixData.caf"
try!
fileManager
.
createDirectory
(
atPath
:
path
,
withIntermediateDirectories
:
true
,
attributes
:
nil
)
try!
fileManager
.
createDirectory
(
atPath
:
path
,
withIntermediateDirectories
:
true
,
attributes
:
nil
)
recorder_mp3
.
configMp3Path
(
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!+
mp3_file_path
!
,
pcmPath
:
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!+
pcm_file_path
!
)
recorder_mp3
.
configMp3Path
(
DocumentPath
+
mp3_file_path
,
pcmPath
:
DocumentPath
+
pcm_file_path
)
}
}
NSLog
(
"mp3_file_path=======
\(
String
(
describing
:
mp3_file_path
)
)
pcm_file_path=======
\(
String
(
describing
:
pcm_file_path
)
)
"
)
NSLog
(
"mp3_file_path=======
\(
String
(
describing
:
mp3_file_path
)
)
pcm_file_path=======
\(
String
(
describing
:
pcm_file_path
)
)
"
)
...
@@ -457,7 +458,7 @@ class SHRecordViewController: SHBaseViewController{
...
@@ -457,7 +458,7 @@ class SHRecordViewController: SHBaseViewController{
recorder_mp3
.
stop
()
recorder_mp3
.
stop
()
if
let
recorder
=
self
.
recorder
{
if
let
recorder
=
self
.
recorder
{
if
recorder
.
isRecording
{
if
recorder
.
isRecording
{
print
(
"正在录音,马上结束它,文件保存到了:
\(
wav_file_path
!
)
"
)
print
(
"正在录音,马上结束它,文件保存到了:
\(
wav_file_path
)
"
)
}
else
{
}
else
{
print
(
"没有录音,但是依然结束它"
)
print
(
"没有录音,但是依然结束它"
)
}
}
...
@@ -484,8 +485,8 @@ class SHRecordViewController: SHBaseViewController{
...
@@ -484,8 +485,8 @@ class SHRecordViewController: SHBaseViewController{
model
.
address
=
currentAddress
??
""
model
.
address
=
currentAddress
??
""
model
.
rename
=
currentAddress
??
""
model
.
rename
=
currentAddress
??
""
model
.
txt
=
recognitionTaskText
.
first
??
(
self
.
currentTxt
??
""
)
model
.
txt
=
recognitionTaskText
.
first
??
(
self
.
currentTxt
??
""
)
model
.
pathFile
=
mp3_file_path
!
model
.
pathFile
=
mp3_file_path
model
.
pcmPathFile
=
pcm_file_path
!
model
.
pcmPathFile
=
pcm_file_path
model
.
during
=
seconds
model
.
during
=
seconds
var
contains
=
false
var
contains
=
false
...
@@ -522,51 +523,7 @@ class SHRecordViewController: SHBaseViewController{
...
@@ -522,51 +523,7 @@ class SHRecordViewController: SHBaseViewController{
CRUserDefaults
.
recordList
=
recordList
CRUserDefaults
.
recordList
=
recordList
}
}
}
}
currentModel
=
model
currentModel
=
model
do
{
let
documentsFile
=
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!.
appending
(
model
.
pathFile
)
let
url
=
URL
.
init
(
fileURLWithPath
:
documentsFile
)
let
data
=
try
Data
.
init
(
contentsOf
:
url
)
model
.
fileData
=
data
if
folderModel
.
dataSources
.
count
!=
0
{
for
(
index
,
subModel
)
in
folderModel
.
dataSources
.
enumerated
()
{
if
subModel
.
pathFile
==
model
.
pathFile
{
folderModel
.
dataSources
[
index
]
=
model
break
}
}
}
else
{
folderModel
.
dataSources
.
append
(
model
)
}
// let keyValueStore = NSUbiquitousKeyValueStore.default
// let list = keyValueStore.object(forKey: "Folderlist") as? [Dictionary<String, Any>]
//
// if var recordList = list{
// for (index, subDict) in recordList.enumerated(){
// let subFolderModel:SHRecordFolderModel = getDataDictWith(dict: subDict)
// if subFolderModel.id == folderModel.id {
// contains = true
// subFolderModel.modifyDate = nowDate
// subFolderModel.dataSources = folderModel.dataSources
// let dic = getDictWith(obj: subFolderModel)
// recordList[index] = dic
// break
// }
// }
// if contains == true {
// keyValueStore.set(recordList, forKey: "Folderlist")
// keyValueStore.synchronize()
// }
// }
currentModel
=
model
}
catch
{
}
}
}
func
removeCurrentRecored
(
_
model
:
SHRecordModel
){
func
removeCurrentRecored
(
_
model
:
SHRecordModel
){
...
@@ -701,7 +658,7 @@ extension SHRecordViewController{
...
@@ -701,7 +658,7 @@ extension SHRecordViewController{
let
location
:
Int
=
currentModel
!.
pathFile
.
distance
(
from
:
currentModel
!.
pathFile
.
startIndex
,
to
:
range
.
lowerBound
)
let
location
:
Int
=
currentModel
!.
pathFile
.
distance
(
from
:
currentModel
!.
pathFile
.
startIndex
,
to
:
range
.
lowerBound
)
let
subStr
=
currentModel
!.
pathFile
.
prefix
(
location
)
let
subStr
=
currentModel
!.
pathFile
.
prefix
(
location
)
let
documentsFile
=
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!
+
subStr
+
"/
\(
currentModel
!.
rename
)
.pdf"
let
documentsFile
=
DocumentPath
+
subStr
+
"/
\(
currentModel
!.
rename
)
.pdf"
try
PDFGenerator
.
generate
(
self
.
recordTextView
!
,
to
:
documentsFile
)
try
PDFGenerator
.
generate
(
self
.
recordTextView
!
,
to
:
documentsFile
)
//此三方会把传入控件约束移除 需重新添加
//此三方会把传入控件约束移除 需重新添加
...
@@ -732,7 +689,7 @@ extension SHRecordViewController{
...
@@ -732,7 +689,7 @@ extension SHRecordViewController{
private
func
generateWav
()
{
private
func
generateWav
()
{
do
{
do
{
let
documentsFile_wav
=
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!
.
appending
(
currentModel
!.
pathFile
)
let
documentsFile_wav
=
DocumentPath
.
appending
(
currentModel
!.
pathFile
)
let
fileURL_wav
=
URL
.
init
(
fileURLWithPath
:
documentsFile_wav
)
let
fileURL_wav
=
URL
.
init
(
fileURLWithPath
:
documentsFile_wav
)
// let data_wav = try Data.init(contentsOf: fileURL_wav)
// let data_wav = try Data.init(contentsOf: fileURL_wav)
...
@@ -740,7 +697,7 @@ extension SHRecordViewController{
...
@@ -740,7 +697,7 @@ extension SHRecordViewController{
let
location
:
Int
=
currentModel
!.
pathFile
.
distance
(
from
:
currentModel
!.
pathFile
.
startIndex
,
to
:
range
.
lowerBound
)
let
location
:
Int
=
currentModel
!.
pathFile
.
distance
(
from
:
currentModel
!.
pathFile
.
startIndex
,
to
:
range
.
lowerBound
)
let
subStr
=
currentModel
!.
pathFile
.
prefix
(
location
)
let
subStr
=
currentModel
!.
pathFile
.
prefix
(
location
)
let
documentsFile_rename
=
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!
+
subStr
+
"/
\(
currentModel
!.
rename
)
.mp3"
let
documentsFile_rename
=
DocumentPath
+
subStr
+
"/
\(
currentModel
!.
rename
)
.mp3"
let
fileURL_rename
=
URL
.
init
(
fileURLWithPath
:
documentsFile_rename
)
let
fileURL_rename
=
URL
.
init
(
fileURLWithPath
:
documentsFile_rename
)
if
FileManager
.
default
.
fileExists
(
atPath
:
documentsFile_rename
)
==
false
{
if
FileManager
.
default
.
fileExists
(
atPath
:
documentsFile_rename
)
==
false
{
...
...
ShorthandMaster/Share/Managers/SHCloudManager.swift
View file @
7eca89d2
...
@@ -135,11 +135,13 @@ class SHCloudManager: NSObject {
...
@@ -135,11 +135,13 @@ class SHCloudManager: NSObject {
recordModel
.
pathFile
=
record
[
"pathFile"
]
as?
String
??
""
recordModel
.
pathFile
=
record
[
"pathFile"
]
as?
String
??
""
recordModel
.
rename
=
record
[
"title"
]
as?
String
??
""
recordModel
.
rename
=
record
[
"title"
]
as?
String
??
""
recordModel
.
txt
=
record
[
"content"
]
as?
String
??
""
recordModel
.
txt
=
record
[
"content"
]
as?
String
??
""
recordModel
.
during
=
record
[
"during"
]
as?
NSInteger
??
0
recordModel
.
createDate
=
record
[
"createDate"
]
as?
Date
??
Date
(
timeIntervalSince1970
:
0
)
recordModel
.
createDate
=
record
[
"createDate"
]
as?
Date
??
Date
(
timeIntervalSince1970
:
0
)
recordModel
.
modifyDate
=
record
[
"modifyDate"
]
as?
Date
??
Date
(
timeIntervalSince1970
:
0
)
recordModel
.
modifyDate
=
record
[
"modifyDate"
]
as?
Date
??
Date
(
timeIntervalSince1970
:
0
)
recordModel
.
icloud
=
true
recordModel
.
icloud
=
true
// let asset = record["recordAsset"] as! CKAsset
let
asset
=
record
[
"recordAsset"
]
as!
CKAsset
// print(asset.fileURL?.path)
recordModel
.
assetFileUrlPath
=
asset
.
fileURL
?
.
path
??
""
folderModel
.
dataSources
.
append
(
recordModel
)
folderModel
.
dataSources
.
append
(
recordModel
)
}
}
}
}
...
@@ -192,9 +194,10 @@ class SHCloudManager: NSObject {
...
@@ -192,9 +194,10 @@ class SHCloudManager: NSObject {
})
.
first
})
.
first
if
recording
==
nil
{
if
recording
==
nil
{
let
documentsFile
=
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!
.
appending
(
recordModel
.
pathFile
)
let
documentsFile
=
DocumentPath
.
appending
(
recordModel
.
pathFile
)
let
url
=
URL
.
init
(
fileURLWithPath
:
documentsFile
)
let
url
=
URL
.
init
(
fileURLWithPath
:
documentsFile
)
let
asset
=
CKAsset
.
init
(
fileURL
:
url
)
let
asset
=
CKAsset
.
init
(
fileURL
:
url
)
let
nowDate
=
Date
()
let
record
=
CKRecord
.
init
(
recordType
:
recordName
)
let
record
=
CKRecord
.
init
(
recordType
:
recordName
)
record
.
setValue
(
recordModel
.
recordingType
,
forKey
:
"recordingType"
)
record
.
setValue
(
recordModel
.
recordingType
,
forKey
:
"recordingType"
)
...
@@ -202,10 +205,15 @@ class SHCloudManager: NSObject {
...
@@ -202,10 +205,15 @@ class SHCloudManager: NSObject {
record
.
setValue
(
recordModel
.
pathFile
,
forKey
:
"pathFile"
)
record
.
setValue
(
recordModel
.
pathFile
,
forKey
:
"pathFile"
)
record
.
setValue
(
recordModel
.
address
,
forKey
:
"address"
)
record
.
setValue
(
recordModel
.
address
,
forKey
:
"address"
)
record
.
setValue
(
recordModel
.
txt
,
forKey
:
"content"
)
record
.
setValue
(
recordModel
.
txt
,
forKey
:
"content"
)
record
.
setValue
(
recordModel
.
createDate
,
forKey
:
"createTime"
)
record
.
setValue
(
recordModel
.
during
,
forKey
:
"during"
)
record
.
setValue
(
recordModel
.
modifyDate
,
forKey
:
"modifyDate"
)
record
.
setValue
(
nowDate
,
forKey
:
"createTime"
)
record
.
setValue
(
nowDate
,
forKey
:
"modifyDate"
)
record
.
setValue
(
asset
,
forKey
:
"recordAsset"
)
record
.
setValue
(
asset
,
forKey
:
"recordAsset"
)
for
image
in
recordModel
.
images
{
}
dateBase
.
save
(
record
)
{
(
subscription
,
saveError
)
in
dateBase
.
save
(
record
)
{
(
subscription
,
saveError
)
in
if
let
error
=
saveError
{
if
let
error
=
saveError
{
print
(
"
\(
error
.
localizedDescription
)
"
)
print
(
"
\(
error
.
localizedDescription
)
"
)
...
@@ -243,8 +251,9 @@ class SHCloudManager: NSObject {
...
@@ -243,8 +251,9 @@ class SHCloudManager: NSObject {
print
(
"
\(
error
.
localizedDescription
)
"
)
print
(
"
\(
error
.
localizedDescription
)
"
)
self
.
completionHandler
?(
false
,
[])
self
.
completionHandler
?(
false
,
[])
}
else
{
}
else
{
let
nowDate
=
Date
()
record
?[
"recordPaths"
]
=
recordPaths
record
?[
"recordPaths"
]
=
recordPaths
record
?[
"modifyDate"
]
=
folderModel
.
modify
Date
record
?[
"modifyDate"
]
=
now
Date
self
.
dateBase
.
save
(
record
!
)
{
(
saveRecord
,
saveError
)
in
self
.
dateBase
.
save
(
record
!
)
{
(
saveRecord
,
saveError
)
in
if
let
error
=
saveError
{
if
let
error
=
saveError
{
...
@@ -278,7 +287,11 @@ class SHCloudManager: NSObject {
...
@@ -278,7 +287,11 @@ class SHCloudManager: NSObject {
print
(
"
\(
error
.
localizedDescription
)
"
)
print
(
"
\(
error
.
localizedDescription
)
"
)
self
.
completionHandler
?(
false
,
[])
self
.
completionHandler
?(
false
,
[])
}
else
{
}
else
{
record
?
.
setValue
(
recordModel
.
modifyDate
,
forKey
:
"modifyDate"
)
let
nowDate
=
Date
()
record
?
.
setValue
(
nowDate
,
forKey
:
"modifyDate"
)
self
.
dateBase
.
save
(
record
!
)
{
(
saveRecord
,
saveError
)
in
self
.
dateBase
.
save
(
record
!
)
{
(
saveRecord
,
saveError
)
in
if
let
error
=
saveError
{
if
let
error
=
saveError
{
...
@@ -378,5 +391,4 @@ class SHCloudManager: NSObject {
...
@@ -378,5 +391,4 @@ class SHCloudManager: NSObject {
}
}
}
}
}
}
}
}
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