Skip to content

Commit

Permalink
Fix when update note createdTime or publicTime field content error
Browse files Browse the repository at this point in the history
  • Loading branch information
xingstarx committed Jan 16, 2019
1 parent 1a8332b commit 1c5fef0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/src/main/java/org/houxg/leamonax/service/NoteService.java
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,16 @@ public static void saveNote(final long noteLocalId) {
note.setContent(modifiedNote.getContent());
handleFile(modifiedNote.getId(), note.getNoteFiles());
updateTagsToLocal(modifiedNote.getId(), note.getTagData());
if (!modifiedNote.isLocalNote()) {//noteId已经存在,代表是更新操作,服务端updateNote接口存在bug,所以特殊处理下createdTime, publicTime
if (modifiedNote.getCreatedTimeVal() == -62135596800000L || modifiedNote.getPublicTimeVal() == -62135596800000L) {
Note remoteNote = RetrofitUtils.excuteWithException(ApiProvider.getInstance().getNoteApi().getNoteAndContent(modifiedNote.getNoteId()));
note.setCreatedTimeVal(remoteNote.getCreatedTimeVal());
note.setPublicTimeVal(remoteNote.getPublicTimeVal());
} else {
note.setCreatedTimeVal(modifiedNote.getCreatedTimeVal());
note.setPublicTimeVal(modifiedNote.getPublicTimeVal());
}
}
note.save();
updateNoteUsnIfNeed(note.getUsn());
} else {
Expand Down

0 comments on commit 1c5fef0

Please sign in to comment.