|
|
@ -333,11 +333,15 @@ final class DappBrowserCoordinator: NSObject, Coordinator { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private func addCurrentPageAsBookmark() { |
|
|
|
private func addCurrentPageAsBookmark() { |
|
|
|
guard let url = currentUrl?.absoluteString else { return } |
|
|
|
if let url = currentUrl?.absoluteString, let title = browserViewController.webView.title { |
|
|
|
guard let title = browserViewController.webView.title else { return } |
|
|
|
let bookmark = Bookmark(url: url, title: title) |
|
|
|
let bookmark = Bookmark(url: url, title: title) |
|
|
|
bookmarksStore.add(bookmarks: [bookmark]) |
|
|
|
bookmarksStore.add(bookmarks: [bookmark]) |
|
|
|
refreshDapps() |
|
|
|
refreshDapps() |
|
|
|
|
|
|
|
|
|
|
|
UINotificationFeedbackGenerator.show(feedbackType: .success) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
UINotificationFeedbackGenerator.show(feedbackType: .error) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private func scanQrCode() { |
|
|
|
private func scanQrCode() { |
|
|
@ -373,6 +377,35 @@ final class DappBrowserCoordinator: NSObject, Coordinator { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum NotificationFeedbackType { |
|
|
|
|
|
|
|
case success |
|
|
|
|
|
|
|
case warning |
|
|
|
|
|
|
|
case error |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var feedbackType: UINotificationFeedbackGenerator.FeedbackType { |
|
|
|
|
|
|
|
switch self { |
|
|
|
|
|
|
|
case .success: |
|
|
|
|
|
|
|
return .success |
|
|
|
|
|
|
|
case .warning: |
|
|
|
|
|
|
|
return .warning |
|
|
|
|
|
|
|
case .error: |
|
|
|
|
|
|
|
return .error |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extension UINotificationFeedbackGenerator { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static func show(feedbackType result: NotificationFeedbackType) { |
|
|
|
|
|
|
|
let feedbackGenerator = UINotificationFeedbackGenerator() |
|
|
|
|
|
|
|
feedbackGenerator.prepare() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1) { |
|
|
|
|
|
|
|
feedbackGenerator.notificationOccurred(result.feedbackType) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
extension DappBrowserCoordinator: BrowserViewControllerDelegate { |
|
|
|
extension DappBrowserCoordinator: BrowserViewControllerDelegate { |
|
|
|
func didCall(action: DappAction, callbackID: Int, inBrowserViewController viewController: BrowserViewController) { |
|
|
|
func didCall(action: DappAction, callbackID: Int, inBrowserViewController viewController: BrowserViewController) { |
|
|
|
guard case .real(let account) = session.account.type else { |
|
|
|
guard case .real(let account) = session.account.type else { |
|
|
|