Skip to content

Commit

Permalink
Merge branch 'release/1.2.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
MainasuK committed Jun 4, 2020
2 parents 648b145 + d91e958 commit 0eac1b4
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 48 deletions.
1 change: 0 additions & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ target 'Song Rating' do

# Pods for Song Rating
pod 'MASShortcut'
pod 'DominantColor', :git => 'https://github.com/indragiek/DominantColor.git'

target 'Song RatingTests' do
inherit! :search_paths
Expand Down
18 changes: 3 additions & 15 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,28 +1,16 @@
PODS:
- DominantColor (0.1.0)
- MASShortcut (2.4.0)

DEPENDENCIES:
- DominantColor (from `https://github.com/indragiek/DominantColor.git`)
- MASShortcut

SPEC REPOS:
https://github.com/CocoaPods/Specs.git:
trunk:
- MASShortcut

EXTERNAL SOURCES:
DominantColor:
:git: https://github.com/indragiek/DominantColor.git

CHECKOUT OPTIONS:
DominantColor:
:commit: 4a46b75f6c9230b374bce6d92b78e54a3107b167
:git: https://github.com/indragiek/DominantColor.git

SPEC CHECKSUMS:
DominantColor: 78c1f1ca1143b3bdf599187c7875df92d76b934d
MASShortcut: d9e4909e878661cc42877cc9d6efbe638273ab57

PODFILE CHECKSUM: 22990987400160704799d9a65bb9be8983c907a2
PODFILE CHECKSUM: 10e6f5005867dbb3964c6d40690aff5abd64540b

