Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 8 additions & 22 deletions Source/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import SwiftUI
class AppDelegate: UIResponder, UIApplicationDelegate {
var store = Store.shared

var notesTableViewController: NotesTableViewController?

///
/// Updated by being the `NextcloudKitDelegate`.
///
Expand All @@ -27,8 +25,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
}

private let operationQueue = OperationQueue()
private var updateFrcDelegateNeeded = true


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
NextcloudKit.shared.setup(delegate: self)

Expand Down Expand Up @@ -71,7 +68,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
UITableViewCell.appearance().backgroundColor = .ph_cellBackgroundColor

let scrollViewArray = [
NotesTableViewController.self,
CategoryTableViewController.self,
EditorViewController.self,
PreviewViewController.self,
Expand All @@ -95,8 +91,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
/// Scene lifecycle is adopted via ``SceneDelegate``; these handlers hold the shared behaviour it forwards.
///
func handleDidEnterBackground() {
notesTableViewController?.disableFetchedResultsController()
updateFrcDelegateNeeded = true
scheduleAppSync()
}

Expand All @@ -112,19 +106,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

func handleDidBecomeActive() {
store.synchronize()
updateFrcDelegateIfNeeded()
}

private func updateFrcDelegateIfNeeded() {
guard updateFrcDelegateNeeded else {
return
}

updateFrcDelegateNeeded = false
notesTableViewController?.configureFetchedResultsController(performFetch: KeychainHelper.didSyncInBackground)
KeychainHelper.didSyncInBackground = false
}


func scheduleAppSync() {
BGTaskScheduler.shared.cancelAllTaskRequests()
let request = BGAppRefreshTaskRequest(identifier: "com.peterandlinda.iOCNotes.Sync")
Expand Down Expand Up @@ -167,9 +150,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
if let queryItems = urlComponents?.queryItems,
let item = queryItems.first(where: { $0.name == "note" }),
let content = item.value {
// Make sure we connect the delegate up, as this is called before the app is active
updateFrcDelegateIfNeeded()
self.notesTableViewController?.addNote(content: content)
NoteSessionManager.shared.add(content: content, category: "") { note in
guard let note = note else { return }
DispatchQueue.main.async {
NotesPresenter.openEditor(for: note, isNewNote: true)
}
}
Comment on lines +153 to +158
}
} else if url.isFileURL {
do {
Expand Down
219 changes: 1 addition & 218 deletions Source/Base.lproj/Main_iPhone.storyboard

Large diffs are not rendered by default.

56 changes: 0 additions & 56 deletions Source/CategoriesSceneDelegate.swift

This file was deleted.

65 changes: 0 additions & 65 deletions Source/CollapsibleTableViewHeaderView.swift

This file was deleted.

67 changes: 0 additions & 67 deletions Source/CollapsibleTableViewHeaderView.xib

This file was deleted.

3 changes: 0 additions & 3 deletions Source/EditorViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@ class EditorViewController: UIViewController {
navigationController?.delegate = self
navigationController?.toolbar.isTranslucent = true
navigationController?.toolbar.clipsToBounds = true
if let splitVC = splitViewController as? PBHSplitViewController {
splitVC.editorViewController = self
}
updatedByEditing = false
self.observers.append(NotificationCenter.default.addObserver(forName: UIWindow.keyboardWillShowNotification,
object: nil,
Expand Down
27 changes: 0 additions & 27 deletions Source/NotesTableViewCell.swift

This file was deleted.

49 changes: 0 additions & 49 deletions Source/PBHPreviewController.swift

This file was deleted.

Loading