mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-29 12:45:20 +01:00
null checks around Application.Current
for SyncService
.
This commit is contained in:
parent
74972336c6
commit
428e35237f
@ -54,8 +54,8 @@ namespace Bit.App.Services
|
|||||||
{
|
{
|
||||||
SyncCompleted(false);
|
SyncCompleted(false);
|
||||||
|
|
||||||
if(cipher.StatusCode == System.Net.HttpStatusCode.Forbidden
|
if(Application.Current != null && (cipher.StatusCode == System.Net.HttpStatusCode.Forbidden
|
||||||
|| cipher.StatusCode == System.Net.HttpStatusCode.Unauthorized)
|
|| cipher.StatusCode == System.Net.HttpStatusCode.Unauthorized))
|
||||||
{
|
{
|
||||||
MessagingCenter.Send(Application.Current, "Logout", (string)null);
|
MessagingCenter.Send(Application.Current, "Logout", (string)null);
|
||||||
}
|
}
|
||||||
@ -141,8 +141,8 @@ namespace Bit.App.Services
|
|||||||
{
|
{
|
||||||
SyncCompleted(false);
|
SyncCompleted(false);
|
||||||
|
|
||||||
if(ciphers.StatusCode == System.Net.HttpStatusCode.Forbidden
|
if(Application.Current != null && (ciphers.StatusCode == System.Net.HttpStatusCode.Forbidden
|
||||||
|| ciphers.StatusCode == System.Net.HttpStatusCode.Unauthorized)
|
|| ciphers.StatusCode == System.Net.HttpStatusCode.Unauthorized))
|
||||||
{
|
{
|
||||||
MessagingCenter.Send(Application.Current, "Logout", (string)null);
|
MessagingCenter.Send(Application.Current, "Logout", (string)null);
|
||||||
}
|
}
|
||||||
@ -200,8 +200,8 @@ namespace Bit.App.Services
|
|||||||
{
|
{
|
||||||
SyncCompleted(false);
|
SyncCompleted(false);
|
||||||
|
|
||||||
if(ciphers.StatusCode == System.Net.HttpStatusCode.Forbidden
|
if(Application.Current != null && (ciphers.StatusCode == System.Net.HttpStatusCode.Forbidden
|
||||||
|| ciphers.StatusCode == System.Net.HttpStatusCode.Unauthorized)
|
|| ciphers.StatusCode == System.Net.HttpStatusCode.Unauthorized))
|
||||||
{
|
{
|
||||||
MessagingCenter.Send(Application.Current, "Logout", (string)null);
|
MessagingCenter.Send(Application.Current, "Logout", (string)null);
|
||||||
}
|
}
|
||||||
@ -328,12 +328,22 @@ namespace Bit.App.Services
|
|||||||
|
|
||||||
private void SyncStarted()
|
private void SyncStarted()
|
||||||
{
|
{
|
||||||
|
if(Application.Current == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SyncInProgress = true;
|
SyncInProgress = true;
|
||||||
MessagingCenter.Send(Application.Current, "SyncStarted");
|
MessagingCenter.Send(Application.Current, "SyncStarted");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SyncCompleted(bool successfully)
|
private void SyncCompleted(bool successfully)
|
||||||
{
|
{
|
||||||
|
if(Application.Current == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SyncInProgress = false;
|
SyncInProgress = false;
|
||||||
MessagingCenter.Send(Application.Current, "SyncCompleted", successfully);
|
MessagingCenter.Send(Application.Current, "SyncCompleted", successfully);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user