COCOAPODS: 1.8.4
COCOAPODS: 1.9.1
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ macOS app for rating music in iTunes/Music.app
### How can I check the track rating in iTunes/Music.app?
Check the checkbox for "Star Ratings" in General preferences. [More info](https://support.apple.com/guide/music/general-preferences-mus4130f48/mac)

### Why the popover player sometimes follows to new screen scenes but sometimes not?
The popover will jump to new scren scene when it get focused. It will stand in the old screen if the current focused window not the popover.

### Why Song Rating not show star rating when iTunes/Music playing?
Please check the Security & Privacy settings and check the checkbox of Song Rating.
![Automation](./Press/Automation.png)
12 changes: 7 additions & 5 deletions Song Rating.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1110;
LastUpgradeCheck = 1110;
LastUpgradeCheck = 1150;
ORGANIZATIONNAME = "Cirno MainasuK";
TargetAttributes = {
DB106C4122C53D4B00502D7C = {
Expand Down Expand Up @@ -768,15 +768,15 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 8;
CURRENT_PROJECT_VERSION = 9;
DEVELOPMENT_TEAM = A8K92XFF77;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = "Song Rating/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 1.2.3;
MARKETING_VERSION = 1.2.4;
PRODUCT_BUNDLE_IDENTIFIER = "com.mainasuk.Song-Rating";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -796,15 +796,15 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 8;
CURRENT_PROJECT_VERSION = 9;
DEVELOPMENT_TEAM = A8K92XFF77;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = "Song Rating/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 1.2.3;
MARKETING_VERSION = 1.2.4;
PRODUCT_BUNDLE_IDENTIFIER = "com.mainasuk.Song-Rating";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -862,6 +862,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = "Song Rating Helper/Song_Rating_Helper.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = A8K92XFF77;
Expand All @@ -884,6 +885,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = "Song Rating Helper/Song_Rating_Helper.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = A8K92XFF77;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1110"
LastUpgradeVersion = "1150"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1110"
LastUpgradeVersion = "1150"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<key>Song Rating Helper.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>7</integer>
<integer>6</integer>
</dict>
<key>Song Rating.xcscheme_^#shared#^_</key>
<dict>
Expand Down
60 changes: 36 additions & 24 deletions Song Rating/Controllers/PlayerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,25 @@
// Copyright © 2019 Cirno MainasuK. All rights reserved.
//

import Cocoa
import os
import DominantColor
import Cocoa
import CoreImage

final class PlayerViewController: NSViewController {

private let playerPanelViewController = PlayerPanelViewController()
private let playerHistoryViewController = PlayerHistoryViewController()

// cover
// back cover with blur effect
private let backCoverImageView: MovableImageView = {
let view = MovableImageView()
view.wantsLayer = true
view.layer = CALayer()
view.layer?.contentsGravity = CALayerContentsGravity.resizeAspectFill
return view
}()
private let backCoverImageVisualEffectView: NSVisualEffectView = {
let visualEffectView = NSVisualEffectView()
visualEffectView.blendingMode = .withinWindow
visualEffectView.material = .hudWindow
visualEffectView.isEmphasized = true
visualEffectView.state = .active
return visualEffectView
}()

// normal cover
private let coverImageView: MovableImageView = {
let imageView = MovableImageView()
imageView.imageScaling = .scaleProportionallyUpOrDown
Expand Down Expand Up @@ -129,7 +123,7 @@ extension PlayerViewController {
playerPanelViewController.delegate = self

// V-StackView
// - backCoverImageVisualEffectView & coverImageView
// - backCoverImageView & coverImageView
// - playerInfoView
// - playerHistoryViewController

Expand All @@ -151,18 +145,9 @@ extension PlayerViewController {
coverImageView.widthAnchor.constraint(equalToConstant: 300),
coverImageView.heightAnchor.constraint(equalTo: coverImageView.widthAnchor),
])

backCoverImageVisualEffectView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(backCoverImageVisualEffectView, positioned: .below, relativeTo: coverImageView)
NSLayoutConstraint.activate([
backCoverImageVisualEffectView.topAnchor.constraint(equalTo: coverImageView.topAnchor),
backCoverImageVisualEffectView.leadingAnchor.constraint(equalTo: coverImageView.leadingAnchor),
backCoverImageVisualEffectView.trailingAnchor.constraint(equalTo: coverImageView.trailingAnchor),
backCoverImageVisualEffectView.bottomAnchor.constraint(equalTo: coverImageView.bottomAnchor),
])


backCoverImageView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(backCoverImageView, positioned: .below, relativeTo: backCoverImageVisualEffectView)
view.addSubview(backCoverImageView, positioned: .below, relativeTo: stackView)
NSLayoutConstraint.activate([
backCoverImageView.topAnchor.constraint(equalTo: coverImageView.topAnchor),
backCoverImageView.leadingAnchor.constraint(equalTo: coverImageView.leadingAnchor),
Expand Down Expand Up @@ -278,7 +263,34 @@ extension PlayerViewController {
coverImageView.layer?.add(transition, forKey: nil)

coverImageView.image = image
backCoverImageView.layer?.contents = image
backCoverImageView.layer?.contents = NSImage(size: coverImageView.frame.size, flipped: true) { rect -> Bool in
let context = CIContext()
guard let tiffData = image.tiffRepresentation, let ciImage = CIImage(data: tiffData),
let clampFilter = CIFilter(name: "CIAffineClamp"),
let gaussianBlur = CIFilter(name: "CIGaussianBlur") else {
return true
}
let extent = ciImage.extent

clampFilter.setValue(ciImage, forKey: kCIInputImageKey)
clampFilter.setValue(NSAffineTransform(transform: .identity), forKey: kCIInputTransformKey)
guard let clampFilterOutput = clampFilter.outputImage else {
return true
}

gaussianBlur.setValue(clampFilterOutput, forKey: kCIInputImageKey)
gaussianBlur.setValue(100, forKey: kCIInputRadiusKey)

guard let outputImage = gaussianBlur.outputImage,
let cgImage = context.createCGImage(outputImage, from: extent) else {
return true
}

let nsImage = NSImage(cgImage: cgImage, size: .zero)
nsImage.draw(in: rect)

return true
}

} else {
coverImageView.image = nil
Expand Down
1 change: 1 addition & 0 deletions Song Rating/Controllers/PopoverViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ final class PopoverViewController: NSViewController {
visualEffectView.state = .active

visualEffectView.alphaValue = 0
visualEffectView.maskImage = NSImage(named: NSImage.stopProgressFreestandingTemplateName) // clip non-button part effect out

return visualEffectView
}()
Expand Down

0 comments on commit 0eac1b4

Please sign in to comment.