Skip to content
Snippets Groups Projects
Commit 1a6b933c authored by Pierre Nicolas's avatar Pierre Nicolas :joy: Committed by Adrien Béraud
Browse files

sanitize artifacts

Change-Id: Ib78b55c3f22e67a0d969596001287aedea5e9ff6
parent cdc45aa5
No related branches found
No related tags found
No related merge requests found
......@@ -223,7 +223,7 @@ class AvatarDrawable : Drawable {
withPhoto(contact.profile.avatar as? Bitmap?)
.withId(contact.contact.primaryNumber)
.withPresence(contact.presence)
.withOnlineState(contact.contact.isOnline)
.withOnlineState(contact.presence)
.withNameData(contact.profile.displayName, contact.registeredName)
private fun withContacts(profile: Profile, contacts: List<ContactViewModel>): Builder {
......@@ -299,7 +299,7 @@ class AvatarDrawable : Drawable {
contact.profile.avatar?.let { photo ->
bitmaps?.set(0, photo as Bitmap)
}
isOnline = contact.contact.isOnline
isOnline = contact.presence
update = true
}
......
......@@ -90,7 +90,7 @@ class Account(
//trustRequestsSubject.onComplete();
}
fun canSearch(): Boolean = !getDetail(ConfigKey.MANAGER_URI).isEmpty()
fun canSearch(): Boolean = getDetail(ConfigKey.MANAGER_URI).isNotEmpty()
fun isContact(conversation: Conversation): Boolean =
conversation.contact?.let { isContact(it.uri) } ?: false
......@@ -807,8 +807,7 @@ class Account(
fun presenceUpdate(contactUri: String, isOnline: Boolean) {
//Log.w(TAG, "presenceUpdate " + contactUri + " " + isOnline);
val contact = getContactFromCache(contactUri)
if (contact.isOnline == isOnline) return
contact.isOnline = isOnline
contact.setPresence(isOnline)
synchronized(conversations) {
conversations[contactUri]?.let { conversationRefreshed(it) }
}
......
......@@ -52,7 +52,6 @@ class Contact constructor(val uri: Uri, val isUser: Boolean = false) {
var isFromSystem = false
var status = Status.NO_REQUEST
var addedDate: Date? = null
private var mOnline = false
var id: Long = 0
private var mLookupKey: String? = null
private val mConversationUri: BehaviorSubject<Uri> = BehaviorSubject.createDefault(uri)
......@@ -76,12 +75,9 @@ class Contact constructor(val uri: Uri, val isUser: Boolean = false) {
mContactPresenceEmitter = emitter
}
var isOnline: Boolean
get() = mOnline
set(present) {
mOnline = present
mContactPresenceEmitter?.onNext(present)
}
fun setPresence(present: Boolean) {
mContactPresenceEmitter?.onNext(present)
}
fun setSystemId(id: Long) {
this.id = id
......
......@@ -39,6 +39,8 @@ class ContactViewModel(val contact: Contact, val profile: Profile, val registere
|| registeredName != null && registeredName.contains(query)
|| contact.uri.toString().contains(query)
override fun toString(): String = displayUri
companion object {
val EMPTY_VM: Observable<ContactViewModel> =
Observable.just(ContactViewModel(Contact(Uri.fromId("")), Profile.EMPTY_PROFILE))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment