Skip to content

Commit f6aedca

Browse files
committed
Fix for imageIds in Conferences
The API returns "" if there is no image. Before this commit, using the main constructor and passing empty strings for imageType and imageId lead to the value of ":" for image, which could cause comparison problems
1 parent f2e9e55 commit f6aedca

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

  • library/src/main/java/com/proxerme/library/connection/messenger/entity

library/src/main/java/com/proxerme/library/connection/messenger/entity/Conference.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.os.Parcelable;
55
import android.support.annotation.IntRange;
66
import android.support.annotation.NonNull;
7+
import android.support.annotation.Nullable;
78

89
import com.afollestad.bridge.annotations.Body;
910
import com.proxerme.library.interfaces.IdItem;
@@ -55,20 +56,25 @@ public Conference[] newArray(int size) {
5556
}
5657

5758
public Conference(@NonNull String id, @NonNull String topic, @NonNull String customTopic,
58-
@IntRange(from = 2) int participantAmount, @NonNull String imageType,
59-
@NonNull String imageId, boolean isGroup, boolean isRead, long time,
59+
@IntRange(from = 2) int participantAmount, @Nullable String imageType,
60+
@Nullable String imageId, boolean isGroup, boolean isRead, long time,
6061
@IntRange(from = 0) int unreadMessageAmount,
6162
@NonNull String lastReadMessageId) {
6263
this.id = id;
6364
this.topic = topic;
6465
this.customTopic = customTopic;
6566
this.participantAmount = participantAmount;
66-
this.image = imageType + ":" + imageId;
6767
this.isGroup = isGroup;
6868
this.isRead = isRead;
6969
this.time = time;
7070
this.unreadMessageAmount = unreadMessageAmount;
7171
this.lastReadMessageId = lastReadMessageId;
72+
73+
if (imageType == null || imageType.isEmpty() || imageId == null || imageType.isEmpty()) {
74+
this.image = "";
75+
} else {
76+
this.image = imageType + ":" + imageId;
77+
}
7278
}
7379

7480
protected Conference(Parcel in) {

0 commit comments

Comments
 (0)