Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Box42/FunctionButton/View/BoxFunctionViewGroup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import SnapKit

class BoxFunctionViewGroup: NSView {
lazy var preferenceButton: PreferenceButtonView = PreferenceButtonView(image: NSImage(imageLiteralResourceName: "plus"), completion: { self.preferenceAction?() })
lazy var pinButton: PinButtonView = PinButtonView(image: NSImage(imageLiteralResourceName: "pin-box"), completion: { self.pinAction?() })
lazy var pinButton: PinButtonView = PinButtonView(title: "Pin Box", image: NSImage(imageLiteralResourceName: "pin-box"), completion: { self.pinAction?() })
lazy var quitButton: QuitButtonView = QuitButtonView(image: NSImage(imageLiteralResourceName: "figure.snowboarding"), completion: { self.quitAction?() })
lazy var boxButton: BoxFunctionButtonView = BoxFunctionButtonView(image: NSImage(imageLiteralResourceName: "shippingbox"), completion: { self.boxAction?() })

Expand Down
4 changes: 2 additions & 2 deletions Box42/FunctionButton/View/PinButtonView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class PinButtonView: NSView {
return button
}()

init(image: NSImage, completion: @escaping () -> Void) {
init(title: String, image: NSImage, completion: @escaping () -> Void) {
super.init(frame: .zero)

pinBoxButton.image = image
Expand All @@ -31,7 +31,7 @@ class PinButtonView: NSView {
pinBoxButton.layer?.backgroundColor = NSColor.clear.cgColor

pinBoxButton.bezelStyle = .inline
let pinBoxTitle = "Pin Box"
let pinBoxTitle = title

let attributes: [NSAttributedString.Key: Any] = [
NSAttributedString.Key.font: NSFont.systemFont(ofSize: 14.0, weight: .semibold), // 원하는 폰트 및 무게로 설정
Expand Down
2 changes: 2 additions & 0 deletions Box42/Scripts/View/Table/ScriptsTableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class ScriptsTableView: NSTableView {
func setup() {
self.delegate = self
self.dataSource = self
self.headerView = nil
self.backgroundColor = .white
let column1 = NSTableColumn(identifier: NSUserInterfaceItemIdentifier("Scripts"))
self.addTableColumn(column1)
}
Expand Down
28 changes: 24 additions & 4 deletions Box42/Toolbar/Controller/ToolbarViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class ToolbarViewController: NSViewController {

toolbarViewGroup = BoxToolbarViewGroup()
toolbarViewGroup?.sidebar = sidebar

}

// func runPrefsHelperApplication() {
Expand All @@ -41,12 +42,22 @@ class ToolbarViewController: NSViewController {
// }
// }


lazy var sidebarLeading: SideBarLeading = SideBarLeading(image: NSImage(imageLiteralResourceName: "toggle-on"), completion: { [weak self] in self?.sidebar() })
lazy var pinButton: PinButtonView = PinButtonView(title: "", image: NSImage(imageLiteralResourceName: "pin-box"), completion: { StateManager.shared.togglePin()

let newImage: NSImage
if StateManager.shared.pin {
newImage = NSImage(imageLiteralResourceName: "pin-box-ver")
} else {
newImage = NSImage(imageLiteralResourceName: "pin-box")
}

self.pinButton.changePinImage(to: newImage)
})

func sidebar() {
// print("sidebar")
// BookmarkViewModel.shared.addBookmark(item: URLItem(name: "chan", url: "https://42box.kr/"))
// print("sidebar")
// BookmarkViewModel.shared.addBookmark(item: URLItem(name: "chan", url: "https://42box.kr/"))
toolbarViewGroup = BoxToolbarViewGroup()
if let baseContainerVC = baseContainerVC {
baseContainerVC.leftView.isHidden.toggle()
Expand All @@ -56,20 +67,29 @@ class ToolbarViewController: NSViewController {
make.top.bottom.trailing.equalToSuperview().inset(12)
make.leading.equalToSuperview().offset(24 + 24)
}

baseContainerVC.view.addSubview(sidebarLeading)
sidebarLeading.snp.makeConstraints { make in
make.top.equalToSuperview().inset(63)
make.leading.equalToSuperview().inset(12)
make.width.equalTo(24)
make.height.equalTo(24)
}

baseContainerVC.view.addSubview(pinButton)
pinButton.snp.makeConstraints { make in
make.leading.equalToSuperview().inset(10)
make.left.bottom.equalTo(baseContainerVC.leftView)
make.width.equalTo(FunctionButtonUI.size.pinWidth)
make.height.equalTo(FunctionButtonUI.size.pinHeight)
}
} else {
baseContainerVC.contentGroup.snp.remakeConstraints { make in
make.top.bottom.trailing.equalToSuperview().inset(12)
make.leading.equalTo(baseContainerVC.leftView.snp.trailing)
}
sidebarLeading.removeFromSuperview()
pinButton.removeFromSuperview()
}

// 제약 조건을 다시 설정
Expand Down
32 changes: 22 additions & 10 deletions Box42/Toolbar/View/SideBarLeading.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,30 @@ class SideBarLeading: NSButton {
}
}

func runPrefsHelperApplication() {
if let appURL = Bundle.main.url(forResource: "prefsHelper", withExtension: "app") {
let workspace = NSWorkspace.shared
do {
try workspace.open([appURL], withAppBundleIdentifier: nil, options: [], additionalEventParamDescriptor: nil, launchIdentifiers: nil)
} catch {
print("Error opening app: \(error)")
func runPrefsHelperApplication() {
if let appURL = Bundle.main.url(forResource: "prefsHelper", withExtension: "app") {
let workspace = NSWorkspace.shared
do {
try workspace.open([appURL], withAppBundleIdentifier: nil, options: [], additionalEventParamDescriptor: nil, launchIdentifiers: nil)
} catch {
print("Error opening app: \(error)")
}
} else {
print("App not found")
}
} else {
print("App not found")
}
}
// func runPrefsHelperApplication() {
// let prefsHelperAppPath = "/Users/solda/Downloads/prefsHelper.app" // prefsHelper.app의 경로
//
// let appURL = URL(fileURLWithPath: prefsHelperAppPath)
//
// let workspace = NSWorkspace.shared
// do {
// try workspace.open([appURL], withAppBundleIdentifier: nil, options: [], additionalEventParamDescriptor: nil, launchIdentifiers: nil)
// } catch {
// print("Error opening app: \(error)")
// }
// }


@objc func sideBarLeading() {
Expand Down