settings help page implementation

This commit is contained in:
Kyle Spearrin 2016-07-23 19:13:30 -04:00
parent 7b083d5d0d
commit 8ad2786bb0
2 changed files with 127 additions and 8 deletions

View file

@ -13,12 +13,131 @@ namespace Bit.App.Pages
public void Init()
{
// TODO: hockeyapp feedback, link to website help
var emailCell = new ExtendedTextCell
{
Text = "Email Us",
ShowDisclousure = true
};
emailCell.Tapped += EmailCell_Tapped;
var stackLayout = new StackLayout { };
var emailTable = new CustomTableView
{
Root = new TableRoot
{
new TableSection
{
emailCell
}
}
};
Title = "Help and Support";
Content = stackLayout;
var emailLabel = new CustomLabel(this)
{
Text = "Email us directly to get help or leave feedback."
};
var websiteCell = new ExtendedTextCell
{
Text = "Visit Our Website",
ShowDisclousure = true
};
websiteCell.Tapped += WebsiteCell_Tapped;
var websiteTable = new CustomTableView
{
NoHeader = true,
Root = new TableRoot
{
new TableSection
{
websiteCell
}
}
};
var websiteLabel = new CustomLabel(this)
{
Text = "Visit our website to get help, news, email us, and/or learn more about how to use bitwarden."
};
var bugCell = new ExtendedTextCell
{
Text = "File a Bug Report",
ShowDisclousure = true
};
bugCell.Tapped += BugCell_Tapped;
var bugTable = new CustomTableView
{
NoHeader = true,
Root = new TableRoot
{
new TableSection
{
bugCell
}
}
};
var bugLabel = new CustomLabel(this)
{
Text = "Open an issue at our GitHub repository."
};
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;
};
Title = "Help and Feedback";
Content = new ScrollView { Content = stackLayout };
}
private void EmailCell_Tapped(object sender, EventArgs e)
{
Device.OpenUri(new Uri("mailto:hello@bitwarden.com"));
}
private void WebsiteCell_Tapped(object sender, EventArgs e)
{
Device.OpenUri(new Uri("https://bitwarden.com"));
}
private void BugCell_Tapped(object sender, EventArgs e)
{
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;
}
}
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);
}
}
}
}

View file

@ -110,14 +110,14 @@ namespace Bit.App.Pages
var helpCell = new ExtendedTextCell
{
Text = "Help and Support",
Text = "Help and Feedback",
ShowDisclousure = true
};
helpCell.Tapped += HelpCell_Tapped;
var rateCell = new ExtendedTextCell
{
Text = "Rate bitwarden",
Text = "Rate the App",
ShowDisclousure = true
};
rateCell.Tapped += RateCell_Tapped;
@ -153,8 +153,8 @@ namespace Bit.App.Pages
new TableSection("Other")
{
helpCell,
aboutCell,
rateCell
rateCell,
aboutCell
}
}
};