2022-04-10 17:38:34 +02:00
|
|
|
|
using Serilog;
|
|
|
|
|
using TINK.Model.Device;
|
2021-11-07 19:42:59 +01:00
|
|
|
|
using TINK.ViewModel.Login;
|
|
|
|
|
using Xamarin.Forms;
|
|
|
|
|
using Xamarin.Forms.Xaml;
|
|
|
|
|
|
|
|
|
|
namespace TINK.View.CopriWebView
|
|
|
|
|
{
|
|
|
|
|
[XamlCompilation(XamlCompilationOptions.Compile)]
|
2022-04-10 17:38:34 +02:00
|
|
|
|
public partial class ManageAccountPage : ContentPage
|
|
|
|
|
{
|
|
|
|
|
public ManageAccountPage()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2021-11-07 19:42:59 +01:00
|
|
|
|
|
|
|
|
|
ManageAccount.Navigating += (sender, ev) =>
|
|
|
|
|
{
|
|
|
|
|
if (!ev.Url.ToUpper().EndsWith(".PDF"))
|
|
|
|
|
{
|
|
|
|
|
// Stay inside web view except for downloading pdf- files.
|
2022-04-10 17:38:34 +02:00
|
|
|
|
this.IsEnabled = false;
|
|
|
|
|
ActivityIndicatorLoading.IsVisible = true;
|
|
|
|
|
ActivityIndicatorLoading.IsRunning = true;
|
2021-11-07 19:42:59 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DependencyService.Get<IExternalBrowserService>().OpenUrl(ev.Url);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ManageAccount.Navigated += (sender, ev) =>
|
|
|
|
|
{
|
2022-04-10 17:38:34 +02:00
|
|
|
|
if (ev.Result == WebNavigationResult.Success)
|
|
|
|
|
{
|
|
|
|
|
this.IsEnabled = true;
|
|
|
|
|
ActivityIndicatorLoading.IsVisible = false;
|
|
|
|
|
ActivityIndicatorLoading.IsRunning = false;
|
|
|
|
|
return;
|
|
|
|
|
}
|
2021-11-07 19:42:59 +01:00
|
|
|
|
|
2022-04-10 17:38:34 +02:00
|
|
|
|
Log.ForContext<ManageAccountPage>().Error("Navigation did not succeed.{@Event}{@Sender}", ev, sender);
|
2021-11-07 19:42:59 +01:00
|
|
|
|
ManageAccount.Source = new HtmlWebViewSource
|
|
|
|
|
{
|
|
|
|
|
Html = "<html><b>Kann persönliche Daten nicht anzeigen/ verwalten!</b><br>Verbindung mit Internet ok?</html>"
|
|
|
|
|
};
|
2022-04-10 17:38:34 +02:00
|
|
|
|
|
|
|
|
|
this.IsEnabled = true;
|
|
|
|
|
ActivityIndicatorLoading.IsVisible = false;
|
|
|
|
|
ActivityIndicatorLoading.IsRunning = false;
|
2021-11-07 19:42:59 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ManageAccount.BindingContext = new ManageAccountViewModel(
|
|
|
|
|
App.ModelRoot.ActiveUser.SessionCookie,
|
|
|
|
|
Model.TinkApp.MerchantId,
|
|
|
|
|
App.ModelRoot.NextActiveUri.Host);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|