diff --git a/app/src/main/java/org/houxg/leamonax/service/NoteService.java b/app/src/main/java/org/houxg/leamonax/service/NoteService.java index 0ec38b7..400d085 100644 --- a/app/src/main/java/org/houxg/leamonax/service/NoteService.java +++ b/app/src/main/java/org/houxg/leamonax/service/NoteService.java @@ -207,7 +207,7 @@ public class NoteService { if (modifiedNote.isLocalNote()) { call = ApiProvider.getInstance().getNoteApi().add(requestBodyMap, fileBodies); } else { - Note remoteNote = RetrofitUtils.excuteWithException(getNoteByServerId(modifiedNote.getNoteId())); + Note remoteNote = RetrofitUtils.excuteWithException(ApiProvider.getInstance().getNoteApi().getNoteAndContent(modifiedNote.getNoteId())); if (remoteNote.getUsn() != modifiedNote.getUsn()) { remoteNote.setId(modifiedNote.getId()); remoteNote.update(); @@ -274,20 +274,8 @@ public class NoteService { }); } - private static Call> getSyncNotes(int afterUsn, int maxEntry) { - return ApiProvider.getInstance().getNoteApi().getSyncNotes(afterUsn, maxEntry); - } - - private static Call> getSyncNotebooks(int afterUsn, int maxEntry) { - return ApiProvider.getInstance().getNotebookApi().getSyncNotebooks(afterUsn, maxEntry); - } - - public static Call getNoteByServerId(String serverId) { - return ApiProvider.getInstance().getNoteApi().getNoteAndContent(serverId); - } - public static boolean revertNote(String serverId) { - Note serverNote = RetrofitUtils.excute(NoteService.getNoteByServerId(serverId)); + Note serverNote = RetrofitUtils.excute(ApiProvider.getInstance().getNoteApi().getNoteAndContent(serverId)); if (serverNote == null) { return false; } @@ -310,8 +298,6 @@ public class NoteService { return true; } - - @NonNull private static Map generateCommonBodyMap(Note note) { Map requestBodyMap = new HashMap<>(); @@ -402,6 +388,7 @@ public class NoteService { return localIds; } + //TODO:change to synchonous public static Observable deleteNote(final Note note) { return Observable.create( new Observable.OnSubscribe() { @@ -427,6 +414,7 @@ public class NoteService { }); } + //TODO:delete this method private static void updateNoteUsnIfNeed(int newUsn) { Account account = AccountService.getCurrent(); if (newUsn - account.getNoteUsn() == 1) { @@ -435,10 +423,6 @@ public class NoteService { } } - public static Call deleteNote(String noteId, int usn) { - return ApiProvider.getInstance().getNoteApi().delete(noteId, usn); - } - public static void updateTagsToLocal(long noteLocalId, List tags) { String currentUid = AccountService.getCurrent().getUserId(); if (tags == null) { @@ -481,7 +465,6 @@ public class NoteService { } } - private static RequestBody createPartFromString(String content) { return RequestBody.create(MediaType.parse(MULTIPART_FORM_DATA), content); }