Commit 026a84b4 authored by Nicolas Jager's avatar Nicolas Jager

Account : improvement for add existing account

Change-Id: Ibdeb9f48d881e42c67e011d8db4cdf524f7eb55a
Tuleap: #790
parent fac013fe
......@@ -84,10 +84,9 @@ MainPage::MainPage()
visibilityChangedEventToken = Window::Current->VisibilityChanged +=
ref new WindowVisibilityChangedEventHandler(this, &MainPage::Application_VisibilityChanged);
/*applicationSuspendingEventToken = Application::Current->Suspending +=
ref new SuspendingEventHandler(this, &MainPage::Application_Suspending);
applicationResumingEventToken = Application::Current->Resuming +=
ref new EventHandler<Object^>(this, &MainPage::Application_Resuming);*/
ref new EventHandler<Object^>(this, &MainPage::Application_Resuming);
RingD::instance->registrationStateErrorGeneric += ref new RingClientUWP::RegistrationStateErrorGeneric(this, &RingClientUWP::MainPage::OnregistrationStateErrorGeneric);
RingD::instance->registrationStateRegistered += ref new RingClientUWP::RegistrationStateRegistered(this, &RingClientUWP::MainPage::OnregistrationStateRegistered);
}
void
......@@ -437,3 +436,15 @@ void RingClientUWP::MainPage::OncloseMessageTextPage()
auto smartPanel = dynamic_cast<SmartPanel^>(_smartPanel_->Content);
smartPanel->unselectContact();
}
void RingClientUWP::MainPage::OnregistrationStateErrorGeneric(const std::string& accountId)
{
showLoadingOverlay(false, false);
}
void RingClientUWP::MainPage::OnregistrationStateRegistered()
{
showLoadingOverlay(false, false);
}
......@@ -77,5 +77,7 @@ private:
void OnpressHangUpCall();
void OnstateChange(Platform::String ^callId, CallStatus state, int code);
void OncloseMessageTextPage();
void OnregistrationStateErrorGeneric(const std::string& accountId);
void OnregistrationStateRegistered();
};
}
......@@ -88,7 +88,8 @@ RingClientUWP::RingD::reloadAccountList()
accountUpdated(account);
}
else {
RingClientUWP::ViewModel::AccountsViewModel::instance->addRingAccount(alias, ringID, accountId, deviceId, upnpState);
if (!ringID.empty())
RingClientUWP::ViewModel::AccountsViewModel::instance->addRingAccount(alias, ringID, accountId, deviceId, upnpState);
}
}
else { /* SIP */
......@@ -503,11 +504,22 @@ RingD::registerCallbacks()
CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(CoreDispatcherPriority::High,
ref new DispatchedHandler([=]() {
reloadAccountList();
if (editModeOn_) {
// enleves ce qui suit et utilises des evenements.
registrationStateRegistered();
// mettre a jour le wizard
/*if (editModeOn_) {
auto frame = dynamic_cast<Frame^>(Window::Current->Content);
dynamic_cast<RingClientUWP::MainPage^>(frame->Content)->showLoadingOverlay(false, false);
editModeOn_ = false;
}
}*/
}));
}
else if (state == DRing::Account::States::ERROR_GENERIC) {
CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(CoreDispatcherPriority::High,
ref new DispatchedHandler([=]() {
reloadAccountList();
registrationStateErrorGeneric(account_id);
// ajoute cet event dans le wizard
}));
}
}),
......@@ -893,6 +905,12 @@ RingD::dequeueTasks()
deviceDetails.insert(std::make_pair(DRing::Account::ConfProperties::ARCHIVE_PIN, pin));
deviceDetails.insert(std::make_pair(DRing::Account::ConfProperties::ARCHIVE_PASSWORD, password));
DRing::addAccount(deviceDetails);
CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(CoreDispatcherPriority::High,
ref new DispatchedHandler([=]() {
auto frame = dynamic_cast<Frame^>(Window::Current->Content);
dynamic_cast<RingClientUWP::MainPage^>(frame->Content)->showLoadingOverlay(true, true);
}));
}
break;
case Request::GetKnownDevices:
......
......@@ -40,6 +40,8 @@ delegate void AccountUpdated(Account^ account);
delegate void IncomingVideoMuted(String^ callId, bool state);
delegate void RegisteredNameFound(LookupStatus status, const std::string& address, const std::string& name);
delegate void FinishCaptureDeviceEnumeration();
delegate void RegistrationStateErrorGeneric(const std::string& accountId);
delegate void RegistrationStateRegistered();
using SharedCallback = std::shared_ptr<DRing::CallbackWrapperBase>;
using namespace std::placeholders;
......@@ -147,6 +149,8 @@ internal:
event IncomingVideoMuted^ incomingVideoMuted;
event RegisteredNameFound^ registeredNameFound;
event FinishCaptureDeviceEnumeration^ finishCaptureDeviceEnumeration;
event RegistrationStateErrorGeneric^ registrationStateErrorGeneric;
event RegistrationStateRegistered^ registrationStateRegistered;
private:
/* sub classes */
......
......@@ -475,13 +475,23 @@
Background="#FFE4F1F9"
ItemTemplate="{StaticResource AccountListItemsTemplate}"/>
</ScrollViewer>
<Button x:Name="_addAccountBtn_"
Grid.Row="1"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Content="&#xE948;"
Click="_addAccountBtn__Click"
Style="{StaticResource ButtonStyle6}"/>
<StackPanel Orientation="Horizontal"
Grid.Row="1">
<!--Style="{StaticResource ButtonStyle6}"-->
<Button x:Name="_addAccountBtn_"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Content="&#xE948;"
Click="_addAccountBtn__Click"
Style="{StaticResource ButtonStyle5}"/>
<!--Style="{StaticResource ButtonStyle6}"-->
<Button x:Name="_linkThisDeviceBtn_"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Content="&#xEBD2;"
Click="_linkThisDeviceBtn__Click"
Style="{StaticResource ButtonStyle5}"/>
</StackPanel>
</Grid>
<!-- account creation menu. -->
<Grid x:Name="_accountCreationMenuGrid_"
......@@ -695,6 +705,92 @@
</StackPanel>
</Grid>
</Grid>
<!-- add account menu. -->
<Grid x:Name="_accountAddMenuGrid_"
Visibility="Collapsed"
Grid.Row="2"
Background="LightBlue">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal"
Background="#FFE4F1F9"
Padding="10"
Grid.Row="0">
<Button x:Name="_step1button_"
Click="_step1button__Click"
Content="Step 1"/>
<TextBlock Text=">"/>
<Button x:Name="_step2button_"
Click="_step2button__Click"
Content="Step 2"/>
</StackPanel>
<!-- step 1. -->
<StackPanel x:Name="_step1Menu_"
Background="#FFE4F1F9"
Padding="10"
Grid.Row="1">
<TextBlock Text="To link this device to a Ring account, you'll first need to generate a PIN from Ring on a device hosting the account."
TextWrapping="Wrap"
TextAlignment="Justify"/>
<HyperlinkButton Content="Learn more"
Margin="0,0,0,10"
NavigateUri="http://ring.cx"/>
</StackPanel>
<!-- step 2. -->
<StackPanel x:Name="_step2Menu_"
Background="#FFE4F1F9"
Visibility="Collapsed"
Grid.Row="1">
<TextBox x:Name="_PINTextBox_"
Margin="10"
GotFocus="_PINTextBox__GotFocus"
PlaceholderText="Enter PIN"/>
<PasswordBox x:Name="_ArchivePassword_"
Margin="10"
PlaceholderText="Enter your password"/>
<TextBlock x:Name="_response_"
Foreground="Red"
HorizontalAlignment="Center"
Text=""/>
</StackPanel>
<!-- buttons next step and yes/no to add the account. -->
<Grid Grid.Row="2">
<StackPanel Orientation="Horizontal"
Padding="10,0"
HorizontalAlignment="Center">
<Button x:Name="_nextstep_"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Content="&#xE081;"
Click="_step2button__Click"
Style="{StaticResource ButtonStyle2}"/>
<Button x:Name="_addAccountYes_"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Visibility="Collapsed"
Content="&#xE081;"
Click="_addAccountYes__Click"
Style="{StaticResource ButtonStyle5}"/>
<Button x:Name="_addAccountNo_"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Visibility="Collapsed"
Content="&#xE106;"
Click="_addAccountNo__Click"
Style="{StaticResource ButtonStyle5}"/>
</StackPanel>
</Grid>
</Grid>
<!--<StackPanel Orientation="Horizontal"
Margin="0,20">
<TextBlock Style="{StaticResource TextSegoeStyle-20pt-black}"
Margin="0,0,10,0"
Text="&#xE8EC;"/>
<TextBlock Text="Alias"/>
</StackPanel>-->
<!-- account edition menu. -->
<Grid x:Name="_accountEditionGrid_"
Grid.Row="2"
......@@ -740,7 +836,7 @@
Style="{StaticResource TextSegoeStyle-20pt-red}"
Text="&#xE10A;"/>
</Grid>
<!-- upnp sub menu. -->
<!-- edition sub menu. -->
<StackPanel x:Name="_ringStackEdition_">
<!-- register account on blockachain -->
<StackPanel Orientation="Horizontal"
......
This diff is collapsed.
......@@ -129,6 +129,7 @@ private:
void checkStateAddAccountMenu();
void checkStateEditionMenu();
void ringTxtBxPlaceHolderDelay(String^ placeHolderText, int delayInMilliSeconds);
void showLinkThisDeviceStep1();
/* members */
void _devicesMenuButton__Unchecked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
......@@ -161,6 +162,14 @@ private:
void _deleteAccountEdition__Toggled(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _RegisterStateEdition__Toggled(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _ringTxtBx__KeyUp(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e);
void _linkThisDeviceBtn__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _step2button__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _step1button__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _addAccountNo__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _addAccountYes__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void OnregistrationStateErrorGeneric(const std::string& accountId);
void _PINTextBox__GotFocus(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void OnregistrationStateRegistered();
};
}
}
......@@ -217,7 +217,7 @@
Click="_step2button__Click"
Content="Step 2"/>
</StackPanel>
<!-- add account menu. -->
<!-- step 1. -->
<StackPanel x:Name="_step1Menu_"
Background="#FFE4F1F9"
Padding="10"
......@@ -229,17 +229,22 @@
Margin="0,0,0,10"
NavigateUri="http://ring.cx"/>
</StackPanel>
<!-- add account menu. -->
<!-- step 2. -->
<StackPanel x:Name="_step2Menu_"
Background="#FFE4F1F9"
Visibility="Collapsed"
Grid.Row="1">
<TextBox x:Name="_PINTextBox_"
Margin="10"
GotFocus="_PINTextBox__GotFocus"
PlaceholderText="Enter PIN"/>
<PasswordBox x:Name="_ArchivePassword_"
Margin="10"
PlaceholderText="Enter your password"/>
<TextBlock x:Name="_response_"
Foreground="Red"
HorizontalAlignment="Center"
Text=""/>
</StackPanel>
<!-- buttons next step and yes/no to add the account. -->
<Grid Grid.Row="2">
......
......@@ -30,6 +30,7 @@ Wizard::Wizard()
InitializeComponent();
/* connect to delegates */
RingD::instance->registeredNameFound += ref new RingClientUWP::RegisteredNameFound(this, &RingClientUWP::Views::Wizard::OnregisteredNameFound);
RingD::instance->registrationStateErrorGeneric += ref new RingClientUWP::RegistrationStateErrorGeneric(this, &RingClientUWP::Views::Wizard::OnregistrationStateErrorGeneric);
}
void RingClientUWP::Views::Wizard::OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs ^ e)
......@@ -295,3 +296,15 @@ void RingClientUWP::Views::Wizard::OnregisteredNameFound(LookupStatus status, co
checkState();
}
void RingClientUWP::Views::Wizard::OnregistrationStateErrorGeneric(const std::string &accountId)
{
_response_->Text = "Credentials error or PIN expired.";
}
void RingClientUWP::Views::Wizard::_PINTextBox__GotFocus(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
_response_->Text = "";
}
......@@ -38,6 +38,8 @@ private:
bool isPublic = true;
bool isUsernameValid; // available
bool isFullNameValid;
void OnregistrationStateErrorGeneric(const std::string &accountId);
void _PINTextBox__GotFocus(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
};
}
......
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