From b8c6e77fca76bbf6652b34a406c377f7a9e24c8c Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Sat, 23 Jul 2016 23:50:08 -0400 Subject: [PATCH] About and credit page implementation. Adjusted block screen and launch screen logo margins up some. Added decryption message to extension loading. --- src/Android/Android.csproj | 1 + src/Android/MainApplication.cs | 1 + src/Android/Services/AppInfoService.cs | 14 +++++ .../Abstractions/Services/IAppInfoService.cs | 8 +++ src/App/App.csproj | 2 + src/App/Pages/Settings/SettingsAboutPage.cs | 38 ++++++++++- src/App/Pages/Settings/SettingsCreditsPage.cs | 63 +++++++++++++++++++ src/iOS.Extension/LoadingViewController.cs | 4 ++ .../LoadingViewController.designer.cs | 24 ++++--- src/iOS.Extension/MainInterface.storyboard | 15 ++++- src/iOS/AppDelegate.cs | 5 +- src/iOS/Info.plist | 2 +- src/iOS/LaunchScreen.storyboard | 21 ++++--- src/iOS/Services/AppInfoService.cs | 12 ++++ src/iOS/iOS.csproj | 1 + 15 files changed, 188 insertions(+), 23 deletions(-) create mode 100644 src/Android/Services/AppInfoService.cs create mode 100644 src/App/Abstractions/Services/IAppInfoService.cs create mode 100644 src/App/Pages/Settings/SettingsCreditsPage.cs create mode 100644 src/iOS/Services/AppInfoService.cs diff --git a/src/Android/Android.csproj b/src/Android/Android.csproj index 0b6e1a959..4ea623334 100644 --- a/src/Android/Android.csproj +++ b/src/Android/Android.csproj @@ -271,6 +271,7 @@ + diff --git a/src/Android/MainApplication.cs b/src/Android/MainApplication.cs index 0aa0d78d3..e0786d7be 100644 --- a/src/Android/MainApplication.cs +++ b/src/Android/MainApplication.cs @@ -124,6 +124,7 @@ namespace Bit.Android .RegisterType(new ContainerControlledLifetimeManager()) .RegisterType(new ContainerControlledLifetimeManager()) .RegisterType(new ContainerControlledLifetimeManager()) + .RegisterType(new ContainerControlledLifetimeManager()) // Repositories .RegisterType(new ContainerControlledLifetimeManager()) .RegisterType(new ContainerControlledLifetimeManager()) diff --git a/src/Android/Services/AppInfoService.cs b/src/Android/Services/AppInfoService.cs new file mode 100644 index 000000000..342236dde --- /dev/null +++ b/src/Android/Services/AppInfoService.cs @@ -0,0 +1,14 @@ +using Bit.App.Abstractions; +using AndrodApp = Android.App.Application; + +namespace Bit.Android.Services +{ + public class AppInfoService : IAppInfoService + { + public string Version => AndrodApp.Context.ApplicationContext.PackageManager + .GetPackageInfo(AndrodApp.Context.PackageName, 0).VersionName; + + public string Build => AndrodApp.Context.ApplicationContext.PackageManager + .GetPackageInfo(AndrodApp.Context.PackageName, 0).VersionCode.ToString(); + } +} diff --git a/src/App/Abstractions/Services/IAppInfoService.cs b/src/App/Abstractions/Services/IAppInfoService.cs new file mode 100644 index 000000000..a83c999eb --- /dev/null +++ b/src/App/Abstractions/Services/IAppInfoService.cs @@ -0,0 +1,8 @@ +namespace Bit.App.Abstractions +{ + public interface IAppInfoService + { + string Build { get; } + string Version { get; } + } +} diff --git a/src/App/App.csproj b/src/App/App.csproj index 2881282e4..226a8595f 100644 --- a/src/App/App.csproj +++ b/src/App/App.csproj @@ -37,6 +37,7 @@ + @@ -113,6 +114,7 @@ + diff --git a/src/App/Pages/Settings/SettingsAboutPage.cs b/src/App/Pages/Settings/SettingsAboutPage.cs index c6b6c1245..ea3d015de 100644 --- a/src/App/Pages/Settings/SettingsAboutPage.cs +++ b/src/App/Pages/Settings/SettingsAboutPage.cs @@ -1,24 +1,56 @@ using System; using Bit.App.Controls; using Xamarin.Forms; +using Bit.App.Abstractions; +using XLabs.Ioc; namespace Bit.App.Pages { public class SettingsAboutPage : ExtendedContentPage { + private readonly IAppInfoService _appInfoService; + public SettingsAboutPage() { + _appInfoService = Resolver.Resolve(); Init(); } public void Init() { - // TODO: version, credits, etc + var logo = new Image + { + Source = "logo", + HorizontalOptions = LayoutOptions.Center + }; - var stackLayout = new StackLayout { }; + var versionLabel = new Label + { + Text = $@"Version {_appInfoService.Version} +© 8bit Solutions LLC 2015-{DateTime.Now.Year}", + HorizontalTextAlignment = TextAlignment.Center + }; + + var creditsButton = new Button + { + Text = "Credits", + Style = (Style)Application.Current.Resources["btn-primaryAccent"], + Margin = new Thickness(15, 0, 15, 25), + Command = new Command(async () => await Navigation.PushAsync(new SettingsCreditsPage())), + HorizontalOptions = LayoutOptions.Center + }; + + var stackLayout = new StackLayout + { + Children = { logo, versionLabel, creditsButton }, + VerticalOptions = LayoutOptions.Center, + Spacing = 20, + Margin = new Thickness(0, 0, 0, 40) + }; Title = "About bitwarden"; - Content = stackLayout; + Content = new ScrollView { Content = stackLayout }; + NavigationPage.SetBackButtonTitle(this, "About"); } } } diff --git a/src/App/Pages/Settings/SettingsCreditsPage.cs b/src/App/Pages/Settings/SettingsCreditsPage.cs new file mode 100644 index 000000000..26e7568f1 --- /dev/null +++ b/src/App/Pages/Settings/SettingsCreditsPage.cs @@ -0,0 +1,63 @@ +using System; +using Bit.App.Controls; +using Xamarin.Forms; + +namespace Bit.App.Pages +{ + public class SettingsCreditsPage : ExtendedContentPage + { + public SettingsCreditsPage() + { + Init(); + } + + public void Init() + { + var table = new ExtendedTableView + { + EnableScrolling = true, + Intent = TableIntent.Menu, + HasUnevenRows = true, + EnableSelection = false, + Root = new TableRoot + { + new TableSection("Icons") + { + new CustomViewCell(@"Icon 1 - John Smith +Icon 2 - Jane Doe") + } + } + }; + + if(Device.OS == TargetPlatform.iOS) + { + table.RowHeight = -1; + table.EstimatedRowHeight = 100; + } + + Title = "Thank You"; + Content = table; + } + + public class CustomViewCell : ViewCell + { + public CustomViewCell(string text) + { + var label = new Label + { + LineBreakMode = LineBreakMode.WordWrap, + Text = text, + FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)) + }; + + var layout = new StackLayout + { + Children = { label }, + Padding = new Thickness(15, 20) + }; + + View = layout; + } + } + } +} diff --git a/src/iOS.Extension/LoadingViewController.cs b/src/iOS.Extension/LoadingViewController.cs index 75426bc39..d81cdbcaa 100644 --- a/src/iOS.Extension/LoadingViewController.cs +++ b/src/iOS.Extension/LoadingViewController.cs @@ -37,6 +37,10 @@ namespace Bit.iOS.Extension View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f); _context.ExtContext = ExtensionContext; + var descriptor = UIFontDescriptor.PreferredBody; + DecryptingLabel.Font = UIFont.FromDescriptor(descriptor, descriptor.PointSize); + DecryptingLabel.TextColor = new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f); + if(!Resolver.IsSet) { SetIoc(); diff --git a/src/iOS.Extension/LoadingViewController.designer.cs b/src/iOS.Extension/LoadingViewController.designer.cs index a528ba3b7..062778b3e 100644 --- a/src/iOS.Extension/LoadingViewController.designer.cs +++ b/src/iOS.Extension/LoadingViewController.designer.cs @@ -11,11 +11,19 @@ using UIKit; namespace Bit.iOS.Extension { - [Register ("LoadingViewController")] - partial class LoadingViewController - { - void ReleaseDesignerOutlets () - { - } - } -} + [Register ("LoadingViewController")] + partial class LoadingViewController + { + [Outlet] + [GeneratedCode ("iOS Designer", "1.0")] + UIKit.UILabel DecryptingLabel { get; set; } + + void ReleaseDesignerOutlets () + { + if (DecryptingLabel != null) { + DecryptingLabel.Dispose (); + DecryptingLabel = null; + } + } + } +} \ No newline at end of file diff --git a/src/iOS.Extension/MainInterface.storyboard b/src/iOS.Extension/MainInterface.storyboard index 537c89ba2..5a415341b 100644 --- a/src/iOS.Extension/MainInterface.storyboard +++ b/src/iOS.Extension/MainInterface.storyboard @@ -18,13 +18,23 @@ - + + - + + + + @@ -33,6 +43,7 @@ + diff --git a/src/iOS/AppDelegate.cs b/src/iOS/AppDelegate.cs index 7eaa4b81b..7478cbcdd 100644 --- a/src/iOS/AppDelegate.cs +++ b/src/iOS/AppDelegate.cs @@ -121,7 +121,7 @@ namespace Bit.iOS var imageView = new UIImageView(new UIImage("logo.png")) { - Center = view.Center + Center = new CoreGraphics.CGPoint(view.Center.X, view.Center.Y - 40) }; view.AddSubview(backgroundView); @@ -130,6 +130,7 @@ namespace Bit.iOS UIApplication.SharedApplication.KeyWindow.AddSubview(view); UIApplication.SharedApplication.KeyWindow.BringSubviewToFront(view); UIApplication.SharedApplication.KeyWindow.EndEditing(true); + UIApplication.SharedApplication.SetStatusBarHidden(true, false); // Log the date/time we last backgrounded @@ -163,6 +164,7 @@ namespace Bit.iOS if(view != null) { view.RemoveFromSuperview(); + UIApplication.SharedApplication.SetStatusBarHidden(false, false); } } @@ -240,6 +242,7 @@ namespace Bit.iOS .RegisterType(new ContainerControlledLifetimeManager()) .RegisterType(new ContainerControlledLifetimeManager()) .RegisterType(new ContainerControlledLifetimeManager()) + .RegisterType(new ContainerControlledLifetimeManager()) // Repositories .RegisterType(new ContainerControlledLifetimeManager()) .RegisterType(new ContainerControlledLifetimeManager()) diff --git a/src/iOS/Info.plist b/src/iOS/Info.plist index 746e35aa5..d4e1c55d2 100644 --- a/src/iOS/Info.plist +++ b/src/iOS/Info.plist @@ -28,7 +28,7 @@ CFBundleIdentifier com.8bit.bitwarden CFBundleVersion - 1.0 + 1 CFBundleIconFiles Icon-72@2x.png diff --git a/src/iOS/LaunchScreen.storyboard b/src/iOS/LaunchScreen.storyboard index 5672c5431..a54d2bae3 100644 --- a/src/iOS/LaunchScreen.storyboard +++ b/src/iOS/LaunchScreen.storyboard @@ -12,16 +12,16 @@ - + - - + + - + @@ -34,7 +34,6 @@ - @@ -65,8 +64,14 @@ + + + + + + + + + - - - \ No newline at end of file diff --git a/src/iOS/Services/AppInfoService.cs b/src/iOS/Services/AppInfoService.cs new file mode 100644 index 000000000..2742878fb --- /dev/null +++ b/src/iOS/Services/AppInfoService.cs @@ -0,0 +1,12 @@ +using System; +using Bit.App.Abstractions; +using Foundation; + +namespace Bit.iOS.Services +{ + public class AppInfoService : IAppInfoService + { + public string Build => NSBundle.MainBundle.InfoDictionary["CFBundleVersion"].ToString(); + public string Version => NSBundle.MainBundle.InfoDictionary["CFBundleShortVersionString"].ToString(); + } +} diff --git a/src/iOS/iOS.csproj b/src/iOS/iOS.csproj index 2e067f4d2..534ca694c 100644 --- a/src/iOS/iOS.csproj +++ b/src/iOS/iOS.csproj @@ -113,6 +113,7 @@ +