From a13aab99b21d186615d2fbf340ad1f127441c41d Mon Sep 17 00:00:00 2001 From: James Magahern Date: Thu, 16 Dec 2021 19:05:10 -0800 Subject: [PATCH] Customized user scripts/stylesheets: iPhone fixes --- App/Browser View/BrowserView.swift | 2 +- App/Settings/CodeEditorSettingsViewController.swift | 8 ++++++++ .../RedirectRulesSettingsViewController.swift | 9 +++++---- App/Supporting Files/Info.plist | 12 ++++++------ 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/App/Browser View/BrowserView.swift b/App/Browser View/BrowserView.swift index 1564275..1babaf6 100644 --- a/App/Browser View/BrowserView.swift +++ b/App/Browser View/BrowserView.swift @@ -120,7 +120,7 @@ class BrowserView: UIView // Compact: toolbar is at the bottom if traitCollection.horizontalSizeClass == .compact { var bottomOffset: CGFloat = 0.0 - if keyboardLayoutOffset == 0 { + if keyboardLayoutOffset < CGFloat.leastNonzeroMagnitude { toolbarSize.height += safeAreaInsets.bottom } else if toolbarView.urlBar?.textField.isFirstResponder ?? false { bottomOffset = keyboardLayoutOffset diff --git a/App/Settings/CodeEditorSettingsViewController.swift b/App/Settings/CodeEditorSettingsViewController.swift index ea68eff..ef54b43 100644 --- a/App/Settings/CodeEditorSettingsViewController.swift +++ b/App/Settings/CodeEditorSettingsViewController.swift @@ -14,6 +14,9 @@ class CodeEditorSettingsView: UIView override init(frame: CGRect) { super.init(frame: frame) + self.backgroundColor = UIColor.systemBackground + + textView.backgroundColor = UIColor.secondarySystemBackground textView.font = .monospacedSystemFont(ofSize: 12.0, weight: .regular) textView.autocorrectionType = .no textView.autocapitalizationType = .none @@ -66,6 +69,11 @@ class CodeEditorSettingsViewController: UIViewController, UITextViewDelegate settingsView.textView.text = Settings.shared[keyPath: settingsKeypath] } + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + saveContents() + } + private func saveContents() { Settings.shared[keyPath: settingsKeypath] = settingsView.textView.text! } diff --git a/App/Settings/RedirectRulesSettingsViewController.swift b/App/Settings/RedirectRulesSettingsViewController.swift index 81a09e5..94e7755 100644 --- a/App/Settings/RedirectRulesSettingsViewController.swift +++ b/App/Settings/RedirectRulesSettingsViewController.swift @@ -6,7 +6,6 @@ // import UIKit -import MachO class RedirectRulesSettingsViewController: UICollectionViewController { @@ -52,15 +51,17 @@ class RedirectRulesSettingsViewController: UICollectionViewController init() { let config = UICollectionLayoutListConfiguration(appearance: .insetGrouped) + + #if targetEnvironment(macCatalyst) let layout = UICollectionViewCompositionalLayout { section, layoutEnvironment in let listSection = NSCollectionLayoutSection.list(using: config, layoutEnvironment: layoutEnvironment) - - #if targetEnvironment(macCatalyst) listSection.contentInsets = NSDirectionalEdgeInsets(top: 24.0, leading: 164.0, bottom: 24.0, trailing: 164.0) - #endif return listSection } + #else + let layout = UICollectionViewCompositionalLayout.list(using: config) + #endif super.init(collectionViewLayout: layout) diff --git a/App/Supporting Files/Info.plist b/App/Supporting Files/Info.plist index aed86c0..b7c962a 100644 --- a/App/Supporting Files/Info.plist +++ b/App/Supporting Files/Info.plist @@ -49,18 +49,18 @@ UIWindowSceneSessionRoleApplication - - UISceneDelegateClassName - $(PRODUCT_MODULE_NAME).SettingsSceneDelegate - UISceneConfigurationName - Settings - UISceneConfigurationName Browser UISceneDelegateClassName $(PRODUCT_MODULE_NAME).SceneDelegate + + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SettingsSceneDelegate + UISceneConfigurationName + Settings +