From 72c7cd2536107a2501e9c79490d46d4f2e17b1cb Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 2 Jun 2017 17:09:09 -0400 Subject: [PATCH] show launch fixes --- .../Models/Page/VaultViewLoginPageModel.cs | 20 ++++++++++++++++++- src/App/Pages/Vault/VaultViewLoginPage.cs | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/App/Models/Page/VaultViewLoginPageModel.cs b/src/App/Models/Page/VaultViewLoginPageModel.cs index 8b8b8ce52..4ada206a4 100644 --- a/src/App/Models/Page/VaultViewLoginPageModel.cs +++ b/src/App/Models/Page/VaultViewLoginPageModel.cs @@ -109,7 +109,25 @@ namespace Bit.App.Models.Page } } public bool ShowUri => !string.IsNullOrWhiteSpace(Uri); - public bool ShowLaunch => Uri.StartsWith("http://") || Uri.StartsWith("https://"); + + public bool ShowLaunch + { + get + { + if(!ShowUri) + { + return false; + } + + Uri uri; + if(!System.Uri.TryCreate(Uri, UriKind.Absolute, out uri)) + { + return false; + } + + return true; + } + } public string UriHost { diff --git a/src/App/Pages/Vault/VaultViewLoginPage.cs b/src/App/Pages/Vault/VaultViewLoginPage.cs index 280525e32..8a2af5e9e 100644 --- a/src/App/Pages/Vault/VaultViewLoginPage.cs +++ b/src/App/Pages/Vault/VaultViewLoginPage.cs @@ -74,7 +74,7 @@ namespace Bit.App.Pages // URI UriCell = new LabeledValueCell(AppResources.Website, button1Text: AppResources.Launch); UriCell.Value.SetBinding(Label.TextProperty, nameof(VaultViewLoginPageModel.UriHost)); - UriCell.Value.SetBinding(IsVisibleProperty, nameof(VaultViewLoginPageModel.ShowLaunch)); + UriCell.Button1.SetBinding(IsVisibleProperty, nameof(VaultViewLoginPageModel.ShowLaunch)); UriCell.Button1.Command = new Command(() => Device.OpenUri(new Uri(Model.Uri))); // Notes