Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Commit f119e12

Browse files
koziodigitalincniftynei
authored andcommitted
Fixed message model to work with retrofit and image loading.
Removed poorly styled code, accidental revert on httprequest. .
1 parent 6810338 commit f119e12

File tree

4 files changed

+16
-25
lines changed

4 files changed

+16
-25
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
gen/
22
bin/
3-
build.gradle
43
/res/raw/ormlite_config.txt
54
.settings
65
*-sources.jar

app/src/main/java/com/zulip/android/models/Message.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import java.util.ArrayList;
3939
import java.util.Arrays;
4040
import java.util.Date;
41-
import java.util.HashMap;
4241
import java.util.List;
4342
import java.util.Map;
4443
import java.util.concurrent.Callable;
@@ -58,7 +57,6 @@ public class Message {
5857
public static final String MESSAGE_READ_FIELD = "read";
5958
private static final String MESSAGE_EDITED = "MESSAGE_EDITED";
6059
private static final String MESSAGE_EDIT_DATE = "MESSAGE_EDIT_DATE";
61-
private Map<String, Drawable> cachedImages = new HashMap<>(1);
6260

6361
//region fields
6462
@SerializedName("recipient_id")
@@ -143,9 +141,6 @@ public class Message {
143141
//IGNORE - This will always be empty due to persistence
144142
@SerializedName("edit_history")
145143
public List<MessageHistory> _history;
146-
147-
//endregion
148-
149144
//endregion
150145

151146
/**
@@ -488,14 +483,6 @@ public Void call() throws Exception {
488483

489484
}
490485

491-
/**
492-
* Used to notify an outside observer if the state of a message has changed... e.g. offthread loaded images.
493-
* @param runnable
494-
*/
495-
public void setValueChangedPromise(Runnable runnable){
496-
this.promise = runnable;
497-
}
498-
499486
public String concatStreamAndTopic() {
500487
return getStream().getId() + getSubject();
501488
}
@@ -510,8 +497,6 @@ public String getIdForHolder() {
510497
private static final HTMLSchema schema = new HTMLSchema();
511498

512499
public Spanned getFormattedContent(ZulipApp app) {
513-
// if(getContent() != null && getContent().contains("<img"))
514-
515500
Spanned formattedMessage = formatContent(getFormattedContent(),
516501
app);
517502

app/src/main/java/com/zulip/android/networking/HTTPRequest.java

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,22 @@ void clearProperties() {
5757

5858
void abort() {
5959
aborting = true;
60-
if (response != null) {
61-
(new AsyncTask<Void, Void, Void>() {
62-
@Override
63-
protected Void doInBackground(Void... voids) {
64-
response.body().close();
65-
return null;
66-
}
67-
}).execute();
60+
synchronized (synchronization) {
61+
if (response != null) {
62+
final Response finalResponse = response;
63+
response = null;
64+
(new AsyncTask<Void, Void, Void>() {
65+
@Override
66+
protected Void doInBackground(Void... voids) {
67+
try {
68+
finalResponse.body().close();
69+
} catch (IllegalStateException e) {
70+
//fail silently
71+
}
72+
return null;
73+
}
74+
}).execute();
75+
}
6876
}
6977
}
7078

build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ buildscript {
88
classpath 'com.google.gms:google-services:2.1.0'
99
}
1010
}
11-
project.ext.fabricKey = "";
1211

1312
allprojects {
1413
repositories {

0 commit comments

Comments
 (0)