Compare commits
50 Commits
Attractor-
...
eab5301c2f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eab5301c2f | ||
| 265d393cdc | |||
| 797c4c7c52 | |||
| 6cc4694e1e | |||
| 334703ec43 | |||
| 6301c40c59 | |||
| 8fe8426cc2 | |||
| a2e29abf19 | |||
| 2f4b3c64fe | |||
|
|
177db26b69 | ||
| 0fd466d86d | |||
| 69aa02e303 | |||
|
|
29057c8024 | ||
| a0056af8b1 | |||
|
|
6dccb25b3e | ||
|
|
eec57f5f31 | ||
| d9fa5adf00 | |||
|
|
a4c6caeb8e | ||
|
|
3f5d608908 | ||
|
|
99bd3af187 | ||
|
|
98dfd85781 | ||
|
|
6a187b0df3 | ||
|
|
dca5aca1ce | ||
|
|
f8d19414d5 | ||
|
|
748023d330 | ||
| 6f41caff62 | |||
| 34ca35ea5a | |||
|
|
53efb5389e | ||
|
|
f374f3ebe8 | ||
|
|
836daee5a3 | ||
| 12e2d82009 | |||
| 6be801420c | |||
|
|
75153d1c4a | ||
|
|
95d5d2705c | ||
|
|
957ee045b4 | ||
|
|
184396b1d8 | ||
|
|
ac345ef613 | ||
|
|
58433bc59d | ||
|
|
3b42984361 | ||
|
|
a9801d9d56 | ||
|
|
e8c6111592 | ||
|
|
61773b97db | ||
|
|
1db6cf54a9 | ||
|
|
ace7917080 | ||
|
|
56ed848fe7 | ||
|
|
f6dcc48e46 | ||
|
|
ebc6f4ad6a | ||
|
|
ab2ff98f37 | ||
|
|
5d56b40128 | ||
|
|
d9658508cc |
@@ -23,118 +23,51 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||||||
if userActivity.activityType == SessionActivityType.SettingsWindow.rawValue {
|
if userActivity.activityType == SessionActivityType.SettingsWindow.rawValue {
|
||||||
return UISceneConfiguration(name: "Settings", sessionRole: connectingSceneSession.role)
|
return UISceneConfiguration(name: "Settings", sessionRole: connectingSceneSession.role)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if userActivity.activityType == SessionActivityType.ReaderWindow.rawValue {
|
||||||
|
return UISceneConfiguration(name: "Reader", sessionRole: connectingSceneSession.role)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return UISceneConfiguration(name: "Browser", sessionRole: connectingSceneSession.role)
|
return UISceneConfiguration(name: "Browser", sessionRole: connectingSceneSession.role)
|
||||||
}
|
}
|
||||||
|
|
||||||
static func appMenuShortcuts() -> [UIKeyCommand] {
|
private func historyMenu() -> UIMenu {
|
||||||
[
|
let historyItems = BrowserHistory.shared.allHistory(limit: 50).map { item in
|
||||||
// Preferences
|
let title = ((item.title.count > 0) ? item.title : item.url.absoluteString)
|
||||||
UIKeyCommand(
|
.middleTruncatedString(maximumLength: 85)
|
||||||
modifiers: .command,
|
|
||||||
input: ",",
|
return UIAction(title: title) { action in
|
||||||
title: "Preferences",
|
UIApplication.shared.sendAction(#selector(ShortcutResponder.handleOpenURL), to: nil, from: action, for: OpenURLEvent(url: item.url))
|
||||||
action: #selector(ShortcutResponder.showPreferences)
|
}
|
||||||
)
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static func fileMenuShortcuts() -> [UIKeyCommand] {
|
return UIMenu(title: "History", children: [
|
||||||
[
|
|
||||||
// Open Location...
|
|
||||||
UIKeyCommand(
|
UIKeyCommand(
|
||||||
modifiers: .command, input: "L",
|
modifiers: [ .command ],
|
||||||
title: "Open Location",
|
input: "y",
|
||||||
action: #selector(ShortcutResponder.focusURLBar)
|
title: "Show All History…",
|
||||||
|
action: #selector(ShortcutResponder.showHistory)
|
||||||
),
|
),
|
||||||
|
|
||||||
// Focus Web View
|
UIMenu(options: .displayInline, children: historyItems)
|
||||||
UIKeyCommand(
|
])
|
||||||
modifiers: .command, input: "e",
|
|
||||||
title: "Focus Web View",
|
|
||||||
action: #selector(ShortcutResponder.focusWebView)
|
|
||||||
),
|
|
||||||
|
|
||||||
// Go Back
|
|
||||||
UIKeyCommand(
|
|
||||||
modifiers: .command, input: "[",
|
|
||||||
title: "Go Back",
|
|
||||||
action: #selector(ShortcutResponder.goBack)
|
|
||||||
),
|
|
||||||
|
|
||||||
// Go Forward
|
|
||||||
UIKeyCommand(
|
|
||||||
modifiers: .command, input: "]",
|
|
||||||
title: "Go Forward",
|
|
||||||
action: #selector(ShortcutResponder.goForward)
|
|
||||||
),
|
|
||||||
|
|
||||||
// Create Tab
|
|
||||||
UIKeyCommand(
|
|
||||||
modifiers: .command, input: "T",
|
|
||||||
title: "New Tab",
|
|
||||||
action: #selector(ShortcutResponder.createTab)
|
|
||||||
),
|
|
||||||
|
|
||||||
// Previous Tab
|
|
||||||
UIKeyCommand(
|
|
||||||
modifiers: [.command, .shift], input: "[",
|
|
||||||
title: "Previous Tab",
|
|
||||||
action: #selector(ShortcutResponder.previousTab)
|
|
||||||
),
|
|
||||||
|
|
||||||
// Close tab
|
|
||||||
UIKeyCommand(
|
|
||||||
modifiers: [.command], input: "W",
|
|
||||||
title: "Close Tab",
|
|
||||||
action: #selector(ShortcutResponder.closeTab)
|
|
||||||
),
|
|
||||||
|
|
||||||
// Next Tab
|
|
||||||
UIKeyCommand(
|
|
||||||
modifiers: [.command, .shift], input: "]",
|
|
||||||
title: "Next Tab",
|
|
||||||
action: #selector(ShortcutResponder.nextTab)
|
|
||||||
),
|
|
||||||
|
|
||||||
// Find on page
|
|
||||||
(FindOnPageViewController.isEnabled() ?
|
|
||||||
UIKeyCommand(
|
|
||||||
modifiers: [.command], input: "F",
|
|
||||||
title: "Find on Page",
|
|
||||||
action: #selector(ShortcutResponder.findOnPage)
|
|
||||||
)
|
|
||||||
: UIKeyCommand()
|
|
||||||
),
|
|
||||||
|
|
||||||
// Refresh
|
|
||||||
UIKeyCommand(
|
|
||||||
modifiers: [.command], input: "R",
|
|
||||||
title: "Refresh",
|
|
||||||
action: #selector(ShortcutResponder.refresh)
|
|
||||||
),
|
|
||||||
|
|
||||||
// Toggle Dark Mode
|
|
||||||
UIKeyCommand(
|
|
||||||
modifiers: [.command], input: "M",
|
|
||||||
title: "Toggle Dark Mode",
|
|
||||||
action: #selector(ShortcutResponder.toggleDarkMode)
|
|
||||||
),
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override var keyCommands: [UIKeyCommand]? {
|
override var keyCommands: [UIKeyCommand]? {
|
||||||
get { return Self.fileMenuShortcuts() + Self.appMenuShortcuts() }
|
get { KeyboardShortcuts.allKeyCommands() }
|
||||||
}
|
}
|
||||||
|
|
||||||
override func buildMenu(with builder: UIMenuBuilder) {
|
override func buildMenu(with builder: UIMenuBuilder) {
|
||||||
|
// File
|
||||||
builder.replaceChildren(ofMenu: .file) { children in
|
builder.replaceChildren(ofMenu: .file) { children in
|
||||||
return Self.fileMenuShortcuts() + children
|
return KeyboardShortcuts.menu(for: .file) + children
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// X Format X
|
||||||
builder.remove(menu: .format)
|
builder.remove(menu: .format)
|
||||||
|
|
||||||
|
// Application
|
||||||
builder.replaceChildren(ofMenu: .application, from: { children in
|
builder.replaceChildren(ofMenu: .application, from: { children in
|
||||||
let index = children.firstIndex(where: { elem in
|
let index = children.firstIndex(where: { elem in
|
||||||
if let elem = elem as? UIMenu {
|
if let elem = elem as? UIMenu {
|
||||||
@@ -144,14 +77,26 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||||||
})
|
})
|
||||||
|
|
||||||
var newChildren = children
|
var newChildren = children
|
||||||
|
let shortcuts = KeyboardShortcuts.menu(for: .application)
|
||||||
if let index = index {
|
if let index = index {
|
||||||
newChildren.insert(contentsOf: Self.appMenuShortcuts(), at: index + 1)
|
newChildren.insert(contentsOf: shortcuts, at: index + 1)
|
||||||
} else {
|
} else {
|
||||||
newChildren.append(contentsOf: Self.appMenuShortcuts())
|
newChildren.append(contentsOf: shortcuts)
|
||||||
}
|
}
|
||||||
|
|
||||||
return newChildren
|
return newChildren
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Go
|
||||||
|
builder.insertSibling(UIMenu(title: "Go", children: KeyboardShortcuts.menu(for: .go)), beforeMenu: .view)
|
||||||
|
|
||||||
|
// History
|
||||||
|
builder.insertSibling(historyMenu(), beforeMenu: .view)
|
||||||
|
|
||||||
|
// View
|
||||||
|
builder.replaceChildren(ofMenu: .view) { children in
|
||||||
|
KeyboardShortcuts.menu(for: .view) + children
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,9 +7,58 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import CoreData
|
import CoreData
|
||||||
|
import Combine
|
||||||
|
|
||||||
class BrowserHistory
|
class BrowserHistory
|
||||||
{
|
{
|
||||||
|
class ViewModel: NSObject, ObservableObject, NSFetchedResultsControllerDelegate {
|
||||||
|
@Published var searchQuery: String = ""
|
||||||
|
@Published private(set) var historyItems: [HistoryItem] = []
|
||||||
|
|
||||||
|
fileprivate let historyController: BrowserHistory
|
||||||
|
fileprivate var searchQueryObserver: AnyCancellable? = nil
|
||||||
|
fileprivate var fetchedResultsController: NSFetchedResultsController<HistoryItemEntity> {
|
||||||
|
didSet { fetchedResultsController.delegate = self; performInitialFetch() }
|
||||||
|
}
|
||||||
|
|
||||||
|
fileprivate init(fetchedResultsController: NSFetchedResultsController<HistoryItemEntity>, historyController: BrowserHistory) {
|
||||||
|
self.fetchedResultsController = fetchedResultsController
|
||||||
|
self.historyController = historyController
|
||||||
|
super.init()
|
||||||
|
|
||||||
|
searchQueryObserver = $searchQuery.sink { [unowned self] newValue in
|
||||||
|
self.fetchedResultsController = historyController.fetchRequestController(forQuery: newValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func item(forIdentifier identifier: HistoryItem.ID) -> HistoryItem? {
|
||||||
|
if let object = fetchedResultsController.managedObjectContext.object(with: identifier) as? HistoryItemEntity {
|
||||||
|
return HistoryItem(entity: object)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
public func deleteItems(_ items: Set<HistoryItem.ID>) {
|
||||||
|
items.forEach { identifier in
|
||||||
|
historyController.deleteItem(withIdentifier: identifier)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func controllerDidChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {
|
||||||
|
if let objects = controller.fetchedObjects as? [HistoryItemEntity] {
|
||||||
|
self.historyItems = objects.map { HistoryItem(entity: $0) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fileprivate func performInitialFetch() {
|
||||||
|
try? fetchedResultsController.performFetch()
|
||||||
|
if let objects = fetchedResultsController.fetchedObjects {
|
||||||
|
self.historyItems = objects.map { HistoryItem(entity: $0) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static public let shared = BrowserHistory()
|
static public let shared = BrowserHistory()
|
||||||
|
|
||||||
lazy fileprivate var persistentContainer: NSPersistentContainer = {
|
lazy fileprivate var persistentContainer: NSPersistentContainer = {
|
||||||
@@ -35,12 +84,43 @@ class BrowserHistory
|
|||||||
let nserror = error as NSError
|
let nserror = error as NSError
|
||||||
fatalError("Failed saving persistent entity to store: \(nserror), \(nserror.userInfo)")
|
fatalError("Failed saving persistent entity to store: \(nserror), \(nserror.userInfo)")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UIMenuSystem.main.setNeedsRebuild()
|
||||||
}
|
}
|
||||||
|
|
||||||
public func allHistory() -> [HistoryItem] {
|
public func viewModel(forFilterString filterString: String? = nil, limit: Int = 500) -> ViewModel {
|
||||||
let dataContext = persistentContainer.viewContext
|
let resultsController = fetchRequestController(forQuery: filterString, limit: limit)
|
||||||
|
return ViewModel(fetchedResultsController: resultsController, historyController: self)
|
||||||
|
}
|
||||||
|
|
||||||
let fetchRequest: NSFetchRequest<HistoryItemEntity> = HistoryItemEntity.fetchRequest()
|
public func historyItem(forIdentifier: HistoryItem.ID) -> HistoryItem? {
|
||||||
|
if let entity = try? persistentContainer.viewContext.existingObject(with: forIdentifier) as? HistoryItemEntity {
|
||||||
|
return HistoryItem(entity: entity)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
public func deleteItem(withIdentifier identifier: HistoryItem.ID) {
|
||||||
|
let dataContext = persistentContainer.viewContext
|
||||||
|
if let object = try? dataContext.existingObject(with: identifier) {
|
||||||
|
dataContext.delete(object)
|
||||||
|
try? dataContext.save()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func clearAllHistory() {
|
||||||
|
let dataContext = persistentContainer.viewContext
|
||||||
|
let fetchRequest: NSFetchRequest<NSFetchRequestResult> = HistoryItemEntity.fetchRequest()
|
||||||
|
let request = NSBatchDeleteRequest(fetchRequest: fetchRequest)
|
||||||
|
|
||||||
|
do { try dataContext.execute(request) }
|
||||||
|
catch { print("Error clearing history: \(error.localizedDescription)") }
|
||||||
|
}
|
||||||
|
|
||||||
|
public func allHistory(filteredBy filterString: String? = nil, limit: Int = 500) -> [HistoryItem] {
|
||||||
|
let dataContext = persistentContainer.viewContext
|
||||||
|
let fetchRequest = fetchRequest(forStringContaining: filterString, limit: limit)
|
||||||
let entities: [HistoryItemEntity] = (try? dataContext.fetch(fetchRequest)) ?? []
|
let entities: [HistoryItemEntity] = (try? dataContext.fetch(fetchRequest)) ?? []
|
||||||
|
|
||||||
return entities.map { (entity) -> HistoryItem in
|
return entities.map { (entity) -> HistoryItem in
|
||||||
@@ -52,7 +132,11 @@ class BrowserHistory
|
|||||||
let dataContext = persistentContainer.viewContext
|
let dataContext = persistentContainer.viewContext
|
||||||
|
|
||||||
let fetchRequest: NSFetchRequest<HistoryItemEntity> = HistoryItemEntity.fetchRequest()
|
let fetchRequest: NSFetchRequest<HistoryItemEntity> = HistoryItemEntity.fetchRequest()
|
||||||
fetchRequest.predicate = NSPredicate(format: "host CONTAINS %@ OR title contains %@", matching, matching)
|
fetchRequest.predicate = NSPredicate(format: """
|
||||||
|
host CONTAINS[cd] %@
|
||||||
|
OR title CONTAINS[cd] %@
|
||||||
|
OR url ENDSWITH[cd] %@
|
||||||
|
""", matching, matching, matching)
|
||||||
fetchRequest.fetchLimit = 200
|
fetchRequest.fetchLimit = 200
|
||||||
fetchRequest.sortDescriptors = [ NSSortDescriptor(key: "visitCount", ascending: false) ]
|
fetchRequest.sortDescriptors = [ NSSortDescriptor(key: "visitCount", ascending: false) ]
|
||||||
|
|
||||||
@@ -85,6 +169,35 @@ class BrowserHistory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension BrowserHistory
|
||||||
|
{
|
||||||
|
fileprivate func fetchRequestController(forQuery query: String? = nil, limit: Int = 500) -> NSFetchedResultsController<HistoryItemEntity> {
|
||||||
|
let fetchRequest = fetchRequest(forStringContaining: query, limit: limit)
|
||||||
|
return NSFetchedResultsController(fetchRequest: fetchRequest,
|
||||||
|
managedObjectContext: persistentContainer.viewContext,
|
||||||
|
sectionNameKeyPath: nil, cacheName: nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
fileprivate func fetchRequest(forStringContaining filterString: String? = nil, limit: Int = 500) -> NSFetchRequest<HistoryItemEntity> {
|
||||||
|
let fetchRequest: NSFetchRequest<HistoryItemEntity> = HistoryItemEntity.fetchRequest()
|
||||||
|
fetchRequest.fetchLimit = limit
|
||||||
|
fetchRequest.sortDescriptors = [
|
||||||
|
// Sort by date
|
||||||
|
NSSortDescriptor(keyPath: \HistoryItemEntity.lastVisited, ascending: false)
|
||||||
|
]
|
||||||
|
|
||||||
|
if let filterString, filterString.count > 0 {
|
||||||
|
fetchRequest.predicate = NSPredicate(format: """
|
||||||
|
host CONTAINS[cd] %@
|
||||||
|
OR title CONTAINS[cd] %@
|
||||||
|
OR url CONTAINS[cd] %@
|
||||||
|
""", filterString, filterString, filterString)
|
||||||
|
}
|
||||||
|
|
||||||
|
return fetchRequest
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extension URL
|
extension URL
|
||||||
{
|
{
|
||||||
public func topLevelURL() -> URL {
|
public func topLevelURL() -> URL {
|
||||||
|
|||||||
@@ -5,17 +5,28 @@
|
|||||||
// Created by James Magahern on 8/14/20.
|
// Created by James Magahern on 8/14/20.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
import CoreData
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
struct HistoryItem: Hashable
|
struct HistoryItem: Hashable, Identifiable
|
||||||
{
|
{
|
||||||
var url: URL
|
var url: URL
|
||||||
var title: String
|
var title: String
|
||||||
var lastVisited: Date
|
var lastVisited: Date
|
||||||
|
var id: NSManagedObjectID
|
||||||
|
|
||||||
init(entity: HistoryItemEntity) {
|
init(entity: HistoryItemEntity) {
|
||||||
self.url = entity.url ?? URL(string: "about:blank")!
|
self.url = entity.url ?? URL(string: "about:blank")!
|
||||||
self.lastVisited = entity.lastVisited ?? Date()
|
self.lastVisited = entity.lastVisited ?? Date()
|
||||||
self.title = entity.title ?? ""
|
self.title = entity.title ?? ""
|
||||||
|
self.id = entity.objectID
|
||||||
|
}
|
||||||
|
|
||||||
|
// For testing/previews
|
||||||
|
public init(url: URL, title: String, lastVisited: Date) {
|
||||||
|
self.url = url
|
||||||
|
self.title = title
|
||||||
|
self.lastVisited = lastVisited
|
||||||
|
self.id = NSManagedObjectID()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,8 @@ class ResourcePolicyManager: NSObject, SBRResourceOriginPolicyDataSource
|
|||||||
func allowedOriginsForScriptResources() -> Set<String> { allowedOriginSet }
|
func allowedOriginsForScriptResources() -> Set<String> { allowedOriginSet }
|
||||||
|
|
||||||
func scriptPolicyTypeByOrigin() -> [String : NSNumber] {
|
func scriptPolicyTypeByOrigin() -> [String : NSNumber] {
|
||||||
return scriptPolicies.mapValues { NSNumber(integerLiteral: $0.rawValue) }
|
let types = scriptPolicies.mapValues { NSNumber(integerLiteral: $0.rawValue) }
|
||||||
|
return types
|
||||||
}
|
}
|
||||||
|
|
||||||
private lazy var scriptPolicies: Dictionary<String, ScriptPolicy.PolicyType> = {
|
private lazy var scriptPolicies: Dictionary<String, ScriptPolicy.PolicyType> = {
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ class BrowserView: UIView
|
|||||||
}
|
}
|
||||||
}(animationCurve)
|
}(animationCurve)
|
||||||
|
|
||||||
|
toolbarView?.layoutLatch.deactivate()
|
||||||
keyboardLayoutOffset = bounds.height - keyboardEndFrame.minY
|
keyboardLayoutOffset = bounds.height - keyboardEndFrame.minY
|
||||||
UIView.animate(withDuration: animationDuration, delay: 0.0, options: animationOptions, animations: { self.layoutIfNeeded() }, completion: nil)
|
UIView.animate(withDuration: animationDuration, delay: 0.0, options: animationOptions, animations: { self.layoutIfNeeded() }, completion: nil)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,11 +94,11 @@ extension BrowserViewController: ShortcutResponder
|
|||||||
}
|
}
|
||||||
|
|
||||||
func goBack(_ sender: Any?) {
|
func goBack(_ sender: Any?) {
|
||||||
tab.webView.goBack()
|
currentTab.webView.goBack()
|
||||||
}
|
}
|
||||||
|
|
||||||
func goForward(_ sender: Any?) {
|
func goForward(_ sender: Any?) {
|
||||||
tab.webView.goForward()
|
currentTab.webView.goForward()
|
||||||
}
|
}
|
||||||
|
|
||||||
func createTab(_ sender: Any?) {
|
func createTab(_ sender: Any?) {
|
||||||
@@ -106,24 +106,24 @@ extension BrowserViewController: ShortcutResponder
|
|||||||
}
|
}
|
||||||
|
|
||||||
func previousTab(_ sender: Any?) {
|
func previousTab(_ sender: Any?) {
|
||||||
if let tabIndex = tabController.tabs.firstIndex(of: self.tab) {
|
if let tabIndex = tabController.tabs.firstIndex(of: self.currentTab) {
|
||||||
if tabIndex - 1 >= 0 {
|
if tabIndex - 1 >= 0 {
|
||||||
self.tab = tabController.tabs[tabIndex - 1]
|
self.currentTab = tabController.tabs[tabIndex - 1]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func nextTab(_ sender: Any?) {
|
func nextTab(_ sender: Any?) {
|
||||||
if let tabIndex = tabController.tabs.firstIndex(of: self.tab) {
|
if let tabIndex = tabController.tabs.firstIndex(of: self.currentTab) {
|
||||||
if tabIndex + 1 < tabController.tabs.count {
|
if tabIndex + 1 < tabController.tabs.count {
|
||||||
self.tab = tabController.tabs[tabIndex + 1]
|
self.currentTab = tabController.tabs[tabIndex + 1]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func closeTab(_ sender: Any?) {
|
func closeTab(_ sender: Any?) {
|
||||||
if tabController.tabs.count > 1 {
|
if tabController.tabs.count > 1 {
|
||||||
tabController.closeTab(self.tab)
|
tabController.closeTab(self.currentTab)
|
||||||
} else {
|
} else {
|
||||||
#if targetEnvironment(macCatalyst)
|
#if targetEnvironment(macCatalyst)
|
||||||
if let originWindowScene = self.view.window?.windowScene {
|
if let originWindowScene = self.view.window?.windowScene {
|
||||||
@@ -144,19 +144,81 @@ extension BrowserViewController: ShortcutResponder
|
|||||||
webView.reload()
|
webView.reload()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func stop(_ sender: Any?) {
|
||||||
|
webView.stopLoading()
|
||||||
|
}
|
||||||
|
|
||||||
override func increaseSize(_ sender: Any?) {
|
override func increaseSize(_ sender: Any?) {
|
||||||
tab.webView._viewScale += 0.10
|
currentTab.webView._viewScale += 0.10
|
||||||
}
|
}
|
||||||
|
|
||||||
override func decreaseSize(_ sender: Any?) {
|
override func decreaseSize(_ sender: Any?) {
|
||||||
tab.webView._viewScale -= 0.10
|
currentTab.webView._viewScale -= 0.10
|
||||||
|
}
|
||||||
|
|
||||||
|
func zoomToActualSize(_ sender: Any?) {
|
||||||
|
currentTab.webView._viewScale = 1.0
|
||||||
}
|
}
|
||||||
|
|
||||||
func showPreferences(_ sender: Any?) {
|
func showPreferences(_ sender: Any?) {
|
||||||
showSettingsWindow()
|
showSettingsWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func showHistory(_ sender: Any?) {
|
||||||
|
showHistoryWindow()
|
||||||
|
}
|
||||||
|
|
||||||
func toggleDarkMode(_ sender: Any?) {
|
func toggleDarkMode(_ sender: Any?) {
|
||||||
self.darkModeEnabled = !self.darkModeEnabled
|
self.darkModeEnabled = !self.darkModeEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func openInReaderMode(_ sender: Any?) {
|
||||||
|
showReaderWindow()
|
||||||
|
}
|
||||||
|
|
||||||
|
func handleOpenURL(_ sender: Any?, forEvent event: OpenURLEvent?) {
|
||||||
|
guard let event else { return }
|
||||||
|
|
||||||
|
if currentTab.url == nil {
|
||||||
|
currentTab.beginLoadingURL(event.url)
|
||||||
|
} else {
|
||||||
|
createNewTab(withURL: event.url)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func raiseScriptPolicyRestriction(_ sender: Any?) {
|
||||||
|
guard let hostOrigin = currentTab.webView.url?.securityOrigin else { return }
|
||||||
|
let currentPolicy = policyManager.scriptPolicy(forOrigin: hostOrigin)
|
||||||
|
policyManager.setScriptPolicyType(currentPolicy.policyType--, forOrigin: hostOrigin)
|
||||||
|
didChangeScriptPolicy()
|
||||||
|
}
|
||||||
|
|
||||||
|
func lowerScriptPolicyRestriction(_ sender: Any?) {
|
||||||
|
guard let hostOrigin = currentTab.webView.url?.securityOrigin else { return }
|
||||||
|
let currentPolicy = policyManager.scriptPolicy(forOrigin: hostOrigin)
|
||||||
|
policyManager.setScriptPolicyType(currentPolicy.policyType++, forOrigin: hostOrigin)
|
||||||
|
didChangeScriptPolicy()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension ScriptPolicy.PolicyType {
|
||||||
|
static postfix func ++ (obj: ScriptPolicy.PolicyType) -> ScriptPolicy.PolicyType {
|
||||||
|
switch obj {
|
||||||
|
case .alpha: .bravo
|
||||||
|
case .bravo: .charlie
|
||||||
|
case .charlie: .delta
|
||||||
|
case .delta: .echo
|
||||||
|
default: obj
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static postfix func -- (obj: ScriptPolicy.PolicyType) -> ScriptPolicy.PolicyType {
|
||||||
|
switch obj {
|
||||||
|
case .bravo: .alpha
|
||||||
|
case .charlie: .bravo
|
||||||
|
case .delta: .charlie
|
||||||
|
case .echo: .delta
|
||||||
|
default: obj
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,35 +10,15 @@ import WebKit
|
|||||||
extension BrowserViewController: WKNavigationDelegate, WKUIDelegate
|
extension BrowserViewController: WKNavigationDelegate, WKUIDelegate
|
||||||
{
|
{
|
||||||
func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
|
func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
|
||||||
|
if let tab = tabController.tab(forWebView: webView) {
|
||||||
|
// We're alive!
|
||||||
|
tab.contentProcessTerminated = false
|
||||||
tab.loadError = nil
|
tab.loadError = nil
|
||||||
|
|
||||||
// Check to make sure we have connected to the web content process
|
|
||||||
if !tab.bridge.webContentProcessConnected {
|
|
||||||
// This means we started loading a page but the web content process hasn't loaded, which means
|
|
||||||
// scripts are not getting blocked.
|
|
||||||
|
|
||||||
// If you're ad-hoc signing this, you'll need to disable library validation:
|
|
||||||
// sudo defaults write /Library/Preferences/com.apple.security.libraryvalidation DisableLibraryValidation -bool YES
|
|
||||||
|
|
||||||
DispatchQueue.main.async { [unowned self] in
|
|
||||||
// Stop loading now
|
|
||||||
webView.stopLoading()
|
|
||||||
|
|
||||||
// Show an alert
|
|
||||||
let alert = UIAlertController(title: "Web Process Not Loaded",
|
|
||||||
message: "The web content process never contacted the host application",
|
|
||||||
preferredStyle: .alert)
|
|
||||||
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { _ in
|
|
||||||
alert.dismiss(animated: true, completion: nil)
|
|
||||||
}))
|
|
||||||
|
|
||||||
present(alert, animated: true, completion: nil)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset tracking this
|
// Reset tracking this
|
||||||
tab.allowedScriptOrigins.removeAll()
|
currentTab.allowedScriptOrigins.removeAll()
|
||||||
tab.blockedScriptOrigins.removeAll()
|
currentTab.blockedScriptOrigins.removeAll()
|
||||||
updateScriptBlockerButton()
|
updateScriptBlockerButton()
|
||||||
|
|
||||||
// Blur url bar if applicable
|
// Blur url bar if applicable
|
||||||
@@ -48,7 +28,7 @@ extension BrowserViewController: WKNavigationDelegate, WKUIDelegate
|
|||||||
|
|
||||||
if let url = webView.url {
|
if let url = webView.url {
|
||||||
// Start requesting favicon
|
// Start requesting favicon
|
||||||
tab.updateFaviconForURL(url)
|
currentTab.updateFaviconForURL(url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,7 +36,7 @@ extension BrowserViewController: WKNavigationDelegate, WKUIDelegate
|
|||||||
// We got rugged!!!!!! Update the favicon again.
|
// We got rugged!!!!!! Update the favicon again.
|
||||||
if let url = webView.url {
|
if let url = webView.url {
|
||||||
// Start requesting favicon
|
// Start requesting favicon
|
||||||
tab.updateFaviconForURL(url)
|
currentTab.updateFaviconForURL(url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,6 +48,9 @@ extension BrowserViewController: WKNavigationDelegate, WKUIDelegate
|
|||||||
let title = webView.title ?? ""
|
let title = webView.title ?? ""
|
||||||
BrowserHistory.shared.didNavigate(toURL: url, title: title)
|
BrowserHistory.shared.didNavigate(toURL: url, title: title)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Publish Tabs
|
||||||
|
AttractorServer.shared.publishTabInfo(tabController.tabs.map { $0.tabInfo })
|
||||||
}
|
}
|
||||||
|
|
||||||
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, preferences: WKWebpagePreferences, decisionHandler: @escaping (WKNavigationActionPolicy, WKWebpagePreferences) -> Void)
|
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, preferences: WKWebpagePreferences, decisionHandler: @escaping (WKNavigationActionPolicy, WKWebpagePreferences) -> Void)
|
||||||
@@ -87,7 +70,7 @@ extension BrowserViewController: WKNavigationDelegate, WKUIDelegate
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var allowJavaScript = tab.javaScriptEnabled
|
var allowJavaScript = currentTab.javaScriptEnabled
|
||||||
if !allowJavaScript, let host = navigationAction.request.url?.host {
|
if !allowJavaScript, let host = navigationAction.request.url?.host {
|
||||||
// Check origin policy
|
// Check origin policy
|
||||||
allowJavaScript = policyManager.scriptPolicy(forOrigin: host).allowsEmbeddedJavaScript()
|
allowJavaScript = policyManager.scriptPolicy(forOrigin: host).allowsEmbeddedJavaScript()
|
||||||
@@ -98,7 +81,7 @@ extension BrowserViewController: WKNavigationDelegate, WKUIDelegate
|
|||||||
if let url = navigationAction.request.url,
|
if let url = navigationAction.request.url,
|
||||||
let redirectedURL = Settings.shared.redirectRule(for: url)
|
let redirectedURL = Settings.shared.redirectRule(for: url)
|
||||||
{
|
{
|
||||||
tab.beginLoadingURL(redirectedURL)
|
currentTab.beginLoadingURL(redirectedURL)
|
||||||
decisionHandler(.cancel, preferences)
|
decisionHandler(.cancel, preferences)
|
||||||
} else {
|
} else {
|
||||||
decisionHandler(.allow, preferences)
|
decisionHandler(.allow, preferences)
|
||||||
@@ -106,17 +89,21 @@ extension BrowserViewController: WKNavigationDelegate, WKUIDelegate
|
|||||||
}
|
}
|
||||||
|
|
||||||
func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
|
func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
|
||||||
if webView == tab.webView {
|
if webView == currentTab.webView {
|
||||||
tab.loadError = error
|
currentTab.loadError = error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
|
func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
|
||||||
if webView == tab.webView {
|
if webView == currentTab.webView {
|
||||||
tab.loadError = error
|
currentTab.loadError = error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func webViewWebContentProcessDidTerminate(_ webView: WKWebView) {
|
||||||
|
tabController.tab(forWebView: webView)?.contentProcessTerminated = true
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: WKUIDelegate
|
// MARK: WKUIDelegate
|
||||||
|
|
||||||
func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView?
|
func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView?
|
||||||
@@ -124,7 +111,7 @@ extension BrowserViewController: WKNavigationDelegate, WKUIDelegate
|
|||||||
let newTab = tabController.createNewTab(url: nil, webViewConfiguration: configuration)
|
let newTab = tabController.createNewTab(url: nil, webViewConfiguration: configuration)
|
||||||
newTab.webView.load(navigationAction.request)
|
newTab.webView.load(navigationAction.request)
|
||||||
|
|
||||||
self.tab = newTab
|
self.currentTab = newTab
|
||||||
|
|
||||||
return newTab.webView
|
return newTab.webView
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import UniformTypeIdentifiers
|
|||||||
class BrowserViewController: UIViewController
|
class BrowserViewController: UIViewController
|
||||||
{
|
{
|
||||||
let browserView = BrowserView()
|
let browserView = BrowserView()
|
||||||
var tab: Tab { didSet { didChangeTab(tab) } }
|
var currentTab: Tab { didSet { didChangeTab(currentTab) } }
|
||||||
var webView: WKWebView { tab.webView }
|
var webView: WKWebView { currentTab.webView }
|
||||||
|
|
||||||
internal let tabController = TabController()
|
internal let tabController = TabController()
|
||||||
internal let tabBarViewController: TabBarViewController
|
internal let tabBarViewController: TabBarViewController
|
||||||
@@ -42,9 +42,9 @@ class BrowserViewController: UIViewController
|
|||||||
static let longPressWindowButtonToMakeNewTab: Bool = false
|
static let longPressWindowButtonToMakeNewTab: Bool = false
|
||||||
|
|
||||||
internal var darkModeEnabled: Bool {
|
internal var darkModeEnabled: Bool {
|
||||||
get { tab.bridge.darkModeEnabled }
|
get { currentTab.bridge.darkModeEnabled }
|
||||||
set {
|
set {
|
||||||
tab.bridge.darkModeEnabled = newValue
|
currentTab.bridge.darkModeEnabled = newValue
|
||||||
toolbarController.darkModeEnabled = newValue
|
toolbarController.darkModeEnabled = newValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -60,7 +60,7 @@ class BrowserViewController: UIViewController
|
|||||||
internal var changingFocusToAutocompleteController = false
|
internal var changingFocusToAutocompleteController = false
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
self.tab = tabController.tabs.first!
|
self.currentTab = tabController.tabs.first!
|
||||||
self.tabBarViewController = TabBarViewController(tabController: tabController)
|
self.tabBarViewController = TabBarViewController(tabController: tabController)
|
||||||
super.init(nibName: nil, bundle: nil)
|
super.init(nibName: nil, bundle: nil)
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ class BrowserViewController: UIViewController
|
|||||||
addChild(findOnPageController)
|
addChild(findOnPageController)
|
||||||
addChild(tabBarViewController)
|
addChild(tabBarViewController)
|
||||||
|
|
||||||
didChangeTab(tab)
|
didChangeTab(currentTab)
|
||||||
}
|
}
|
||||||
|
|
||||||
required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }
|
required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }
|
||||||
@@ -114,12 +114,12 @@ class BrowserViewController: UIViewController
|
|||||||
|
|
||||||
// Script button
|
// Script button
|
||||||
toolbarController.scriptControllerIconView.addAction(UIAction(handler: { [unowned self] action in
|
toolbarController.scriptControllerIconView.addAction(UIAction(handler: { [unowned self] action in
|
||||||
let hostOrigin = self.webView.url?.host ?? ""
|
let hostOrigin = self.webView.url?.securityOrigin ?? ""
|
||||||
let loadedScripts = self.tab.allowedScriptOrigins.union(self.tab.blockedScriptOrigins)
|
let loadedScripts = currentTab.allowedScriptOrigins.union(currentTab.blockedScriptOrigins)
|
||||||
let scriptViewController = ScriptPolicyViewController(policyManager: self.policyManager,
|
let scriptViewController = ScriptPolicyViewController(policyManager: self.policyManager,
|
||||||
hostOrigin: hostOrigin,
|
hostOrigin: hostOrigin,
|
||||||
loadedScripts: loadedScripts,
|
loadedScripts: loadedScripts,
|
||||||
scriptsAllowedForTab: self.tab.javaScriptEnabled)
|
scriptsAllowedForTab: currentTab.javaScriptEnabled)
|
||||||
scriptViewController.delegate = self
|
scriptViewController.delegate = self
|
||||||
|
|
||||||
let navController = UINavigationController(rootViewController: scriptViewController)
|
let navController = UINavigationController(rootViewController: scriptViewController)
|
||||||
@@ -137,16 +137,54 @@ class BrowserViewController: UIViewController
|
|||||||
|
|
||||||
// Tabs button
|
// Tabs button
|
||||||
toolbarController.windowButton.addAction(UIAction(handler: { [unowned self] _ in
|
toolbarController.windowButton.addAction(UIAction(handler: { [unowned self] _ in
|
||||||
let tabPickerController = TabPickerViewController(tabController: self.tabController)
|
let tabPickerController = TabPickerViewController()
|
||||||
tabPickerController.delegate = self
|
tabPickerController.delegate = self
|
||||||
tabPickerController.selectedTab = self.tab
|
tabPickerController.title = "Tabs"
|
||||||
|
tabPickerController.tabBarItem.image = UIImage(systemName: "rectangle.on.rectangle")
|
||||||
|
tabPickerController.selectedTabIdentifier = currentTab.identifier
|
||||||
|
tabPickerController.tabObserver = tabController.$tabs
|
||||||
|
.receive(on: RunLoop.main)
|
||||||
|
.sink(receiveValue: { (newTabs: [Tab]) in
|
||||||
|
tabPickerController.setTabInfos(newTabs.map { $0.tabInfo }, forHost: TabPickerViewController.localHostIdentifier)
|
||||||
|
})
|
||||||
|
|
||||||
let navController = UINavigationController(rootViewController: tabPickerController)
|
// Set localhost tabs
|
||||||
navController.modalPresentationStyle = .popover
|
let tabInfos = tabController.tabs.map { $0.tabInfo }
|
||||||
navController.popoverPresentationController?.sourceView = self.toolbarController.windowButton
|
tabPickerController.setTabInfos(tabInfos, forHost: TabPickerViewController.localHostIdentifier)
|
||||||
navController.popoverPresentationController?.delegate = self
|
tabPickerController.selectedTabHost = TabPickerViewController.localHostIdentifier
|
||||||
|
|
||||||
self.present(navController, animated: true, completion: nil)
|
let remoteTabPickerController = TabPickerViewController()
|
||||||
|
remoteTabPickerController.delegate = self
|
||||||
|
remoteTabPickerController.title = "Remote Tabs"
|
||||||
|
remoteTabPickerController.tabBarItem.image = UIImage(systemName: "icloud")
|
||||||
|
remoteTabPickerController.newTabButton.isEnabled = false
|
||||||
|
remoteTabPickerController.editButtonItem.isEnabled = false
|
||||||
|
|
||||||
|
// Fetch tabs now
|
||||||
|
AttractorServer.shared.getTabInfos { [weak remoteTabPickerController] result in
|
||||||
|
guard let picker = remoteTabPickerController else { return }
|
||||||
|
|
||||||
|
switch result {
|
||||||
|
case .success(let tabInfos):
|
||||||
|
tabInfos.forEach { (key: String, value: [TabInfo]) in
|
||||||
|
picker.setTabInfos(value, forHost: key)
|
||||||
|
}
|
||||||
|
case .failure(let error):
|
||||||
|
picker.displayedError = error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let tabBarController = UITabBarController(nibName: nil, bundle: nil)
|
||||||
|
tabBarController.viewControllers = [
|
||||||
|
UINavigationController(rootViewController: tabPickerController),
|
||||||
|
UINavigationController(rootViewController: remoteTabPickerController)
|
||||||
|
]
|
||||||
|
|
||||||
|
tabBarController.modalPresentationStyle = .popover
|
||||||
|
tabBarController.popoverPresentationController?.sourceView = self.toolbarController.windowButton
|
||||||
|
tabBarController.popoverPresentationController?.delegate = self
|
||||||
|
|
||||||
|
self.present(tabBarController, animated: true, completion: nil)
|
||||||
}), for: .touchUpInside)
|
}), for: .touchUpInside)
|
||||||
|
|
||||||
let newTabAction = UIAction { [unowned self] action in
|
let newTabAction = UIAction { [unowned self] action in
|
||||||
@@ -169,7 +207,7 @@ class BrowserViewController: UIViewController
|
|||||||
|
|
||||||
// Error button
|
// Error button
|
||||||
toolbarController.urlBar.errorButton.addAction(UIAction(handler: { [unowned self] _ in
|
toolbarController.urlBar.errorButton.addAction(UIAction(handler: { [unowned self] _ in
|
||||||
let alert = UIAlertController(title: "Error", message: self.tab.loadError?.localizedDescription, preferredStyle: .actionSheet)
|
let alert = UIAlertController(title: "Error", message: currentTab.loadError?.localizedDescription, preferredStyle: .actionSheet)
|
||||||
alert.popoverPresentationController?.sourceView = self.toolbarController.urlBar.errorButton
|
alert.popoverPresentationController?.sourceView = self.toolbarController.urlBar.errorButton
|
||||||
|
|
||||||
alert.addAction(UIAlertAction(title: "Reload", style: .destructive, handler: { _ in
|
alert.addAction(UIAlertAction(title: "Reload", style: .destructive, handler: { _ in
|
||||||
@@ -202,7 +240,7 @@ class BrowserViewController: UIViewController
|
|||||||
|
|
||||||
// Font size adjust
|
// Font size adjust
|
||||||
toolbarController.urlBar.documentButton.addAction(UIAction(handler: { [unowned self] _ in
|
toolbarController.urlBar.documentButton.addAction(UIAction(handler: { [unowned self] _ in
|
||||||
let documentControls = DocumentControlViewController(darkModeEnabled: tab.bridge.darkModeEnabled)
|
let documentControls = DocumentControlViewController(darkModeEnabled: currentTab.bridge.darkModeEnabled)
|
||||||
documentControls.modalPresentationStyle = .popover
|
documentControls.modalPresentationStyle = .popover
|
||||||
documentControls.popoverPresentationController?.permittedArrowDirections = [ .down, .up ]
|
documentControls.popoverPresentationController?.permittedArrowDirections = [ .down, .up ]
|
||||||
documentControls.popoverPresentationController?.sourceView = toolbarController.urlBar.documentButton
|
documentControls.popoverPresentationController?.sourceView = toolbarController.urlBar.documentButton
|
||||||
@@ -212,28 +250,30 @@ class BrowserViewController: UIViewController
|
|||||||
numberFormatter.numberStyle = .percent
|
numberFormatter.numberStyle = .percent
|
||||||
|
|
||||||
let label = documentControls.fontSizeAdjustView.labelView
|
let label = documentControls.fontSizeAdjustView.labelView
|
||||||
label.text = numberFormatter.string(for: tab.webView._viewScale)
|
label.text = numberFormatter.string(for: currentTab.webView._viewScale)
|
||||||
|
|
||||||
// Font size adjust
|
// Font size adjust
|
||||||
documentControls.fontSizeAdjustView.decreaseSizeButton.addAction(UIAction(handler: { [unowned self] sender in
|
documentControls.fontSizeAdjustView.decreaseSizeButton.addAction(UIAction(handler: { [unowned self] sender in
|
||||||
self.decreaseSize(sender)
|
self.decreaseSize(sender)
|
||||||
label.text = numberFormatter.string(for: tab.webView._viewScale)
|
label.text = numberFormatter.string(for: currentTab.webView._viewScale)
|
||||||
}), for: .touchUpInside)
|
}), for: .touchUpInside)
|
||||||
|
|
||||||
documentControls.fontSizeAdjustView.increaseSizeButton.addAction(UIAction(handler: { [unowned self] sender in
|
documentControls.fontSizeAdjustView.increaseSizeButton.addAction(UIAction(handler: { [unowned self] sender in
|
||||||
self.increaseSize(sender)
|
self.increaseSize(sender)
|
||||||
label.text = numberFormatter.string(for: tab.webView._viewScale)
|
label.text = numberFormatter.string(for: currentTab.webView._viewScale)
|
||||||
}), for: .touchUpInside)
|
}), for: .touchUpInside)
|
||||||
|
|
||||||
// Find on page
|
// Find on page
|
||||||
documentControls.findOnPageControlView.addAction(UIAction(handler: { [unowned self] _ in
|
documentControls.findOnPageControlView.addAction(UIAction(handler: { [unowned self] _ in
|
||||||
documentControls.dismiss(animated: true, completion: nil)
|
documentControls.dismiss(animated: true, completion: { [unowned self] in
|
||||||
|
// Needs to happen after dismissal, otherwise the find navigator will pick up the document
|
||||||
|
// controls as the divergent responder/deepest action responder (my bad...).
|
||||||
if FindOnPageViewController.isEnabled() {
|
if FindOnPageViewController.isEnabled() {
|
||||||
browserView.setFindOnPageVisible(true, animated: true)
|
browserView.setFindOnPageVisible(true, animated: true)
|
||||||
} else if #available(iOS 16.0, *) {
|
} else if #available(iOS 16.0, *) {
|
||||||
browserView.webView?._findInteraction.presentFindNavigatorShowingReplace(false)
|
browserView.webView?.findInteraction?.presentFindNavigator(showingReplace: false)
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}), for: .touchUpInside)
|
}), for: .touchUpInside)
|
||||||
|
|
||||||
// Navigation controls
|
// Navigation controls
|
||||||
@@ -257,19 +297,8 @@ class BrowserViewController: UIViewController
|
|||||||
|
|
||||||
// Reader mode
|
// Reader mode
|
||||||
documentControls.readabilityView.addAction(UIAction { [unowned self] _ in
|
documentControls.readabilityView.addAction(UIAction { [unowned self] _ in
|
||||||
tab.bridge.parseDocumentForReaderMode { string in
|
|
||||||
DispatchQueue.main.async {
|
|
||||||
documentControls.dismiss(animated: true, completion: nil)
|
documentControls.dismiss(animated: true, completion: nil)
|
||||||
|
showReaderWindow()
|
||||||
let readableViewController = ReaderViewController(readableHTMLString: string, baseURL: self.tab.bridge.webView.url)
|
|
||||||
readableViewController.title = self.tab.bridge.webView.title
|
|
||||||
readableViewController.darkModeEnabled = self.tab.bridge.darkModeEnabled
|
|
||||||
readableViewController.delegate = self
|
|
||||||
|
|
||||||
let navigationController = UINavigationController(rootViewController: readableViewController)
|
|
||||||
self.present(navigationController, animated: true, completion: nil)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, for: .touchUpInside)
|
}, for: .touchUpInside)
|
||||||
|
|
||||||
// Archive
|
// Archive
|
||||||
@@ -304,6 +333,12 @@ class BrowserViewController: UIViewController
|
|||||||
showShareSheetForCurrentURL(fromViewController: documentControls)
|
showShareSheetForCurrentURL(fromViewController: documentControls)
|
||||||
}, for: .touchUpInside)
|
}, for: .touchUpInside)
|
||||||
|
|
||||||
|
// History
|
||||||
|
documentControls.historyView.addAction(UIAction { [unowned self] action in
|
||||||
|
documentControls.dismiss(animated: false, completion: nil)
|
||||||
|
showHistory(action)
|
||||||
|
}, for: .touchUpInside)
|
||||||
|
|
||||||
present(documentControls, animated: true, completion: nil)
|
present(documentControls, animated: true, completion: nil)
|
||||||
}), for: .touchUpInside)
|
}), for: .touchUpInside)
|
||||||
|
|
||||||
@@ -313,8 +348,8 @@ class BrowserViewController: UIViewController
|
|||||||
.sink(receiveValue: { [unowned self] (activeTab: Int) in
|
.sink(receiveValue: { [unowned self] (activeTab: Int) in
|
||||||
if activeTab < tabController.tabs.count {
|
if activeTab < tabController.tabs.count {
|
||||||
let tab = tabController.tabs[activeTab]
|
let tab = tabController.tabs[activeTab]
|
||||||
if self.tab != tab {
|
if currentTab != tab {
|
||||||
self.tab = tab
|
currentTab = tab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,6 +357,11 @@ class BrowserViewController: UIViewController
|
|||||||
self.updateTabBarVisibility()
|
self.updateTabBarVisibility()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
registerForTraitChanges([UITraitHorizontalSizeClass.self]) { [weak self] (traitEnvironment: Self, previousTraitCollection) in
|
||||||
|
guard let self else { return }
|
||||||
|
toolbarController.reconfigureButtons(for: traitCollection.horizontalSizeClass)
|
||||||
|
}
|
||||||
|
|
||||||
self.view = browserView
|
self.view = browserView
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,7 +375,7 @@ class BrowserViewController: UIViewController
|
|||||||
let shareableURL = ShareableURL(
|
let shareableURL = ShareableURL(
|
||||||
url: url,
|
url: url,
|
||||||
title: webView.title ?? url.absoluteString,
|
title: webView.title ?? url.absoluteString,
|
||||||
favicon: tab.favicon
|
favicon: currentTab.favicon
|
||||||
)
|
)
|
||||||
|
|
||||||
let activityController = UIActivityViewController(activityItems: [ shareableURL ], applicationActivities: nil)
|
let activityController = UIActivityViewController(activityItems: [ shareableURL ], applicationActivities: nil)
|
||||||
@@ -408,8 +448,67 @@ class BrowserViewController: UIViewController
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal func showReaderWindow() {
|
||||||
|
currentTab.bridge.parseDocumentForReaderMode { [currentTab] string in
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
if self.traitCollection.userInterfaceIdiom == .phone {
|
||||||
|
let readableViewController = ReaderViewController(readableHTMLString: string, baseURL: currentTab.bridge.webView.url)
|
||||||
|
readableViewController.title = currentTab.bridge.webView.title
|
||||||
|
readableViewController.darkModeEnabled = currentTab.bridge.darkModeEnabled
|
||||||
|
readableViewController.delegate = self
|
||||||
|
|
||||||
|
let navigationController = UINavigationController(rootViewController: readableViewController)
|
||||||
|
self.present(navigationController, animated: true, completion: nil)
|
||||||
|
} else {
|
||||||
|
let userActivity = NSUserActivity(activityType: SessionActivityType.ReaderWindow.rawValue)
|
||||||
|
userActivity.title = currentTab.title
|
||||||
|
userActivity.userInfo = [
|
||||||
|
ReaderUserActivityKeys.baseURL.rawValue : currentTab.bridge.webView.url ?? NSNull(),
|
||||||
|
ReaderUserActivityKeys.htmlString.rawValue : string,
|
||||||
|
]
|
||||||
|
let requestOptions = UIWindowScene.ActivationRequestOptions()
|
||||||
|
requestOptions.preferredPresentationStyle = .prominent
|
||||||
|
UIApplication.shared.requestSceneSessionActivation(nil, userActivity: userActivity, options: requestOptions)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal func showHistoryWindow() {
|
||||||
|
let historyViewController = HistoryBrowserViewController { [unowned self] url in
|
||||||
|
if currentTab.url == nil {
|
||||||
|
currentTab.beginLoadingURL(url)
|
||||||
|
} else {
|
||||||
|
createNewTab(withURL: url)
|
||||||
|
}
|
||||||
|
|
||||||
|
presentedViewController?.dismiss(animated: true)
|
||||||
|
}
|
||||||
|
|
||||||
|
historyViewController.title = "History"
|
||||||
|
historyViewController.navigationItem.rightBarButtonItem = UIBarButtonItem(systemItem: .done, primaryAction: UIAction { _ in
|
||||||
|
// xxx: This is not the SwiftUI-y way to do this.
|
||||||
|
historyViewController.dismiss(animated: true)
|
||||||
|
})
|
||||||
|
|
||||||
|
historyViewController.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "Clear", primaryAction: UIAction { [unowned self] action in
|
||||||
|
let alertController = UIAlertController(title: "Clear History", message: "Are you sure you want to clear all history?", preferredStyle: .actionSheet)
|
||||||
|
alertController.addAction(UIAlertAction(title: "Clear", style: .destructive, handler: { [unowned self] _ in
|
||||||
|
BrowserHistory.shared.clearAllHistory()
|
||||||
|
presentedViewController?.dismiss(animated: true)
|
||||||
|
}))
|
||||||
|
alertController.addAction(UIAlertAction(title: "Cancel", style: .cancel))
|
||||||
|
alertController.popoverPresentationController?.sourceItem = action.presentationSourceItem
|
||||||
|
|
||||||
|
presentedViewController?.present(alertController, animated: true)
|
||||||
|
})
|
||||||
|
|
||||||
|
let navigationController = UINavigationController(rootViewController: historyViewController)
|
||||||
|
present(navigationController, animated: true)
|
||||||
|
}
|
||||||
|
|
||||||
internal func updateLoadProgress(forWebView webView: WKWebView) {
|
internal func updateLoadProgress(forWebView webView: WKWebView) {
|
||||||
if let loadError = tab.loadError {
|
if let loadError = currentTab.loadError {
|
||||||
toolbarController.urlBar.loadProgress = .error(error: loadError)
|
toolbarController.urlBar.loadProgress = .error(error: loadError)
|
||||||
} else if webView.estimatedProgress == 1.0 {
|
} else if webView.estimatedProgress == 1.0 {
|
||||||
toolbarController.urlBar.loadProgress = .complete
|
toolbarController.urlBar.loadProgress = .complete
|
||||||
@@ -421,6 +520,8 @@ class BrowserViewController: UIViewController
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal func updateTitleAndURL(forWebView webView: WKWebView) {
|
internal func updateTitleAndURL(forWebView webView: WKWebView) {
|
||||||
|
guard let tab = tabController.tab(forWebView: webView) else { return }
|
||||||
|
|
||||||
if webView == browserView.webView {
|
if webView == browserView.webView {
|
||||||
browserView.titlebarView.setTitle(webView.title ?? "")
|
browserView.titlebarView.setTitle(webView.title ?? "")
|
||||||
|
|
||||||
@@ -432,8 +533,7 @@ class BrowserViewController: UIViewController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Figure out which tab this corresponds to
|
// Figure out which tab this corresponds to
|
||||||
let tab = tabController.tabs.first { $0.webView == webView }
|
if let tabIndex = tabController.tabs.firstIndex(of: tab) {
|
||||||
if let tab = tab, let tabIndex = tabController.tabs.firstIndex(of: tab) {
|
|
||||||
tabBarViewController.tabBarView.reloadTab(atIndex: tabIndex)
|
tabBarViewController.tabBarView.reloadTab(atIndex: tabIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -443,9 +543,9 @@ class BrowserViewController: UIViewController
|
|||||||
tabController.activeTabIndex = activeIndex
|
tabController.activeTabIndex = activeIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
tab.delegate = self
|
currentTab.delegate = self
|
||||||
|
|
||||||
let webView = tab.webView
|
let webView = currentTab.webView
|
||||||
webView.allowsBackForwardNavigationGestures = true
|
webView.allowsBackForwardNavigationGestures = true
|
||||||
webView.navigationDelegate = self
|
webView.navigationDelegate = self
|
||||||
webView.uiDelegate = self
|
webView.uiDelegate = self
|
||||||
@@ -490,27 +590,64 @@ class BrowserViewController: UIViewController
|
|||||||
updateScriptBlockerButton()
|
updateScriptBlockerButton()
|
||||||
|
|
||||||
// Enforce dark mode setting
|
// Enforce dark mode setting
|
||||||
tab.bridge.darkModeEnabled = toolbarController.darkModeEnabled
|
currentTab.bridge.darkModeEnabled = toolbarController.darkModeEnabled
|
||||||
|
|
||||||
// Blur url bar, if applicable
|
// Blur url bar, if applicable
|
||||||
toolbarController.urlBar.textField.resignFirstResponder()
|
toolbarController.urlBar.textField.resignFirstResponder()
|
||||||
|
|
||||||
|
// If this tab's web content process was jettisoned while in background,
|
||||||
|
// its current page may appear blank and url be nil. Proactively reload
|
||||||
|
// when the tab becomes active again to restore state.
|
||||||
|
if tab.contentProcessTerminated {
|
||||||
|
if webView.url != nil || tab.url != nil {
|
||||||
|
webView.reload()
|
||||||
|
} else if let home = tab.homeURL {
|
||||||
|
tab.beginLoadingURL(home)
|
||||||
|
} else {
|
||||||
|
webView.reload()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override func target(forAction action: Selector, withSender sender: Any?) -> Any? {
|
||||||
|
var findActions: [Selector] = []
|
||||||
|
if #available(macCatalyst 16.0, iOS 16.0, *) {
|
||||||
|
findActions = [
|
||||||
|
#selector(UIResponder.find(_:)),
|
||||||
|
#selector(UIResponder.findNext(_:)),
|
||||||
|
#selector(UIResponder.findPrevious(_:)),
|
||||||
|
#selector(UIResponder.findAndReplace(_:)),
|
||||||
|
#selector(UIResponder.useSelectionForFind(_:)),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
if findActions.contains(where: { $0 == action }) {
|
||||||
|
return webView.target(forAction: action, withSender: sender)
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.target(forAction: action, withSender: sender)
|
||||||
}
|
}
|
||||||
|
|
||||||
override func viewWillAppear(_ animated: Bool) {
|
override func viewWillAppear(_ animated: Bool) {
|
||||||
super.viewWillAppear(animated)
|
super.viewWillAppear(animated)
|
||||||
becomeFirstResponder()
|
becomeFirstResponder()
|
||||||
|
|
||||||
|
// If the app resumed and the current tab's web content process was
|
||||||
|
// terminated while in background, ensure we restore it now.
|
||||||
|
if currentTab.contentProcessTerminated {
|
||||||
|
if webView.url != nil || currentTab.url != nil {
|
||||||
|
webView.reload()
|
||||||
|
} else if let home = currentTab.homeURL {
|
||||||
|
currentTab.beginLoadingURL(home)
|
||||||
|
} else {
|
||||||
|
webView.reload()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
|
||||||
super.traitCollectionDidChange(previousTraitCollection)
|
|
||||||
|
|
||||||
// Not sure why this doesn't happen automatically...
|
|
||||||
toolbarController.traitCollectionDidChange(previousTraitCollection)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal func updateScriptBlockerButton() {
|
internal func updateScriptBlockerButton() {
|
||||||
var numBlockedScripts: Int = tab.blockedScriptOrigins.count
|
var numBlockedScripts: Int = currentTab.blockedScriptOrigins.count
|
||||||
if tab.url != nil, tab.javaScriptEnabled == false {
|
if currentTab.url != nil, currentTab.javaScriptEnabled == false {
|
||||||
// Because the page is blocked too, notify.
|
// Because the page is blocked too, notify.
|
||||||
numBlockedScripts += 1
|
numBlockedScripts += 1
|
||||||
}
|
}
|
||||||
@@ -521,7 +658,7 @@ class BrowserViewController: UIViewController
|
|||||||
}
|
}
|
||||||
|
|
||||||
let iconView = toolbarController.scriptControllerIconView
|
let iconView = toolbarController.scriptControllerIconView
|
||||||
iconView.shieldsDown = tab.javaScriptEnabled
|
iconView.shieldsDown = currentTab.javaScriptEnabled
|
||||||
// iconView.setBlockedScriptsNumber(numBlockedScripts)
|
// iconView.setBlockedScriptsNumber(numBlockedScripts)
|
||||||
|
|
||||||
if let policy = policy {
|
if let policy = policy {
|
||||||
@@ -536,7 +673,7 @@ class BrowserViewController: UIViewController
|
|||||||
let newTab = tabController.createNewTab(url: url)
|
let newTab = tabController.createNewTab(url: url)
|
||||||
|
|
||||||
if !loadInBackground {
|
if !loadInBackground {
|
||||||
self.tab = newTab
|
currentTab = newTab
|
||||||
|
|
||||||
if url == nil && traitCollection.userInterfaceIdiom == .mac {
|
if url == nil && traitCollection.userInterfaceIdiom == .mac {
|
||||||
self.toolbarController.urlBar.textField.becomeFirstResponder()
|
self.toolbarController.urlBar.textField.becomeFirstResponder()
|
||||||
@@ -544,7 +681,7 @@ class BrowserViewController: UIViewController
|
|||||||
} else {
|
} else {
|
||||||
// Send this message to get it to load NOW, instead of waiting for it to show up
|
// Send this message to get it to load NOW, instead of waiting for it to show up
|
||||||
// in the view hierarchy.
|
// in the view hierarchy.
|
||||||
tab.webView.didMoveToWindow()
|
currentTab.webView.didMoveToWindow()
|
||||||
|
|
||||||
// Update tab bar now
|
// Update tab bar now
|
||||||
updateTabBarVisibility()
|
updateTabBarVisibility()
|
||||||
@@ -565,12 +702,12 @@ extension BrowserViewController: UIPopoverPresentationControllerDelegate
|
|||||||
extension BrowserViewController: ScriptPolicyViewControllerDelegate
|
extension BrowserViewController: ScriptPolicyViewControllerDelegate
|
||||||
{
|
{
|
||||||
func didChangeScriptPolicy() {
|
func didChangeScriptPolicy() {
|
||||||
tab.bridge.policyDataSourceDidChange()
|
currentTab.bridge.policyDataSourceDidChange()
|
||||||
webView.reload()
|
webView.reload()
|
||||||
}
|
}
|
||||||
|
|
||||||
func setScriptsEnabledForTab(_ enabled: Bool) {
|
func setScriptsEnabledForTab(_ enabled: Bool) {
|
||||||
tab.javaScriptEnabled = enabled
|
currentTab.javaScriptEnabled = enabled
|
||||||
toolbarController.scriptControllerIconView.shieldsDown = enabled
|
toolbarController.scriptControllerIconView.shieldsDown = enabled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -578,7 +715,7 @@ extension BrowserViewController: ScriptPolicyViewControllerDelegate
|
|||||||
extension BrowserViewController: AutocompleteViewControllerDelegate
|
extension BrowserViewController: AutocompleteViewControllerDelegate
|
||||||
{
|
{
|
||||||
func autocompleteController(_: AutocompleteViewController, didSelectHistoryItem item: HistoryItem) {
|
func autocompleteController(_: AutocompleteViewController, didSelectHistoryItem item: HistoryItem) {
|
||||||
tab.beginLoadingURL(item.url)
|
currentTab.beginLoadingURL(item.url)
|
||||||
autocompleteViewController.view.isHidden = true
|
autocompleteViewController.view.isHidden = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -592,14 +729,37 @@ extension BrowserViewController: TabDelegate
|
|||||||
|
|
||||||
extension BrowserViewController: TabPickerViewControllerDelegate
|
extension BrowserViewController: TabPickerViewControllerDelegate
|
||||||
{
|
{
|
||||||
func tabPicker(_ picker: TabPickerViewController, didSelectTab tab: Tab) {
|
func tabPicker(_ picker: TabPickerViewController, createNewTabWithURL url: URL?) {
|
||||||
self.tab = tab
|
currentTab = tabController.createNewTab(url: url)
|
||||||
|
picker.dismiss(animated: true)
|
||||||
|
}
|
||||||
|
|
||||||
|
func tabPicker(_ picker: TabPickerViewController, tabInfoForIdentifier identifier: UUID) -> TabInfo {
|
||||||
|
guard let tab = tabController.tab(forIdentifier: identifier) else { fatalError() }
|
||||||
|
return tab.tabInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
func tabPicker(_ picker: TabPickerViewController, didSelectTabInfo info: TabInfo, fromHost host: String) {
|
||||||
|
var tab: Tab?
|
||||||
|
if host == TabPickerViewController.localHostIdentifier {
|
||||||
|
tab = tabController.tab(forIdentifier: info.identifier)
|
||||||
|
} else if let urlString = info.urlString {
|
||||||
|
tab = tabController.createNewTab(url: URL(string: urlString))
|
||||||
|
}
|
||||||
|
|
||||||
|
guard let tab else { return }
|
||||||
|
|
||||||
|
currentTab = tab
|
||||||
picker.dismiss(animated: true, completion: nil)
|
picker.dismiss(animated: true, completion: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func tabPicker(_ picker: TabPickerViewController, willCloseTab tab: Tab) {
|
func tabPicker(_ picker: TabPickerViewController, closeTabWithIdentifier tabIdentifier: UUID) {
|
||||||
|
guard let tab = tabController.tab(forIdentifier: tabIdentifier) else { return }
|
||||||
|
|
||||||
|
tabController.closeTab(tab)
|
||||||
|
|
||||||
// Dismiss picker if current tab is closed using the picker
|
// Dismiss picker if current tab is closed using the picker
|
||||||
if tab == self.tab {
|
if tab == currentTab {
|
||||||
picker.dismiss(animated: true, completion: nil)
|
picker.dismiss(animated: true, completion: nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -633,10 +793,10 @@ extension BrowserViewController: UITextFieldDelegate
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tab.beginLoadingURL(url)
|
currentTab.beginLoadingURL(url)
|
||||||
} else {
|
} else {
|
||||||
let searchURL = Settings.shared.searchProvider.provider().searchURLWithQuery(text)
|
let searchURL = Settings.shared.currentSearchProvider().searchURLWithQuery(text)
|
||||||
tab.beginLoadingURL(searchURL)
|
currentTab.beginLoadingURL(searchURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
textField.resignFirstResponder()
|
textField.resignFirstResponder()
|
||||||
@@ -645,10 +805,6 @@ extension BrowserViewController: UITextFieldDelegate
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
override func textFieldShouldEndEditing(_ textField: UITextField) -> Bool {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
|
|
||||||
func textFieldDidEndEditing(_ textField: UITextField) {
|
func textFieldDidEndEditing(_ textField: UITextField) {
|
||||||
if !changingFocusToAutocompleteController {
|
if !changingFocusToAutocompleteController {
|
||||||
autocompleteViewController.view.isHidden = true
|
autocompleteViewController.view.isHidden = true
|
||||||
@@ -659,7 +815,7 @@ extension BrowserViewController: UITextFieldDelegate
|
|||||||
extension BrowserViewController: ReaderViewControllerDelegate
|
extension BrowserViewController: ReaderViewControllerDelegate
|
||||||
{
|
{
|
||||||
func readerViewController(_ reader: ReaderViewController, didRequestNavigationToURL navigationURL: URL) {
|
func readerViewController(_ reader: ReaderViewController, didRequestNavigationToURL navigationURL: URL) {
|
||||||
tab.beginLoadingURL(navigationURL)
|
currentTab.beginLoadingURL(navigationURL)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,11 +28,17 @@ class GradientView: UIImageView
|
|||||||
self.init(image: nil)
|
self.init(image: nil)
|
||||||
self.direction = direction
|
self.direction = direction
|
||||||
self.colors = colors
|
self.colors = colors
|
||||||
|
|
||||||
|
registerForTraitChanges([UITraitUserInterfaceStyle.self]) { [weak self] (traitEnvironment: Self, previousTraitCollection) in
|
||||||
|
self?.image = nil
|
||||||
|
self?.setNeedsLayout()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func gradientImage(forSize size: CGSize) -> UIImage? {
|
private func gradientImage(forSize size: CGSize) -> UIImage? {
|
||||||
var image: UIImage? = nil
|
guard size.width > .leastNonzeroMagnitude && size.height > .leastNonzeroMagnitude else { return nil }
|
||||||
|
|
||||||
|
var image: UIImage? = nil
|
||||||
UIGraphicsBeginImageContext(size)
|
UIGraphicsBeginImageContext(size)
|
||||||
if let context = UIGraphicsGetCurrentContext() {
|
if let context = UIGraphicsGetCurrentContext() {
|
||||||
let gradientColorsArray = self.colors.map { $0.cgColor }
|
let gradientColorsArray = self.colors.map { $0.cgColor }
|
||||||
@@ -69,12 +75,4 @@ class GradientView: UIImageView
|
|||||||
generatedImageSize = bounds.size
|
generatedImageSize = bounds.size
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
|
||||||
super.traitCollectionDidChange(previousTraitCollection)
|
|
||||||
|
|
||||||
// Regenerate image
|
|
||||||
image = nil
|
|
||||||
setNeedsLayout()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ class ReliefButton: UIButton
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
self.imageView?.contentMode = .scaleAspectFit
|
||||||
|
|
||||||
shadowView.alpha = 0.28
|
shadowView.alpha = 0.28
|
||||||
shadowView.backgroundColor = UIColor(white: 0.0, alpha: 1.0)
|
shadowView.backgroundColor = UIColor(white: 0.0, alpha: 1.0)
|
||||||
shadowView.isUserInteractionEnabled = false
|
shadowView.isUserInteractionEnabled = false
|
||||||
@@ -67,12 +69,14 @@ class ReliefButton: UIButton
|
|||||||
backgroundView.layer.rasterizationScale = UIScreen.main.scale
|
backgroundView.layer.rasterizationScale = UIScreen.main.scale
|
||||||
addSubview(backgroundView)
|
addSubview(backgroundView)
|
||||||
|
|
||||||
traitCollectionDidChange(nil)
|
registerForTraitChanges([UITraitUserInterfaceStyle.self], handler: handleTraitCollectionChange)
|
||||||
|
|
||||||
pointerStyleProvider = { (button, pointerEffect, pointerShape) -> UIPointerStyle? in
|
pointerStyleProvider = { (button, pointerEffect, pointerShape) -> UIPointerStyle? in
|
||||||
let preview = UITargetedPreview(view: button)
|
let preview = UITargetedPreview(view: button)
|
||||||
return UIPointerStyle(effect: .lift(preview), shape: pointerShape)
|
return UIPointerStyle(effect: .lift(preview), shape: pointerShape)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleTraitCollectionChange(self, previousCollection: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
required init?(coder: NSCoder) {
|
required init?(coder: NSCoder) {
|
||||||
@@ -97,7 +101,7 @@ class ReliefButton: UIButton
|
|||||||
return inverted ? colors.reversed() : colors
|
return inverted ? colors.reversed() : colors
|
||||||
}
|
}
|
||||||
|
|
||||||
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
private func handleTraitCollectionChange(_ environment: UITraitEnvironment, previousCollection: UITraitCollection?) {
|
||||||
setBackgroundInverted(isHighlighted)
|
setBackgroundInverted(isHighlighted)
|
||||||
backgroundView.layer.borderColor = { traitCollection -> UIColor in
|
backgroundView.layer.borderColor = { traitCollection -> UIColor in
|
||||||
if traitCollection.userInterfaceStyle == .dark {
|
if traitCollection.userInterfaceStyle == .dark {
|
||||||
@@ -132,8 +136,6 @@ class ReliefButton: UIButton
|
|||||||
}
|
}
|
||||||
|
|
||||||
override func layoutSubviews() {
|
override func layoutSubviews() {
|
||||||
self.imageView?.contentMode = .scaleAspectFit
|
|
||||||
|
|
||||||
super.layoutSubviews()
|
super.layoutSubviews()
|
||||||
|
|
||||||
sendSubviewToBack(backgroundView)
|
sendSubviewToBack(backgroundView)
|
||||||
|
|||||||
@@ -103,9 +103,16 @@ class DocumentControlItemView: UIControl
|
|||||||
separatorView.isHidden = !drawsBottomSeparator
|
separatorView.isHidden = !drawsBottomSeparator
|
||||||
}
|
}
|
||||||
|
|
||||||
override func setTracking(_ tracking: Bool) {
|
override func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
|
||||||
super.setTracking(tracking)
|
super.beginTracking(touch, with: event)
|
||||||
highlightView.isHidden = !tracking
|
highlightView.isHidden = false
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override func endTracking(_ touch: UITouch?, with event: UIEvent?) {
|
||||||
|
super.endTracking(touch, with: event)
|
||||||
|
highlightView.isHidden = true
|
||||||
}
|
}
|
||||||
|
|
||||||
public func title(_ title: String) -> Self {
|
public func title(_ title: String) -> Self {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ class DocumentControlViewController: UIViewController
|
|||||||
let archiveView = DocumentControlItemView().title("Archive.today") .symbol("shippingbox")
|
let archiveView = DocumentControlItemView().title("Archive.today") .symbol("shippingbox")
|
||||||
let emailView = DocumentControlItemView().title("Email") .symbol("envelope")
|
let emailView = DocumentControlItemView().title("Email") .symbol("envelope")
|
||||||
let sharingView = DocumentControlItemView().title("Share") .symbol("square.and.arrow.up")
|
let sharingView = DocumentControlItemView().title("Share") .symbol("square.and.arrow.up")
|
||||||
|
let historyView = DocumentControlItemView().title("History") .symbol("clock.arrow.circlepath")
|
||||||
let darkModeView = DocumentControlItemView().title("Dark Mode")
|
let darkModeView = DocumentControlItemView().title("Dark Mode")
|
||||||
|
|
||||||
var observations: [NSKeyValueObservation] = []
|
var observations: [NSKeyValueObservation] = []
|
||||||
@@ -46,6 +47,7 @@ class DocumentControlViewController: UIViewController
|
|||||||
documentControlsView.stackView.addArrangedSubview(darkModeView)
|
documentControlsView.stackView.addArrangedSubview(darkModeView)
|
||||||
documentControlsView.stackView.addArrangedSubview(readabilityView)
|
documentControlsView.stackView.addArrangedSubview(readabilityView)
|
||||||
documentControlsView.stackView.addArrangedSubview(archiveView)
|
documentControlsView.stackView.addArrangedSubview(archiveView)
|
||||||
|
documentControlsView.stackView.addArrangedSubview(historyView)
|
||||||
|
|
||||||
documentControlsView.stackView.addArrangedSubview(settingsView)
|
documentControlsView.stackView.addArrangedSubview(settingsView)
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class FindOnPageViewController: UIViewController, _WKFindDelegate
|
|||||||
|
|
||||||
findOnPageView.textField.addAction(UIAction(handler: { [unowned self] _ in
|
findOnPageView.textField.addAction(UIAction(handler: { [unowned self] _ in
|
||||||
self.findString = findOnPageView.textField.text
|
self.findString = findOnPageView.textField.text
|
||||||
webView?._find(self.findString, options: self.findOptions, maxCount: self.maxCount)
|
webView?._find(self.findString, options: self.findOptions, maxCount: UInt(self.maxCount))
|
||||||
}), for: .editingChanged)
|
}), for: .editingChanged)
|
||||||
|
|
||||||
findOnPageView.prevResultButton.addAction(UIAction(handler: { [unowned self] _ in
|
findOnPageView.prevResultButton.addAction(UIAction(handler: { [unowned self] _ in
|
||||||
@@ -81,25 +81,21 @@ class FindOnPageViewController: UIViewController, _WKFindDelegate
|
|||||||
}
|
}
|
||||||
|
|
||||||
@objc
|
@objc
|
||||||
func findNext(_ sender: Any?) {
|
override func findNext(_ sender: Any?) {
|
||||||
webView?._find(self.findString, options: self.findOptions, maxCount: self.maxCount)
|
webView?._find(self.findString, options: self.findOptions, maxCount: UInt(self.maxCount))
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc
|
@objc
|
||||||
func findPrevious(_ sender: Any?) {
|
override func findPrevious(_ sender: Any?) {
|
||||||
let options: _WKFindOptions = self.findOptions.union(.backwards)
|
let options: _WKFindOptions = self.findOptions.union(.backwards)
|
||||||
webView?._find(self.findString, options: options, maxCount: self.maxCount)
|
webView?._find(self.findString, options: options, maxCount: UInt(self.maxCount))
|
||||||
}
|
}
|
||||||
|
|
||||||
func _webView(_ webView: WKWebView!, didFailToFind string: String!) {
|
func _webView(_ webView: WKWebView!, didFailToFind string: String!) {
|
||||||
// ??
|
// ??
|
||||||
}
|
}
|
||||||
|
|
||||||
func _webView(_ webView: WKWebView!, didCountMatches matches: UInt, for string: String!) {
|
internal func _webView(_ webView: WKWebView!, didFindMatches matches: UInt, for string: String!, withMatch matchIndex: Int) {
|
||||||
// TODO: Update a label
|
|
||||||
}
|
|
||||||
|
|
||||||
func _webView(_ webView: WKWebView!, didFindMatches matches: UInt, for string: String!, withMatch matchIndex: Int) {
|
|
||||||
findOnPageView.nextResultButton.isEnabled = matches > 0
|
findOnPageView.nextResultButton.isEnabled = matches > 0
|
||||||
findOnPageView.prevResultButton.isEnabled = matches > 0
|
findOnPageView.prevResultButton.isEnabled = matches > 0
|
||||||
}
|
}
|
||||||
|
|||||||
12
App/Hacks/Hacks.h
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
//
|
||||||
|
// Hacks.h
|
||||||
|
// App
|
||||||
|
//
|
||||||
|
// Created by James Magahern on 5/5/25.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
extern Class DecodedClass(const char *encodedClassName);
|
||||||
|
extern SEL DecodedSelector(const char *encodedSelectorName);
|
||||||
|
extern void SwizzleClassMethod(Class targetClass, SEL originalSelector, IMP replacementIMP);
|
||||||
31
App/Hacks/Hacks.m
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
//
|
||||||
|
// Hacks.m
|
||||||
|
// App
|
||||||
|
//
|
||||||
|
// Created by James Magahern on 5/5/25.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "Hacks.h"
|
||||||
|
#import <objc/runtime.h>
|
||||||
|
|
||||||
|
Class DecodedClass(const char *encodedClassName) {
|
||||||
|
NSData *data = [NSData dataWithBytesNoCopy:(void *)encodedClassName length:strlen(encodedClassName) freeWhenDone:NO];
|
||||||
|
data = [[NSData alloc] initWithBase64EncodedData:data options:0];
|
||||||
|
|
||||||
|
NSString *str = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
|
||||||
|
return NSClassFromString(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
SEL DecodedSelector(const char *encodedSelectorName) {
|
||||||
|
NSData *data = [NSData dataWithBytesNoCopy:(void *)encodedSelectorName length:strlen(encodedSelectorName) freeWhenDone:NO];
|
||||||
|
data = [[NSData alloc] initWithBase64EncodedData:data options:0];
|
||||||
|
|
||||||
|
NSString *str = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
|
||||||
|
return NSSelectorFromString(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SwizzleClassMethod(Class targetClass, SEL originalSelector, IMP replacementIMP)
|
||||||
|
{
|
||||||
|
Method originalMethod = class_getClassMethod(targetClass, originalSelector);
|
||||||
|
method_setImplementation(originalMethod, replacementIMP);
|
||||||
|
}
|
||||||
@@ -7,27 +7,43 @@
|
|||||||
|
|
||||||
#import <CoreFoundation/CoreFoundation.h>
|
#import <CoreFoundation/CoreFoundation.h>
|
||||||
#import <MessageUI/MessageUI.h>
|
#import <MessageUI/MessageUI.h>
|
||||||
|
#import <WebKit/WKWebView.h>
|
||||||
#import <objc/runtime.h>
|
#import <objc/runtime.h>
|
||||||
|
#import "Hacks.h"
|
||||||
@interface MFMailComposeViewController (InternalMethods)
|
|
||||||
+ (BOOL)canSendMailSourceAccountManagement:(NSInteger)sourceAccountManagement;
|
|
||||||
@end
|
|
||||||
|
|
||||||
static void swizzleClassMethod(Class targetClass, SEL originalSelector, IMP replacementIMP)
|
|
||||||
{
|
|
||||||
Method originalMethod = class_getClassMethod(targetClass, originalSelector);
|
|
||||||
method_setImplementation(originalMethod, replacementIMP);
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__((constructor))
|
__attribute__((constructor))
|
||||||
static void swizzleMFMailComposeViewController()
|
static void swizzleMFMailComposeViewController(void)
|
||||||
{
|
{
|
||||||
// Hacks to work around the fact that MFMailComposeViewController is broken in iOS 14+
|
// Hacks to work around the fact that MFMailComposeViewController is broken in iOS 14+
|
||||||
swizzleClassMethod(MFMailComposeViewController.class, @selector(canSendMail), imp_implementationWithBlock(^BOOL(void) {
|
SwizzleClassMethod(MFMailComposeViewController.class, @selector(canSendMail), imp_implementationWithBlock(^BOOL(void) {
|
||||||
return YES;
|
return YES;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
swizzleClassMethod(MFMailComposeViewController.class, @selector(canSendMailSourceAccountManagement:), imp_implementationWithBlock(^BOOL(NSInteger sam) {
|
SEL canSendMailSourceAccountManagement = DecodedSelector("Y2FuU2VuZE1haWxTb3VyY2VBY2NvdW50TWFuYWdlbWVudDo=");
|
||||||
|
SwizzleClassMethod(MFMailComposeViewController.class, canSendMailSourceAccountManagement, imp_implementationWithBlock(^BOOL(NSInteger sam) {
|
||||||
return YES;
|
return YES;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@interface WKWebView (Hacks)
|
||||||
|
+ (BOOL)orig_handlesURLScheme:(NSString *)scheme;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation WKWebView (Hacks)
|
||||||
|
+ (BOOL)orig_handlesURLScheme:(NSString *)scheme
|
||||||
|
{
|
||||||
|
if ([scheme isEqualToString:@"http"] || [scheme isEqualToString:@"https"]) {
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [self orig_handlesURLScheme:scheme];
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
__attribute__((constructor))
|
||||||
|
static void swizzleWebKitConfiguration(void)
|
||||||
|
{
|
||||||
|
Method origMethod = class_getClassMethod(WKWebView.class, @selector(handlesURLScheme:));
|
||||||
|
Method replMethod = class_getClassMethod(WKWebView.class, @selector(orig_handlesURLScheme:));
|
||||||
|
method_exchangeImplementations(origMethod, replMethod);
|
||||||
|
}
|
||||||
|
|||||||
20
App/History UI/HistoryBrowserViewController.swift
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
//
|
||||||
|
// HistoryBrowserViewController.swift
|
||||||
|
// App
|
||||||
|
//
|
||||||
|
// Created by James Magahern on 1/20/23.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
@MainActor
|
||||||
|
class HistoryBrowserViewController: UIHostingController<HistoryView> {
|
||||||
|
public init(onSelectItem: @escaping (URL) -> Void) {
|
||||||
|
super.init(rootView: HistoryView(viewModel: BrowserHistory.shared.viewModel(limit: 500), onSelectItem: onSelectItem))
|
||||||
|
}
|
||||||
|
|
||||||
|
required dynamic init?(coder aDecoder: NSCoder) {
|
||||||
|
fatalError("init(coder:) has not been implemented")
|
||||||
|
}
|
||||||
|
}
|
||||||
78
App/History UI/HistoryView.swift
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
//
|
||||||
|
// HistoryView.swift
|
||||||
|
// App
|
||||||
|
//
|
||||||
|
// Created by James Magahern on 1/20/23.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
import UniformTypeIdentifiers
|
||||||
|
|
||||||
|
struct HistoryView: View {
|
||||||
|
@StateObject public var viewModel: BrowserHistory.ViewModel
|
||||||
|
@State public var selectedItems = Set<HistoryItem.ID>()
|
||||||
|
public var onSelectItem: (URL) -> Void
|
||||||
|
|
||||||
|
private let dateFormatter = DateFormatter() .. {
|
||||||
|
$0.locale = Locale.current
|
||||||
|
$0.dateStyle = .medium
|
||||||
|
$0.timeStyle = .short
|
||||||
|
}
|
||||||
|
|
||||||
|
@Environment(\.dismiss) private var dismissAction
|
||||||
|
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
Table(viewModel.historyItems, selection: $selectedItems) {
|
||||||
|
TableColumn("Title") { item in
|
||||||
|
VStack(alignment: .leading) {
|
||||||
|
Text(item.title.count > 0 ? item.title : item.url.absoluteString)
|
||||||
|
.lineLimit(1)
|
||||||
|
|
||||||
|
if horizontalSizeClass == .compact {
|
||||||
|
Text(item.url.shortString()).font(.caption).lineLimit(1)
|
||||||
|
Text(dateFormatter.string(from: item.lastVisited))
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TableColumn("URL", value: \.url.absoluteString)
|
||||||
|
TableColumn("Last Visited") { item in
|
||||||
|
Text(dateFormatter.string(from: item.lastVisited))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.contextMenu(forSelectionType: HistoryItem.ID.self, menu: { items in
|
||||||
|
let historyItems = items.compactMap { viewModel.item(forIdentifier: $0) }
|
||||||
|
Button("Copy") {
|
||||||
|
UIPasteboard.general.setItems(historyItems.map { [
|
||||||
|
UTType.url.identifier : $0.url,
|
||||||
|
UTType.utf8PlainText.identifier : $0.url.absoluteString,
|
||||||
|
] })
|
||||||
|
}
|
||||||
|
|
||||||
|
Button("Delete") {
|
||||||
|
viewModel.deleteItems(items)
|
||||||
|
}
|
||||||
|
}, primaryAction: { items in
|
||||||
|
items.compactMap({ viewModel.item(forIdentifier: $0) }).forEach { item in
|
||||||
|
onSelectItem(item.url)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.searchable(text: $viewModel.searchQuery)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct HistoryViewPreviewProvider: PreviewProvider {
|
||||||
|
static var previews: some View {
|
||||||
|
HistoryView(viewModel: BrowserHistory.shared.viewModel(), onSelectItem: { _ in })
|
||||||
|
.previewLayout(.fixed(width: 480.0, height: 800.0))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension URL {
|
||||||
|
public func shortString() -> String {
|
||||||
|
return String(absoluteString.trimmingPrefix(try! Regex("(.+)://")))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -39,9 +39,254 @@ protocol ShortcutResponder: AnyObject {
|
|||||||
@objc
|
@objc
|
||||||
optional func refresh(_ sender: Any?)
|
optional func refresh(_ sender: Any?)
|
||||||
|
|
||||||
|
@objc
|
||||||
|
optional func stop(_ sender: Any?)
|
||||||
|
|
||||||
@objc
|
@objc
|
||||||
optional func showPreferences(_ sender: Any?)
|
optional func showPreferences(_ sender: Any?)
|
||||||
|
|
||||||
@objc
|
@objc
|
||||||
optional func toggleDarkMode(_ sender: Any?)
|
optional func toggleDarkMode(_ sender: Any?)
|
||||||
|
|
||||||
|
@objc
|
||||||
|
optional func openInReaderMode(_ sender: Any?)
|
||||||
|
|
||||||
|
@objc
|
||||||
|
optional func showHistory(_ sender: Any?)
|
||||||
|
|
||||||
|
@objc
|
||||||
|
optional func handleOpenURL(_ sender: Any?, forEvent event: OpenURLEvent?)
|
||||||
|
|
||||||
|
@objc
|
||||||
|
optional func lowerScriptPolicyRestriction(_ sender: Any?)
|
||||||
|
|
||||||
|
@objc
|
||||||
|
optional func raiseScriptPolicyRestriction(_ sender: Any?)
|
||||||
|
|
||||||
|
@objc
|
||||||
|
optional func zoomToActualSize(_ sender: Any?)
|
||||||
|
}
|
||||||
|
|
||||||
|
public class OpenURLEvent: UIEvent {
|
||||||
|
let url: URL
|
||||||
|
public init(url: URL) {
|
||||||
|
self.url = url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fileprivate extension Array {
|
||||||
|
func removeNulls() -> Array {
|
||||||
|
self.filter { element in
|
||||||
|
guard let keyCommand = element as? UIKeyCommand else { return true }
|
||||||
|
return !keyCommand.isNull()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class KeyboardShortcuts {
|
||||||
|
public enum Category: CaseIterable {
|
||||||
|
case application
|
||||||
|
case file
|
||||||
|
case go
|
||||||
|
case view
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func menu(for category: Category) -> [UIMenuElement] {
|
||||||
|
switch category {
|
||||||
|
case .application:
|
||||||
|
return [
|
||||||
|
// Preferences
|
||||||
|
UIKeyCommand(
|
||||||
|
modifiers: .command,
|
||||||
|
input: ",",
|
||||||
|
title: "Preferences",
|
||||||
|
action: #selector(ShortcutResponder.showPreferences)
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
|
case .file:
|
||||||
|
return [
|
||||||
|
// Open Location...
|
||||||
|
UIKeyCommand(
|
||||||
|
modifiers: .command, input: "L",
|
||||||
|
title: "Open Location",
|
||||||
|
action: #selector(ShortcutResponder.focusURLBar)
|
||||||
|
),
|
||||||
|
|
||||||
|
// Open in Reader
|
||||||
|
UIKeyCommand(
|
||||||
|
modifiers: [ .command, .shift ], input: "R",
|
||||||
|
title: "Open in Reader Mode…",
|
||||||
|
action: #selector(ShortcutResponder.openInReaderMode)
|
||||||
|
),
|
||||||
|
|
||||||
|
// Tabs
|
||||||
|
UIMenu(options: .displayInline, children: [
|
||||||
|
// Create Tab
|
||||||
|
UIKeyCommand(
|
||||||
|
modifiers: .command, input: "T",
|
||||||
|
title: "New Tab",
|
||||||
|
action: #selector(ShortcutResponder.createTab)
|
||||||
|
),
|
||||||
|
|
||||||
|
// Close tab
|
||||||
|
UIKeyCommand(
|
||||||
|
modifiers: [.command], input: "W",
|
||||||
|
title: "Close Tab",
|
||||||
|
action: #selector(ShortcutResponder.closeTab)
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
|
||||||
|
// Find on page
|
||||||
|
(FindOnPageViewController.isEnabled() ?
|
||||||
|
UIKeyCommand(
|
||||||
|
modifiers: [.command], input: "F",
|
||||||
|
title: "Find on Page",
|
||||||
|
action: #selector(ShortcutResponder.findOnPage)
|
||||||
|
)
|
||||||
|
: UIKeyCommand.null()
|
||||||
|
),
|
||||||
|
|
||||||
|
UIMenu(options: .displayInline, children: [
|
||||||
|
// Refresh
|
||||||
|
UIKeyCommand(
|
||||||
|
modifiers: [.command], input: "R",
|
||||||
|
title: "Refresh",
|
||||||
|
action: #selector(ShortcutResponder.refresh)
|
||||||
|
),
|
||||||
|
|
||||||
|
// Stop
|
||||||
|
UIKeyCommand(
|
||||||
|
modifiers: [.command], input: ".",
|
||||||
|
title: "Stop",
|
||||||
|
action: #selector(ShortcutResponder.stop)
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
|
||||||
|
UIMenu(options: .displayInline, children: [
|
||||||
|
// Raise Script Policy Restriction
|
||||||
|
UIKeyCommand(
|
||||||
|
modifiers: [.alternate], input: "x",
|
||||||
|
title: "Raise Script Policy Restriction",
|
||||||
|
action: #selector(ShortcutResponder.raiseScriptPolicyRestriction)
|
||||||
|
),
|
||||||
|
|
||||||
|
// Lower Script Policy Restriction
|
||||||
|
UIKeyCommand(
|
||||||
|
modifiers: [.alternate], input: "c",
|
||||||
|
title: "Lower Script Policy Restriction",
|
||||||
|
action: #selector(ShortcutResponder.lowerScriptPolicyRestriction)
|
||||||
|
),
|
||||||
|
])
|
||||||
|
].removeNulls()
|
||||||
|
|
||||||
|
case .go:
|
||||||
|
return [
|
||||||
|
// Focus Web View
|
||||||
|
UIKeyCommand(
|
||||||
|
modifiers: [ .command, .shift ], input: "w",
|
||||||
|
title: "Focus Web View",
|
||||||
|
action: #selector(ShortcutResponder.focusWebView)
|
||||||
|
),
|
||||||
|
|
||||||
|
// Back/Forward
|
||||||
|
UIMenu(options: .displayInline, children: [
|
||||||
|
// Go Back
|
||||||
|
UIKeyCommand(
|
||||||
|
modifiers: .command, input: "[",
|
||||||
|
title: "Go Back",
|
||||||
|
action: #selector(ShortcutResponder.goBack)
|
||||||
|
),
|
||||||
|
|
||||||
|
// Go Forward
|
||||||
|
UIKeyCommand(
|
||||||
|
modifiers: .command, input: "]",
|
||||||
|
title: "Go Forward",
|
||||||
|
action: #selector(ShortcutResponder.goForward)
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
|
||||||
|
// Tab Navigation
|
||||||
|
UIMenu(options: .displayInline, children: [
|
||||||
|
// Previous Tab
|
||||||
|
UIKeyCommand(
|
||||||
|
modifiers: [.command, .shift], input: "[",
|
||||||
|
title: "Previous Tab",
|
||||||
|
action: #selector(ShortcutResponder.previousTab)
|
||||||
|
),
|
||||||
|
|
||||||
|
// Next Tab
|
||||||
|
UIKeyCommand(
|
||||||
|
modifiers: [.command, .shift], input: "]",
|
||||||
|
title: "Next Tab",
|
||||||
|
action: #selector(ShortcutResponder.nextTab)
|
||||||
|
),
|
||||||
|
])
|
||||||
|
]
|
||||||
|
|
||||||
|
case .view:
|
||||||
|
return [
|
||||||
|
// Zoom
|
||||||
|
UIMenu(options: .displayInline, children: [
|
||||||
|
// Actual Size
|
||||||
|
UIKeyCommand(
|
||||||
|
modifiers: .command, input: "0",
|
||||||
|
title: "Actual Size",
|
||||||
|
action: #selector(ShortcutResponder.zoomToActualSize)
|
||||||
|
),
|
||||||
|
|
||||||
|
// Increase Zoom
|
||||||
|
UIKeyCommand(
|
||||||
|
modifiers: .command, input: "=",
|
||||||
|
title: "Zoom In",
|
||||||
|
action: #selector(UIResponder.increaseSize)
|
||||||
|
),
|
||||||
|
|
||||||
|
// Go Forward
|
||||||
|
UIKeyCommand(
|
||||||
|
modifiers: .command, input: "-",
|
||||||
|
title: "Zoom Out",
|
||||||
|
action: #selector(UIResponder.decreaseSize)
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
|
||||||
|
// Toggle Dark Mode
|
||||||
|
UIKeyCommand(
|
||||||
|
modifiers: [.command], input: "M",
|
||||||
|
title: "Toggle Dark Mode",
|
||||||
|
action: #selector(ShortcutResponder.toggleDarkMode)
|
||||||
|
),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func hiddenKeyCommands() -> [UIKeyCommand] {
|
||||||
|
return [
|
||||||
|
// Go Back
|
||||||
|
UIKeyCommand(input: UIKeyCommand.inputLeftArrow,
|
||||||
|
modifierFlags: [.command, .control],
|
||||||
|
action: #selector(ShortcutResponder.goBack)),
|
||||||
|
|
||||||
|
// Go Forward
|
||||||
|
UIKeyCommand(input: UIKeyCommand.inputRightArrow,
|
||||||
|
modifierFlags: [.command, .control],
|
||||||
|
action: #selector(ShortcutResponder.goForward)),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func allKeyCommands() -> [UIKeyCommand] {
|
||||||
|
var commands: [UIKeyCommand] = []
|
||||||
|
for category in Category.allCases {
|
||||||
|
let menuElements = menu(for: category)
|
||||||
|
for element in menuElements {
|
||||||
|
if let command = element as? UIKeyCommand {
|
||||||
|
commands.append(command)
|
||||||
|
} else if let menu = element as? UIMenu {
|
||||||
|
commands.append(contentsOf: menu.children as! [UIKeyCommand])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return commands + Self.hiddenKeyCommands()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,13 +49,32 @@ class ReaderViewController: UIViewController
|
|||||||
navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(self.didTapDoneButton))
|
navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(self.didTapDoneButton))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func viewDidAppear(_ animated: Bool) {
|
||||||
|
bridge.webView.becomeFirstResponder()
|
||||||
|
}
|
||||||
|
|
||||||
private func updateDarkModeButton() {
|
private func updateDarkModeButton() {
|
||||||
darkModeButton.image = DarkModeControls.buttonImage(forDarkModeState: darkModeEnabled)
|
darkModeButton.image = DarkModeControls.buttonImage(forDarkModeState: darkModeEnabled)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func close() {
|
||||||
|
if traitCollection.userInterfaceIdiom == .phone {
|
||||||
|
dismiss(animated: true, completion: nil)
|
||||||
|
} else {
|
||||||
|
if let sceneSession = view.window?.windowScene?.session {
|
||||||
|
UIApplication.shared.requestSceneSessionDestruction(sceneSession, options: nil, errorHandler: nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@objc
|
@objc
|
||||||
private func didTapDoneButton(_ sender: Any?) {
|
private func didTapDoneButton(_ sender: Any?) {
|
||||||
dismiss(animated: true, completion: nil)
|
close()
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc
|
||||||
|
private func closeTab(_ sender: Any?) {
|
||||||
|
close()
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc
|
@objc
|
||||||
|
|||||||
12
App/Resources/Credits.rtf
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{\rtf1\ansi\ansicpg1252\cocoartf2697
|
||||||
|
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
|
||||||
|
{\colortbl;\red255\green255\blue255;}
|
||||||
|
{\*\expandedcolortbl;;}
|
||||||
|
\margl1440\margr1440\vieww9000\viewh8400\viewkind0
|
||||||
|
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\qc\partightenfactor0
|
||||||
|
|
||||||
|
\f0\fs24 \cf0 Copyright \'a9 2020-2022 James Magahern {\field{\*\fldinst{HYPERLINK "mailto:james@magahern.com"}}{\fldrslt james@magahern.com}}\
|
||||||
|
\
|
||||||
|
Licensed under the GNU General Public License v3.0.\
|
||||||
|
\
|
||||||
|
{\field{\*\fldinst{HYPERLINK "https://git.sr.ht/~buzzert/rossler-attix"}}{\fldrslt https://git.sr.ht/~buzzert/rossler-attix}}}
|
||||||
@@ -162,31 +162,55 @@ class Scroller
|
|||||||
constructor() {
|
constructor() {
|
||||||
this.modelPositionY = 0;
|
this.modelPositionY = 0;
|
||||||
this.modelPositionX = 0;
|
this.modelPositionX = 0;
|
||||||
|
|
||||||
|
this.modelPositionXVel = 0;
|
||||||
|
this.modelPositionYVel = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
scrollBy(xOffset, yOffset) {
|
clampHorizontal(xOffset) {
|
||||||
var initialPositionY = this.modelPositionY;
|
return Math.max(
|
||||||
var initialPositionX = this.modelPositionX;
|
0, Math.min(
|
||||||
|
xOffset, document.documentElement.scrollWidth - window.visualViewport.width
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
clampVertical(yOffset) {
|
||||||
|
return Math.max(
|
||||||
|
0, Math.min(
|
||||||
|
yOffset, document.documentElement.scrollHeight - window.visualViewport.height
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
initializeModelPosition() {
|
||||||
if (this.timerIdentifier == undefined) {
|
if (this.timerIdentifier == undefined) {
|
||||||
this.startTimer();
|
this.startTimer();
|
||||||
|
|
||||||
initialPositionY = window.scrollY;
|
this.modelPositionY = window.scrollY;
|
||||||
initialPositionX = window.scrollX;
|
this.modelPositionX = window.scrollX;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.modelPositionY = initialPositionY + yOffset;
|
scrollBy(xOffset, yOffset) {
|
||||||
this.modelPositionY = Math.max(
|
this.initializeModelPosition();
|
||||||
0, Math.min(
|
|
||||||
this.modelPositionY, document.documentElement.scrollHeight - window.visualViewport.height
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
this.modelPositionX = initialPositionX + xOffset;
|
this.modelPositionY += yOffset;
|
||||||
this.modelPositionX = Math.max(
|
this.modelPositionY = this.clampVertical(this.modelPositionY);
|
||||||
0, Math.min(
|
|
||||||
this.modelPositionX, document.documentElement.scrollWidth - window.visualViewport.width
|
this.modelPositionX += xOffset;
|
||||||
)
|
this.modelPositionX = this.clampHorizontal(this.modelPositionX);
|
||||||
);
|
}
|
||||||
|
|
||||||
|
setScrollVelocity(xVelocity, yVelocity) {
|
||||||
|
this.initializeModelPosition();
|
||||||
|
|
||||||
|
this.modelPositionXVel = xVelocity;
|
||||||
|
this.modelPositionYVel = yVelocity;
|
||||||
|
|
||||||
|
if (this.timerIdentifier == undefined) {
|
||||||
|
this.startTimer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
startTimer() {
|
startTimer() {
|
||||||
@@ -199,17 +223,29 @@ class Scroller
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateTimer(self) {
|
updateTimer(self) {
|
||||||
|
self.modelPositionX = self.clampHorizontal(self.modelPositionX + self.modelPositionXVel);
|
||||||
|
self.modelPositionY = self.clampVertical(self.modelPositionY + self.modelPositionYVel);
|
||||||
|
|
||||||
const accelerationFactor = 0.05;
|
const accelerationFactor = 0.05;
|
||||||
let positionOffsetY = (self.modelPositionY - window.scrollY) * accelerationFactor;
|
let positionOffsetY = (self.modelPositionY - window.scrollY) * accelerationFactor;
|
||||||
let positionOffsetX = (self.modelPositionX - window.scrollX) * accelerationFactor;
|
let positionOffsetX = (self.modelPositionX - window.scrollX) * accelerationFactor;
|
||||||
window.scrollBy(positionOffsetX, positionOffsetY);
|
window.scrollBy(positionOffsetX, positionOffsetY);
|
||||||
|
|
||||||
if (Math.abs(positionOffsetX) <= 1.0 && Math.abs(positionOffsetY) <= 1.0) {
|
var atRest = Math.abs(positionOffsetX) <= 1.0 && Math.abs(positionOffsetY) <= 1.0;
|
||||||
|
var noVelocity = self.modelPositionXVel == 0 && self.modelPositionYVel == 0;
|
||||||
|
if (atRest && noVelocity) {
|
||||||
self.stopTimer();
|
self.stopTimer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ScrollDirection = {
|
||||||
|
Up: 'k',
|
||||||
|
Down: 'j',
|
||||||
|
Left: 'h',
|
||||||
|
Right: 'l',
|
||||||
|
};
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
let tagger = new ElementTagger();
|
let tagger = new ElementTagger();
|
||||||
let scroller = new Scroller();
|
let scroller = new Scroller();
|
||||||
@@ -240,20 +276,25 @@ class Scroller
|
|||||||
tagger.clickLinkWithTag(keyName);
|
tagger.clickLinkWithTag(keyName);
|
||||||
tagger.untagDocument();
|
tagger.untagDocument();
|
||||||
}
|
}
|
||||||
} else {
|
} else if (event.shiftKey) {
|
||||||
// Otherwise, interpret as a single character command
|
// Otherwise, interpret as a single character command
|
||||||
|
|
||||||
let lowerKey = keyName.toLowerCase();
|
let lowerKey = keyName.toLowerCase();
|
||||||
let scrollAmount = event.shiftKey ? window.visualViewport.height : 30;
|
let scrollAmount = event.shiftKey ? window.visualViewport.height : 30;
|
||||||
|
|
||||||
if (lowerKey == 'j') {
|
switch (lowerKey) {
|
||||||
|
case ScrollDirection.Down:
|
||||||
scroller.scrollBy(0, scrollAmount);
|
scroller.scrollBy(0, scrollAmount);
|
||||||
} else if (lowerKey == 'k') {
|
break;
|
||||||
|
case ScrollDirection.Up:
|
||||||
scroller.scrollBy(0, -scrollAmount);
|
scroller.scrollBy(0, -scrollAmount);
|
||||||
} else if (lowerKey == 'h') {
|
break;
|
||||||
|
case ScrollDirection.Left:
|
||||||
scroller.scrollBy(-scrollAmount, 0);
|
scroller.scrollBy(-scrollAmount, 0);
|
||||||
} else if (lowerKey == 'l') {
|
break;
|
||||||
|
case ScrollDirection.Right:
|
||||||
scroller.scrollBy(scrollAmount, 0);
|
scroller.scrollBy(scrollAmount, 0);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -268,6 +309,24 @@ class Scroller
|
|||||||
tagger.tagDocument();
|
tagger.tagDocument();
|
||||||
}
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
} else {
|
||||||
|
let lowerKey = event.key.toLowerCase();
|
||||||
|
let velocity = 5;
|
||||||
|
|
||||||
|
switch (lowerKey) {
|
||||||
|
case ScrollDirection.Down:
|
||||||
|
scroller.setScrollVelocity(0, velocity);
|
||||||
|
break;
|
||||||
|
case ScrollDirection.Up:
|
||||||
|
scroller.setScrollVelocity(0, -velocity);
|
||||||
|
break;
|
||||||
|
case ScrollDirection.Left:
|
||||||
|
scroller.setScrollVelocity(-velocity, 0);
|
||||||
|
break;
|
||||||
|
case ScrollDirection.Right:
|
||||||
|
scroller.setScrollVelocity(velocity, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -279,8 +338,15 @@ class Scroller
|
|||||||
if (event.key == " " && tagger.isTagged) {
|
if (event.key == " " && tagger.isTagged) {
|
||||||
tagger.untagDocument();
|
tagger.untagDocument();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
} else if (event.key == "Backspace") {
|
||||||
|
if (!event.shiftKey) {
|
||||||
|
window.history.back();
|
||||||
|
} else {
|
||||||
|
window.history.forward();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
scroller.setScrollVelocity(0, 0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ html, iframe {
|
|||||||
-webkit-filter: invert(100%) !important;
|
-webkit-filter: invert(100%) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
em,
|
|
||||||
img,
|
img,
|
||||||
svg,
|
svg,
|
||||||
form,
|
form,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// SceneDelegate.swift
|
// BrowserSceneDelegate.swift
|
||||||
// SBrowser
|
// SBrowser
|
||||||
//
|
//
|
||||||
// Created by James Magahern on 7/21/20.
|
// Created by James Magahern on 7/21/20.
|
||||||
@@ -10,9 +10,10 @@ import UIKit
|
|||||||
public enum SessionActivityType: String {
|
public enum SessionActivityType: String {
|
||||||
case BrowserWindow = "net.buzzert.attractor.browser"
|
case BrowserWindow = "net.buzzert.attractor.browser"
|
||||||
case SettingsWindow = "net.buzzert.attractor.settings"
|
case SettingsWindow = "net.buzzert.attractor.settings"
|
||||||
|
case ReaderWindow = "net.buzzert.attractor.reader"
|
||||||
}
|
}
|
||||||
|
|
||||||
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
class BrowserSceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||||
var window: UIWindow?
|
var window: UIWindow?
|
||||||
|
|
||||||
var browserViewController: BrowserViewController?
|
var browserViewController: BrowserViewController?
|
||||||
@@ -29,12 +30,26 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|||||||
|
|
||||||
if let urlContext = connectionOptions.urlContexts.first {
|
if let urlContext = connectionOptions.urlContexts.first {
|
||||||
let url = urlContext.url
|
let url = urlContext.url
|
||||||
browserViewController.tab.beginLoadingURL(url)
|
browserViewController.currentTab.beginLoadingURL(url)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if targetEnvironment(macCatalyst)
|
#if targetEnvironment(macCatalyst)
|
||||||
windowScene.titlebar?.titleVisibility = .hidden
|
windowScene.titlebar?.titleVisibility = .hidden
|
||||||
windowScene.titlebar?.separatorStyle = .none
|
windowScene.titlebar?.separatorStyle = .none
|
||||||
|
|
||||||
|
if #available(macCatalyst 16.0, *) {
|
||||||
|
let screenSize = windowScene.screen.bounds.size
|
||||||
|
let preferredSize = CGSize(width: 1000, height: 1100)
|
||||||
|
let geometryPreferences = UIWindowScene.GeometryPreferences.Mac(systemFrame: CGRect(
|
||||||
|
origin: CGPoint(
|
||||||
|
x: (screenSize.width - preferredSize.width) / 2,
|
||||||
|
y: (screenSize.height - preferredSize.height) / 2
|
||||||
|
),
|
||||||
|
|
||||||
|
size: preferredSize
|
||||||
|
))
|
||||||
|
windowScene.requestGeometryUpdate(geometryPreferences)
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
window.makeKeyAndVisible()
|
window.makeKeyAndVisible()
|
||||||
@@ -44,8 +59,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|||||||
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>)
|
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>)
|
||||||
{
|
{
|
||||||
for urlContext in URLContexts {
|
for urlContext in URLContexts {
|
||||||
if browserViewController?.tab.url == nil {
|
if browserViewController?.currentTab.url == nil {
|
||||||
browserViewController?.tab.beginLoadingURL(urlContext.url)
|
browserViewController?.currentTab.beginLoadingURL(urlContext.url)
|
||||||
} else {
|
} else {
|
||||||
browserViewController?.createNewTab(withURL: urlContext.url)
|
browserViewController?.createNewTab(withURL: urlContext.url)
|
||||||
}
|
}
|
||||||
41
App/Scene Delegates/ReaderSceneDelegate.swift
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
//
|
||||||
|
// ReaderSceneDelegate.swift
|
||||||
|
// App
|
||||||
|
//
|
||||||
|
// Created by James Magahern on 8/22/22.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
internal enum ReaderUserActivityKeys: String {
|
||||||
|
case htmlString
|
||||||
|
case baseURL
|
||||||
|
}
|
||||||
|
|
||||||
|
class ReaderSceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||||
|
var window: UIWindow?
|
||||||
|
var readerViewController: ReaderViewController?
|
||||||
|
|
||||||
|
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions)
|
||||||
|
{
|
||||||
|
guard let windowScene = (scene as? UIWindowScene) else { return }
|
||||||
|
guard let activity = connectionOptions.userActivities.first else { return }
|
||||||
|
|
||||||
|
guard let userInfo = activity.userInfo, let htmlString: String = userInfo[ReaderUserActivityKeys.htmlString.rawValue] as? String else { return }
|
||||||
|
let baseURL = userInfo[ReaderUserActivityKeys.baseURL.rawValue] as? URL
|
||||||
|
|
||||||
|
let window = UIWindow(windowScene: windowScene)
|
||||||
|
|
||||||
|
let readerViewController = ReaderViewController(readableHTMLString: htmlString, baseURL: baseURL)
|
||||||
|
readerViewController.title = activity.title
|
||||||
|
|
||||||
|
self.readerViewController = readerViewController
|
||||||
|
window.rootViewController = UINavigationController(rootViewController: readerViewController)
|
||||||
|
|
||||||
|
windowScene.title = activity.title ?? "Reader"
|
||||||
|
windowScene.sizeRestrictions?.maximumSize = CGSize(width: 700.0, height: 1000.0)
|
||||||
|
|
||||||
|
window.makeKeyAndVisible()
|
||||||
|
self.window = window
|
||||||
|
}
|
||||||
|
}
|
||||||
74
App/Settings/AddSearchEngineViewController.swift
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
//
|
||||||
|
// AddSearchEngineViewController.swift
|
||||||
|
// App
|
||||||
|
//
|
||||||
|
// Created by James Magahern on 9/29/25.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
@MainActor
|
||||||
|
struct AddSearchEngineView: View
|
||||||
|
{
|
||||||
|
@State var model: ViewModel
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
Form {
|
||||||
|
Section {
|
||||||
|
HStack {
|
||||||
|
Text("Name")
|
||||||
|
TextField("Name", text: $model.name)
|
||||||
|
.multilineTextAlignment(.trailing)
|
||||||
|
.autocorrectionDisabled()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Section {
|
||||||
|
HStack {
|
||||||
|
Text("URL")
|
||||||
|
TextField("https://example.com/query=%q", text: $model.url)
|
||||||
|
.multilineTextAlignment(.trailing)
|
||||||
|
.autocorrectionDisabled()
|
||||||
|
.textContentType(.none)
|
||||||
|
}
|
||||||
|
} footer: {
|
||||||
|
Text("URL must contain %q, which will be replaced by the query. ")
|
||||||
|
}
|
||||||
|
|
||||||
|
Section {
|
||||||
|
Toggle("Set as default", isOn: $model.makeDefault)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.navigationTitle("Add Search Engine")
|
||||||
|
}
|
||||||
|
|
||||||
|
@MainActor
|
||||||
|
@Observable
|
||||||
|
class ViewModel
|
||||||
|
{
|
||||||
|
var name: String = ""
|
||||||
|
var url: String = ""
|
||||||
|
var makeDefault: Bool = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@MainActor
|
||||||
|
class AddSearchEngineViewController: UIHostingController<AddSearchEngineView>
|
||||||
|
{
|
||||||
|
public var viewModel: AddSearchEngineView.ViewModel
|
||||||
|
|
||||||
|
init() {
|
||||||
|
self.viewModel = AddSearchEngineView.ViewModel()
|
||||||
|
super.init(rootView: AddSearchEngineView(model: viewModel))
|
||||||
|
}
|
||||||
|
|
||||||
|
@MainActor @preconcurrency required dynamic init?(coder aDecoder: NSCoder) {
|
||||||
|
fatalError("init(coder:) has not been implemented")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview {
|
||||||
|
@Previewable @State var model = AddSearchEngineView.ViewModel()
|
||||||
|
AddSearchEngineView(model: model)
|
||||||
|
}
|
||||||
@@ -23,8 +23,8 @@ struct AmberSettingsView: View {
|
|||||||
@Environment(\.presentationMode)
|
@Environment(\.presentationMode)
|
||||||
@Binding private var presentationMode
|
@Binding private var presentationMode
|
||||||
|
|
||||||
@State private var searchProvider = Settings.shared.searchProvider {
|
@State private var defaultSearchEngineName = Settings.shared.defaultSearchEngineName {
|
||||||
didSet { Settings.shared.searchProvider = searchProvider }
|
didSet { Settings.shared.defaultSearchEngineName = defaultSearchEngineName }
|
||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
@@ -35,12 +35,12 @@ struct AmberSettingsView: View {
|
|||||||
})
|
})
|
||||||
|
|
||||||
Section(header: Text("Search Provider"), content: {
|
Section(header: Text("Search Provider"), content: {
|
||||||
ForEach(Settings.SearchProviderSetting.allCases, id: \.self, content: { setting in
|
ForEach(Array(Settings.shared.searchEngines.keys).sorted(), id: \.self, content: { name in
|
||||||
Button(action: { searchProvider = setting }, label: {
|
Button(action: { defaultSearchEngineName = name }, label: {
|
||||||
HStack {
|
HStack {
|
||||||
Text(setting.rawValue)
|
Text(name)
|
||||||
Spacer()
|
Spacer()
|
||||||
if searchProvider == setting {
|
if defaultSearchEngineName == name {
|
||||||
Image(systemName: "checkmark")
|
Image(systemName: "checkmark")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,57 @@ struct LabelContentConfiguration : UIContentConfiguration
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct TextFieldContentConfiguration : UIContentConfiguration
|
||||||
|
{
|
||||||
|
var text: String = ""
|
||||||
|
var placeholderText: String? = nil
|
||||||
|
var textChanged: ((String) -> Void)? = nil
|
||||||
|
var pressedReturn: ((UITextField) -> Void)? = nil
|
||||||
|
var keyboardType: UIKeyboardType = .default
|
||||||
|
var returnKeyType: UIReturnKeyType = .default
|
||||||
|
|
||||||
|
func makeContentView() -> UIView & UIContentView {
|
||||||
|
let textField = UITextField(frame: .zero)
|
||||||
|
textField.borderStyle = .roundedRect
|
||||||
|
textField.autocorrectionType = .no
|
||||||
|
textField.autocapitalizationType = .none
|
||||||
|
textField.keyboardType = keyboardType
|
||||||
|
textField.returnKeyType = returnKeyType
|
||||||
|
|
||||||
|
return GenericContentView<UITextField, TextFieldContentConfiguration>(configuration: self, view: textField) { config, textField in
|
||||||
|
textField.text = config.text
|
||||||
|
textField.placeholder = config.placeholderText
|
||||||
|
|
||||||
|
if let textChanged = config.textChanged {
|
||||||
|
textField.addAction(UIAction { _ in textChanged(textField.text ?? "") }, for: .editingChanged)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let pressedReturn = config.pressedReturn {
|
||||||
|
class ReturnDelegate : NSObject, UITextFieldDelegate {
|
||||||
|
var pressedReturn: ((UITextField) -> Void)
|
||||||
|
|
||||||
|
public init(pressedReturn: @escaping ((UITextField) -> Void)) {
|
||||||
|
self.pressedReturn = pressedReturn
|
||||||
|
}
|
||||||
|
|
||||||
|
public func textFieldShouldReturn(_ textField: UITextField) -> Bool {
|
||||||
|
pressedReturn(textField)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let delegate = ReturnDelegate(pressedReturn: pressedReturn)
|
||||||
|
objc_setAssociatedObject(textField, "returnDelegate", delegate, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
|
||||||
|
textField.delegate = delegate
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func updated(for state: UIConfigurationState) -> TextFieldContentConfiguration {
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct ButtonContentConfiguration : UIContentConfiguration
|
struct ButtonContentConfiguration : UIContentConfiguration
|
||||||
{
|
{
|
||||||
var menu: UIMenu
|
var menu: UIMenu
|
||||||
@@ -56,14 +107,17 @@ class GeneralSettingsViewController: UIViewController
|
|||||||
{
|
{
|
||||||
enum Section: String, CaseIterable {
|
enum Section: String, CaseIterable {
|
||||||
case searchEngine = "Search Engine"
|
case searchEngine = "Search Engine"
|
||||||
|
case syncServer = "Sync Server"
|
||||||
}
|
}
|
||||||
|
|
||||||
typealias Item = String
|
typealias Item = String
|
||||||
|
|
||||||
static let SearchProviderPopupItem = "searchProvider.popup"
|
static let SearchProviderPopupItem = "searchProvider.popup"
|
||||||
|
static let SyncServerItem = "syncServer.field"
|
||||||
|
|
||||||
let dataSource: UICollectionViewDiffableDataSource<Section, Item>
|
let dataSource: UICollectionViewDiffableDataSource<Section, Item>
|
||||||
let collectionView: UICollectionView
|
let collectionView: UICollectionView
|
||||||
|
let viewModel: ViewModel
|
||||||
|
|
||||||
static func createLayout(forIdiom idiom: UIUserInterfaceIdiom) -> UICollectionViewLayout {
|
static func createLayout(forIdiom idiom: UIUserInterfaceIdiom) -> UICollectionViewLayout {
|
||||||
#if targetEnvironment(macCatalyst)
|
#if targetEnvironment(macCatalyst)
|
||||||
@@ -85,7 +139,7 @@ class GeneralSettingsViewController: UIViewController
|
|||||||
layoutSize: headerFooterSize,
|
layoutSize: headerFooterSize,
|
||||||
elementKind: UICollectionView.elementKindSectionHeader,
|
elementKind: UICollectionView.elementKindSectionHeader,
|
||||||
alignment: .topLeading,
|
alignment: .topLeading,
|
||||||
absoluteOffset: CGPoint(x: insets.leading, y: insets.top)
|
absoluteOffset: CGPoint(x: insets.leading, y: insets.top + 5.0)
|
||||||
)
|
)
|
||||||
sectionHeader.extendsBoundary = false
|
sectionHeader.extendsBoundary = false
|
||||||
sectionHeader.contentInsets = insets
|
sectionHeader.contentInsets = insets
|
||||||
@@ -109,11 +163,11 @@ class GeneralSettingsViewController: UIViewController
|
|||||||
if idiom == .mac {
|
if idiom == .mac {
|
||||||
return LabelContentConfiguration(
|
return LabelContentConfiguration(
|
||||||
text: sectionName + ": ",
|
text: sectionName + ": ",
|
||||||
insets: UIEdgeInsets(top: 0, left: 10.0, bottom: 0, right: 10.0),
|
insets: UIEdgeInsets(top: 0.0, left: 10.0, bottom: 0, right: 10.0),
|
||||||
textAlignment: .right
|
textAlignment: .right
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
var config = UIListContentConfiguration.plainHeader()
|
var config = UIListContentConfiguration.header()
|
||||||
config.text = sectionName
|
config.text = sectionName
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
@@ -127,26 +181,45 @@ class GeneralSettingsViewController: UIViewController
|
|||||||
|
|
||||||
init() {
|
init() {
|
||||||
let actionHandler = { (action: UIAction) in
|
let actionHandler = { (action: UIAction) in
|
||||||
let providerString = action.title
|
let engineName = action.title
|
||||||
let provider = Settings.SearchProviderSetting(rawValue: providerString)!
|
Settings.shared.defaultSearchEngineName = engineName
|
||||||
Settings.shared.searchProvider = provider
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let viewModel = ViewModel()
|
||||||
let itemCellRegistry = UICollectionView.CellRegistration<UICollectionViewCell, Item> { cell, indexPath, identifier in
|
let itemCellRegistry = UICollectionView.CellRegistration<UICollectionViewCell, Item> { cell, indexPath, identifier in
|
||||||
if identifier == Self.SearchProviderPopupItem {
|
if identifier == Self.SearchProviderPopupItem {
|
||||||
let menu = UIMenu(children: Settings.SearchProviderSetting.allCases.map { provider in
|
let names = Settings.shared.searchEngines.keys.sorted()
|
||||||
let action = UIAction(title: provider.rawValue, handler: actionHandler)
|
var engineMenuItems: [UIMenuElement] = names.map { name in
|
||||||
action.state = Settings.shared.searchProvider == provider ? .on : .off
|
let action = UIAction(title: name, handler: actionHandler)
|
||||||
|
action.state = (Settings.shared.defaultSearchEngineName == name) ? .on : .off
|
||||||
return action
|
return action
|
||||||
})
|
}
|
||||||
|
|
||||||
|
engineMenuItems.append(UIMenu(options: .displayInline, children: [
|
||||||
|
UIAction(title: "Manage Search Engines…", handler: { _ in
|
||||||
|
viewModel.onManageSearchEngines()
|
||||||
|
})
|
||||||
|
]))
|
||||||
|
|
||||||
|
let menu = UIMenu(children: engineMenuItems)
|
||||||
cell.contentConfiguration = ButtonContentConfiguration(menu: menu)
|
cell.contentConfiguration = ButtonContentConfiguration(menu: menu)
|
||||||
|
} else if identifier == Self.SyncServerItem {
|
||||||
|
cell.contentConfiguration = TextFieldContentConfiguration(
|
||||||
|
text: Settings.shared.syncServer ?? "",
|
||||||
|
placeholderText: "https://sync.server.com",
|
||||||
|
textChanged: { newString in
|
||||||
|
Settings.shared.syncServer = newString
|
||||||
|
},
|
||||||
|
pressedReturn: { $0.resignFirstResponder() },
|
||||||
|
keyboardType: .URL,
|
||||||
|
returnKeyType: .done
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
#if !targetEnvironment(macCatalyst)
|
#if !targetEnvironment(macCatalyst)
|
||||||
cell.backgroundConfiguration = UIBackgroundConfiguration.listGroupedCell()
|
cell.backgroundConfiguration = UIBackgroundConfiguration.listCell()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
let sectionHeaderRegistry = UICollectionView.SupplementaryRegistration<UICollectionViewCell>(elementKind: UICollectionView.elementKindSectionHeader, handler: {
|
let sectionHeaderRegistry = UICollectionView.SupplementaryRegistration<UICollectionViewCell>(elementKind: UICollectionView.elementKindSectionHeader, handler: {
|
||||||
(cell, string, indexPath) in
|
(cell, string, indexPath) in
|
||||||
@@ -167,10 +240,66 @@ class GeneralSettingsViewController: UIViewController
|
|||||||
return collectionView.dequeueConfiguredReusableSupplementary(using: sectionHeaderRegistry, for: indexPath)
|
return collectionView.dequeueConfiguredReusableSupplementary(using: sectionHeaderRegistry, for: indexPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.viewModel = viewModel
|
||||||
|
|
||||||
super.init(nibName: nil, bundle: nil)
|
super.init(nibName: nil, bundle: nil)
|
||||||
|
|
||||||
|
collectionView.delegate = self
|
||||||
tabBarItem.title = "General"
|
tabBarItem.title = "General"
|
||||||
tabBarItem.image = UIImage(systemName: "gear")
|
tabBarItem.image = UIImage(systemName: "gear")
|
||||||
|
|
||||||
|
let resetPopup = { [weak self] in
|
||||||
|
guard let self else { return }
|
||||||
|
|
||||||
|
var snapshot = dataSource.snapshot()
|
||||||
|
snapshot.reloadItems([ Self.SearchProviderPopupItem ])
|
||||||
|
dataSource.apply(snapshot, animatingDifferences: false)
|
||||||
|
}
|
||||||
|
|
||||||
|
viewModel.onManageSearchEngines = { [weak self] in
|
||||||
|
guard let self else { return }
|
||||||
|
|
||||||
|
// Reset menu item (to show currently selected search engine)
|
||||||
|
resetPopup()
|
||||||
|
|
||||||
|
let viewController = ManageSearchEnginesViewController()
|
||||||
|
viewController.title = "Manage Search Engines"
|
||||||
|
|
||||||
|
viewController.model.onAddSearchEngine = { [weak self] in
|
||||||
|
guard let self else { return }
|
||||||
|
|
||||||
|
let addSearchEngineViewController = AddSearchEngineViewController()
|
||||||
|
let navController = UINavigationController(rootViewController: addSearchEngineViewController)
|
||||||
|
|
||||||
|
// Cancel
|
||||||
|
addSearchEngineViewController.navigationItem.leftBarButtonItem = UIBarButtonItem(systemItem: .cancel, primaryAction: UIAction { _ in
|
||||||
|
navController.dismiss(animated: true)
|
||||||
|
})
|
||||||
|
|
||||||
|
// Done
|
||||||
|
addSearchEngineViewController.navigationItem.rightBarButtonItem = UIBarButtonItem(systemItem: .done, primaryAction: UIAction { [weak self] _ in
|
||||||
|
self?.saveCustomSearchEngine(model: addSearchEngineViewController.viewModel)
|
||||||
|
navController.dismiss(animated: true)
|
||||||
|
|
||||||
|
resetPopup()
|
||||||
|
viewController.model.reloadConfiguredEngines()
|
||||||
|
})
|
||||||
|
|
||||||
|
self.present(navController, animated: true)
|
||||||
|
}
|
||||||
|
|
||||||
|
viewController.model.onChangeEngines = {
|
||||||
|
resetPopup()
|
||||||
|
}
|
||||||
|
|
||||||
|
#if targetEnvironment(macCatalyst)
|
||||||
|
let alertController = UIAlertController(title: "Not yet implemented for macOS.", message: nil, preferredStyle: .alert)
|
||||||
|
alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: { _ in alertController.dismiss(animated: true) }))
|
||||||
|
present(alertController, animated: true)
|
||||||
|
#else
|
||||||
|
navigationController?.pushViewController(viewController, animated: true)
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
required init?(coder: NSCoder) {
|
required init?(coder: NSCoder) {
|
||||||
@@ -183,13 +312,54 @@ class GeneralSettingsViewController: UIViewController
|
|||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
applySnapshot(animatingDifferences: false)
|
||||||
|
}
|
||||||
|
|
||||||
var snapshot = dataSource.snapshot()
|
// MARK: - Types
|
||||||
|
|
||||||
|
@MainActor
|
||||||
|
@Observable
|
||||||
|
class ViewModel
|
||||||
|
{
|
||||||
|
var onManageSearchEngines: () -> Void = {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension GeneralSettingsViewController : UICollectionViewDelegate {
|
||||||
|
func collectionView(_ collectionView: UICollectionView, shouldSelectItemAt indexPath: IndexPath) -> Bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private extension GeneralSettingsViewController {
|
||||||
|
func applySnapshot(animatingDifferences: Bool) {
|
||||||
|
var snapshot = NSDiffableDataSourceSnapshot<Section, Item>()
|
||||||
snapshot.appendSections(Section.allCases)
|
snapshot.appendSections(Section.allCases)
|
||||||
// iOS
|
|
||||||
// snapshot.appendItems(Settings.SearchProviderSetting.allCases.map { $0.rawValue }, toSection: .searchEngine)
|
|
||||||
snapshot.appendItems([ Self.SearchProviderPopupItem ], toSection: .searchEngine)
|
snapshot.appendItems([ Self.SearchProviderPopupItem ], toSection: .searchEngine)
|
||||||
|
snapshot.appendItems([ Self.SyncServerItem ], toSection: .syncServer)
|
||||||
|
dataSource.apply(snapshot, animatingDifferences: animatingDifferences)
|
||||||
|
}
|
||||||
|
|
||||||
|
func saveCustomSearchEngine(model: AddSearchEngineView.ViewModel) {
|
||||||
|
let name = model.name.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
|
let url = model.url.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
|
guard !name.isEmpty, !url.isEmpty else { return }
|
||||||
|
|
||||||
|
// Require placeholder
|
||||||
|
guard url.contains("%q") || url.contains("%s") else { return }
|
||||||
|
|
||||||
|
// Save
|
||||||
|
var engines = Settings.shared.searchEngines
|
||||||
|
engines[name] = url
|
||||||
|
Settings.shared.searchEngines = engines
|
||||||
|
|
||||||
|
if model.makeDefault {
|
||||||
|
Settings.shared.defaultSearchEngineName = name
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset inputs and refresh UI
|
||||||
|
var snapshot = dataSource.snapshot()
|
||||||
|
snapshot.reloadItems([ Self.SearchProviderPopupItem ])
|
||||||
dataSource.apply(snapshot, animatingDifferences: false)
|
dataSource.apply(snapshot, animatingDifferences: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
139
App/Settings/ManageSearchEnginesViewController.swift
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
//
|
||||||
|
// ManageSearchEnginesViewController.swift
|
||||||
|
// App
|
||||||
|
//
|
||||||
|
// Created by James Magahern on 9/29/25.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
@MainActor
|
||||||
|
struct ManageSearchEnginesView: View
|
||||||
|
{
|
||||||
|
@State var model: ViewModel
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
Form {
|
||||||
|
Section {
|
||||||
|
List($model.configuredEngines, editActions: .delete) { row in
|
||||||
|
HStack {
|
||||||
|
Image(uiImage: .checkmark)
|
||||||
|
.opacity(row.wrappedValue.isDefault ? 1.0 : 0.0)
|
||||||
|
|
||||||
|
VStack(alignment: .leading) {
|
||||||
|
Text(row.wrappedValue.name)
|
||||||
|
.font(.body)
|
||||||
|
.bold()
|
||||||
|
|
||||||
|
Text(row.wrappedValue.url)
|
||||||
|
.font(.caption)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.id(row.id)
|
||||||
|
|
||||||
|
.swipeActions(edge: .leading) {
|
||||||
|
Button { model.makeDefault(row.id) } label: {
|
||||||
|
Label("Make Default", systemImage: "checkmark")
|
||||||
|
}
|
||||||
|
.tint(.blue)
|
||||||
|
}
|
||||||
|
|
||||||
|
.swipeActions(edge: .trailing) {
|
||||||
|
Button(role: .destructive) { model.deleteEngine(row.id) } label: {
|
||||||
|
Label("Delete", systemImage: "trash")
|
||||||
|
}
|
||||||
|
.disabled(model.configuredEngines.count <= 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Section {
|
||||||
|
Button("Add Search Engine…") {
|
||||||
|
model.onAddSearchEngine()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Types
|
||||||
|
|
||||||
|
@MainActor
|
||||||
|
@Observable
|
||||||
|
class ViewModel
|
||||||
|
{
|
||||||
|
var configuredEngines: [ConfiguredEngine] = []
|
||||||
|
var onAddSearchEngine: () -> Void = {}
|
||||||
|
var onChangeEngines: () -> Void = {}
|
||||||
|
|
||||||
|
init() {
|
||||||
|
reloadConfiguredEngines()
|
||||||
|
}
|
||||||
|
|
||||||
|
func reloadConfiguredEngines() {
|
||||||
|
let defaultEngine = Settings.shared.defaultSearchEngineName
|
||||||
|
self.configuredEngines = Settings.shared.searchEngines.map { val in
|
||||||
|
ConfiguredEngine(
|
||||||
|
name: val.key,
|
||||||
|
url: val.value,
|
||||||
|
isDefault: val.key == defaultEngine
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func deleteEngine(_ id: ConfiguredEngine.ID) {
|
||||||
|
let engine = configuredEngines.first { $0.url == id }!
|
||||||
|
|
||||||
|
var engines = Settings.shared.searchEngines
|
||||||
|
engines.removeValue(forKey: engine.name)
|
||||||
|
Settings.shared.searchEngines = engines
|
||||||
|
|
||||||
|
if engine.isDefault {
|
||||||
|
// Pick another default
|
||||||
|
if let firstEngine = engines.first {
|
||||||
|
Settings.shared.defaultSearchEngineName = firstEngine.key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
reloadConfiguredEngines()
|
||||||
|
onChangeEngines()
|
||||||
|
}
|
||||||
|
|
||||||
|
func makeDefault(_ id: ConfiguredEngine.ID) {
|
||||||
|
let engineName = configuredEngines.first { $0.url == id }!.name
|
||||||
|
Settings.shared.defaultSearchEngineName = engineName
|
||||||
|
|
||||||
|
reloadConfiguredEngines()
|
||||||
|
onChangeEngines()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ConfiguredEngine: Identifiable
|
||||||
|
{
|
||||||
|
let name: String
|
||||||
|
let url: String
|
||||||
|
let isDefault: Bool
|
||||||
|
|
||||||
|
var id: String { url }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@MainActor
|
||||||
|
class ManageSearchEnginesViewController: UIHostingController<ManageSearchEnginesView>
|
||||||
|
{
|
||||||
|
let model: ManageSearchEnginesView.ViewModel
|
||||||
|
|
||||||
|
init() {
|
||||||
|
self.model = ManageSearchEnginesView.ViewModel()
|
||||||
|
super.init(rootView: ManageSearchEnginesView(model: model))
|
||||||
|
}
|
||||||
|
|
||||||
|
required dynamic init?(coder aDecoder: NSCoder) {
|
||||||
|
fatalError("init(coder:) has not been implemented")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview {
|
||||||
|
@Previewable @State var model = ManageSearchEnginesView.ViewModel()
|
||||||
|
ManageSearchEnginesView(model: model)
|
||||||
|
}
|
||||||
@@ -229,13 +229,19 @@ class CreateRedirectRuleViewController: UICollectionViewController
|
|||||||
|
|
||||||
sectionHeaderImageView.contentMode = .scaleAspectFit
|
sectionHeaderImageView.contentMode = .scaleAspectFit
|
||||||
|
|
||||||
fromHostField.placeholder = "https://fromhostname.com"
|
fromHostField.placeholder = "fromhostname.com"
|
||||||
fromHostField.autocorrectionType = .no
|
fromHostField.autocorrectionType = .no
|
||||||
fromHostField.autocapitalizationType = .none
|
fromHostField.autocapitalizationType = .none
|
||||||
|
fromHostField.keyboardType = .URL
|
||||||
|
fromHostField.returnKeyType = .next
|
||||||
|
fromHostField.delegate = self
|
||||||
|
|
||||||
toHostField.placeholder = "https://tohostname.com"
|
toHostField.placeholder = "tohostname.com"
|
||||||
toHostField.autocorrectionType = .no
|
toHostField.autocorrectionType = .no
|
||||||
toHostField.autocapitalizationType = .none
|
toHostField.autocapitalizationType = .none
|
||||||
|
toHostField.keyboardType = .URL
|
||||||
|
toHostField.returnKeyType = .done
|
||||||
|
toHostField.delegate = self
|
||||||
}
|
}
|
||||||
|
|
||||||
required init?(coder: NSCoder) {
|
required init?(coder: NSCoder) {
|
||||||
@@ -256,3 +262,15 @@ class CreateRedirectRuleViewController: UICollectionViewController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension CreateRedirectRuleViewController : UITextFieldDelegate {
|
||||||
|
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
|
||||||
|
if textField == fromHostField {
|
||||||
|
toHostField.becomeFirstResponder()
|
||||||
|
} else if textField == toHostField {
|
||||||
|
toHostField.resignFirstResponder()
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,22 @@ extension Dictionary: RawRepresentable where Key == String, Value == String {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension Optional: RawRepresentable where Wrapped == String {
|
||||||
|
public typealias RawValue = String?
|
||||||
|
|
||||||
|
public init?(rawValue: String?) {
|
||||||
|
if let rawValue {
|
||||||
|
self = String(rawValue: rawValue)
|
||||||
|
} else {
|
||||||
|
self = .none
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public var rawValue: String? {
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extension String: RawRepresentable {
|
extension String: RawRepresentable {
|
||||||
public typealias RawValue = String
|
public typealias RawValue = String
|
||||||
|
|
||||||
@@ -59,24 +75,26 @@ class Settings
|
|||||||
{
|
{
|
||||||
static let shared = Settings()
|
static let shared = Settings()
|
||||||
|
|
||||||
public enum SearchProviderSetting: String, CaseIterable {
|
// Map of search engine name -> URL template containing %q or %s placeholder
|
||||||
case google = "Google"
|
// Defaults preserve the previous built-in engines
|
||||||
case duckduckgo = "DuckDuckGo"
|
@SettingProperty(key: "searchEngines")
|
||||||
case searxnor = "Searx.nor"
|
public var searchEngines: [String: String] = [
|
||||||
case whoogle = "Whoogle.nor"
|
"Google": "https://google.com/search?q=%q&gbv=1",
|
||||||
|
"DuckDuckGo": "https://html.duckduckgo.com/html/?q=%q",
|
||||||
|
]
|
||||||
|
|
||||||
func provider() -> SearchProvider {
|
// Name of the default search engine from `searchEngines`
|
||||||
switch self {
|
@SettingProperty(key: "defaultSearchEngine")
|
||||||
case .google: return SearchProvider.google
|
public var defaultSearchEngineName: String = "Searx.nor"
|
||||||
case .duckduckgo: return SearchProvider.duckduckgo
|
|
||||||
case .searxnor: return SearchProvider.searxnor
|
|
||||||
case .whoogle: return SearchProvider.whoogle
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SettingProperty(key: "searchProvider")
|
// Convenience to build a SearchProvider from current default
|
||||||
public var searchProvider: SearchProviderSetting = .searxnor
|
func currentSearchProvider() -> SearchProvider {
|
||||||
|
if let template = searchEngines[defaultSearchEngineName] {
|
||||||
|
return SearchProvider.fromTemplate(template)
|
||||||
|
}
|
||||||
|
// Fallback to Google if something goes wrong
|
||||||
|
return SearchProvider.fromTemplate("https://google.com/search?q=%q&gbv=1")
|
||||||
|
}
|
||||||
|
|
||||||
@SettingProperty(key: "redirectRules")
|
@SettingProperty(key: "redirectRules")
|
||||||
public var redirectRules: [String: String] = [:]
|
public var redirectRules: [String: String] = [:]
|
||||||
@@ -105,4 +123,7 @@ class Settings
|
|||||||
|
|
||||||
@SettingProperty(key: "userStylesheet")
|
@SettingProperty(key: "userStylesheet")
|
||||||
public var userStylesheet: String = ""
|
public var userStylesheet: String = ""
|
||||||
|
|
||||||
|
@SettingProperty(key: "syncServer")
|
||||||
|
public var syncServer: Optional<String> = "https://attractor.severnaya.net"
|
||||||
}
|
}
|
||||||
|
|||||||
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
|
After Width: | Height: | Size: 6.4 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 43 KiB |
@@ -1,110 +1,114 @@
|
|||||||
{
|
{
|
||||||
"images" : [
|
"images" : [
|
||||||
{
|
{
|
||||||
"filename" : "icon-Notification@2x.png",
|
"filename" : "AppIcon-20.0x20.0@2x.png",
|
||||||
"idiom" : "iphone",
|
"idiom" : "universal",
|
||||||
|
"platform" : "ios",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
"size" : "20x20"
|
"size" : "20x20"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "icon-Notification@3x.png",
|
"filename" : "AppIcon-20.0x20.0@3x.png",
|
||||||
"idiom" : "iphone",
|
"idiom" : "universal",
|
||||||
|
"platform" : "ios",
|
||||||
"scale" : "3x",
|
"scale" : "3x",
|
||||||
"size" : "20x20"
|
"size" : "20x20"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "icon-Settings@2x.png",
|
"filename" : "AppIcon-29.0x29.0@2x.png",
|
||||||
"idiom" : "iphone",
|
"idiom" : "universal",
|
||||||
|
"platform" : "ios",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
"size" : "29x29"
|
"size" : "29x29"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "icon-Settings@3x.png",
|
"filename" : "AppIcon-29.0x29.0@3x.png",
|
||||||
"idiom" : "iphone",
|
"idiom" : "universal",
|
||||||
|
"platform" : "ios",
|
||||||
"scale" : "3x",
|
"scale" : "3x",
|
||||||
"size" : "29x29"
|
"size" : "29x29"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "icon-Spotlight-40@2x.png",
|
"filename" : "AppIcon-38.0x38.0@2x.png",
|
||||||
"idiom" : "iphone",
|
"idiom" : "universal",
|
||||||
|
"platform" : "ios",
|
||||||
|
"scale" : "2x",
|
||||||
|
"size" : "38x38"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "AppIcon-38.0x38.0@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"platform" : "ios",
|
||||||
|
"scale" : "3x",
|
||||||
|
"size" : "38x38"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "AppIcon-40.0x40.0@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"platform" : "ios",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
"size" : "40x40"
|
"size" : "40x40"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "icon-Spotlight-40@3x.png",
|
"filename" : "AppIcon-40.0x40.0@3x.png",
|
||||||
"idiom" : "iphone",
|
"idiom" : "universal",
|
||||||
|
"platform" : "ios",
|
||||||
"scale" : "3x",
|
"scale" : "3x",
|
||||||
"size" : "40x40"
|
"size" : "40x40"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "icon-60@2x.png",
|
"filename" : "AppIcon-60.0x60.0@2x.png",
|
||||||
"idiom" : "iphone",
|
"idiom" : "universal",
|
||||||
|
"platform" : "ios",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
"size" : "60x60"
|
"size" : "60x60"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "icon-60@3x.png",
|
"filename" : "AppIcon-60.0x60.0@3x.png",
|
||||||
"idiom" : "iphone",
|
"idiom" : "universal",
|
||||||
|
"platform" : "ios",
|
||||||
"scale" : "3x",
|
"scale" : "3x",
|
||||||
"size" : "60x60"
|
"size" : "60x60"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "icon-Notification~ipad.png",
|
"filename" : "AppIcon-64.0x64.0@2x.png",
|
||||||
"idiom" : "ipad",
|
"idiom" : "universal",
|
||||||
"scale" : "1x",
|
"platform" : "ios",
|
||||||
"size" : "20x20"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "icon-Notification@2x ~ipad.png",
|
|
||||||
"idiom" : "ipad",
|
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
"size" : "20x20"
|
"size" : "64x64"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "icon-Settings~ipad.png",
|
"filename" : "AppIcon-64.0x64.0@3x.png",
|
||||||
"idiom" : "ipad",
|
"idiom" : "universal",
|
||||||
"scale" : "1x",
|
"platform" : "ios",
|
||||||
"size" : "29x29"
|
"scale" : "3x",
|
||||||
|
"size" : "64x64"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "icon-Settings@2x~ipad.png",
|
"filename" : "AppIcon-68.0x68.0@2x.png",
|
||||||
"idiom" : "ipad",
|
"idiom" : "universal",
|
||||||
|
"platform" : "ios",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
"size" : "29x29"
|
"size" : "68x68"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "icon-Spotlight-40~ipad.png",
|
"filename" : "AppIcon-76.0x76.0@2x.png",
|
||||||
"idiom" : "ipad",
|
"idiom" : "universal",
|
||||||
"scale" : "1x",
|
"platform" : "ios",
|
||||||
"size" : "40x40"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "icon-Spotlight-40@2x~ipad.png",
|
|
||||||
"idiom" : "ipad",
|
|
||||||
"scale" : "2x",
|
|
||||||
"size" : "40x40"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "icon-76~ipad.png",
|
|
||||||
"idiom" : "ipad",
|
|
||||||
"scale" : "1x",
|
|
||||||
"size" : "76x76"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"filename" : "icon-76@2x~ipad.png",
|
|
||||||
"idiom" : "ipad",
|
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
"size" : "76x76"
|
"size" : "76x76"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "icon-83.5@2x~ipad.png",
|
"filename" : "AppIcon-83.5x83.5@2x.png",
|
||||||
"idiom" : "ipad",
|
"idiom" : "universal",
|
||||||
|
"platform" : "ios",
|
||||||
"scale" : "2x",
|
"scale" : "2x",
|
||||||
"size" : "83.5x83.5"
|
"size" : "83.5x83.5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "iconios~marketing-1.png",
|
"filename" : "AppIcon-1024.0x1024.0@1x.png",
|
||||||
"idiom" : "ios-marketing",
|
"idiom" : "universal",
|
||||||
|
"platform" : "ios",
|
||||||
"scale" : "1x",
|
"scale" : "1x",
|
||||||
"size" : "1024x1024"
|
"size" : "1024x1024"
|
||||||
}
|
}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 762 B |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 336 KiB |
@@ -34,14 +34,14 @@
|
|||||||
</array>
|
</array>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||||
|
<key>LSApplicationCategoryType</key>
|
||||||
|
<string>public.app-category.utilities</string>
|
||||||
<key>LSRequiresIPhoneOS</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>NSAppTransportSecurity</key>
|
<key>NSAppTransportSecurity</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>NSAllowsArbitraryLoads</key>
|
<key>NSAllowsArbitraryLoads</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>NSAllowsArbitraryLoadsInWebContent</key>
|
|
||||||
<true/>
|
|
||||||
</dict>
|
</dict>
|
||||||
<key>UIApplicationSceneManifest</key>
|
<key>UIApplicationSceneManifest</key>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
<key>UISceneConfigurationName</key>
|
<key>UISceneConfigurationName</key>
|
||||||
<string>Browser</string>
|
<string>Browser</string>
|
||||||
<key>UISceneDelegateClassName</key>
|
<key>UISceneDelegateClassName</key>
|
||||||
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
|
<string>$(PRODUCT_MODULE_NAME).BrowserSceneDelegate</string>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>UISceneConfigurationName</key>
|
<key>UISceneConfigurationName</key>
|
||||||
@@ -63,6 +63,12 @@
|
|||||||
<key>UISceneDelegateClassName</key>
|
<key>UISceneDelegateClassName</key>
|
||||||
<string>$(PRODUCT_MODULE_NAME).SettingsSceneDelegate</string>
|
<string>$(PRODUCT_MODULE_NAME).SettingsSceneDelegate</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>UISceneConfigurationName</key>
|
||||||
|
<string>Reader</string>
|
||||||
|
<key>UISceneDelegateClassName</key>
|
||||||
|
<string>$(PRODUCT_MODULE_NAME).ReaderSceneDelegate</string>
|
||||||
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
|
|||||||
@@ -5,8 +5,9 @@
|
|||||||
#import "SBRProcessBundleBridge.h"
|
#import "SBRProcessBundleBridge.h"
|
||||||
#import "SBRScriptPolicy.h"
|
#import "SBRScriptPolicy.h"
|
||||||
|
|
||||||
|
#import "WebKitDefines.h"
|
||||||
|
|
||||||
// SPI
|
// SPI
|
||||||
#import <UIKit/UITextField_Private.h>
|
|
||||||
#import <WebKit/WKWebViewPrivate.h>
|
#import <WebKit/WKWebViewPrivate.h>
|
||||||
#import <WebKit/_WKFindDelegate.h>
|
#import <WebKit/_WKFindDelegate.h>
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,5 @@
|
|||||||
<true/>
|
<true/>
|
||||||
<key>com.apple.security.network.client</key>
|
<key>com.apple.security.network.client</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>com.apple.developer.web-browser</key>
|
|
||||||
<true/>
|
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
19
App/Supporting Files/WebKitDefines.h
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
//
|
||||||
|
// WebKitDefines.h
|
||||||
|
// SBrowser
|
||||||
|
//
|
||||||
|
// Created by James Magahern on 4/11/25.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef WebKitDefines_h
|
||||||
|
#define WebKitDefines_h
|
||||||
|
|
||||||
|
#define WK_API_AVAILABLE(...)
|
||||||
|
#define WK_API_UNAVAILABLE(...)
|
||||||
|
#define WK_CLASS_AVAILABLE(...) __attribute__((visibility("default"))) WK_API_AVAILABLE(__VA_ARGS__)
|
||||||
|
#define WK_API_DEPRECATED(_message, ...) __attribute__((deprecated(_message)))
|
||||||
|
#define WK_API_DEPRECATED_WITH_REPLACEMENT(_replacement, ...) __attribute__((deprecated("use " #_replacement)))
|
||||||
|
#define WK_CLASS_DEPRECATED_WITH_REPLACEMENT(_replacement, ...) __attribute__((visibility("default"))) __attribute__((deprecated("use " #_replacement)))
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* WebKitDefines_h */
|
||||||
93
App/Sync/AttractorServer.swift
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
//
|
||||||
|
// AttractorServer.swift
|
||||||
|
// App
|
||||||
|
//
|
||||||
|
// Created by James Magahern on 8/5/22.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
class AttractorServer
|
||||||
|
{
|
||||||
|
public enum Error: Swift.Error {
|
||||||
|
case missingEndpointURL
|
||||||
|
}
|
||||||
|
|
||||||
|
static let shared = AttractorServer()
|
||||||
|
|
||||||
|
private var endpointURL: URL? {
|
||||||
|
get {
|
||||||
|
if let syncServer = Settings.shared.syncServer {
|
||||||
|
return URL(string: syncServer)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func getHostname() -> String {
|
||||||
|
// Need an entitlement for this...
|
||||||
|
return UIDevice.current.name
|
||||||
|
}
|
||||||
|
|
||||||
|
public func publishTabInfo(_ tabInfos: [TabInfo]) {
|
||||||
|
guard let endpointURL else { return }
|
||||||
|
|
||||||
|
let hostName = getHostname()
|
||||||
|
let rpcURL = endpointURL.appendingPathComponent("publishTabInfo")
|
||||||
|
var components = URLComponents(url: rpcURL, resolvingAgainstBaseURL: false)!
|
||||||
|
components.queryItems = [
|
||||||
|
URLQueryItem(name: "host", value: hostName)
|
||||||
|
]
|
||||||
|
|
||||||
|
let encoder = JSONEncoder()
|
||||||
|
if let bodyData = try? encoder.encode(tabInfos) {
|
||||||
|
var request = URLRequest(url: components.url!)
|
||||||
|
request.httpBody = bodyData
|
||||||
|
request.httpMethod = "POST"
|
||||||
|
|
||||||
|
let dataTask = URLSession.shared.dataTask(with: request) { (data, response, error) in
|
||||||
|
if let error {
|
||||||
|
print("Error publishing tab info: \(error.localizedDescription)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dataTask.resume()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getTabInfos(_ completion: @escaping(Result<[String: [TabInfo]], Swift.Error>) -> Void) {
|
||||||
|
guard let endpointURL else {
|
||||||
|
completion(.failure(Self.Error.missingEndpointURL))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let rpcURL = endpointURL.appendingPathComponent("getTabInfos")
|
||||||
|
let request = URLRequest(url: rpcURL)
|
||||||
|
let myHostname = getHostname()
|
||||||
|
let dataTask = URLSession.shared.dataTask(with: request) { (data, response, error) in
|
||||||
|
if let error {
|
||||||
|
print("Error getting tab infos: \(error.localizedDescription)")
|
||||||
|
DispatchQueue.main.async { completion(.failure(error)) }
|
||||||
|
}
|
||||||
|
|
||||||
|
let decoder = JSONDecoder()
|
||||||
|
if let data {
|
||||||
|
do {
|
||||||
|
let result = try decoder.decode([String: [TabInfo]].self, from: data)
|
||||||
|
.filter({ (host, tabInfo) in
|
||||||
|
// Filter out tabs from the same machine.
|
||||||
|
return host != myHostname
|
||||||
|
})
|
||||||
|
|
||||||
|
DispatchQueue.main.async { completion(.success(result)) }
|
||||||
|
} catch {
|
||||||
|
print("Error decoding tabs: \(error.localizedDescription)")
|
||||||
|
DispatchQueue.main.async { completion(.failure(error)) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dataTask.resume()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,6 +17,13 @@ class Tab: NSObject, SBRProcessBundleBridgeDelegate
|
|||||||
{
|
{
|
||||||
public weak var delegate: TabDelegate?
|
public weak var delegate: TabDelegate?
|
||||||
|
|
||||||
|
public var tabInfo: TabInfo {
|
||||||
|
get {
|
||||||
|
updateMetadata()
|
||||||
|
return _tabInfo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public let homeURL: URL?
|
public let homeURL: URL?
|
||||||
public let bridge: ProcessBundleBridge
|
public let bridge: ProcessBundleBridge
|
||||||
public var webView: WKWebView {
|
public var webView: WKWebView {
|
||||||
@@ -32,9 +39,19 @@ class Tab: NSObject, SBRProcessBundleBridgeDelegate
|
|||||||
}
|
}
|
||||||
public var policyManager: ResourcePolicyManager
|
public var policyManager: ResourcePolicyManager
|
||||||
|
|
||||||
|
private var _tabInfo: TabInfo = TabInfo()
|
||||||
|
|
||||||
private var loadedWebView: WKWebView? = nil
|
private var loadedWebView: WKWebView? = nil
|
||||||
public var title: String? { loadedWebView?.title }
|
public var title: String? { get { tabInfo.title } }
|
||||||
public var url: URL? { loadedWebView?.url ?? self.homeURL }
|
public var url: URL? {
|
||||||
|
get {
|
||||||
|
if let urlString = tabInfo.urlString {
|
||||||
|
return URL(string: urlString)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public var javaScriptEnabled: Bool = false {
|
public var javaScriptEnabled: Bool = false {
|
||||||
didSet { bridge.allowAllScripts = javaScriptEnabled }
|
didSet { bridge.allowAllScripts = javaScriptEnabled }
|
||||||
@@ -63,6 +80,7 @@ class Tab: NSObject, SBRProcessBundleBridgeDelegate
|
|||||||
@Published public var favicon: UIImage?
|
@Published public var favicon: UIImage?
|
||||||
|
|
||||||
public var loadError: Error?
|
public var loadError: Error?
|
||||||
|
public var contentProcessTerminated: Bool = false
|
||||||
|
|
||||||
private var faviconHost: String?
|
private var faviconHost: String?
|
||||||
private var faviconRequest: AnyCancellable?
|
private var faviconRequest: AnyCancellable?
|
||||||
@@ -132,4 +150,15 @@ class Tab: NSObject, SBRProcessBundleBridgeDelegate
|
|||||||
.assign(to: \.favicon, on: self)
|
.assign(to: \.favicon, on: self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func updateMetadata() {
|
||||||
|
guard contentProcessTerminated == false else { return }
|
||||||
|
|
||||||
|
_tabInfo = TabInfo(
|
||||||
|
title: loadedWebView?.title,
|
||||||
|
urlString: loadedWebView?.url?.absoluteString ?? self.homeURL?.absoluteString,
|
||||||
|
faviconData: self.favicon?.pngData(),
|
||||||
|
identifier: self.identifier
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ class TabBarView: UIView
|
|||||||
} else {
|
} else {
|
||||||
let newTabView = makeTabView(withIdentifier: identifier)
|
let newTabView = makeTabView(withIdentifier: identifier)
|
||||||
if animated { newTabView.collapsed = true }
|
if animated { newTabView.collapsed = true }
|
||||||
if i < tabViews.count {
|
if i > 0 && i < tabViews.count {
|
||||||
tabViews.insert(newTabView, at: i - 1)
|
tabViews.insert(newTabView, at: i - 1)
|
||||||
} else {
|
} else {
|
||||||
tabViews.append(newTabView)
|
tabViews.append(newTabView)
|
||||||
|
|||||||
@@ -33,6 +33,10 @@ class TabController
|
|||||||
tabs.first { $0.identifier == identifier }
|
tabs.first { $0.identifier == identifier }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func tab(forWebView webView: WKWebView) -> Tab? {
|
||||||
|
tabs.first { $0.webView == webView }
|
||||||
|
}
|
||||||
|
|
||||||
func createNewTab(url: URL?) -> Tab {
|
func createNewTab(url: URL?) -> Tab {
|
||||||
return self.createNewTab(url: url, webViewConfiguration: nil)
|
return self.createNewTab(url: url, webViewConfiguration: nil)
|
||||||
}
|
}
|
||||||
|
|||||||
24
App/Tabs/TabInfo.swift
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
//
|
||||||
|
// TabInfo.swift
|
||||||
|
// App
|
||||||
|
//
|
||||||
|
// Created by James Magahern on 8/5/22.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import Combine
|
||||||
|
|
||||||
|
struct TabInfo: Codable, Hashable
|
||||||
|
{
|
||||||
|
public var title: String?
|
||||||
|
public var urlString: String?
|
||||||
|
public var faviconData: Data?
|
||||||
|
public var identifier = UUID()
|
||||||
|
|
||||||
|
enum CodingKeys: String, CodingKey {
|
||||||
|
case title
|
||||||
|
case urlString = "url"
|
||||||
|
case faviconData
|
||||||
|
case identifier
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,89 +6,50 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
import Combine
|
||||||
|
|
||||||
protocol TabPickerViewControllerDelegate: AnyObject
|
protocol TabPickerViewControllerDelegate: AnyObject
|
||||||
{
|
{
|
||||||
func tabPicker(_ picker: TabPickerViewController, didSelectTab tab: Tab)
|
func tabPicker(_ picker: TabPickerViewController, createNewTabWithURL: URL?)
|
||||||
func tabPicker(_ picker: TabPickerViewController, willCloseTab tab: Tab)
|
func tabPicker(_ picker: TabPickerViewController, closeTabWithIdentifier tab: UUID)
|
||||||
|
func tabPicker(_ picker: TabPickerViewController, tabInfoForIdentifier: UUID) -> TabInfo
|
||||||
|
func tabPicker(_ picker: TabPickerViewController, didSelectTabInfo: TabInfo, fromHost: String)
|
||||||
}
|
}
|
||||||
|
|
||||||
class TabPickerViewController: UIViewController, UICollectionViewDelegate
|
class TabPickerViewController: UIViewController, UICollectionViewDelegate
|
||||||
{
|
{
|
||||||
let tabController: TabController!
|
|
||||||
var selectedTab: Tab?
|
|
||||||
|
|
||||||
weak var delegate: TabPickerViewControllerDelegate?
|
|
||||||
|
|
||||||
typealias TabID = UUID
|
typealias TabID = UUID
|
||||||
|
|
||||||
private var selectedTabsForEditing: Set<Tab> = []
|
public static var localHostIdentifier = "__localhost__";
|
||||||
private var collectionView: UICollectionView?
|
|
||||||
private var dataSource: UICollectionViewDiffableDataSource<Int, TabID>?
|
|
||||||
|
|
||||||
override var traitCollection: UITraitCollection {
|
public var selectedTabIdentifier: TabID?
|
||||||
get { return super.traitCollection.alwaysPadLike() }
|
public var selectedTabHost: String? { didSet { didChangeSelectedTabHost(selectedTabHost!) } }
|
||||||
}
|
|
||||||
|
|
||||||
private lazy var newTabButton: UIBarButtonItem = {
|
weak var delegate: TabPickerViewControllerDelegate?
|
||||||
UIBarButtonItem(systemItem: .add, primaryAction: UIAction(handler: { [unowned self] _ in
|
public var tabObserver: AnyCancellable?
|
||||||
let newTab = self.tabController.createNewTab(url: nil)
|
public var displayedError: Error? = nil { didSet { didSetDisplayedError(displayedError) } }
|
||||||
self.delegate?.tabPicker(self, didSelectTab: newTab)
|
|
||||||
}), menu: nil)
|
|
||||||
}()
|
|
||||||
|
|
||||||
lazy var deleteTabButton: UIBarButtonItem = {
|
private var displayedErrorView: UITextView?
|
||||||
UIBarButtonItem(systemItem: .trash, primaryAction: UIAction(handler: { [unowned self] _ in
|
private var selectedTabIdentifiersForEditing: Set<TabInfo> = []
|
||||||
deleteSelectedTabs()
|
private var tabIdentifiersByHost: [String: [TabInfo]] = [:]
|
||||||
}), menu: nil)
|
|
||||||
}()
|
|
||||||
|
|
||||||
init(tabController: TabController) {
|
private var listConfiguration = UICollectionLayoutListConfiguration(appearance: .insetGrouped)
|
||||||
self.tabController = tabController
|
private lazy var listLayout = UICollectionViewCompositionalLayout.list(using: listConfiguration)
|
||||||
super.init(nibName: nil, bundle: nil)
|
private lazy var collectionView = UICollectionView(frame: .zero, collectionViewLayout: listLayout).conf { collectionView in
|
||||||
|
|
||||||
self.title = "Tabs"
|
|
||||||
}
|
|
||||||
|
|
||||||
required init?(coder: NSCoder) {
|
|
||||||
fatalError("init(coder:) has not been implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
override func loadView() {
|
|
||||||
var listConfig = UICollectionLayoutListConfiguration(appearance: .insetGrouped)
|
|
||||||
listConfig.trailingSwipeActionsConfigurationProvider = { [unowned self] indexPath in
|
|
||||||
if self.dataSource?.snapshot().numberOfItems ?? 0 <= 1 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return UISwipeActionsConfiguration(actions: [ UIContextualAction(style: .destructive, title: "Close", handler: { [unowned self] (action, view, completionHandler) in
|
|
||||||
if let item = self.dataSource?.itemIdentifier(for: indexPath), var snapshot = self.dataSource?.snapshot() {
|
|
||||||
if let tab = self.tabController.tab(forIdentifier: item) {
|
|
||||||
self.delegate?.tabPicker(self, willCloseTab: tab)
|
|
||||||
|
|
||||||
self.tabController.closeTab(tab)
|
|
||||||
snapshot.deleteItems([ item ])
|
|
||||||
self.dataSource?.apply(snapshot, animatingDifferences: true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})])
|
|
||||||
}
|
|
||||||
|
|
||||||
let listLayout = UICollectionViewCompositionalLayout.list(using: listConfig)
|
|
||||||
let collectionView = UICollectionView(frame: .zero, collectionViewLayout: listLayout)
|
|
||||||
collectionView.allowsMultipleSelectionDuringEditing = true
|
collectionView.allowsMultipleSelectionDuringEditing = true
|
||||||
collectionView.backgroundColor = .systemGroupedBackground
|
collectionView.backgroundColor = .systemGroupedBackground
|
||||||
|
collectionView.delegate = self
|
||||||
|
}
|
||||||
|
|
||||||
let registry = UICollectionView.CellRegistration<UICollectionViewListCell, TabID> { [unowned self] (listCell, indexPath, item) in
|
private lazy var cellRegistry = UICollectionView.CellRegistration<UICollectionViewListCell, TabInfo> { [unowned self] (listCell, indexPath, tab) in
|
||||||
var config = listCell.defaultContentConfiguration()
|
var config = listCell.defaultContentConfiguration()
|
||||||
|
|
||||||
if let tab = self.tabController.tab(forIdentifier: item) {
|
|
||||||
if let title = tab.title, title.count > 0 {
|
if let title = tab.title, title.count > 0 {
|
||||||
config.text = title
|
config.text = title
|
||||||
config.secondaryText = tab.url?.absoluteString
|
config.secondaryText = tab.urlString
|
||||||
} else if let url = tab.url {
|
} else if let url = tab.urlString {
|
||||||
config.text = url.absoluteString
|
config.text = url
|
||||||
config.secondaryText = url.absoluteString
|
config.secondaryText = url
|
||||||
} else {
|
} else {
|
||||||
config.text = "New Tab"
|
config.text = "New Tab"
|
||||||
}
|
}
|
||||||
@@ -96,7 +57,7 @@ class TabPickerViewController: UIViewController, UICollectionViewDelegate
|
|||||||
config.textProperties.numberOfLines = 1
|
config.textProperties.numberOfLines = 1
|
||||||
config.secondaryTextProperties.numberOfLines = 1
|
config.secondaryTextProperties.numberOfLines = 1
|
||||||
|
|
||||||
if let image = tab.favicon {
|
if let faviconData = tab.faviconData, let image = UIImage(data: faviconData) {
|
||||||
config.image = image
|
config.image = image
|
||||||
} else {
|
} else {
|
||||||
config.image = UIImage(systemName: "safari")
|
config.image = UIImage(systemName: "safari")
|
||||||
@@ -105,43 +66,118 @@ class TabPickerViewController: UIViewController, UICollectionViewDelegate
|
|||||||
config.imageProperties.maximumSize = CGSize(width: 21.0, height: 21.0)
|
config.imageProperties.maximumSize = CGSize(width: 21.0, height: 21.0)
|
||||||
config.imageProperties.cornerRadius = 3.0
|
config.imageProperties.cornerRadius = 3.0
|
||||||
|
|
||||||
if self.selectedTab == tab {
|
if let selectedTabIdentifier, selectedTabIdentifier == tab.identifier {
|
||||||
listCell.accessories = [ .checkmark() ]
|
listCell.accessories = [ .checkmark() ]
|
||||||
} else {
|
} else {
|
||||||
listCell.accessories = []
|
listCell.accessories = []
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
listCell.contentConfiguration = config
|
listCell.contentConfiguration = config
|
||||||
}
|
}
|
||||||
|
|
||||||
let dataSource = UICollectionViewDiffableDataSource<Int, TabID>(collectionView: collectionView) { (collectionView, indexPath, item) -> UICollectionViewCell? in
|
private lazy var dataSource = UICollectionViewDiffableDataSource<Int, TabInfo>(collectionView: collectionView)
|
||||||
return collectionView.dequeueConfiguredReusableCell(using: registry, for: indexPath, item: item)
|
{ [unowned self] (collectionView, indexPath, item) -> UICollectionViewCell? in
|
||||||
|
return collectionView.dequeueConfiguredReusableCell(using: cellRegistry, for: indexPath, item: item)
|
||||||
}
|
}
|
||||||
|
|
||||||
collectionView.dataSource = dataSource
|
override var traitCollection: UITraitCollection {
|
||||||
collectionView.delegate = self
|
get { return super.traitCollection.alwaysPadLike() }
|
||||||
|
}
|
||||||
|
|
||||||
|
public lazy var newTabButton: UIBarButtonItem = {
|
||||||
|
UIBarButtonItem(systemItem: .add, primaryAction: UIAction(handler: { [unowned self] _ in
|
||||||
|
self.delegate?.tabPicker(self, createNewTabWithURL: nil)
|
||||||
|
}), menu: nil)
|
||||||
|
}()
|
||||||
|
|
||||||
|
private lazy var deleteTabButton: UIBarButtonItem = {
|
||||||
|
UIBarButtonItem(systemItem: .trash, primaryAction: UIAction(handler: { [unowned self] _ in
|
||||||
|
deleteSelectedTabs()
|
||||||
|
}), menu: nil)
|
||||||
|
}()
|
||||||
|
|
||||||
|
private lazy var hostPickerButton: UIButton = {
|
||||||
|
var buttonConfiguration = UIButton.Configuration.bordered()
|
||||||
|
buttonConfiguration.title = "Host"
|
||||||
|
|
||||||
|
let button = UIButton(configuration: buttonConfiguration)
|
||||||
|
button.changesSelectionAsPrimaryAction = true
|
||||||
|
button.showsMenuAsPrimaryAction = true
|
||||||
|
button.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
button.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||||
|
|
||||||
|
return button
|
||||||
|
}()
|
||||||
|
|
||||||
|
init() {
|
||||||
|
super.init(nibName: nil, bundle: nil)
|
||||||
|
self.title = "Tabs"
|
||||||
|
}
|
||||||
|
|
||||||
|
required init?(coder: NSCoder) {
|
||||||
|
fatalError("init(coder:) has not been implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
override func loadView() {
|
||||||
|
// Load this lazy var now.
|
||||||
|
_ = cellRegistry.self
|
||||||
|
|
||||||
|
listConfiguration.trailingSwipeActionsConfigurationProvider = { [unowned self] indexPath in
|
||||||
|
return UISwipeActionsConfiguration(actions: [ UIContextualAction(style: .destructive, title: "Close", handler: { [unowned self] (action, view, completionHandler) in
|
||||||
|
if let item = dataSource.itemIdentifier(for: indexPath) {
|
||||||
var snapshot = dataSource.snapshot()
|
var snapshot = dataSource.snapshot()
|
||||||
snapshot.appendSections([ 0 ])
|
delegate?.tabPicker(self, closeTabWithIdentifier: item.identifier)
|
||||||
tabController.tabs.forEach { tab in
|
|
||||||
snapshot.appendItems([ tab.identifier ])
|
snapshot.deleteItems([ item ])
|
||||||
|
dataSource.apply(snapshot, animatingDifferences: true)
|
||||||
|
}
|
||||||
|
})])
|
||||||
}
|
}
|
||||||
|
|
||||||
dataSource.apply(snapshot)
|
|
||||||
|
|
||||||
self.dataSource = dataSource
|
|
||||||
self.collectionView = collectionView
|
|
||||||
self.view = self.collectionView
|
self.view = self.collectionView
|
||||||
|
|
||||||
configureNavigationButtons(forEditing: isEditing)
|
configureNavigationButtons(forEditing: isEditing)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func setTabInfos(_ infos: [TabInfo], forHost host: String) {
|
||||||
|
tabIdentifiersByHost[host] = infos
|
||||||
|
|
||||||
|
if host == selectedTabHost {
|
||||||
|
var snapshot = dataSource.snapshot()
|
||||||
|
snapshot.deleteAllItems()
|
||||||
|
snapshot.appendSections([ 0 ])
|
||||||
|
snapshot.appendItems(infos)
|
||||||
|
dataSource.apply(snapshot) // crashing here...
|
||||||
|
}
|
||||||
|
|
||||||
|
reloadHostPickerButtonMenu()
|
||||||
|
}
|
||||||
|
|
||||||
|
private func reloadHostPickerButtonMenu() {
|
||||||
|
var menuChildren: [UIAction] = []
|
||||||
|
for host in tabIdentifiersByHost.keys {
|
||||||
|
menuChildren.append(UIAction(title: host, handler: { [unowned self] _ in
|
||||||
|
selectedTabHost = host
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
hostPickerButton.menu = UIMenu(children: menuChildren)
|
||||||
|
|
||||||
|
// Update list for whatever the selected item is
|
||||||
|
selectedTabHost = hostPickerButton.menu?.selectedElements.first?.title
|
||||||
|
|
||||||
|
if tabIdentifiersByHost.keys.count > 0 && tabIdentifiersByHost.keys.first != Self.localHostIdentifier {
|
||||||
|
navigationItem.titleView = hostPickerButton
|
||||||
|
} else {
|
||||||
|
navigationItem.titleView = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private func configureNavigationButtons(forEditing: Bool) {
|
private func configureNavigationButtons(forEditing: Bool) {
|
||||||
if !forEditing {
|
if !forEditing {
|
||||||
navigationItem.rightBarButtonItem = newTabButton
|
navigationItem.rightBarButtonItem = newTabButton
|
||||||
} else {
|
} else {
|
||||||
deleteTabButton.isEnabled = collectionView?.indexPathsForSelectedItems?.count ?? 0 > 0
|
deleteTabButton.isEnabled = collectionView.indexPathsForSelectedItems?.count ?? 0 > 0
|
||||||
navigationItem.rightBarButtonItem = deleteTabButton
|
navigationItem.rightBarButtonItem = deleteTabButton
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,43 +186,86 @@ class TabPickerViewController: UIViewController, UICollectionViewDelegate
|
|||||||
|
|
||||||
override func setEditing(_ editing: Bool, animated: Bool) {
|
override func setEditing(_ editing: Bool, animated: Bool) {
|
||||||
super.setEditing(editing, animated: animated)
|
super.setEditing(editing, animated: animated)
|
||||||
|
|
||||||
if let collectionView = collectionView {
|
|
||||||
collectionView.isEditing = editing
|
collectionView.isEditing = editing
|
||||||
}
|
|
||||||
|
|
||||||
configureNavigationButtons(forEditing: editing)
|
configureNavigationButtons(forEditing: editing)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func deleteSelectedTabs() {
|
private func deleteSelectedTabs() {
|
||||||
guard let dataSource = dataSource else { return }
|
|
||||||
|
|
||||||
var snapshot = dataSource.snapshot()
|
var snapshot = dataSource.snapshot()
|
||||||
for tab in selectedTabsForEditing {
|
for tab in selectedTabIdentifiersForEditing {
|
||||||
snapshot.deleteItems([ tab.identifier ])
|
snapshot.deleteItems([ tab ])
|
||||||
self.delegate?.tabPicker(self, willCloseTab: tab)
|
delegate?.tabPicker(self, closeTabWithIdentifier: tab.identifier)
|
||||||
self.tabController.closeTab(tab)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dataSource.apply(snapshot, animatingDifferences: true)
|
dataSource.apply(snapshot, animatingDifferences: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func didChangeSelectedTabHost(_ tabHost: String) {
|
||||||
|
guard let tabIdentifiers = tabIdentifiersByHost[tabHost] else { fatalError() }
|
||||||
|
|
||||||
|
var snapshot = dataSource.snapshot()
|
||||||
|
snapshot.deleteAllItems()
|
||||||
|
snapshot.appendSections([ 0 ])
|
||||||
|
snapshot.appendItems(tabIdentifiers)
|
||||||
|
dataSource.applySnapshotUsingReloadData(snapshot)
|
||||||
|
}
|
||||||
|
|
||||||
|
private func didSetDisplayedError(_ displayedError: Error?) {
|
||||||
|
if let displayedError {
|
||||||
|
// Clear items first
|
||||||
|
var snapshot = dataSource.snapshot()
|
||||||
|
snapshot.deleteAllItems()
|
||||||
|
dataSource.applySnapshotUsingReloadData(snapshot)
|
||||||
|
|
||||||
|
if displayedErrorView == nil {
|
||||||
|
let errorView = UITextView(frame: .zero)
|
||||||
|
errorView.isUserInteractionEnabled = false
|
||||||
|
errorView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
errorView.isScrollEnabled = false
|
||||||
|
collectionView.addSubview(errorView)
|
||||||
|
|
||||||
|
let guide = collectionView.layoutMarginsGuide
|
||||||
|
NSLayoutConstraint.activate([
|
||||||
|
errorView.leadingAnchor .constraint(equalTo: guide.leadingAnchor),
|
||||||
|
errorView.trailingAnchor .constraint(equalTo: guide.trailingAnchor),
|
||||||
|
errorView.centerYAnchor .constraint(equalTo: guide.centerYAnchor),
|
||||||
|
])
|
||||||
|
|
||||||
|
self.displayedErrorView = errorView
|
||||||
|
}
|
||||||
|
|
||||||
|
let paragraphStyle = NSMutableParagraphStyle()
|
||||||
|
paragraphStyle.alignment = .center
|
||||||
|
|
||||||
|
var attributedString = try! AttributedString(markdown: "**Error loading tabs**: \(displayedError.localizedDescription)")
|
||||||
|
attributedString.foregroundColor = UIColor.secondaryLabel
|
||||||
|
attributedString.paragraphStyle = paragraphStyle
|
||||||
|
attributedString.font = UIFont.preferredFont(forTextStyle: .body)
|
||||||
|
|
||||||
|
displayedErrorView?.attributedText = NSAttributedString(attributedString)
|
||||||
|
} else {
|
||||||
|
displayedErrorView?.removeFromSuperview()
|
||||||
|
displayedErrorView = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
||||||
let tab = tabController.tabs[indexPath.row]
|
guard let tab = dataSource.itemIdentifier(for: indexPath) else { return }
|
||||||
|
|
||||||
if !isEditing {
|
if !isEditing {
|
||||||
delegate?.tabPicker(self, didSelectTab: tab)
|
delegate?.tabPicker(self, didSelectTabInfo: tab, fromHost: selectedTabHost!)
|
||||||
} else {
|
} else {
|
||||||
deleteTabButton.isEnabled = collectionView.indexPathsForSelectedItems?.count ?? 0 > 0
|
deleteTabButton.isEnabled = collectionView.indexPathsForSelectedItems?.count ?? 0 > 0
|
||||||
selectedTabsForEditing.update(with: tab)
|
selectedTabIdentifiersForEditing.update(with: tab)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func collectionView(_ collectionView: UICollectionView, didDeselectItemAt indexPath: IndexPath) {
|
func collectionView(_ collectionView: UICollectionView, didDeselectItemAt indexPath: IndexPath) {
|
||||||
if isEditing {
|
guard let tabIdentifier = dataSource.itemIdentifier(for: indexPath) else { return }
|
||||||
let tab = tabController.tabs[indexPath.row]
|
|
||||||
selectedTabsForEditing.remove(tab)
|
|
||||||
|
|
||||||
|
if isEditing {
|
||||||
|
selectedTabIdentifiersForEditing.remove(tabIdentifier)
|
||||||
deleteTabButton.isEnabled = collectionView.indexPathsForSelectedItems?.count ?? 0 > 0
|
deleteTabButton.isEnabled = collectionView.indexPathsForSelectedItems?.count ?? 0 > 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import QuartzCore_Private
|
|
||||||
|
|
||||||
class SecurityIndicatorView: UIView
|
class SecurityIndicatorView: UIView
|
||||||
{
|
{
|
||||||
@@ -62,10 +61,6 @@ class TitlebarView: UIView
|
|||||||
private let separatorView = UIView(frame: .zero)
|
private let separatorView = UIView(frame: .zero)
|
||||||
private let securityIndicatorView = SecurityIndicatorView()
|
private let securityIndicatorView = SecurityIndicatorView()
|
||||||
|
|
||||||
override var _sceneDraggingBehaviorOnPan: _UIViewSceneDraggingBehaviorOnPan {
|
|
||||||
_UIViewSceneDraggingBehaviorOnPan.dragScene
|
|
||||||
}
|
|
||||||
|
|
||||||
convenience init() {
|
convenience init() {
|
||||||
self.init(frame: .zero)
|
self.init(frame: .zero)
|
||||||
addSubview(backgroundView)
|
addSubview(backgroundView)
|
||||||
@@ -74,7 +69,7 @@ class TitlebarView: UIView
|
|||||||
addSubview(separatorView)
|
addSubview(separatorView)
|
||||||
|
|
||||||
separatorView.backgroundColor = UIColor(white: 1.0, alpha: 0.20)
|
separatorView.backgroundColor = UIColor(white: 1.0, alpha: 0.20)
|
||||||
separatorView.layer.compositingFilter = kCAFilterPlusL
|
separatorView.layer.compositingFilter = "kCAFilterPlusL"
|
||||||
|
|
||||||
titleLabelView.textColor = .white
|
titleLabelView.textColor = .white
|
||||||
titleLabelView.layer.shadowColor = UIColor.black.cgColor
|
titleLabelView.layer.shadowColor = UIColor.black.cgColor
|
||||||
@@ -88,6 +83,11 @@ class TitlebarView: UIView
|
|||||||
securityIndicatorView.label.font = UIFont.systemFont(ofSize: 10.0)
|
securityIndicatorView.label.font = UIFont.systemFont(ofSize: 10.0)
|
||||||
|
|
||||||
backgroundView.alpha = 0.98
|
backgroundView.alpha = 0.98
|
||||||
|
|
||||||
|
// Make draggable
|
||||||
|
if #available(iOS 17.0, *) {
|
||||||
|
addInteraction(UIWindowSceneDragInteraction())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func setTitle(_ title: String) {
|
func setTitle(_ title: String) {
|
||||||
|
|||||||
@@ -9,9 +9,18 @@ import UIKit
|
|||||||
|
|
||||||
class ToolbarView: UIView
|
class ToolbarView: UIView
|
||||||
{
|
{
|
||||||
var urlBar: URLBar? { didSet { containerView.addSubview(urlBar!) } }
|
var urlBar: URLBar? {
|
||||||
|
didSet {
|
||||||
|
guard let urlBar else { return }
|
||||||
|
containerView.addSubview(urlBar)
|
||||||
|
|
||||||
var cancelButtonVisible: Bool = false { didSet { layoutSubviews() } }
|
urlBar.textField.addAction(.init(handler: { [unowned self] _ in
|
||||||
|
layoutLatch.activate()
|
||||||
|
}), for: [ .editingDidBegin, .editingDidEnd ])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var cancelButtonVisible: Bool = false { didSet { setNeedsLayout() } }
|
||||||
|
|
||||||
let containerView = UIView(frame: .zero)
|
let containerView = UIView(frame: .zero)
|
||||||
let backgroundView = GradientView(direction: .vertical, colors: [
|
let backgroundView = GradientView(direction: .vertical, colors: [
|
||||||
@@ -23,6 +32,9 @@ class ToolbarView: UIView
|
|||||||
let leadingButtonsView = ToolbarButtonContainerView(frame: .zero)
|
let leadingButtonsView = ToolbarButtonContainerView(frame: .zero)
|
||||||
let trailingButtonsView = ToolbarButtonContainerView(frame: .zero)
|
let trailingButtonsView = ToolbarButtonContainerView(frame: .zero)
|
||||||
|
|
||||||
|
// Something I'm sure I'll regret: to ensure animation with the keyboard, latch layout until we get the right signal.
|
||||||
|
lazy var layoutLatch = LayoutLatch(self)
|
||||||
|
|
||||||
convenience init()
|
convenience init()
|
||||||
{
|
{
|
||||||
self.init(frame: .zero)
|
self.init(frame: .zero)
|
||||||
@@ -54,6 +66,7 @@ class ToolbarView: UIView
|
|||||||
|
|
||||||
override func layoutSubviews()
|
override func layoutSubviews()
|
||||||
{
|
{
|
||||||
|
guard !layoutLatch.latched else { return }
|
||||||
super.layoutSubviews()
|
super.layoutSubviews()
|
||||||
|
|
||||||
let shadowPath = UIBezierPath(rect: bounds)
|
let shadowPath = UIBezierPath(rect: bounds)
|
||||||
|
|||||||
@@ -66,10 +66,13 @@ class ToolbarViewController: UIViewController
|
|||||||
newTabButton.setImage(UIImage(systemName: "plus"), for: .normal)
|
newTabButton.setImage(UIImage(systemName: "plus"), for: .normal)
|
||||||
|
|
||||||
let toolbarAnimationDuration: TimeInterval = 0.3
|
let toolbarAnimationDuration: TimeInterval = 0.3
|
||||||
urlBar.textField.addAction(.init(handler: { [traitCollection, toolbarView, urlBar] _ in
|
urlBar.textField.addAction(.init(handler: { [weak self] _ in
|
||||||
if traitCollection.horizontalSizeClass == .compact {
|
guard let self, let parent else { return }
|
||||||
UIView.animate(withDuration: toolbarAnimationDuration) {
|
|
||||||
toolbarView.cancelButtonVisible = urlBar.textField.isFirstResponder
|
// xxx: Not sure why I need to refer to parent here. This view controller isn't inheriting anything.
|
||||||
|
if parent.traitCollection.horizontalSizeClass == .compact {
|
||||||
|
UIView.animate(withDuration: toolbarAnimationDuration) { [unowned self] in
|
||||||
|
self.toolbarView.cancelButtonVisible = self.urlBar.textField.isFirstResponder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}), for: [ .editingDidBegin, .editingDidEnd ])
|
}), for: [ .editingDidBegin, .editingDidEnd ])
|
||||||
@@ -78,12 +81,10 @@ class ToolbarViewController: UIViewController
|
|||||||
urlBar.textField.resignFirstResponder()
|
urlBar.textField.resignFirstResponder()
|
||||||
}), for: .touchUpInside)
|
}), for: .touchUpInside)
|
||||||
|
|
||||||
traitCollectionDidChange(nil)
|
reconfigureButtons(for: traitCollection.horizontalSizeClass)
|
||||||
}
|
}
|
||||||
|
|
||||||
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
public func reconfigureButtons(for horizontalSizeClass: UIUserInterfaceSizeClass) {
|
||||||
super.traitCollectionDidChange(previousTraitCollection)
|
|
||||||
|
|
||||||
toolbarView.leadingButtonsView.removeAllButtonViews()
|
toolbarView.leadingButtonsView.removeAllButtonViews()
|
||||||
toolbarView.trailingButtonsView.removeAllButtonViews()
|
toolbarView.trailingButtonsView.removeAllButtonViews()
|
||||||
|
|
||||||
@@ -92,7 +93,7 @@ class ToolbarViewController: UIViewController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Setup toolbar based on trait collection
|
// Setup toolbar based on trait collection
|
||||||
if traitCollection.horizontalSizeClass == .compact {
|
if horizontalSizeClass == .compact {
|
||||||
toolbarView.trailingButtonsView.addButtonView(scriptControllerIconView)
|
toolbarView.trailingButtonsView.addButtonView(scriptControllerIconView)
|
||||||
toolbarView.trailingButtonsView.addButtonView(newTabButton)
|
toolbarView.trailingButtonsView.addButtonView(newTabButton)
|
||||||
toolbarView.trailingButtonsView.addButtonView(windowButton)
|
toolbarView.trailingButtonsView.addButtonView(windowButton)
|
||||||
|
|||||||
@@ -153,20 +153,12 @@ class URLBar: ReliefButton
|
|||||||
textField.font = .systemFont(ofSize: 13.0)
|
textField.font = .systemFont(ofSize: 13.0)
|
||||||
textField.clearButtonMode = .never
|
textField.clearButtonMode = .never
|
||||||
textField.placeholder = "URL or search term"
|
textField.placeholder = "URL or search term"
|
||||||
textField.addAction(UIAction(handler: { [unowned self] _ in
|
|
||||||
// Mask view visibility is affected by editing state.
|
|
||||||
self.layoutSubviews()
|
|
||||||
}), for: [ .editingDidBegin, .editingDidEnd ])
|
|
||||||
textField.keyCommands = [
|
textField.keyCommands = [
|
||||||
UIKeyCommand(action: #selector(Self.downKeyPressed), input: UIKeyCommand.inputDownArrow)
|
UIKeyCommand(action: #selector(Self.downKeyPressed), input: UIKeyCommand.inputDownArrow)
|
||||||
.prioritizeOverSystem()
|
.prioritizeOverSystem()
|
||||||
]
|
]
|
||||||
addSubview(textField)
|
addSubview(textField)
|
||||||
|
|
||||||
textField.addAction(.init(handler: { [textField, refreshButton ] _ in
|
|
||||||
refreshButton.isHidden = textField.isFirstResponder
|
|
||||||
}), for: [ .editingDidBegin, .editingDidEnd ])
|
|
||||||
|
|
||||||
refreshButton.tintColor = .secondaryLabel
|
refreshButton.tintColor = .secondaryLabel
|
||||||
refreshButton.setImage(refreshImage, for: .normal)
|
refreshButton.setImage(refreshImage, for: .normal)
|
||||||
refreshButton.isPointerInteractionEnabled = true
|
refreshButton.isPointerInteractionEnabled = true
|
||||||
@@ -189,8 +181,9 @@ class URLBar: ReliefButton
|
|||||||
documentSeparatorView.backgroundColor = .secondarySystemFill
|
documentSeparatorView.backgroundColor = .secondarySystemFill
|
||||||
addSubview(documentSeparatorView)
|
addSubview(documentSeparatorView)
|
||||||
|
|
||||||
|
controlsView.autoresizingMask = []
|
||||||
controlsView.clearButton.addAction(.init(handler: { [textField] _ in
|
controlsView.clearButton.addAction(.init(handler: { [textField] _ in
|
||||||
textField.clearText()
|
textField.text = ""
|
||||||
}), for: .primaryActionTriggered)
|
}), for: .primaryActionTriggered)
|
||||||
|
|
||||||
controlsView.autocorrectButton.addAction(.init(handler: { [unowned self] _ in
|
controlsView.autocorrectButton.addAction(.init(handler: { [unowned self] _ in
|
||||||
@@ -281,8 +274,9 @@ class URLBar: ReliefButton
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func fadeBackgroundImageForSize(_ size: CGSize, cutoffLocation: CGFloat) -> UIImage? {
|
private func fadeBackgroundImageForSize(_ size: CGSize, cutoffLocation: CGFloat) -> UIImage? {
|
||||||
var image: UIImage? = nil
|
guard size.width > .leastNonzeroMagnitude && size.height > .leastNonzeroMagnitude else { return nil }
|
||||||
|
|
||||||
|
var image: UIImage? = nil
|
||||||
UIGraphicsBeginImageContext(CGSize(width: size.width, height: 1.0))
|
UIGraphicsBeginImageContext(CGSize(width: size.width, height: 1.0))
|
||||||
if let context = UIGraphicsGetCurrentContext() {
|
if let context = UIGraphicsGetCurrentContext() {
|
||||||
let gradientColorsArray = [
|
let gradientColorsArray = [
|
||||||
@@ -292,6 +286,7 @@ class URLBar: ReliefButton
|
|||||||
UIColor(white: 1.0, alpha: 0.08).cgColor
|
UIColor(white: 1.0, alpha: 0.08).cgColor
|
||||||
]
|
]
|
||||||
|
|
||||||
|
let cutoffLocation = CGFloat.minimum(0.9, cutoffLocation)
|
||||||
let locations: [CGFloat] = [
|
let locations: [CGFloat] = [
|
||||||
0.0, cutoffLocation, cutoffLocation + 0.10, 1.0
|
0.0, cutoffLocation, cutoffLocation + 0.10, 1.0
|
||||||
]
|
]
|
||||||
@@ -343,6 +338,9 @@ class URLBar: ReliefButton
|
|||||||
)
|
)
|
||||||
documentSeparatorView.frame = documentSeparatorView.frame.insetBy(dx: 0.0, dy: 3.0)
|
documentSeparatorView.frame = documentSeparatorView.frame.insetBy(dx: 0.0, dy: 3.0)
|
||||||
|
|
||||||
|
// Text field controls
|
||||||
|
controlsView.frame = CGRect(origin: controlsView.frame.origin, size: controlsView.sizeThatFits(bounds.size))
|
||||||
|
|
||||||
// Text field
|
// Text field
|
||||||
let textFieldPadding: CGFloat = 6.0
|
let textFieldPadding: CGFloat = 6.0
|
||||||
let textFieldOrigin = CGPoint(x: documentButton.frame.maxX + textFieldPadding, y: 0.0)
|
let textFieldOrigin = CGPoint(x: documentButton.frame.maxX + textFieldPadding, y: 0.0)
|
||||||
@@ -360,8 +358,18 @@ class URLBar: ReliefButton
|
|||||||
let refreshButtonSize = CGSize(width: textField.frame.height, height: textField.frame.height)
|
let refreshButtonSize = CGSize(width: textField.frame.height, height: textField.frame.height)
|
||||||
refreshButton.frame = CGRect(origin: CGPoint(x: bounds.width - refreshButtonSize.width, y: 0), size: refreshButtonSize)
|
refreshButton.frame = CGRect(origin: CGPoint(x: bounds.width - refreshButtonSize.width, y: 0), size: refreshButtonSize)
|
||||||
|
|
||||||
|
// Refresh vs. controls view visibility
|
||||||
|
let isFocused = textField.isFirstResponder
|
||||||
|
if isFocused {
|
||||||
|
controlsView.alpha = 1.0
|
||||||
|
refreshButton.alpha = 0.0
|
||||||
|
} else {
|
||||||
|
controlsView.alpha = 0.0
|
||||||
|
refreshButton.alpha = 1.0
|
||||||
|
}
|
||||||
|
|
||||||
// Error button
|
// Error button
|
||||||
if case .error(error: _) = loadProgress, !textField.isFirstResponder {
|
if case .error(error: _) = loadProgress, !isFocused {
|
||||||
errorButton.isHidden = false
|
errorButton.isHidden = false
|
||||||
errorButton.sizeToFit()
|
errorButton.sizeToFit()
|
||||||
errorButton.frame = CGRect(
|
errorButton.frame = CGRect(
|
||||||
@@ -379,7 +387,7 @@ class URLBar: ReliefButton
|
|||||||
// Fade mask
|
// Fade mask
|
||||||
fadeMaskView.frame = textField.bounds
|
fadeMaskView.frame = textField.bounds
|
||||||
fadeMaskView.image = fadeBackgroundImageForSize(fadeMaskView.frame.size, cutoffLocation: fadeCutoffLocation)
|
fadeMaskView.image = fadeBackgroundImageForSize(fadeMaskView.frame.size, cutoffLocation: fadeCutoffLocation)
|
||||||
if !textField.isFirstResponder {
|
if !isFocused {
|
||||||
textField.mask = fadeMaskView
|
textField.mask = fadeMaskView
|
||||||
} else {
|
} else {
|
||||||
textField.mask = nil
|
textField.mask = nil
|
||||||
|
|||||||
@@ -33,14 +33,14 @@ extension CGRect
|
|||||||
|
|
||||||
public func centeredY(inRect: CGRect) -> CGRect {
|
public func centeredY(inRect: CGRect) -> CGRect {
|
||||||
var rect = self
|
var rect = self
|
||||||
rect.origin.y = CGRound(inRect.origin.y + (inRect.height - rect.height) / 2.0)
|
rect.origin.y = (inRect.origin.y + (inRect.height - rect.height) / 2.0).rounded()
|
||||||
|
|
||||||
return rect
|
return rect
|
||||||
}
|
}
|
||||||
|
|
||||||
public func centeredX(inRect: CGRect) -> CGRect {
|
public func centeredX(inRect: CGRect) -> CGRect {
|
||||||
var rect = self
|
var rect = self
|
||||||
rect.origin.x = CGRound(inRect.origin.x + (inRect.width - rect.width) / 2.0)
|
rect.origin.x = (inRect.origin.x + (inRect.width - rect.width) / 2.0).rounded()
|
||||||
|
|
||||||
return rect
|
return rect
|
||||||
}
|
}
|
||||||
|
|||||||
30
App/Utilities/LayoutLatch.swift
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
//
|
||||||
|
// LayoutLatch.swift
|
||||||
|
// App
|
||||||
|
//
|
||||||
|
// Created by James Magahern on 8/10/23.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
class LayoutLatch {
|
||||||
|
public weak var view: UIView?
|
||||||
|
public private(set) var latched: Bool = false
|
||||||
|
|
||||||
|
init(_ view: UIView) {
|
||||||
|
self.view = view
|
||||||
|
}
|
||||||
|
|
||||||
|
public func activate() {
|
||||||
|
latched = true
|
||||||
|
|
||||||
|
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(100)) { [weak self] in
|
||||||
|
self?.deactivate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func deactivate() {
|
||||||
|
latched = false
|
||||||
|
view?.setNeedsLayout()
|
||||||
|
}
|
||||||
|
}
|
||||||
33
App/Utilities/StringUtilities.swift
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
//
|
||||||
|
// StringUtilities.swift
|
||||||
|
// App
|
||||||
|
//
|
||||||
|
// Created by James Magahern on 7/31/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
extension String {
|
||||||
|
internal func middleTruncatedString(maximumLength: Int) -> String {
|
||||||
|
if maximumLength > self.count {
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute replacement range
|
||||||
|
let pivot = self.count / 2
|
||||||
|
let truncationLength = self.count - maximumLength
|
||||||
|
|
||||||
|
let pivotIndex = self.index(startIndex, offsetBy: pivot)
|
||||||
|
let startIndex = self.index(pivotIndex, offsetBy: -truncationLength / 2)
|
||||||
|
let endIndex = self.index(pivotIndex, offsetBy: truncationLength / 2)
|
||||||
|
|
||||||
|
return replacingCharacters(in: startIndex..<endIndex, with: "…")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension URL {
|
||||||
|
internal var securityOrigin: String {
|
||||||
|
// TODO: This could be smarter…
|
||||||
|
return self.host() ?? ""
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,19 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
|
extension NSObject {
|
||||||
|
@objc fileprivate func _null() {}
|
||||||
|
}
|
||||||
|
|
||||||
extension UIKeyCommand {
|
extension UIKeyCommand {
|
||||||
|
public static func null() -> UIKeyCommand {
|
||||||
|
UIKeyCommand(modifiers: [], input: "", title: "", action: #selector(_null))
|
||||||
|
}
|
||||||
|
|
||||||
|
public func isNull() -> Bool {
|
||||||
|
return action == #selector(_null)
|
||||||
|
}
|
||||||
|
|
||||||
convenience init(modifiers: UIKeyModifierFlags, input: String, title: String, action: Selector) {
|
convenience init(modifiers: UIKeyModifierFlags, input: String, title: String, action: Selector) {
|
||||||
self.init(input: input, modifierFlags: modifiers, action: action)
|
self.init(input: input, modifierFlags: modifiers, action: action)
|
||||||
self.title = title
|
self.title = title
|
||||||
|
|||||||
29
App/Utilities/UIView+Utils.swift
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
//
|
||||||
|
// UIView+Utils.swift
|
||||||
|
// App
|
||||||
|
//
|
||||||
|
// Created by James Magahern on 8/5/22.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
infix operator .. : AssignmentPrecedence
|
||||||
|
|
||||||
|
@discardableResult @inline(__always) @inlinable
|
||||||
|
public func .. <T: Any>(it: T, apply: (inout T) throws -> Void) rethrows -> T {
|
||||||
|
var it = it
|
||||||
|
try apply(&it)
|
||||||
|
return it
|
||||||
|
}
|
||||||
|
|
||||||
|
protocol Conf { }
|
||||||
|
|
||||||
|
extension Conf {
|
||||||
|
@discardableResult
|
||||||
|
func conf(_ block: (Self) -> Void) -> Self {
|
||||||
|
block(self)
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension UIView: Conf {}
|
||||||
@@ -36,8 +36,6 @@ NS_SWIFT_NAME(ProcessBundleBridge)
|
|||||||
@property (nonatomic, assign) BOOL allowAllScripts; // default is NO
|
@property (nonatomic, assign) BOOL allowAllScripts; // default is NO
|
||||||
@property (nonatomic, assign) BOOL darkModeEnabled;
|
@property (nonatomic, assign) BOOL darkModeEnabled;
|
||||||
|
|
||||||
@property (nonatomic, readonly) BOOL webContentProcessConnected;
|
|
||||||
|
|
||||||
- (instancetype)initWithWebViewConfiguration:(nullable WKWebViewConfiguration *)webViewConfiguration NS_DESIGNATED_INITIALIZER;
|
- (instancetype)initWithWebViewConfiguration:(nullable WKWebViewConfiguration *)webViewConfiguration NS_DESIGNATED_INITIALIZER;
|
||||||
|
|
||||||
- (void)policyDataSourceDidChange;
|
- (void)policyDataSourceDidChange;
|
||||||
|
|||||||
@@ -7,64 +7,117 @@
|
|||||||
|
|
||||||
#import "SBRProcessBundleBridge.h"
|
#import "SBRProcessBundleBridge.h"
|
||||||
|
|
||||||
#import "SBRWebProcessDelegate.h"
|
#import "SBRScriptPolicy.h"
|
||||||
#import "SBRWebProcessProxy.h"
|
#import "Hacks.h"
|
||||||
|
|
||||||
|
#import <OSLog/OSLog.h>
|
||||||
|
|
||||||
#import <WebKit/_WKRemoteObjectInterface.h>
|
#import <WebKit/_WKRemoteObjectInterface.h>
|
||||||
#import <WebKit/_WKRemoteObjectRegistry.h>
|
#import <WebKit/_WKRemoteObjectRegistry.h>
|
||||||
#import <WebKit/_WKProcessPoolConfiguration.h>
|
#import <WebKit/_WKProcessPoolConfiguration.h>
|
||||||
#import <WebKit/_WKUserStyleSheet.h>
|
|
||||||
|
|
||||||
#import <WebKit/WKProcessPoolPrivate.h>
|
#import <WebKit/WKProcessPoolPrivate.h>
|
||||||
#import <WebKit/WKWebViewPrivate.h>
|
#import <WebKit/WKWebViewPrivate.h>
|
||||||
#import <WebKit/WKWebViewConfigurationPrivate.h>
|
#import <WebKit/WKWebViewConfigurationPrivate.h>
|
||||||
#import <WebKit/WKUserContentControllerPrivate.h>
|
|
||||||
|
|
||||||
@interface SBRProcessBundleBridge () <SBRWebProcessDelegate>
|
#define WKUserStyleSheet id
|
||||||
|
#define WKUserStyleSheetEncodedClassName "X1dLVXNlclN0eWxlU2hlZXQ="
|
||||||
|
|
||||||
|
@interface StyleSheet : NSObject <NSCopying>
|
||||||
|
@property (nonatomic, readonly, copy) NSString *source;
|
||||||
|
@property (nonatomic, readonly, copy) NSURL *baseURL;
|
||||||
|
@property (nonatomic, readonly, getter=isForMainFrameOnly) BOOL forMainFrameOnly;
|
||||||
|
|
||||||
|
- (instancetype)initWithSource:(NSString *)source forMainFrameOnly:(BOOL)forMainFrameOnly;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface WKUserContentController (Private)
|
||||||
|
- (void)__addUserStyleSheet:(WKUserStyleSheet)userStyleSheet;
|
||||||
|
- (void)__removeUserStyleSheet:(WKUserStyleSheet)userStyleSheet;
|
||||||
|
- (void)__addUserScriptImmediately:(WKUserScript *)userScript;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation WKUserContentController (Private)
|
||||||
|
|
||||||
|
- (void)__addUserStyleSheet:(id)userStyleSheet
|
||||||
|
{
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
|
||||||
|
[self performSelector:DecodedSelector("X2FkZFVzZXJTdHlsZVNoZWV0Og==") withObject:userStyleSheet];
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)__removeUserStyleSheet:(id)userStyleSheet
|
||||||
|
{
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
|
||||||
|
[self performSelector:DecodedSelector("X3JlbW92ZVVzZXJTdHlsZVNoZWV0Og==") withObject:userStyleSheet];
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)__addUserScriptImmediately:(WKUserScript *)userScript
|
||||||
|
{
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
|
||||||
|
[self performSelector:DecodedSelector("X2FkZFVzZXJTY3JpcHRJbW1lZGlhdGVseTo=") withObject:userScript];
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#define LOG_DEBUG(format, ...) os_log_debug(_log, format, ##__VA_ARGS__)
|
||||||
|
#define LOG_ERROR(format, ...) os_log_error(_log, format, ##__VA_ARGS__)
|
||||||
|
|
||||||
|
@interface NSURLResponse (BridgeAdditions)
|
||||||
|
@property (nonatomic, readonly) BOOL isJavascriptResponse;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation NSURLResponse (BridgeAdditions)
|
||||||
|
|
||||||
|
- (BOOL)isJavascriptResponse
|
||||||
|
{
|
||||||
|
NSString *extension = [[self URL] pathExtension];
|
||||||
|
if ([[extension lowercaseString] isEqualToString:@"js"]) {
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSString *MIMEType = [self MIMEType];
|
||||||
|
if ([[MIMEType lowercaseString] containsString:@"javascript"]) {
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface SBRProcessBundleBridge () <WKURLSchemeHandler>
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation SBRProcessBundleBridge {
|
@implementation SBRProcessBundleBridge {
|
||||||
|
os_log_t _log;
|
||||||
|
|
||||||
WKWebView *_webView;
|
WKWebView *_webView;
|
||||||
WKWebViewConfiguration *_webViewConfiguration;
|
WKWebViewConfiguration *_webViewConfiguration;
|
||||||
WKProcessPool *_processPool;
|
WKProcessPool *_processPool;
|
||||||
id<SBRWebProcessProxy> _webProcessProxy;
|
|
||||||
|
|
||||||
_WKUserStyleSheet *_darkModeStyleSheet;
|
WKUserStyleSheet _darkModeStyleSheet;
|
||||||
WKUserScript *_readabilityScript;
|
WKUserScript *_readabilityScript;
|
||||||
|
|
||||||
NSArray<WKUserScript *> *_userScripts;
|
NSArray<WKUserScript *> *_userScripts;
|
||||||
|
|
||||||
|
dispatch_queue_t _dataTasksAccessQueue;
|
||||||
|
NSMutableDictionary<NSURLRequest *, NSURLSessionDataTask *> *_dataTasks;
|
||||||
|
|
||||||
// These come from settings.
|
// These come from settings.
|
||||||
_WKUserStyleSheet *_customizedUserStylesheet;
|
WKUserStyleSheet _customizedUserStylesheet;
|
||||||
WKUserScript *_customizedUserScript;
|
WKUserScript *_customizedUserScript;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)tearDown
|
- (void)tearDown
|
||||||
{
|
{
|
||||||
[[_webView _remoteObjectRegistry] unregisterExportedObject:self interface:[self _webProcessDelegateInterface]];
|
// This was used to unregister the delegate with the web process.
|
||||||
}
|
|
||||||
|
|
||||||
- (_WKRemoteObjectInterface *)_webProcessDelegateInterface
|
|
||||||
{
|
|
||||||
static dispatch_once_t onceToken;
|
|
||||||
static _WKRemoteObjectInterface *interface = nil;
|
|
||||||
dispatch_once(&onceToken, ^{
|
|
||||||
interface = [_WKRemoteObjectInterface remoteObjectInterfaceWithProtocol:@protocol(SBRWebProcessDelegate)];
|
|
||||||
});
|
|
||||||
|
|
||||||
return interface;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (_WKRemoteObjectInterface *)_webProcessProxyInterface
|
|
||||||
{
|
|
||||||
static dispatch_once_t onceToken;
|
|
||||||
static _WKRemoteObjectInterface *interface = nil;
|
|
||||||
dispatch_once(&onceToken, ^{
|
|
||||||
interface = [_WKRemoteObjectInterface remoteObjectInterfaceWithProtocol:@protocol(SBRWebProcessProxy)];
|
|
||||||
});
|
|
||||||
|
|
||||||
return interface;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithWebViewConfiguration:(WKWebViewConfiguration *)webViewConfiguration
|
- (instancetype)initWithWebViewConfiguration:(WKWebViewConfiguration *)webViewConfiguration
|
||||||
@@ -72,32 +125,22 @@
|
|||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
if (!webViewConfiguration) {
|
if (!webViewConfiguration) {
|
||||||
|
_log = os_log_create("net.buzzert.attractor.webview", "bridge");
|
||||||
|
|
||||||
webViewConfiguration = [[WKWebViewConfiguration alloc] init];
|
webViewConfiguration = [[WKWebViewConfiguration alloc] init];
|
||||||
|
|
||||||
// Inject bundle
|
|
||||||
_WKProcessPoolConfiguration *poolConfiguration = [[_WKProcessPoolConfiguration alloc] init];
|
|
||||||
NSURL *bundleURL = [[[NSBundle mainBundle] builtInPlugInsURL] URLByAppendingPathComponent:@"SBrowserProcessBundle.bundle"];
|
|
||||||
|
|
||||||
// Make sure it exists. Bail if otherwise.
|
|
||||||
NSBundle *pluginBundle = [NSBundle bundleWithURL:bundleURL];
|
|
||||||
NSAssert(pluginBundle != nil, @"Attix process bundle not found at %@", bundleURL.path);
|
|
||||||
|
|
||||||
[poolConfiguration setInjectedBundleURL:bundleURL];
|
|
||||||
|
|
||||||
// Set up process pool
|
// Set up process pool
|
||||||
_processPool = [[WKProcessPool alloc] _initWithConfiguration:poolConfiguration];
|
_processPool = [[WKProcessPool alloc] init];
|
||||||
|
|
||||||
// Initialize allowed origins now
|
|
||||||
NSDictionary<NSString *, NSNumber *> *policies = [_policyDataSource scriptPolicyTypeByOrigin];
|
|
||||||
NSArray<NSString *> *allowedOrigins = [[_policyDataSource allowedOriginsForScriptResources] allObjects];
|
|
||||||
[_processPool _setObject:allowedOrigins forBundleParameter:SBRGetAllowedOriginsKey()];
|
|
||||||
[_processPool _setObject:@(_allowAllScripts) forBundleParameter:SBRGetAllScriptsAllowedKey()];
|
|
||||||
[_processPool _setObject:policies forBundleParameter:SBRGetPolicyTypeByOriginKey()];
|
|
||||||
|
|
||||||
webViewConfiguration.processPool = _processPool;
|
webViewConfiguration.processPool = _processPool;
|
||||||
|
|
||||||
webViewConfiguration._waitsForPaintAfterViewDidMoveToWindow = NO;
|
webViewConfiguration._waitsForPaintAfterViewDidMoveToWindow = NO;
|
||||||
webViewConfiguration._applePayEnabled = YES;
|
webViewConfiguration._applePayEnabled = YES;
|
||||||
|
|
||||||
|
_dataTasks = [NSMutableDictionary dictionary];
|
||||||
|
_dataTasksAccessQueue = dispatch_queue_create("net.buzzert.attractor.dataTasksAccess", DISPATCH_QUEUE_SERIAL);
|
||||||
|
|
||||||
|
[webViewConfiguration setURLSchemeHandler:self forURLScheme:@"http"];
|
||||||
|
[webViewConfiguration setURLSchemeHandler:self forURLScheme:@"https"];
|
||||||
}
|
}
|
||||||
|
|
||||||
_webViewConfiguration = webViewConfiguration;
|
_webViewConfiguration = webViewConfiguration;
|
||||||
@@ -113,16 +156,10 @@
|
|||||||
|
|
||||||
// Instantiate web view
|
// Instantiate web view
|
||||||
WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:webViewConfiguration];
|
WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:webViewConfiguration];
|
||||||
if ([webView respondsToSelector:@selector(_setFindInteractionEnabled:)]) {
|
if (@available(iOS 16.0, *)) {
|
||||||
webView._findInteractionEnabled = YES;
|
webView.findInteractionEnabled = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configure proxy interface (interface to remote web process)
|
|
||||||
_webProcessProxy = [[webView _remoteObjectRegistry] remoteObjectProxyWithInterface:[self _webProcessProxyInterface]];
|
|
||||||
|
|
||||||
// Configure delegate interface (registering us as the web process delegate for the remote process)
|
|
||||||
[[webView _remoteObjectRegistry] registerExportedObject:self interface:[self _webProcessDelegateInterface]];
|
|
||||||
|
|
||||||
_webView = webView;
|
_webView = webView;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,9 +188,7 @@
|
|||||||
- (void)reloadCustomizedUserScriptsAndStylesheets
|
- (void)reloadCustomizedUserScriptsAndStylesheets
|
||||||
{
|
{
|
||||||
WKUserContentController *userContentController = [_webViewConfiguration userContentController];
|
WKUserContentController *userContentController = [_webViewConfiguration userContentController];
|
||||||
if (_customizedUserScript) {
|
[userContentController removeAllUserScripts];
|
||||||
[userContentController _removeUserScript:_customizedUserScript];
|
|
||||||
}
|
|
||||||
|
|
||||||
NSString *scriptSource = [[NSUserDefaults standardUserDefaults] stringForKey:@"userScript"];
|
NSString *scriptSource = [[NSUserDefaults standardUserDefaults] stringForKey:@"userScript"];
|
||||||
if ([scriptSource length]) {
|
if ([scriptSource length]) {
|
||||||
@@ -162,55 +197,123 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_customizedUserStylesheet) {
|
if (_customizedUserStylesheet) {
|
||||||
[userContentController _removeUserStyleSheet:_customizedUserStylesheet];
|
[userContentController __removeUserStyleSheet:_customizedUserStylesheet];
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString *stylesheetSource = [[NSUserDefaults standardUserDefaults] stringForKey:@"userStylesheet"];
|
NSString *stylesheetSource = [[NSUserDefaults standardUserDefaults] stringForKey:@"userStylesheet"];
|
||||||
if ([stylesheetSource length]) {
|
if ([stylesheetSource length]) {
|
||||||
_customizedUserStylesheet = [[_WKUserStyleSheet alloc] initWithSource:stylesheetSource forMainFrameOnly:YES];
|
_customizedUserStylesheet = [[DecodedClass(WKUserStyleSheetEncodedClassName) alloc] initWithSource:stylesheetSource forMainFrameOnly:YES];
|
||||||
[userContentController _addUserStyleSheet:_customizedUserStylesheet];
|
[userContentController __addUserStyleSheet:_customizedUserStylesheet];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark <SBRWebProcessDelegate>
|
#pragma mark Former <SBRWebProcessDelegate> methods
|
||||||
|
|
||||||
- (void)webProcessDidConnect
|
|
||||||
{
|
|
||||||
NSLog(@"SBRProcessBundleBridge: did connect. Saying hello, syncing allowlist");
|
|
||||||
_webContentProcessConnected = YES;
|
|
||||||
|
|
||||||
[_webProcessProxy hello];
|
|
||||||
[self policyDataSourceDidChange];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)webProcessDidAllowScriptWithOrigin:(NSString *)origin
|
- (void)webProcessDidAllowScriptWithOrigin:(NSString *)origin
|
||||||
{
|
{
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[[self delegate] webProcess:self didAllowScriptResourceFromOrigin:origin];
|
[[self delegate] webProcess:self didAllowScriptResourceFromOrigin:origin];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)webProcessDidBlockScriptWithOrigin:(NSString *)origin
|
- (void)webProcessDidBlockScriptWithOrigin:(NSString *)origin
|
||||||
{
|
{
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[[self delegate] webProcess:self didBlockScriptResourceFromOrigin:origin];
|
[[self delegate] webProcess:self didBlockScriptResourceFromOrigin:origin];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark <WKURLSchemeHandler>
|
||||||
|
|
||||||
|
- (void)webView:(WKWebView *)webView startURLSchemeTask:(id<WKURLSchemeTask>)urlSchemeTask
|
||||||
|
{
|
||||||
|
NSString *hostOrigin = [[_webView URL] host];
|
||||||
|
NSURLRequest *request = [urlSchemeTask request];
|
||||||
|
|
||||||
|
LOG_DEBUG("Start URL scheme task: request: %@", request);
|
||||||
|
|
||||||
|
__weak __auto_type welf = self;
|
||||||
|
NSURLSessionDataTask *dataTask = [[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error)
|
||||||
|
{
|
||||||
|
if (!welf) return;
|
||||||
|
__strong __auto_type sself = welf;
|
||||||
|
|
||||||
|
if (error != nil) {
|
||||||
|
[urlSchemeTask didFailWithError:error];
|
||||||
|
} else if ([response isKindOfClass:[NSHTTPURLResponse class]]) {
|
||||||
|
NSURL *requestURL = [request URL];
|
||||||
|
NSString *resourceOrigin = [requestURL host];
|
||||||
|
const __auto_type allowResource = ^{
|
||||||
|
os_log_debug(sself->_log, "Allowing resource: %@", requestURL.lastPathComponent);
|
||||||
|
[urlSchemeTask didReceiveResponse:response];
|
||||||
|
[urlSchemeTask didReceiveData:data];
|
||||||
|
[urlSchemeTask didFinish];
|
||||||
|
|
||||||
|
[self webProcessDidAllowScriptWithOrigin:resourceOrigin];
|
||||||
|
};
|
||||||
|
|
||||||
|
const __auto_type denyResource = ^{
|
||||||
|
os_log_debug(sself->_log, "Blocking resource: %@", requestURL.lastPathComponent);
|
||||||
|
NSHTTPURLResponse *altResponse = [[NSHTTPURLResponse alloc] initWithURL:requestURL
|
||||||
|
MIMEType:@"application/javascript"
|
||||||
|
expectedContentLength:0 textEncodingName:@"utf8"];
|
||||||
|
[urlSchemeTask didReceiveResponse:altResponse];
|
||||||
|
[urlSchemeTask didReceiveData:[NSData data]];
|
||||||
|
[urlSchemeTask didFinish];
|
||||||
|
|
||||||
|
[self webProcessDidBlockScriptWithOrigin:resourceOrigin];
|
||||||
|
};
|
||||||
|
|
||||||
|
// Check MIME type for JavaScript responses.
|
||||||
|
if ([response isJavascriptResponse] && ![sself allowAllScripts]) {
|
||||||
|
dispatch_async(sself->_dataTasksAccessQueue, ^{
|
||||||
|
NSDictionary<NSString *, NSNumber *> *policyTypes = [sself->_policyDataSource scriptPolicyTypeByOrigin];
|
||||||
|
NSNumber *policyType = [policyTypes objectForKey:hostOrigin];
|
||||||
|
|
||||||
|
SBRScriptPolicy *policy = [[SBRScriptPolicy alloc] initWithSecurityOrigin:hostOrigin policyType:[policyType integerValue]];
|
||||||
|
if ([policy allowsExternalJavaScriptResourceOrigin:resourceOrigin]) {
|
||||||
|
allowResource();
|
||||||
|
} else {
|
||||||
|
denyResource();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
allowResource();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
[urlSchemeTask didFailWithError:[NSError errorWithDomain:NSURLErrorDomain code:0 userInfo:nil]];
|
||||||
|
}
|
||||||
|
|
||||||
|
[sself->_dataTasks removeObjectForKey:request];
|
||||||
|
}];
|
||||||
|
|
||||||
|
[_dataTasks setObject:dataTask forKey:request];
|
||||||
|
[dataTask resume];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)webView:(WKWebView *)webView stopURLSchemeTask:(id<WKURLSchemeTask>)urlSchemeTask
|
||||||
|
{
|
||||||
|
NSURLRequest *request = [urlSchemeTask request];
|
||||||
|
NSURLSessionDataTask *dataTask = [_dataTasks objectForKey:request];
|
||||||
|
if (dataTask) {
|
||||||
|
if ([dataTask state] != NSURLSessionTaskStateCanceling) {
|
||||||
|
[dataTask cancel];
|
||||||
|
}
|
||||||
|
|
||||||
|
[_dataTasks removeObjectForKey:request];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark Actions
|
#pragma mark Actions
|
||||||
|
|
||||||
- (void)policyDataSourceDidChange
|
- (void)policyDataSourceDidChange
|
||||||
{
|
{
|
||||||
NSArray<NSString *> *allowedOrigins = [[_policyDataSource allowedOriginsForScriptResources] allObjects];
|
// This was used when we had to signal the process bundle.
|
||||||
[_processPool _setObject:allowedOrigins forBundleParameter:SBRGetAllowedOriginsKey()];
|
|
||||||
[_webProcessProxy syncAllowedResourceOrigins:allowedOrigins];
|
|
||||||
|
|
||||||
NSDictionary<NSString *, NSNumber *> *policyTypes = [_policyDataSource scriptPolicyTypeByOrigin];
|
|
||||||
[_processPool _setObject:policyTypes forBundleParameter:SBRGetPolicyTypeByOriginKey()];
|
|
||||||
[_webProcessProxy syncPolicyTypes:policyTypes];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setAllowAllScripts:(BOOL)allowAllScripts
|
- (void)setAllowAllScripts:(BOOL)allowAllScripts
|
||||||
{
|
{
|
||||||
_allowAllScripts = allowAllScripts;
|
_allowAllScripts = allowAllScripts;
|
||||||
[_processPool _setObject:@(_allowAllScripts) forBundleParameter:SBRGetAllScriptsAllowedKey()];
|
|
||||||
[_webProcessProxy setAllScriptsAllowed:allowAllScripts];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setDarkModeEnabled:(BOOL)darkModeEnabled
|
- (void)setDarkModeEnabled:(BOOL)darkModeEnabled
|
||||||
@@ -223,16 +326,15 @@
|
|||||||
if (!_darkModeStyleSheet) {
|
if (!_darkModeStyleSheet) {
|
||||||
NSURL *styleSheetURL = [[NSBundle mainBundle] URLForResource:@"darkmode" withExtension:@"css"];
|
NSURL *styleSheetURL = [[NSBundle mainBundle] URLForResource:@"darkmode" withExtension:@"css"];
|
||||||
NSString *styleSheetSource = [NSString stringWithContentsOfURL:styleSheetURL encoding:NSUTF8StringEncoding error:nil];
|
NSString *styleSheetSource = [NSString stringWithContentsOfURL:styleSheetURL encoding:NSUTF8StringEncoding error:nil];
|
||||||
_darkModeStyleSheet = [[_WKUserStyleSheet alloc] initWithSource:styleSheetSource forMainFrameOnly:NO];
|
_darkModeStyleSheet = [[DecodedClass(WKUserStyleSheetEncodedClassName) alloc] initWithSource:styleSheetSource forMainFrameOnly:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
[userContentController _addUserStyleSheet:_darkModeStyleSheet];
|
[userContentController __addUserStyleSheet:_darkModeStyleSheet];
|
||||||
} else if (_darkModeStyleSheet) {
|
} else if (_darkModeStyleSheet) {
|
||||||
[userContentController _removeUserStyleSheet:_darkModeStyleSheet];
|
[userContentController __removeUserStyleSheet:_darkModeStyleSheet];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)parseDocumentForReaderMode:(void (^)(NSString * _Nonnull))completionBlock
|
- (void)parseDocumentForReaderMode:(void (^)(NSString * _Nonnull))completionBlock
|
||||||
{
|
{
|
||||||
WKUserContentController *userContentController = [_webViewConfiguration userContentController];
|
WKUserContentController *userContentController = [_webViewConfiguration userContentController];
|
||||||
@@ -241,16 +343,17 @@
|
|||||||
_readabilityScript = [self _loadScriptForResource:@"Readability" withExtension:@"js"];
|
_readabilityScript = [self _loadScriptForResource:@"Readability" withExtension:@"js"];
|
||||||
}
|
}
|
||||||
|
|
||||||
[userContentController _addUserScriptImmediately:_readabilityScript];
|
[userContentController __addUserScriptImmediately:_readabilityScript];
|
||||||
|
|
||||||
NSString *script = @""
|
NSString *script = @""
|
||||||
"var documentClone = document.cloneNode(true);"
|
"var documentClone = document.cloneNode(true);"
|
||||||
"var article = new Readability(documentClone).parse();"
|
"var article = new Readability(documentClone).parse();"
|
||||||
"article.content";
|
"article.content";
|
||||||
|
|
||||||
|
os_log_t log = _log;
|
||||||
[_webView evaluateJavaScript:script completionHandler:^(NSString *result, NSError * _Nullable error) {
|
[_webView evaluateJavaScript:script completionHandler:^(NSString *result, NSError * _Nullable error) {
|
||||||
if (error != nil) {
|
if (error != nil) {
|
||||||
NSLog(@"Bridge: Readability error: %@", error.localizedDescription);
|
os_log_error(log, "Bridge: Readability error: %@", error.localizedDescription);
|
||||||
} else {
|
} else {
|
||||||
completionBlock(result);
|
completionBlock(result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,6 +77,10 @@ static CGFloat RoundToScale(CGFloat v, CGFloat s) {
|
|||||||
+ (UIImage *)iconRepresentationForPolicyType:(SBRScriptOriginPolicyType)policyType withConfiguration:(nonnull SBRScriptPolicyIconConfiguration *)configuration
|
+ (UIImage *)iconRepresentationForPolicyType:(SBRScriptOriginPolicyType)policyType withConfiguration:(nonnull SBRScriptPolicyIconConfiguration *)configuration
|
||||||
{
|
{
|
||||||
const CGSize size = [configuration size];
|
const CGSize size = [configuration size];
|
||||||
|
if (size.width < CGFLOAT_EPSILON || size.height < CGFLOAT_EPSILON) {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
UIFont *font = [UIFont boldSystemFontOfSize:size.height - 2];
|
UIFont *font = [UIFont boldSystemFontOfSize:size.height - 2];
|
||||||
NSDictionary<NSAttributedStringKey, id> *attrs = @{
|
NSDictionary<NSAttributedStringKey, id> *attrs = @{
|
||||||
NSFontAttributeName : font,
|
NSFontAttributeName : font,
|
||||||
|
|||||||
@@ -9,6 +9,18 @@ import Foundation
|
|||||||
|
|
||||||
class SearchProvider
|
class SearchProvider
|
||||||
{
|
{
|
||||||
|
// Build a provider from a URL template. Template should contain %q or %s
|
||||||
|
// which will be replaced with the sanitized query string.
|
||||||
|
static func fromTemplate(_ template: String) -> SearchProvider {
|
||||||
|
SearchProvider(resolver: { query in
|
||||||
|
let sanitized = query.sanitized()
|
||||||
|
let replaced = template
|
||||||
|
.replacingOccurrences(of: "%q", with: sanitized)
|
||||||
|
.replacingOccurrences(of: "%s", with: sanitized)
|
||||||
|
return URL(string: replaced) ?? URL(string: "https://google.com/search?q=\(sanitized)&gbv=1")!
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
static let google = SearchProvider(resolver: { query in
|
static let google = SearchProvider(resolver: { query in
|
||||||
// gbv=1: no JS
|
// gbv=1: no JS
|
||||||
URL(string: "https://google.com/search?q=\(query.sanitized())&gbv=1")!
|
URL(string: "https://google.com/search?q=\(query.sanitized())&gbv=1")!
|
||||||
|
|||||||
619
LICENSE.txt
Normal file
@@ -0,0 +1,619 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
28
README.md
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# Attractor
|
||||||
|
|
||||||
|
Attractor is a web browser for iOS and macOS prioritizing security and aggresive content filtering, and some nifty useful features.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Security Modes
|
||||||
|
|
||||||
|
Attractor aggresively filters unwanted web content and prevents arbitrary code execution (JavaScript) by default. I created a special browser for this purpose. Philosophically speaking, I believe the web should primarily be used as a document viewer (as originally intended by [Tim Berners-Lee](https://en.wikipedia.org/wiki/World_wide_web)). Interactive web applications are fine, but the *default* mode should be document viewing, which is why this security model exists.
|
||||||
|
|
||||||
|
Attractor operates in five "security modes":
|
||||||
|
1. **Alpha** (Default) All JavaScript is blocked, as well as web fonts and iframes.
|
||||||
|
2. **Bravo** Only embedded scripts are allowed. This means any JavaScript enclosed in `<script>` tags. Often this is enough to allow form validation to occur without issue.
|
||||||
|
3. **Charlie** Allows external JavaScript, but only from the same security origin. Meaning, if browsing `buzzert.net`, only external scripts from the domain `buzzert.net` (or subdomains) are allowed to execute.
|
||||||
|
4. **Delta** Allows external JavaScript, but only from a curated list of common CDNs.
|
||||||
|
5. **Echo** All scripts are allowed.
|
||||||
|
|
||||||
|
## Other features
|
||||||
|
|
||||||
|
- Dark mode (a very good one that uses low-level stylesheet injection to prevent flicker)
|
||||||
|
- Tab syncing
|
||||||
|
- Share via Email
|
||||||
|
- Reader Mode
|
||||||
|
- Arbitrary zoom scale
|
||||||
|
- User-defined scripts and stylesheets via UI
|
||||||
|
- Custom redirect rules
|
||||||
|
- Catalyst and iPadOS support
|
||||||
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
archiveVersion = 1;
|
archiveVersion = 1;
|
||||||
classes = {
|
classes = {
|
||||||
};
|
};
|
||||||
objectVersion = 50;
|
objectVersion = 70;
|
||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
@@ -22,15 +22,12 @@
|
|||||||
1AD3104325254FB900A4A952 /* FindOnPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AD3104225254FB900A4A952 /* FindOnPageViewController.swift */; };
|
1AD3104325254FB900A4A952 /* FindOnPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AD3104225254FB900A4A952 /* FindOnPageViewController.swift */; };
|
||||||
1AD310452525586B00A4A952 /* DocumentControlItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AD310442525586B00A4A952 /* DocumentControlItemView.swift */; };
|
1AD310452525586B00A4A952 /* DocumentControlItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AD310442525586B00A4A952 /* DocumentControlItemView.swift */; };
|
||||||
1ADFF46024C7DE53006DC7AE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ADFF45F24C7DE53006DC7AE /* AppDelegate.swift */; };
|
1ADFF46024C7DE53006DC7AE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ADFF45F24C7DE53006DC7AE /* AppDelegate.swift */; };
|
||||||
1ADFF46224C7DE53006DC7AE /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ADFF46124C7DE53006DC7AE /* SceneDelegate.swift */; };
|
1ADFF46224C7DE53006DC7AE /* BrowserSceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ADFF46124C7DE53006DC7AE /* BrowserSceneDelegate.swift */; };
|
||||||
1ADFF46924C7DE54006DC7AE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1ADFF46824C7DE54006DC7AE /* Assets.xcassets */; };
|
1ADFF46924C7DE54006DC7AE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1ADFF46824C7DE54006DC7AE /* Assets.xcassets */; };
|
||||||
1ADFF46C24C7DE54006DC7AE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1ADFF46A24C7DE54006DC7AE /* LaunchScreen.storyboard */; };
|
1ADFF46C24C7DE54006DC7AE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1ADFF46A24C7DE54006DC7AE /* LaunchScreen.storyboard */; };
|
||||||
1ADFF47424C7DE9C006DC7AE /* BrowserViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ADFF47324C7DE9C006DC7AE /* BrowserViewController.swift */; };
|
1ADFF47424C7DE9C006DC7AE /* BrowserViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ADFF47324C7DE9C006DC7AE /* BrowserViewController.swift */; };
|
||||||
1ADFF47924C7DFF8006DC7AE /* BrowserView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ADFF47824C7DFF8006DC7AE /* BrowserView.swift */; };
|
1ADFF47924C7DFF8006DC7AE /* BrowserView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ADFF47824C7DFF8006DC7AE /* BrowserView.swift */; };
|
||||||
1ADFF48424C8C12F006DC7AE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1ADFF48324C8C12F006DC7AE /* Foundation.framework */; };
|
|
||||||
1ADFF48D24C8C176006DC7AE /* SBRProcessBundleBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ADFF48C24C8C176006DC7AE /* SBRProcessBundleBridge.m */; };
|
1ADFF48D24C8C176006DC7AE /* SBRProcessBundleBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ADFF48C24C8C176006DC7AE /* SBRProcessBundleBridge.m */; };
|
||||||
1ADFF4A724C8C271006DC7AE /* SBrowserProcessBundle.bundle in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 1ADFF48124C8C12F006DC7AE /* SBrowserProcessBundle.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
|
||||||
1ADFF4AA24C8D477006DC7AE /* SBRProcessPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ADFF4A924C8D477006DC7AE /* SBRProcessPlugin.m */; };
|
|
||||||
1ADFF4AE24C8ED32006DC7AE /* ResourcePolicyManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ADFF4AD24C8ED32006DC7AE /* ResourcePolicyManager.swift */; };
|
1ADFF4AE24C8ED32006DC7AE /* ResourcePolicyManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ADFF4AD24C8ED32006DC7AE /* ResourcePolicyManager.swift */; };
|
||||||
1ADFF4C024CA6964006DC7AE /* URLBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ADFF4BF24CA6964006DC7AE /* URLBar.swift */; };
|
1ADFF4C024CA6964006DC7AE /* URLBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ADFF4BF24CA6964006DC7AE /* URLBar.swift */; };
|
||||||
1ADFF4C324CA6AF6006DC7AE /* Geometry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ADFF4C224CA6AF6006DC7AE /* Geometry.swift */; };
|
1ADFF4C324CA6AF6006DC7AE /* Geometry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ADFF4C224CA6AF6006DC7AE /* Geometry.swift */; };
|
||||||
@@ -40,11 +37,15 @@
|
|||||||
1ADFF4CD24CBB0C8006DC7AE /* ScriptOriginPolicyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ADFF4CC24CBB0C8006DC7AE /* ScriptOriginPolicyViewController.swift */; };
|
1ADFF4CD24CBB0C8006DC7AE /* ScriptOriginPolicyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ADFF4CC24CBB0C8006DC7AE /* ScriptOriginPolicyViewController.swift */; };
|
||||||
CD01D5A5254A10BB00189CDC /* TabBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD01D5A4254A10BB00189CDC /* TabBarView.swift */; };
|
CD01D5A5254A10BB00189CDC /* TabBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD01D5A4254A10BB00189CDC /* TabBarView.swift */; };
|
||||||
CD01D5AB254A206D00189CDC /* TabBarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD01D5AA254A206D00189CDC /* TabBarViewController.swift */; };
|
CD01D5AB254A206D00189CDC /* TabBarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD01D5AA254A206D00189CDC /* TabBarViewController.swift */; };
|
||||||
|
CD15332F297B6798009A7F3A /* HistoryBrowserViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD15332E297B6798009A7F3A /* HistoryBrowserViewController.swift */; };
|
||||||
|
CD153331297B6806009A7F3A /* HistoryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD153330297B6806009A7F3A /* HistoryView.swift */; };
|
||||||
CD16844D269E709400B8F8A5 /* Box.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD16844C269E709400B8F8A5 /* Box.swift */; };
|
CD16844D269E709400B8F8A5 /* Box.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD16844C269E709400B8F8A5 /* Box.swift */; };
|
||||||
CD19576D268BE95900E8089B /* GenericContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD19576C268BE95900E8089B /* GenericContentView.swift */; };
|
CD19576D268BE95900E8089B /* GenericContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD19576C268BE95900E8089B /* GenericContentView.swift */; };
|
||||||
CD361CF6271A3718006E9CA5 /* SBRScriptPolicy.m in Sources */ = {isa = PBXBuildFile; fileRef = CD361CF5271A3718006E9CA5 /* SBRScriptPolicy.m */; };
|
CD361CF6271A3718006E9CA5 /* SBRScriptPolicy.m in Sources */ = {isa = PBXBuildFile; fileRef = CD361CF5271A3718006E9CA5 /* SBRScriptPolicy.m */; };
|
||||||
CD470C4225DE056600AFBE0E /* BrowserViewController+WebKitDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD470C4125DE056600AFBE0E /* BrowserViewController+WebKitDelegate.swift */; };
|
CD470C4225DE056600AFBE0E /* BrowserViewController+WebKitDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD470C4125DE056600AFBE0E /* BrowserViewController+WebKitDelegate.swift */; };
|
||||||
CD470C4425DE070400AFBE0E /* BrowserViewController+Keyboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD470C4325DE070400AFBE0E /* BrowserViewController+Keyboard.swift */; };
|
CD470C4425DE070400AFBE0E /* BrowserViewController+Keyboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD470C4325DE070400AFBE0E /* BrowserViewController+Keyboard.swift */; };
|
||||||
|
CD4930D92E8B390200ADDE99 /* AddSearchEngineViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD4930D82E8B38FC00ADDE99 /* AddSearchEngineViewController.swift */; };
|
||||||
|
CD4930DB2E8B3F6500ADDE99 /* ManageSearchEnginesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD4930DA2E8B3F5B00ADDE99 /* ManageSearchEnginesViewController.swift */; };
|
||||||
CD7313E22705349700053347 /* ScriptPolicyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD7313E12705349700053347 /* ScriptPolicyViewController.swift */; };
|
CD7313E22705349700053347 /* ScriptPolicyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD7313E12705349700053347 /* ScriptPolicyViewController.swift */; };
|
||||||
CD7313E4270534B800053347 /* ScriptPolicyViewControllerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD7313E3270534B800053347 /* ScriptPolicyViewControllerDelegate.swift */; };
|
CD7313E4270534B800053347 /* ScriptPolicyViewControllerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD7313E3270534B800053347 /* ScriptPolicyViewControllerDelegate.swift */; };
|
||||||
CD7A7E9D2686A9A500E20BA3 /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD7A7E9C2686A9A500E20BA3 /* SettingsViewController.swift */; };
|
CD7A7E9D2686A9A500E20BA3 /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD7A7E9C2686A9A500E20BA3 /* SettingsViewController.swift */; };
|
||||||
@@ -57,10 +58,17 @@
|
|||||||
CD853BCE24E7763900D2BDCC /* BrowserHistory.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD853BCD24E7763900D2BDCC /* BrowserHistory.swift */; };
|
CD853BCE24E7763900D2BDCC /* BrowserHistory.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD853BCD24E7763900D2BDCC /* BrowserHistory.swift */; };
|
||||||
CD853BD124E778B800D2BDCC /* History.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = CD853BCF24E778B800D2BDCC /* History.xcdatamodeld */; };
|
CD853BD124E778B800D2BDCC /* History.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = CD853BCF24E778B800D2BDCC /* History.xcdatamodeld */; };
|
||||||
CD853BD424E77BF900D2BDCC /* HistoryItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD853BD324E77BF900D2BDCC /* HistoryItem.swift */; };
|
CD853BD424E77BF900D2BDCC /* HistoryItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD853BD324E77BF900D2BDCC /* HistoryItem.swift */; };
|
||||||
|
CD8ACBC22DC9A2F7008BF856 /* Hacks.m in Sources */ = {isa = PBXBuildFile; fileRef = CD8ACBC12DC9A2F7008BF856 /* Hacks.m */; };
|
||||||
|
CD8DBE7B2A85D892006A0FE0 /* LayoutLatch.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD8DBE7A2A85D892006A0FE0 /* LayoutLatch.swift */; };
|
||||||
|
CD936A3B289DB3380093A1AC /* TabInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD936A3A289DB3380093A1AC /* TabInfo.swift */; };
|
||||||
|
CD936A3D289DB88B0093A1AC /* UIView+Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD936A3C289DB88B0093A1AC /* UIView+Utils.swift */; };
|
||||||
CD97CF9225D5BE6F00288FEE /* NavigationControlsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD97CF9125D5BE6F00288FEE /* NavigationControlsView.swift */; };
|
CD97CF9225D5BE6F00288FEE /* NavigationControlsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD97CF9125D5BE6F00288FEE /* NavigationControlsView.swift */; };
|
||||||
CD9B88C2272201E900DAAB7E /* SBRScriptPolicy.m in Sources */ = {isa = PBXBuildFile; fileRef = CD361CF5271A3718006E9CA5 /* SBRScriptPolicy.m */; };
|
CDACE18C2C5B09F00053AB29 /* StringUtilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDACE18B2C5B09F00053AB29 /* StringUtilities.swift */; };
|
||||||
CDAD9CE8263A2DF200FF7199 /* DocumentControlsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDAD9CE7263A2DF200FF7199 /* DocumentControlsView.swift */; };
|
CDAD9CE8263A2DF200FF7199 /* DocumentControlsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDAD9CE7263A2DF200FF7199 /* DocumentControlsView.swift */; };
|
||||||
CDAD9CEA263A318F00FF7199 /* ShareableURL.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDAD9CE9263A318F00FF7199 /* ShareableURL.swift */; };
|
CDAD9CEA263A318F00FF7199 /* ShareableURL.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDAD9CE9263A318F00FF7199 /* ShareableURL.swift */; };
|
||||||
|
CDB6807D28B446FC007D787E /* ReaderSceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDB6807C28B446FC007D787E /* ReaderSceneDelegate.swift */; };
|
||||||
|
CDB6808728B4556B007D787E /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = CDB6808628B4556B007D787E /* Credits.rtf */; };
|
||||||
|
CDB6808928B4569F007D787E /* LICENSE.txt in Resources */ = {isa = PBXBuildFile; fileRef = CDB6808828B4569F007D787E /* LICENSE.txt */; };
|
||||||
CDC4A1CF25E9D8F7007D33C6 /* Tagger.js in Resources */ = {isa = PBXBuildFile; fileRef = CDC4A1CE25E9D8F7007D33C6 /* Tagger.js */; };
|
CDC4A1CF25E9D8F7007D33C6 /* Tagger.js in Resources */ = {isa = PBXBuildFile; fileRef = CDC4A1CE25E9D8F7007D33C6 /* Tagger.js */; };
|
||||||
CDC5DA3A25DB774D00BA8D99 /* Readability.js in Resources */ = {isa = PBXBuildFile; fileRef = CDC5DA3925DB774D00BA8D99 /* Readability.js */; };
|
CDC5DA3A25DB774D00BA8D99 /* Readability.js in Resources */ = {isa = PBXBuildFile; fileRef = CDC5DA3925DB774D00BA8D99 /* Readability.js */; };
|
||||||
CDC5DA3E25DB7C2C00BA8D99 /* ReaderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC5DA3D25DB7C2C00BA8D99 /* ReaderViewController.swift */; };
|
CDC5DA3E25DB7C2C00BA8D99 /* ReaderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC5DA3D25DB7C2C00BA8D99 /* ReaderViewController.swift */; };
|
||||||
@@ -73,20 +81,11 @@
|
|||||||
CDE6A30425F023BC00E912A4 /* AmberSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDE6A30325F023BC00E912A4 /* AmberSettingsViewController.swift */; };
|
CDE6A30425F023BC00E912A4 /* AmberSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDE6A30325F023BC00E912A4 /* AmberSettingsViewController.swift */; };
|
||||||
CDE6A30625F023EA00E912A4 /* AmberSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDE6A30525F023EA00E912A4 /* AmberSettingsView.swift */; };
|
CDE6A30625F023EA00E912A4 /* AmberSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDE6A30525F023EA00E912A4 /* AmberSettingsView.swift */; };
|
||||||
CDEDD8AA25D62ADB00862605 /* UITraitCollection+MacLike.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDEDD8A925D62ADB00862605 /* UITraitCollection+MacLike.swift */; };
|
CDEDD8AA25D62ADB00862605 /* UITraitCollection+MacLike.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDEDD8A925D62ADB00862605 /* UITraitCollection+MacLike.swift */; };
|
||||||
|
CDF255FD289DD7CF0059F021 /* AttractorServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDF255FC289DD7CF0059F021 /* AttractorServer.swift */; };
|
||||||
CDF3468E276C105900FB3141 /* SettingsSceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDF3468D276C105900FB3141 /* SettingsSceneDelegate.swift */; };
|
CDF3468E276C105900FB3141 /* SettingsSceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDF3468D276C105900FB3141 /* SettingsSceneDelegate.swift */; };
|
||||||
CDF34690276C14BD00FB3141 /* CodeEditorSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDF3468F276C14BD00FB3141 /* CodeEditorSettingsViewController.swift */; };
|
CDF34690276C14BD00FB3141 /* CodeEditorSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDF3468F276C14BD00FB3141 /* CodeEditorSettingsViewController.swift */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
|
||||||
1ADFF48E24C8C230006DC7AE /* PBXContainerItemProxy */ = {
|
|
||||||
isa = PBXContainerItemProxy;
|
|
||||||
containerPortal = 1ADFF45424C7DE53006DC7AE /* Project object */;
|
|
||||||
proxyType = 1;
|
|
||||||
remoteGlobalIDString = 1ADFF48024C8C12F006DC7AE;
|
|
||||||
remoteInfo = SBrowserProcessBundle;
|
|
||||||
};
|
|
||||||
/* End PBXContainerItemProxy section */
|
|
||||||
|
|
||||||
/* Begin PBXCopyFilesBuildPhase section */
|
/* Begin PBXCopyFilesBuildPhase section */
|
||||||
1ADFF4A124C8C25B006DC7AE /* Embed App Extensions */ = {
|
1ADFF4A124C8C25B006DC7AE /* Embed App Extensions */ = {
|
||||||
isa = PBXCopyFilesBuildPhase;
|
isa = PBXCopyFilesBuildPhase;
|
||||||
@@ -94,7 +93,6 @@
|
|||||||
dstPath = "";
|
dstPath = "";
|
||||||
dstSubfolderSpec = 13;
|
dstSubfolderSpec = 13;
|
||||||
files = (
|
files = (
|
||||||
1ADFF4A724C8C271006DC7AE /* SBrowserProcessBundle.bundle in Embed App Extensions */,
|
|
||||||
);
|
);
|
||||||
name = "Embed App Extensions";
|
name = "Embed App Extensions";
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
@@ -118,23 +116,17 @@
|
|||||||
1AD310442525586B00A4A952 /* DocumentControlItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DocumentControlItemView.swift; sourceTree = "<group>"; };
|
1AD310442525586B00A4A952 /* DocumentControlItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DocumentControlItemView.swift; sourceTree = "<group>"; };
|
||||||
1ADFF45C24C7DE53006DC7AE /* Attractor.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Attractor.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
1ADFF45C24C7DE53006DC7AE /* Attractor.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Attractor.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
1ADFF45F24C7DE53006DC7AE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
1ADFF45F24C7DE53006DC7AE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||||
1ADFF46124C7DE53006DC7AE /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
|
1ADFF46124C7DE53006DC7AE /* BrowserSceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrowserSceneDelegate.swift; sourceTree = "<group>"; };
|
||||||
1ADFF46824C7DE54006DC7AE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
1ADFF46824C7DE54006DC7AE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||||
1ADFF46B24C7DE54006DC7AE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
1ADFF46B24C7DE54006DC7AE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||||
1ADFF46D24C7DE54006DC7AE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
1ADFF46D24C7DE54006DC7AE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
1ADFF47324C7DE9C006DC7AE /* BrowserViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrowserViewController.swift; sourceTree = "<group>"; };
|
1ADFF47324C7DE9C006DC7AE /* BrowserViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrowserViewController.swift; sourceTree = "<group>"; };
|
||||||
1ADFF47524C7DF20006DC7AE /* SBrowser.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = SBrowser.entitlements; sourceTree = "<group>"; };
|
1ADFF47524C7DF20006DC7AE /* SBrowser.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = SBrowser.entitlements; sourceTree = "<group>"; };
|
||||||
1ADFF47824C7DFF8006DC7AE /* BrowserView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrowserView.swift; sourceTree = "<group>"; };
|
1ADFF47824C7DFF8006DC7AE /* BrowserView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrowserView.swift; sourceTree = "<group>"; };
|
||||||
1ADFF48124C8C12F006DC7AE /* SBrowserProcessBundle.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SBrowserProcessBundle.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
||||||
1ADFF48324C8C12F006DC7AE /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
1ADFF48324C8C12F006DC7AE /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||||
1ADFF48624C8C12F006DC7AE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
|
||||||
1ADFF48A24C8C176006DC7AE /* SBrowser-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SBrowser-Bridging-Header.h"; sourceTree = "<group>"; };
|
1ADFF48A24C8C176006DC7AE /* SBrowser-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SBrowser-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||||
1ADFF48B24C8C176006DC7AE /* SBRProcessBundleBridge.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SBRProcessBundleBridge.h; sourceTree = "<group>"; };
|
1ADFF48B24C8C176006DC7AE /* SBRProcessBundleBridge.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SBRProcessBundleBridge.h; sourceTree = "<group>"; };
|
||||||
1ADFF48C24C8C176006DC7AE /* SBRProcessBundleBridge.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SBRProcessBundleBridge.m; sourceTree = "<group>"; };
|
1ADFF48C24C8C176006DC7AE /* SBRProcessBundleBridge.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SBRProcessBundleBridge.m; sourceTree = "<group>"; };
|
||||||
1ADFF4A824C8D476006DC7AE /* SBRProcessPlugin.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SBRProcessPlugin.h; sourceTree = "<group>"; };
|
|
||||||
1ADFF4A924C8D477006DC7AE /* SBRProcessPlugin.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SBRProcessPlugin.m; sourceTree = "<group>"; };
|
|
||||||
1ADFF4AB24C8DF62006DC7AE /* SBRWebProcessDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SBRWebProcessDelegate.h; sourceTree = "<group>"; };
|
|
||||||
1ADFF4AC24C8DFEE006DC7AE /* SBRWebProcessProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SBRWebProcessProxy.h; sourceTree = "<group>"; };
|
|
||||||
1ADFF4AD24C8ED32006DC7AE /* ResourcePolicyManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResourcePolicyManager.swift; sourceTree = "<group>"; };
|
1ADFF4AD24C8ED32006DC7AE /* ResourcePolicyManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResourcePolicyManager.swift; sourceTree = "<group>"; };
|
||||||
1ADFF4BF24CA6964006DC7AE /* URLBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLBar.swift; sourceTree = "<group>"; };
|
1ADFF4BF24CA6964006DC7AE /* URLBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLBar.swift; sourceTree = "<group>"; };
|
||||||
1ADFF4C224CA6AF6006DC7AE /* Geometry.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Geometry.swift; sourceTree = "<group>"; };
|
1ADFF4C224CA6AF6006DC7AE /* Geometry.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Geometry.swift; sourceTree = "<group>"; };
|
||||||
@@ -144,12 +136,17 @@
|
|||||||
1ADFF4CC24CBB0C8006DC7AE /* ScriptOriginPolicyViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScriptOriginPolicyViewController.swift; sourceTree = "<group>"; };
|
1ADFF4CC24CBB0C8006DC7AE /* ScriptOriginPolicyViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScriptOriginPolicyViewController.swift; sourceTree = "<group>"; };
|
||||||
CD01D5A4254A10BB00189CDC /* TabBarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarView.swift; sourceTree = "<group>"; };
|
CD01D5A4254A10BB00189CDC /* TabBarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarView.swift; sourceTree = "<group>"; };
|
||||||
CD01D5AA254A206D00189CDC /* TabBarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarViewController.swift; sourceTree = "<group>"; };
|
CD01D5AA254A206D00189CDC /* TabBarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarViewController.swift; sourceTree = "<group>"; };
|
||||||
|
CD15332E297B6798009A7F3A /* HistoryBrowserViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryBrowserViewController.swift; sourceTree = "<group>"; };
|
||||||
|
CD153330297B6806009A7F3A /* HistoryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryView.swift; sourceTree = "<group>"; };
|
||||||
CD16844C269E709400B8F8A5 /* Box.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Box.swift; sourceTree = "<group>"; };
|
CD16844C269E709400B8F8A5 /* Box.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Box.swift; sourceTree = "<group>"; };
|
||||||
CD19576C268BE95900E8089B /* GenericContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GenericContentView.swift; sourceTree = "<group>"; };
|
CD19576C268BE95900E8089B /* GenericContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GenericContentView.swift; sourceTree = "<group>"; };
|
||||||
CD361CF4271A3718006E9CA5 /* SBRScriptPolicy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SBRScriptPolicy.h; sourceTree = "<group>"; };
|
CD361CF4271A3718006E9CA5 /* SBRScriptPolicy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SBRScriptPolicy.h; sourceTree = "<group>"; };
|
||||||
CD361CF5271A3718006E9CA5 /* SBRScriptPolicy.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SBRScriptPolicy.m; sourceTree = "<group>"; };
|
CD361CF5271A3718006E9CA5 /* SBRScriptPolicy.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SBRScriptPolicy.m; sourceTree = "<group>"; };
|
||||||
|
CD3D6CED2DA9F8910099667F /* WebKitDefines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebKitDefines.h; sourceTree = "<group>"; };
|
||||||
CD470C4125DE056600AFBE0E /* BrowserViewController+WebKitDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BrowserViewController+WebKitDelegate.swift"; sourceTree = "<group>"; };
|
CD470C4125DE056600AFBE0E /* BrowserViewController+WebKitDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BrowserViewController+WebKitDelegate.swift"; sourceTree = "<group>"; };
|
||||||
CD470C4325DE070400AFBE0E /* BrowserViewController+Keyboard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BrowserViewController+Keyboard.swift"; sourceTree = "<group>"; };
|
CD470C4325DE070400AFBE0E /* BrowserViewController+Keyboard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BrowserViewController+Keyboard.swift"; sourceTree = "<group>"; };
|
||||||
|
CD4930D82E8B38FC00ADDE99 /* AddSearchEngineViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddSearchEngineViewController.swift; sourceTree = "<group>"; };
|
||||||
|
CD4930DA2E8B3F5B00ADDE99 /* ManageSearchEnginesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ManageSearchEnginesViewController.swift; sourceTree = "<group>"; };
|
||||||
CD7313E12705349700053347 /* ScriptPolicyViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScriptPolicyViewController.swift; sourceTree = "<group>"; };
|
CD7313E12705349700053347 /* ScriptPolicyViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScriptPolicyViewController.swift; sourceTree = "<group>"; };
|
||||||
CD7313E3270534B800053347 /* ScriptPolicyViewControllerDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScriptPolicyViewControllerDelegate.swift; sourceTree = "<group>"; };
|
CD7313E3270534B800053347 /* ScriptPolicyViewControllerDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScriptPolicyViewControllerDelegate.swift; sourceTree = "<group>"; };
|
||||||
CD7A7E9C2686A9A500E20BA3 /* SettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = "<group>"; };
|
CD7A7E9C2686A9A500E20BA3 /* SettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = "<group>"; };
|
||||||
@@ -162,9 +159,18 @@
|
|||||||
CD853BCD24E7763900D2BDCC /* BrowserHistory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrowserHistory.swift; sourceTree = "<group>"; };
|
CD853BCD24E7763900D2BDCC /* BrowserHistory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrowserHistory.swift; sourceTree = "<group>"; };
|
||||||
CD853BD024E778B800D2BDCC /* History.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = History.xcdatamodel; sourceTree = "<group>"; };
|
CD853BD024E778B800D2BDCC /* History.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = History.xcdatamodel; sourceTree = "<group>"; };
|
||||||
CD853BD324E77BF900D2BDCC /* HistoryItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryItem.swift; sourceTree = "<group>"; };
|
CD853BD324E77BF900D2BDCC /* HistoryItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryItem.swift; sourceTree = "<group>"; };
|
||||||
|
CD8ACBC02DC9A2F7008BF856 /* Hacks.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Hacks.h; sourceTree = "<group>"; };
|
||||||
|
CD8ACBC12DC9A2F7008BF856 /* Hacks.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Hacks.m; sourceTree = "<group>"; };
|
||||||
|
CD8DBE7A2A85D892006A0FE0 /* LayoutLatch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LayoutLatch.swift; sourceTree = "<group>"; };
|
||||||
|
CD936A3A289DB3380093A1AC /* TabInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabInfo.swift; sourceTree = "<group>"; };
|
||||||
|
CD936A3C289DB88B0093A1AC /* UIView+Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Utils.swift"; sourceTree = "<group>"; };
|
||||||
CD97CF9125D5BE6F00288FEE /* NavigationControlsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationControlsView.swift; sourceTree = "<group>"; };
|
CD97CF9125D5BE6F00288FEE /* NavigationControlsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationControlsView.swift; sourceTree = "<group>"; };
|
||||||
|
CDACE18B2C5B09F00053AB29 /* StringUtilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringUtilities.swift; sourceTree = "<group>"; };
|
||||||
CDAD9CE7263A2DF200FF7199 /* DocumentControlsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DocumentControlsView.swift; sourceTree = "<group>"; };
|
CDAD9CE7263A2DF200FF7199 /* DocumentControlsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DocumentControlsView.swift; sourceTree = "<group>"; };
|
||||||
CDAD9CE9263A318F00FF7199 /* ShareableURL.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareableURL.swift; sourceTree = "<group>"; };
|
CDAD9CE9263A318F00FF7199 /* ShareableURL.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareableURL.swift; sourceTree = "<group>"; };
|
||||||
|
CDB6807C28B446FC007D787E /* ReaderSceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReaderSceneDelegate.swift; sourceTree = "<group>"; };
|
||||||
|
CDB6808628B4556B007D787E /* Credits.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = Credits.rtf; sourceTree = "<group>"; };
|
||||||
|
CDB6808828B4569F007D787E /* LICENSE.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE.txt; sourceTree = "<group>"; };
|
||||||
CDC4A1CE25E9D8F7007D33C6 /* Tagger.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = Tagger.js; sourceTree = "<group>"; };
|
CDC4A1CE25E9D8F7007D33C6 /* Tagger.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = Tagger.js; sourceTree = "<group>"; };
|
||||||
CDC5DA3925DB774D00BA8D99 /* Readability.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = Readability.js; sourceTree = "<group>"; };
|
CDC5DA3925DB774D00BA8D99 /* Readability.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = Readability.js; sourceTree = "<group>"; };
|
||||||
CDC5DA3D25DB7C2C00BA8D99 /* ReaderViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReaderViewController.swift; sourceTree = "<group>"; };
|
CDC5DA3D25DB7C2C00BA8D99 /* ReaderViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReaderViewController.swift; sourceTree = "<group>"; };
|
||||||
@@ -177,10 +183,15 @@
|
|||||||
CDE6A30325F023BC00E912A4 /* AmberSettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmberSettingsViewController.swift; sourceTree = "<group>"; };
|
CDE6A30325F023BC00E912A4 /* AmberSettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmberSettingsViewController.swift; sourceTree = "<group>"; };
|
||||||
CDE6A30525F023EA00E912A4 /* AmberSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmberSettingsView.swift; sourceTree = "<group>"; };
|
CDE6A30525F023EA00E912A4 /* AmberSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmberSettingsView.swift; sourceTree = "<group>"; };
|
||||||
CDEDD8A925D62ADB00862605 /* UITraitCollection+MacLike.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITraitCollection+MacLike.swift"; sourceTree = "<group>"; };
|
CDEDD8A925D62ADB00862605 /* UITraitCollection+MacLike.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITraitCollection+MacLike.swift"; sourceTree = "<group>"; };
|
||||||
|
CDF255FC289DD7CF0059F021 /* AttractorServer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttractorServer.swift; sourceTree = "<group>"; };
|
||||||
CDF3468D276C105900FB3141 /* SettingsSceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsSceneDelegate.swift; sourceTree = "<group>"; };
|
CDF3468D276C105900FB3141 /* SettingsSceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsSceneDelegate.swift; sourceTree = "<group>"; };
|
||||||
CDF3468F276C14BD00FB3141 /* CodeEditorSettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodeEditorSettingsViewController.swift; sourceTree = "<group>"; };
|
CDF3468F276C14BD00FB3141 /* CodeEditorSettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodeEditorSettingsViewController.swift; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
|
/* Begin PBXFileSystemSynchronizedRootGroup section */
|
||||||
|
CDB73F3F2DA9F2F100DF4FAB /* WebKit Headers */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = "WebKit Headers"; sourceTree = "<group>"; };
|
||||||
|
/* End PBXFileSystemSynchronizedRootGroup section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
1ADFF45924C7DE53006DC7AE /* Frameworks */ = {
|
1ADFF45924C7DE53006DC7AE /* Frameworks */ = {
|
||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
@@ -189,14 +200,6 @@
|
|||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
1ADFF47E24C8C12F006DC7AE /* Frameworks */ = {
|
|
||||||
isa = PBXFrameworksBuildPhase;
|
|
||||||
buildActionMask = 2147483647;
|
|
||||||
files = (
|
|
||||||
1ADFF48424C8C12F006DC7AE /* Foundation.framework in Frameworks */,
|
|
||||||
);
|
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
|
||||||
};
|
|
||||||
/* End PBXFrameworksBuildPhase section */
|
/* End PBXFrameworksBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXGroup section */
|
/* Begin PBXGroup section */
|
||||||
@@ -219,6 +222,7 @@
|
|||||||
CDC5DA3925DB774D00BA8D99 /* Readability.js */,
|
CDC5DA3925DB774D00BA8D99 /* Readability.js */,
|
||||||
CDC4A1CE25E9D8F7007D33C6 /* Tagger.js */,
|
CDC4A1CE25E9D8F7007D33C6 /* Tagger.js */,
|
||||||
CDC5DA3F25DB7EAC00BA8D99 /* reader.html */,
|
CDC5DA3F25DB7EAC00BA8D99 /* reader.html */,
|
||||||
|
CDB6808628B4556B007D787E /* Credits.rtf */,
|
||||||
);
|
);
|
||||||
path = Resources;
|
path = Resources;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -227,6 +231,7 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
1A14FC2724D26749009B3F83 /* Tab.swift */,
|
1A14FC2724D26749009B3F83 /* Tab.swift */,
|
||||||
|
CD936A3A289DB3380093A1AC /* TabInfo.swift */,
|
||||||
CD01D5A4254A10BB00189CDC /* TabBarView.swift */,
|
CD01D5A4254A10BB00189CDC /* TabBarView.swift */,
|
||||||
CD01D5AA254A206D00189CDC /* TabBarViewController.swift */,
|
CD01D5AA254A206D00189CDC /* TabBarViewController.swift */,
|
||||||
1AB88EFC24D3BA560006F850 /* TabController.swift */,
|
1AB88EFC24D3BA560006F850 /* TabController.swift */,
|
||||||
@@ -259,8 +264,9 @@
|
|||||||
1ADFF45324C7DE53006DC7AE = {
|
1ADFF45324C7DE53006DC7AE = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
CDB6808828B4569F007D787E /* LICENSE.txt */,
|
||||||
1ADFF45E24C7DE53006DC7AE /* App */,
|
1ADFF45E24C7DE53006DC7AE /* App */,
|
||||||
1ADFF48524C8C12F006DC7AE /* SBrowserProcessBundle */,
|
CDB73F3F2DA9F2F100DF4FAB /* WebKit Headers */,
|
||||||
1ADFF48224C8C12F006DC7AE /* Frameworks */,
|
1ADFF48224C8C12F006DC7AE /* Frameworks */,
|
||||||
1ADFF45D24C7DE53006DC7AE /* Products */,
|
1ADFF45D24C7DE53006DC7AE /* Products */,
|
||||||
);
|
);
|
||||||
@@ -270,7 +276,6 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
1ADFF45C24C7DE53006DC7AE /* Attractor.app */,
|
1ADFF45C24C7DE53006DC7AE /* Attractor.app */,
|
||||||
1ADFF48124C8C12F006DC7AE /* SBrowserProcessBundle.bundle */,
|
|
||||||
);
|
);
|
||||||
name = Products;
|
name = Products;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -279,8 +284,6 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
1ADFF45F24C7DE53006DC7AE /* AppDelegate.swift */,
|
1ADFF45F24C7DE53006DC7AE /* AppDelegate.swift */,
|
||||||
1ADFF46124C7DE53006DC7AE /* SceneDelegate.swift */,
|
|
||||||
CDF3468D276C105900FB3141 /* SettingsSceneDelegate.swift */,
|
|
||||||
CD7A89162519872D0075991E /* KeyboardShortcuts.swift */,
|
CD7A89162519872D0075991E /* KeyboardShortcuts.swift */,
|
||||||
CD7A89132519759D0075991E /* Autocomplete */,
|
CD7A89132519759D0075991E /* Autocomplete */,
|
||||||
1ADFF47A24C7E176006DC7AE /* Backend */,
|
1ADFF47A24C7E176006DC7AE /* Backend */,
|
||||||
@@ -289,9 +292,12 @@
|
|||||||
CDCE2662251AA7FC007FE92A /* Document Controls UI */,
|
CDCE2662251AA7FC007FE92A /* Document Controls UI */,
|
||||||
1AD3104125254FA300A4A952 /* Find on Page */,
|
1AD3104125254FA300A4A952 /* Find on Page */,
|
||||||
CD7F2133265DACEE0001D042 /* Hacks */,
|
CD7F2133265DACEE0001D042 /* Hacks */,
|
||||||
|
CD15332D297B6784009A7F3A /* History UI */,
|
||||||
CDC5DA3C25DB7A5500BA8D99 /* Reader View */,
|
CDC5DA3C25DB7A5500BA8D99 /* Reader View */,
|
||||||
|
CDB6807B28B4456B007D787E /* Scene Delegates */,
|
||||||
1ADFF4CE24CBBCBD006DC7AE /* Script Policy UI */,
|
1ADFF4CE24CBBCBD006DC7AE /* Script Policy UI */,
|
||||||
CDE6A30225F023A000E912A4 /* Settings */,
|
CDE6A30225F023A000E912A4 /* Settings */,
|
||||||
|
CDF255FB289DD7BD0059F021 /* Sync */,
|
||||||
1AB88F0324D3E1EC0006F850 /* Tabs */,
|
1AB88F0324D3E1EC0006F850 /* Tabs */,
|
||||||
1AB88F0424D3E1F90006F850 /* Titlebar and URL Bar */,
|
1AB88F0424D3E1F90006F850 /* Titlebar and URL Bar */,
|
||||||
1ADFF4C124CA6AE4006DC7AE /* Utilities */,
|
1ADFF4C124CA6AE4006DC7AE /* Utilities */,
|
||||||
@@ -311,6 +317,7 @@
|
|||||||
1ADFF46824C7DE54006DC7AE /* Assets.xcassets */,
|
1ADFF46824C7DE54006DC7AE /* Assets.xcassets */,
|
||||||
1ADFF46A24C7DE54006DC7AE /* LaunchScreen.storyboard */,
|
1ADFF46A24C7DE54006DC7AE /* LaunchScreen.storyboard */,
|
||||||
1ADFF46D24C7DE54006DC7AE /* Info.plist */,
|
1ADFF46D24C7DE54006DC7AE /* Info.plist */,
|
||||||
|
CD3D6CED2DA9F8910099667F /* WebKitDefines.h */,
|
||||||
);
|
);
|
||||||
path = "Supporting Files";
|
path = "Supporting Files";
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -343,18 +350,6 @@
|
|||||||
name = Frameworks;
|
name = Frameworks;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
1ADFF48524C8C12F006DC7AE /* SBrowserProcessBundle */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
1ADFF48624C8C12F006DC7AE /* Info.plist */,
|
|
||||||
1ADFF4AB24C8DF62006DC7AE /* SBRWebProcessDelegate.h */,
|
|
||||||
1ADFF4AC24C8DFEE006DC7AE /* SBRWebProcessProxy.h */,
|
|
||||||
1ADFF4A824C8D476006DC7AE /* SBRProcessPlugin.h */,
|
|
||||||
1ADFF4A924C8D477006DC7AE /* SBRProcessPlugin.m */,
|
|
||||||
);
|
|
||||||
path = SBrowserProcessBundle;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
1ADFF4AF24C92E2F006DC7AE /* Web Process Bundle Bridge */ = {
|
1ADFF4AF24C92E2F006DC7AE /* Web Process Bundle Bridge */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@@ -375,6 +370,9 @@
|
|||||||
1ADFF4C624CA6DEB006DC7AE /* UIEdgeInsets+Layout.swift */,
|
1ADFF4C624CA6DEB006DC7AE /* UIEdgeInsets+Layout.swift */,
|
||||||
1AB88F0524D4D3A90006F850 /* UIGestureRecognizer+Actions.swift */,
|
1AB88F0524D4D3A90006F850 /* UIGestureRecognizer+Actions.swift */,
|
||||||
CDEDD8A925D62ADB00862605 /* UITraitCollection+MacLike.swift */,
|
CDEDD8A925D62ADB00862605 /* UITraitCollection+MacLike.swift */,
|
||||||
|
CD936A3C289DB88B0093A1AC /* UIView+Utils.swift */,
|
||||||
|
CD8DBE7A2A85D892006A0FE0 /* LayoutLatch.swift */,
|
||||||
|
CDACE18B2C5B09F00053AB29 /* StringUtilities.swift */,
|
||||||
);
|
);
|
||||||
path = Utilities;
|
path = Utilities;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -390,6 +388,15 @@
|
|||||||
path = "Script Policy UI";
|
path = "Script Policy UI";
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
CD15332D297B6784009A7F3A /* History UI */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
CD15332E297B6798009A7F3A /* HistoryBrowserViewController.swift */,
|
||||||
|
CD153330297B6806009A7F3A /* HistoryView.swift */,
|
||||||
|
);
|
||||||
|
path = "History UI";
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
CD7A7E9B2686A99600E20BA3 /* Amber */ = {
|
CD7A7E9B2686A99600E20BA3 /* Amber */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@@ -410,6 +417,8 @@
|
|||||||
CD7F2133265DACEE0001D042 /* Hacks */ = {
|
CD7F2133265DACEE0001D042 /* Hacks */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
CD8ACBC02DC9A2F7008BF856 /* Hacks.h */,
|
||||||
|
CD8ACBC12DC9A2F7008BF856 /* Hacks.m */,
|
||||||
CD7F2134265DAD010001D042 /* MFMailComposeViewControllerFix.m */,
|
CD7F2134265DAD010001D042 /* MFMailComposeViewControllerFix.m */,
|
||||||
);
|
);
|
||||||
path = Hacks;
|
path = Hacks;
|
||||||
@@ -426,6 +435,16 @@
|
|||||||
path = History;
|
path = History;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
CDB6807B28B4456B007D787E /* Scene Delegates */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
1ADFF46124C7DE53006DC7AE /* BrowserSceneDelegate.swift */,
|
||||||
|
CDF3468D276C105900FB3141 /* SettingsSceneDelegate.swift */,
|
||||||
|
CDB6807C28B446FC007D787E /* ReaderSceneDelegate.swift */,
|
||||||
|
);
|
||||||
|
path = "Scene Delegates";
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
CDC5DA3C25DB7A5500BA8D99 /* Reader View */ = {
|
CDC5DA3C25DB7A5500BA8D99 /* Reader View */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@@ -462,11 +481,21 @@
|
|||||||
CD7A7E9C2686A9A500E20BA3 /* SettingsViewController.swift */,
|
CD7A7E9C2686A9A500E20BA3 /* SettingsViewController.swift */,
|
||||||
CD7A7E9E2686B29100E20BA3 /* GeneralSettingsViewController.swift */,
|
CD7A7E9E2686B29100E20BA3 /* GeneralSettingsViewController.swift */,
|
||||||
CD7A7EA02686B2E600E20BA3 /* RedirectRulesSettingsViewController.swift */,
|
CD7A7EA02686B2E600E20BA3 /* RedirectRulesSettingsViewController.swift */,
|
||||||
|
CD4930D82E8B38FC00ADDE99 /* AddSearchEngineViewController.swift */,
|
||||||
|
CD4930DA2E8B3F5B00ADDE99 /* ManageSearchEnginesViewController.swift */,
|
||||||
CDF3468F276C14BD00FB3141 /* CodeEditorSettingsViewController.swift */,
|
CDF3468F276C14BD00FB3141 /* CodeEditorSettingsViewController.swift */,
|
||||||
);
|
);
|
||||||
path = Settings;
|
path = Settings;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
CDF255FB289DD7BD0059F021 /* Sync */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
CDF255FC289DD7CF0059F021 /* AttractorServer.swift */,
|
||||||
|
);
|
||||||
|
path = Sync;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
/* End PBXGroup section */
|
/* End PBXGroup section */
|
||||||
|
|
||||||
/* Begin PBXNativeTarget section */
|
/* Begin PBXNativeTarget section */
|
||||||
@@ -482,30 +511,12 @@
|
|||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
dependencies = (
|
dependencies = (
|
||||||
1ADFF48F24C8C230006DC7AE /* PBXTargetDependency */,
|
|
||||||
);
|
);
|
||||||
name = App;
|
name = App;
|
||||||
productName = SBrowser;
|
productName = SBrowser;
|
||||||
productReference = 1ADFF45C24C7DE53006DC7AE /* Attractor.app */;
|
productReference = 1ADFF45C24C7DE53006DC7AE /* Attractor.app */;
|
||||||
productType = "com.apple.product-type.application";
|
productType = "com.apple.product-type.application";
|
||||||
};
|
};
|
||||||
1ADFF48024C8C12F006DC7AE /* SBrowserProcessBundle */ = {
|
|
||||||
isa = PBXNativeTarget;
|
|
||||||
buildConfigurationList = 1ADFF48724C8C12F006DC7AE /* Build configuration list for PBXNativeTarget "SBrowserProcessBundle" */;
|
|
||||||
buildPhases = (
|
|
||||||
1ADFF47D24C8C12F006DC7AE /* Sources */,
|
|
||||||
1ADFF47E24C8C12F006DC7AE /* Frameworks */,
|
|
||||||
1ADFF47F24C8C12F006DC7AE /* Resources */,
|
|
||||||
);
|
|
||||||
buildRules = (
|
|
||||||
);
|
|
||||||
dependencies = (
|
|
||||||
);
|
|
||||||
name = SBrowserProcessBundle;
|
|
||||||
productName = SBrowserProcessBundle;
|
|
||||||
productReference = 1ADFF48124C8C12F006DC7AE /* SBrowserProcessBundle.bundle */;
|
|
||||||
productType = "com.apple.product-type.bundle";
|
|
||||||
};
|
|
||||||
/* End PBXNativeTarget section */
|
/* End PBXNativeTarget section */
|
||||||
|
|
||||||
/* Begin PBXProject section */
|
/* Begin PBXProject section */
|
||||||
@@ -519,9 +530,6 @@
|
|||||||
CreatedOnToolsVersion = 12.0;
|
CreatedOnToolsVersion = 12.0;
|
||||||
LastSwiftMigration = 1200;
|
LastSwiftMigration = 1200;
|
||||||
};
|
};
|
||||||
1ADFF48024C8C12F006DC7AE = {
|
|
||||||
CreatedOnToolsVersion = 12.0;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
buildConfigurationList = 1ADFF45724C7DE53006DC7AE /* Build configuration list for PBXProject "SBrowser" */;
|
buildConfigurationList = 1ADFF45724C7DE53006DC7AE /* Build configuration list for PBXProject "SBrowser" */;
|
||||||
@@ -538,7 +546,6 @@
|
|||||||
projectRoot = "";
|
projectRoot = "";
|
||||||
targets = (
|
targets = (
|
||||||
1ADFF45B24C7DE53006DC7AE /* App */,
|
1ADFF45B24C7DE53006DC7AE /* App */,
|
||||||
1ADFF48024C8C12F006DC7AE /* SBrowserProcessBundle */,
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
/* End PBXProject section */
|
/* End PBXProject section */
|
||||||
@@ -552,18 +559,13 @@
|
|||||||
1A14FC2624D251BD009B3F83 /* darkmode.css in Resources */,
|
1A14FC2624D251BD009B3F83 /* darkmode.css in Resources */,
|
||||||
CDC5DA4025DB7EAC00BA8D99 /* reader.html in Resources */,
|
CDC5DA4025DB7EAC00BA8D99 /* reader.html in Resources */,
|
||||||
1ADFF46C24C7DE54006DC7AE /* LaunchScreen.storyboard in Resources */,
|
1ADFF46C24C7DE54006DC7AE /* LaunchScreen.storyboard in Resources */,
|
||||||
|
CDB6808928B4569F007D787E /* LICENSE.txt in Resources */,
|
||||||
1ADFF46924C7DE54006DC7AE /* Assets.xcassets in Resources */,
|
1ADFF46924C7DE54006DC7AE /* Assets.xcassets in Resources */,
|
||||||
|
CDB6808728B4556B007D787E /* Credits.rtf in Resources */,
|
||||||
CDC5DA3A25DB774D00BA8D99 /* Readability.js in Resources */,
|
CDC5DA3A25DB774D00BA8D99 /* Readability.js in Resources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
1ADFF47F24C8C12F006DC7AE /* Resources */ = {
|
|
||||||
isa = PBXResourcesBuildPhase;
|
|
||||||
buildActionMask = 2147483647;
|
|
||||||
files = (
|
|
||||||
);
|
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
|
||||||
};
|
|
||||||
/* End PBXResourcesBuildPhase section */
|
/* End PBXResourcesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXSourcesBuildPhase section */
|
/* Begin PBXSourcesBuildPhase section */
|
||||||
@@ -573,8 +575,10 @@
|
|||||||
files = (
|
files = (
|
||||||
1ADFF46024C7DE53006DC7AE /* AppDelegate.swift in Sources */,
|
1ADFF46024C7DE53006DC7AE /* AppDelegate.swift in Sources */,
|
||||||
1AD3104325254FB900A4A952 /* FindOnPageViewController.swift in Sources */,
|
1AD3104325254FB900A4A952 /* FindOnPageViewController.swift in Sources */,
|
||||||
|
CD4930D92E8B390200ADDE99 /* AddSearchEngineViewController.swift in Sources */,
|
||||||
1A03811424E73EB300826501 /* SegmentedReliefButton.swift in Sources */,
|
1A03811424E73EB300826501 /* SegmentedReliefButton.swift in Sources */,
|
||||||
1A03811024E71CF000826501 /* ReliefButton.swift in Sources */,
|
1A03811024E71CF000826501 /* ReliefButton.swift in Sources */,
|
||||||
|
CD8ACBC22DC9A2F7008BF856 /* Hacks.m in Sources */,
|
||||||
1A03811224E71EAA00826501 /* GradientView.swift in Sources */,
|
1A03811224E71EAA00826501 /* GradientView.swift in Sources */,
|
||||||
1ADFF4C024CA6964006DC7AE /* URLBar.swift in Sources */,
|
1ADFF4C024CA6964006DC7AE /* URLBar.swift in Sources */,
|
||||||
CDAD9CEA263A318F00FF7199 /* ShareableURL.swift in Sources */,
|
CDAD9CEA263A318F00FF7199 /* ShareableURL.swift in Sources */,
|
||||||
@@ -585,6 +589,7 @@
|
|||||||
CD470C4225DE056600AFBE0E /* BrowserViewController+WebKitDelegate.swift in Sources */,
|
CD470C4225DE056600AFBE0E /* BrowserViewController+WebKitDelegate.swift in Sources */,
|
||||||
CDEDD8AA25D62ADB00862605 /* UITraitCollection+MacLike.swift in Sources */,
|
CDEDD8AA25D62ADB00862605 /* UITraitCollection+MacLike.swift in Sources */,
|
||||||
CD7A8919251989C90075991E /* UIKeyCommand+ConvInit.swift in Sources */,
|
CD7A8919251989C90075991E /* UIKeyCommand+ConvInit.swift in Sources */,
|
||||||
|
CD936A3B289DB3380093A1AC /* TabInfo.swift in Sources */,
|
||||||
1ADFF4C724CA6DEB006DC7AE /* UIEdgeInsets+Layout.swift in Sources */,
|
1ADFF4C724CA6DEB006DC7AE /* UIEdgeInsets+Layout.swift in Sources */,
|
||||||
1ADFF4AE24C8ED32006DC7AE /* ResourcePolicyManager.swift in Sources */,
|
1ADFF4AE24C8ED32006DC7AE /* ResourcePolicyManager.swift in Sources */,
|
||||||
1ADFF47424C7DE9C006DC7AE /* BrowserViewController.swift in Sources */,
|
1ADFF47424C7DE9C006DC7AE /* BrowserViewController.swift in Sources */,
|
||||||
@@ -592,16 +597,21 @@
|
|||||||
CDCE2668251AAA9A007FE92A /* FontSizeAdjustView.swift in Sources */,
|
CDCE2668251AAA9A007FE92A /* FontSizeAdjustView.swift in Sources */,
|
||||||
CD01D5A5254A10BB00189CDC /* TabBarView.swift in Sources */,
|
CD01D5A5254A10BB00189CDC /* TabBarView.swift in Sources */,
|
||||||
1A03810D24E71CA700826501 /* ToolbarView.swift in Sources */,
|
1A03810D24E71CA700826501 /* ToolbarView.swift in Sources */,
|
||||||
|
CD936A3D289DB88B0093A1AC /* UIView+Utils.swift in Sources */,
|
||||||
CD470C4425DE070400AFBE0E /* BrowserViewController+Keyboard.swift in Sources */,
|
CD470C4425DE070400AFBE0E /* BrowserViewController+Keyboard.swift in Sources */,
|
||||||
|
CDB6807D28B446FC007D787E /* ReaderSceneDelegate.swift in Sources */,
|
||||||
CDD0522425F8055700DD1771 /* SearchProvider.swift in Sources */,
|
CDD0522425F8055700DD1771 /* SearchProvider.swift in Sources */,
|
||||||
CD853BD424E77BF900D2BDCC /* HistoryItem.swift in Sources */,
|
CD853BD424E77BF900D2BDCC /* HistoryItem.swift in Sources */,
|
||||||
|
CD15332F297B6798009A7F3A /* HistoryBrowserViewController.swift in Sources */,
|
||||||
1ADFF48D24C8C176006DC7AE /* SBRProcessBundleBridge.m in Sources */,
|
1ADFF48D24C8C176006DC7AE /* SBRProcessBundleBridge.m in Sources */,
|
||||||
1AB88F0624D4D3A90006F850 /* UIGestureRecognizer+Actions.swift in Sources */,
|
1AB88F0624D4D3A90006F850 /* UIGestureRecognizer+Actions.swift in Sources */,
|
||||||
CD7313E4270534B800053347 /* ScriptPolicyViewControllerDelegate.swift in Sources */,
|
CD7313E4270534B800053347 /* ScriptPolicyViewControllerDelegate.swift in Sources */,
|
||||||
1ADFF46224C7DE53006DC7AE /* SceneDelegate.swift in Sources */,
|
1ADFF46224C7DE53006DC7AE /* BrowserSceneDelegate.swift in Sources */,
|
||||||
CD16844D269E709400B8F8A5 /* Box.swift in Sources */,
|
CD16844D269E709400B8F8A5 /* Box.swift in Sources */,
|
||||||
CD853BCE24E7763900D2BDCC /* BrowserHistory.swift in Sources */,
|
CD853BCE24E7763900D2BDCC /* BrowserHistory.swift in Sources */,
|
||||||
1A03810B24E71C5600826501 /* ToolbarButtonContainerView.swift in Sources */,
|
1A03810B24E71C5600826501 /* ToolbarButtonContainerView.swift in Sources */,
|
||||||
|
CD8DBE7B2A85D892006A0FE0 /* LayoutLatch.swift in Sources */,
|
||||||
|
CD4930DB2E8B3F6500ADDE99 /* ManageSearchEnginesViewController.swift in Sources */,
|
||||||
CD7A7EA12686B2E600E20BA3 /* RedirectRulesSettingsViewController.swift in Sources */,
|
CD7A7EA12686B2E600E20BA3 /* RedirectRulesSettingsViewController.swift in Sources */,
|
||||||
1ADFF4CB24CB8278006DC7AE /* ScriptControllerIconView.swift in Sources */,
|
1ADFF4CB24CB8278006DC7AE /* ScriptControllerIconView.swift in Sources */,
|
||||||
CD7A8915251975B70075991E /* AutocompleteViewController.swift in Sources */,
|
CD7A8915251975B70075991E /* AutocompleteViewController.swift in Sources */,
|
||||||
@@ -609,11 +619,13 @@
|
|||||||
CDE6A30625F023EA00E912A4 /* AmberSettingsView.swift in Sources */,
|
CDE6A30625F023EA00E912A4 /* AmberSettingsView.swift in Sources */,
|
||||||
CD7A7E9D2686A9A500E20BA3 /* SettingsViewController.swift in Sources */,
|
CD7A7E9D2686A9A500E20BA3 /* SettingsViewController.swift in Sources */,
|
||||||
1AB88EFD24D3BA560006F850 /* TabController.swift in Sources */,
|
1AB88EFD24D3BA560006F850 /* TabController.swift in Sources */,
|
||||||
|
CDF255FD289DD7CF0059F021 /* AttractorServer.swift in Sources */,
|
||||||
1ADFF4C324CA6AF6006DC7AE /* Geometry.swift in Sources */,
|
1ADFF4C324CA6AF6006DC7AE /* Geometry.swift in Sources */,
|
||||||
CD7F2135265DAD010001D042 /* MFMailComposeViewControllerFix.m in Sources */,
|
CD7F2135265DAD010001D042 /* MFMailComposeViewControllerFix.m in Sources */,
|
||||||
CDAD9CE8263A2DF200FF7199 /* DocumentControlsView.swift in Sources */,
|
CDAD9CE8263A2DF200FF7199 /* DocumentControlsView.swift in Sources */,
|
||||||
1ADFF4C924CA793E006DC7AE /* ToolbarViewController.swift in Sources */,
|
1ADFF4C924CA793E006DC7AE /* ToolbarViewController.swift in Sources */,
|
||||||
CD7A89172519872D0075991E /* KeyboardShortcuts.swift in Sources */,
|
CD7A89172519872D0075991E /* KeyboardShortcuts.swift in Sources */,
|
||||||
|
CDACE18C2C5B09F00053AB29 /* StringUtilities.swift in Sources */,
|
||||||
1ADFF4CD24CBB0C8006DC7AE /* ScriptOriginPolicyViewController.swift in Sources */,
|
1ADFF4CD24CBB0C8006DC7AE /* ScriptOriginPolicyViewController.swift in Sources */,
|
||||||
CDE6A30425F023BC00E912A4 /* AmberSettingsViewController.swift in Sources */,
|
CDE6A30425F023BC00E912A4 /* AmberSettingsViewController.swift in Sources */,
|
||||||
1A14FC2824D26749009B3F83 /* Tab.swift in Sources */,
|
1A14FC2824D26749009B3F83 /* Tab.swift in Sources */,
|
||||||
@@ -623,6 +635,7 @@
|
|||||||
CD01D5AB254A206D00189CDC /* TabBarViewController.swift in Sources */,
|
CD01D5AB254A206D00189CDC /* TabBarViewController.swift in Sources */,
|
||||||
1ADFF47924C7DFF8006DC7AE /* BrowserView.swift in Sources */,
|
1ADFF47924C7DFF8006DC7AE /* BrowserView.swift in Sources */,
|
||||||
CDCE2664251AA80F007FE92A /* DocumentControlViewController.swift in Sources */,
|
CDCE2664251AA80F007FE92A /* DocumentControlViewController.swift in Sources */,
|
||||||
|
CD153331297B6806009A7F3A /* HistoryView.swift in Sources */,
|
||||||
CDF3468E276C105900FB3141 /* SettingsSceneDelegate.swift in Sources */,
|
CDF3468E276C105900FB3141 /* SettingsSceneDelegate.swift in Sources */,
|
||||||
1AB88EFF24D3BBA50006F850 /* TabPickerViewController.swift in Sources */,
|
1AB88EFF24D3BBA50006F850 /* TabPickerViewController.swift in Sources */,
|
||||||
CD19576D268BE95900E8089B /* GenericContentView.swift in Sources */,
|
CD19576D268BE95900E8089B /* GenericContentView.swift in Sources */,
|
||||||
@@ -632,25 +645,8 @@
|
|||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
1ADFF47D24C8C12F006DC7AE /* Sources */ = {
|
|
||||||
isa = PBXSourcesBuildPhase;
|
|
||||||
buildActionMask = 2147483647;
|
|
||||||
files = (
|
|
||||||
CD9B88C2272201E900DAAB7E /* SBRScriptPolicy.m in Sources */,
|
|
||||||
1ADFF4AA24C8D477006DC7AE /* SBRProcessPlugin.m in Sources */,
|
|
||||||
);
|
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
|
||||||
};
|
|
||||||
/* End PBXSourcesBuildPhase section */
|
/* End PBXSourcesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXTargetDependency section */
|
|
||||||
1ADFF48F24C8C230006DC7AE /* PBXTargetDependency */ = {
|
|
||||||
isa = PBXTargetDependency;
|
|
||||||
target = 1ADFF48024C8C12F006DC7AE /* SBrowserProcessBundle */;
|
|
||||||
targetProxy = 1ADFF48E24C8C230006DC7AE /* PBXContainerItemProxy */;
|
|
||||||
};
|
|
||||||
/* End PBXTargetDependency section */
|
|
||||||
|
|
||||||
/* Begin PBXVariantGroup section */
|
/* Begin PBXVariantGroup section */
|
||||||
1ADFF46A24C7DE54006DC7AE /* LaunchScreen.storyboard */ = {
|
1ADFF46A24C7DE54006DC7AE /* LaunchScreen.storyboard */ = {
|
||||||
isa = PBXVariantGroup;
|
isa = PBXVariantGroup;
|
||||||
@@ -716,11 +712,12 @@
|
|||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
HEADER_SEARCH_PATHS = "\"WebKit Headers\"";
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
SDKROOT = iphoneos.internal;
|
SDKROOT = iphoneos;
|
||||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
};
|
};
|
||||||
@@ -773,10 +770,11 @@
|
|||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
HEADER_SEARCH_PATHS = "\"WebKit Headers\"";
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
SDKROOT = iphoneos.internal;
|
SDKROOT = iphoneos;
|
||||||
SWIFT_COMPILATION_MODE = wholemodule;
|
SWIFT_COMPILATION_MODE = wholemodule;
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||||
VALIDATE_PRODUCT = YES;
|
VALIDATE_PRODUCT = YES;
|
||||||
@@ -790,12 +788,15 @@
|
|||||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = "App/Supporting Files/SBrowser.entitlements";
|
CODE_SIGN_ENTITLEMENTS = "App/Supporting Files/SBrowser.entitlements";
|
||||||
CODE_SIGN_IDENTITY = "-";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Manual;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 4;
|
CURRENT_PROJECT_VERSION = 5;
|
||||||
DEAD_CODE_STRIPPING = YES;
|
DEAD_CODE_STRIPPING = YES;
|
||||||
DEVELOPMENT_TEAM = DQQH5H6GBD;
|
DEVELOPMENT_TEAM = 3SJALV9BQ7;
|
||||||
INFOPLIST_FILE = "App/Supporting Files/Info.plist";
|
INFOPLIST_FILE = "App/Supporting Files/Info.plist";
|
||||||
|
INFOPLIST_KEY_CFBundleDisplayName = Attractor;
|
||||||
|
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
@@ -803,8 +804,11 @@
|
|||||||
MARKETING_VERSION = 4.0;
|
MARKETING_VERSION = 4.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = net.buzzert.attractor;
|
PRODUCT_BUNDLE_IDENTIFIER = net.buzzert.attractor;
|
||||||
PRODUCT_NAME = Attractor;
|
PRODUCT_NAME = Attractor;
|
||||||
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
|
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
||||||
SUPPORTS_MACCATALYST = YES;
|
SUPPORTS_MACCATALYST = YES;
|
||||||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
|
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
|
||||||
|
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "App/Supporting Files/SBrowser-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "App/Supporting Files/SBrowser-Bridging-Header.h";
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
@@ -819,12 +823,15 @@
|
|||||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = "App/Supporting Files/SBrowser.entitlements";
|
CODE_SIGN_ENTITLEMENTS = "App/Supporting Files/SBrowser.entitlements";
|
||||||
CODE_SIGN_IDENTITY = "-";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Manual;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 4;
|
CURRENT_PROJECT_VERSION = 5;
|
||||||
DEAD_CODE_STRIPPING = YES;
|
DEAD_CODE_STRIPPING = YES;
|
||||||
DEVELOPMENT_TEAM = DQQH5H6GBD;
|
DEVELOPMENT_TEAM = 3SJALV9BQ7;
|
||||||
INFOPLIST_FILE = "App/Supporting Files/Info.plist";
|
INFOPLIST_FILE = "App/Supporting Files/Info.plist";
|
||||||
|
INFOPLIST_KEY_CFBundleDisplayName = Attractor;
|
||||||
|
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
@@ -832,47 +839,17 @@
|
|||||||
MARKETING_VERSION = 4.0;
|
MARKETING_VERSION = 4.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = net.buzzert.attractor;
|
PRODUCT_BUNDLE_IDENTIFIER = net.buzzert.attractor;
|
||||||
PRODUCT_NAME = Attractor;
|
PRODUCT_NAME = Attractor;
|
||||||
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
|
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
||||||
SUPPORTS_MACCATALYST = YES;
|
SUPPORTS_MACCATALYST = YES;
|
||||||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
|
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
|
||||||
|
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "App/Supporting Files/SBrowser-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "App/Supporting Files/SBrowser-Bridging-Header.h";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2,6";
|
TARGETED_DEVICE_FAMILY = "1,2,6";
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
1ADFF48824C8C12F006DC7AE /* Debug */ = {
|
|
||||||
isa = XCBuildConfiguration;
|
|
||||||
buildSettings = {
|
|
||||||
DEAD_CODE_STRIPPING = YES;
|
|
||||||
INFOPLIST_FILE = SBrowserProcessBundle/Info.plist;
|
|
||||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
|
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = net.buzzert.SBrowserProcessBundle;
|
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
||||||
SDKROOT = iphoneos.internal;
|
|
||||||
STRIP_INSTALLED_PRODUCT = NO;
|
|
||||||
SUPPORTS_MACCATALYST = YES;
|
|
||||||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
|
|
||||||
TARGETED_DEVICE_FAMILY = "1,2,6";
|
|
||||||
WRAPPER_EXTENSION = bundle;
|
|
||||||
};
|
|
||||||
name = Debug;
|
|
||||||
};
|
|
||||||
1ADFF48924C8C12F006DC7AE /* Release */ = {
|
|
||||||
isa = XCBuildConfiguration;
|
|
||||||
buildSettings = {
|
|
||||||
DEAD_CODE_STRIPPING = YES;
|
|
||||||
INFOPLIST_FILE = SBrowserProcessBundle/Info.plist;
|
|
||||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
|
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = net.buzzert.SBrowserProcessBundle;
|
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
||||||
SDKROOT = iphoneos.internal;
|
|
||||||
SUPPORTS_MACCATALYST = YES;
|
|
||||||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
|
|
||||||
TARGETED_DEVICE_FAMILY = "1,2,6";
|
|
||||||
WRAPPER_EXTENSION = bundle;
|
|
||||||
};
|
|
||||||
name = Release;
|
|
||||||
};
|
|
||||||
/* End XCBuildConfiguration section */
|
/* End XCBuildConfiguration section */
|
||||||
|
|
||||||
/* Begin XCConfigurationList section */
|
/* Begin XCConfigurationList section */
|
||||||
@@ -894,15 +871,6 @@
|
|||||||
defaultConfigurationIsVisible = 0;
|
defaultConfigurationIsVisible = 0;
|
||||||
defaultConfigurationName = Release;
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
1ADFF48724C8C12F006DC7AE /* Build configuration list for PBXNativeTarget "SBrowserProcessBundle" */ = {
|
|
||||||
isa = XCConfigurationList;
|
|
||||||
buildConfigurations = (
|
|
||||||
1ADFF48824C8C12F006DC7AE /* Debug */,
|
|
||||||
1ADFF48924C8C12F006DC7AE /* Release */,
|
|
||||||
);
|
|
||||||
defaultConfigurationIsVisible = 0;
|
|
||||||
defaultConfigurationName = Release;
|
|
||||||
};
|
|
||||||
/* End XCConfigurationList section */
|
/* End XCConfigurationList section */
|
||||||
|
|
||||||
/* Begin XCVersionGroup section */
|
/* Begin XCVersionGroup section */
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "1400"
|
LastUpgradeVersion = "1600"
|
||||||
version = "1.7">
|
version = "1.7">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
buildImplicitDependencies = "YES">
|
buildImplicitDependencies = "YES"
|
||||||
|
buildArchitectures = "Automatic">
|
||||||
<BuildActionEntries>
|
<BuildActionEntries>
|
||||||
<BuildActionEntry
|
<BuildActionEntry
|
||||||
buildForTesting = "YES"
|
buildForTesting = "YES"
|
||||||
@@ -15,7 +16,7 @@
|
|||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "1ADFF45B24C7DE53006DC7AE"
|
BlueprintIdentifier = "1ADFF45B24C7DE53006DC7AE"
|
||||||
BuildableName = "rossler attix.app"
|
BuildableName = "Attractor.app"
|
||||||
BlueprintName = "App"
|
BlueprintName = "App"
|
||||||
ReferencedContainer = "container:SBrowser.xcodeproj">
|
ReferencedContainer = "container:SBrowser.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
@@ -26,9 +27,8 @@
|
|||||||
buildConfiguration = "Debug"
|
buildConfiguration = "Debug"
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
<Testables>
|
shouldAutocreateTestPlan = "YES">
|
||||||
</Testables>
|
|
||||||
</TestAction>
|
</TestAction>
|
||||||
<LaunchAction
|
<LaunchAction
|
||||||
buildConfiguration = "Debug"
|
buildConfiguration = "Debug"
|
||||||
@@ -39,25 +39,17 @@
|
|||||||
ignoresPersistentStateOnLaunch = "NO"
|
ignoresPersistentStateOnLaunch = "NO"
|
||||||
debugDocumentVersioning = "YES"
|
debugDocumentVersioning = "YES"
|
||||||
debugServiceExtension = "internal"
|
debugServiceExtension = "internal"
|
||||||
allowLocationSimulation = "YES"
|
allowLocationSimulation = "YES">
|
||||||
internalIOSLaunchStyle = "2">
|
|
||||||
<BuildableProductRunnable
|
<BuildableProductRunnable
|
||||||
runnableDebuggingMode = "0">
|
runnableDebuggingMode = "0">
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "1ADFF45B24C7DE53006DC7AE"
|
BlueprintIdentifier = "1ADFF45B24C7DE53006DC7AE"
|
||||||
BuildableName = "rossler attix.app"
|
BuildableName = "Attractor.app"
|
||||||
BlueprintName = "App"
|
BlueprintName = "App"
|
||||||
ReferencedContainer = "container:SBrowser.xcodeproj">
|
ReferencedContainer = "container:SBrowser.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</BuildableProductRunnable>
|
</BuildableProductRunnable>
|
||||||
<AdditionalOptions>
|
|
||||||
<AdditionalOption
|
|
||||||
key = "MallocScribble"
|
|
||||||
value = ""
|
|
||||||
isEnabled = "YES">
|
|
||||||
</AdditionalOption>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</LaunchAction>
|
</LaunchAction>
|
||||||
<ProfileAction
|
<ProfileAction
|
||||||
buildConfiguration = "Release"
|
buildConfiguration = "Release"
|
||||||
@@ -70,7 +62,7 @@
|
|||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "1ADFF45B24C7DE53006DC7AE"
|
BlueprintIdentifier = "1ADFF45B24C7DE53006DC7AE"
|
||||||
BuildableName = "rossler attix.app"
|
BuildableName = "Attractor.app"
|
||||||
BlueprintName = "App"
|
BlueprintName = "App"
|
||||||
ReferencedContainer = "container:SBrowser.xcodeproj">
|
ReferencedContainer = "container:SBrowser.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
@@ -83,7 +75,4 @@
|
|||||||
buildConfiguration = "Release"
|
buildConfiguration = "Release"
|
||||||
revealArchiveInOrganizer = "YES">
|
revealArchiveInOrganizer = "YES">
|
||||||
</ArchiveAction>
|
</ArchiveAction>
|
||||||
<InstallAction
|
|
||||||
buildConfiguration = "Release">
|
|
||||||
</InstallAction>
|
|
||||||
</Scheme>
|
</Scheme>
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
|
||||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
|
||||||
<key>CFBundleExecutable</key>
|
|
||||||
<string>$(EXECUTABLE_NAME)</string>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
|
||||||
<string>6.0</string>
|
|
||||||
<key>CFBundleName</key>
|
|
||||||
<string>$(PRODUCT_NAME)</string>
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
|
||||||
<key>CFBundleShortVersionString</key>
|
|
||||||
<string>1.0</string>
|
|
||||||
<key>CFBundleVersion</key>
|
|
||||||
<string>1</string>
|
|
||||||
<key>NSPrincipalClass</key>
|
|
||||||
<string>SBRProcessPlugin</string>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
//
|
|
||||||
// SBRProcessPlugin.h
|
|
||||||
// SBrowserProcessBundle
|
|
||||||
//
|
|
||||||
// Created by James Magahern on 7/22/20.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <WebKit/WKWebProcessPlugIn.h>
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface SBRProcessPlugin : NSObject <WKWebProcessPlugIn>
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,115 +0,0 @@
|
|||||||
//
|
|
||||||
// SBRProcessPlugin.m
|
|
||||||
// SBrowserProcessBundle
|
|
||||||
//
|
|
||||||
// Created by James Magahern on 7/22/20.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "SBRProcessPlugin.h"
|
|
||||||
|
|
||||||
#import "SBRWebProcessDelegate.h"
|
|
||||||
#import "SBRWebProcessProxy.h"
|
|
||||||
#import "SBRScriptPolicy.h"
|
|
||||||
|
|
||||||
#import <WebKit/_WKRemoteObjectInterface.h>
|
|
||||||
#import <WebKit/_WKRemoteObjectRegistry.h>
|
|
||||||
#import <WebKit/WKWebProcessPlugInBrowserContextController.h>
|
|
||||||
#import <WebKit/WKWebProcessPlugInBrowserContextControllerPrivate.h>
|
|
||||||
#import <WebKit/WKWebProcessPlugInFrame.h>
|
|
||||||
#import <WebKit/WKWebProcessPlugInLoadDelegate.h>
|
|
||||||
|
|
||||||
@interface SBRProcessPlugin () <WKWebProcessPlugInLoadDelegate, SBRWebProcessProxy>
|
|
||||||
|
|
||||||
@property (nonatomic, strong) id<SBRWebProcessDelegate> processDelegate;
|
|
||||||
|
|
||||||
@property (nonatomic, assign) BOOL allScriptsAllowed;
|
|
||||||
@property (nonatomic, strong) NSMutableSet<NSString *> *allowedResourceOrigins;
|
|
||||||
@property (nonatomic, strong) NSDictionary<NSString *, NSNumber *> *policyTypeByOrigin;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation SBRProcessPlugin
|
|
||||||
|
|
||||||
+ (void)initialize
|
|
||||||
{
|
|
||||||
[super initialize];
|
|
||||||
NSLog(@"SBRProcessPlugin Initialized");
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark <SBRWebProcessProxy>
|
|
||||||
|
|
||||||
- (void)hello
|
|
||||||
{
|
|
||||||
NSLog(@"SBRProcessPlugin: Helloooooo");
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)syncAllowedResourceOrigins:(NSArray<NSString *> *)allowedOrigins
|
|
||||||
{
|
|
||||||
_allowedResourceOrigins = [NSMutableSet setWithArray:allowedOrigins];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)syncPolicyTypes:(NSDictionary<NSString *,NSNumber *> *)policyTypes
|
|
||||||
{
|
|
||||||
_policyTypeByOrigin = policyTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setAllScriptsAllowed:(BOOL)allScriptsAllowed
|
|
||||||
{
|
|
||||||
_allScriptsAllowed = allScriptsAllowed;
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark <WKWebProcessPlugIn>
|
|
||||||
|
|
||||||
- (void)webProcessPlugIn:(WKWebProcessPlugInController *)plugInController initializeWithObject:(id)initializationObject
|
|
||||||
{
|
|
||||||
_allowedResourceOrigins = [[plugInController parameters] valueForKey:SBRGetAllowedOriginsKey()];
|
|
||||||
_allScriptsAllowed = [[[plugInController parameters] valueForKey:SBRGetAllScriptsAllowedKey()] boolValue];
|
|
||||||
_policyTypeByOrigin = [[plugInController parameters] valueForKey:SBRGetPolicyTypeByOriginKey()];
|
|
||||||
NSLog(@"SBRProcessPlugin: %lu origins allowed, all scripts allowed: %@ ", (unsigned long)_allowedResourceOrigins.count, _allScriptsAllowed ? @"YES" : @"NO");
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)webProcessPlugIn:(WKWebProcessPlugInController *)plugInController didCreateBrowserContextController:(WKWebProcessPlugInBrowserContextController *)browserContextController
|
|
||||||
{
|
|
||||||
_WKRemoteObjectInterface *proxyInterface = [_WKRemoteObjectInterface remoteObjectInterfaceWithProtocol:@protocol(SBRWebProcessProxy)];
|
|
||||||
[browserContextController._remoteObjectRegistry registerExportedObject:self interface:proxyInterface];
|
|
||||||
|
|
||||||
_WKRemoteObjectInterface *eventListenerInterface = [_WKRemoteObjectInterface remoteObjectInterfaceWithProtocol:@protocol(SBRWebProcessDelegate)];
|
|
||||||
self.processDelegate = [browserContextController._remoteObjectRegistry remoteObjectProxyWithInterface:eventListenerInterface];
|
|
||||||
|
|
||||||
browserContextController.loadDelegate = self;
|
|
||||||
|
|
||||||
[[self processDelegate] webProcessDidConnect];
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark <WKWebProcessPlugInLoadDelegate>
|
|
||||||
|
|
||||||
- (NSURLRequest *)webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController *)controller frame:(WKWebProcessPlugInFrame *)frame willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse
|
|
||||||
{
|
|
||||||
NSLog(@"SBRProcessPlugin: Sending request: %@", request);
|
|
||||||
if (_allowedResourceOrigins == nil) {
|
|
||||||
NSLog(@"Allowed resource origins should not be nil!!!!");
|
|
||||||
}
|
|
||||||
|
|
||||||
NSURL *requestURL = [request URL];
|
|
||||||
NSString *resourceOrigin = [requestURL host];
|
|
||||||
NSString *requestExtension = [requestURL pathExtension];
|
|
||||||
NSString *hostOrigin = [[[controller mainFrame] URL] host];
|
|
||||||
if (requestExtension.length > 0 && [requestExtension isEqualToString:@"js"]) {
|
|
||||||
NSNumber *policyType = [_policyTypeByOrigin objectForKey:hostOrigin];
|
|
||||||
NSLog(@"SBRProcessPlugin: Policy type for %@: %@", hostOrigin, policyType);
|
|
||||||
|
|
||||||
SBRScriptPolicy *policy = [[SBRScriptPolicy alloc] initWithSecurityOrigin:hostOrigin policyType:[policyType integerValue]];
|
|
||||||
if ([self allScriptsAllowed] || [policy allowsExternalJavaScriptResourceOrigin:resourceOrigin]) {
|
|
||||||
NSLog(@"SBRProcessPlugin: Policy allows script requestURL: %@", requestURL);
|
|
||||||
[[self processDelegate] webProcessDidAllowScriptWithOrigin:resourceOrigin];
|
|
||||||
} else {
|
|
||||||
NSLog(@"SBRProcessPlugin: Policy disallows script requestURL: %@", requestURL);
|
|
||||||
[[self processDelegate] webProcessDidBlockScriptWithOrigin:resourceOrigin];
|
|
||||||
|
|
||||||
request = nil;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return request;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
//
|
|
||||||
// SBRWebProcessDelegate.h
|
|
||||||
// SBrowser
|
|
||||||
//
|
|
||||||
// Created by James Magahern on 7/22/20.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
|
|
||||||
@protocol SBRWebProcessDelegate <NSObject>
|
|
||||||
|
|
||||||
- (void)webProcessDidConnect;
|
|
||||||
- (void)webProcessDidBlockScriptWithOrigin:(NSString *)origin;
|
|
||||||
- (void)webProcessDidAllowScriptWithOrigin:(NSString *)origin;
|
|
||||||
|
|
||||||
@end
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
//
|
|
||||||
// SBRWebProcessProxy.h
|
|
||||||
// SBrowser
|
|
||||||
//
|
|
||||||
// Created by James Magahern on 7/22/20.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
|
|
||||||
static inline NSString* SBRGetAllowedOriginsKey() {
|
|
||||||
return @"allowedOrigins";
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline NSString* SBRGetAllScriptsAllowedKey() {
|
|
||||||
return @"allScriptsAllowed";
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline NSString* SBRGetPolicyTypeByOriginKey() {
|
|
||||||
return @"policyTypeByOrigin";
|
|
||||||
}
|
|
||||||
|
|
||||||
@protocol SBRWebProcessProxy <NSObject>
|
|
||||||
|
|
||||||
- (void)hello;
|
|
||||||
- (void)setAllScriptsAllowed:(BOOL)allowed;
|
|
||||||
- (void)syncAllowedResourceOrigins:(NSArray<NSString *> *)allowedOrigins;
|
|
||||||
- (void)syncPolicyTypes:(NSDictionary<NSString *, NSNumber *> *)policyTypes;
|
|
||||||
|
|
||||||
@end
|
|
||||||
BIN
Screenshots/main.png
Normal file
|
After Width: | Height: | Size: 442 KiB |