Skip to content
This repository was archived by the owner on Aug 16, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "ReactiveCocoa/ReactiveCocoa" == 2.4.7
github "sparkle-project/Sparkle" == 1.9.0
github "ReactiveCocoa/ReactiveCocoa" "v4.0.0-RC.1"
github "sparkle-project/Sparkle" ~> 1.9.0
github "calebd/MediaKeys" == 0.1.0
5 changes: 3 additions & 2 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
github "calebd/MediaKeys" "v0.1.0"
github "ReactiveCocoa/ReactiveCocoa" "v2.4.7"
github "sparkle-project/Sparkle" "1.9.0"
github "antitypical/Result" "1.0.1"
github "sparkle-project/Sparkle" "1.13.0"
github "ReactiveCocoa/ReactiveCocoa" "v4.0.0-RC.1"
24 changes: 13 additions & 11 deletions Cloudy.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
objects = {

/* Begin PBXBuildFile section */
3B0206EC1AE7461400E45D53 /* NowPlayingController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B0206EB1AE7461400E45D53 /* NowPlayingController.swift */; };
3AE739B31C44E7350004A7A5 /* Result.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3AE739B11C44E5F40004A7A5 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
3AF748D01C46394700216897 /* Cloudy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AF748CF1C46394700216897 /* Cloudy.swift */; };
3B1A19201B4E681A005CE283 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BA5FE361AF35A8E00A5622B /* Sparkle.framework */; };
3B430E261AE0A88F00AEBFBC /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B430E251AE0A88F00AEBFBC /* AppDelegate.swift */; };
3B430E281AE0A88F00AEBFBC /* PlaybackViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B430E271AE0A88F00AEBFBC /* PlaybackViewController.swift */; };
3B430E2A1AE0A88F00AEBFBC /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3B430E291AE0A88F00AEBFBC /* Images.xcassets */; };
3B430E2D1AE0A88F00AEBFBC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3B430E2B1AE0A88F00AEBFBC /* Main.storyboard */; };
3B430E441AE0B20700AEBFBC /* cloudy.js in Resources */ = {isa = PBXBuildFile; fileRef = 3B430E431AE0B20700AEBFBC /* cloudy.js */; };
3B430E461AE0C0FE00AEBFBC /* Defines.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B430E451AE0C0FE00AEBFBC /* Defines.swift */; };
3B430E4A1AE0C66200AEBFBC /* MainWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B430E491AE0C66200AEBFBC /* MainWindowController.swift */; };
3BA5FE391AF35A9800A5622B /* Sparkle.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3BA5FE361AF35A8E00A5622B /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
3BB0D1B91AE2263100AB4A33 /* ReactiveCocoa.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B2332D41AE1BA48005C6654 /* ReactiveCocoa.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
Expand All @@ -31,6 +31,7 @@
files = (
3BB0D1B91AE2263100AB4A33 /* ReactiveCocoa.framework in Embed Frameworks */,
3BFB222C1AFA071300127AF1 /* MediaKeys.framework in Embed Frameworks */,
3AE739B31C44E7350004A7A5 /* Result.framework in Embed Frameworks */,
3BA5FE391AF35A9800A5622B /* Sparkle.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
Expand All @@ -39,7 +40,8 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
3B0206EB1AE7461400E45D53 /* NowPlayingController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NowPlayingController.swift; sourceTree = "<group>"; };
3AE739B11C44E5F40004A7A5 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Result.framework; path = Carthage/Build/Mac/Result.framework; sourceTree = "<group>"; };
3AF748CF1C46394700216897 /* Cloudy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Cloudy.swift; sourceTree = "<group>"; };
3B2332D41AE1BA48005C6654 /* ReactiveCocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ReactiveCocoa.framework; path = Carthage/Build/Mac/ReactiveCocoa.framework; sourceTree = "<group>"; };
3B430E201AE0A88F00AEBFBC /* Cloudy.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Cloudy.app; sourceTree = BUILT_PRODUCTS_DIR; };
3B430E241AE0A88F00AEBFBC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand All @@ -48,7 +50,6 @@
3B430E291AE0A88F00AEBFBC /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
3B430E2C1AE0A88F00AEBFBC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
3B430E431AE0B20700AEBFBC /* cloudy.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = cloudy.js; sourceTree = "<group>"; };
3B430E451AE0C0FE00AEBFBC /* Defines.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Defines.swift; sourceTree = "<group>"; };
3B430E491AE0C66200AEBFBC /* MainWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainWindowController.swift; sourceTree = "<group>"; };
3BA5FE361AF35A8E00A5622B /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Sparkle.framework; path = Carthage/Build/Mac/Sparkle.framework; sourceTree = "<group>"; };
3BFB22291AFA070C00127AF1 /* MediaKeys.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaKeys.framework; path = Carthage/Build/Mac/MediaKeys.framework; sourceTree = "<group>"; };
Expand All @@ -70,6 +71,7 @@
3B2332D81AE1BA84005C6654 /* Frameworks */ = {
isa = PBXGroup;
children = (
3AE739B11C44E5F40004A7A5 /* Result.framework */,
3BFB22291AFA070C00127AF1 /* MediaKeys.framework */,
3BA5FE361AF35A8E00A5622B /* Sparkle.framework */,
3B2332D41AE1BA48005C6654 /* ReactiveCocoa.framework */,
Expand Down Expand Up @@ -100,8 +102,7 @@
3B430E251AE0A88F00AEBFBC /* AppDelegate.swift */,
3B430E491AE0C66200AEBFBC /* MainWindowController.swift */,
3B430E271AE0A88F00AEBFBC /* PlaybackViewController.swift */,
3B0206EB1AE7461400E45D53 /* NowPlayingController.swift */,
3B430E451AE0C0FE00AEBFBC /* Defines.swift */,
3AF748CF1C46394700216897 /* Cloudy.swift */,
3B430E421AE0A93000AEBFBC /* Resources */,
);
path = Cloudy;
Expand Down Expand Up @@ -146,7 +147,8 @@
3B430E181AE0A88F00AEBFBC /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0630;
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0720;
ORGANIZATIONNAME = "Caleb Davenport";
TargetAttributes = {
3B430E1F1AE0A88F00AEBFBC = {
Expand Down Expand Up @@ -197,11 +199,10 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3B0206EC1AE7461400E45D53 /* NowPlayingController.swift in Sources */,
3B430E281AE0A88F00AEBFBC /* PlaybackViewController.swift in Sources */,
3B430E261AE0A88F00AEBFBC /* AppDelegate.swift in Sources */,
3B430E4A1AE0C66200AEBFBC /* MainWindowController.swift in Sources */,
3B430E461AE0C0FE00AEBFBC /* Defines.swift in Sources */,
3AF748D01C46394700216897 /* Cloudy.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -239,6 +240,7 @@
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -301,7 +303,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "Developer ID Application";
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -310,6 +311,7 @@
INFOPLIST_FILE = Cloudy/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
OTHER_SWIFT_FLAGS = "-DDEBUG";
PRODUCT_BUNDLE_IDENTIFIER = com.calebd.cloudy;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
Expand All @@ -318,14 +320,14 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "Developer ID Application";
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/Mac",
);
INFOPLIST_FILE = Cloudy/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.calebd.cloudy;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
Expand Down
13 changes: 8 additions & 5 deletions Cloudy.xcodeproj/xcshareddata/xcschemes/Cloudy.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0630"
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -23,10 +23,10 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
Expand All @@ -38,15 +38,18 @@
ReferencedContainer = "container:Cloudy.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
Expand All @@ -62,10 +65,10 @@
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
Expand Down
102 changes: 51 additions & 51 deletions Cloudy/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,64 +8,64 @@

import Cocoa

private func DockMenu(#item: PlaybackItem?, #playing: Bool) -> NSMenu? {
if item == nil {
return nil
}

let menu = NSMenu()
menu.autoenablesItems = false

let nowPlayingItem = NSMenuItem()
nowPlayingItem.title = "Now Playing"
nowPlayingItem.enabled = false
menu.addItem(nowPlayingItem)

let showNameItem = NSMenuItem()
showNameItem.title = item?.show ?? "Now Show Title"
showNameItem.indentationLevel = 1
showNameItem.enabled = false
menu.addItem(showNameItem)

let episodeNameItem = NSMenuItem()
episodeNameItem.title = item?.episode ?? "Now Episode Title"
episodeNameItem.indentationLevel = 1
episodeNameItem.enabled = false
menu.addItem(episodeNameItem)

menu.addItem(NSMenuItem.separatorItem())

let togglePlaybackItem = NSMenuItem(title: playing ? "Pause" : "Play", action: "togglePlaybackState:", keyEquivalent: "")
menu.addItem(togglePlaybackItem)

return menu
}

private func GetPlaybackViewController() -> PlaybackViewController? {
let windows = NSApplication.sharedApplication().windows as? [NSWindow] ?? []
for window in windows {
if let controller = window.contentViewController as? PlaybackViewController {
return controller
}
}
return nil
}
//private func DockMenu(#item: PlaybackItem?, #playing: Bool) -> NSMenu? {
// if item == nil {
// return nil
// }
//
// let menu = NSMenu()
// menu.autoenablesItems = false
//
// let nowPlayingItem = NSMenuItem()
// nowPlayingItem.title = "Now Playing"
// nowPlayingItem.enabled = false
// menu.addItem(nowPlayingItem)
//
// let showNameItem = NSMenuItem()
// showNameItem.title = item?.show ?? "Now Show Title"
// showNameItem.indentationLevel = 1
// showNameItem.enabled = false
// menu.addItem(showNameItem)
//
// let episodeNameItem = NSMenuItem()
// episodeNameItem.title = item?.episode ?? "Now Episode Title"
// episodeNameItem.indentationLevel = 1
// episodeNameItem.enabled = false
// menu.addItem(episodeNameItem)
//
// menu.addItem(NSMenuItem.separatorItem())
//
// let togglePlaybackItem = NSMenuItem(title: playing ? "Pause" : "Play", action: "togglePlaybackState:", keyEquivalent: "")
// menu.addItem(togglePlaybackItem)
//
// return menu
//}

//private func GetPlaybackViewController() -> PlaybackViewController? {
// let windows = NSApplication.sharedApplication().windows as? [NSWindow] ?? []
// for window in windows {
// if let controller = window.contentViewController as? PlaybackViewController {
// return controller
// }
// }
// return nil
//}

@NSApplicationMain final class AppDelegate: NSObject, NSApplicationDelegate {

// MARK: - NSApplicationDelegate

func applicationDockMenu(sender: NSApplication) -> NSMenu? {
return DockMenu(
item: NowPlayingController.shared().nowPlayingItem,
playing: NowPlayingController.shared().playing
)
}
// func applicationDockMenu(sender: NSApplication) -> NSMenu? {
// return DockMenu(
// item: NowPlayingController.shared().nowPlayingItem,
// playing: NowPlayingController.shared().playing
// )
// }


// MARK: - Private

@objc private func togglePlaybackState(sender: AnyObject?) {
GetPlaybackViewController()?.togglePlaybackState(self)
}
// @objc private func togglePlaybackState(sender: AnyObject?) {
// GetPlaybackViewController()?.togglePlaybackState(self)
// }
}
Loading