diff --git a/src/Android/Services/DeviceActionService.cs b/src/Android/Services/DeviceActionService.cs
index 114ec28f2..6d04709e0 100644
--- a/src/Android/Services/DeviceActionService.cs
+++ b/src/Android/Services/DeviceActionService.cs
@@ -122,5 +122,10 @@ namespace Bit.Android.Services
return false;
}
}
+
+ public byte[] SelectFile()
+ {
+ return null;
+ }
}
}
diff --git a/src/App/Abstractions/Services/IDeviceActionService.cs b/src/App/Abstractions/Services/IDeviceActionService.cs
index c24febc9c..919a7640f 100644
--- a/src/App/Abstractions/Services/IDeviceActionService.cs
+++ b/src/App/Abstractions/Services/IDeviceActionService.cs
@@ -5,6 +5,7 @@
void CopyToClipboard(string text);
bool OpenFile(byte[] fileData, string id, string fileName);
bool CanOpenFile(string fileName);
+ byte[] SelectFile();
void ClearCache();
}
}
diff --git a/src/iOS/Entitlements.plist b/src/iOS/Entitlements.plist
index b20900dcc..0597ce385 100644
--- a/src/iOS/Entitlements.plist
+++ b/src/iOS/Entitlements.plist
@@ -10,5 +10,9 @@
$(AppIdentifierPrefix)com.8bit.bitwarden
+ com.apple.developer.ubiquity-container-identifiers
+
+ $(TeamIdentifierPrefix)com.8bit.bitwarden
+
diff --git a/src/iOS/Services/DeviceActionService.cs b/src/iOS/Services/DeviceActionService.cs
index af0129953..24ec0e519 100644
--- a/src/iOS/Services/DeviceActionService.cs
+++ b/src/iOS/Services/DeviceActionService.cs
@@ -3,6 +3,7 @@ using Bit.App.Abstractions;
using UIKit;
using Foundation;
using System.IO;
+using MobileCoreServices;
namespace Bit.iOS.Services
{
@@ -83,5 +84,69 @@ namespace Bit.iOS.Services
var tmp = Path.Combine(documents, "..", "tmp");
return tmp;
}
+
+ public byte[] SelectFile()
+ {
+ var controller = GetVisibleViewController();
+
+ var allowedUTIs = new string[]
+ {
+ UTType.AliasFile,
+ UTType.AliasRecord,
+ UTType.AppleICNS,
+ UTType.Image,
+ UTType.Movie,
+ UTType.GIF,
+ UTType.Video,
+ UTType.Folder,
+ UTType.ApplicationFile,
+ UTType.JPEG,
+ UTType.PNG,
+ UTType.BMP,
+ UTType.Spreadsheet
+ };
+
+ var picker = new UIDocumentMenuViewController(allowedUTIs, UIDocumentPickerMode.Open);
+ picker.AddOption("Camera", null, UIDocumentMenuOrder.First, () =>
+ {
+ var imagePicker = new UIImagePickerController { SourceType = UIImagePickerControllerSourceType.Camera };
+
+ imagePicker.FinishedPickingMedia += (sender, ev) =>
+ {
+ //var filepath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "tmp.png");
+ //var image = (UIImage)ev.Info.ObjectForKey(new NSString("UIImagePickerControllerOriginalImage"));
+ //DismissViewController(true, null)
+ };
+
+ imagePicker.Canceled += (sender, ev2) =>
+ {
+ //DismissViewController(true, null)
+ };
+
+ controller.PresentModalViewController(imagePicker, true);
+ });
+ picker.AddOption("Photo Library", null, UIDocumentMenuOrder.First, () =>
+ {
+ var imagePicker = new UIImagePickerController { SourceType = UIImagePickerControllerSourceType.PhotoLibrary };
+
+ imagePicker.FinishedPickingMedia += (sender, ev) =>
+ {
+ //var filepath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "tmp.png");
+ //var image = (UIImage)ev.Info.ObjectForKey(new NSString("UIImagePickerControllerOriginalImage"));
+ //DismissViewController(true, null)
+ };
+
+ imagePicker.Canceled += (sender, ev2) =>
+ {
+ //DismissViewController(true, null)
+ };
+
+ controller.PresentModalViewController(imagePicker, true);
+ });
+
+ controller.PresentViewController(picker, true, null);
+
+ return null;
+ }
}
}