2016-07-23 09:48:56 +03:00
|
|
|
|
using System;
|
|
|
|
|
using Bit.App.Controls;
|
|
|
|
|
using Xamarin.Forms;
|
2016-08-05 02:35:56 +03:00
|
|
|
|
using Bit.App.Abstractions;
|
|
|
|
|
using XLabs.Ioc;
|
2016-11-25 21:22:11 +03:00
|
|
|
|
using Bit.App.Resources;
|
2016-07-23 09:48:56 +03:00
|
|
|
|
|
|
|
|
|
namespace Bit.App.Pages
|
|
|
|
|
{
|
|
|
|
|
public class SettingsHelpPage : ExtendedContentPage
|
|
|
|
|
{
|
2016-08-05 02:35:56 +03:00
|
|
|
|
private readonly IGoogleAnalyticsService _googleAnalyticsService;
|
|
|
|
|
|
2016-07-23 09:48:56 +03:00
|
|
|
|
public SettingsHelpPage()
|
|
|
|
|
{
|
2016-08-05 02:35:56 +03:00
|
|
|
|
_googleAnalyticsService = Resolver.Resolve<IGoogleAnalyticsService>();
|
|
|
|
|
|
2016-07-23 09:48:56 +03:00
|
|
|
|
Init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Init()
|
|
|
|
|
{
|
2016-07-24 02:13:30 +03:00
|
|
|
|
var emailCell = new ExtendedTextCell
|
|
|
|
|
{
|
2016-11-25 21:22:11 +03:00
|
|
|
|
Text = AppResources.EmailUs,
|
2016-07-24 02:13:30 +03:00
|
|
|
|
ShowDisclousure = true
|
|
|
|
|
};
|
|
|
|
|
emailCell.Tapped += EmailCell_Tapped;
|
2016-07-23 09:48:56 +03:00
|
|
|
|
|
2016-07-24 02:13:30 +03:00
|
|
|
|
var emailTable = new CustomTableView
|
|
|
|
|
{
|
|
|
|
|
Root = new TableRoot
|
|
|
|
|
{
|
|
|
|
|
new TableSection
|
|
|
|
|
{
|
|
|
|
|
emailCell
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
2016-07-23 09:48:56 +03:00
|
|
|
|
|
2016-07-24 02:13:30 +03:00
|
|
|
|
var emailLabel = new CustomLabel(this)
|
|
|
|
|
{
|
2016-11-25 21:22:11 +03:00
|
|
|
|
Text = AppResources.EmailUsDescription
|
2016-07-24 02:13:30 +03:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var websiteCell = new ExtendedTextCell
|
|
|
|
|
{
|
2016-11-25 21:22:11 +03:00
|
|
|
|
Text = AppResources.VisitOurWebsite,
|
2016-07-24 02:13:30 +03:00
|
|
|
|
ShowDisclousure = true
|
|
|
|
|
};
|
|
|
|
|
websiteCell.Tapped += WebsiteCell_Tapped;
|
|
|
|
|
|
|
|
|
|
var websiteTable = new CustomTableView
|
|
|
|
|
{
|
|
|
|
|
NoHeader = true,
|
|
|
|
|
Root = new TableRoot
|
|
|
|
|
{
|
|
|
|
|
new TableSection
|
|
|
|
|
{
|
|
|
|
|
websiteCell
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var websiteLabel = new CustomLabel(this)
|
|
|
|
|
{
|
2016-11-25 21:22:11 +03:00
|
|
|
|
Text = AppResources.VisitOurWebsiteDescription
|
2016-07-24 02:13:30 +03:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var bugCell = new ExtendedTextCell
|
|
|
|
|
{
|
2016-11-25 21:22:11 +03:00
|
|
|
|
Text = AppResources.FileBugReport,
|
2016-07-24 02:13:30 +03:00
|
|
|
|
ShowDisclousure = true
|
|
|
|
|
};
|
|
|
|
|
bugCell.Tapped += BugCell_Tapped;
|
|
|
|
|
|
|
|
|
|
var bugTable = new CustomTableView
|
|
|
|
|
{
|
|
|
|
|
NoHeader = true,
|
|
|
|
|
Root = new TableRoot
|
|
|
|
|
{
|
|
|
|
|
new TableSection
|
|
|
|
|
{
|
|
|
|
|
bugCell
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var bugLabel = new CustomLabel(this)
|
|
|
|
|
{
|
2016-11-25 21:22:11 +03:00
|
|
|
|
Text = AppResources.FileBugReportDescription
|
2016-07-24 02:13:30 +03:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var stackLayout = new StackLayout
|
|
|
|
|
{
|
|
|
|
|
Children = { emailTable, emailLabel, websiteTable, websiteLabel, bugTable, bugLabel },
|
|
|
|
|
Spacing = 0
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
stackLayout.LayoutChanged += (sender, args) =>
|
|
|
|
|
{
|
|
|
|
|
websiteLabel.WidthRequest = stackLayout.Bounds.Width - websiteLabel.Bounds.Left * 2;
|
|
|
|
|
emailLabel.WidthRequest = stackLayout.Bounds.Width - emailLabel.Bounds.Left * 2;
|
|
|
|
|
bugLabel.WidthRequest = stackLayout.Bounds.Width - bugLabel.Bounds.Left * 2;
|
|
|
|
|
};
|
|
|
|
|
|
2016-11-25 21:22:11 +03:00
|
|
|
|
Title = AppResources.HelpAndFeedback;
|
2016-07-24 02:13:30 +03:00
|
|
|
|
Content = new ScrollView { Content = stackLayout };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void EmailCell_Tapped(object sender, EventArgs e)
|
|
|
|
|
{
|
2016-08-05 02:35:56 +03:00
|
|
|
|
_googleAnalyticsService.TrackAppEvent("HelpEmail");
|
2016-07-24 02:13:30 +03:00
|
|
|
|
Device.OpenUri(new Uri("mailto:hello@bitwarden.com"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void WebsiteCell_Tapped(object sender, EventArgs e)
|
|
|
|
|
{
|
2016-08-05 02:35:56 +03:00
|
|
|
|
_googleAnalyticsService.TrackAppEvent("HelpWebsite");
|
2016-10-02 07:20:45 +03:00
|
|
|
|
Device.OpenUri(new Uri("https://bitwarden.com/contact/"));
|
2016-07-24 02:13:30 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void BugCell_Tapped(object sender, EventArgs e)
|
|
|
|
|
{
|
2016-08-05 02:35:56 +03:00
|
|
|
|
_googleAnalyticsService.TrackAppEvent("HelpBug");
|
2016-07-24 02:13:30 +03:00
|
|
|
|
Device.OpenUri(new Uri("https://github.com/bitwarden/mobile"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private class CustomTableView : ExtendedTableView
|
|
|
|
|
{
|
|
|
|
|
public CustomTableView()
|
|
|
|
|
{
|
|
|
|
|
Intent = TableIntent.Settings;
|
|
|
|
|
EnableScrolling = false;
|
|
|
|
|
HasUnevenRows = true;
|
|
|
|
|
EnableSelection = true;
|
|
|
|
|
VerticalOptions = LayoutOptions.Start;
|
|
|
|
|
NoFooter = true;
|
2016-07-29 07:13:35 +03:00
|
|
|
|
|
|
|
|
|
if(Device.OS == TargetPlatform.iOS)
|
|
|
|
|
{
|
|
|
|
|
RowHeight = -1;
|
|
|
|
|
EstimatedRowHeight = 44;
|
|
|
|
|
}
|
2016-07-24 02:13:30 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private class CustomLabel : Label
|
|
|
|
|
{
|
|
|
|
|
public CustomLabel(ContentPage page)
|
|
|
|
|
{
|
|
|
|
|
LineBreakMode = LineBreakMode.WordWrap;
|
|
|
|
|
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label));
|
|
|
|
|
Style = (Style)Application.Current.Resources["text-muted"];
|
|
|
|
|
Margin = new Thickness(15, (page.IsLandscape() ? 5 : 0), 15, 25);
|
|
|
|
|
}
|
2016-07-23 09:48:56 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|