Delete drafts [settings] (#576)
Merge branch '450-drafts-settings' of codeberg.org:gitnex/GitNex into 450-drafts-settings Fix package move Merge branch 'master' into 450-drafts-settings Merge branch 'master' into 450-drafts-settings fix default value save Delete drafts settings Co-authored-by: M M Arif <mmarif@swatian.com> Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/576 Reviewed-by: opyale <opyale@noreply.codeberg.org>
This commit is contained in:
@@ -55,6 +55,22 @@ public class DraftsApi {
|
||||
return draftId;
|
||||
}
|
||||
|
||||
public long getDraftIdAsync(int issueId, int draftRepositoryId) {
|
||||
|
||||
try {
|
||||
|
||||
Thread thread = new Thread(() -> draftId = draftsDao.getDraftId(issueId, draftRepositoryId));
|
||||
thread.start();
|
||||
thread.join();
|
||||
}
|
||||
catch(InterruptedException e) {
|
||||
|
||||
Log.e(StaticGlobalVariables.draftsRepository, e.toString());
|
||||
}
|
||||
|
||||
return draftId;
|
||||
}
|
||||
|
||||
public Integer checkDraft(int issueId, int draftRepositoryId) {
|
||||
|
||||
try {
|
||||
@@ -81,7 +97,7 @@ public class DraftsApi {
|
||||
return draftsDao.fetchDraftByIssueId(issueId);
|
||||
}
|
||||
|
||||
public static void deleteSingleDraft(final int draftId) {
|
||||
public void deleteSingleDraft(final int draftId) {
|
||||
|
||||
final LiveData<Draft> draft = draftsDao.fetchDraftById(draftId);
|
||||
|
||||
|
||||
@@ -44,6 +44,9 @@ public interface DraftsDao {
|
||||
@Query("UPDATE Drafts SET draftText= :draftText WHERE issueId = :issueId AND draftRepositoryId = :draftRepositoryId")
|
||||
void updateDraftByIssueId(String draftText, int issueId, int draftRepositoryId);
|
||||
|
||||
@Query("SELECT draftId FROM Drafts WHERE issueId = :issueId AND draftRepositoryId = :draftRepositoryId")
|
||||
Integer getDraftId(int issueId, int draftRepositoryId);
|
||||
|
||||
@Query("DELETE FROM Drafts WHERE draftId = :draftId")
|
||||
void deleteByDraftId(int draftId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user