Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
ddddxxx committed Oct 3, 2020
2 parents 9b4e4aa + af900bf commit 171398b
Show file tree
Hide file tree
Showing 75 changed files with 1,005 additions and 1,583 deletions.
4 changes: 2 additions & 2 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github "ddddxxx/DFRPrivate"

github "SnapKit/SnapKit" == 5.0.0

github "shpakovski/MASShortcut"

github "sparkle-project/Sparkle"

github "microsoft/appcenter-sdk-apple"
4 changes: 2 additions & 2 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github "SnapKit/SnapKit" "5.0.0"
github "ddddxxx/DFRPrivate" "v1.0.1"
github "microsoft/appcenter-sdk-apple" "3.2.0"
github "shpakovski/MASShortcut" "2.4.0"
github "sparkle-project/Sparkle" "1.21.3"
github "sparkle-project/Sparkle" "v1.23.0"
184 changes: 127 additions & 57 deletions LyricsX.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"repositoryURL": "https://github.com/cx-org/CombineX",
"state": {
"branch": null,
"revision": "6bc3b53533711871cf0d96e50c2a2c733abb4d47",
"version": "0.2.0"
"revision": "9ce154b155643ec8939d84cb6ae00c331ff3eca0",
"version": "0.2.1"
}
},
{
Expand All @@ -24,8 +24,8 @@
"repositoryURL": "https://github.com/ddddxxx/GenericID.git",
"state": {
"branch": null,
"revision": "42c61a3a266f61448800f237199ad39e6083060b",
"version": "0.5.0"
"revision": "3f6f529365c04a833f983a835a3fadc1c987ddc5",
"version": "0.5.1"
}
},
{
Expand Down Expand Up @@ -69,8 +69,8 @@
"repositoryURL": "https://github.com/Quick/Quick.git",
"state": {
"branch": null,
"revision": "33682c2f6230c60614861dfc61df267e11a1602f",
"version": "2.2.0"
"revision": "09b3becb37cb2163919a3842a4c5fa6ec7130792",
"version": "2.2.1"
}
},
{
Expand All @@ -96,8 +96,8 @@
"repositoryURL": "https://github.com/ddddxxx/SwiftCF.git",
"state": {
"branch": null,
"revision": "1d0af3a0a2fce803e8f51a033847cf3c70e4e8ad",
"version": "0.1.1"
"revision": "efb0309d747cc0d0c288859cbb637947860e4a2e",
"version": "0.1.3"
}
},
{
Expand All @@ -108,6 +108,15 @@
"revision": "64a4534c17480b15b87cfa114ffcc5aa26a2d35f",
"version": "1.0.1"
}
},
{
"package": "TouchBarHelper",
"repositoryURL": "https://github.com/ddddxxx/TouchBarHelper",
"state": {
"branch": null,
"revision": "003d41193ac1c6ab9cc570a1923587298014bf1d",
"version": "0.1.0"
}
}
]
},
Expand Down
10 changes: 3 additions & 7 deletions LyricsX.xcodeproj/xcshareddata/xcschemes/LyricsX.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
LastUpgradeVersion = "1200"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -27,8 +27,6 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
Expand All @@ -38,8 +36,8 @@
ReferencedContainer = "container:LyricsX.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -61,8 +59,6 @@
ReferencedContainer = "container:LyricsX.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
298 changes: 102 additions & 196 deletions LyricsX/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions LyricsX/Base.lproj/Preferences.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="16097" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="dJj-XH-edl">
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="16097.2" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="dJj-XH-edl">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="16097"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="16097.2"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand Down
7 changes: 2 additions & 5 deletions LyricsX/Component/AppController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
//

