From 2fb2d99541c4ea64c908fe7ed179884eb7a4c048 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 19 Jul 2016 19:38:13 -0400 Subject: [PATCH] Invoke logout message always on main thread. --- src/App/App.cs | 5 +---- src/App/Services/FolderService.cs | 4 ++-- src/App/Services/SiteService.cs | 4 ++-- src/App/Services/SyncService.cs | 6 +++--- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/App/App.cs b/src/App/App.cs index 6bb139a38..8407fc463 100644 --- a/src/App/App.cs +++ b/src/App/App.cs @@ -178,10 +178,7 @@ namespace Bit.App private void Logout(string logoutMessage) { _authService.LogOut(); - Device.BeginInvokeOnMainThread(() => - { - _pushNotification.Unregister(); - }); + _pushNotification.Unregister(); Current.MainPage = new HomePage(); if(!string.IsNullOrWhiteSpace(logoutMessage)) { diff --git a/src/App/Services/FolderService.cs b/src/App/Services/FolderService.cs index 10e5eb162..7b5f1dd6a 100644 --- a/src/App/Services/FolderService.cs +++ b/src/App/Services/FolderService.cs @@ -75,7 +75,7 @@ namespace Bit.App.Services else if(response.StatusCode == System.Net.HttpStatusCode.Forbidden || response.StatusCode == System.Net.HttpStatusCode.Unauthorized) { - MessagingCenter.Send(Application.Current, "Logout", (string)null); + Device.BeginInvokeOnMainThread(() => MessagingCenter.Send(Application.Current, "Logout", (string)null)); } return response; @@ -91,7 +91,7 @@ namespace Bit.App.Services else if(response.StatusCode == System.Net.HttpStatusCode.Forbidden || response.StatusCode == System.Net.HttpStatusCode.Unauthorized) { - MessagingCenter.Send(Application.Current, "Logout", (string)null); + Device.BeginInvokeOnMainThread(() => MessagingCenter.Send(Application.Current, "Logout", (string)null)); } return response; diff --git a/src/App/Services/SiteService.cs b/src/App/Services/SiteService.cs index a9e07e3c7..128c801da 100644 --- a/src/App/Services/SiteService.cs +++ b/src/App/Services/SiteService.cs @@ -82,7 +82,7 @@ namespace Bit.App.Services else if(response.StatusCode == System.Net.HttpStatusCode.Forbidden || response.StatusCode == System.Net.HttpStatusCode.Unauthorized) { - MessagingCenter.Send(Application.Current, "Logout", (string)null); + Device.BeginInvokeOnMainThread(() => MessagingCenter.Send(Application.Current, "Logout", (string)null)); } return response; @@ -98,7 +98,7 @@ namespace Bit.App.Services else if(response.StatusCode == System.Net.HttpStatusCode.Forbidden || response.StatusCode == System.Net.HttpStatusCode.Unauthorized) { - MessagingCenter.Send(Application.Current, "Logout", (string)null); + Device.BeginInvokeOnMainThread(() => MessagingCenter.Send(Application.Current, "Logout", (string)null)); } return response; diff --git a/src/App/Services/SyncService.cs b/src/App/Services/SyncService.cs index 5678fe538..45e4a8adf 100644 --- a/src/App/Services/SyncService.cs +++ b/src/App/Services/SyncService.cs @@ -59,7 +59,7 @@ namespace Bit.App.Services if(cipher.StatusCode == System.Net.HttpStatusCode.Forbidden || cipher.StatusCode == System.Net.HttpStatusCode.Unauthorized) { - MessagingCenter.Send(Application.Current, "Logout", (string)null); + Device.BeginInvokeOnMainThread(() => MessagingCenter.Send(Application.Current, "Logout", (string)null)); } return false; @@ -146,7 +146,7 @@ namespace Bit.App.Services if(ciphers.StatusCode == System.Net.HttpStatusCode.Forbidden || ciphers.StatusCode == System.Net.HttpStatusCode.Unauthorized) { - MessagingCenter.Send(Application.Current, "Logout", (string)null); + Device.BeginInvokeOnMainThread(() => MessagingCenter.Send(Application.Current, "Logout", (string)null)); } return false; @@ -191,7 +191,7 @@ namespace Bit.App.Services if(ciphers.StatusCode == System.Net.HttpStatusCode.Forbidden || ciphers.StatusCode == System.Net.HttpStatusCode.Unauthorized) { - MessagingCenter.Send(Application.Current, "Logout", (string)null); + Device.BeginInvokeOnMainThread(() => MessagingCenter.Send(Application.Current, "Logout", (string)null)); } return false;