Skip to content
Snippets Groups Projects
Unverified Commit b7512d41 authored by Spotlight Deveaux's avatar Spotlight Deveaux :fox:
Browse files

Add support for Mojave screen recordings

parent fd45e146
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@ class UploadManager : NSObject {
if (defaults.bool(forKey: uploadingKey)) {
// We're already uploading, don't need to again.
#if DEBUG
print("Goodbye.")
print("Goodbye.")
#endif
} else {
defaults.set(true, forKey: uploadingKey)
......@@ -38,15 +38,14 @@ class UploadManager : NSObject {
var toUpload: [URL] = []
for fileName in toSeach {
let filePath = NSURL(fileURLWithPath:path).appendingPathComponent(fileName)!
let filePath = URL(fileURLWithPath:path).appendingPathComponent(fileName)
let metadata : NSMetadataItem? = NSMetadataItem.init(url: filePath)
if (metadata == nil) {
// This file is no friend of mine
print("That probably shouldn't have happened. File: \(filePath)")
} else {
// Check if tagged as screenshot
let test : Bool = metadata?.value(forAttribute: "kMDItemIsScreenCapture") as! Bool? ?? false
if (test) {
// Check if tagged as screen capture or screen recording
let attributes = metadata!.attributes
if (attributes.contains("kMDItemIsScreenCapture") || attributes.contains("kMDItemIsScreenRecording")) {
toUpload.append(filePath)
print(toUpload)
}
......@@ -69,9 +68,9 @@ class UploadManager : NSObject {
}
func uploadFrom(path: String, shouldDelete: Bool) {
PomfManager().uploadFile(path: path) { (error, url) in
self.finalizeUpload(path: path, error: error, url: url, shouldDelete: shouldDelete) {}
}
PomfManager().uploadFile(path: path) { (error, url) in
self.finalizeUpload(path: path, error: error, url: url, shouldDelete: shouldDelete) {}
}
}
func finalizeUpload(path: String, error: NSError?, url: String, shouldDelete: Bool, handler: () -> Void) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment