Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with Message Results not being sent to sync URL #480

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -46,7 +46,7 @@ allprojects {
}

ext {
androidVersionCode = 46
androidVersionCode = 47
testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion smssync/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ public void processMessageResult() {
if ((response != null) && (response.isSuccess()) && (response.hasUUIDs())) {
final List<MessageResult> 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)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can avoid this null check if you flip equals like this: Message.Status.UNCONFIRMED.equals(message.getStatus())

MessageResult messageResult = new MessageResult();
messageResult.setMessageUUID(message.getMessageUuid());
messageResult.setSentResultMessage(message.getSentResultMessage());
Expand Down Expand Up @@ -143,7 +143,7 @@ private void sendMessageResultPOSTRequest(SyncUrl syncUrl, List<MessageResult> 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));
}
}
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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 {
Expand Down