Back/forward buttons, share button on iPad

This commit is contained in:
James Magahern
2020-07-31 14:08:10 -07:00
parent 6baf543da3
commit ad85c3dc23
6 changed files with 133 additions and 64 deletions

View File

@@ -102,8 +102,7 @@ class ScriptPolicyViewController: UIViewController, UICollectionViewDelegate
let otherOriginScripts = loadedScripts.subtracting([ hostOrigin ])
let originItems = [ hostOrigin ] + otherOriginScripts
let switchCellRegistry = UICollectionView.CellRegistration<SwitchListCell, String> { [weak self] (listCell, indexPath, item) in
guard let self = self else { return }
let switchCellRegistry = UICollectionView.CellRegistration<SwitchListCell, String> { [unowned self] (listCell, indexPath, item) in
var config = listCell.defaultContentConfiguration()
if item == Self.enableScriptsForTabItem {
config.text = "Allow for Tab"
@@ -133,8 +132,7 @@ class ScriptPolicyViewController: UIViewController, UICollectionViewDelegate
listCell.contentConfiguration = config
}
let scriptPolicyRegistry = UICollectionView.CellRegistration<ScriptPolicyControlListCell, String> { [weak self] (listCell, indexPath, item) in
guard let self = self else { return }
let scriptPolicyRegistry = UICollectionView.CellRegistration<ScriptPolicyControlListCell, String> { [unowned self] (listCell, indexPath, item) in
var config = listCell.defaultContentConfiguration()
config.text = item
@@ -196,8 +194,7 @@ class ScriptPolicyViewController: UIViewController, UICollectionViewDelegate
self.collectionView = collectionView
title = "Script Origin Policy"
navigationItem.rightBarButtonItem = UIBarButtonItem(systemItem: .done, primaryAction: UIAction(handler: { [weak self] action in
guard let self = self else { return }
navigationItem.rightBarButtonItem = UIBarButtonItem(systemItem: .done, primaryAction: UIAction(handler: { [unowned self] action in
if self.didChangeScriptPolicy {
self.delegate?.didChangeScriptPolicy()
self.delegate?.setScriptsEnabledForTab(self.allowScriptsForTab)