Skip to content

Commit

Permalink
[Feature] Remove unnecessary settings (#71)
Browse files Browse the repository at this point in the history
* [Feature] Remove unnecessary settings

- Remove unnecessary settings: Hide dock icon and keep app last state
- Refactor code
- Remove background color of preferences window
- Update new app pictures
  • Loading branch information
phucledien authored Mar 6, 2020
1 parent 5ddceb0 commit 207a89d
Show file tree
Hide file tree
Showing 17 changed files with 229 additions and 430 deletions.
32 changes: 21 additions & 11 deletions Hidden Bar.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
08A5F85F23AA01EE00981CA5 /* HotKey in Frameworks */ = {isa = PBXBuildFile; productRef = 08A5F85E23AA01EE00981CA5 /* HotKey */; };
08A5F86123AA085B00981CA5 /* Preferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08A5F86023AA085B00981CA5 /* Preferences.swift */; };
08A5F86423AA09F300981CA5 /* UserDefault+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08A5F86323AA09F300981CA5 /* UserDefault+Extension.swift */; };
08B9F32C2411883300AA0551 /* NSWindow+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08B9F32B2411883300AA0551 /* NSWindow+Extension.swift */; };
08C20FDE23AABDD10035D978 /* HyperlinkTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08C20FDD23AABDD10035D978 /* HyperlinkTextField.swift */; };
08C20FE023AB44E60035D978 /* Bundle+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08C20FDF23AB44E60035D978 /* Bundle+Extension.swift */; };
08C20FE223AB452C0035D978 /* AboutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08C20FE123AB452C0035D978 /* AboutViewController.swift */; };
Expand Down Expand Up @@ -55,6 +56,7 @@
08A5F85B23AA013100981CA5 /* SelectedSecond.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectedSecond.swift; sourceTree = "<group>"; };
08A5F86023AA085B00981CA5 /* Preferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Preferences.swift; sourceTree = "<group>"; };
08A5F86323AA09F300981CA5 /* UserDefault+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UserDefault+Extension.swift"; sourceTree = "<group>"; };
08B9F32B2411883300AA0551 /* NSWindow+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSWindow+Extension.swift"; sourceTree = "<group>"; };
08C20FDD23AABDD10035D978 /* HyperlinkTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HyperlinkTextField.swift; sourceTree = "<group>"; };
08C20FDF23AB44E60035D978 /* Bundle+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Bundle+Extension.swift"; sourceTree = "<group>"; };
08C20FE123AB452C0035D978 /* AboutViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -146,6 +148,7 @@
children = (
08A5F86323AA09F300981CA5 /* UserDefault+Extension.swift */,
08C20FDF23AB44E60035D978 /* Bundle+Extension.swift */,
08B9F32B2411883300AA0551 /* NSWindow+Extension.swift */,
);
path = Extensions;
sourceTree = "<group>";
Expand Down Expand Up @@ -284,11 +287,12 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1010;
LastUpgradeCheck = 1010;
LastUpgradeCheck = 1130;
ORGANIZATIONNAME = "Dwarves Foundation";
TargetAttributes = {
929113F021F9D04100173149 = {
CreatedOnToolsVersion = 10.1;
LastSwiftMigration = 1130;
SystemCapabilities = {
com.apple.Sandbox = {
enabled = 1;
Expand All @@ -297,6 +301,7 @@
};
92C5054D21FEC03B0084719A = {
CreatedOnToolsVersion = 10.1;
LastSwiftMigration = 1130;
};
};
};
Expand Down Expand Up @@ -356,6 +361,7 @@
08A5F86123AA085B00981CA5 /* Preferences.swift in Sources */,
92C97B9122018C1F0007559C /* StatusBarController.swift in Sources */,
92D2122221FEE06600C92FF4 /* LauncherApplication.app in Sources */,
08B9F32C2411883300AA0551 /* NSWindow+Extension.swift in Sources */,
929113F521F9D04100173149 /* AppDelegate.swift in Sources */,
08C20FDE23AABDD10035D978 /* HyperlinkTextField.swift in Sources */,
92C97B88220032ED0007559C /* Util.swift in Sources */,
Expand Down Expand Up @@ -529,17 +535,18 @@
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = W777S7V8TN;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = hidden/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 1.3;
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 1.4;
PRODUCT_BUNDLE_IDENTIFIER = com.dwarvesv.minimalbar;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -552,17 +559,18 @@
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = W777S7V8TN;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = hidden/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 1.3;
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 1.4;
PRODUCT_BUNDLE_IDENTIFIER = com.dwarvesv.minimalbar;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -575,17 +583,18 @@
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = W777S7V8TN;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = LauncherApplication/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = 10.12;
PRODUCT_BUNDLE_IDENTIFIER = com.dwarvesv.LauncherApplication;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -598,17 +607,18 @@
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = W777S7V8TN;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = LauncherApplication/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = 10.12;
PRODUCT_BUNDLE_IDENTIFIER = com.dwarvesv.LauncherApplication;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
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 = "1010"
LastUpgradeVersion = "1130"
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 = "1010"
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 = "92C5054D21FEC03B0084719A"
BuildableName = "LauncherApplication.app"
BlueprintName = "LauncherApplication"
ReferencedContainer = "container:Hidden Bar.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -49,17 +58,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "92C5054D21FEC03B0084719A"
BuildableName = "LauncherApplication.app"
BlueprintName = "LauncherApplication"
ReferencedContainer = "container:Hidden Bar.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
Expand All @@ -81,8 +79,6 @@
ReferencedContainer = "container:Hidden Bar.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
32 changes: 23 additions & 9 deletions hidden/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
// Copyright © 2019 Dwarves Foundation. All rights reserved.
//

import Cocoa
import AppKit
import ServiceManagement
import HotKey

@NSApplicationMain
Expand All @@ -28,18 +26,34 @@ class AppDelegate: NSObject, NSApplicationDelegate{
}

func applicationDidFinishLaunching(_ aNotification: Notification) {
Util.setUpAutoStart(isAutoStart: Util.getIsAutoStart())
statusBarController.initView()
setupAutoStartApp()
registerDefaultValues()
setupHotKey()
openPreferencesIfNeeded()
}

func setupHotKey() {
guard let globalKey = Preferences.GlobalKey else {return}
hotKey = HotKey(keyCombo: KeyCombo(carbonKeyCode: globalKey.keyCode, carbonModifiers: globalKey.carbonFlags))
func openPreferencesIfNeeded() {
if Preferences.isShowPreference {
Util.showPrefWindow()
}
}

func setupAutoStartApp() {
Util.setUpAutoStart(isAutoStart: Preferences.isAutoStart)
}

func applicationWillBecomeActive(_ notification: Notification) {
let _ = Util.toggleDockIcon(Util.getIsKeepInDock())
func registerDefaultValues() {
UserDefaults.standard.register(defaults: [
UserDefaults.Key.isAutoStart: true,
UserDefaults.Key.isShowPreference: true,
UserDefaults.Key.isAutoHide: true,
UserDefaults.Key.numberOfSecondForAutoHide: 10.0
])
}

func setupHotKey() {
guard let globalKey = Preferences.globalKey else {return}
hotKey = HotKey(keyCombo: KeyCombo(carbonKeyCode: globalKey.keyCode, carbonModifiers: globalKey.carbonFlags))
}

func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
Expand Down
56 changes: 0 additions & 56 deletions hidden/Assets.xcassets/WindowBgColor.colorset/Contents.json

This file was deleted.

Loading

0 comments on commit 207a89d

Please sign in to comment.