Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
glushchenko committed Aug 12, 2024
1 parent 6c10cda commit 733a0d6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
4 changes: 3 additions & 1 deletion FSNotes/Business/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,8 @@ public class Project: Equatable {
}

private func fetchAllDirectories() -> [URL]? {
let maxDirs = UserDefaultsManagement.maxChildDirs

guard let fileEnumerator =
FileManager.default.enumerator(
at: url, includingPropertiesForKeys: nil,
Expand Down Expand Up @@ -981,7 +983,7 @@ public class Project: Equatable {
print("Error: ", error.localizedDescription)
}

if i > 200 {
if i > maxDirs {
break
}
}
Expand Down
4 changes: 3 additions & 1 deletion FSNotes/Business/Storage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,8 @@ class Storage {
}

private func fetchAllDirectories(url: URL) -> [URL]? {
let maxDirs = UserDefaultsManagement.maxChildDirs

guard let fileEnumerator =
FileManager.default.enumerator(
at: url, includingPropertiesForKeys: nil,
Expand Down Expand Up @@ -799,7 +801,7 @@ class Storage {
print("Error: ", error.localizedDescription)
}

if i > 200 {
if i > maxDirs {
break
}
}
Expand Down
20 changes: 20 additions & 0 deletions FSNotes/Helpers/UserDefaultsManagement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public class UserDefaultsManagement {
static let FontColorKey = "fontColorKeyed"
static let FullScreen = "fullScreen"
static let FirstLineAsTitle = "firstLineAsTitle"
static let MaxChildDirs = "maxChildDirs"
static let NoteType = "noteType"
static let NoteExtension = "noteExtension"
static let GrammarChecking = "grammarChecking"
Expand Down Expand Up @@ -1731,4 +1732,23 @@ public class UserDefaultsManagement {
}
}
}

static var maxChildDirs: Int {
get {
if let returnFontSize = shared?.object(forKey: Constants.MaxChildDirs),
let value = returnFontSize as? Int {

if value < 200 {
return 200
}

return value
}

return 200
}
set {
shared?.set(newValue, forKey: Constants.CodeFontSizeKey)
}
}
}

0 comments on commit 733a0d6

Please sign in to comment.