-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable app download #69
Conversation
@@ -333,6 +334,19 @@ class TasksViewController: NSViewController { | |||
} | |||
} | |||
|
|||
func downloadAppFromLink(link: String) { | |||
if let launchPath = Constants.FilePaths.Bash.appDownload { | |||
let outputStream = CommandsCore.CommandTextOutputStream() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the CommandsCore
prefix here?
Also, can we please not add this to the VC?
someData.write(toFile: plistPath, atomically: true) | ||
} | ||
|
||
func readFromPlist(forKey: String) -> ([String], [String]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's rename this read
plistPath = documentDirectory.appending(defaultPlistPath) | ||
} | ||
|
||
func createPlist(data : [String : Any]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's rename this create
class CommandsController { | ||
let applicationStateHandler = ApplicationStateHandler() | ||
|
||
func downloadAppFromLink(link: String, textView: NSTextView) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I would pass in the CommandTextOutputStream or a textHsndler closure which you assign to the executor’s output stream instead of the text view.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created an issue for that: #74 , as I don't see any easy possibilities to do it here (we depend on printer class that require this view, so it will not make much sense to create this extra class if we do all the stuff in ViewController)
} | ||
|
||
func create(data : [String : Any]) { | ||
if !fileManager.fileExists(atPath: plistPath) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it not file exists. I think this would never have anything to remove when it enters the clause.
Why remove at all, can’t it just overwrite?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, it automatically overwrites. Thanks for pointing this out
plistDictionary = NSDictionary(contentsOfFile: plistPath) | ||
} | ||
if let objectsArray = plistDictionary?.mutableArrayValue(forKey: forKey) { | ||
objectsArray.forEach { dictionary in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can’t you reduce this and return a map of keys and values instead of the tuple of 2 arrays?
var deviceListIsEmpty = false | ||
@objc dynamic var isRunning = false | ||
let applicationStateHandler = ApplicationStateHandler() | ||
let tagsController = TagsController() | ||
var devices = [""] | ||
var timer: Timer! | ||
var pathToCalabashFolder = "" | ||
var linkInfoArray: ([String], [String]) = ([], []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’d make it a map 🗺
@BasThomas @q231950 I think it looks better this way (see refactored PlistOperations) |
Fixes #70