twilio / twilio-chat-demo-android

Chat API Demo Application for Android
MIT License
62 stars 51 forks source link

member.getAttributes() => attributes are always empty #146

Closed kostik15 closed 4 years ago

kostik15 commented 4 years ago

Firstly I set some attributes for current user.

JSONObject jsonObject = new JSONObject();
try {
                            jsonObject.put("sex", setupModel.getSex());
                            jsonObject.put("age",setupModel.getAge());
                            jsonObject.put("imageVersion", 0 );
                            jsonObject.put("nickname", setupModel.getNickname());
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                        Attributes attributes = new Attributes(jsonObject);
                        user.setAttributes(attributes, new StatusListener() {

These properties have been succesfully set and are also visible in console. image

I joined random public channel. I sent some messages.

Member and current user on picture below have same Sid (are same users). As you can see, attributes for class Member are empty. Attributes for class User have value.

image

I would expect that attributes for these two classes would be same.

It does not matter if I get Member reference from Message or Channel. Attributes always return emtpy dict.

Attributes test3 = channel.getMembers().getMember(message.getAuthor()).getAttributes();

Gray-Wind commented 4 years ago

Member and user are separate entities. Member is per-channel entity, you might want have different attributes across different channels for the same user, but users are unique for a given service instance.