Loading app/src/main/java/app/fedilab/android/client/entities/app/StatusCache.java +1 −1 Original line number Diff line number Diff line Loading @@ -179,7 +179,7 @@ public class StatusCache { * @return int - 0 if updated 1 if inserted * @throws DBException exception with database */ public int insertOrUpdate(StatusCache statusCache, String slug) throws DBException { public synchronized int insertOrUpdate(StatusCache statusCache, String slug) throws DBException { if (db == null) { throw new DBException("db is null. Wrong initialization."); } Loading app/src/main/java/app/fedilab/android/jobs/ComposeWorker.java +19 −14 Original line number Diff line number Diff line Loading @@ -234,8 +234,11 @@ public class ComposeWorker extends Worker { if (statusReply != null) { in_reply_to_status = statusReply.id; dataPost.statusDraft.state.posts_successfully_sent = i; dataPost.statusDraft.state.posts.get(i).id = statusReply.id; dataPost.statusDraft.state.posts.get(i).in_reply_to_id = statusReply.in_reply_to_id; if (dataPost.statusDraft.state.posts.size() > i + 1) { dataPost.statusDraft.state.posts.get(i + 1).id = statusReply.id; dataPost.statusDraft.state.posts.get(i + 1).in_reply_to_id = statusReply.in_reply_to_id; } try { new StatusDraft(context.getApplicationContext()).updatePostState(dataPost.statusDraft); } catch (DBException e) { Loading Loading @@ -284,23 +287,15 @@ public class ComposeWorker extends Worker { if (statusReply != null) { in_reply_to_status = statusReply.id; dataPost.statusDraft.state.posts_successfully_sent = i; dataPost.statusDraft.state.posts.get(i).id = statusReply.id; dataPost.statusDraft.state.posts.get(i).in_reply_to_id = statusReply.params.in_reply_to_id; try { new StatusDraft(context.getApplicationContext()).updatePostState(dataPost.statusDraft); } catch (DBException e) { e.printStackTrace(); if (dataPost.statusDraft.state.posts.size() > i + 1) { dataPost.statusDraft.state.posts.get(i + 1).id = statusReply.id; dataPost.statusDraft.state.posts.get(i + 1).in_reply_to_id = statusReply.params.in_reply_to_id; } if (i >= dataPost.statusDraft.statusDraftList.size()) { try { new StatusDraft(context).removeDraft(dataPost.statusDraft); new StatusDraft(context.getApplicationContext()).updatePostState(dataPost.statusDraft); } catch (DBException e) { e.printStackTrace(); } if (dataPost.service != null) { dataPost.service.stopSelf(); } } } } } catch (IOException e) { Loading @@ -312,6 +307,16 @@ public class ComposeWorker extends Worker { if (dataPost.messageSent > dataPost.messageToSend) { dataPost.messageSent = dataPost.messageToSend; } if (i >= (statuses.size() - 1)) { try { new StatusDraft(context).removeDraft(dataPost.statusDraft); } catch (DBException e) { e.printStackTrace(); } if (dataPost.service != null) { dataPost.service.stopSelf(); } } } } Loading Loading
app/src/main/java/app/fedilab/android/client/entities/app/StatusCache.java +1 −1 Original line number Diff line number Diff line Loading @@ -179,7 +179,7 @@ public class StatusCache { * @return int - 0 if updated 1 if inserted * @throws DBException exception with database */ public int insertOrUpdate(StatusCache statusCache, String slug) throws DBException { public synchronized int insertOrUpdate(StatusCache statusCache, String slug) throws DBException { if (db == null) { throw new DBException("db is null. Wrong initialization."); } Loading
app/src/main/java/app/fedilab/android/jobs/ComposeWorker.java +19 −14 Original line number Diff line number Diff line Loading @@ -234,8 +234,11 @@ public class ComposeWorker extends Worker { if (statusReply != null) { in_reply_to_status = statusReply.id; dataPost.statusDraft.state.posts_successfully_sent = i; dataPost.statusDraft.state.posts.get(i).id = statusReply.id; dataPost.statusDraft.state.posts.get(i).in_reply_to_id = statusReply.in_reply_to_id; if (dataPost.statusDraft.state.posts.size() > i + 1) { dataPost.statusDraft.state.posts.get(i + 1).id = statusReply.id; dataPost.statusDraft.state.posts.get(i + 1).in_reply_to_id = statusReply.in_reply_to_id; } try { new StatusDraft(context.getApplicationContext()).updatePostState(dataPost.statusDraft); } catch (DBException e) { Loading Loading @@ -284,23 +287,15 @@ public class ComposeWorker extends Worker { if (statusReply != null) { in_reply_to_status = statusReply.id; dataPost.statusDraft.state.posts_successfully_sent = i; dataPost.statusDraft.state.posts.get(i).id = statusReply.id; dataPost.statusDraft.state.posts.get(i).in_reply_to_id = statusReply.params.in_reply_to_id; try { new StatusDraft(context.getApplicationContext()).updatePostState(dataPost.statusDraft); } catch (DBException e) { e.printStackTrace(); if (dataPost.statusDraft.state.posts.size() > i + 1) { dataPost.statusDraft.state.posts.get(i + 1).id = statusReply.id; dataPost.statusDraft.state.posts.get(i + 1).in_reply_to_id = statusReply.params.in_reply_to_id; } if (i >= dataPost.statusDraft.statusDraftList.size()) { try { new StatusDraft(context).removeDraft(dataPost.statusDraft); new StatusDraft(context.getApplicationContext()).updatePostState(dataPost.statusDraft); } catch (DBException e) { e.printStackTrace(); } if (dataPost.service != null) { dataPost.service.stopSelf(); } } } } } catch (IOException e) { Loading @@ -312,6 +307,16 @@ public class ComposeWorker extends Worker { if (dataPost.messageSent > dataPost.messageToSend) { dataPost.messageSent = dataPost.messageToSend; } if (i >= (statuses.size() - 1)) { try { new StatusDraft(context).removeDraft(dataPost.statusDraft); } catch (DBException e) { e.printStackTrace(); } if (dataPost.service != null) { dataPost.service.stopSelf(); } } } } Loading