diff --git a/build.gradle b/build.gradle index 73c252a7f..57fa0081c 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ buildscript { maven { url 'https://jitpack.io' } } dependencies { - classpath 'com.android.tools.build:gradle:2.3.0-beta3' + classpath 'com.android.tools.build:gradle:2.3.1' classpath 'me.tatarka:gradle-retrolambda:3.5.0' classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2' classpath 'com.github.triplet.gradle:play-publisher:1.1.5' @@ -46,7 +46,7 @@ allprojects { } ext { - androidVersionCode = 46 + androidVersionCode = 47 testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner" } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d4f6c25b6..a6dff0431 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip diff --git a/smssync/build.gradle b/smssync/build.gradle index 5ffca90f5..6bf77dd62 100644 --- a/smssync/build.gradle +++ b/smssync/build.gradle @@ -195,7 +195,7 @@ release { versionStrategy Strategies.PRE_RELEASE_ALPHA_BETA - android.defaultConfig.versionName = project.version.toString() + android.defaultConfig.versionName = '3.1.3'; tagStrategy { generateMessage = { version -> "\n\nRelease of $version.version\n$tagMessage" } diff --git a/smssync/src/main/java/org/addhen/smssync/data/message/PostMessage.java b/smssync/src/main/java/org/addhen/smssync/data/message/PostMessage.java index 748be6984..5a1430864 100644 --- a/smssync/src/main/java/org/addhen/smssync/data/message/PostMessage.java +++ b/smssync/src/main/java/org/addhen/smssync/data/message/PostMessage.java @@ -374,9 +374,11 @@ public void performTask() { Logger.log(TAG, "Task checking crashed " + e.getMessage() + " response: " + messageHttpClient.getResponse()); try { - mFileManager.append( - "Task crashed: " + e.getMessage() + " response: " + messageHttpClient - .getResponse().body().string()); + if (messageHttpClient.getResponse() != null) { + mFileManager.append( + "Task crashed: " + e.getMessage() + " response: " + messageHttpClient + .getResponse().body().string()); + } } catch (IOException e1) { e1.printStackTrace(); } diff --git a/smssync/src/main/java/org/addhen/smssync/data/message/ProcessMessageResult.java b/smssync/src/main/java/org/addhen/smssync/data/message/ProcessMessageResult.java index 58a568a9a..fd70e0e55 100644 --- a/smssync/src/main/java/org/addhen/smssync/data/message/ProcessMessageResult.java +++ b/smssync/src/main/java/org/addhen/smssync/data/message/ProcessMessageResult.java @@ -94,8 +94,8 @@ public void processMessageResult() { if ((response != null) && (response.isSuccess()) && (response.hasUUIDs())) { final List messageResults = new ArrayList<>(); for (String uuid : response.getUuids()) { - Message message = mMessageDataSource.fetchPendingByUuid(uuid); - if (message != null) { + Message message = mMessageDataSource.fetchByUuid(uuid); + if (message != null && !message.getStatus().equals(Message.Status.UNCONFIRMED)) { MessageResult messageResult = new MessageResult(); messageResult.setMessageUUID(message.getMessageUuid()); messageResult.setSentResultMessage(message.getSentResultMessage()); @@ -143,7 +143,7 @@ private void sendMessageResultPOSTRequest(SyncUrl syncUrl, List r } catch (Exception e) { mFileManager.append(mContext.getString(R.string.message_processed_failed)); } finally { - if (200 == mAppHttpClient.getResponse().code()) { + if (mAppHttpClient.getResponse() != null && 200 == mAppHttpClient.getResponse().code()) { mFileManager.append(mContext.getString(R.string.message_processed_success)); } } @@ -177,7 +177,9 @@ public MessagesUUIDSResponse sendQueuedMessagesPOSTRequest(SyncUrl syncUrl, mContext.getString(R.string.message_processed_failed) + " " + e .getMessage()); } finally { - if (200 == mAppHttpClient.getResponse().code()) { + if (mAppHttpClient.getResponse() == null) { + response = null; + } else if (200 == mAppHttpClient.getResponse().code()) { mFileManager.append( mContext.getString(R.string.message_processed_success)); @@ -234,7 +236,9 @@ public MessagesUUIDSResponse sendMessageResultGETRequest(SyncUrl syncUrl) { mFileManager.append( mContext.getString(R.string.message_processed_failed) + " " + e.getMessage()); } finally { - if (200 == mAppHttpClient.getResponse().code()) { + if (mAppHttpClient.getResponse() == null) { + response = null; + } else if (200 == mAppHttpClient.getResponse().code()) { response = parseMessagesUUIDSResponse(mAppHttpClient); response.setSuccess(true); } else {