mirror of https://github.com/logseq/logseq
chore: run swiftlint
parent
503e33f614
commit
a8e35db725
|
@ -29,14 +29,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||
func applicationDidBecomeActive(_ application: UIApplication) {
|
||||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
|
||||
|
||||
}
|
||||
|
||||
func applicationWillTerminate(_ application: UIApplication) {
|
||||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
||||
}
|
||||
|
||||
func application(_ application: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
|
||||
func application(_ application: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
|
||||
return ApplicationDelegateProxy.shared.application(application, open: url, options: options)
|
||||
}
|
||||
|
||||
|
@ -48,4 +47,3 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -39,22 +39,19 @@ public class FileContainer: CAPPlugin, UIDocumentPickerDelegate {
|
|||
do {
|
||||
print("the url = " + url.path)
|
||||
try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true, attributes: nil)
|
||||
}
|
||||
catch {
|
||||
} catch {
|
||||
print("container doesn't exist")
|
||||
print(error.localizedDescription)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let str = ""
|
||||
let filename = url.appendingPathComponent(".logseq", isDirectory: false)
|
||||
|
||||
if !FileManager.default.fileExists(atPath: filename.path) {
|
||||
do {
|
||||
try str.write(to: filename, atomically: true, encoding: String.Encoding.utf8)
|
||||
}
|
||||
catch {
|
||||
} catch {
|
||||
print("write .logseq failed")
|
||||
print(error.localizedDescription)
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import MobileCoreServices
|
|||
@objc(FolderPicker)
|
||||
public class FolderPicker: CAPPlugin, UIDocumentPickerDelegate {
|
||||
|
||||
public var _call: CAPPluginCall? = nil
|
||||
public var _call: CAPPluginCall?
|
||||
|
||||
@objc func pickFolder(_ call: CAPPluginCall) {
|
||||
self._call = call
|
||||
|
@ -38,7 +38,7 @@ public class FolderPicker: CAPPlugin, UIDocumentPickerDelegate {
|
|||
public func documentPicker(
|
||||
_ controller: UIDocumentPickerViewController,
|
||||
didPickDocumentsAt urls: [URL]
|
||||
){
|
||||
) {
|
||||
var items: [String] = []
|
||||
let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ import Capacitor
|
|||
|
||||
@objc(FsWatcher)
|
||||
public class FsWatcher: CAPPlugin, PollingWatcherDelegate {
|
||||
private var watcher: PollingWatcher? = nil
|
||||
private var baseUrl: URL? = nil
|
||||
private var watcher: PollingWatcher?
|
||||
private var baseUrl: URL?
|
||||
|
||||
override public func load() {
|
||||
print("debug FsWatcher iOS plugin loaded!")
|
||||
|
@ -51,11 +51,11 @@ public class FsWatcher: CAPPlugin, PollingWatcherDelegate {
|
|||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||
self.notifyListeners("watcher", data: ["event": "unlink",
|
||||
"dir": self.baseUrl?.description as Any,
|
||||
"path": url.description,
|
||||
"path": url.description
|
||||
])
|
||||
}
|
||||
case .Add, .Change:
|
||||
var content: String? = nil
|
||||
var content: String?
|
||||
if url.shouldNotifyWithContent() {
|
||||
content = try? String(contentsOf: url, encoding: .utf8)
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ extension URL {
|
|||
if self.lastPathComponent.starts(with: ".") {
|
||||
return true
|
||||
}
|
||||
if self.absoluteString.contains("/logseq/bak/") || self.absoluteString.contains("/logseq/version-files/"){
|
||||
if self.absoluteString.contains("/logseq/bak/") || self.absoluteString.contains("/logseq/version-files/") {
|
||||
return true
|
||||
}
|
||||
if self.lastPathComponent == "graphs-txid.edn" || self.lastPathComponent == "broken-config.edn" {
|
||||
|
@ -134,7 +134,6 @@ public enum PollingWatcherEvent {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public struct SimpleFileMetadata: CustomStringConvertible, Equatable {
|
||||
var contentModificationTimestamp: Double
|
||||
var creationTimestamp: Double
|
||||
|
@ -142,7 +141,7 @@ public struct SimpleFileMetadata: CustomStringConvertible, Equatable {
|
|||
|
||||
public init?(of fileURL: URL) {
|
||||
do {
|
||||
let fileAttributes = try fileURL.resourceValues(forKeys:[.isRegularFileKey, .fileSizeKey, .contentModificationDateKey, .creationDateKey])
|
||||
let fileAttributes = try fileURL.resourceValues(forKeys: [.isRegularFileKey, .fileSizeKey, .contentModificationDateKey, .creationDateKey])
|
||||
if fileAttributes.isRegularFile! {
|
||||
contentModificationTimestamp = fileAttributes.contentModificationDate?.timeIntervalSince1970 ?? 0.0
|
||||
creationTimestamp = fileAttributes.creationDate?.timeIntervalSince1970 ?? 0.0
|
||||
|
@ -163,7 +162,7 @@ public struct SimpleFileMetadata: CustomStringConvertible, Equatable {
|
|||
public class PollingWatcher {
|
||||
private let url: URL
|
||||
private var timer: DispatchSourceTimer?
|
||||
public var delegate: PollingWatcherDelegate? = nil
|
||||
public var delegate: PollingWatcherDelegate?
|
||||
private var metaDb: [URL: SimpleFileMetadata] = [:]
|
||||
|
||||
public init?(at: URL) {
|
||||
|
|
|
@ -19,4 +19,4 @@ public class Utils: CAPPlugin {
|
|||
|
||||
call.resolve(["isZoomed": isZoomed])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue