Commit 1d38dd26 authored by lmj_521aiau@163.com's avatar lmj_521aiau@163.com

dateModel

parent 310abcf6
......@@ -19,7 +19,7 @@ class SHInputController: SHBaseViewController
var saveSuccessCallBack:((SHRecordFolderModel)->Void)?
/// 存储数据的model
private var dataModel: SHRecordModel = SHRecordModel()
var dataModel: SHRecordModel = SHRecordModel()
/// 未填写标题时的默认标题
private let defaultTitle: String = "新建笔记"
......
......@@ -365,35 +365,35 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ace-iU-keq">
<rect key="frame" x="50" y="5" width="344" height="220"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6bV-3V-R81">
<rect key="frame" x="18" y="18" width="44" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6bV-3V-R81">
<rect key="frame" x="18" y="18" width="44" height="21.5"/>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<color key="textColor" red="0.0" green="0.074509803921568626" blue="0.23921568627450979" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FVv-OG-DwV">
<rect key="frame" x="18" y="80" width="35.5" height="17"/>
<rect key="frame" x="18" y="80.5" width="35.5" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="recordDetails_voice" translatesAutoresizingMaskIntoConstraints="NO" id="6je-jR-opG">
<rect key="frame" x="18" y="107" width="16" height="16"/>
<rect key="frame" x="18" y="107.5" width="16" height="16"/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="XAw-V9-smq">
<rect key="frame" x="39" y="106.5" width="36" height="17"/>
<rect key="frame" x="39" y="107" width="36" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.58431372549019611" green="0.62745098039215685" blue="0.72156862745098038" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cAa-wI-k0B">
<rect key="frame" x="18" y="49" width="36" height="17"/>
<rect key="frame" x="18" y="49.5" width="36" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.58431372549019611" green="0.62745098039215685" blue="0.72156862745098038" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="SzJ-Gk-Tag">
<rect key="frame" x="296" y="100" width="30" height="30"/>
<rect key="frame" x="296" y="100.5" width="30" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="30" id="oaj-sd-4Uh"/>
<constraint firstAttribute="height" constant="30" id="wkj-jD-iI1"/>
......@@ -418,6 +418,7 @@
<constraint firstItem="6bV-3V-R81" firstAttribute="top" secondItem="Ace-iU-keq" secondAttribute="top" constant="18" id="Sj5-yA-Hdn"/>
<constraint firstItem="FVv-OG-DwV" firstAttribute="leading" secondItem="6bV-3V-R81" secondAttribute="leading" id="k4e-UV-52H"/>
<constraint firstItem="cAa-wI-k0B" firstAttribute="top" secondItem="6bV-3V-R81" secondAttribute="bottom" constant="10" id="mde-3T-2mf"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="6bV-3V-R81" secondAttribute="trailing" constant="18" id="xug-bT-eC2"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="adA-MF-vWU">
......
......@@ -297,23 +297,7 @@ extension SHRecordDetailsVC {
self.updateocloudUI()
}
}
// 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 == currentModel.id {
// subFolderModel.modifyDate = nowDate
// subFolderModel.dataSources = currentModel.dataSources
// let dic = getDictWith(obj: subFolderModel)
// recordList[index] = dic
// break
// }
// }
// keyValueStore.set(recordList, forKey: "Folderlist")
// keyValueStore.synchronize()
// }
if currentModel.dataSources.count == 0 {
self.editClick(true)
self.markAlertViewShow(false)
......@@ -409,8 +393,19 @@ extension SHRecordDetailsVC: UITableViewDelegate, UITableViewDataSource{
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let show = UIStoryboard.init(name: "Record", bundle: nil).instantiateViewController(withIdentifier: "SHRecordShowViewController") as! SHRecordShowViewController
show.model = currentModel.dataSources[indexPath.row]
self.navigationController?.pushViewController(show, animated: true)
// let show = UIStoryboard.init(name: "Record", bundle: nil).instantiateViewController(withIdentifier: "SHRecordShowViewController") as! SHRecordShowViewController
// show.model = currentModel.dataSources[indexPath.row]
// self.navigationController?.pushViewController(show, animated: true)
let input = SHInputController.init()
input.folderModel = currentModel
input.dataModel = currentModel.dataSources[indexPath.row]
self.navigationController?.pushViewController(input, animated: true)
input.saveSuccessCallBack = { model in
self.currentModel = model
self.updateocloudUI()
}
}
}
......@@ -56,7 +56,7 @@ class SHRecordListViewController: SHBaseViewController {
override func viewDidLoad() {
super.viewDidLoad()
SHAVAudioManager.shared.start()
// SHAVAudioManager.shared.start()
let url = FileManager.default.url(forUbiquityContainerIdentifier: nil)
print(url as Any)
......
......@@ -83,50 +83,20 @@ class SHRecordMoveFileVC: SHBaseViewController {
}
}
}
var list = keyValueStore.object(forKey: "Folderlist") as? [Dictionary<String, Any>]
if list == nil {
list = keyValueStore.object(forKey: "list") as? [Dictionary<String, Any>]
}
list = nil
if list != nil {
for dict in list!.reversed(){
var model = SHRecordFolderModel()
model = getDataDictWith(dict: dict)
if model.id != currentModel.id {
dataSources.append(model)
}
switch CRUserDefaults.sortType {
case 0:
dataSources.sort { (model0, model1) -> Bool in
return model0.createDate.compare(model1.createDate) == ComparisonResult.orderedDescending
}
dataSources = dataSources.filterDuplicates({$0.id})
switch CRUserDefaults.sortType {
case 0:
dataSources.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
}
break
}
}else{
switch CRUserDefaults.sortType {
case 0:
dataSources.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
}
break
break
default:
dataSources.sort { (model0, model1) -> Bool in
return model0.modifyDate.compare(model1.modifyDate) == ComparisonResult.orderedDescending
}
break
}
tableView?.reloadData()
}
......@@ -157,19 +127,7 @@ class SHRecordMoveFileVC: SHBaseViewController {
let list = [modelDict]
CRUserDefaults.recordList = list
}
// let list = self.keyValueStore.object(forKey: "Folderlist") as? [Dictionary<String, Any>]
//
// if var list = list {
// list.append(modelDict)
// self.keyValueStore.set(list, forKey: "Folderlist")
// self.keyValueStore.synchronize()
// }else{
// let list = [modelDict]
// self.keyValueStore.set(list, forKey: "Folderlist")
// self.keyValueStore.synchronize()
// }
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(333)) {
self.prepareDataSource()
}
......@@ -253,34 +211,6 @@ class SHRecordMoveFileVC: SHBaseViewController {
}
}
}
// 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 == targetModel.id {
// subFolderModel.modifyDate = nowDate
// subFolderModel.dataSources = subFolderModel.dataSources+moveFiles
// let dic = getDictWith(obj: subFolderModel)
// recordList[index] = dic
// break
// }
// }
// //删
// for (index, subDict) in recordList.enumerated(){
// let subFolderModel:SHRecordFolderModel = getDataDictWith(dict: subDict)
// if subFolderModel.id == currentModel.id {
// subFolderModel.modifyDate = nowDate
// subFolderModel.dataSources = currentModel.dataSources
// let dic = getDictWith(obj: subFolderModel)
// recordList[index] = dic
// break
// }
// }
// keyValueStore.set(recordList, forKey: "Folderlist")
// keyValueStore.synchronize()
// }
}
}
......
......@@ -30,7 +30,19 @@ class SHRecordDetailsCell: UITableViewCell {
titleName?.text = newValue.rename
timeLab?.text = Date.getShortTimeByStamp_record(timestamp: Int64(newValue.modifyDate.timeIntervalSince1970))
txtLab?.text = newValue.txt
if model.recordingType == 1 {
let txts = newValue.txt.components(separatedBy: "\n")
let result = txts.reduce("" , { x, y in
if x.length == 0{
return x + y
}else{
return x + "\n" + y
}
})
txtLab?.text = result
}else{
txtLab?.text = newValue.txt
}
duringLab?.text = countSecond(newValue.during)
selectedBtn?.isSelected = model.selected
icloudBtn?.isSelected = model.icloud
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment