|
@@ -1,6 +1,7 @@
|
|
|
import { book_item_data } from '../data/data';
|
|
|
import { util } from '../framework/util';
|
|
|
import { config } from '../config/config';
|
|
|
+import { ReadHistoryManager } from './readHistoryManager';
|
|
|
|
|
|
export class BookshelfManager {
|
|
|
private static book_list:book_item_data[] = null
|
|
@@ -13,7 +14,17 @@ export class BookshelfManager {
|
|
|
BookshelfManager.book_list = []
|
|
|
let string = util.getStorage(config.storage_key.BOOKSHELF_LIST)
|
|
|
if(string) {
|
|
|
- BookshelfManager.book_list = JSON.parse(string)
|
|
|
+ let temp_list = JSON.parse(string)
|
|
|
+ for (var i = 0; i < temp_list.length; i++) {
|
|
|
+ ReadHistoryManager.checkBookOnReadHistory(temp_list[i].book_id,(index,item)=>{
|
|
|
+ if(index!=-1){
|
|
|
+ BookshelfManager.book_list.push(item)
|
|
|
+ }else{
|
|
|
+ BookshelfManager.book_list.push(temp_list[i])
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
return BookshelfManager.book_list
|
|
|
}
|