Skip to content

Commit

Permalink
Updated external libs (MASShortcut & Sparkle)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Hanson committed Jan 14, 2020
1 parent 75e4b53 commit 4efa960
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 26 deletions.
14 changes: 7 additions & 7 deletions Podfile.lock
@@ -1,20 +1,20 @@
PODS:
- MASShortcut (2.3.6)
- Sparkle (1.21.3)
- MASShortcut (2.4.0)
- Sparkle (1.22.0)

DEPENDENCIES:
- MASShortcut
- Sparkle

SPEC REPOS:
https://github.com/cocoapods/specs.git:
trunk:
- MASShortcut
- Sparkle

SPEC CHECKSUMS:
MASShortcut: 9c215e8a8a78f3d01ce56da48e2730ab66b538fa
Sparkle: 3f75576db8b0265adef36c43249d747f22d0b708
MASShortcut: d9e4909e878661cc42877cc9d6efbe638273ab57
Sparkle: 593ac2e677c07bcb6c3b22d621240e7cbedaab57

PODFILE CHECKSUM: 9d924c34b8abce32760985160284c3feccaedcd7
PODFILE CHECKSUM: 8cc8e127e49dd104a2ef51ae95acef123648eab6

COCOAPODS: 1.7.0
COCOAPODS: 1.8.4
24 changes: 10 additions & 14 deletions Rectangle.xcodeproj/xcshareddata/xcschemes/Rectangle.xcscheme
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1030"
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -27,6 +27,15 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9824700822AF9B7D0037B409"
BuildableName = "Rectangle.app"
BlueprintName = "Rectangle"
ReferencedContainer = "container:Rectangle.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -39,17 +48,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9824700822AF9B7D0037B409"
BuildableName = "Rectangle.app"
BlueprintName = "Rectangle"
ReferencedContainer = "container:Rectangle.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -71,8 +69,6 @@
ReferencedContainer = "container:Rectangle.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
7 changes: 4 additions & 3 deletions Rectangle/AppDelegate.swift
Expand Up @@ -148,9 +148,10 @@ extension AppDelegate: NSMenuDelegate {
menuItem.image?.size = NSSize(width: 18, height: 12)

if !applicationToggle.shortcutsDisabled {
if let fullKeyEquivalent = shortcutManager.getKeyEquivalent(action: windowAction) {
menuItem.keyEquivalent = fullKeyEquivalent.0.lowercased()
menuItem.keyEquivalentModifierMask = NSEvent.ModifierFlags(rawValue: fullKeyEquivalent.1)
if let fullKeyEquivalent = shortcutManager.getKeyEquivalent(action: windowAction),
let keyEquivalent = fullKeyEquivalent.0?.lowercased() {
menuItem.keyEquivalent = keyEquivalent
menuItem.keyEquivalentModifierMask = fullKeyEquivalent.1
}
}
if frontmostWindow == nil {
Expand Down
4 changes: 2 additions & 2 deletions Rectangle/ShortcutManager.swift
Expand Up @@ -35,7 +35,7 @@ class ShortcutManager {
}
}

public func getKeyEquivalent(action: WindowAction) -> (String, UInt)? {
public func getKeyEquivalent(action: WindowAction) -> (String?, NSEvent.ModifierFlags)? {
guard let masShortcut = MASShortcutBinder.shared()?.value(forKey: action.name) as? MASShortcut else { return nil }
return (masShortcut.keyCodeString, masShortcut.modifierFlags)
}
Expand All @@ -51,7 +51,7 @@ class ShortcutManager {
? windowAction.alternateDefault
: windowAction.spectacleDefault
else { return }
let shortcut = MASShortcut(keyCode: UInt(defaultShortcut.keyCode), modifierFlags: defaultShortcut.modifierFlags)
let shortcut = MASShortcut(keyCode: defaultShortcut.keyCode, modifierFlags: NSEvent.ModifierFlags(rawValue: defaultShortcut.modifierFlags))
dict[windowAction.name] = shortcut
}

Expand Down

0 comments on commit 4efa960

Please sign in to comment.