diff --git a/App/Milkshake.dmg b/App/Milkshake.dmg index f9529bb..4796caf 100644 Binary files a/App/Milkshake.dmg and b/App/Milkshake.dmg differ diff --git a/Milkshake.xcworkspace/xcuserdata/dean.xcuserdatad/UserInterfaceState.xcuserstate b/Milkshake.xcworkspace/xcuserdata/dean.xcuserdatad/UserInterfaceState.xcuserstate index f3a7ec6..badb0f9 100644 Binary files a/Milkshake.xcworkspace/xcuserdata/dean.xcuserdatad/UserInterfaceState.xcuserstate and b/Milkshake.xcworkspace/xcuserdata/dean.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Milkshake/API.swift b/Milkshake/API.swift index 9c97963..8d23a8c 100644 --- a/Milkshake/API.swift +++ b/Milkshake/API.swift @@ -112,7 +112,11 @@ class API: NSObject { } func search(txt:String, callbackHandler: @escaping(_ Dictionary:[String:AnyObject]) -> ()) { - let types = ["AL","AR","CO","TR","SF","PL"] + let appDelegate = NSApplication.shared.delegate as! AppDelegate + var types = ["AL","AR","CO","TR","SF","PL"] + if appDelegate.isPremium == false { + types = ["AR","CO","TR"] + } let params: [String: Any] = [ "query": txt, "types": types, diff --git a/Milkshake/AppDelegate.swift b/Milkshake/AppDelegate.swift index f11f25e..590c86a 100644 --- a/Milkshake/AppDelegate.swift +++ b/Milkshake/AppDelegate.swift @@ -46,6 +46,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, LoginProtocol { @IBOutlet weak var menuCrossFade: NSMenuItem! @IBOutlet weak var menuShuffle: NSMenuItem! @IBOutlet weak var menuSpectrum: NSMenuItem! + @IBOutlet weak var menuPlaylist: NSMenuItem! + @IBOutlet weak var menuArtists: NSMenuItem! private var hotKey: HotKey? { didSet { @@ -58,8 +60,12 @@ class AppDelegate: NSObject, NSApplicationDelegate, LoginProtocol { let modifier = hotKey.keyCombo.carbonModifiers let mainVc = self?.windowController?.contentViewController as! MainViewController if keyCode == 0x12 && modifier == 0x100 { mainVc.loadNowPlaying(self!) } - else if keyCode == 0x13 && modifier == 0x100 { mainVc.loadStationResults(self!) } - else if keyCode == 0x14 && modifier == 0x100 { mainVc.loadPlaylistResults(self!) } + else if keyCode == 0x13 && modifier == 0x100 { + mainVc.loadStationResults(self!) + } + else if keyCode == 0x14 && modifier == 0x100 && self!.isPremium { + mainVc.loadPlaylistResults(self!) + } // u else if keyCode == 0x31 && modifier == 0x1100 { mainVc.showWindow() } // p @@ -191,12 +197,17 @@ class AppDelegate: NSObject, NSApplicationDelegate, LoginProtocol { } } + func handleSuccessLogin(results: Dictionary) { print(results) let authToken = results["authToken"] as! String let config = results["config"] as! [String: AnyObject] self.isPremium = (config["branding"] as! String).lowercased() == "pandorapremium" - + + if self.isPremium == false { + self.menuArtists.isHidden = true + self.menuPlaylist.isHidden = true + } // Setting let defaults = UserDefaults.standard defaults.set(authToken, forKey: "authToken") diff --git a/Milkshake/Base.lproj/Main.storyboard b/Milkshake/Base.lproj/Main.storyboard index 50a6a37..e5366bb 100644 --- a/Milkshake/Base.lproj/Main.storyboard +++ b/Milkshake/Base.lproj/Main.storyboard @@ -186,8 +186,10 @@ + + diff --git a/Milkshake/Info.plist b/Milkshake/Info.plist index 3ef84e9..4e908da 100644 --- a/Milkshake/Info.plist +++ b/Milkshake/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 1.0 CFBundleVersion - 1 + 3 LSApplicationCategoryType public.app-category.music LSMinimumSystemVersion diff --git a/Milkshake/MainViewController.swift b/Milkshake/MainViewController.swift index 1118ae5..5604e66 100644 --- a/Milkshake/MainViewController.swift +++ b/Milkshake/MainViewController.swift @@ -481,7 +481,13 @@ extension MainViewController: CellSelectedProtocol { self.cellArtistSelectedProtocol(item: item) } else if type == MusicType.ARTIST { - appDelegate.api.catalogDetails(pandoraId: item.artistId!, callbackHandler: callbackArtist) + if self.appDelegate.isPremium == false { + cell.setPlaying(isPlaying: true, isFocus: true) + appDelegate.radio.playerPause() + appDelegate.api.createStation(pandoraId:item.pandoraId!, callbackHandler: createStationCallback) + } else { + appDelegate.api.catalogDetails(pandoraId: item.artistId!, callbackHandler: callbackArtist) + } } else if type == MusicType.STATION { // if playing already, pause diff --git a/Milkshake/SearchTableCellView.swift b/Milkshake/SearchTableCellView.swift index 839aa44..94e0219 100644 --- a/Milkshake/SearchTableCellView.swift +++ b/Milkshake/SearchTableCellView.swift @@ -41,11 +41,18 @@ class SearchTableCellView: NSTableCellView { } func show_play() -> Bool { - return ( - self.item.hasInteractive == true && - (self.appDelegate.isPremium || (self.appDelegate.isPremium == false && self.item.cellType != CellType.ARTIST)) && - (self.item.type == MusicType.TRACK || self.item.type == MusicType.PLAYLIST || self.item.type == MusicType.ALBUM || self.item.type == MusicType.STATION) - ) + if self.appDelegate.isPremium { + return ( + self.item.hasInteractive == true && + (self.item.type == MusicType.TRACK || self.item.type == MusicType.PLAYLIST || self.item.type == MusicType.ALBUM || self.item.type == MusicType.STATION) + ) + } else { + return ( + self.item.hasInteractive == true && + (self.item.cellType != CellType.ARTIST) && + (self.item.type == MusicType.TRACK || self.item.type == MusicType.PLAYLIST || self.item.type == MusicType.ALBUM || self.item.type == MusicType.STATION || self.item.type == MusicType.ARTIST) + ) + } } override func mouseEntered(with event: NSEvent) { let row:NSTableRowView = self.superview as! NSTableRowView