Skip to content

Commit c8c74fd

Browse files
alperozturk96AndyScherzinger
authored andcommitted
check db status
Signed-off-by: alperozturk <[email protected]>
1 parent 4314414 commit c8c74fd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

app/src/main/java/it/niedermann/owncloud/notes/persistence/NotesRepository.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,16 @@ public void toggleFavoriteAndSync(Account account, Note note) {
546546
try {
547547
final var ssoAccount = AccountImporter.getSingleSignOnAccount(context, account.getAccountName());
548548
final var notesAPI = apiProvider.getNotesAPI(context, ssoAccount, getPreferredApiVersion(account.getApiVersion()));
549-
note.setFavorite(!note.getFavorite());
549+
550+
boolean newFavoriteValue = !note.getFavorite();
551+
DBStatus newDBStatus = DBStatus.VOID;
552+
553+
if (newFavoriteValue) {
554+
newDBStatus = DBStatus.LOCAL_EDITED;
555+
}
556+
557+
note.setFavorite(newFavoriteValue);
558+
note.setStatus(newDBStatus);
550559
final var result = notesAPI.updateNote(note);
551560
final var response = result.execute();
552561
if (response.isSuccessful()) {

0 commit comments

Comments
 (0)