Skip to content

Commit

Permalink
Super janky editing
Browse files Browse the repository at this point in the history
  • Loading branch information
brianmichel committed Dec 18, 2016
1 parent c979119 commit 684be2f
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Juice.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@
CODE_SIGN_ENTITLEMENTS = Juice/Juice.entitlements;
CODE_SIGN_IDENTITY = "Mac Developer";
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2016.12.18010420;
CURRENT_PROJECT_VERSION = 2016.12.18011428;
DEVELOPMENT_TEAM = YN24FFRTC8;
INFOPLIST_FILE = Juice/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
Expand All @@ -484,7 +484,7 @@
CODE_SIGN_ENTITLEMENTS = Juice/Juice.entitlements;
CODE_SIGN_IDENTITY = "Mac Developer";
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2016.12.18010420;
CURRENT_PROJECT_VERSION = 2016.12.18011428;
DEVELOPMENT_TEAM = YN24FFRTC8;
INFOPLIST_FILE = Juice/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
Expand Down
2 changes: 0 additions & 2 deletions Juice/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,5 @@ class AppDelegate: NSObject, NSApplicationDelegate {
func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
}


}

18 changes: 18 additions & 0 deletions Juice/Classes/FileBackedChargeScaleDisplay+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,22 @@ extension FileBackedChargeScaleDisplay {
defaultDetentString: "┅┅┅┅┅┅┅┅┅┅┅",
fileName: "dotted-line")
}

static func makeNewScaleTemplateScale(id: String) -> FileBackedChargeScaleDisplay {
let detents = [0: "Edit Me, I'll be triggered from 0 to 10%",
1: "Edit Me, I'll be triggered from 10 to 20%",
2: "Edit Me, I'll be triggered from 20 to 30%",
3: "Edit Me, I'll be triggered from 30 to 40%",
4: "Edit Me, I'll be triggered from 40 to 50%",
5: "Edit Me, I'll be triggered from 50 to 60%",
6: "Edit Me, I'll be triggered from 60 to 70%",
7: "Edit Me, I'll be triggered from 70 to 80%",
8: "Edit Me, I'll be triggered from 80 to 90%",
9: "Edit Me, I'll be triggered from 90 to 100%"]

return FileBackedChargeScaleDisplay(title: "Edit The Title",
detents: detents,
defaultDetentString: "Edit The Default Value To Show",
fileName: id)
}
}
4 changes: 4 additions & 0 deletions Juice/Classes/FileBackedChargeScaleDisplay.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ struct FileBackedChargeScaleDisplay: ChargeScaleDisplay, SerializableChargeScale
let defaultDetentString: String
let fileName: String

var filePath: URL? {
return FileManager.default.applicationSupportDirectory?.appendingPathComponent(fileName)
}

init(title: String, detents: [Int: String], defaultDetentString: String, fileName: String) {
self.title = title
self.detents = detents
Expand Down
12 changes: 11 additions & 1 deletion Juice/Classes/GeneralPreferencesViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,21 @@ class GeneralPreferencesViewController: NSViewController {
statusBarStylePopUp.removeAllItems()
scales.forEach({ statusBarStylePopUp.addItem(withTitle: $0.title) })

statusBarStylePopUp.selectItem(withTitle: preferences.chargeDisplayScale.value.title)

scalesFoundLabel.stringValue = "\(scales.count) Scales Found"
}

@IBAction func addNewScale(_ sender: Any) {
// something
let identifier = UUID().uuidString
let newScale = FileBackedChargeScaleDisplay.makeNewScaleTemplateScale(id: identifier)
guard let filePath = newScale.filePath else {
return
}

newScale.save()

NSWorkspace.shared().open(filePath)
}

@IBAction func triggerRescan(_ sender: Any) {
Expand Down
1 change: 1 addition & 0 deletions Juice/Classes/PreferencesStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ final class PreferencesStorage {
init() {
scanQueue.name = "com.bsm.macos.storage.scan"
chargeDisplayScale = Variable(FileBackedChargeScaleDisplay.makeEmojiScale())
scanApplicationSupportForFiles()
}

func set(chargeDisplayScale: ChargeScaleDisplay) {
Expand Down
2 changes: 1 addition & 1 deletion Juice/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>2016.12.18000935</string>
<string>2016.12.18011428</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.lifestyle</string>
<key>LSMinimumSystemVersion</key>
Expand Down

0 comments on commit 684be2f

Please sign in to comment.