chat-sdk-android icon indicating copy to clipboard operation
chat-sdk-android copied to clipboard

Initial Profile Image

Open matheuaviczki opened this issue 9 years ago • 9 comments

I joined the ChatSDK to my AP, but I need to start it using the default picture of my APP, its ok i was able to start using the default picture of my app, more this photo not its saved on firebase. What happens is that the profile picture is not updated to the small chat picture.

For example, i can start the ChatSDK with my default picture: screenshot_2017-05-08-09-35-38

More this picture not update on Chat small icon, its get the ic_user icon: screenshot_2017-05-08-09-35-03

matheuaviczki avatar May 08 '17 12:05 matheuaviczki

Hi @matheuaviczki,

Can you run me through how you have added this image as the default user image?

Can you confirm that the app is correctly configured to Firebase (are conversations working between two users?). Also have you post a screenshot of the user area in Firebase showing which image has been uploaded to Firebase.

I would expect the problem is either:

  1. Firebase is not configured correctly
  2. The original default image is still being used meaning your new one is not being uploaded.

Simon

simonsmiley64 avatar May 09 '17 13:05 simonsmiley64

Yes, it is correctly configured to firebase, but I can keep a conversation between two users. What happens is that I load an image from a file saved from my other module and i to Circle Image View chat_sdk_circle_ing_profile_pic. However, it does not create an image url to save on firebase storage

matheuaviczki avatar May 09 '17 13:05 matheuaviczki

Can you confirm whether you have swapped your default image with the current default image?

Currently your image shows the default image which suggests you haven't modified the code to replace the current default image with your own.

The default image isn't uploaded to Firebase as it is contained on each version of the app. This means a user image is only uploaded once it is changed. If the user doesn't have an image uploaded then the app shows the default image instead.

This is why it appears you have not switched the default image correctly as it is still using the old one.

Simon

simonsmiley64 avatar May 09 '17 13:05 simonsmiley64

I can not change because they are different profile images, so it has to be dynamic. It loads in the profile, but not in the small imageview of the chat.

I need it when loading this image directly from my module, it will be saved in firebase storage, so it will load it, as if I manually changed the image by clicking on the circle image view, after passing the crop it saves the altered image Automatically on the correct firebase? I need to do the same step for my application, but taking the default image of the user that my other module provides.

I'll disable image swapping by tapping in Circle imageview, the user's image will need to be uploaded through my app.

matheuaviczki avatar May 09 '17 13:05 matheuaviczki

Hi @matheuaviczki,

This functionality seems quite complicated, I don't fully understand your project so am struggling to help troubleshoot your problem.

I would recommend writing some functions that check if the user already has a profile picture set, if they don't you can copy the code we already use to set a user's profile picture, instead use the profile picture from your module. This will then update the picture to the user's Firebase account.

Simon

simonsmiley64 avatar May 09 '17 14:05 simonsmiley64

When I send the default photo of my module, it saves directly to the device in the form of a file named "bitmap.png".

So before the chat comes into resume (), this file is rescued in class ChatSDKLoginActivity and saved in a static variable of bitmap type.

The only problem here is that it is not saving the image in the firebase's storage / files

matheuaviczki avatar May 09 '17 14:05 matheuaviczki

What happens when you set the profile picture in the regular way:

  • Click the profile image
  • Select an image from library

Does this save to Firebase or your device? It should be saving to Firebase so you should follow the flow of this code.

simonsmiley64 avatar May 09 '17 15:05 simonsmiley64

In the normal way, the image is saved in the firebase, but I want to disable it this way.

matheuaviczki avatar May 09 '17 16:05 matheuaviczki

You need to look at how the normal way does it and then use a similar technique to get your picture to update correctly.

There should be a function which sets the users profile image and then pushes the user. You need to modify this to use your image and only get called when the user doesn't have an image set.

simonsmiley64 avatar May 09 '17 18:05 simonsmiley64