From b996b246ab0f83ddd881dc7bd33fd702bd73007c Mon Sep 17 00:00:00 2001 From: apidcloud Date: Mon, 18 Feb 2019 22:14:28 -0700 Subject: [PATCH 1/8] add: new popover view --- Podfile.lock | 2 +- SpotMenu.xcodeproj/project.pbxproj | 22 ++- .../xcshareddata/xcschemes/SpotMenu.xcscheme | 91 ++++++++++ .../xcschemes/SpotMenuToday.xcscheme | 108 +++++++++++ SpotMenu/AppDelegate/AppDelegate.swift | 2 +- SpotMenu/PopOver/PopOver.xib | 20 +-- SpotMenu/PopOver/PopOverSmall.xib | 168 ++++++++++++++++++ 7 files changed, 393 insertions(+), 20 deletions(-) create mode 100644 SpotMenu.xcodeproj/xcshareddata/xcschemes/SpotMenu.xcscheme create mode 100644 SpotMenu.xcodeproj/xcshareddata/xcschemes/SpotMenuToday.xcscheme create mode 100644 SpotMenu/PopOver/PopOverSmall.xib diff --git a/Podfile.lock b/Podfile.lock index 69e228f..637eddc 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -34,4 +34,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: f237920f869d400b1819fdc4dd988f78ac218ef7 -COCOAPODS: 1.5.3 +COCOAPODS: 1.6.0 diff --git a/SpotMenu.xcodeproj/project.pbxproj b/SpotMenu.xcodeproj/project.pbxproj index 54374bc..39203ab 100644 --- a/SpotMenu.xcodeproj/project.pbxproj +++ b/SpotMenu.xcodeproj/project.pbxproj @@ -79,6 +79,8 @@ 64F112A821933CA400753E83 /* ScrollingTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64F112A621933ACB00753E83 /* ScrollingTextView.swift */; }; 64F29A091F2E5F1100E48BBD /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 64F29A0B1F2E5F1100E48BBD /* Localizable.strings */; }; 98C18916984B50AAD9E17661 /* Pods_SpotMenu.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADFCF0607F980ADD8D5D03FA /* Pods_SpotMenu.framework */; }; + A02DF2CF221BB1C700222929 /* PopOverSmall.xib in Resources */ = {isa = PBXBuildFile; fileRef = A02DF2CE221BB1C700222929 /* PopOverSmall.xib */; }; + A02DF2D0221BC03500222929 /* PopOverSmall.xib in Resources */ = {isa = PBXBuildFile; fileRef = A02DF2CE221BB1C700222929 /* PopOverSmall.xib */; }; DB2C500E2199F94000932042 /* ScrollingStatusItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB2C500D2199F94000932042 /* ScrollingStatusItemView.swift */; }; E2D35CCB1F60827B00EB5D67 /* CustomVisualEffect.swift in Sources */ = {isa = PBXBuildFile; fileRef = 648984831E5C21C200EA2234 /* CustomVisualEffect.swift */; }; E2D35CCE1F60879700EB5D67 /* NSViewExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2D35CCD1F60879700EB5D67 /* NSViewExtension.swift */; }; @@ -217,6 +219,7 @@ 64F112A621933ACB00753E83 /* ScrollingTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScrollingTextView.swift; sourceTree = ""; }; 64F29A0F1F2E5FDD00E48BBD /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = ""; }; 6A999C2F782EFDE0675BE9DB /* Pods-SpotMenu.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SpotMenu.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SpotMenu/Pods-SpotMenu.debug.xcconfig"; sourceTree = ""; }; + A02DF2CE221BB1C700222929 /* PopOverSmall.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PopOverSmall.xib; sourceTree = ""; }; ADFCF0607F980ADD8D5D03FA /* Pods_SpotMenu.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SpotMenu.framework; sourceTree = BUILT_PRODUCTS_DIR; }; DB2C500D2199F94000932042 /* ScrollingStatusItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScrollingStatusItemView.swift; sourceTree = ""; }; E2D35CCD1F60879700EB5D67 /* NSViewExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSViewExtension.swift; sourceTree = ""; }; @@ -350,6 +353,7 @@ 643746621F76AEDD00B16214 /* PopOver.xib */, 213324381D79967B0060D48C /* PopOverVC.swift */, 64A8E1A31F83F45F00FFF6B1 /* Hidden.storyboard */, + A02DF2CE221BB1C700222929 /* PopOverSmall.xib */, ); path = PopOver; sourceTree = ""; @@ -749,6 +753,7 @@ 641226E61FD417A400BB119F /* GeneralPreferences.storyboard in Resources */, 64A8E1A41F83F45F00FFF6B1 /* Hidden.storyboard in Resources */, 6437466A1F76B0BB00B16214 /* MainMenu.xib in Resources */, + A02DF2CF221BB1C700222929 /* PopOverSmall.xib in Resources */, 641226E41FD416A200BB119F /* AboutPreferences.storyboard in Resources */, 641226E81FD417D700BB119F /* UpdatePreferences.storyboard in Resources */, 6437466B1F76B0BB00B16214 /* Preferences.storyboard in Resources */, @@ -763,6 +768,7 @@ buildActionMask = 2147483647; files = ( 643746671F76B06900B16214 /* PopOver.xib in Resources */, + A02DF2D0221BC03500222929 /* PopOverSmall.xib in Resources */, 64185C1A1F1B8DC400CA23A0 /* InfoPlist.strings in Resources */, 64185C271F1B98C600CA23A0 /* Assets.xcassets in Resources */, ); @@ -802,7 +808,7 @@ files = ( ); inputPaths = ( - "${SRCROOT}/Pods/Target Support Files/Pods-SpotMenu/Pods-SpotMenu-frameworks.sh", + "${PODS_ROOT}/Target Support Files/Pods-SpotMenu/Pods-SpotMenu-frameworks.sh", "${BUILT_PRODUCTS_DIR}/LoginServiceKit/LoginServiceKit.framework", "${PODS_ROOT}/Sparkle/Sparkle.framework", "${PODS_ROOT}/Sparkle/Sparkle.framework.dSYM", @@ -815,7 +821,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SpotMenu/Pods-SpotMenu-frameworks.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-SpotMenu/Pods-SpotMenu-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -1053,10 +1059,10 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = SpotMenu/SpotMenu.entitlements; - CODE_SIGN_IDENTITY = "Mac Developer"; + CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = 3K79XCJYWL; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = SpotMenu/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.KMikiy.SpotMenu; @@ -1077,10 +1083,10 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = SpotMenu/SpotMenu.entitlements; - CODE_SIGN_IDENTITY = "Mac Developer"; + CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = 3K79XCJYWL; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = SpotMenu/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.KMikiy.SpotMenu; @@ -1098,7 +1104,7 @@ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CODE_SIGN_ENTITLEMENTS = SpotMenuToday/SpotMenuToday.entitlements; - CODE_SIGN_IDENTITY = "Mac Developer"; + CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; DEVELOPMENT_TEAM = 3K79XCJYWL; @@ -1122,7 +1128,7 @@ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CODE_SIGN_ENTITLEMENTS = SpotMenuToday/SpotMenuToday.entitlements; - CODE_SIGN_IDENTITY = "Mac Developer"; + CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; DEVELOPMENT_TEAM = 3K79XCJYWL; diff --git a/SpotMenu.xcodeproj/xcshareddata/xcschemes/SpotMenu.xcscheme b/SpotMenu.xcodeproj/xcshareddata/xcschemes/SpotMenu.xcscheme new file mode 100644 index 0000000..b6e758c --- /dev/null +++ b/SpotMenu.xcodeproj/xcshareddata/xcschemes/SpotMenu.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SpotMenu.xcodeproj/xcshareddata/xcschemes/SpotMenuToday.xcscheme b/SpotMenu.xcodeproj/xcshareddata/xcschemes/SpotMenuToday.xcscheme new file mode 100644 index 0000000..2bf6462 --- /dev/null +++ b/SpotMenu.xcodeproj/xcshareddata/xcschemes/SpotMenuToday.xcscheme @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SpotMenu/AppDelegate/AppDelegate.swift b/SpotMenu/AppDelegate/AppDelegate.swift index ef2c996..0a01e21 100644 --- a/SpotMenu/AppDelegate/AppDelegate.swift +++ b/SpotMenu/AppDelegate/AppDelegate.swift @@ -68,7 +68,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate { // MARK: - AppDelegate methods func applicationDidFinishLaunching(_: Notification) { - Fabric.with([Crashlytics.self]) + //Fabric.with([Crashlytics.self]) UserPreferences.initializeUserPreferences() diff --git a/SpotMenu/PopOver/PopOver.xib b/SpotMenu/PopOver/PopOver.xib index 57b9ddf..1875f97 100644 --- a/SpotMenu/PopOver/PopOver.xib +++ b/SpotMenu/PopOver/PopOver.xib @@ -120,15 +120,6 @@ - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From fc32ddc89e77675ae9cf813f2f61012396e50877 Mon Sep 17 00:00:00 2001 From: apidcloud Date: Mon, 18 Feb 2019 23:51:31 -0700 Subject: [PATCH 2/8] feat: use fadein mode always --- SpotMenu.xcodeproj/project.pbxproj | 6 +++++ SpotMenu/AppDelegate/AppDelegate.swift | 2 +- SpotMenu/CustomViews/StaticFadeIn.swift | 30 ++++++++++++++++++++++ SpotMenu/PopOver/PopOverSmall.xib | 33 ++++++++++++++----------- 4 files changed, 56 insertions(+), 15 deletions(-) create mode 100644 SpotMenu/CustomViews/StaticFadeIn.swift diff --git a/SpotMenu.xcodeproj/project.pbxproj b/SpotMenu.xcodeproj/project.pbxproj index 39203ab..4d0881e 100644 --- a/SpotMenu.xcodeproj/project.pbxproj +++ b/SpotMenu.xcodeproj/project.pbxproj @@ -81,6 +81,8 @@ 98C18916984B50AAD9E17661 /* Pods_SpotMenu.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADFCF0607F980ADD8D5D03FA /* Pods_SpotMenu.framework */; }; A02DF2CF221BB1C700222929 /* PopOverSmall.xib in Resources */ = {isa = PBXBuildFile; fileRef = A02DF2CE221BB1C700222929 /* PopOverSmall.xib */; }; A02DF2D0221BC03500222929 /* PopOverSmall.xib in Resources */ = {isa = PBXBuildFile; fileRef = A02DF2CE221BB1C700222929 /* PopOverSmall.xib */; }; + A02DF2D2221BCDB700222929 /* StaticFadeIn.swift in Sources */ = {isa = PBXBuildFile; fileRef = A02DF2D1221BCDB700222929 /* StaticFadeIn.swift */; }; + A02DF2D3221BCFCD00222929 /* StaticFadeIn.swift in Sources */ = {isa = PBXBuildFile; fileRef = A02DF2D1221BCDB700222929 /* StaticFadeIn.swift */; }; DB2C500E2199F94000932042 /* ScrollingStatusItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB2C500D2199F94000932042 /* ScrollingStatusItemView.swift */; }; E2D35CCB1F60827B00EB5D67 /* CustomVisualEffect.swift in Sources */ = {isa = PBXBuildFile; fileRef = 648984831E5C21C200EA2234 /* CustomVisualEffect.swift */; }; E2D35CCE1F60879700EB5D67 /* NSViewExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2D35CCD1F60879700EB5D67 /* NSViewExtension.swift */; }; @@ -220,6 +222,7 @@ 64F29A0F1F2E5FDD00E48BBD /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = ""; }; 6A999C2F782EFDE0675BE9DB /* Pods-SpotMenu.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SpotMenu.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SpotMenu/Pods-SpotMenu.debug.xcconfig"; sourceTree = ""; }; A02DF2CE221BB1C700222929 /* PopOverSmall.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PopOverSmall.xib; sourceTree = ""; }; + A02DF2D1221BCDB700222929 /* StaticFadeIn.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StaticFadeIn.swift; sourceTree = ""; }; ADFCF0607F980ADD8D5D03FA /* Pods_SpotMenu.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SpotMenu.framework; sourceTree = BUILT_PRODUCTS_DIR; }; DB2C500D2199F94000932042 /* ScrollingStatusItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScrollingStatusItemView.swift; sourceTree = ""; }; E2D35CCD1F60879700EB5D67 /* NSViewExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSViewExtension.swift; sourceTree = ""; }; @@ -326,6 +329,7 @@ 648984831E5C21C200EA2234 /* CustomVisualEffect.swift */, 64F112A621933ACB00753E83 /* ScrollingTextView.swift */, DB2C500D2199F94000932042 /* ScrollingStatusItemView.swift */, + A02DF2D1221BCDB700222929 /* StaticFadeIn.swift */, ); path = CustomViews; sourceTree = ""; @@ -845,6 +849,7 @@ 645F8E711F22AEDE007AEEE7 /* Toast.swift in Sources */, 645F8E701F22AEDE007AEEE7 /* SharedFunctionality.swift in Sources */, 6415E1391ED1BF8500051EB5 /* LaunchStarter.swift in Sources */, + A02DF2D2221BCDB700222929 /* StaticFadeIn.swift in Sources */, 64ED8B381F6C351500CAA1AA /* PreferencesWC.swift in Sources */, 647087D61F2299F40054CC48 /* DDHotKeyCenter.m in Sources */, 64A908081EB7754100566ED1 /* UserPreferences.swift in Sources */, @@ -864,6 +869,7 @@ buildActionMask = 2147483647; files = ( 64BD97A61FDD713800209B2B /* UserPreferences.swift in Sources */, + A02DF2D3221BCFCD00222929 /* StaticFadeIn.swift in Sources */, 64F112A821933CA400753E83 /* ScrollingTextView.swift in Sources */, E2D35CD11F60A08800EB5D67 /* PopOverVC.swift in Sources */, E2D35CCF1F60882600EB5D67 /* NSViewExtension.swift in Sources */, diff --git a/SpotMenu/AppDelegate/AppDelegate.swift b/SpotMenu/AppDelegate/AppDelegate.swift index 0a01e21..d3a705a 100644 --- a/SpotMenu/AppDelegate/AppDelegate.swift +++ b/SpotMenu/AppDelegate/AppDelegate.swift @@ -81,7 +81,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate { let lastMusicPlayer = musicPlayerManager.existMusicPlayer(with: lastMusicPlayerName) musicPlayerManager.currentPlayer = lastMusicPlayer - let popoverVC = PopOverViewController(nibName: NSNib.Name(rawValue: "PopOver"), bundle: nil) + let popoverVC = PopOverViewController(nibName: NSNib.Name(rawValue: "PopOverSmall"), bundle: nil) popoverVC.setUpMusicPlayerManager() hiddenController = (NSStoryboard(name: NSStoryboard.Name(rawValue: "Hidden"), bundle: nil).instantiateInitialController() as! NSWindowController) diff --git a/SpotMenu/CustomViews/StaticFadeIn.swift b/SpotMenu/CustomViews/StaticFadeIn.swift new file mode 100644 index 0000000..35505d2 --- /dev/null +++ b/SpotMenu/CustomViews/StaticFadeIn.swift @@ -0,0 +1,30 @@ +import AppKit +import Foundation + +class StaticFadeIn: NSVisualEffectView { + + // MARK: - Lifecycle methods + + override init(frame frameRect: NSRect) { + super.init(frame: frameRect) + setup() + } + + required init?(coder: NSCoder) { + super.init(coder: coder) + setup() + } + + deinit { + } + + private func setup() { + fade() + } + + // MARK: - Private helper methods + + private func fade() { + alphaValue = CGFloat(1) + } +} diff --git a/SpotMenu/PopOver/PopOverSmall.xib b/SpotMenu/PopOver/PopOverSmall.xib index 7367ec1..9810ded 100644 --- a/SpotMenu/PopOver/PopOverSmall.xib +++ b/SpotMenu/PopOver/PopOverSmall.xib @@ -16,6 +16,7 @@ + @@ -40,11 +41,15 @@ - + - - + - + - - - - + + @@ -95,7 +100,7 @@ - - - + + @@ -115,7 +120,7 @@ - + @@ -123,7 +128,7 @@ - + @@ -139,7 +144,7 @@ - + From c721074243b7c38c91c80a0571d35e8c691bd306 Mon Sep 17 00:00:00 2001 From: apidcloud Date: Wed, 20 Feb 2019 23:52:45 -0700 Subject: [PATCH 3/8] style: add small popover option to preferences menu --- .../Localizable/en.lproj/Localizable.strings | 2 + .../pt-PT.lproj/Localizable.strings | 2 + .../Tabs/GeneralPreferences.storyboard | 90 +++++++++++-------- .../Tabs/GeneralPreferencesVC.swift | 14 +++ SpotMenu/Preferences/UserPreferences.swift | 11 +++ 5 files changed, 81 insertions(+), 38 deletions(-) diff --git a/SpotMenu/Localizable/en.lproj/Localizable.strings b/SpotMenu/Localizable/en.lproj/Localizable.strings index 5e0a5fa..8593d35 100644 --- a/SpotMenu/Localizable/en.lproj/Localizable.strings +++ b/SpotMenu/Localizable/en.lproj/Localizable.strings @@ -20,6 +20,7 @@ "When checked the playing icon (♫) will be shown in the menu bar if music is played." = "When checked the playing icon (♫) will be shown in the menu bar if music is played."; "When checked the SpotMenu icon will be shown in the menu bar. Note: If there is no music information to be shown the SpotMenu icon will be visible." = "When checked the SpotMenu icon will be shown in the menu bar.\n\nNote:\nIf there is no music information to be shown the SpotMenu icon will be visible."; "When checked the popover will be fixed to the right corner." = "When checked the popover will be fixed to the right corner."; +"When checked a small popover will be used instead." = "When checked a small popover will be used instead."; "When checked SpotMenu will start automatically at login." = "When checked SpotMenu will start automatically at login."; "Artist" = "Artist"; "Title" = "Title"; @@ -32,6 +33,7 @@ "Updates" = "Updates"; "Open at login" = "Open at login"; "Fix popover to the right" = "Fix popover to the right"; +"Use small popover" = "Use small popover"; "Show SpotMenu icon" = "Show SpotMenu icon"; "Automatically check for updates" = "Automatically check for updates"; "Automatically download updates" = "Automatically download updates"; diff --git a/SpotMenu/Localizable/pt-PT.lproj/Localizable.strings b/SpotMenu/Localizable/pt-PT.lproj/Localizable.strings index 96ee692..096378b 100644 --- a/SpotMenu/Localizable/pt-PT.lproj/Localizable.strings +++ b/SpotMenu/Localizable/pt-PT.lproj/Localizable.strings @@ -20,6 +20,7 @@ "When checked the playing icon (♫) will be shown in the menu bar if music is played." = "Quando ativado, o icon de reprodução (♫) vai ser mostrado na barra de menus se houver uma música em reprodução."; "When checked the SpotMenu icon will be shown in the menu bar. Note: If there is no music information to be shown the SpotMenu icon will be visible." = "Quando ativado, o icon do SpotMenu vai ser mostrado na barra de menus.\n\nNota:\nSe não houver informação sobre uma música para ser mostrada, o icon do SpotMenu vai estar visível."; "When checked the popover will be fixed to the right corner." = "Quando ativado, o popover vai ser fixado ao canto supeior direito."; +"When checked a small popover will be used instead." = "Quando ativado, é utilizado um popover pequeno." "When checked SpotMenu will start automatically at login." = "Quando ativado, o SpotMenu vai iniciar automaticamente no Login."; "Artist" = "Artista"; "Title" = "Título"; @@ -32,6 +33,7 @@ "Updates" = "Actualizações"; "Open at login" = "Abrir no Login"; "Fix popover to the right" = "Fixar popover à direita"; +"Use small popover" = "Usar popover pequeno"; "Show SpotMenu icon" = "Mostrar ícone do SpotMenu"; "Automatically check for updates" = "Procurar actualizações automaticamente"; "Automatically download updates" = "Transferir actualizações automaticamente"; diff --git a/SpotMenu/Preferences/Tabs/GeneralPreferences.storyboard b/SpotMenu/Preferences/Tabs/GeneralPreferences.storyboard index 298a57c..5533360 100644 --- a/SpotMenu/Preferences/Tabs/GeneralPreferences.storyboard +++ b/SpotMenu/Preferences/Tabs/GeneralPreferences.storyboard @@ -1,8 +1,8 @@ - + - + @@ -11,11 +11,11 @@ - + - + @@ -63,33 +63,10 @@ - + - - - - - - + @@ -129,13 +106,46 @@ + + + + + + - + @@ -146,11 +156,13 @@ + + @@ -158,6 +170,7 @@ + @@ -184,12 +197,13 @@ + - + diff --git a/SpotMenu/Preferences/Tabs/GeneralPreferencesVC.swift b/SpotMenu/Preferences/Tabs/GeneralPreferencesVC.swift index 5901544..11a1529 100644 --- a/SpotMenu/Preferences/Tabs/GeneralPreferencesVC.swift +++ b/SpotMenu/Preferences/Tabs/GeneralPreferencesVC.swift @@ -23,6 +23,7 @@ final class GeneralPreferencesVC: NSViewController { @IBOutlet fileprivate var showPlayingIconButton: HoverButton! @IBOutlet fileprivate var showSpotMenuIconButton: HoverButton! @IBOutlet fileprivate var fixPopoverToTheRightButton: HoverButton! + @IBOutlet fileprivate var useSmallPopoverButton: HoverButton! @IBOutlet fileprivate var openAtLoginButton: HoverButton! @IBOutlet fileprivate var enableKeyboardShortcutButton: HoverButton! @IBOutlet fileprivate var hideTextWhenPausedButton: HoverButton! @@ -51,6 +52,7 @@ final class GeneralPreferencesVC: NSViewController { showPlayingIconButton.title = NSLocalizedString("Show playing icon", comment: "") showSpotMenuIconButton.title = NSLocalizedString("Show SpotMenu icon", comment: "") fixPopoverToTheRightButton.title = NSLocalizedString("Fix popover to the right", comment: "") + useSmallPopoverButton.title = NSLocalizedString("Use small popover", comment: "") openAtLoginButton.title = NSLocalizedString("Open at login", comment: "") enableKeyboardShortcutButton.title = NSLocalizedString("Enable keyboard shortcut", comment: "") hideTextWhenPausedButton.title = NSLocalizedString("Hide text when paused", comment: "") @@ -64,6 +66,7 @@ final class GeneralPreferencesVC: NSViewController { showPlayingIconButton.state = NSControl.StateValue(rawValue: UserPreferences.showPlayingIcon.asState) showSpotMenuIconButton.state = NSControl.StateValue(rawValue: UserPreferences.showSpotMenuIcon.asState) fixPopoverToTheRightButton.state = NSControl.StateValue(rawValue: UserPreferences.fixPopoverToTheRight.asState) + useSmallPopoverButton.state = NSControl.StateValue(rawValue: UserPreferences.useSmallPopover.asState) openAtLoginButton.state = NSControl.StateValue(rawValue: applicationIsInStartUpItems().asState) enableKeyboardShortcutButton.state = NSControl.StateValue(rawValue: UserPreferences.keyboardShortcutEnabled.asState) hideTextWhenPausedButton.state = NSControl.StateValue(rawValue: UserPreferences.hideTitleArtistWhenPaused.asState) @@ -87,6 +90,9 @@ final class GeneralPreferencesVC: NSViewController { fixPopoverToTheRightButton.mouseEnteredFunc = hoverFixPopoverToTheRight fixPopoverToTheRightButton.mouseExitedFunc = hoverAway + + useSmallPopoverButton.mouseEnteredFunc = hoverUseSmallPopover + useSmallPopoverButton.mouseExitedFunc = hoverAway openAtLoginButton.mouseEnteredFunc = hoverOpenAtLogin openAtLoginButton.mouseExitedFunc = hoverAway @@ -123,6 +129,10 @@ final class GeneralPreferencesVC: NSViewController { @IBAction private func toggleFixPopoverToTheRight(_: Any) { UserPreferences.fixPopoverToTheRight = fixPopoverToTheRightButton.state.asBool } + + @IBAction private func toggleUseSmallPopover(_: Any) { + UserPreferences.useSmallPopover = useSmallPopoverButton.state.asBool + } @IBAction private func toggleOpenAtLogin(_: Any) { toggleLaunchAtStartup() @@ -171,6 +181,10 @@ extension GeneralPreferencesVC { fileprivate func hoverFixPopoverToTheRight() { moreInformation.stringValue = NSLocalizedString("When checked the popover will be fixed to the right corner.", comment: "") } + + fileprivate func hoverUseSmallPopover() { + moreInformation.stringValue = NSLocalizedString("When checked a small popover will be used instead.", comment: "") + } fileprivate func hoverOpenAtLogin() { moreInformation.stringValue = NSLocalizedString("When checked SpotMenu will start automatically at login.", comment: "") diff --git a/SpotMenu/Preferences/UserPreferences.swift b/SpotMenu/Preferences/UserPreferences.swift index 634a515..37a2aa1 100644 --- a/SpotMenu/Preferences/UserPreferences.swift +++ b/SpotMenu/Preferences/UserPreferences.swift @@ -21,6 +21,7 @@ struct UserPreferences { static let showPlayingIcon = "showPlayingIcon" static let showSpotMenuIcon = "showSpotMenuIcon" static let fixPopoverToTheRight = "dropDownToTheRight" + static let useSmallPopover = "useSmallPopover" static let hasBeenInitialized = "hasBeenInitialized" static let keyboardShortcutEnabled = "keyboardShortcutEnabled" static let hideTitleArtistWhenPaused = "hideTitleArtistWhenPaused" @@ -82,6 +83,15 @@ struct UserPreferences { UserPreferences.setSetting(key: Keys.fixPopoverToTheRight, value: newValue) } } + + static var useSmallPopover: Bool { + get { + return UserPreferences.readSetting(key: Keys.useSmallPopover) + } + set { + UserPreferences.setSetting(key: Keys.useSmallPopover, value: newValue) + } + } static var keyboardShortcutEnabled: Bool { get { @@ -160,6 +170,7 @@ struct UserPreferences { UserPreferences.showPlayingIcon || UserPreferences.showSpotMenuIcon || UserPreferences.fixPopoverToTheRight || + UserPreferences.useSmallPopover || UserPreferences.keyboardShortcutEnabled || UserPreferences.hideTitleArtistWhenPaused { return From b6f7a8f672970c94b06f5e50de5ffada844b137c Mon Sep 17 00:00:00 2001 From: apidcloud Date: Thu, 21 Feb 2019 01:18:32 -0700 Subject: [PATCH 4/8] feat: update popover before opening it --- SpotMenu.xcodeproj/project.pbxproj | 2 -- SpotMenu/AppDelegate/AppDelegate.swift | 28 ++++++++++++++++++++++---- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/SpotMenu.xcodeproj/project.pbxproj b/SpotMenu.xcodeproj/project.pbxproj index 4d0881e..03da5d3 100644 --- a/SpotMenu.xcodeproj/project.pbxproj +++ b/SpotMenu.xcodeproj/project.pbxproj @@ -80,7 +80,6 @@ 64F29A091F2E5F1100E48BBD /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 64F29A0B1F2E5F1100E48BBD /* Localizable.strings */; }; 98C18916984B50AAD9E17661 /* Pods_SpotMenu.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADFCF0607F980ADD8D5D03FA /* Pods_SpotMenu.framework */; }; A02DF2CF221BB1C700222929 /* PopOverSmall.xib in Resources */ = {isa = PBXBuildFile; fileRef = A02DF2CE221BB1C700222929 /* PopOverSmall.xib */; }; - A02DF2D0221BC03500222929 /* PopOverSmall.xib in Resources */ = {isa = PBXBuildFile; fileRef = A02DF2CE221BB1C700222929 /* PopOverSmall.xib */; }; A02DF2D2221BCDB700222929 /* StaticFadeIn.swift in Sources */ = {isa = PBXBuildFile; fileRef = A02DF2D1221BCDB700222929 /* StaticFadeIn.swift */; }; A02DF2D3221BCFCD00222929 /* StaticFadeIn.swift in Sources */ = {isa = PBXBuildFile; fileRef = A02DF2D1221BCDB700222929 /* StaticFadeIn.swift */; }; DB2C500E2199F94000932042 /* ScrollingStatusItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB2C500D2199F94000932042 /* ScrollingStatusItemView.swift */; }; @@ -772,7 +771,6 @@ buildActionMask = 2147483647; files = ( 643746671F76B06900B16214 /* PopOver.xib in Resources */, - A02DF2D0221BC03500222929 /* PopOverSmall.xib in Resources */, 64185C1A1F1B8DC400CA23A0 /* InfoPlist.strings in Resources */, 64185C271F1B98C600CA23A0 /* Assets.xcassets in Resources */, ); diff --git a/SpotMenu/AppDelegate/AppDelegate.swift b/SpotMenu/AppDelegate/AppDelegate.swift index d3a705a..60ceec2 100644 --- a/SpotMenu/AppDelegate/AppDelegate.swift +++ b/SpotMenu/AppDelegate/AppDelegate.swift @@ -37,6 +37,8 @@ final class AppDelegate: NSObject, NSApplicationDelegate { private var lastStatusTitle: String = "" private var removeHudTimer: Timer? private var musicPlayerManager: MusicPlayerManager! + private var lastPopOverViewName: String = "" + private var popoverVC: PopOverViewController! private lazy var statusItem: NSStatusItem = { let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength) @@ -64,6 +66,12 @@ final class AppDelegate: NSObject, NSApplicationDelegate { self.statusItem.length = Constants.statusItemLength } } + + private var popOverViewName: String { + get { + return UserPreferences.useSmallPopover ? "PopOverSmall" : "PopOver" + } + } // MARK: - AppDelegate methods @@ -81,11 +89,10 @@ final class AppDelegate: NSObject, NSApplicationDelegate { let lastMusicPlayer = musicPlayerManager.existMusicPlayer(with: lastMusicPlayerName) musicPlayerManager.currentPlayer = lastMusicPlayer - let popoverVC = PopOverViewController(nibName: NSNib.Name(rawValue: "PopOverSmall"), bundle: nil) - popoverVC.setUpMusicPlayerManager() - hiddenController = (NSStoryboard(name: NSStoryboard.Name(rawValue: "Hidden"), bundle: nil).instantiateInitialController() as! NSWindowController) - hiddenController?.contentViewController = popoverVC + + setupPopOverWithController(viewName: popOverViewName, controller: hiddenController) + hiddenController?.window?.isOpaque = false hiddenController?.window?.backgroundColor = .clear hiddenController?.window?.level = NSWindow.Level(rawValue: Int(CGWindowLevelForKey(.floatingWindow))) @@ -309,9 +316,22 @@ final class AppDelegate: NSObject, NSApplicationDelegate { return spotMenuIcon } } + + private func setupPopOverWithController(viewName: String, controller: NSWindowController?) { + if lastPopOverViewName == viewName { return } + lastPopOverViewName = lastPopOverViewName == "" ? viewName : lastPopOverViewName + + popoverVC = PopOverViewController(nibName: NSNib.Name(rawValue: viewName), bundle: nil) + popoverVC.setUpMusicPlayerManager() + controller?.contentViewController = popoverVC + + lastPopOverViewName = viewName + } private func showPopover(_: AnyObject?) { + setupPopOverWithController(viewName: popOverViewName, controller: hiddenController) + let rect = statusItem.button?.window?.convertToScreen((statusItem.button?.frame)!) let xOffset = UserPreferences.fixPopoverToTheRight ? ((hiddenController?.window?.contentView?.frame.minX)! - (statusItem.button?.frame.minX)!) : ((hiddenController?.window?.contentView?.frame.midX)! - (statusItem.button?.frame.midX)!) let x = (rect?.origin.x)! - xOffset From 456e0df2c47262ecc9c2abc646b5c65c7f1720ff Mon Sep 17 00:00:00 2001 From: apidcloud Date: Thu, 21 Feb 2019 01:24:13 -0700 Subject: [PATCH 5/8] chore: use crashlytics --- SpotMenu/AppDelegate/AppDelegate.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpotMenu/AppDelegate/AppDelegate.swift b/SpotMenu/AppDelegate/AppDelegate.swift index 60ceec2..ab4c748 100644 --- a/SpotMenu/AppDelegate/AppDelegate.swift +++ b/SpotMenu/AppDelegate/AppDelegate.swift @@ -76,7 +76,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate { // MARK: - AppDelegate methods func applicationDidFinishLaunching(_: Notification) { - //Fabric.with([Crashlytics.self]) + Fabric.with([Crashlytics.self]) UserPreferences.initializeUserPreferences() From 32eee06733f1cc5bb2a845f2d1aed4212db79e81 Mon Sep 17 00:00:00 2001 From: apidcloud Date: Thu, 21 Feb 2019 01:38:05 -0700 Subject: [PATCH 6/8] chore: revert code signing identity --- SpotMenu.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SpotMenu.xcodeproj/project.pbxproj b/SpotMenu.xcodeproj/project.pbxproj index 03da5d3..c40fabc 100644 --- a/SpotMenu.xcodeproj/project.pbxproj +++ b/SpotMenu.xcodeproj/project.pbxproj @@ -1108,7 +1108,7 @@ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CODE_SIGN_ENTITLEMENTS = SpotMenuToday/SpotMenuToday.entitlements; - CODE_SIGN_IDENTITY = ""; + CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; DEVELOPMENT_TEAM = 3K79XCJYWL; @@ -1132,7 +1132,7 @@ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CODE_SIGN_ENTITLEMENTS = SpotMenuToday/SpotMenuToday.entitlements; - CODE_SIGN_IDENTITY = ""; + CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; DEVELOPMENT_TEAM = 3K79XCJYWL; From 544ecda08013a253da16ae3cc9bc4eef882d5402 Mon Sep 17 00:00:00 2001 From: apidcloud Date: Thu, 21 Feb 2019 01:53:25 -0700 Subject: [PATCH 7/8] chore: revert code signing identity --- SpotMenu.xcodeproj/project.pbxproj | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/SpotMenu.xcodeproj/project.pbxproj b/SpotMenu.xcodeproj/project.pbxproj index c40fabc..b49b796 100644 --- a/SpotMenu.xcodeproj/project.pbxproj +++ b/SpotMenu.xcodeproj/project.pbxproj @@ -1063,10 +1063,10 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = SpotMenu/SpotMenu.entitlements; - CODE_SIGN_IDENTITY = ""; + CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 3K79XCJYWL; INFOPLIST_FILE = SpotMenu/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.KMikiy.SpotMenu; @@ -1087,10 +1087,10 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = SpotMenu/SpotMenu.entitlements; - CODE_SIGN_IDENTITY = ""; + CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 3K79XCJYWL; INFOPLIST_FILE = SpotMenu/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.KMikiy.SpotMenu; @@ -1157,7 +1157,7 @@ CLANG_ENABLE_MODULES = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_IDENTITY = ""; + CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; @@ -1191,7 +1191,7 @@ CLANG_ENABLE_MODULES = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_IDENTITY = ""; + CODE_SIGN_IDENTITY = "Mac Developer"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; From 3f05391d3b3c392efb8e24105178d29eed408106 Mon Sep 17 00:00:00 2001 From: apidcloud Date: Thu, 21 Feb 2019 01:58:14 -0700 Subject: [PATCH 8/8] chore: revert code signing identity --- SpotMenu.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SpotMenu.xcodeproj/project.pbxproj b/SpotMenu.xcodeproj/project.pbxproj index b49b796..b212513 100644 --- a/SpotMenu.xcodeproj/project.pbxproj +++ b/SpotMenu.xcodeproj/project.pbxproj @@ -1157,7 +1157,7 @@ CLANG_ENABLE_MODULES = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_IDENTITY = "Mac Developer"; + CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; @@ -1191,7 +1191,7 @@ CLANG_ENABLE_MODULES = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_IDENTITY = "Mac Developer"; + CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1;