xabber-android icon indicating copy to clipboard operation
xabber-android copied to clipboard

VCard Avatars don't seem to update once populated

Open jorticus opened this issue 8 years ago • 1 comments

I've noticed that avatars don't seem to update when a contact changes their VCard-based avatar, or even when exiting/opening Xabber (I noticed this using contacts connected with Pidgin and a custom chatbot).

I can only get the avatar to update if I manually open the contact and open the 'Contact Info' pane, or if I clear the Xabber app data and re-add my account, causing all my contacts to be re-populated.

Xabber logs show that the VCard is being requested and sent, but for whatever reason it's not updating the UI or not detecting the new VCard. The logging isn't verbose enough to tell me exactly what is happening in Xabber code though.

On startup: (Avatar does not update to the data contained within the VCard)

2017-07-08_15-14-12 D/Smack﹕ RECV (0): <presence to='[email protected]' from='[email protected]/mem'><priority>1</priority><c hash='sha-1' ver='I22W7CegORwdbnu0ZiQwGpxr0Go=' node='http://pidgin.im/' xmlns='http://jabber.org/protocol/caps'/><x xmlns='vcard-temp:x:update'><photo>4f456ae06efc61d4e4c798775ff5a2099457df95</photo></x></presence>
2017-07-08_15-14-12 D/Smack﹕ SENT (0): <iq to='[email protected]' id='FJTr9-384' type='get'><vCard xmlns='vcard-temp'/></iq>
2017-07-08_15-14-13 D/Smack﹕ RECV (0): <iq id='FJTr9-384' type='result' to='[email protected]/Xabber_KO5ePDhw' from='[email protected]'><vCard prodid='-//HandGen//NONSGML vGen v1.0//EN' version='2.1' xmlns='vcard-temp'><NICKNAME>potatobot</NICKNAME><FN/><URL>--snip--</URL><ADR><WORK/><HOME/></ADR><DESC>Add me to your contacts!</DESC><PHOTO><TYPE>image/png</TYPE><BINVAL>--snip--</BINVAL></PHOTO></vCard></iq>

On avatar changed:

2017-07-08_15-15-16 D/Smack﹕ RECV (0): <presence to='[email protected]' from='[email protected]/mem'><priority>1</priority><c hash='sha-1' ver='I22W7CegORwdbnu0ZiQwGpxr0Go=' node='http://pidgin.im/' xmlns='http://jabber.org/protocol/caps'/><x xmlns='vcard-temp:x:update'><photo>4141ddacd1d9b7da2212ed218e2bbc5060d0e0e9</photo></x></presence>
2017-07-08_15-15-16 W/com.xabber.android.data.extension.avatar.AvatarStorage@ea7ca06: java.io.FileNotFoundException: /data/user/0/com.xabber.android/files/avatars/4141ddacd1d9b7da2212ed218e2bbc5060d0e0e9 (No such file or directory)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:146)
	at com.xabber.android.data.extension.avatar.AvatarStorage.read(Unknown Source)
	at com.xabber.android.data.extension.avatar.AvatarManager.loadBitmap(Unknown Source)
	at com.xabber.android.data.extension.avatar.AvatarManager.access$100(Unknown Source)
	at com.xabber.android.data.extension.avatar.AvatarManager$4.run(Unknown Source)
	at com.xabber.android.data.Application$9.run(Unknown Source)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
	at java.lang.Thread.run(Thread.java:761)

2017-07-08_15-15-16 E/com.xabber.android.data.extension.avatar.AvatarStorage@ea7ca06﹕ java.io.FileNotFoundException: /data/user/0/com.xabber.android/files/avatars/4141ddacd1d9b7da2212ed218e2bbc5060d0e0e9 (No such file or directory)
--snip additional stack trace--
2017-07-08_15-15-16 D/Smack﹕ SENT (0): <iq to='[email protected]' id='FJTr9-391' type='get'><vCard xmlns='vcard-temp'/></iq>
2017-07-08_15-15-17 D/Smack﹕ RECV (0): <iq id='FJTr9-391' type='result' to='[email protected]/Xabber_KO5ePDhw' from='[email protected]'><vCard version='2.1' prodid='-//HandGen//NONSGML vGen v1.0//EN' xmlns='vcard-temp'><NICKNAME>potatobot</NICKNAME><FN/><URL>--snip--</URL><ADR><WORK/><HOME/></ADR><DESC>Add me to your contacts!</DESC><PHOTO><TYPE>image/png</TYPE><BINVAL>--snip: new base64 encoded image--</BINVAL></PHOTO></vCard></iq>

