Skip to content
Snippets Groups Projects
Commit 4178e3dc authored by Hadrien De Sousa's avatar Hadrien De Sousa
Browse files

vcard: add uid to locale vcards

There was no uid set on android locale vcard which made lrc to
duplicate the conversation for each new vcard sent

Change-Id: I83b1e0c0db7847d3d2d7e3ae7697f687aae6d236
parent 7824dbe2
No related branches found
No related tags found
No related merge requests found
......@@ -74,6 +74,7 @@ import ezvcard.parameter.ImageType;
import ezvcard.property.FormattedName;
import ezvcard.property.Photo;
import ezvcard.property.RawProperty;
import ezvcard.property.Uid;
public class AccountWizard extends AppCompatActivity implements Observer<ServiceEvent> {
static final String TAG = AccountWizard.class.getName();
......@@ -293,6 +294,8 @@ public class AccountWizard extends AppCompatActivity implements Observer<Service
public void saveProfile(String accountID) {
VCard vcard = new VCard();
vcard.setFormattedName(new FormattedName(mFullname));
String ringId = mAccountService.getCurrentAccount().getUsername();
vcard.setUid(new Uid(ringId));
ByteArrayOutputStream stream = new ByteArrayOutputStream();
if (mPhotoProfile != null) {
mPhotoProfile.compress(Bitmap.CompressFormat.PNG, 100, stream);
......
......@@ -38,6 +38,7 @@ import ezvcard.VCard;
import ezvcard.property.FormattedName;
import ezvcard.property.Photo;
import ezvcard.property.RawProperty;
import ezvcard.property.Uid;
public class RingNavigationPresenter extends RootPresenter<GenericView<RingNavigationViewModel>> implements Observer<ServiceEvent> {
......@@ -87,10 +88,12 @@ public class RingNavigationPresenter extends RootPresenter<GenericView<RingNavig
public void saveVCard(String username, Photo photo) {
String accountId = mAccountService.getCurrentAccount().getAccountID();
String ringId = mAccountService.getCurrentAccount().getUsername();
File filesDir = mDeviceRuntimeService.provideFilesDir();
VCard vcard = VCardUtils.loadLocalProfileFromDisk(filesDir, accountId);
vcard.setFormattedName(username);
vcard.setUid(new Uid(ringId));
vcard.removeProperties(Photo.class);
vcard.addPhoto(photo);
vcard.removeProperties(RawProperty.class);
......
......@@ -231,7 +231,7 @@ public class VCardUtils {
private static VCard setupDefaultProfile(File filesDir, String accountId) {
VCard vcard = new VCard();
vcard.setUid(new Uid(String.valueOf(System.currentTimeMillis())));
vcard.setUid(new Uid(accountId));
saveLocalProfileToDisk(vcard, accountId, filesDir);
return vcard;
}
......
......@@ -41,6 +41,7 @@ import cx.ring.utils.VCardUtils;
import ezvcard.VCard;
import ezvcard.property.FormattedName;
import ezvcard.property.RawProperty;
import ezvcard.property.Uid;
public class SIPCreationPresenter extends RootPresenter<SIPCreationView> implements Observer<ServiceEvent> {
......@@ -217,6 +218,8 @@ public class SIPCreationPresenter extends RootPresenter<SIPCreationView> impleme
formattedName = mAccount.getAlias();
}
vcard.setFormattedName(new FormattedName(formattedName));
String vcardUid = formattedName + accountID;
vcard.setUid(new Uid(vcardUid));
vcard.removeProperties(RawProperty.class);
VCardUtils.saveLocalProfileToDisk(vcard, accountID, mDeviceService.provideFilesDir());
}
......
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