1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-15 07:43:37 +00:00

remove arc dialogs. create custom loading actions

This commit is contained in:
Kyle Spearrin
2017-12-22 23:56:45 -05:00
parent 0270cf6e45
commit 4dc388015c
27 changed files with 528 additions and 642 deletions

View File

@@ -11,6 +11,7 @@ using System.Net;
using System.Threading.Tasks;
using Bit.App.Models.Page;
using Bit.iOS.Core.Views;
using CoreGraphics;
namespace Bit.iOS.Services
{
@@ -18,6 +19,7 @@ namespace Bit.iOS.Services
{
private readonly IAppSettingsService _appSettingsService;
private readonly IDeviceInfoService _deviceInfoService;
private UIAlertController _progressAlert;
public DeviceActionService(
IAppSettingsService appSettingsService,
@@ -264,5 +266,43 @@ namespace Bit.iOS.Services
{
throw new NotImplementedException();
}
public void ShowLoading(string text)
{
var loadingIndicator = new UIActivityIndicatorView(new CGRect(10, 5, 50, 50));
loadingIndicator.HidesWhenStopped = true;
loadingIndicator.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray;
loadingIndicator.StartAnimating();
_progressAlert = UIAlertController.Create(null, text, UIAlertControllerStyle.Alert);
_progressAlert.View.TintColor = UIColor.Black;
_progressAlert.View.Add(loadingIndicator);
var window = UIApplication.SharedApplication.KeyWindow;
var vc = window.RootViewController;
while(vc.PresentedViewController != null)
{
vc = vc.PresentedViewController;
}
vc.PresentViewController(_progressAlert, true, null);
}
public void HideLoading()
{
if(_progressAlert == null)
{
return;
}
_progressAlert.DismissViewController(true, () => { });
_progressAlert.Dispose();
_progressAlert = null;
}
public Task LaunchAppAsync(string appName, Page page)
{
throw new NotImplementedException();
}
}
}