On opening 'Contact Info' pane: (VCard is re-fetched even though content hasn't changed, but it actually updates the avatar image this time)

2017-07-08_15-15-21 D/com.xabber.android.ui.activity.ChatActivity@fdb962d﹕ onPause
2017-07-08_15-15-21 D/com.xabber.android.ui.activity.ContactListActivity@5718e8c﹕ onResume
2017-07-08_15-15-22 D/com.xabber.android.ui.activity.ChatActivity@fdb962d﹕ onDestroy
2017-07-08_15-15-22 D/com.xabber.android.ui.activity.ContactListActivity@5718e8c﹕ onPause
2017-07-08_15-15-22 D/com.xabber.android.ui.activity.ChatActivity@5df7a5c﹕ onCreate: Intent { act=com.xabber.android.data.ACTION_SPECIFIC_CHAT dat=/[email protected]/Xabber_KO5ePDhw/[email protected] cmp=com.xabber.android/.ui.activity.ChatActivity }
2017-07-08_15-15-22 D/ChatActivity﹕ onCreate null
2017-07-08_15-15-22 D/ChatActivity﹕ getInitialChatFromIntent [email protected]
2017-07-08_15-15-22 D/com.xabber.android.ui.activity.ChatActivity@5df7a5c﹕ onResume
2017-07-08_15-15-22 D/ChatActivity﹕ onResume
2017-07-08_15-15-22 D/ChatFragment{9c41c63 #0 id=0x7f11009e android:switcher:2131820702:1}﹕ onCreate [email protected]
2017-07-08_15-15-22 D/ChatFragment{9c41c63 #0 id=0x7f11009e android:switcher:2131820702:1}﹕ onResume
2017-07-08_15-15-25 D/com.xabber.android.ui.activity.ChatActivity@5df7a5c﹕ onPause
2017-07-08_15-15-25 D/com.xabber.android.ui.activity.ContactEditActivity@c7bb0aa﹕ onCreate: Intent { dat=/[email protected]/Xabber_KO5ePDhw/[email protected] cmp=com.xabber.android/.ui.activity.ContactEditActivity }
2017-07-08_15-15-25 D/com.xabber.android.ui.activity.ContactEditActivity@c7bb0aa﹕ onResume
2017-07-08_15-15-25 D/Smack﹕ SENT (0): <iq to='[email protected]' id='FJTr9-394' type='get'><vCard xmlns='vcard-temp'/></iq>
2017-07-08_15-15-25 D/Smack﹕ RECV (0): <iq id='FJTr9-394' type='result' to='[email protected]/Xabber_KO5ePDhw' from='[email protected]'><vCard version='2.1' prodid='-//HandGen//NONSGML vGen v1.0//EN' xmlns='vcard-temp'><NICKNAME>potatobot</NICKNAME><FN/><URL>--snip--</URL><ADR><WORK/><HOME/></ADR><DESC>Add me to your contacts!</DESC><PHOTO><TYPE>image/png</TYPE><BINVAL>--snip: same image content as last VCard--</BINVAL></PHOTO></vCard></iq>
2017-07-08_15-15-26 D/com.xabber.android.ui.activity.ContactEditActivity@c7bb0aa﹕ onPause
2017-07-08_15-15-26 D/com.xabber.android.ui.activity.ChatActivity@5df7a5c﹕ onResume
2017-07-08_15-15-26 D/ChatActivity﹕ onResume

(In these logs, [email protected] is the Xabber user, and [email protected] is my bot account logged into Pidgin)

jorticus avatar Jul 08 '17 22:07 jorticus

Same problem

hsklia avatar Sep 20 '17 13:09 hsklia