Skip to content

Commit

Permalink
extract method to make intention more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
angryziber committed Aug 29, 2015
1 parent b6a7e11 commit 7f04e84
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/main/java/com/zegoggles/smssync/service/RestoreTask.java
Expand Up @@ -121,9 +121,7 @@ private RestoreState restore(RestoreConfig config) {
service.clearCache();
}
}
if (smsIds.size() > 0) {
updateAllThreads();
}
updateAllThreadsIfAnySmsRestored();
} else {
Log.d(TAG, "nothing to restore");
}
Expand All @@ -140,9 +138,7 @@ private RestoreState restore(RestoreConfig config) {
return transition(ERROR, e);
} catch (MessagingException e) {
Log.e(TAG, "error", e);
if (smsIds.size() > 0) {
updateAllThreads();
}
updateAllThreadsIfAnySmsRestored();
return transition(ERROR, e);
} catch (IllegalStateException e) {
// usually memory problems (Couldn't init cursor window)
Expand Down Expand Up @@ -324,6 +320,12 @@ private boolean smsExists(ContentValues values) {
return exists;
}

private void updateAllThreadsIfAnySmsRestored() {
if (smsIds.size() > 0) {
updateAllThreads();
}
}

private void updateAllThreads() {
// thread dates + states might be wrong, we need to force a full update
// unfortunately there's no direct way to do that in the SDK, but passing a
Expand Down

0 comments on commit 7f04e84

Please sign in to comment.