Commit 890921f2 authored by atraczyk's avatar atraczyk Committed by Andreas Traczyk

ui/ux: tidy text message page

- loads contact vcard image upon loading the text message page
- removes extended execution handling

Change-Id: I5a45df23b8528877679f7fd6a27583e5c673ca72
Tuleap: #790
parent 7bb6d11c
......@@ -42,7 +42,7 @@ Account::Account(String^ name,
accountType_ = accountType;
accountID_ = accountID;
_deviceId = deviceId;
_upnpState = _upnpState;
_upnpState = upnpState;
_sipHostname = sipHostname;
_sipUsername = sipUsername;
_sipPassword = sipPassword;
......
......@@ -305,33 +305,10 @@ MainPage::Application_Suspending(Object^, Windows::ApplicationModel::SuspendingE
{
MSG_("Application_Suspending");
auto deferral = e->SuspendingOperation->GetDeferral();
Video::VideoManager::instance->captureManager()->CleanupCameraAsync();
MSG_("Hang up calls...");
RingD::instance->deinit();
deferral->Complete();
/*if (Frame->CurrentSourcePageType.Name ==
Interop::TypeName(MainPage::typeid).Name) {
auto deferral = e->SuspendingOperation->GetDeferral();
BeginExtendedExecution()
.then([=](task<void> previousTask) {
try {
previousTask.get();
}
catch (Exception^ e) {
MSG_("Exception: Extended Execution Begin");
}
})
.then([this, deferral](task<void> previousTask) {
try {
previousTask.get();
MSG_("deferral->Complete()");
deferral->Complete();
}
catch (Exception^ e) {
MSG_("Exception: Extended Execution");
deferral->Complete();
}
});
}*/
}
void
......@@ -404,60 +381,6 @@ void MainPage::Application_Resuming(Object^, Object^)
MSG_("Application_Resuming");
}
void
MainPage::SessionRevoked(Object^ sender, ExtendedExecutionRevokedEventArgs^ args)
{
Dispatcher->RunAsync(CoreDispatcherPriority::High, ref new DispatchedHandler([=]() {
ClearExtendedExecution();
}));
}
void
MainPage::ClearExtendedExecution()
{
if (session != nullptr) {
MSG_("End Extended Execution");
session->Revoked -= sessionRevokedToken;
}
}
task<void>
MainPage::BeginExtendedExecution()
{
ClearExtendedExecution();
auto newSession = ref new ExtendedExecutionSession();
newSession->Reason = ExtendedExecutionReason::SavingData;
newSession->Description = "Extended Execution";
sessionRevokedToken = (newSession->Revoked += ref new TypedEventHandler<Object^,
ExtendedExecutionRevokedEventArgs^>(this, &MainPage::SessionRevoked));
return create_task(newSession->RequestExtensionAsync())
.then([=](ExtendedExecutionResult result) {
try {
switch (result)
{
case ExtendedExecutionResult::Allowed:
session = newSession;
MSG_("Request Extended Execution Allowed");
MSG_("Clean up camera...");
Video::VideoManager::instance->captureManager()->CleanupCameraAsync();
MSG_("Hang up calls...");
RingD::instance->deinit();
break;
default:
case ExtendedExecutionResult::Denied:
MSG_("Request Extended Execution Denied");
break;
}
}
catch (Exception^ e) {
EXC_(e);
}
});
}
void RingClientUWP::MainPage::OncloseMessageTextPage()
{
auto smartPanel = dynamic_cast<SmartPanel^>(_smartPanel_->Content);
......
......@@ -57,12 +57,6 @@ private:
void Application_Resuming(Object^ sender, Object^ args);
EventRegistrationToken applicationResumingEventToken;
ExtendedExecutionSession^ session;
void SessionRevoked(Object^ sender, ExtendedExecutionRevokedEventArgs^ args);
EventRegistrationToken sessionRevokedToken;
task<void> BeginExtendedExecution();
void ClearExtendedExecution();
// Multi-monitor, DPI, scale factor change, and window resize detection
void DisplayProperties_DpiChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args);
EventRegistrationToken dpiChangedtoken;
......
......@@ -136,89 +136,96 @@
<Grid Background="#FFF2F2F2">
<Grid.RowDefinitions>
<RowDefinition Height="90" />
<RowDefinition Height="61" />
<RowDefinition Height="*"/>
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Grid Grid.Row="0"
Background="White"
Height="90">
<Grid.RowDefinitions>
<RowDefinition Height="60" />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="280"/>
<ColumnDefinition Width="140"/>
</Grid.ColumnDefinitions>
<Ellipse Grid.Column="0"
Width="50"
Height="50">
<Ellipse.Fill>
<ImageBrush x:Name="_contactBarAvatar_"
ImageSource="ms-appx:///Assets/TESTS/contactAvatar.png"/>
</Ellipse.Fill>
</Ellipse>
<TextBlock x:Name="_title_"
Grid.Column="1"
Text="[TEXT MISSING]"
TextWrapping="NoWrap"
TextTrimming="CharacterEllipsis"
VerticalAlignment="Center"
FontSize="18"
Margin="6" />
<ComboBox x:Name="_associableAccountsList_"
Grid.Column="2"
Margin="6,14,6,6"
Visibility="Collapsed">
<ComboBox.ItemTemplate>
<DataTemplate x:DataType="local:Account">
<TextBlock Text="{x:Bind name_, Mode=OneWay}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Button x:Name="_videoCall_"
Click="_videoCall__Click"
Grid.Column="0"
Content="&#xE714;"
FontFamily="Segoe MDL2 Assets"
FontSize="14"
Style="{StaticResource ButtonStyle4}"
Margin="6,2,6,6"/>
<Button x:Name="_audioCall_"
Grid.Column="1"
Click="_audioCall__Click"
Content="&#xE13A;"
FontSize="14"
FontFamily="Segoe MDL2 Assets"
Style="{StaticResource ButtonStyle4}"
Margin="6,2,6,6"/>
<Button x:Name="_clearConversation_"
Grid.Column="2"
Click="_clearConversation__Click"
Content="&#xE894;"
FontFamily="Segoe MDL2 Assets"
FontSize="14"
Style="{StaticResource ButtonStyle4}"
Margin="6,2,6,6"/>
<Button x:Name="_deleteContact_"
Grid.Column="3"
Click="_deleteContact__Click"
Content="&#xE74D;"
FontFamily="Segoe MDL2 Assets"
FontSize="14"
Style="{StaticResource ButtonStyle4}"
Margin="6,2,6,6"/>
Height="61">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Ellipse Grid.Column="0"
Width="50"
Height="50">
<Ellipse.Fill>
<ImageBrush x:Name="_contactBarAvatar_"
ImageSource="ms-appx:///Assets/TESTS/contactAvatar.png"/>
</Ellipse.Fill>
</Ellipse>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="31" />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="280"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
</Grid>
<TextBlock x:Name="_title_"
Grid.Column="0"
Text="[TEXT MISSING]"
TextWrapping="NoWrap"
TextTrimming="CharacterEllipsis"
VerticalAlignment="Center"
FontSize="16"
Margin="4,0,4,0" />
<ComboBox x:Name="_associableAccountsList_"
Grid.Column="1"
Margin="6,14,6,6"
Visibility="Collapsed">
<ComboBox.ItemTemplate>
<DataTemplate x:DataType="local:Account">
<TextBlock Text="{x:Bind name_, Mode=OneWay}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Button x:Name="_videoCall_"
Click="_videoCall__Click"
Grid.Column="0"
Content="&#xE714;"
FontFamily="Segoe MDL2 Assets"
FontSize="14"
Style="{StaticResource ButtonStyle4}"
Margin="6,2,6,6"/>
<Button x:Name="_audioCall_"
Grid.Column="1"
Click="_audioCall__Click"
Content="&#xE13A;"
FontSize="14"
FontFamily="Segoe MDL2 Assets"
Style="{StaticResource ButtonStyle4}"
Margin="6,2,6,6"/>
<Button x:Name="_clearConversation_"
Grid.Column="2"
Click="_clearConversation__Click"
Content="&#xE894;"
FontFamily="Segoe MDL2 Assets"
FontSize="14"
Style="{StaticResource ButtonStyle4}"
Margin="6,2,6,6"/>
<Button x:Name="_deleteContact_"
Grid.Column="3"
Click="_deleteContact__Click"
Content="&#xE74D;"
FontFamily="Segoe MDL2 Assets"
FontSize="14"
Style="{StaticResource ButtonStyle4}"
Margin="6,2,6,6"/>
</Grid>
</Grid>
</Grid>
<ScrollViewer x:Name="_scrollView_"
......
......@@ -65,18 +65,17 @@ RingClientUWP::Views::MessageTextPage::updatePageContent()
auto item = SmartPanelItemsViewModel::instance->_selectedItem;
auto contact = item->_contact;
if (!contact) /* should never happen */
return;
/* show the name of contact on the page */
_title_->Text = contact->name_;
String^ image_path = Utils::toPlatformString(RingD::instance->getLocalFolder()) + ".vcards\\" + contact->_vcardUID + ".png";
auto uri = ref new Windows::Foundation::Uri(image_path);
_contactBarAvatar_->ImageSource = ref new Windows::UI::Xaml::Media::Imaging::BitmapImage(uri);
if (Utils::fileExists(Utils::toString(image_path))) {
auto uri = ref new Windows::Foundation::Uri(image_path);
_contactBarAvatar_->ImageSource = ref new Windows::UI::Xaml::Media::Imaging::BitmapImage(uri);
}
/* show messages */
_messagesList_->ItemsSource = contact->_conversation->_messages;
......@@ -93,7 +92,6 @@ RingClientUWP::Views::MessageTextPage::updatePageContent()
break;
}
if (found)
_associableAccountsList_->SelectedIndex = index;
else
......
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
<Identity Name="Savoir-faireLinux.GNURing" Publisher="CN=8121A5F7-3CA1-4CAA-92B2-4F595B011941" Version="1.1.11.0" />
<Identity Name="Savoir-faireLinux.GNURing" Publisher="CN=8121A5F7-3CA1-4CAA-92B2-4F595B011941" Version="1.1.12.0" />
<mp:PhoneIdentity PhoneProductId="2385953f-9019-423d-aa82-d1bbacfa258b" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>GNU Ring</DisplayName>
......
......@@ -880,7 +880,7 @@ RingD::dequeueTasks()
auto newAccountId = DRing::addAccount(ringAccountDetails);
if (!task->_registeredName->IsEmpty())
registerName_new(newAccountId, Utils::toString(task->_password), Utils::toString(task->_alias));
registerName_new(newAccountId, Utils::toString(task->_password), Utils::toString(task->_registeredName));
}
break;
case Request::AddSIPAccount:
......
......@@ -72,6 +72,8 @@ RingDebug::print(const std::string& message, const Type& type,
wString = (type>Type::WNG)?(L"(EE) "):((type>Type::MSG)?(L"(WW) "):(L"")) + wString;
String^ msg;
msg = ref new String(wString.c_str(), wString.length());
#if UWP_DBG_VS
/* screen it into VS debug console */
OutputDebugString((wString + L"\n").c_str());
......@@ -79,7 +81,6 @@ RingDebug::print(const std::string& message, const Type& type,
#if UWP_DBG_CLIENT
/* fire the event. */
msg = ref new String(wString.c_str(), wString.length());
messageToScreen(msg);
#endif
......
......@@ -295,7 +295,6 @@
<ColumnDefinition x:Name="_selectedAccountAvatarColumn_"
Width="90"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>
<Ellipse
x:Name="_selectedAccountAvatarContainer_"
......@@ -341,6 +340,11 @@
Style="{StaticResource TextStyle2}"/>
<StackPanel Orientation="Horizontal">
<!--Content="&#xE0A1;-->
<Button x:Name="_smartGridButton_"
VerticalAlignment="Bottom"
Content="&#xe716;"
Click="_smartGridButton__Clicked"
Style="{StaticResource smartGridButtonStyle}"/>
<ToggleButton x:Name="_accountsMenuButton_"
VerticalAlignment="Bottom"
Content="&#xE168;"
......@@ -363,15 +367,15 @@
Checked="_devicesMenuButton__Checked"
Unchecked="_devicesMenuButton__Unchecked"
Style="{StaticResource ToggleButtonStyle1}"/>
<!-- _settingsMenuButton_ -->
<ToggleButton x:Name="_settingsMenuButton_"
VerticalAlignment="Bottom"
Content="&#xE115;"
Checked="_settingsMenu__Checked"
Unchecked="_settingsMenu__Unchecked"
Style="{StaticResource ToggleButtonStyle1}"/>
</StackPanel>
</StackPanel>
<ToggleButton x:Name="_settingsMenuButton_"
Grid.Column="2"
VerticalAlignment="Bottom"
Content="&#xE115;"
Checked="_settingsMenu__Checked"
Unchecked="_settingsMenu__Unchecked"
Style="{StaticResource ToggleButtonStyle1}"/>
</Grid>
<!--sub menus like the accounts list or the share menu are just below, technicaly they are nested inside the
......
......@@ -120,6 +120,17 @@ SmartPanel::SmartPanel()
case CallStatus::NONE:
case CallStatus::ENDED:
{
bool isInCall = false;
for (auto item : SmartPanelItemsViewModel::instance->itemsList) {
if (item->_callId && item->_callStatus == CallStatus::IN_PROGRESS) {
isInCall = true;
RingD::instance->currentCallId = item->_callId;
break;
}
}
if (!isInCall)
_settingsMenuButton_->Visibility = VIS::Visible;
item->_callId = "";
break;
}
......@@ -143,7 +154,6 @@ SmartPanel::SmartPanel()
});
RingD::instance->devicesListRefreshed += ref new RingClientUWP::DevicesListRefreshed(this, &RingClientUWP::Views::SmartPanel::OndevicesListRefreshed);
ContactsViewModel::instance->contactAdded += ref new ContactAdded([this](Contact^ contact) {
auto smartPanelItem = ref new SmartPanelItem();
smartPanelItem->_contact = contact;
......@@ -207,9 +217,23 @@ void RingClientUWP::Views::SmartPanel::unselectContact()
_smartList_->SelectedItem = nullptr;
}
void RingClientUWP::Views::SmartPanel::_smartGridButton__Clicked(Object^ sender, RoutedEventArgs^ e)
{
_accountsMenuButton__Unchecked(nullptr,nullptr);
_accountsMenuButton_->IsChecked = false;
_shareMenuButton__Unchecked(nullptr,nullptr);
_shareMenuButton_->IsChecked = false;
_devicesMenuButton__Unchecked(nullptr,nullptr);
_devicesMenuButton_->IsChecked = false;
_settingsMenu_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_settingsMenuButton_->IsChecked = false;
_smartGrid_->Visibility = Windows::UI::Xaml::Visibility::Visible;
}
void RingClientUWP::Views::SmartPanel::_accountsMenuButton__Checked(Object^ sender, RoutedEventArgs^ e)
{
_settingsMenu__Unchecked(nullptr,nullptr);
_settingsMenu_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_settingsMenuButton_->IsChecked = false;
_shareMenuButton_->IsChecked = false;
_devicesMenuButton_->IsChecked = false;
......@@ -303,7 +327,7 @@ void RingClientUWP::Views::SmartPanel::setMode(RingClientUWP::Views::SmartPanel:
void RingClientUWP::Views::SmartPanel::_shareMenuButton__Checked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
_settingsMenu__Unchecked(nullptr,nullptr);
_settingsMenu_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_settingsMenuButton_->IsChecked = false;
_shareMenuGrid_->Visibility = Windows::UI::Xaml::Visibility::Visible;
_accountsMenuGrid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
......@@ -508,6 +532,8 @@ SmartPanel::_callContact__Click(Platform::Object^ sender, Windows::UI::Xaml::Rou
/* force to hide the button, avoid attempting to call several times... */
button->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_settingsMenuButton_->Visibility = VIS::Collapsed;
auto item = dynamic_cast<SmartPanelItem^>(button->DataContext);
if (item) {
auto contact = item->_contact;
......@@ -884,7 +910,7 @@ void RingClientUWP::Views::SmartPanel::_devicesMenuButton__Unchecked(Platform::O
void RingClientUWP::Views::SmartPanel::_devicesMenuButton__Checked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
_settingsMenu__Unchecked(nullptr,nullptr);
_settingsMenu_->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
_settingsMenuButton_->IsChecked = false;
_waitingDevicesList_->Visibility = Windows::UI::Xaml::Visibility::Visible;
......@@ -1103,8 +1129,7 @@ void RingClientUWP::Views::SmartPanel::_acceptAccountModification__Click(Platfor
_accountsMenuButton_->IsChecked = false;
if (_usernameValidEdition_->Visibility == Windows::UI::Xaml::Visibility::Visible && _usernameTextBoxEdition_->Text->Length() > 2)
RingD::instance->registerName(account->accountID_, "", _usernameTextBoxEdition_->Text);
RingD::instance->registerName_new(Utils::toString(account->accountID_), "", Utils::toString(_usernameTextBoxEdition_->Text));
}
......
......@@ -99,6 +99,7 @@ internal:
private:
/* functions */
void _smartGridButton__Clicked(Object^ sender, RoutedEventArgs^ e);
void _accountsMenuButton__Checked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _accountsMenuButton__Unchecked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _settingsMenu__Checked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
......
......@@ -288,7 +288,22 @@
<Style x:Key="ToggleButtonStyle1"
TargetType="ToggleButton">
<Setter Property="Width"
Value="50"/>
Value="46"/>
<Setter Property="Height"
Value="30"/>
<Setter Property="FontFamily"
Value="Segoe MDL2 Assets"/>
<Setter Property="Foreground"
Value="White"/>
<Setter Property="Background"
Value="Transparent"/>
<Setter Property="BorderThickness"
Value="0"/>
</Style>
<Style x:Key="smartGridButtonStyle"
TargetType="Button">
<Setter Property="Width"
Value="46"/>
<Setter Property="Height"
Value="30"/>
<Setter Property="FontFamily"
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
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