Skip to content

Commit

Permalink
- Fixes tags autocomplete
Browse files Browse the repository at this point in the history
- Fixes pop navigation controller for image preview
  • Loading branch information
glushchenko committed Sep 19, 2024
1 parent a2afe20 commit 3dc95a0
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 13 deletions.
4 changes: 2 additions & 2 deletions FSNotes iOS/CloudDriveManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -476,11 +476,11 @@ class CloudDriveManager {
projectsInsertionQueue.removeAll()

for note in insert {
note.forceLoad()
note.forceLoad(skipCreateDate: false, loadTags: false)
}

for note in change {
note.forceLoad(skipCreateDate: true)
note.forceLoad(skipCreateDate: true, loadTags: false)
}

OperationQueue.main.addOperation {
Expand Down
24 changes: 18 additions & 6 deletions FSNotes iOS/EditorViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -399,12 +399,17 @@ class EditorViewController: UIViewController, UITextViewDelegate, UIDocumentPick

let vc = UIApplication.getVC()

var projects = [Project]()
if let project = Storage.shared().searchQuery.projects.first {
let tags = vc.sidebarTableView.getAllTags(projects: [project])
self.dropDown.dataSource = tags.filter({ $0.starts(with: text) })

self.complete(offset: hashRange.location, text: text)
projects.append(project)
} else {
projects = Storage.shared().getProjects()
}

let tags = vc.sidebarTableView.getAllTags(projects: projects)
self.dropDown.dataSource = tags.filter({ $0.starts(with: text) })

self.complete(offset: hashRange.location, text: text)
}
}

Expand Down Expand Up @@ -971,8 +976,15 @@ class EditorViewController: UIViewController, UITextViewDelegate, UIDocumentPick
let location = editArea.selectedRange.location

let vc = UIApplication.getVC()
guard let project = Storage.shared().searchQuery.projects.first else { return }
let tags = vc.sidebarTableView.getAllTags(projects: [project])

var projects = [Project]()
if let project = Storage.shared().searchQuery.projects.first {
projects.append(project)
} else {
projects = Storage.shared().getProjects()
}

let tags = vc.sidebarTableView.getAllTags(projects: projects)
self.dropDown.dataSource = tags

self.complete(offset: location)
Expand Down
2 changes: 1 addition & 1 deletion FSNotes iOS/ImagePreviewViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class ImagePreviewViewController: UIViewController, CropViewControllerDelegate {
}
}

self.dismiss(animated: true)
self.navigationController?.popViewController(animated: true)
}

let cancelAction = UIAlertAction(title: NSLocalizedString("Cancel", comment: ""), style: .cancel) { (_) in }
Expand Down
2 changes: 1 addition & 1 deletion FSNotes iOS/View/SidebarTableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ class SidebarTableView: UITableView,
// resets tags in sidebar
removeTags(in: [note])

// reload tags (in remove tags operation notn fitted)
// reload tags (in remove tags operation non fitted)
_ = note.scanContentTags()

vc.notesTable.removeRows(notes: [note])
Expand Down
5 changes: 2 additions & 3 deletions FSNotes/Business/Note.swift
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ public class Note: NSObject {
}
}

public func forceLoad(skipCreateDate: Bool = false) {
public func forceLoad(skipCreateDate: Bool = false, loadTags: Bool = true) {
invalidateCache()
load()
load(tags: loadTags)

if !skipCreateDate {
loadCreationDate()
Expand Down Expand Up @@ -1313,7 +1313,6 @@ public class Note: NSObject {
}
}


self.tags = tags

return (added, removed)
Expand Down

0 comments on commit 3dc95a0

Please sign in to comment.