From fe7aad0835c0284010bec1df0adb83647187af51 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 26 Jun 2019 20:39:45 -0400 Subject: [PATCH] autofill extension project --- bitwarden-mobile.sln | 31 +++++++ src/iOS.Autofill/ActionViewController.cs | 71 ++++++++++++++ .../ActionViewController.designer.cs | 24 +++++ src/iOS.Autofill/AppDelegate.cs | 30 ++++++ src/iOS.Autofill/Entitlements.plist | 16 ++++ src/iOS.Autofill/Info.plist | 92 +++++++++++++++++++ src/iOS.Autofill/Main.cs | 12 +++ src/iOS.Autofill/MainInterface.storyboard | 63 +++++++++++++ src/iOS.Autofill/Properties/AssemblyInfo.cs | 36 ++++++++ src/iOS.Autofill/iOS.Autofill.csproj | 91 ++++++++++++++++++ src/iOS/iOS.csproj | 6 ++ 11 files changed, 472 insertions(+) create mode 100644 src/iOS.Autofill/ActionViewController.cs create mode 100644 src/iOS.Autofill/ActionViewController.designer.cs create mode 100644 src/iOS.Autofill/AppDelegate.cs create mode 100644 src/iOS.Autofill/Entitlements.plist create mode 100644 src/iOS.Autofill/Info.plist create mode 100644 src/iOS.Autofill/Main.cs create mode 100644 src/iOS.Autofill/MainInterface.storyboard create mode 100644 src/iOS.Autofill/Properties/AssemblyInfo.cs create mode 100644 src/iOS.Autofill/iOS.Autofill.csproj diff --git a/bitwarden-mobile.sln b/bitwarden-mobile.sln index 5b4e19d85..f0fba069f 100644 --- a/bitwarden-mobile.sln +++ b/bitwarden-mobile.sln @@ -37,6 +37,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iOS", "src\iOS\iOS.csproj", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iOS.Extension", "src\iOS.Extension\iOS.Extension.csproj", "{324BE76C-38FA-4F11-8BB1-95C7B3B1B545}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iOS.Autofill", "src\iOS.Autofill\iOS.Autofill.csproj", "{8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Ad-Hoc|Any CPU = Ad-Hoc|Any CPU @@ -316,6 +318,34 @@ Global {324BE76C-38FA-4F11-8BB1-95C7B3B1B545}.Release|iPhone.Build.0 = Release|iPhone {324BE76C-38FA-4F11-8BB1-95C7B3B1B545}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {324BE76C-38FA-4F11-8BB1-95C7B3B1B545}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.Ad-Hoc|Any CPU.ActiveCfg = Release|iPhone + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.Ad-Hoc|Any CPU.Build.0 = Release|iPhone + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.Ad-Hoc|iPhone.ActiveCfg = Release|iPhone + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.Ad-Hoc|iPhone.Build.0 = Release|iPhone + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.AppStore|Any CPU.ActiveCfg = Release|iPhone + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.AppStore|Any CPU.Build.0 = Release|iPhone + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.AppStore|iPhone.ActiveCfg = Release|iPhone + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.AppStore|iPhone.Build.0 = Release|iPhone + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.AppStore|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.AppStore|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.Debug|Any CPU.ActiveCfg = Debug|iPhone + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.Debug|iPhone.ActiveCfg = Debug|iPhone + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.Debug|iPhone.Build.0 = Debug|iPhone + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.FDroid|Any CPU.ActiveCfg = Release|iPhone + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.FDroid|Any CPU.Build.0 = Release|iPhone + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.FDroid|iPhone.ActiveCfg = Release|iPhone + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.FDroid|iPhone.Build.0 = Release|iPhone + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.FDroid|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.FDroid|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.Release|Any CPU.ActiveCfg = Release|iPhone + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.Release|iPhone.ActiveCfg = Release|iPhone + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.Release|iPhone.Build.0 = Release|iPhone + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -330,6 +360,7 @@ Global {E71F3053-056C-4381-9638-048ED73BDFF6} = {D10CA4A9-F866-40E1-B658-F69051236C71} {599E0201-420A-4C3E-A7BA-5349F72E0B15} = {D10CA4A9-F866-40E1-B658-F69051236C71} {324BE76C-38FA-4F11-8BB1-95C7B3B1B545} = {D10CA4A9-F866-40E1-B658-F69051236C71} + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A} = {D10CA4A9-F866-40E1-B658-F69051236C71} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {7D436EA3-8B7E-45D2-8D14-0730BD2E0410} diff --git a/src/iOS.Autofill/ActionViewController.cs b/src/iOS.Autofill/ActionViewController.cs new file mode 100644 index 000000000..f3757fd81 --- /dev/null +++ b/src/iOS.Autofill/ActionViewController.cs @@ -0,0 +1,71 @@ +using System; + +using MobileCoreServices; +using Foundation; +using UIKit; + +namespace iOS.Autofill +{ + public partial class ActionViewController : UIViewController + { + public ActionViewController(IntPtr handle) : base(handle) + { + } + + public override void DidReceiveMemoryWarning() + { + // Releases the view if it doesn't have a superview. + base.DidReceiveMemoryWarning(); + + // Release any cached data, images, etc that aren't in use. + } + + public override void ViewDidLoad() + { + base.ViewDidLoad(); + + // Get the item[s] we're handling from the extension context. + + // For example, look for an image and place it into an image view. + // Replace this with something appropriate for the type[s] your extension supports. + bool imageFound = false; + + foreach(var item in ExtensionContext.InputItems) + { + foreach(var itemProvider in item.Attachments) + { + if(itemProvider.HasItemConformingTo(UTType.Image)) + { + // This is an image. We'll load it, then place it in our image view. + itemProvider.LoadItem(UTType.Image, null, delegate (NSObject image, NSError error) + { + if(image != null) + { + NSOperationQueue.MainQueue.AddOperation(delegate + { + imageView.Image = (UIImage)image; + }); + } + }); + + imageFound = true; + break; + } + } + + if(imageFound) + { + // We only handle one image, so stop looking for more. + break; + } + } + } + + partial void DoneClicked(NSObject sender) + { + // Return any edited content to the host app. + // This template doesn't do anything, so we just echo the passed-in items. + ExtensionContext.CompleteRequest(ExtensionContext.InputItems, null); + } + } +} diff --git a/src/iOS.Autofill/ActionViewController.designer.cs b/src/iOS.Autofill/ActionViewController.designer.cs new file mode 100644 index 000000000..8fb3ffe07 --- /dev/null +++ b/src/iOS.Autofill/ActionViewController.designer.cs @@ -0,0 +1,24 @@ +// +// This file has been generated automatically to store outlets and +// actions made in the Xcode designer. If it is removed, they will be lost. +// Manual changes to this file may not be handled correctly. +// +using UIKit; +using Foundation; + +namespace iOS.Autofill +{ + [Register("ActionViewController")] + partial class ActionViewController + { + [Outlet] + UIImageView imageView { get; set; } + + [Action("DoneClicked:")] + partial void DoneClicked(NSObject sender); + + void ReleaseDesignerOutlets() + { + } + } +} \ No newline at end of file diff --git a/src/iOS.Autofill/AppDelegate.cs b/src/iOS.Autofill/AppDelegate.cs new file mode 100644 index 000000000..e27c57ae6 --- /dev/null +++ b/src/iOS.Autofill/AppDelegate.cs @@ -0,0 +1,30 @@ +using Foundation; +using UIKit; + +namespace Bit.iOS.Autofill +{ + [Register("AppDelegate")] + public partial class AppDelegate : UIApplicationDelegate + { + public override UIWindow Window + { + get; set; + } + + public override void OnResignActivation(UIApplication application) + { + } + + public override void DidEnterBackground(UIApplication application) + { + } + + public override void WillEnterForeground(UIApplication application) + { + } + + public override void WillTerminate(UIApplication application) + { + } + } +} diff --git a/src/iOS.Autofill/Entitlements.plist b/src/iOS.Autofill/Entitlements.plist new file mode 100644 index 000000000..ef9236c02 --- /dev/null +++ b/src/iOS.Autofill/Entitlements.plist @@ -0,0 +1,16 @@ + + + + + com.apple.developer.authentication-services.autofill-credential-provider + + com.apple.security.application-groups + + group.com.8bit.bitwarden + + keychain-access-groups + + $(AppIdentifierPrefix)com.8bit.bitwarden + + + diff --git a/src/iOS.Autofill/Info.plist b/src/iOS.Autofill/Info.plist new file mode 100644 index 000000000..829154852 --- /dev/null +++ b/src/iOS.Autofill/Info.plist @@ -0,0 +1,92 @@ + + + + + MinimumOSVersion + 12.0 + CFBundleDisplayName + Bitwarden + CFBundleName + Bitwarden Autofill + CFBundleIdentifier + com.8bit.bitwarden.autofill + CFBundleShortVersionString + 2.0.6 + CFBundleVersion + 50 + CFBundleLocalizations + + en + es + zh-Hans + zh-Hant + pt-PT + pt-BR + sv + sk + it + fi + fr + ro + id + hr + hu + nl + tr + uk + de + dk + cz + nb + ja + et + vi + pl + ko + fa + + CFBundleDevelopmentRegion + en + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + XPC! + CFBundleSignature + ???? + UIDeviceFamily + + 1 + 2 + + UISupportedInterfaceOrientations + + UIAppFonts + + FontAwesome.ttf + MaterialIcons_Regular.ttf + + UIRequiredDeviceCapabilities + + arm64 + + + ITSAppUsesNonExemptEncryption + + ITSEncryptionExportComplianceCode + ecf076d3-4824-4d7b-b716-2a9a47d7d296 + NSFaceIDUsageDescription + Use Face ID to unlock your vault. + NSExtension + + NSExtensionMainStoryboard + MainInterface + NSExtensionPointIdentifier + com.apple.authentication-services-credential-provider-ui + NSExtensionAttributes + + ASCredentialProviderExtensionShowsConfigurationUI + + + + + diff --git a/src/iOS.Autofill/Main.cs b/src/iOS.Autofill/Main.cs new file mode 100644 index 000000000..8289b7cd3 --- /dev/null +++ b/src/iOS.Autofill/Main.cs @@ -0,0 +1,12 @@ +using UIKit; + +namespace Bit.iOS.Autofill +{ + public class Application + { + static void Main(string[] args) + { + UIApplication.Main(args, null, "AppDelegate"); + } + } +} \ No newline at end of file diff --git a/src/iOS.Autofill/MainInterface.storyboard b/src/iOS.Autofill/MainInterface.storyboard new file mode 100644 index 000000000..76eede89d --- /dev/null +++ b/src/iOS.Autofill/MainInterface.storyboard @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/iOS.Autofill/Properties/AssemblyInfo.cs b/src/iOS.Autofill/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..d45c83030 --- /dev/null +++ b/src/iOS.Autofill/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("BitwardeniOSAutofill")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("8bit Solutions LLC")] +[assembly: AssemblyProduct("Bitwarden")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("8a3ecd75-3ec8-4cb3-b3a2-a73a724c279a")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/iOS.Autofill/iOS.Autofill.csproj b/src/iOS.Autofill/iOS.Autofill.csproj new file mode 100644 index 000000000..587c85228 --- /dev/null +++ b/src/iOS.Autofill/iOS.Autofill.csproj @@ -0,0 +1,91 @@ + + + + Debug + iPhoneSimulator + {8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A} + {EE2C853D-36AF-4FDB-B1AD-8E90477E2198};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Library + Bit.iOS.Autofill + BitwardeniOSAutofill + Resources + Properties + + + true + full + false + bin\iPhoneSimulator\Debug + DEBUG + prompt + 4 + false + x86_64 + None + true + + + none + true + bin\iPhoneSimulator\Release + prompt + 4 + None + x86_64 + false + Entitlements.plist + + + true + full + false + bin\iPhone\Debug + DEBUG + prompt + 4 + false + ARM64 + Entitlements.plist + iPhone Developer + true + + + none + true + bin\iPhone\Release + prompt + 4 + Entitlements.plist + ARM64 + false + iPhone Developer + + + + + + + + + + + + ActionViewController.cs + + + + + + + + + + + + + {e71f3053-056c-4381-9638-048ed73bdff6} + iOS.Core + + + + \ No newline at end of file diff --git a/src/iOS/iOS.csproj b/src/iOS/iOS.csproj index 6aab5dc7f..147e16e3e 100644 --- a/src/iOS/iOS.csproj +++ b/src/iOS/iOS.csproj @@ -159,6 +159,12 @@ {4b8a8c41-9820-4341-974c-41e65b7f4366} Core + + {8a3ecd75-3ec8-4cb3-b3a2-a73a724c279a} + iOS.Autofill + true + false + {e71f3053-056c-4381-9638-048ed73bdff6} iOS.Core