Skip to content

Commit

Permalink
Merge pull request #11 from dwarvesf/develop
Browse files Browse the repository at this point in the history
[Release] v1.2.0
  • Loading branch information
phucledien authored Jun 23, 2020
2 parents 8286312 + 2114772 commit 4d81e52
Show file tree
Hide file tree
Showing 13 changed files with 328 additions and 19 deletions.
47 changes: 39 additions & 8 deletions Blurred.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
5515742323C43FC5006BE18F /* StatusBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5515742223C43FC5006BE18F /* StatusBarController.swift */; };
5515742523C46FE8006BE18F /* UserDefaults+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5515742423C46FE8006BE18F /* UserDefaults+Extension.swift */; };
553B8D1B23C2E43D0009CA0F /* DimManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 553B8D1A23C2E43D0009CA0F /* DimManager.swift */; };
557D86AF2473878900C4B809 /* StatusBarSwipeToSetAlphaView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 557D86AE2473878900C4B809 /* StatusBarSwipeToSetAlphaView.swift */; };
B32C8D902498D3A9003562C9 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = B32C8D922498D3A9003562C9 /* Localizable.strings */; };
B32C8D992498E837003562C9 /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B32C8D982498E837003562C9 /* String+Extension.swift */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -77,6 +80,13 @@
5515742223C43FC5006BE18F /* StatusBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusBarController.swift; sourceTree = "<group>"; };
5515742423C46FE8006BE18F /* UserDefaults+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UserDefaults+Extension.swift"; sourceTree = "<group>"; };
553B8D1A23C2E43D0009CA0F /* DimManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DimManager.swift; sourceTree = "<group>"; };
557D86AE2473878900C4B809 /* StatusBarSwipeToSetAlphaView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusBarSwipeToSetAlphaView.swift; sourceTree = "<group>"; };
B32C8D812498CF8D003562C9 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Main.strings; sourceTree = "<group>"; };
B32C8D8C2498D0F7003562C9 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Main.strings"; sourceTree = "<group>"; };
B32C8D8D2498D0F7003562C9 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Main.strings"; sourceTree = "<group>"; };
B32C8D912498D3A9003562C9 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
B32C8D932498D3AE003562C9 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
B32C8D982498E837003562C9 /* String+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extension.swift"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -102,6 +112,7 @@
0850B62224208EA200717EDE /* Views */ = {
isa = PBXGroup;
children = (
557D86AE2473878900C4B809 /* StatusBarSwipeToSetAlphaView.swift */,
0850B62324208EC300717EDE /* LinkView.swift */,
0851749A23FD099400B3B84F /* GeneralView.swift */,
0850B62524208EE700717EDE /* AboutView.swift */,
Expand Down Expand Up @@ -167,6 +178,7 @@
55AA99F523B07AB8005478F2 /* ViewControllers */,
08FF678C23A9156A00EACD58 /* AppDelegate.swift */,
08FF679023A9156C00EACD58 /* Assets.xcassets */,
B32C8D922498D3A9003562C9 /* Localizable.strings */,
08FF679223A9156C00EACD58 /* Main.storyboard */,
08FF679523A9156C00EACD58 /* Info.plist */,
08FF678A23A9156A00EACD58 /* Products */,
Expand Down Expand Up @@ -195,6 +207,7 @@
0853667823C58F1E00567AA8 /* Collection+Extension.swift */,
083501CB23C5DF0400F6E567 /* EventMonitor.swift */,
08203CCF23CD9CBE0006AE7C /* Bundle+Extension.swift */,
B32C8D982498E837003562C9 /* String+Extension.swift */,
);
path = Utilities;
sourceTree = "<group>";
Expand Down Expand Up @@ -265,6 +278,7 @@
knownRegions = (
en,
Base,
"zh-Hans",
);
mainGroup = 08FF678023A9156A00EACD58;
packageReferences = (
Expand Down Expand Up @@ -295,6 +309,7 @@
buildActionMask = 2147483647;
files = (
08FF679123A9156C00EACD58 /* Assets.xcassets in Resources */,
B32C8D902498D3A9003562C9 /* Localizable.strings in Resources */,
08FF679423A9156C00EACD58 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -317,6 +332,7 @@
0850B62624208EE700717EDE /* AboutView.swift in Sources */,
553B8D1B23C2E43D0009CA0F /* DimManager.swift in Sources */,
083501CC23C5DF0400F6E567 /* EventMonitor.swift in Sources */,
B32C8D992498E837003562C9 /* String+Extension.swift in Sources */,
0850B6282420ABCB00717EDE /* GeneralViewController.swift in Sources */,
5515742323C43FC5006BE18F /* StatusBarController.swift in Sources */,
0851749B23FD099400B3B84F /* SettingObservable.swift in Sources */,
Expand All @@ -330,6 +346,7 @@
0853667923C58F1E00567AA8 /* Collection+Extension.swift in Sources */,
0853667723C4C0AC00567AA8 /* WindowInfo.swift in Sources */,
085174A323FD2EF300B3B84F /* GlobalKeyBindPreferences.swift in Sources */,
557D86AF2473878900C4B809 /* StatusBarSwipeToSetAlphaView.swift in Sources */,
0851749C23FD099400B3B84F /* GeneralView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -341,6 +358,7 @@
isa = PBXVariantGroup;
children = (
0889D10B23C4721100E867FF /* Base */,
B32C8D8D2498D0F7003562C9 /* zh-Hans */,
);
name = Main.storyboard;
sourceTree = "<group>";
Expand All @@ -349,10 +367,21 @@
isa = PBXVariantGroup;
children = (
08FF679323A9156C00EACD58 /* Base */,
B32C8D812498CF8D003562C9 /* en */,
B32C8D8C2498D0F7003562C9 /* zh-Hans */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
B32C8D922498D3A9003562C9 /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (
B32C8D912498D3A9003562C9 /* zh-Hans */,
B32C8D932498D3AE003562C9 /* en */,
);
name = Localizable.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
Expand All @@ -363,7 +392,7 @@
CODE_SIGN_ENTITLEMENTS = BlurredLauncher/BlurredLauncher.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = W777S7V8TN;
DEVELOPMENT_TEAM = VGURA84Q2L;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = BlurredLauncher/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -385,7 +414,7 @@
CODE_SIGN_ENTITLEMENTS = BlurredLauncher/BlurredLauncher.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = W777S7V8TN;
DEVELOPMENT_TEAM = VGURA84Q2L;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = BlurredLauncher/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -404,6 +433,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
Expand Down Expand Up @@ -464,6 +494,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
Expand Down Expand Up @@ -521,16 +552,16 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = W777S7V8TN;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_TEAM = VGURA84Q2L;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = Blurred/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 1.1.0;
MARKETING_VERSION = 1.2.0;
PRODUCT_BUNDLE_IDENTIFIER = foundation.dwarves.blurred;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -546,16 +577,16 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = W777S7V8TN;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_TEAM = VGURA84Q2L;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = Blurred/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 1.1.0;
MARKETING_VERSION = 1.2.0;
PRODUCT_BUNDLE_IDENTIFIER = foundation.dwarves.blurred;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
6 changes: 4 additions & 2 deletions Blurred/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="15705" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="16096" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15705"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="16096"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand Down Expand Up @@ -158,10 +158,12 @@
</connections>
</window>
<connections>
<outlet property="segmentController" destination="1TP-Xp-Bdd" id="21q-5x-07N"/>
<segue destination="DOm-ST-mwr" kind="relationship" relationship="window.shadowedContentViewController" id="NAV-y9-itP"/>
</connections>
</windowController>
<customObject id="w3E-TA-97t" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
<userDefaultsController representsSharedInstance="YES" id="Wvd-EC-ZUa"/>
</objects>
<point key="canvasLocation" x="-252" y="252"/>
</scene>
Expand Down
15 changes: 15 additions & 0 deletions Blurred/Utilities/String+Extension.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// String+Extension.swift
// Blurred
//
// Created by Peter Luo on 2020/6/16.
// Copyright © 2020 Dwarves Foundation. All rights reserved.
//

import Foundation

extension String {
var localized: String {
return NSLocalizedString(self, comment: "")
}
}
11 changes: 9 additions & 2 deletions Blurred/ViewControllers/PreferencesWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import SwiftUI
import HotKey

class PreferencesWindowController: NSWindowController {

@IBOutlet weak var segmentController: NSSegmentedControl!

enum MenuSegment: Int {
case general
case about
Expand Down Expand Up @@ -38,6 +41,10 @@ class PreferencesWindowController: NSWindowController {
override func windowDidLoad() {
super.windowDidLoad()
updateVC()

// Set localized titles for segment labels
self.segmentController.setLabel("General".localized, forSegment: 0)
self.segmentController.setLabel("About".localized, forSegment: 1)
}


Expand All @@ -50,10 +57,10 @@ class PreferencesWindowController: NSWindowController {
switch menuSegment {
case .general:
self.window?.contentViewController = generalVC
self.window?.title = "General"
self.window?.title = "General".localized
case .about:
self.window?.contentViewController = aboutVC
self.window?.title = "About"
self.window?.title = "About".localized
}

var windowOrigin = CGPoint(x: 0, y: 0)
Expand Down
15 changes: 9 additions & 6 deletions Blurred/ViewControllers/StatusBarController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ class StatusBarController{
private func setupView() {
if let button = menuStatusItem.button {
button.image = #imageLiteral(resourceName: "ico_menu")

let swipeView = StatusBarSwipeToSetAlphaView(frame: CGRect(origin: CGPoint(x: 0, y: 0), size: button.frame.size))
button.addSubview(swipeView)
}
menuStatusItem.menu = getContextMenu()
}
Expand Down Expand Up @@ -56,15 +59,15 @@ class StatusBarController{
private func getContextMenu() -> NSMenu {
let menu = NSMenu()
let sliderMenuItem = NSMenuItem()
let titleEnable = DimManager.sharedInstance.setting.isEnabled ? "Disable" : "Enable"
let titleEnable = DimManager.sharedInstance.setting.isEnabled ? "Disable".localized : "Enable".localized

let enableButton = NSMenuItem(title: titleEnable, action: #selector(toggleEnable), keyEquivalent: "E")
enableButton.target = self

DimManager.sharedInstance.setting.$isEnabled
.receive(on: DispatchQueue.main)
.sink {[weak enableButton] isEnabled in
let title = isEnabled ? "Disable" : "Enable"
let title = isEnabled ? "Disable".localized : "Enable".localized
enableButton?.title = title
}
.store(in: &cancellableSet)
Expand All @@ -82,15 +85,15 @@ class StatusBarController{
])

sliderMenuItem.view = view
menu.addItem(withTitle: "Slide to set Dim level", action: nil, keyEquivalent: "")
menu.addItem(withTitle: "Slide to set Dim level".localized, action: nil, keyEquivalent: "")
menu.addItem(sliderMenuItem)
menu.addItem(NSMenuItem.separator())
menu.addItem(enableButton)
menu.addItem(NSMenuItem.separator())
menu.addItem(NSMenuItem(title: "Preferences...", action: #selector(openPreferences), keyEquivalent: "P"))
menu.addItem(NSMenuItem(title: "Preferences...".localized, action: #selector(openPreferences), keyEquivalent: "P"))
menu.addItem(NSMenuItem.separator())
menu.addItem(NSMenuItem(title: "Quit", action: #selector(NSApplication.terminate(_:)), keyEquivalent: "q"))
menu.item(withTitle: "Preferences...")?.target = self
menu.addItem(NSMenuItem(title: "Quit".localized, action: #selector(NSApplication.terminate(_:)), keyEquivalent: "q"))
menu.item(withTitle: "Preferences...".localized)?.target = self
return menu
}

Expand Down
2 changes: 1 addition & 1 deletion Blurred/Views/LinkView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct LinkView: View {
.frame(width: 16)
.foregroundColor(.primary)

Text(title)
Text(title.localized)
.fontWeight(.medium)
.foregroundColor(.primary)
}
Expand Down
24 changes: 24 additions & 0 deletions Blurred/Views/StatusBarSwipeToSetAlphaView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// MySwipeStatusBar.swift
// Blurred
//
// Created by Trung Phan on 5/19/20.
// Copyright © 2020 Dwarves Foundation. All rights reserved.
//

import Cocoa

class StatusBarSwipeToSetAlphaView: NSView {
override func wantsScrollEventsForSwipeTracking(on axis: NSEvent.GestureAxis) -> Bool {
if axis == .vertical {
return true
}
return false
}

override func scrollWheel(with event: NSEvent) {

if event.deltaY > 0 { if (DimManager.sharedInstance.setting.alpha > 10.0) { DimManager.sharedInstance.setting.alpha -= 1.0}}
if event.deltaY < 0 { if (DimManager.sharedInstance.setting.alpha < 100) { DimManager.sharedInstance.setting.alpha += 1 }}
}
}
7 changes: 7 additions & 0 deletions Blurred/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
Localizable.strings
Blurred

Created by Peter Luo on 2020/6/16.
Copyright © 2020 Dwarves Foundation. All rights reserved.
*/
Loading

0 comments on commit 4d81e52

Please sign in to comment.