Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-client-uwp
Commits
93dbe9e9
Commit
93dbe9e9
authored
Oct 18, 2016
by
Nicolas Jager
Browse files
internal : add creation token to protect against crash
Change-Id: Ice9291bd774de6f8ec21058a3d99885f24c0cc6f Tuleap: #1227
parent
df0a067a
Changes
2
Hide whitespace changes
Inline
Side-by-side
LoadingPage.xaml.cpp
View file @
93dbe9e9
...
...
@@ -52,11 +52,42 @@ LoadingPage::LoadingPage()
.
then
([
this
](
bool
config_exists
)
{
if
(
config_exists
)
{
this
->
Dispatcher
->
RunAsync
(
Windows
::
UI
::
Core
::
CoreDispatcherPriority
::
Normal
,
ref
new
Windows
::
UI
::
Core
::
DispatchedHandler
([
this
]
()
{
this
->
Frame
->
Navigate
(
Windows
::
UI
::
Xaml
::
Interop
::
TypeName
(
MainPage
::
typeid
));
}));
Utils
::
fileExists
(
ApplicationData
::
Current
->
LocalFolder
,
"creation.token"
)
.
then
([
this
](
bool
token_exists
)
{
if
(
token_exists
)
{
/* we have a token, the config has to be considered as corrupted, summon the wizard */
Utils
::
fileExists
(
ApplicationData
::
Current
->
LocalFolder
,
".config
\\
dring.yml"
)
.
then
([
this
](
bool
token_exists
)
{
if
(
token_exists
)
{
StorageFolder
^
storageFolder
=
ApplicationData
::
Current
->
LocalFolder
;
task
<
StorageFile
^>
(
storageFolder
->
GetFileAsync
(
".config
\\
dring.yml"
)).
then
([
this
](
StorageFile
^
folder
)
{
folder
->
DeleteAsync
();
});
}
});
this
->
Dispatcher
->
RunAsync
(
Windows
::
UI
::
Core
::
CoreDispatcherPriority
::
Normal
,
ref
new
Windows
::
UI
::
Core
::
DispatchedHandler
([
this
]()
{
this
->
Frame
->
Navigate
(
Windows
::
UI
::
Xaml
::
Interop
::
TypeName
(
Wizard
::
typeid
));
}));
}
else
{
/* there is no token and we have a config.yml, summon the main page */
this
->
Dispatcher
->
RunAsync
(
Windows
::
UI
::
Core
::
CoreDispatcherPriority
::
Normal
,
ref
new
Windows
::
UI
::
Core
::
DispatchedHandler
([
this
]()
{
this
->
Frame
->
Navigate
(
Windows
::
UI
::
Xaml
::
Interop
::
TypeName
(
MainPage
::
typeid
));
}));
}
});
}
else
{
/* no config file, create the token and summon the wizard*/
StorageFolder
^
storageFolder
=
ApplicationData
::
Current
->
LocalFolder
;
storageFolder
->
CreateFileAsync
(
"creation.token"
,
CreationCollisionOption
::
ReplaceExisting
);
this
->
Dispatcher
->
RunAsync
(
Windows
::
UI
::
Core
::
CoreDispatcherPriority
::
Normal
,
ref
new
Windows
::
UI
::
Core
::
DispatchedHandler
([
this
]
()
{
this
->
Frame
->
Navigate
(
Windows
::
UI
::
Xaml
::
Interop
::
TypeName
(
Wizard
::
typeid
));
}));
...
...
RingD.cpp
View file @
93dbe9e9
...
...
@@ -528,6 +528,21 @@ RingClientUWP::RingD::startDaemon()
}
}
/* at this point the config.yml is safe. */
Utils
::
fileExists
(
ApplicationData
::
Current
->
LocalFolder
,
"creation.token"
)
.
then
([
this
](
bool
token_exists
)
{
if
(
token_exists
)
{
StorageFolder
^
storageFolder
=
ApplicationData
::
Current
->
LocalFolder
;
task
<
StorageFile
^>
(
storageFolder
->
GetFileAsync
(
"creation.token"
)).
then
([
this
](
StorageFile
^
file
)
{
file
->
DeleteAsync
();
});
}
});
while
(
true
)
{
DRing
::
pollEvents
();
dequeueTasks
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment