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 { ...@@ -23,7 +23,7 @@ class UploadManager : NSObject {
if (defaults.bool(forKey: uploadingKey)) { if (defaults.bool(forKey: uploadingKey)) {
// We're already uploading, don't need to again. // We're already uploading, don't need to again.
#if DEBUG #if DEBUG
print("Goodbye.") print("Goodbye.")
#endif #endif
} else { } else {
defaults.set(true, forKey: uploadingKey) defaults.set(true, forKey: uploadingKey)
...@@ -38,15 +38,14 @@ class UploadManager : NSObject { ...@@ -38,15 +38,14 @@ class UploadManager : NSObject {
var toUpload: [URL] = [] var toUpload: [URL] = []
for fileName in toSeach { 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) let metadata : NSMetadataItem? = NSMetadataItem.init(url: filePath)
if (metadata == nil) { if (metadata == nil) {
// This file is no friend of mine
print("That probably shouldn't have happened. File: \(filePath)") print("That probably shouldn't have happened. File: \(filePath)")
} else { } else {
// Check if tagged as screenshot // Check if tagged as screen capture or screen recording
let test : Bool = metadata?.value(forAttribute: "kMDItemIsScreenCapture") as! Bool? ?? false let attributes = metadata!.attributes
if (test) { if (attributes.contains("kMDItemIsScreenCapture") || attributes.contains("kMDItemIsScreenRecording")) {
toUpload.append(filePath) toUpload.append(filePath)
print(toUpload) print(toUpload)
} }
...@@ -69,9 +68,9 @@ class UploadManager : NSObject { ...@@ -69,9 +68,9 @@ class UploadManager : NSObject {
} }
func uploadFrom(path: String, shouldDelete: Bool) { func uploadFrom(path: String, shouldDelete: Bool) {
PomfManager().uploadFile(path: path) { (error, url) in PomfManager().uploadFile(path: path) { (error, url) in
self.finalizeUpload(path: path, error: error, url: url, shouldDelete: shouldDelete) {} self.finalizeUpload(path: path, error: error, url: url, shouldDelete: shouldDelete) {}
} }
} }
func finalizeUpload(path: String, error: NSError?, url: String, shouldDelete: Bool, handler: () -> Void) { 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