Skip to content

Commit

Permalink
2.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
zm committed Apr 6, 2022
1 parent e97d293 commit 6d4dfd5
Show file tree
Hide file tree
Showing 40 changed files with 170 additions and 184 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
## 2.8.1 - 2022-04-06

### Changed
- Updated App icon
- Updated App Font
- Updated menubar icon
- Show hosts status with icons

---

## 2.8.0 - 2022-01-14

### Changed
- Updated App name from **HostsToolForMac** to **HostsX**
- Updated App icon
- Updadted menu items in the menubar
- Updated menu items in the menubar

### Added
- Added about view
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG_SC.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 2.8.1 - 2022-04-06

### Changed
- 更新应用图标
- 更新应用字体
- 更新菜单栏图标
- 用图标显示 hosts 状态

---

## 2.8.0 - 2022-01-14

### Changed
Expand Down
4 changes: 2 additions & 2 deletions HostsX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 2.8.0;
MARKETING_VERSION = 2.8.1;
PRODUCT_BUNDLE_IDENTIFIER = com.alpha.hostsx;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -497,7 +497,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 2.8.0;
MARKETING_VERSION = 2.8.1;
PRODUCT_BUNDLE_IDENTIFIER = com.alpha.hostsx;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
9 changes: 6 additions & 3 deletions HostsX/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@ import Cocoa
@main
class AppDelegate: NSObject, NSApplicationDelegate {

private let statusItem = NSStatusItem.system
private lazy var statusItem = NSStatusItem.system


@IBOutlet weak var menu: AppMenu!



func applicationDidFinishLaunching(_ aNotification: Notification) {

statusItem.setAttributedTitle(Bundle.main.bundleName)
statusItem.setMenuBarIcon()
statusItem.menu = menu
//RemoteSource.restore()

}


Expand Down
16 changes: 8 additions & 8 deletions HostsX/AppMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ class AppMenu: NSMenu {
private var wc: NSWindowController?

override func awakeFromNib() {
localItem.setAttributedTitle(Localization.Menu.local)
remoteItem.setAttributedTitle(Localization.Menu.remote)
downloadItem.setAttributedTitle(Localization.Menu.remoteDownload)
configItem.setAttributedTitle(Localization.Menu.remoteConfig)
helpItem.setAttributedTitle(Localization.Menu.help)
checkItem.setAttributedTitle(Localization.Menu.helpCheck)
aboutItem.setAttributedTitle(Localization.Menu.helpAbout)
quitItem.setAttributedTitle(Localization.Menu.quit)
localItem.title = Localization.Menu.local
remoteItem.title = Localization.Menu.remote
downloadItem.title = Localization.Menu.remoteDownload
configItem.title = Localization.Menu.remoteConfig
helpItem.title = Localization.Menu.help
checkItem.title = Localization.Menu.helpCheck
aboutItem.title = Localization.Menu.helpAbout
quitItem.title = Localization.Menu.quit
}

@IBAction func onLoacl(_ sender: NSMenuItem) {
Expand Down
9 changes: 0 additions & 9 deletions HostsX/Assets.xcassets/AccentColor.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
{
"colors" : [
{
"color" : {
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0.808",
"green" : "0.635",
"red" : "0.294"
}
},
"idiom" : "mac"
}
],
Expand Down
Binary file modified HostsX/Assets.xcassets/AppIcon.appiconset/icon_128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified HostsX/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified HostsX/Assets.xcassets/AppIcon.appiconset/icon_16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified HostsX/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified HostsX/Assets.xcassets/AppIcon.appiconset/icon_256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified HostsX/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified HostsX/Assets.xcassets/AppIcon.appiconset/icon_32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified HostsX/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified HostsX/Assets.xcassets/AppIcon.appiconset/icon_512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified HostsX/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed HostsX/Assets.xcassets/back.imageset/back.png
Binary file not shown.
2 changes: 1 addition & 1 deletion HostsX/Assets.xcassets/link.imageset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scale" : "1x"
},
{
"filename" : "link.png",
"filename" : "link@2x.png",
"idiom" : "mac",
"scale" : "2x"
}
Expand Down
Binary file removed HostsX/Assets.xcassets/link.imageset/link.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@
"scale" : "1x"
},
{
"filename" : "back.png",
"filename" : "rocket.png",
"idiom" : "mac",
"scale" : "2x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
136 changes: 68 additions & 68 deletions HostsX/Base.lproj/Remote.storyboard

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions HostsX/Component/Dialog/ConfirmDialogController.xib
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.XIB" version="3.0" toolsVersion="19455" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="20037" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="19455"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="20037"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand All @@ -18,14 +18,14 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="Hz6-mo-xeY">
<rect key="frame" x="0.0" y="0.0" width="200" height="83"/>
<rect key="frame" x="0.0" y="0.0" width="200" height="81"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="NCm-8c-cWG">
<rect key="frame" x="8" y="8" width="72" height="32"/>
<rect key="frame" x="8" y="8" width="76" height="32"/>
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" refusesFirstResponder="YES" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="1f7-ha-x3o">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" size="13" name="HannotateSC-W5"/>
<font key="font" metaFont="system"/>
<string key="keyEquivalent" base64-UTF8="YES">
Gw
</string>
Expand All @@ -35,20 +35,20 @@ Gw
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="XOq-K0-t0p">
<rect key="frame" x="129" y="8" width="63" height="32"/>
<rect key="frame" x="126" y="8" width="66" height="32"/>
<buttonCell key="cell" type="push" title="Done" bezelStyle="rounded" alignment="center" refusesFirstResponder="YES" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="We9-rZ-kFW">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" size="13" name="HannotateSC-W5"/>
<font key="font" metaFont="system"/>
</buttonCell>
<color key="bezelColor" name="AccentColor"/>
<connections>
<action selector="onDone:" target="-2" id="nKA-3T-T51"/>
</connections>
</button>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="Qjn-h4-JpK">
<rect key="frame" x="13" y="50" width="174" height="18"/>
<rect key="frame" x="13" y="50" width="174" height="16"/>
<textFieldCell key="cell" selectable="YES" alignment="center" title="Multiline " id="T9s-ou-pGM">
<font key="font" size="13" name="HannotateSC-W5"/>
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
Expand All @@ -69,7 +69,7 @@ Gw
</objects>
<resources>
<namedColor name="AccentColor">
<color red="0.29399999976158142" green="0.63499999046325684" blue="0.80800002813339233" alpha="0.89800000190734863" colorSpace="custom" customColorSpace="displayP3"/>
<color red="0.0" green="0.46000000000000002" blue="0.89000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</document>
16 changes: 8 additions & 8 deletions HostsX/Component/Dialog/InfoDialogController.xib
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.XIB" version="3.0" toolsVersion="19455" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="20037" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="19455"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="20037"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand All @@ -17,24 +17,24 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="Hz6-mo-xeY">
<rect key="frame" x="0.0" y="0.0" width="200" height="83"/>
<rect key="frame" x="0.0" y="0.0" width="200" height="81"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ER8-Pj-g3m">
<rect key="frame" x="69" y="8" width="63" height="32"/>
<rect key="frame" x="67" y="8" width="66" height="32"/>
<buttonCell key="cell" type="push" title="Done" bezelStyle="rounded" alignment="center" refusesFirstResponder="YES" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Ftm-we-EhM">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" size="13" name="HannotateSC-W5"/>
<font key="font" metaFont="system"/>
</buttonCell>
<color key="bezelColor" name="AccentColor"/>
<connections>
<action selector="onDone:" target="-2" id="OXg-wD-WOZ"/>
</connections>
</button>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="QHU-Rr-aqy">
<rect key="frame" x="13" y="50" width="174" height="18"/>
<rect key="frame" x="13" y="50" width="174" height="16"/>
<textFieldCell key="cell" selectable="YES" alignment="center" title="Multiline Label" id="ZEO-Cf-Zuh">
<font key="font" size="13" name="HannotateSC-W5"/>
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
Expand All @@ -53,7 +53,7 @@
</objects>
<resources>
<namedColor name="AccentColor">
<color red="0.29399999976158142" green="0.63499999046325684" blue="0.80800002813339233" alpha="0.89800000190734863" colorSpace="custom" customColorSpace="displayP3"/>
<color red="0.0" green="0.46000000000000002" blue="0.89000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</document>
10 changes: 0 additions & 10 deletions HostsX/Constant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,12 @@ extension NSSize {
}

extension NSImage.Name {
static let backward = "back"
static let star = "star"
static let add = "add"
static let link = "link"
static let trash = "trash"
}

enum Attributes {
static let menu: [NSAttributedString.Key: NSFont] = [.font: .menu]
}

extension NSFont {
static let menu = NSFont(name: "HannotateSC-W5", size: 13)!
}

extension NSStoryboard {
static let remote = NSStoryboard(name: "Remote", bundle: .none)
Expand All @@ -71,6 +63,4 @@ extension NSStoryboard {
extension NSColor {
@available(macOS 10.13, *)
static let backgroud = NSColor(named: "backgroudColor")
static let accent = NSColor(displayP3Red: 0.294, green: 0.635, blue: 0.808, alpha: 1)

}
33 changes: 12 additions & 21 deletions HostsX/Extension/AppKit+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,6 @@ extension NSView {
}
}

extension NSImageView {
func addShadow() {
let shadow = NSShadow()
shadow.shadowOffset = .init(width: 2, height: -2)
shadow.shadowColor = .lightGray
shadow.shadowBlurRadius = 3
self.shadow = shadow
}
}

extension NSViewController {

Expand All @@ -141,26 +132,26 @@ extension NSStoryboard {
}

extension NSMenu {
func addImageItem(_ name: NSImage.Name, action: Selector?) {
func addItemIcon(_ name: String, action: Selector?) {
let item = NSMenuItem(title: "", action: action, keyEquivalent: "")
let image = NSImage(named: name)
image?.isTemplate = true
item.image = image
let icon = NSImage(named: name)
icon?.isTemplate = true
item.image = icon
addItem(item)
}
}

extension NSMenuItem {
func setAttributedTitle(_ title: String) {
attributedTitle = NSAttributedString(string: title, attributes: Attributes.menu)
}
}


extension NSStatusItem {
func setAttributedTitle(_ title: String?) {
guard title != nil else { return }
button?.attributedTitle = NSAttributedString(string: title!, attributes: Attributes.menu)

func setMenuBarIcon() {
guard let icon = NSImage(named: NSImage.Name("menuBarIcon")) else { return }
icon.isTemplate = true
icon.size = CGSize(width: 16, height: 16)
button?.image = icon
}

}

extension Optional where Wrapped == NSWindowController {
Expand Down
Loading

0 comments on commit 6d4dfd5

Please sign in to comment.