Commit 4ed42ea7 authored by atraczyk's avatar atraczyk Committed by Andreas Traczyk

fix: adjustments to vcard implemenation

- uses JPEG for outgoing instead of PNG
- sets the chunk size back to 1KB
- handles empty PHOTO

Change-Id: I761debd2841a024e6a5ad607cad1e278a891c973
Tuleap: #790
parent 6344744e
......@@ -230,8 +230,6 @@
<RowDefinition Height="auto"/>
<!-- row definition for the incoming call bar. -->
<RowDefinition Height="auto"/>
<!-- row definition for the outgoing call bar. -->
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<!--helper to detect mouse overing-->
<Rectangle Fill="Transparent" Grid.Row="0"/>
......
......@@ -82,7 +82,6 @@ SmartPanel::SmartPanel()
_selectedAccountAvatar_->ImageSource = ref new BitmapImage(uri);
});
ContactsViewModel::instance->contactDataModified += ref new ContactDataModified([this](Contact^ contact){
});
AccountsViewModel::instance->updateScrollView += ref new UpdateScrollView([this]() {
_accountsListScrollView_->UpdateLayout();
......@@ -1160,7 +1159,7 @@ void
RingClientUWP::Views::SmartPanel::_selectedAccountAvatarContainer__PointerReleased(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e)
{
CameraCaptureUI^ cameraCaptureUI = ref new CameraCaptureUI();
cameraCaptureUI->PhotoSettings->Format = CameraCaptureUIPhotoFormat::Png;
cameraCaptureUI->PhotoSettings->Format = CameraCaptureUIPhotoFormat::Jpeg;
cameraCaptureUI->PhotoSettings->CroppedSizeInPixels = Size(80, 80);
create_task(cameraCaptureUI->CaptureFileAsync(CameraCaptureUIMode::Photo))
......
......@@ -62,24 +62,43 @@ VCard::receiveChunk(const std::string& args, const std::string& payload)
}
m_mParts[Property::UID] = _line.substr(4);
bool fnFound = false;
while (std::getline(_payload, _line)) {
if (_line.find("FN:") != std::string::npos)
if (_line.find("FN:") != std::string::npos) {
fnFound = true;
break;
}
}
m_mParts[Property::FN] = _line.substr(3);
if (fnFound)
m_mParts[Property::FN] = _line.substr(3);
while (std::getline(_payload, _line)) {
if (_line.find("PHOTO;") != std::string::npos)
break;
}
// because android client builds vcard differently (TYPE=PNG: vs PNG:)
m_mParts[Property::PHOTO].append(_line.substr(_line.find("PNG:") + 4));
size_t pos = _line.find("PNG:");
if (pos != std::string::npos)
m_mParts[Property::PHOTO].append(_line.substr(pos + 4));
return VCARD_INCOMPLETE;
}
else {
if (_part == _of) {
std::getline(_payload, _line);
m_mParts[Property::PHOTO].append(_line);
bool fnFound = false;
while (std::getline(_payload, _line)) {
if (_line.find("FN:") != std::string::npos) {
fnFound = true;
break;
}
}
if (fnFound)
m_mParts[Property::FN] = _line.substr(3);
saveToFile();
decodeBase64ToPNGFile();
if (!m_mParts[Property::FN].empty())
......@@ -101,7 +120,7 @@ void
VCard::send(std::string callID, const char* vCardFile)
{
int i = 0;
const int chunkSize = 4096;
const int chunkSize = 1024;
std::string vCard;
if (vCardFile) {
std::ifstream file(vCardFile);
......
......@@ -44,7 +44,7 @@ struct Symbols {
constexpr static const char* SEPERATOR1 = ";";
constexpr static const char* SEPERATOR2 = ":";
constexpr static const char* PHOTO_ENC = "ENDCODING=BASE64";
constexpr static const char* PHOTO_TYPE = "TYPE=PNG";
constexpr static const char* PHOTO_TYPE = "TYPE=JPEG";
};
struct Property {
......@@ -74,6 +74,7 @@ internal:
private:
std::map<std::string, std::string> m_mParts { };
Contact^ m_Owner;
int m_type;
};
......
......@@ -80,7 +80,7 @@ void
Wizard::_avatarWebcamCaptureBtn__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
CameraCaptureUI^ cameraCaptureUI = ref new CameraCaptureUI();
cameraCaptureUI->PhotoSettings->Format = CameraCaptureUIPhotoFormat::JpegXR;
cameraCaptureUI->PhotoSettings->Format = CameraCaptureUIPhotoFormat::Jpeg;
cameraCaptureUI->PhotoSettings->CroppedSizeInPixels = Size(80, 80);
create_task(cameraCaptureUI->CaptureFileAsync(CameraCaptureUIMode::Photo))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment