mirror of
https://github.com/bitwarden/android.git
synced 2024-12-18 23:31:52 +03:00
null checks around Application.Current
for SyncService
.
This commit is contained in:
parent
74972336c6
commit
428e35237f
1 changed files with 16 additions and 6 deletions
|
@ -54,8 +54,8 @@ namespace Bit.App.Services
|
|||
{
|
||||
SyncCompleted(false);
|
||||
|
||||
if(cipher.StatusCode == System.Net.HttpStatusCode.Forbidden
|
||||
|| cipher.StatusCode == System.Net.HttpStatusCode.Unauthorized)
|
||||
if(Application.Current != null && (cipher.StatusCode == System.Net.HttpStatusCode.Forbidden
|
||||
|| cipher.StatusCode == System.Net.HttpStatusCode.Unauthorized))
|
||||
{
|
||||
MessagingCenter.Send(Application.Current, "Logout", (string)null);
|
||||
}
|
||||
|
@ -141,8 +141,8 @@ namespace Bit.App.Services
|
|||
{
|
||||
SyncCompleted(false);
|
||||
|
||||
if(ciphers.StatusCode == System.Net.HttpStatusCode.Forbidden
|
||||
|| ciphers.StatusCode == System.Net.HttpStatusCode.Unauthorized)
|
||||
if(Application.Current != null && (ciphers.StatusCode == System.Net.HttpStatusCode.Forbidden
|
||||
|| ciphers.StatusCode == System.Net.HttpStatusCode.Unauthorized))
|
||||
{
|
||||
MessagingCenter.Send(Application.Current, "Logout", (string)null);
|
||||
}
|
||||
|
@ -200,8 +200,8 @@ namespace Bit.App.Services
|
|||
{
|
||||
SyncCompleted(false);
|
||||
|
||||
if(ciphers.StatusCode == System.Net.HttpStatusCode.Forbidden
|
||||
|| ciphers.StatusCode == System.Net.HttpStatusCode.Unauthorized)
|
||||
if(Application.Current != null && (ciphers.StatusCode == System.Net.HttpStatusCode.Forbidden
|
||||
|| ciphers.StatusCode == System.Net.HttpStatusCode.Unauthorized))
|
||||
{
|
||||
MessagingCenter.Send(Application.Current, "Logout", (string)null);
|
||||
}
|
||||
|
@ -328,12 +328,22 @@ namespace Bit.App.Services
|
|||
|
||||
private void SyncStarted()
|
||||
{
|
||||
if(Application.Current == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SyncInProgress = true;
|
||||
MessagingCenter.Send(Application.Current, "SyncStarted");
|
||||
}
|
||||
|
||||
private void SyncCompleted(bool successfully)
|
||||
{
|
||||
if(Application.Current == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SyncInProgress = false;
|
||||
MessagingCenter.Send(Application.Current, "SyncCompleted", successfully);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue