Merge pull request #3285 from vladyslav-iosdev/#3279

When browser's DappBrowserNavigationBar.state is .browserOnly, the home button, bookmarks, history, etc shouldn't be shown #3279
pull/3286/head
Hwee-Boon Yar 3 years ago committed by GitHub
commit 14e5e0e810
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 32
      AlphaWallet/Browser/Coordinators/DappBrowserCoordinator.swift
  2. 2
      AlphaWallet/Browser/Views/DappBrowserNavigationBar.swift

@ -279,20 +279,24 @@ final class DappBrowserCoordinator: NSObject, Coordinator {
let cancelAction = UIAlertAction(title: R.string.localizable.cancel(), style: .cancel) { _ in } let cancelAction = UIAlertAction(title: R.string.localizable.cancel(), style: .cancel) { _ in }
alertController.addAction(reloadAction) let mappedAlertActionsToDisplay: [(action: UIAlertAction, flag: Bool)] = [
alertController.addAction(myBookmarksAction) (action: reloadAction, flag: true),
alertController.addAction(historyAction) (action: myBookmarksAction, flag: !browserOnly),
alertController.addAction(setAsHomePageAction) (action: historyAction, flag: !browserOnly),
alertController.addAction(shareAction) (action: setAsHomePageAction, flag: !browserOnly),
alertController.addAction(addBookmarkAction) (action: shareAction, flag: true),
alertController.addAction(switchNetworkAction) (action: addBookmarkAction, flag: !browserOnly),
(action: switchNetworkAction, flag: !browserOnly),
if browserOnly { (action: scanQrCodeAction, flag: !browserOnly),
//no-op (action: cancelAction, flag: true)
} else { ]
alertController.addAction(scanQrCodeAction)
} for each in mappedAlertActionsToDisplay {
alertController.addAction(cancelAction) guard each.flag else { continue }
alertController.addAction(each.action)
}
return alertController return alertController
} }

@ -171,7 +171,7 @@ final class DappBrowserNavigationBar: UINavigationBar {
viewsToShowWhenNotEditing.append(contentsOf: [spacer0, spacer1, backwardForwardButtonStackView, textField, spacer2, homeButton, spacer3, moreButton]) viewsToShowWhenNotEditing.append(contentsOf: [spacer0, spacer1, backwardForwardButtonStackView, textField, spacer2, homeButton, spacer3, moreButton])
viewsToShowWhenEditing.append(contentsOf: [textField, cancelEditingButton]) viewsToShowWhenEditing.append(contentsOf: [textField, cancelEditingButton])
viewsToShowWhenBrowserOnly.append(contentsOf: [spacer0, backwardForwardButtonStackView, domainNameLabel, spacer1, closeButton, spacer2, homeButton, spacer3, moreButton]) viewsToShowWhenBrowserOnly.append(contentsOf: [spacer0, backwardForwardButtonStackView, domainNameLabel, spacer1, closeButton, spacer3, moreButton])
changeServerButton.setContentCompressionResistancePriority(.required, for: .horizontal) changeServerButton.setContentCompressionResistancePriority(.required, for: .horizontal)
changeServerButton.setContentHuggingPriority(.required, for: .horizontal) changeServerButton.setContentHuggingPriority(.required, for: .horizontal)

Loading…
Cancel
Save