use of ezvcard.VCard in project ring-client-android by savoirfairelinux.
the class ConversationPresenter method sendTrustRequest.
public void sendTrustRequest() {
VCard vCard = mVCardService.loadSmallVCard(mAccountId);
mAccountService.sendTrustRequest(mAccountId, mContactRingId.getRawRingId(), Blob.fromString(VCardUtils.vcardToString(vCard)));
CallContact contact = mContactService.findContact(mContactRingId);
if (contact == null) {
Log.e(TAG, "sendTrustRequest: not able to find contact");
return;
}
contact.setStatus(CallContact.Status.REQUEST_SENT);
}
use of ezvcard.VCard in project ring-client-android by savoirfairelinux.
the class RingNavigationPresenter method getAlias.
public String getAlias(Account account) {
if (account == null) {
Log.e(TAG, "Not able to get alias");
return null;
}
VCard vcard = VCardUtils.loadLocalProfileFromDisk(mDeviceRuntimeService.provideFilesDir(), account.getAccountID());
FormattedName name = vcard.getFormattedName();
if (name != null) {
String name_value = name.getValue();
if (name_value != null && !name_value.isEmpty()) {
return name_value;
}
}
return null;
}
use of ezvcard.VCard in project ez-vcard by mangstadt.
the class JCardReaderTest method readExtendedType_override_standard_type_classes.
@Test
public void readExtendedType_override_standard_type_classes() throws Throwable {
// @formatter:off
String json = "[\"vcard\"," + "[" + "[\"version\", {}, \"text\", \"4.0\"]," + "[\"fn\", {}, \"text\", \"John Doe\"]" + "]" + "]";
// @formatter:on
JCardReader reader = new JCardReader(json);
reader.registerScribe(new MyFormattedNameScribe());
VCard vcard = reader.readNext();
assertPropertyCount(1, vcard);
assertVersion(V4_0, vcard);
MyFormattedNameProperty prop = vcard.getProperty(MyFormattedNameProperty.class);
assertEquals("JOHN DOE", prop.value);
assertParseWarnings(reader);
assertNoMoreVCards(reader);
}
use of ezvcard.VCard in project ez-vcard by mangstadt.
the class JCardReaderTest method registerExtendedType.
@Test
public void registerExtendedType() throws Throwable {
// @formatter:off
String json = "[\"vcard\"," + "[" + "[\"version\", {}, \"text\", \"4.0\"]," + "[\"x-type\", {}, \"text\", \"value\"]" + "]" + "]";
// @formatter:on
JCardReader reader = new JCardReader(json);
reader.registerScribe(new TypeForTestingScribe());
VCard vcard = reader.readNext();
assertVersion(V4_0, vcard);
assertPropertyCount(1, vcard);
TypeForTesting prop = vcard.getProperty(TypeForTesting.class);
assertEquals("value", prop.value.asSingle());
assertParseWarnings(reader);
assertNoMoreVCards(reader);
}
use of ezvcard.VCard in project ez-vcard by mangstadt.
the class JCardSerializerTest method container.
@Test
public void container() throws Exception {
VCard vcard = new VCard();
vcard.setFormattedName("John Doe");
vcard.setMailer("mailer");
Container container = new Container(vcard);
StringWriter result = new StringWriter();
mapper.writeValue(result, container);
String actual = result.toString();
// @formatter:off
String expected = "{" + "\"contact\":[\"vcard\"," + "[" + "[\"version\",{},\"text\",\"4.0\"]," + "[\"prodid\",{},\"text\",\"ez-vcard " + Ezvcard.VERSION + "\"]," + "[\"fn\",{},\"text\",\"John Doe\"]" + "]" + "]" + "}";
// @formatter:on
assertEquals(expected, actual);
}
Aggregations