Add share link and safari tutorial

This commit is contained in:
Ivan Grachyov 2021-12-16 15:33:40 +03:00
parent ead2c382ea
commit ebb0ac1896
3 changed files with 21 additions and 1 deletions

View File

@ -7,6 +7,8 @@ extension URL {
static let twitter = URL(string: "https://tokenary.io/twitter")!
static let github = URL(string: "https://tokenary.io/github")!
static let email = URL(string: "mailto:support@tokenary.io")!
static let iosSafariGuide = URL(string: "https://tokenary.io/guide-ios")!
static let appStore = URL(string: "https://tokenary.io/get")!
static func etherscan(address: String) -> URL {
return URL(string: "https://etherscan.io/address/\(address)")!

View File

@ -74,5 +74,7 @@ struct Strings {
static let pleaseTypeAtLeast = "Please type at least 4 characters"
static let unknownWebsite = "Unknown website ⚠️"
static let calculating = "Calculating…"
static let howToEnableSafariExtension = "How to enable Safari extension?"
static let shareInvite = "Share an invite"
}

View File

@ -18,6 +18,9 @@ class AccountsListViewController: UIViewController, DataStateContainer {
return walletsManager.wallets
}
private var preferencesItem: UIBarButtonItem?
private var addAccountItem: UIBarButtonItem?
@IBOutlet weak var chainButton: UIButton!
@IBOutlet weak var chainSelectionHeader: UIView!
@IBOutlet weak var tableView: UITableView! {
@ -42,6 +45,8 @@ class AccountsListViewController: UIViewController, DataStateContainer {
let addItem = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(addAccount))
let preferencesItem = UIBarButtonItem(image: Images.preferences, style: UIBarButtonItem.Style.plain, target: self, action: #selector(preferencesButtonTapped))
let cancelItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(cancelButtonTapped))
self.addAccountItem = addItem
self.preferencesItem = preferencesItem
navigationItem.rightBarButtonItems = forWalletSelection ? [addItem] : [addItem, preferencesItem]
if forWalletSelection {
navigationItem.leftBarButtonItem = cancelItem
@ -271,13 +276,24 @@ class AccountsListViewController: UIViewController, DataStateContainer {
let githubAction = UIAlertAction(title: Strings.viewOnGithub, style: .default) { _ in
UIApplication.shared.open(URL.github)
}
let emailAction = UIAlertAction(title: Strings.dropUsALine, style: .default) { _ in
let emailAction = UIAlertAction(title: Strings.dropUsALine.withEllipsis, style: .default) { _ in
UIApplication.shared.open(URL.email)
}
let shareInvite = UIAlertAction(title: Strings.shareInvite.withEllipsis, style: .default) { [weak self] _ in
let shareViewController = UIActivityViewController(activityItems: [URL.appStore], applicationActivities: nil)
shareViewController.popoverPresentationController?.barButtonItem = self?.preferencesItem
shareViewController.excludedActivityTypes = [.addToReadingList, .airDrop, .assignToContact, .openInIBooks, .postToFlickr, .postToVimeo, .markupAsPDF]
self?.present(shareViewController, animated: true)
}
let howToEnableSafariExtension = UIAlertAction(title: Strings.howToEnableSafariExtension, style: .default) { _ in
UIApplication.shared.open(URL.iosSafariGuide)
}
let cancelAction = UIAlertAction(title: Strings.cancel, style: .cancel)
actionSheet.addAction(twitterAction)
actionSheet.addAction(githubAction)
actionSheet.addAction(emailAction)
actionSheet.addAction(shareInvite)
actionSheet.addAction(howToEnableSafariExtension)
actionSheet.addAction(cancelAction)
present(actionSheet, animated: true)
}