Michael Scoff 7 years ago
parent d5a5948d56
commit 29bb3b7c93
  1. 21
      Trust/Assets.xcassets/import_options.imageset/Contents.json
  2. BIN
      Trust/Assets.xcassets/import_options.imageset/import_options.png
  3. 27
      Trust/Wallet/ViewControllers/ImportWalletViewController.swift

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "import_options.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 834 B

@ -44,6 +44,7 @@ class ImportWalletViewController: FormViewController {
}
title = viewModel.title
navigationItem.rightBarButtonItem = UIBarButtonItem(image: R.image.import_options(), style: .done, target: self, action: #selector(importOptions))
// if OnePasswordExtension.shared().isAppExtensionAvailable() {
// self.navigationItem.rightBarButtonItem = UIBarButtonItem(
@ -139,4 +140,30 @@ class ImportWalletViewController: FormViewController {
)
delegate?.didImportAccount(account: demoAccount, in: self)
}
func importOptions() {
let alertController = UIAlertController(title: "Import Wallet Options", message: .none, preferredStyle: .actionSheet)
alertController.addAction(UIAlertAction(title: "iCloud/Dropbox/Google Cloud", style: .default) { _ in
self.showDocumentPicker()
})
alertController.addAction(UIAlertAction(title: "Cancel", style: .destructive) { _ in })
present(alertController, animated: true)
}
func showDocumentPicker() {
let types = ["public.text", "public.content", "public.item", "public.data"]
let controller = UIDocumentPickerViewController(documentTypes: types, in: .import)
controller.delegate = self
present(controller, animated: true, completion: nil)
}
}
extension ImportWalletViewController: UIDocumentPickerDelegate {
func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentAt url: URL) {
if controller.documentPickerMode == UIDocumentPickerMode.import {
let text = try? String(contentsOfFile: url.path)
keystoreRow?.value = text
keystoreRow?.reload()
}
}
}

Loading…
Cancel
Save