safety checks for popping modals

This commit is contained in:
Kyle Spearrin 2017-06-07 10:19:56 -04:00
parent 5b24d19630
commit 2fda7b8011
5 changed files with 12 additions and 7 deletions

View file

@ -88,9 +88,9 @@ namespace Bit.App.Pages
if(saveResult.Succeeded) if(saveResult.Succeeded)
{ {
await Navigation.PopForDeviceAsync();
_userDialogs.Toast(AppResources.FolderCreated); _userDialogs.Toast(AppResources.FolderCreated);
_googleAnalyticsService.TrackAppEvent("CreatedFolder"); _googleAnalyticsService.TrackAppEvent("CreatedFolder");
await Navigation.PopForDeviceAsync();
} }
else if(saveResult.Errors.Count() > 0) else if(saveResult.Errors.Count() > 0)
{ {

View file

@ -102,9 +102,9 @@ namespace Bit.App.Pages
if(saveResult.Succeeded) if(saveResult.Succeeded)
{ {
await Navigation.PopForDeviceAsync();
_userDialogs.Toast(AppResources.FolderUpdated); _userDialogs.Toast(AppResources.FolderUpdated);
_googleAnalyticsService.TrackAppEvent("EditedFolder"); _googleAnalyticsService.TrackAppEvent("EditedFolder");
await Navigation.PopForDeviceAsync();
} }
else if(saveResult.Errors.Count() > 0) else if(saveResult.Errors.Count() > 0)
{ {
@ -165,8 +165,8 @@ namespace Bit.App.Pages
if(deleteTask.Succeeded) if(deleteTask.Succeeded)
{ {
await Navigation.PopForDeviceAsync();
_userDialogs.Toast(AppResources.FolderDeleted); _userDialogs.Toast(AppResources.FolderDeleted);
await Navigation.PopForDeviceAsync();
} }
else if(deleteTask.Errors.Count() > 0) else if(deleteTask.Errors.Count() > 0)
{ {

View file

@ -173,11 +173,10 @@ namespace Bit.App.Pages
_userDialogs.ShowLoading(AppResources.Saving, MaskType.Black); _userDialogs.ShowLoading(AppResources.Saving, MaskType.Black);
var saveTask = await _loginService.SaveAsync(login); var saveTask = await _loginService.SaveAsync(login);
_userDialogs.HideLoading(); _userDialogs.HideLoading();
if(saveTask.Succeeded) if(saveTask.Succeeded)
{ {
await Navigation.PopForDeviceAsync();
_userDialogs.Toast(AppResources.NewLoginCreated); _userDialogs.Toast(AppResources.NewLoginCreated);
if(_fromAutofill) if(_fromAutofill)
{ {
@ -187,6 +186,7 @@ namespace Bit.App.Pages
{ {
_googleAnalyticsService.TrackAppEvent("CreatedLogin"); _googleAnalyticsService.TrackAppEvent("CreatedLogin");
} }
await Navigation.PopForDeviceAsync();
} }
else if(saveTask.Errors.Count() > 0) else if(saveTask.Errors.Count() > 0)
{ {

View file

@ -190,9 +190,9 @@ namespace Bit.App.Pages
if(saveTask.Succeeded) if(saveTask.Succeeded)
{ {
await Navigation.PopForDeviceAsync();
_userDialogs.Toast(AppResources.LoginUpdated); _userDialogs.Toast(AppResources.LoginUpdated);
_googleAnalyticsService.TrackAppEvent("EditeLogin"); _googleAnalyticsService.TrackAppEvent("EditeLogin");
await Navigation.PopForDeviceAsync();
} }
else if(saveTask.Errors.Count() > 0) else if(saveTask.Errors.Count() > 0)
{ {
@ -307,9 +307,9 @@ namespace Bit.App.Pages
if(deleteTask.Succeeded) if(deleteTask.Succeeded)
{ {
await Navigation.PopForDeviceAsync();
_userDialogs.Toast(AppResources.LoginDeleted); _userDialogs.Toast(AppResources.LoginDeleted);
_googleAnalyticsService.TrackAppEvent("DeletedLogin"); _googleAnalyticsService.TrackAppEvent("DeletedLogin");
await Navigation.PopForDeviceAsync();
} }
else if(deleteTask.Errors.Count() > 0) else if(deleteTask.Errors.Count() > 0)
{ {

View file

@ -60,6 +60,11 @@ namespace Bit.App
public static async Task PopForDeviceAsync(this INavigation navigation) public static async Task PopForDeviceAsync(this INavigation navigation)
{ {
if(navigation.ModalStack.Count < 1)
{
return;
}
await navigation.PopModalAsync(true); await navigation.PopModalAsync(true);
} }