mirror of https://github.com/logseq/logseq
chore: run swiftlint
parent
503e33f614
commit
a8e35db725
|
@ -29,7 +29,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||||
func applicationDidBecomeActive(_ application: UIApplication) {
|
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.
|
// 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) {
|
func applicationWillTerminate(_ application: UIApplication) {
|
||||||
|
@ -48,4 +47,3 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,22 +39,19 @@ public class FileContainer: CAPPlugin, UIDocumentPickerDelegate {
|
||||||
do {
|
do {
|
||||||
print("the url = " + url.path)
|
print("the url = " + url.path)
|
||||||
try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true, attributes: nil)
|
try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true, attributes: nil)
|
||||||
}
|
} catch {
|
||||||
catch {
|
|
||||||
print("container doesn't exist")
|
print("container doesn't exist")
|
||||||
print(error.localizedDescription)
|
print(error.localizedDescription)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let str = ""
|
let str = ""
|
||||||
let filename = url.appendingPathComponent(".logseq", isDirectory: false)
|
let filename = url.appendingPathComponent(".logseq", isDirectory: false)
|
||||||
|
|
||||||
if !FileManager.default.fileExists(atPath: filename.path) {
|
if !FileManager.default.fileExists(atPath: filename.path) {
|
||||||
do {
|
do {
|
||||||
try str.write(to: filename, atomically: true, encoding: String.Encoding.utf8)
|
try str.write(to: filename, atomically: true, encoding: String.Encoding.utf8)
|
||||||
}
|
} catch {
|
||||||
catch {
|
|
||||||
print("write .logseq failed")
|
print("write .logseq failed")
|
||||||
print(error.localizedDescription)
|
print(error.localizedDescription)
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import MobileCoreServices
|
||||||
@objc(FolderPicker)
|
@objc(FolderPicker)
|
||||||
public class FolderPicker: CAPPlugin, UIDocumentPickerDelegate {
|
public class FolderPicker: CAPPlugin, UIDocumentPickerDelegate {
|
||||||
|
|
||||||
public var _call: CAPPluginCall? = nil
|
public var _call: CAPPluginCall?
|
||||||
|
|
||||||
@objc func pickFolder(_ call: CAPPluginCall) {
|
@objc func pickFolder(_ call: CAPPluginCall) {
|
||||||
self._call = call
|
self._call = call
|
||||||
|
|
|
@ -12,8 +12,8 @@ import Capacitor
|
||||||
|
|
||||||
@objc(FsWatcher)
|
@objc(FsWatcher)
|
||||||
public class FsWatcher: CAPPlugin, PollingWatcherDelegate {
|
public class FsWatcher: CAPPlugin, PollingWatcherDelegate {
|
||||||
private var watcher: PollingWatcher? = nil
|
private var watcher: PollingWatcher?
|
||||||
private var baseUrl: URL? = nil
|
private var baseUrl: URL?
|
||||||
|
|
||||||
override public func load() {
|
override public func load() {
|
||||||
print("debug FsWatcher iOS plugin loaded!")
|
print("debug FsWatcher iOS plugin loaded!")
|
||||||
|
@ -51,11 +51,11 @@ public class FsWatcher: CAPPlugin, PollingWatcherDelegate {
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||||
self.notifyListeners("watcher", data: ["event": "unlink",
|
self.notifyListeners("watcher", data: ["event": "unlink",
|
||||||
"dir": self.baseUrl?.description as Any,
|
"dir": self.baseUrl?.description as Any,
|
||||||
"path": url.description,
|
"path": url.description
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
case .Add, .Change:
|
case .Add, .Change:
|
||||||
var content: String? = nil
|
var content: String?
|
||||||
if url.shouldNotifyWithContent() {
|
if url.shouldNotifyWithContent() {
|
||||||
content = try? String(contentsOf: url, encoding: .utf8)
|
content = try? String(contentsOf: url, encoding: .utf8)
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,6 @@ public enum PollingWatcherEvent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public struct SimpleFileMetadata: CustomStringConvertible, Equatable {
|
public struct SimpleFileMetadata: CustomStringConvertible, Equatable {
|
||||||
var contentModificationTimestamp: Double
|
var contentModificationTimestamp: Double
|
||||||
var creationTimestamp: Double
|
var creationTimestamp: Double
|
||||||
|
@ -163,7 +162,7 @@ public struct SimpleFileMetadata: CustomStringConvertible, Equatable {
|
||||||
public class PollingWatcher {
|
public class PollingWatcher {
|
||||||
private let url: URL
|
private let url: URL
|
||||||
private var timer: DispatchSourceTimer?
|
private var timer: DispatchSourceTimer?
|
||||||
public var delegate: PollingWatcherDelegate? = nil
|
public var delegate: PollingWatcherDelegate?
|
||||||
private var metaDb: [URL: SimpleFileMetadata] = [:]
|
private var metaDb: [URL: SimpleFileMetadata] = [:]
|
||||||
|
|
||||||
public init?(at: URL) {
|
public init?(at: URL) {
|
||||||
|
|
Loading…
Reference in New Issue