|
@@ -975,24 +975,35 @@ extension KMLeftSideViewController {
|
|
let model = KMAnnotationListModel()
|
|
let model = KMAnnotationListModel()
|
|
var datas: [KMBotaAnnotationModel] = []
|
|
var datas: [KMBotaAnnotationModel] = []
|
|
var prePageIdx: Int = NSNotFound
|
|
var prePageIdx: Int = NSNotFound
|
|
|
|
+ var preDate: Date?
|
|
|
|
+ var secM: KMBotaAnnotationSectionModel?
|
|
for anno in allAnnotation {
|
|
for anno in allAnnotation {
|
|
-// if self.noteSortType == .page {
|
|
|
|
|
|
+ let item = KMBotaAnnotationModel()
|
|
|
|
+ item.anno = anno
|
|
|
|
+ item.showPage = self.annoListIsShowPage()
|
|
|
|
+ item.showTime = self.annoListIsShowTime()
|
|
|
|
+ item.showAuthor = self.annoListIsShowAnther()
|
|
|
|
+
|
|
|
|
+// datas.append(item)
|
|
|
|
+ if self.noteSortType == .page {
|
|
let pageIdx = Int(anno.pageIndex())
|
|
let pageIdx = Int(anno.pageIndex())
|
|
- var secM: KMBotaAnnotationSectionModel?
|
|
|
|
if pageIdx != prePageIdx { // 不是同一个页面
|
|
if pageIdx != prePageIdx { // 不是同一个页面
|
|
secM = KMBotaAnnotationSectionModel()
|
|
secM = KMBotaAnnotationSectionModel()
|
|
model.datas.append(secM!)
|
|
model.datas.append(secM!)
|
|
}
|
|
}
|
|
|
|
|
|
- let item = KMBotaAnnotationModel()
|
|
|
|
- item.anno = anno
|
|
|
|
- item.showPage = self.annoListIsShowPage()
|
|
|
|
- item.showTime = self.annoListIsShowTime()
|
|
|
|
- item.showAuthor = self.annoListIsShowAnther()
|
|
|
|
-// datas.append(item)
|
|
|
|
secM?.items.append(item)
|
|
secM?.items.append(item)
|
|
-
|
|
|
|
prePageIdx = Int(anno.pageIndex())
|
|
prePageIdx = Int(anno.pageIndex())
|
|
|
|
+ } else { // time
|
|
|
|
+ let date = anno.modificationDate()
|
|
|
|
+ if let same = date?.isSameDay(other: preDate), same == false { // 不是同一天
|
|
|
|
+ secM = KMBotaAnnotationSectionModel()
|
|
|
|
+ model.datas.append(secM!)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ secM?.items.append(item)
|
|
|
|
+ preDate = date
|
|
|
|
+ }
|
|
|
|
|
|
let replyAnnos = self.noteReplyHanddler.fetchReplyAnnotations(anno) ?? []
|
|
let replyAnnos = self.noteReplyHanddler.fetchReplyAnnotations(anno) ?? []
|
|
for replyAnno in replyAnnos {
|
|
for replyAnno in replyAnnos {
|
|
@@ -1003,20 +1014,12 @@ extension KMLeftSideViewController {
|
|
replyM.annoModel = item
|
|
replyM.annoModel = item
|
|
item.replyAnnos.append(replyM)
|
|
item.replyAnnos.append(replyM)
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
let footerI = KMBotaAnnotationFooterModel()
|
|
let footerI = KMBotaAnnotationFooterModel()
|
|
footerI.anno = anno
|
|
footerI.anno = anno
|
|
secM?.items.append(footerI)
|
|
secM?.items.append(footerI)
|
|
item.footerModel = footerI
|
|
item.footerModel = footerI
|
|
footerI.annoModel = item
|
|
footerI.annoModel = item
|
|
-// }
|
|
|
|
-
|
|
|
|
-// let item = KMBotaAnnotationModel()
|
|
|
|
-// item.anno = anno
|
|
|
|
-// item.showPage = self.annoListIsShowPage()
|
|
|
|
-// item.showTime = self.annoListIsShowTime()
|
|
|
|
-// item.showAuthor = self.annoListIsShowAnther()
|
|
|
|
-// datas.append(item)
|
|
|
|
}
|
|
}
|
|
// model.datas = datas
|
|
// model.datas = datas
|
|
self.annoListModel = model
|
|
self.annoListModel = model
|