import AppKit
import CombineX
import Crashlytics
import CXShim
import CXExtensions
import LyricsService
import MusicPlayer
Expand Down Expand Up @@ -62,7 +61,7 @@ class AppController: NSObject {
.invoke(AppController.scheduleCurrentLineCheck, weaklyOn: self)
.store(in: &cancelBag)

defaultNC.cx.publisher(for: NSWorkspace.didTerminateApplicationNotification, object: nil)
workspaceNC.cx.publisher(for: NSWorkspace.didTerminateApplicationNotification, object: nil)
.sink { n in
let bundleID = (n.userInfo![NSWorkspace.applicationUserInfoKey] as! NSRunningApplication).bundleIdentifier
if defaults[.launchAndQuitWithPlayer], (selectedPlayer.designatedPlayer as? MusicPlayers.Scriptable)?.playerBundleID == bundleID {
Expand Down Expand Up @@ -179,7 +178,6 @@ class AppController: NSObject {
lyrics.filtrate()
lyrics.recognizeLanguage()
currentLyrics = lyrics
Answers.logCustomEvent(withName: "Load Local Lyrics")
if needsSearching {
break
} else {
Expand Down Expand Up @@ -216,7 +214,6 @@ class AppController: NSObject {
}, receiveValue: { [unowned self] lyrics in
self.lyricsReceived(lyrics: lyrics)
})
Answers.logCustomEvent(withName: "Search Lyrics Automatically", customAttributes: ["override": currentLyrics == nil ? 0 : 1])
}

// MARK: LyricsSourceDelegate
Expand Down
54 changes: 34 additions & 20 deletions LyricsX/Component/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
//

import Cocoa
import Crashlytics
import Fabric
import GenericID
import MASShortcut
import MusicPlayer
import AppCenter
import AppCenterAnalytics
import AppCenterCrashes

#if !IS_FOR_MAS
import Sparkle
Expand All @@ -27,14 +28,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation, NSMenu
@IBOutlet weak var lyricsOffsetStepper: NSStepper!
@IBOutlet weak var statusBarMenu: NSMenu!

var desktopLyrics: KaraokeLyricsWindowController?

var _touchBarLyrics: Any?

@available(OSX 10.12.2, *)
var touchBarLyrics: TouchBarLyrics? {
return self._touchBarLyrics as! TouchBarLyrics?
}
var karaokeLyricsWC: KaraokeLyricsWindowController?

lazy var searchLyricsWC: NSWindowController = {
// swiftlint:disable:next force_cast
Expand All @@ -47,15 +41,18 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation, NSMenu
func applicationDidFinishLaunching(_ aNotification: Notification) {
registerUserDefaults()
#if RELEASE
Fabric.with([Crashlytics.self])
MSAppCenter.start("36777a05-06fd-422e-9375-a934b3c835a5", withServices:[
MSAnalytics.self,
MSCrashes.self
])
#endif

let controller = AppController.shared

desktopLyrics = KaraokeLyricsWindowController()
desktopLyrics?.showWindow(nil)
karaokeLyricsWC = KaraokeLyricsWindowController()
karaokeLyricsWC?.showWindow(nil)

MenuBarLyrics.shared.statusItem.menu = statusBarMenu
MenuBarLyricsController.shared.statusItem.menu = statusBarMenu
statusBarMenu.delegate = self

lyricsOffsetStepper.bind(.value,
Expand Down Expand Up @@ -84,11 +81,11 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation, NSMenu
#else
SUUpdater.shared()?.checkForUpdatesInBackground()
if #available(OSX 10.12.2, *) {
observeDefaults(key: .touchBarLyricsEnabled, options: [.new, .initial]) { [unowned self] _, change in
if change.newValue, self.touchBarLyrics == nil {
self._touchBarLyrics = TouchBarLyrics()
} else if !change.newValue, self.touchBarLyrics != nil {
self._touchBarLyrics = nil
observeDefaults(key: .touchBarLyricsEnabled, options: [.new, .initial]) { _, change in
if change.newValue, TouchBarLyricsController.shared == nil {
TouchBarLyricsController.shared = TouchBarLyricsController()
} else if !change.newValue, TouchBarLyricsController.shared != nil {
TouchBarLyricsController.shared = nil
}
}
}
Expand All @@ -100,7 +97,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation, NSMenu
AppController.shared.currentLyrics?.persist()
}
if defaults[.launchAndQuitWithPlayer] {
let url = Bundle.main.bundleURL.appendingPathComponent("Contents/Library/LoginItems/LyricsXHelper.app")
let url = Bundle.main.bundleURL
.appendingPathComponent("Contents/Library/LoginItems/LyricsXHelper.app")
groupDefaults[.launchHelperTime] = Date()
do {
try NSWorkspace.shared.launchApplication(at: url, configuration: [:])
Expand Down Expand Up @@ -152,6 +150,22 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation, NSMenu
lyricsHUD = controller
}

@IBAction func aboutLyricsXAction(_ sender: Any) {
if #available(OSX 10.13, *) {
let version = Bundle.main.infoDictionary!["CFBundleShortVersionString"] as! String
#if IS_FOR_MAS
let channel = "App Store"
#else
let channel = "GitHub"
#endif
let versionString = "\(channel) Version \(version)"
NSApp.orderFrontStandardAboutPanel(options: [.applicationVersion: versionString])
} else {
NSApp.orderFrontStandardAboutPanel(sender)
}
NSApp.activate(ignoringOtherApps: true)
}

@IBAction func checkUpdateAction(_ sender: Any) {
#if IS_FOR_MAS
assert(false, "should not be there")
Expand Down
2 changes: 1 addition & 1 deletion LyricsX/Component/SelectedPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation
import MusicPlayer
import GenericID
import CombineX
import CXShim

extension MusicPlayers {

Expand Down
2 changes: 1 addition & 1 deletion LyricsX/Component/TouchBarArtworkViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import AppKit
import CombineX
import CXShim
import MusicPlayer

class TouchBarArtworkViewController: NSViewController {
Expand Down
2 changes: 1 addition & 1 deletion LyricsX/Component/TouchBarLyricsItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import AppKit
import CombineX
import CXShim
import LyricsCore
import OpenCC

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import AppKit
import MusicPlayer
import CombineX
import CXShim

@available(OSX 10.12.2, *)
class TouchBarPlaybackControlViewController: NSViewController {
Expand Down
44 changes: 0 additions & 44 deletions LyricsX/Controller/AboutViewController.swift

This file was deleted.

16 changes: 16 additions & 0 deletions LyricsX/Controller/DebugViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// DebugViewController.swift
//
// This file is part of LyricsX - https://github.com/ddddxxx/LyricsX
// Copyright (C) 2017 Xander Deng. Licensed under GPLv3.
//

import Cocoa
import AppCenterCrashes

class DebugViewController: NSViewController {

@IBAction func crashActioin(_ sender: Any) {
MSCrashes.generateTestCrash()
}
}
15 changes: 15 additions & 0 deletions LyricsX/Controller/DonateViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// DonateViewController.swift
//
// This file is part of LyricsX - https://github.com/ddddxxx/LyricsX
// Copyright (C) 2020 Xander Deng. Licensed under GPLv3.
//

import Cocoa

class DonateViewController: NSViewController {

@IBAction func showDebugPanelAction(_ sender: Any) {
performSegue(withIdentifier: "ShowDebugPanel", sender: sender)
}
}
Loading

0 comments on commit 171398b

Please sign in to comment.