From 01db66a53cc77e9d19a10f2404625c709904b224 Mon Sep 17 00:00:00 2001 From: chanhihi Date: Fri, 18 Aug 2023 03:40:07 +0900 Subject: [PATCH 01/19] =?UTF-8?q?feat(window):=20=EC=9C=88=EB=8F=84?= =?UTF-8?q?=EC=9A=B0=EB=A5=BC=20Movable=ED=95=98=EA=B2=8C=20=EB=A7=8C?= =?UTF-8?q?=EB=93=AD=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Box42/UI/BackGroundView.swift | 63 ++++++++++++++++++++++++++ Box42/Window/BoxWindowController.swift | 11 +++-- 2 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 Box42/UI/BackGroundView.swift diff --git a/Box42/UI/BackGroundView.swift b/Box42/UI/BackGroundView.swift new file mode 100644 index 0000000..d2d2a46 --- /dev/null +++ b/Box42/UI/BackGroundView.swift @@ -0,0 +1,63 @@ +// +// GradientView.swift +// Box42 +// +// Created by Chanhee Kim on 8/18/23. +// + +import Cocoa + +// MARK: - BackGround Gradient +//layer caching 기법. +//레이어 캐싱: 복잡한 그래픽 연산이 필요한 뷰의 경우 wantsLayer를 true로 설정하고 shouldRasterize 속성을 true로 설정하여 렌더링 결과를 캐시할 수 있습니다. 하지만 이를 과도하게 사용하면 메모리 사용량이 증가할 수 있으므로 주의가 필요합니다. + +class BackGroundView: NSView { + private var initialLocation: NSPoint? // Mouse Drag Event + + override init(frame frameRect: NSRect) { + super.init(frame: frameRect) + self.setupLayerCaching() + } + + required init?(coder: NSCoder) { + super.init(coder: coder) + self.setupLayerCaching() + } + + private func setupLayerCaching() { + self.wantsLayer = true + self.layer?.shouldRasterize = true + self.layer?.rasterizationScale = self.window?.backingScaleFactor ?? 1.0 + } + + override func draw(_ dirtyRect: NSRect) { + super.draw(dirtyRect) + + let startingColor = NSColor(red: 1.0, green: 0.804, blue: 0.0, alpha: 0.9) + let endingColor = NSColor(red: 1.0, green: 0.447, blue: 0.0, alpha: 0.7) + let gradient = NSGradient(starting: startingColor, ending: endingColor) + gradient?.draw(in: self.bounds, angle: 90) + } +} + +// MARK: - Mouse Drag Event +extension BackGroundView { + override func mouseDown(with event: NSEvent) { + // 창 내에서의 현재 마우스 위치를 저장합니다. +// self.initialLocation = self.window?.convertPoint(fromScreen: event.locationInWindow) + } + + override func mouseDragged(with event: NSEvent) { +// guard let initialLocation = initialLocation, let window = self.window else { +// return +// } +// +// let currentLocation = window.convertPoint(fromScreen: event.locationInWindow) +// let newOrigin = CGPoint(x: window.frame.origin.x + (currentLocation.x - initialLocation.x), +// y: window.frame.origin.y + (currentLocation.y - initialLocation.y)) +// +// // 창의 위치를 업데이트합니다. +// window.setFrameOrigin(newOrigin) + } +} + diff --git a/Box42/Window/BoxWindowController.swift b/Box42/Window/BoxWindowController.swift index 964e402..caa3aca 100644 --- a/Box42/Window/BoxWindowController.swift +++ b/Box42/Window/BoxWindowController.swift @@ -13,15 +13,20 @@ class BoxWindowController: NSWindowController { override init(window: NSWindow?) { let contentRect = BoxSizeManager.shared.boxViewSizeNSRect - let styleMask: NSWindow.StyleMask = [.titled, .closable, .resizable, .miniaturizable] + let styleMask: NSWindow.StyleMask = [.resizable] // [.titled, .closable, .miniaturizable] windowInstance = NSWindow(contentRect: contentRect, styleMask: styleMask, backing: .buffered, defer: false) windowInstance.title = "Box" windowInstance.styleMask.insert(.resizable) windowInstance.isReleasedWhenClosed = false windowInstance.isOpaque = false - + windowInstance.isMovableByWindowBackground = true + super.init(window: windowInstance) - gradientView = GradientView(frame: contentRect) + + windowInstance.isOpaque = false + windowInstance.backgroundColor = .clear + + gradientView = BackGroundView(frame: contentRect) let boxViewController = BoxViewController(nibName: nil, bundle: nil) windowInstance.contentViewController = boxViewController From 0ea8596df8e5e9a9ac5489610689578a029932cc Mon Sep 17 00:00:00 2001 From: chanhihi Date: Fri, 18 Aug 2023 03:41:07 +0900 Subject: [PATCH 02/19] =?UTF-8?q?feat(contentsView):=20=EC=98=A4=ED=86=A0?= =?UTF-8?q?=EB=A0=88=EC=9D=B4=EC=95=84=EC=9B=83=EC=9D=84=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=ED=95=98=EC=97=AC=20=EB=B0=98=EC=9D=91=ED=98=95=20?= =?UTF-8?q?=EB=94=94=EC=8A=A4=ED=94=8C=EB=A0=88=EC=9D=B4=EB=A5=BC=20?= =?UTF-8?q?=EC=A4=80=EB=B9=84=ED=95=A9=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Box42.xcodeproj/project.pbxproj | 9 +++---- .../Box/BoxBaseContainerViewController.swift | 27 +++++++++---------- Box42/Box/BoxContentsViewGroup.swift | 17 +++++++++--- Box42/Menubar/MenubarViewController.swift | 2 +- Box42/Shared/Constants.swift | 4 +++ 5 files changed, 36 insertions(+), 23 deletions(-) diff --git a/Box42.xcodeproj/project.pbxproj b/Box42.xcodeproj/project.pbxproj index 8235f4f..0d91469 100644 --- a/Box42.xcodeproj/project.pbxproj +++ b/Box42.xcodeproj/project.pbxproj @@ -7,7 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - D676A64A2A8C5CEA00B5C319 /* SnapKit in Frameworks */ = {isa = PBXBuildFile; productRef = D676A6492A8C5CEA00B5C319 /* SnapKit */; }; DE018BB32A5099F900FF0AA3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE018BB22A5099F900FF0AA3 /* AppDelegate.swift */; }; DE018BB82A5099F900FF0AA3 /* Box42.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = DE018BB62A5099F900FF0AA3 /* Box42.xcdatamodeld */; }; DE018BDD2A509AEB00FF0AA3 /* EventMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE018BDC2A509AEB00FF0AA3 /* EventMonitor.swift */; }; @@ -24,7 +23,7 @@ DE0A91632A8E6A5400D1D6F1 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A91622A8E6A5400D1D6F1 /* Constants.swift */; }; DE0A91672A8E6CA700D1D6F1 /* WebViewList.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A91662A8E6CA700D1D6F1 /* WebViewList.swift */; }; DE0A916D2A8E7DD700D1D6F1 /* HoverButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A916C2A8E7DD700D1D6F1 /* HoverButton.swift */; }; - DE0A91702A8E8BDE00D1D6F1 /* GradientView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A916F2A8E8BDE00D1D6F1 /* GradientView.swift */; }; + DE0A91702A8E8BDE00D1D6F1 /* BackGroundView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A916F2A8E8BDE00D1D6F1 /* BackGroundView.swift */; }; DE1F1A142A8B506600A88DD8 /* importMacOSInfo.sh in Resources */ = {isa = PBXBuildFile; fileRef = DE1F1A112A8B506600A88DD8 /* importMacOSInfo.sh */; }; DE1F1A152A8B506600A88DD8 /* exportMacOSInfo.sh in Resources */ = {isa = PBXBuildFile; fileRef = DE1F1A122A8B506600A88DD8 /* exportMacOSInfo.sh */; }; DE1F1A162A8B506600A88DD8 /* keyMapping.sh in Resources */ = {isa = PBXBuildFile; fileRef = DE1F1A132A8B506600A88DD8 /* keyMapping.sh */; }; @@ -72,7 +71,7 @@ DE0A91622A8E6A5400D1D6F1 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; DE0A91662A8E6CA700D1D6F1 /* WebViewList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewList.swift; sourceTree = ""; }; DE0A916C2A8E7DD700D1D6F1 /* HoverButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HoverButton.swift; sourceTree = ""; }; - DE0A916F2A8E8BDE00D1D6F1 /* GradientView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GradientView.swift; sourceTree = ""; }; + DE0A916F2A8E8BDE00D1D6F1 /* BackGroundView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackGroundView.swift; sourceTree = ""; }; DE1F1A112A8B506600A88DD8 /* importMacOSInfo.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = importMacOSInfo.sh; sourceTree = ""; }; DE1F1A122A8B506600A88DD8 /* exportMacOSInfo.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = exportMacOSInfo.sh; sourceTree = ""; }; DE1F1A132A8B506600A88DD8 /* keyMapping.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = keyMapping.sh; sourceTree = ""; }; @@ -208,7 +207,7 @@ isa = PBXGroup; children = ( DE0A916C2A8E7DD700D1D6F1 /* HoverButton.swift */, - DE0A916F2A8E8BDE00D1D6F1 /* GradientView.swift */, + DE0A916F2A8E8BDE00D1D6F1 /* BackGroundView.swift */, ); path = UI; sourceTree = ""; @@ -414,7 +413,7 @@ DE2AD3292A824EEB00002D51 /* Accessibility.swift in Sources */, DE874F572A591F2500FC3B77 /* Icon.swift in Sources */, DE1F1A2E2A8BCC9800A88DD8 /* Storage.swift in Sources */, - DE0A91702A8E8BDE00D1D6F1 /* GradientView.swift in Sources */, + DE0A91702A8E8BDE00D1D6F1 /* BackGroundView.swift in Sources */, DE1F1A312A8BD68F00A88DD8 /* Double.swift in Sources */, DE018BEA2A509B2100FF0AA3 /* WebViewModel.swift in Sources */, ); diff --git a/Box42/Box/BoxBaseContainerViewController.swift b/Box42/Box/BoxBaseContainerViewController.swift index dd38da3..b7400b6 100644 --- a/Box42/Box/BoxBaseContainerViewController.swift +++ b/Box42/Box/BoxBaseContainerViewController.swift @@ -6,6 +6,7 @@ // import Cocoa +import SnapKit class BoxBaseContainerViewController: NSViewController { var buttonGroup : BoxButtonViewGroup! @@ -62,22 +63,20 @@ class BoxBaseContainerViewController: NSViewController { view.addSubview(contentGroup) // buttonGroup 오토레이아웃 설정 - buttonGroup.translatesAutoresizingMaskIntoConstraints = false - NSLayoutConstraint.activate([ - buttonGroup.leadingAnchor.constraint(equalTo: self.view.leadingAnchor), - buttonGroup.topAnchor.constraint(equalTo: self.view.topAnchor), - buttonGroup.bottomAnchor.constraint(equalTo: self.view.bottomAnchor), - buttonGroup.widthAnchor.constraint(equalToConstant: BoxSizeManager.shared.buttonGroupSize.width) - ]) + buttonGroup.snp.makeConstraints { make in + make.leading.equalTo(self.view).offset(Constants.UI.GroupAutolayout) + make.top.equalTo(self.view).offset(Constants.UI.GroupAutolayout) + make.bottom.equalTo(self.view).offset(-Constants.UI.GroupAutolayout) + make.width.equalTo(BoxSizeManager.shared.buttonGroupSize.width) + } // contentGroup 오토레이아웃 설정 - contentGroup.translatesAutoresizingMaskIntoConstraints = false - NSLayoutConstraint.activate([ - contentGroup.leadingAnchor.constraint(equalTo: buttonGroup.trailingAnchor), - contentGroup.trailingAnchor.constraint(equalTo: self.view.trailingAnchor), - contentGroup.topAnchor.constraint(equalTo: self.view.topAnchor), - contentGroup.bottomAnchor.constraint(equalTo: self.view.bottomAnchor) - ]) + contentGroup.snp.makeConstraints { make in + make.leading.equalTo(buttonGroup.snp.trailing) + make.trailing.equalTo(self.view).offset(-Constants.UI.GroupAutolayout) + make.top.equalTo(self.view).offset(Constants.UI.GroupAutolayout) + make.bottom.equalTo(self.view).offset(-Constants.UI.GroupAutolayout) + } } func boxViewSizeInit() { diff --git a/Box42/Box/BoxContentsViewGroup.swift b/Box42/Box/BoxContentsViewGroup.swift index 78c9b96..c777a2d 100644 --- a/Box42/Box/BoxContentsViewGroup.swift +++ b/Box42/Box/BoxContentsViewGroup.swift @@ -7,6 +7,7 @@ import Cocoa import WebKit +import SnapKit class BoxContentsViewGroup: NSView { var webVC: WebViewController? @@ -19,9 +20,14 @@ class BoxContentsViewGroup: NSView { super.init(frame: NSRect(x: 0, y: 0, width: BoxSizeManager.shared.size.width - BoxSizeManager.shared.buttonGroupSize.width, height: BoxSizeManager.shared.buttonGroupSize.height)) self.wantsLayer = true - webVC.view.frame = self.bounds self.addSubview(webVC.view) + + webVC.view.translatesAutoresizingMaskIntoConstraints = false + webVC.view.snp.makeConstraints { make in + make.edges.equalTo(self) + } } + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") @@ -48,10 +54,15 @@ class BoxContentsViewGroup: NSView { print("No WebView found for title: \(sender.title)") return } - - currentWebview.frame = self.bounds // WebView의 크기 및 위치 설정 + + currentWebview.translatesAutoresizingMaskIntoConstraints = false + self.addSubview(currentWebview) + currentWebview.snp.makeConstraints { make in + make.edges.equalTo(self) + } + // WebView 설정 currentWebview.configuration.preferences.javaScriptCanOpenWindowsAutomatically = true currentWebview.configuration.preferences.javaScriptEnabled = true diff --git a/Box42/Menubar/MenubarViewController.swift b/Box42/Menubar/MenubarViewController.swift index de28917..a409ed8 100644 --- a/Box42/Menubar/MenubarViewController.swift +++ b/Box42/Menubar/MenubarViewController.swift @@ -116,7 +116,7 @@ extension MenubarViewController: MenubarViewControllerDelegate { let window = boxWindowController?.window { if StateManager.shared.getIsShowFirstWindow() == false { let buttonFrame = button.window?.convertToScreen(button.frame) ?? NSZeroRect - let desiredPosition = NSPoint(x: buttonFrame.origin.x, y: buttonFrame.origin.y - window.frame.height) + let desiredPosition = NSPoint(x: buttonFrame.origin.x - (BoxSizeManager.shared.size.width / 2) - 10, y: buttonFrame.origin.y - window.frame.height) window.setFrameOrigin(desiredPosition) StateManager.shared.setToggleIsShowFirstWindow() diff --git a/Box42/Shared/Constants.swift b/Box42/Shared/Constants.swift index 3e4ff73..7d46cc6 100644 --- a/Box42/Shared/Constants.swift +++ b/Box42/Shared/Constants.swift @@ -10,4 +10,8 @@ struct Constants { static let InitialName = "home" static let InitialPage = "https://42box.github.io/front-end/" } + + struct UI { + static let GroupAutolayout = 10 + } } From 6f615b98074e2cc35820ca8157daf72c3812ed75 Mon Sep 17 00:00:00 2001 From: chanhihi Date: Fri, 18 Aug 2023 14:38:15 +0900 Subject: [PATCH 03/19] =?UTF-8?q?refactor(webview):=20=EC=9B=B9=EB=B7=B0?= =?UTF-8?q?=20=EB=AA=A8=EB=93=88=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Box42/WebView/WebView.swift | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Box42/WebView/WebView.swift diff --git a/Box42/WebView/WebView.swift b/Box42/WebView/WebView.swift new file mode 100644 index 0000000..0e909ad --- /dev/null +++ b/Box42/WebView/WebView.swift @@ -0,0 +1,42 @@ +// +// WebView.swift +// Box42 +// +// Created by Chanhee Kim on 8/18/23. +// + +import WebKit + +class WebView: WKWebView, WKScriptMessageHandler, WKUIDelegate, WKNavigationDelegate { + func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) { + print("userContentController") + } + + + init() { + let preferences = WKPreferences() + preferences.javaScriptEnabled = true + preferences.javaScriptCanOpenWindowsAutomatically = true + + let contentController = WKUserContentController() + let configuration = WKWebViewConfiguration() + configuration.preferences = preferences + configuration.userContentController = contentController + + super.init(frame: .zero, configuration: configuration) + + contentController.add(self, name: "box") // Moved after super.init + + self.configuration.preferences.javaScriptCanOpenWindowsAutomatically = true + self.configuration.preferences.javaScriptEnabled = true + self.configuration.preferences.setValue(true, forKey: "allowFileAccessFromFileURLs") + + self.uiDelegate = self + self.navigationDelegate = self + self.becomeFirstResponder() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} From 0508e030ad08521ac3949e7e1ee640d67f9398f9 Mon Sep 17 00:00:00 2001 From: chanhihi Date: Fri, 18 Aug 2023 14:38:36 +0900 Subject: [PATCH 04/19] =?UTF-8?q?refactor(webview):=20=EC=9B=B9=EB=B7=B0?= =?UTF-8?q?=20=EB=AA=A8=EB=93=88=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Box42/UI/BackGroundView.swift | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/Box42/UI/BackGroundView.swift b/Box42/UI/BackGroundView.swift index d2d2a46..de430ed 100644 --- a/Box42/UI/BackGroundView.swift +++ b/Box42/UI/BackGroundView.swift @@ -12,8 +12,6 @@ import Cocoa //레이어 캐싱: 복잡한 그래픽 연산이 필요한 뷰의 경우 wantsLayer를 true로 설정하고 shouldRasterize 속성을 true로 설정하여 렌더링 결과를 캐시할 수 있습니다. 하지만 이를 과도하게 사용하면 메모리 사용량이 증가할 수 있으므로 주의가 필요합니다. class BackGroundView: NSView { - private var initialLocation: NSPoint? // Mouse Drag Event - override init(frame frameRect: NSRect) { super.init(frame: frameRect) self.setupLayerCaching() @@ -40,24 +38,3 @@ class BackGroundView: NSView { } } -// MARK: - Mouse Drag Event -extension BackGroundView { - override func mouseDown(with event: NSEvent) { - // 창 내에서의 현재 마우스 위치를 저장합니다. -// self.initialLocation = self.window?.convertPoint(fromScreen: event.locationInWindow) - } - - override func mouseDragged(with event: NSEvent) { -// guard let initialLocation = initialLocation, let window = self.window else { -// return -// } -// -// let currentLocation = window.convertPoint(fromScreen: event.locationInWindow) -// let newOrigin = CGPoint(x: window.frame.origin.x + (currentLocation.x - initialLocation.x), -// y: window.frame.origin.y + (currentLocation.y - initialLocation.y)) -// -// // 창의 위치를 업데이트합니다. -// window.setFrameOrigin(newOrigin) - } -} - From 3b44fbdf0af00bf06cfd9f823a29a237ab03c89e Mon Sep 17 00:00:00 2001 From: chanhihi Date: Fri, 18 Aug 2023 14:39:20 +0900 Subject: [PATCH 05/19] =?UTF-8?q?refactor(webview):=20=EC=9B=B9=EB=B7=B0?= =?UTF-8?q?=20=EB=AA=A8=EB=93=88=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Box42/Box/BoxContentsViewGroup.swift | 1 - Box42/WebView/WebViewController.swift | 60 +++++++++------------------ 2 files changed, 20 insertions(+), 41 deletions(-) diff --git a/Box42/Box/BoxContentsViewGroup.swift b/Box42/Box/BoxContentsViewGroup.swift index c777a2d..40320d9 100644 --- a/Box42/Box/BoxContentsViewGroup.swift +++ b/Box42/Box/BoxContentsViewGroup.swift @@ -11,7 +11,6 @@ import SnapKit class BoxContentsViewGroup: NSView { var webVC: WebViewController? - var webView: WKWebView! var preferencesVC = PreferencesViewController() init() { diff --git a/Box42/WebView/WebViewController.swift b/Box42/WebView/WebViewController.swift index 55991ed..ac3eddb 100644 --- a/Box42/WebView/WebViewController.swift +++ b/Box42/WebView/WebViewController.swift @@ -9,7 +9,7 @@ import Cocoa import WebKit import Combine -class WebViewController: NSViewController, WKScriptMessageHandler, WKUIDelegate, WKNavigationDelegate { +class WebViewController: NSViewController { var URLVM = WebViewModel() var webView: WKWebView! @@ -17,24 +17,32 @@ class WebViewController: NSViewController, WKScriptMessageHandler, WKUIDelegate, var cancellables: Set = [] override func loadView() { - self.webView = addWebView() + self.webView = WebView() self.view = webView - loadWebViewInit() webViewInit() + loadWebviewInit() // bindViewModel() } - func loadWebViewInit() { + func loadWebviewInit() { URLVM.setUpURLdict() - for (key, value) in URLVM.URLdict { - let wkWebView = addWebView() - WebViewList.shared.list[key] = wkWebView - DispatchQueue.main.async { - wkWebView.load(self.URLVM.requestURL(value)) - } - } + loadAllWebview() + } + + func loadWebView(_ name: String, _ url: URL) { + let wkWebView = WebView() + WebViewList.shared.list[name] = wkWebView + DispatchQueue.main.async { + wkWebView.load(self.URLVM.requestURL(url)) + } } + func loadAllWebview() { + for (name, URL) in URLVM.URLdict { + loadWebView(name, URL) + } + } + func webViewInit() { DispatchQueue.main.async { self.webView.load(self.URLVM.requestURL(self.URLVM.safeURL())) @@ -42,41 +50,13 @@ class WebViewController: NSViewController, WKScriptMessageHandler, WKUIDelegate, } func bindViewModel() { - // Whenever URLdict changes, it will call loadWebViewInit URLVM.$URLdict .sink { [weak self] _ in - self?.loadWebViewInit() + self?.loadAllWebview() } .store(in: &cancellables) } - func addWebView() -> WKWebView { - let preferences = WKPreferences() - preferences.javaScriptEnabled = true - preferences.javaScriptCanOpenWindowsAutomatically = true - - let contentController = WKUserContentController() - contentController.add(self, name: "box") - - let configuration = WKWebViewConfiguration() - configuration.preferences = preferences - configuration.userContentController = contentController - - let webView = WKWebView(frame: .zero, configuration: configuration) - - webView.configuration.preferences.javaScriptCanOpenWindowsAutomatically = true - webView.configuration.preferences.javaScriptEnabled = true - - webView.configuration.preferences.setValue(true, forKey: "allowFileAccessFromFileURLs") - if #available(macOS 11.0, *) { - webView.configuration.defaultWebpagePreferences.allowsContentJavaScript = true - } - - webView.uiDelegate = self - webView.navigationDelegate = self - return webView - } - override func viewDidLoad() { super.viewDidLoad() } From c1fa4edada74273090dcba7d53652f087d6f6405 Mon Sep 17 00:00:00 2001 From: chanhihi Date: Fri, 18 Aug 2023 14:39:51 +0900 Subject: [PATCH 06/19] =?UTF-8?q?fix(storage):=20auto=20cache=20clean=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EB=B2=84=EA=B7=B8=20=ED=94=BD=EC=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Box42/Scripts/AppleScripts+ShowMessage.swift | 42 ++++++++++++++++++++ Box42/Shared/StateManager.swift | 14 +++++++ Box42/System/Storage.swift | 34 +++++++++++++++- Box42/System/StorageConfig.swift | 2 +- 4 files changed, 89 insertions(+), 3 deletions(-) create mode 100644 Box42/Scripts/AppleScripts+ShowMessage.swift diff --git a/Box42/Scripts/AppleScripts+ShowMessage.swift b/Box42/Scripts/AppleScripts+ShowMessage.swift new file mode 100644 index 0000000..3a7411b --- /dev/null +++ b/Box42/Scripts/AppleScripts+ShowMessage.swift @@ -0,0 +1,42 @@ +// +// AppleScripts+ShowMessage.swift +// Box42 +// +// Created by Chanhee Kim on 8/18/23. +// + +import Foundation +import AppKit + +func showMessageWithAppleScript(_ message: String) { + let appleScript = """ + display dialog "\(message)" buttons {"OK"} default button "OK" + """ + + var error: NSDictionary? + if let scriptObject = NSAppleScript(source: appleScript) { + scriptObject.executeAndReturnError(&error) + if let error = error { + print("AppleScript Error: \(error)") + } + } +} + +func showMessageWithAppleScript(_ message: String, _ button: String, completion: @escaping (String?) -> Void) { + let appleScript = """ + display dialog "\(message)" buttons {"\(button)", "취소"} default button "\(button)" + """ + + var error: NSDictionary? + if let scriptObject = NSAppleScript(source: appleScript) { + let output = scriptObject.executeAndReturnError(&error) + let buttonReturned = output.forKeyword(keyDirectObject) + print("output", output.description) +// completion(output.stringValue) + completion(buttonReturned?.stringValue) + if let error = error { + print("AppleScript Error: \(error)") + completion(nil) + } + } +} diff --git a/Box42/Shared/StateManager.swift b/Box42/Shared/StateManager.swift index 0e8ca1d..e73da57 100644 --- a/Box42/Shared/StateManager.swift +++ b/Box42/Shared/StateManager.swift @@ -12,12 +12,14 @@ class StateManager { private var isShowCPUUsage: Bool! private var isShowWindow: Bool! private var isShowFirstWindow: Bool! + private var isAutoStorage: Bool! private init() { isPin = false isShowCPUUsage = false isShowWindow = false isShowFirstWindow = false + isAutoStorage = true } func getIsPin() -> Bool { @@ -51,4 +53,16 @@ class StateManager { func setToggleIsShowFirstWindow() { isShowFirstWindow.toggle() } + + func getIsAutoStorage() -> Bool { + return isAutoStorage + } + + func setOffIsAutoStorage() { + isAutoStorage = false + } + + func setOnIsAutoStorage() { + isAutoStorage = true + } } diff --git a/Box42/System/Storage.swift b/Box42/System/Storage.swift index 8c55f25..6b06a22 100644 --- a/Box42/System/Storage.swift +++ b/Box42/System/Storage.swift @@ -54,6 +54,11 @@ class Storage { func storageTimerEvent(){ storageTimer?.invalidate() + + if StateManager.shared.getIsAutoStorage() == false { + return + } + storageTimer = Timer.scheduledTimer(withTimeInterval: config.period.rawValue, repeats: true, block: { [weak self] _ in guard let self = self else { return } @@ -63,11 +68,34 @@ class Storage { } if let usedUsage = self.usedUsage, let totalUsage = self.totalUsage, totalUsage != 0 { - let usagePercentage = usedUsage / totalUsage + let usagePercentage = (totalUsage - usedUsage) / totalUsage if usagePercentage < self.config.threshold.rawValue { self.cleanSh() self.count += 1 - print(self.count > 5 ? "캐시 문제가 아닙니다. ncdu ~ 를 확인해주세요." : "\(usedUsage.roundedToTwoDecimalPlaces) GB", "Storage used is less than 30%") + if self.count > 2 { + showMessageWithAppleScript("캐시 문제가 아닙니다. ncdu ~ 를 확인해주세요.", "재시작") { button in + print("timer") + dump(button) + if let button = button { + switch button { + case "재시작": + StateManager.shared.setOnIsAutoStorage() + print("재시작 버튼을 클릭했습니다.") + case "취소": + // 취소 관련 로직 실행 + print("취소 버튼을 클릭했습니다.") + default: + break + } + } + } + + StateManager.shared.setOffIsAutoStorage() + // 여기서도 타이머를 중지시켜야 합니다. + self.storageTimer?.invalidate() + } else { + print("\(usedUsage.roundedToTwoDecimalPlaces) GB", "Storage used is less than 30%") + } } else { self.count = 0 } @@ -75,8 +103,10 @@ class Storage { print("Failed to get storage usage details") } }) + storageTimer?.fire() } + func cleanSh() { if let scriptPath = Bundle.main.path(forResource: "cleanCache", ofType: "sh") { diff --git a/Box42/System/StorageConfig.swift b/Box42/System/StorageConfig.swift index 1eec523..7b9f615 100644 --- a/Box42/System/StorageConfig.swift +++ b/Box42/System/StorageConfig.swift @@ -27,7 +27,7 @@ class StorageConfig: ObservableObject { @Published var threshold: StorageThreshold @Published var period: StoragePeriod - init(_ threshold: StorageThreshold = .percentage05, _ period: StoragePeriod = .period3s) { + init(_ threshold: StorageThreshold = .percentage10, _ period: StoragePeriod = .period3s) { self.threshold = threshold self.period = period } From 4714278032f140d7861f1f31c26b474aa3de7ae6 Mon Sep 17 00:00:00 2001 From: chanhihi Date: Fri, 18 Aug 2023 14:40:14 +0900 Subject: [PATCH 07/19] =?UTF-8?q?chore:=20=EC=93=B8=EB=AA=A8=EC=97=86?= =?UTF-8?q?=EB=8A=94=20=EA=B8=B0=EB=8A=A5=20=EC=9E=A0=EC=8B=9C=20=EC=9E=A0?= =?UTF-8?q?=EA=B8=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Box42.xcodeproj/project.pbxproj | 8 ++++++++ Box42/Box/BoxBaseContainerViewController.swift | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Box42.xcodeproj/project.pbxproj b/Box42.xcodeproj/project.pbxproj index 0d91469..795d9b6 100644 --- a/Box42.xcodeproj/project.pbxproj +++ b/Box42.xcodeproj/project.pbxproj @@ -24,6 +24,8 @@ DE0A91672A8E6CA700D1D6F1 /* WebViewList.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A91662A8E6CA700D1D6F1 /* WebViewList.swift */; }; DE0A916D2A8E7DD700D1D6F1 /* HoverButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A916C2A8E7DD700D1D6F1 /* HoverButton.swift */; }; DE0A91702A8E8BDE00D1D6F1 /* BackGroundView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A916F2A8E8BDE00D1D6F1 /* BackGroundView.swift */; }; + DE0A91782A8F014F00D1D6F1 /* WebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A91772A8F014F00D1D6F1 /* WebView.swift */; }; + DE0A917B2A8F0CA800D1D6F1 /* AppleScripts+ShowMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A917A2A8F0CA800D1D6F1 /* AppleScripts+ShowMessage.swift */; }; DE1F1A142A8B506600A88DD8 /* importMacOSInfo.sh in Resources */ = {isa = PBXBuildFile; fileRef = DE1F1A112A8B506600A88DD8 /* importMacOSInfo.sh */; }; DE1F1A152A8B506600A88DD8 /* exportMacOSInfo.sh in Resources */ = {isa = PBXBuildFile; fileRef = DE1F1A122A8B506600A88DD8 /* exportMacOSInfo.sh */; }; DE1F1A162A8B506600A88DD8 /* keyMapping.sh in Resources */ = {isa = PBXBuildFile; fileRef = DE1F1A132A8B506600A88DD8 /* keyMapping.sh */; }; @@ -72,6 +74,8 @@ DE0A91662A8E6CA700D1D6F1 /* WebViewList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewList.swift; sourceTree = ""; }; DE0A916C2A8E7DD700D1D6F1 /* HoverButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HoverButton.swift; sourceTree = ""; }; DE0A916F2A8E8BDE00D1D6F1 /* BackGroundView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackGroundView.swift; sourceTree = ""; }; + DE0A91772A8F014F00D1D6F1 /* WebView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebView.swift; sourceTree = ""; }; + DE0A917A2A8F0CA800D1D6F1 /* AppleScripts+ShowMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AppleScripts+ShowMessage.swift"; sourceTree = ""; }; DE1F1A112A8B506600A88DD8 /* importMacOSInfo.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = importMacOSInfo.sh; sourceTree = ""; }; DE1F1A122A8B506600A88DD8 /* exportMacOSInfo.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = exportMacOSInfo.sh; sourceTree = ""; }; DE1F1A132A8B506600A88DD8 /* keyMapping.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = keyMapping.sh; sourceTree = ""; }; @@ -167,6 +171,7 @@ DE018BE92A509B2100FF0AA3 /* WebViewModel.swift */, DE018BE62A509B1E00FF0AA3 /* WebViewController.swift */, DE0A91662A8E6CA700D1D6F1 /* WebViewList.swift */, + DE0A91772A8F014F00D1D6F1 /* WebView.swift */, ); path = WebView; sourceTree = ""; @@ -266,6 +271,7 @@ children = ( DEB862DE2A85348600278FCD /* sh */, DEB862DB2A85347400278FCD /* Scripts.swift */, + DE0A917A2A8F0CA800D1D6F1 /* AppleScripts+ShowMessage.swift */, ); path = Scripts; sourceTree = ""; @@ -381,6 +387,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + DE0A917B2A8F0CA800D1D6F1 /* AppleScripts+ShowMessage.swift in Sources */, DE1F1A262A8B50D500A88DD8 /* BoxViewController.swift in Sources */, DE018BB82A5099F900FF0AA3 /* Box42.xcdatamodeld in Sources */, DE874F542A591F1400FC3B77 /* PreferencesView.swift in Sources */, @@ -414,6 +421,7 @@ DE874F572A591F2500FC3B77 /* Icon.swift in Sources */, DE1F1A2E2A8BCC9800A88DD8 /* Storage.swift in Sources */, DE0A91702A8E8BDE00D1D6F1 /* BackGroundView.swift in Sources */, + DE0A91782A8F014F00D1D6F1 /* WebView.swift in Sources */, DE1F1A312A8BD68F00A88DD8 /* Double.swift in Sources */, DE018BEA2A509B2100FF0AA3 /* WebViewModel.swift in Sources */, ); diff --git a/Box42/Box/BoxBaseContainerViewController.swift b/Box42/Box/BoxBaseContainerViewController.swift index b7400b6..82f7ca1 100644 --- a/Box42/Box/BoxBaseContainerViewController.swift +++ b/Box42/Box/BoxBaseContainerViewController.swift @@ -16,7 +16,7 @@ class BoxBaseContainerViewController: NSViewController { self.view = NSView() // 뷰 컨트롤러의 뷰 설정 buttonGroup = BoxButtonViewGroupInit() contentGroup = BoxContentsViewGroup() - panGestureInit() +// panGestureInit() viewInit() } From 5876cb93a712792f629fab3c89035066a94223cc Mon Sep 17 00:00:00 2001 From: chanhihi Date: Sat, 19 Aug 2023 04:18:18 +0900 Subject: [PATCH 08/19] =?UTF-8?q?feat(Button=20UI):=20=EA=B8=B0=EC=A1=B4?= =?UTF-8?q?=20ContainerView=EB=A5=BC=20Split=20View=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Box/BoxBaseContainerViewController.swift | 111 ++++++++---------- Box42/BoxBaseSplitView.swift | 22 ++++ Box42/Shared/Constants.swift | 2 +- Box42/UI/MovableContainerView.swift | 24 ++++ 4 files changed, 97 insertions(+), 62 deletions(-) create mode 100644 Box42/BoxBaseSplitView.swift create mode 100644 Box42/UI/MovableContainerView.swift diff --git a/Box42/Box/BoxBaseContainerViewController.swift b/Box42/Box/BoxBaseContainerViewController.swift index 82f7ca1..6aaa7de 100644 --- a/Box42/Box/BoxBaseContainerViewController.swift +++ b/Box42/Box/BoxBaseContainerViewController.swift @@ -9,25 +9,30 @@ import Cocoa import SnapKit class BoxBaseContainerViewController: NSViewController { - var buttonGroup : BoxButtonViewGroup! - var contentGroup : BoxContentsViewGroup! + var splitView: BoxBaseSplitView! = BoxBaseSplitView() + var contentGroup: BoxContentsViewGroup! = BoxContentsViewGroup() + var toolbarGroup: BoxToolbarViewGroup! = BoxToolbarViewGroup() + var buttonGroup: BoxButtonViewGroup! + var leftContainer: MovableContainerView! override func loadView() { - self.view = NSView() // 뷰 컨트롤러의 뷰 설정 + self.view = NSView() + self.view.addSubview(splitView) + splitView.delegate = self + buttonGroup = BoxButtonViewGroupInit() - contentGroup = BoxContentsViewGroup() -// panGestureInit() + + leftContainerInit() viewInit() } - + func BoxButtonViewGroupInit() -> BoxButtonViewGroup { let buttonGroup = BoxButtonViewGroup { sender in self.clickBtn(sender: sender) } - view.addSubview(buttonGroup) return buttonGroup } - + func clickBtn(sender: NSButton) { guard let clickCount = NSApp.currentEvent?.clickCount else { return } if sender.title == "Preferences" { @@ -39,80 +44,64 @@ class BoxBaseContainerViewController: NSViewController { WebViewList.shared.list[sender.title]!.reload() print("Dobule Click") } else if clickCount > 2 { -// let rqURL = URLRequest(url: boxVM.URLdict[sender.title]!) -// WebViewList.shared.list[sender.title]!.load(rqURL) + // let rqURL = URLRequest(url: boxVM.URLdict[sender.title]!) + // WebViewList.shared.list[sender.title]!.load(rqURL) print("Triple Click") } else if clickCount < 2 { contentGroup.removeAllSubviews() contentGroup.showWebviews(sender) } } - - private func panGestureInit() { - let panRecognizer = NSPanGestureRecognizer(target: self, action: #selector(handlePanGesture(_:))) - self.view.addGestureRecognizer(panRecognizer) // 뷰 컨트롤러의 뷰에 제스처 추가 + + private func leftContainerInit() { + leftContainer = MovableContainerView() + leftContainer.addSubview(buttonGroup) + leftContainer.addSubview(toolbarGroup) } func viewInit() { self.boxViewSizeInit() - self.buttonBoxGroupInit() - self.contentsGroupInit() - // buttonGroup과 contentGroup을 self에 추가합니다. - view.addSubview(buttonGroup) - view.addSubview(contentGroup) - - // buttonGroup 오토레이아웃 설정 - buttonGroup.snp.makeConstraints { make in - make.leading.equalTo(self.view).offset(Constants.UI.GroupAutolayout) + splitView.addArrangedSubview(leftContainer) + splitView.addArrangedSubview(contentGroup) + self.view.addSubview(splitView) + + splitView.snp.makeConstraints { make in make.top.equalTo(self.view).offset(Constants.UI.GroupAutolayout) make.bottom.equalTo(self.view).offset(-Constants.UI.GroupAutolayout) - make.width.equalTo(BoxSizeManager.shared.buttonGroupSize.width) + make.left.equalTo(self.view).offset(Constants.UI.GroupAutolayout) + make.right.equalTo(self.view).offset(-Constants.UI.GroupAutolayout) } - - // contentGroup 오토레이아웃 설정 - contentGroup.snp.makeConstraints { make in - make.leading.equalTo(buttonGroup.snp.trailing) - make.trailing.equalTo(self.view).offset(-Constants.UI.GroupAutolayout) - make.top.equalTo(self.view).offset(Constants.UI.GroupAutolayout) - make.bottom.equalTo(self.view).offset(-Constants.UI.GroupAutolayout) + + toolbarGroup.snp.makeConstraints { make in + make.top.equalTo(leftContainer).offset(Constants.UI.GroupAutolayout) + make.left.right.equalTo(leftContainer) + } + + buttonGroup.snp.makeConstraints { make in + make.top.equalTo(toolbarGroup.snp.bottom).offset(Constants.UI.GroupAutolayout) + make.left.right.bottom.equalTo(leftContainer) } } - + func boxViewSizeInit() { self.view.frame.size.width = BoxSizeManager.shared.size.width self.view.frame.size.height = BoxSizeManager.shared.size.height } - - func contentsGroupInit() { - self.contentGroup.frame.size.width = BoxSizeManager.shared.size.width - BoxSizeManager.shared.buttonGroupSize.width - self.contentGroup.frame.size.height = BoxSizeManager.shared.size.height - } - - func buttonBoxGroupInit() { - self.buttonGroup.frame.size.width = BoxSizeManager.shared.buttonGroupSize.width - self.buttonGroup.frame.size.height = BoxSizeManager.shared.buttonGroupSize.height - } } -extension BoxBaseContainerViewController { - // 추후 논의. 내부 panGesture로 View크기 증감 - @objc private func handlePanGesture(_ recognizer: NSPanGestureRecognizer) { - guard let view = recognizer.view else { return } - - // 사용자가 드래그한 변화량을 가져옵니다. - let translation = recognizer.translation(in: view) - - // 드래그로 인한 크기 변화를 계산합니다. - let newWidth = view.frame.width + translation.x - let newHeight = view.frame.height + translation.y - - // 크기를 적용합니다. - view.setFrameSize(NSSize(width: newWidth, height: newHeight)) - - // 변화량을 리셋합니다. - recognizer.setTranslation(.zero, in: view) - - print(newWidth, newHeight) +extension BoxBaseContainerViewController: NSSplitViewDelegate { + func splitView(_ splitView: NSSplitView, constrainMinCoordinate proposedMinimumPosition: CGFloat, ofSubviewAt dividerIndex: Int) -> CGFloat { + if dividerIndex == 0 { + return 132 + } + return proposedMinimumPosition + } + + func splitView(_ splitView: NSSplitView, constrainMaxCoordinate proposedMaximumPosition: CGFloat, ofSubviewAt dividerIndex: Int) -> CGFloat { + if dividerIndex == 0 { + return 200 + } + return proposedMaximumPosition } } diff --git a/Box42/BoxBaseSplitView.swift b/Box42/BoxBaseSplitView.swift new file mode 100644 index 0000000..d432a99 --- /dev/null +++ b/Box42/BoxBaseSplitView.swift @@ -0,0 +1,22 @@ +// +// BoxBaseSplitView.swift +// Box42 +// +// Created by Chanhee Kim on 8/19/23. +// + +import AppKit + +class BoxBaseSplitView: NSSplitView { + init() { + super.init(frame: .zero) + + self.isVertical = true + self.dividerStyle = .thin + + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} diff --git a/Box42/Shared/Constants.swift b/Box42/Shared/Constants.swift index 7d46cc6..322faa9 100644 --- a/Box42/Shared/Constants.swift +++ b/Box42/Shared/Constants.swift @@ -12,6 +12,6 @@ struct Constants { } struct UI { - static let GroupAutolayout = 10 + static let GroupAutolayout = 12 } } diff --git a/Box42/UI/MovableContainerView.swift b/Box42/UI/MovableContainerView.swift new file mode 100644 index 0000000..69c4042 --- /dev/null +++ b/Box42/UI/MovableContainerView.swift @@ -0,0 +1,24 @@ +// +// MovableContainerView.swift +// Box42 +// +// Created by Chanhee Kim on 8/19/23. +// + +import AppKit + +class MovableContainerView: NSView { + init() { + super.init(frame: NSRect(x: 0, y: 0, width: 300, height: BoxSizeManager.shared.size.height)) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func mouseDown(with event: NSEvent) { + if let window = self.window { + window.performDrag(with: event) + } + } +} From 211a2a8a55649e0ac54afe875bb31eb0a5d8d3a9 Mon Sep 17 00:00:00 2001 From: chanhihi Date: Sat, 19 Aug 2023 04:19:19 +0900 Subject: [PATCH 09/19] =?UTF-8?q?feat(BoxUI):=20toolbar=EB=A5=BC=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=ED=95=A9=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Box42.xcodeproj/project.pbxproj | 72 ++++++++-- Box42/Box/BoxContentsViewGroup.swift | 24 ++-- Box42/Box/BoxToolbarViewGroup.swift | 31 +++++ Box42/Extensions/NSImage.swift | 30 +++++ Box42/Main/BoxButtonHandler.swift | 34 ----- Box42/Main/BoxViewController.swift | 27 +++- .../Assets.xcassets/Icons/Contents.json | 6 + .../arrow.clockwise.imageset/Contents.json | 21 +++ .../arrow.clockwise@2x.png | Bin 0 -> 1114 bytes .../Icons/arrow.left.imageset/Contents.json | 21 +++ .../arrow.left.imageset/arrow.left@2x.png | Bin 0 -> 677 bytes .../Icons/arrow.right.imageset/Contents.json | 21 +++ .../arrow.right.imageset/arrow.right@2x.png | Bin 0 -> 633 bytes .../Icons/doc.on.doc.imageset/Contents.json | 21 +++ .../doc.on.doc.imageset/doc.on.doc@2x.png | Bin 0 -> 1301 bytes .../Icons/ellipsis.imageset/Contents.json | 21 +++ .../Icons/ellipsis.imageset/ellipsis@2x.png | Bin 0 -> 459 bytes .../figure.skating.imageset/Contents.json | 21 +++ .../figure.skating@2x.png | Bin 0 -> 1333 bytes .../Contents.json | 21 +++ .../figure.snowboarding@2x.png | Bin 0 -> 1277 bytes .../figure.surfing.imageset/Contents.json | 21 +++ .../figure.surfing@2x.png | Bin 0 -> 1570 bytes .../Icons/minus.imageset/Contents.json | 21 +++ .../Icons/minus.imageset/minus@2x.png | Bin 0 -> 212 bytes .../Icons/pin.fill.imageset/Contents.json | 21 +++ .../Icons/pin.fill.imageset/pin.fill@2x.png | Bin 0 -> 890 bytes .../Icons/pin.imageset/Contents.json | 21 +++ .../Icons/pin.imageset/pin@2x.png | Bin 0 -> 986 bytes .../Icons/plus.imageset/Contents.json | 21 +++ .../Icons/plus.imageset/plus@2x.png | Bin 0 -> 354 bytes .../Icons/shippingbox.imageset/Contents.json | 21 +++ .../shippingbox.imageset/shippingbox@2x.png | Bin 0 -> 1530 bytes .../sidebar.leading.imageset/Contents.json | 21 +++ .../sidebar.leading@2x.png | Bin 0 -> 681 bytes Box42/Shared/BoxSizeManager.swift | 2 + Box42/Toolbar/ToolbarViewController.swift | 57 ++++++++ Box42/Toolbar/View/DisplayURLInToolbar.swift | 33 +++++ Box42/Toolbar/View/GoBackInToolbar.swift | 31 +++++ Box42/Toolbar/View/GoForwardInToolbar.swift | 31 +++++ .../Toolbar/View/GoHomePageViaToolbar().swift | 31 +++++ .../Toolbar/View/RefreshPageViaToolbar.swift | 31 +++++ Box42/Toolbar/View/SideBarLeading.swift | 31 +++++ Box42/UI/BackGroundView.swift | 40 ------ Box42/Window/BoxWindowController.swift | 125 ++++++++++++++---- 45 files changed, 804 insertions(+), 126 deletions(-) create mode 100644 Box42/Box/BoxToolbarViewGroup.swift create mode 100644 Box42/Extensions/NSImage.swift delete mode 100644 Box42/Main/BoxButtonHandler.swift create mode 100644 Box42/Resources/Assets.xcassets/Icons/Contents.json create mode 100644 Box42/Resources/Assets.xcassets/Icons/arrow.clockwise.imageset/Contents.json create mode 100644 Box42/Resources/Assets.xcassets/Icons/arrow.clockwise.imageset/arrow.clockwise@2x.png create mode 100644 Box42/Resources/Assets.xcassets/Icons/arrow.left.imageset/Contents.json create mode 100644 Box42/Resources/Assets.xcassets/Icons/arrow.left.imageset/arrow.left@2x.png create mode 100644 Box42/Resources/Assets.xcassets/Icons/arrow.right.imageset/Contents.json create mode 100644 Box42/Resources/Assets.xcassets/Icons/arrow.right.imageset/arrow.right@2x.png create mode 100644 Box42/Resources/Assets.xcassets/Icons/doc.on.doc.imageset/Contents.json create mode 100644 Box42/Resources/Assets.xcassets/Icons/doc.on.doc.imageset/doc.on.doc@2x.png create mode 100644 Box42/Resources/Assets.xcassets/Icons/ellipsis.imageset/Contents.json create mode 100644 Box42/Resources/Assets.xcassets/Icons/ellipsis.imageset/ellipsis@2x.png create mode 100644 Box42/Resources/Assets.xcassets/Icons/figure.skating.imageset/Contents.json create mode 100644 Box42/Resources/Assets.xcassets/Icons/figure.skating.imageset/figure.skating@2x.png create mode 100644 Box42/Resources/Assets.xcassets/Icons/figure.snowboarding.imageset/Contents.json create mode 100644 Box42/Resources/Assets.xcassets/Icons/figure.snowboarding.imageset/figure.snowboarding@2x.png create mode 100644 Box42/Resources/Assets.xcassets/Icons/figure.surfing.imageset/Contents.json create mode 100644 Box42/Resources/Assets.xcassets/Icons/figure.surfing.imageset/figure.surfing@2x.png create mode 100644 Box42/Resources/Assets.xcassets/Icons/minus.imageset/Contents.json create mode 100644 Box42/Resources/Assets.xcassets/Icons/minus.imageset/minus@2x.png create mode 100644 Box42/Resources/Assets.xcassets/Icons/pin.fill.imageset/Contents.json create mode 100644 Box42/Resources/Assets.xcassets/Icons/pin.fill.imageset/pin.fill@2x.png create mode 100644 Box42/Resources/Assets.xcassets/Icons/pin.imageset/Contents.json create mode 100644 Box42/Resources/Assets.xcassets/Icons/pin.imageset/pin@2x.png create mode 100644 Box42/Resources/Assets.xcassets/Icons/plus.imageset/Contents.json create mode 100644 Box42/Resources/Assets.xcassets/Icons/plus.imageset/plus@2x.png create mode 100644 Box42/Resources/Assets.xcassets/Icons/shippingbox.imageset/Contents.json create mode 100644 Box42/Resources/Assets.xcassets/Icons/shippingbox.imageset/shippingbox@2x.png create mode 100644 Box42/Resources/Assets.xcassets/Icons/sidebar.leading.imageset/Contents.json create mode 100644 Box42/Resources/Assets.xcassets/Icons/sidebar.leading.imageset/sidebar.leading@2x.png create mode 100644 Box42/Toolbar/ToolbarViewController.swift create mode 100644 Box42/Toolbar/View/DisplayURLInToolbar.swift create mode 100644 Box42/Toolbar/View/GoBackInToolbar.swift create mode 100644 Box42/Toolbar/View/GoForwardInToolbar.swift create mode 100644 Box42/Toolbar/View/GoHomePageViaToolbar().swift create mode 100644 Box42/Toolbar/View/RefreshPageViaToolbar.swift create mode 100644 Box42/Toolbar/View/SideBarLeading.swift delete mode 100644 Box42/UI/BackGroundView.swift diff --git a/Box42.xcodeproj/project.pbxproj b/Box42.xcodeproj/project.pbxproj index 795d9b6..89f0ba3 100644 --- a/Box42.xcodeproj/project.pbxproj +++ b/Box42.xcodeproj/project.pbxproj @@ -23,22 +23,32 @@ DE0A91632A8E6A5400D1D6F1 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A91622A8E6A5400D1D6F1 /* Constants.swift */; }; DE0A91672A8E6CA700D1D6F1 /* WebViewList.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A91662A8E6CA700D1D6F1 /* WebViewList.swift */; }; DE0A916D2A8E7DD700D1D6F1 /* HoverButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A916C2A8E7DD700D1D6F1 /* HoverButton.swift */; }; - DE0A91702A8E8BDE00D1D6F1 /* BackGroundView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A916F2A8E8BDE00D1D6F1 /* BackGroundView.swift */; }; DE0A91782A8F014F00D1D6F1 /* WebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A91772A8F014F00D1D6F1 /* WebView.swift */; }; DE0A917B2A8F0CA800D1D6F1 /* AppleScripts+ShowMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A917A2A8F0CA800D1D6F1 /* AppleScripts+ShowMessage.swift */; }; + DE0A917F2A8F865400D1D6F1 /* BoxToolbarViewGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A917E2A8F865400D1D6F1 /* BoxToolbarViewGroup.swift */; }; + DE0A91832A8F889000D1D6F1 /* GoHomePageViaToolbar().swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A91822A8F889000D1D6F1 /* GoHomePageViaToolbar().swift */; }; + DE0A91862A8F889F00D1D6F1 /* RefreshPageViaToolbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A91852A8F889F00D1D6F1 /* RefreshPageViaToolbar.swift */; }; + DE0A918A2A8F88A900D1D6F1 /* GoForwardInToolbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A91892A8F88A900D1D6F1 /* GoForwardInToolbar.swift */; }; + DE0A918D2A8F88BC00D1D6F1 /* GoBackInToolbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A918C2A8F88BC00D1D6F1 /* GoBackInToolbar.swift */; }; + DE0A91902A8F88CA00D1D6F1 /* DisplayURLInToolbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A918F2A8F88CA00D1D6F1 /* DisplayURLInToolbar.swift */; }; + DE0A91982A8F977F00D1D6F1 /* ToolbarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A91972A8F977F00D1D6F1 /* ToolbarViewController.swift */; }; + DE0A91A22A8FAC3F00D1D6F1 /* WebView+CustomScroller.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A91A12A8FAC3E00D1D6F1 /* WebView+CustomScroller.swift */; }; + DE0A91A72A8FC66600D1D6F1 /* SideBarLeading.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A91A62A8FC66600D1D6F1 /* SideBarLeading.swift */; }; DE1F1A142A8B506600A88DD8 /* importMacOSInfo.sh in Resources */ = {isa = PBXBuildFile; fileRef = DE1F1A112A8B506600A88DD8 /* importMacOSInfo.sh */; }; DE1F1A152A8B506600A88DD8 /* exportMacOSInfo.sh in Resources */ = {isa = PBXBuildFile; fileRef = DE1F1A122A8B506600A88DD8 /* exportMacOSInfo.sh */; }; DE1F1A162A8B506600A88DD8 /* keyMapping.sh in Resources */ = {isa = PBXBuildFile; fileRef = DE1F1A132A8B506600A88DD8 /* keyMapping.sh */; }; DE1F1A1C2A8B50C500A88DD8 /* BoxBaseContainerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1F1A192A8B50C500A88DD8 /* BoxBaseContainerViewController.swift */; }; DE1F1A1D2A8B50C500A88DD8 /* BoxContentsViewGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1F1A1A2A8B50C500A88DD8 /* BoxContentsViewGroup.swift */; }; DE1F1A1E2A8B50C500A88DD8 /* BoxButtonViewGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1F1A1B2A8B50C500A88DD8 /* BoxButtonViewGroup.swift */; }; - DE1F1A242A8B50D500A88DD8 /* BoxButtonHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1F1A212A8B50D500A88DD8 /* BoxButtonHandler.swift */; }; DE1F1A252A8B50D500A88DD8 /* BoxViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1F1A222A8B50D500A88DD8 /* BoxViewModel.swift */; }; DE1F1A262A8B50D500A88DD8 /* BoxViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1F1A232A8B50D500A88DD8 /* BoxViewController.swift */; }; DE1F1A292A8B50E200A88DD8 /* BoxSizeManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1F1A282A8B50E200A88DD8 /* BoxSizeManager.swift */; }; DE1F1A2E2A8BCC9800A88DD8 /* Storage.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1F1A2D2A8BCC9800A88DD8 /* Storage.swift */; }; DE1F1A312A8BD68F00A88DD8 /* Double.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1F1A302A8BD68F00A88DD8 /* Double.swift */; }; DE1F1A362A8BDDDF00A88DD8 /* StorageConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1F1A352A8BDDDF00A88DD8 /* StorageConfig.swift */; }; + DE24E6352A8FE02A00E29F5D /* MovableContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE24E6342A8FE02A00E29F5D /* MovableContainerView.swift */; }; + DE24E6382A8FE10400E29F5D /* BoxBaseSplitView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE24E6372A8FE10300E29F5D /* BoxBaseSplitView.swift */; }; + DE24E63B2A8FE93900E29F5D /* NSImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE24E63A2A8FE93900E29F5D /* NSImage.swift */; }; DE2AD3292A824EEB00002D51 /* Accessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE2AD3282A824EEB00002D51 /* Accessibility.swift */; }; DE77BA512A82580400713683 /* MenubarViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE77BA502A82580400713683 /* MenubarViewModel.swift */; }; DE77BA562A82637900713683 /* StateManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE77BA552A82637900713683 /* StateManager.swift */; }; @@ -73,22 +83,32 @@ DE0A91622A8E6A5400D1D6F1 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; DE0A91662A8E6CA700D1D6F1 /* WebViewList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewList.swift; sourceTree = ""; }; DE0A916C2A8E7DD700D1D6F1 /* HoverButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HoverButton.swift; sourceTree = ""; }; - DE0A916F2A8E8BDE00D1D6F1 /* BackGroundView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackGroundView.swift; sourceTree = ""; }; DE0A91772A8F014F00D1D6F1 /* WebView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebView.swift; sourceTree = ""; }; DE0A917A2A8F0CA800D1D6F1 /* AppleScripts+ShowMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AppleScripts+ShowMessage.swift"; sourceTree = ""; }; + DE0A917E2A8F865400D1D6F1 /* BoxToolbarViewGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = BoxToolbarViewGroup.swift; path = Box/BoxToolbarViewGroup.swift; sourceTree = ""; }; + DE0A91822A8F889000D1D6F1 /* GoHomePageViaToolbar().swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GoHomePageViaToolbar().swift"; sourceTree = ""; }; + DE0A91852A8F889F00D1D6F1 /* RefreshPageViaToolbar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RefreshPageViaToolbar.swift; sourceTree = ""; }; + DE0A91892A8F88A900D1D6F1 /* GoForwardInToolbar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoForwardInToolbar.swift; sourceTree = ""; }; + DE0A918C2A8F88BC00D1D6F1 /* GoBackInToolbar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoBackInToolbar.swift; sourceTree = ""; }; + DE0A918F2A8F88CA00D1D6F1 /* DisplayURLInToolbar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayURLInToolbar.swift; sourceTree = ""; }; + DE0A91972A8F977F00D1D6F1 /* ToolbarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToolbarViewController.swift; sourceTree = ""; }; + DE0A91A12A8FAC3E00D1D6F1 /* WebView+CustomScroller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WebView+CustomScroller.swift"; sourceTree = ""; }; + DE0A91A62A8FC66600D1D6F1 /* SideBarLeading.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SideBarLeading.swift; sourceTree = ""; }; DE1F1A112A8B506600A88DD8 /* importMacOSInfo.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = importMacOSInfo.sh; sourceTree = ""; }; DE1F1A122A8B506600A88DD8 /* exportMacOSInfo.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = exportMacOSInfo.sh; sourceTree = ""; }; DE1F1A132A8B506600A88DD8 /* keyMapping.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = keyMapping.sh; sourceTree = ""; }; DE1F1A192A8B50C500A88DD8 /* BoxBaseContainerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = BoxBaseContainerViewController.swift; path = Box/BoxBaseContainerViewController.swift; sourceTree = ""; }; DE1F1A1A2A8B50C500A88DD8 /* BoxContentsViewGroup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = BoxContentsViewGroup.swift; path = Box/BoxContentsViewGroup.swift; sourceTree = ""; }; DE1F1A1B2A8B50C500A88DD8 /* BoxButtonViewGroup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = BoxButtonViewGroup.swift; path = Box/BoxButtonViewGroup.swift; sourceTree = ""; }; - DE1F1A212A8B50D500A88DD8 /* BoxButtonHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = BoxButtonHandler.swift; path = Main/BoxButtonHandler.swift; sourceTree = ""; }; DE1F1A222A8B50D500A88DD8 /* BoxViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = BoxViewModel.swift; path = Main/BoxViewModel.swift; sourceTree = ""; }; DE1F1A232A8B50D500A88DD8 /* BoxViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = BoxViewController.swift; path = Main/BoxViewController.swift; sourceTree = ""; }; DE1F1A282A8B50E200A88DD8 /* BoxSizeManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoxSizeManager.swift; sourceTree = ""; }; DE1F1A2D2A8BCC9800A88DD8 /* Storage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Storage.swift; sourceTree = ""; }; DE1F1A302A8BD68F00A88DD8 /* Double.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Double.swift; sourceTree = ""; }; DE1F1A352A8BDDDF00A88DD8 /* StorageConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StorageConfig.swift; sourceTree = ""; }; + DE24E6342A8FE02A00E29F5D /* MovableContainerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MovableContainerView.swift; sourceTree = ""; }; + DE24E6372A8FE10300E29F5D /* BoxBaseSplitView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoxBaseSplitView.swift; sourceTree = ""; }; + DE24E63A2A8FE93900E29F5D /* NSImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSImage.swift; sourceTree = ""; }; DE2AD3282A824EEB00002D51 /* Accessibility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Accessibility.swift; sourceTree = ""; }; DE77BA502A82580400713683 /* MenubarViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenubarViewModel.swift; sourceTree = ""; }; DE77BA552A82637900713683 /* StateManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StateManager.swift; sourceTree = ""; }; @@ -147,6 +167,7 @@ DE018C0C2A509BDF00FF0AA3 /* Resources */, DE018C062A509B9000FF0AA3 /* System */, DE018C082A509BB500FF0AA3 /* WebView */, + DE0A917D2A8F864300D1D6F1 /* Toolbar */, DE1F1A182A8B50BB00A88DD8 /* Box */, DE018C0E2A509C0C00FF0AA3 /* Menubar */, ); @@ -212,11 +233,34 @@ isa = PBXGroup; children = ( DE0A916C2A8E7DD700D1D6F1 /* HoverButton.swift */, - DE0A916F2A8E8BDE00D1D6F1 /* BackGroundView.swift */, + DE0A91A12A8FAC3E00D1D6F1 /* WebView+CustomScroller.swift */, + DE24E6342A8FE02A00E29F5D /* MovableContainerView.swift */, ); path = UI; sourceTree = ""; }; + DE0A917D2A8F864300D1D6F1 /* Toolbar */ = { + isa = PBXGroup; + children = ( + DE0A919E2A8FA15300D1D6F1 /* View */, + DE0A91972A8F977F00D1D6F1 /* ToolbarViewController.swift */, + ); + path = Toolbar; + sourceTree = ""; + }; + DE0A919E2A8FA15300D1D6F1 /* View */ = { + isa = PBXGroup; + children = ( + DE0A91A62A8FC66600D1D6F1 /* SideBarLeading.swift */, + DE0A91822A8F889000D1D6F1 /* GoHomePageViaToolbar().swift */, + DE0A918F2A8F88CA00D1D6F1 /* DisplayURLInToolbar.swift */, + DE0A918C2A8F88BC00D1D6F1 /* GoBackInToolbar.swift */, + DE0A91892A8F88A900D1D6F1 /* GoForwardInToolbar.swift */, + DE0A91852A8F889F00D1D6F1 /* RefreshPageViaToolbar.swift */, + ); + path = View; + sourceTree = ""; + }; DE17AF722A834A1600325BF4 /* Frameworks */ = { isa = PBXGroup; children = ( @@ -227,9 +271,11 @@ DE1F1A182A8B50BB00A88DD8 /* Box */ = { isa = PBXGroup; children = ( + DE0A917E2A8F865400D1D6F1 /* BoxToolbarViewGroup.swift */, DE1F1A192A8B50C500A88DD8 /* BoxBaseContainerViewController.swift */, DE1F1A1B2A8B50C500A88DD8 /* BoxButtonViewGroup.swift */, DE1F1A1A2A8B50C500A88DD8 /* BoxContentsViewGroup.swift */, + DE24E6372A8FE10300E29F5D /* BoxBaseSplitView.swift */, ); name = Box; sourceTree = ""; @@ -237,7 +283,6 @@ DE1F1A202A8B50CA00A88DD8 /* Main */ = { isa = PBXGroup; children = ( - DE1F1A212A8B50D500A88DD8 /* BoxButtonHandler.swift */, DE1F1A232A8B50D500A88DD8 /* BoxViewController.swift */, DE1F1A222A8B50D500A88DD8 /* BoxViewModel.swift */, ); @@ -303,6 +348,7 @@ DE874F5E2A5935CC00FC3B77 /* String.swift */, DEF749312A85657600D987C8 /* NSScreen.swift */, DE1F1A302A8BD68F00A88DD8 /* Double.swift */, + DE24E63A2A8FE93900E29F5D /* NSImage.swift */, ); path = Extensions; sourceTree = ""; @@ -387,10 +433,12 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + DE0A91A72A8FC66600D1D6F1 /* SideBarLeading.swift in Sources */, DE0A917B2A8F0CA800D1D6F1 /* AppleScripts+ShowMessage.swift in Sources */, DE1F1A262A8B50D500A88DD8 /* BoxViewController.swift in Sources */, DE018BB82A5099F900FF0AA3 /* Box42.xcdatamodeld in Sources */, DE874F542A591F1400FC3B77 /* PreferencesView.swift in Sources */, + DE0A91982A8F977F00D1D6F1 /* ToolbarViewController.swift in Sources */, DE77BA562A82637900713683 /* StateManager.swift in Sources */, DE1F1A1C2A8B50C500A88DD8 /* BoxBaseContainerViewController.swift in Sources */, DE018BF62A509B3600FF0AA3 /* MenubarView.swift in Sources */, @@ -400,29 +448,37 @@ DE77BA512A82580400713683 /* MenubarViewModel.swift in Sources */, DE018BE42A509B1700FF0AA3 /* CPU.swift in Sources */, DE874F5F2A5935CC00FC3B77 /* String.swift in Sources */, + DE0A91862A8F889F00D1D6F1 /* RefreshPageViaToolbar.swift in Sources */, DE874F4E2A591DEA00FC3B77 /* Hotkey.swift in Sources */, + DE0A91832A8F889000D1D6F1 /* GoHomePageViaToolbar().swift in Sources */, DE1F1A252A8B50D500A88DD8 /* BoxViewModel.swift in Sources */, DE018BB32A5099F900FF0AA3 /* AppDelegate.swift in Sources */, DE0A91632A8E6A5400D1D6F1 /* Constants.swift in Sources */, + DE0A91902A8F88CA00D1D6F1 /* DisplayURLInToolbar.swift in Sources */, DE018BF32A509B3300FF0AA3 /* MenubarModel.swift in Sources */, DE7A257A2A6D8CA20043225A /* PreferencesViewController.swift in Sources */, + DE24E63B2A8FE93900E29F5D /* NSImage.swift in Sources */, DE0A916D2A8E7DD700D1D6F1 /* HoverButton.swift in Sources */, - DE1F1A242A8B50D500A88DD8 /* BoxButtonHandler.swift in Sources */, DE0A91672A8E6CA700D1D6F1 /* WebViewList.swift in Sources */, DE018BED2A509B2600FF0AA3 /* URLModel.swift in Sources */, + DE0A918A2A8F88A900D1D6F1 /* GoForwardInToolbar.swift in Sources */, DE1F1A1E2A8B50C500A88DD8 /* BoxButtonViewGroup.swift in Sources */, DEB862EB2A853F7F00278FCD /* BoxWindowController.swift in Sources */, + DE0A918D2A8F88BC00D1D6F1 /* GoBackInToolbar.swift in Sources */, DE018BDD2A509AEB00FF0AA3 /* EventMonitor.swift in Sources */, DE1F1A292A8B50E200A88DD8 /* BoxSizeManager.swift in Sources */, DEB862DC2A85347400278FCD /* Scripts.swift in Sources */, DE1F1A1D2A8B50C500A88DD8 /* BoxContentsViewGroup.swift in Sources */, + DE24E6352A8FE02A00E29F5D /* MovableContainerView.swift in Sources */, DE1F1A362A8BDDDF00A88DD8 /* StorageConfig.swift in Sources */, DE2AD3292A824EEB00002D51 /* Accessibility.swift in Sources */, + DE24E6382A8FE10400E29F5D /* BoxBaseSplitView.swift in Sources */, DE874F572A591F2500FC3B77 /* Icon.swift in Sources */, DE1F1A2E2A8BCC9800A88DD8 /* Storage.swift in Sources */, - DE0A91702A8E8BDE00D1D6F1 /* BackGroundView.swift in Sources */, + DE0A91A22A8FAC3F00D1D6F1 /* WebView+CustomScroller.swift in Sources */, DE0A91782A8F014F00D1D6F1 /* WebView.swift in Sources */, DE1F1A312A8BD68F00A88DD8 /* Double.swift in Sources */, + DE0A917F2A8F865400D1D6F1 /* BoxToolbarViewGroup.swift in Sources */, DE018BEA2A509B2100FF0AA3 /* WebViewModel.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Box42/Box/BoxContentsViewGroup.swift b/Box42/Box/BoxContentsViewGroup.swift index 40320d9..0493128 100644 --- a/Box42/Box/BoxContentsViewGroup.swift +++ b/Box42/Box/BoxContentsViewGroup.swift @@ -5,7 +5,6 @@ // Created by Chanhee Kim on 8/13/23. // -import Cocoa import WebKit import SnapKit @@ -14,15 +13,18 @@ class BoxContentsViewGroup: NSView { var preferencesVC = PreferencesViewController() init() { - let webVC = WebViewController(nibName: nil, bundle: nil) + webVC = WebViewController(nibName: nil, bundle: nil) super.init(frame: NSRect(x: 0, y: 0, width: BoxSizeManager.shared.size.width - BoxSizeManager.shared.buttonGroupSize.width, height: BoxSizeManager.shared.buttonGroupSize.height)) + self.frame.size.width = BoxSizeManager.shared.size.width - BoxSizeManager.shared.buttonGroupSize.width + self.frame.size.height = BoxSizeManager.shared.size.height + self.wantsLayer = true - self.addSubview(webVC.view) + self.addSubview(webVC!.view) - webVC.view.translatesAutoresizingMaskIntoConstraints = false - webVC.view.snp.makeConstraints { make in + webVC?.view.translatesAutoresizingMaskIntoConstraints = false + webVC?.view.snp.makeConstraints { make in make.edges.equalTo(self) } } @@ -54,25 +56,21 @@ class BoxContentsViewGroup: NSView { return } - currentWebview.translatesAutoresizingMaskIntoConstraints = false - + WebViewList.shared.hostingname = sender.title + WebViewList.shared.hostingWebView = currentWebview + self.addSubview(currentWebview) currentWebview.snp.makeConstraints { make in make.edges.equalTo(self) } - // WebView 설정 - currentWebview.configuration.preferences.javaScriptCanOpenWindowsAutomatically = true - currentWebview.configuration.preferences.javaScriptEnabled = true - - // WebView 내용 로드 확인 (옵셔널) if currentWebview.url == nil { print("WebView for \(sender.title) has no content loaded.") } currentWebview.viewDidMoveToSuperview() + currentWebview.becomeFirstResponder() } } - diff --git a/Box42/Box/BoxToolbarViewGroup.swift b/Box42/Box/BoxToolbarViewGroup.swift new file mode 100644 index 0000000..ac17e8c --- /dev/null +++ b/Box42/Box/BoxToolbarViewGroup.swift @@ -0,0 +1,31 @@ +// +// BoxToolbarViewGroup.swift +// Box42 +// +// Created by Chanhee Kim on 8/18/23. +// + +import AppKit +import SnapKit + +class BoxToolbarViewGroup: NSView { + var toolbarVC: ToolbarViewController? + + init() { +// toolbarVC = ToolbarViewController(nibName: nil, bundle: nil) + + super.init(frame: NSRect(x: 0, y: 0, width: BoxSizeManager.shared.size.width - BoxSizeManager.shared.toolbarGroupSize.width, height: BoxSizeManager.shared.toolbarGroupSize.height)) + + self.wantsLayer = true +// self.addSubview(toolbarVC!.view) + + toolbarVC?.view.translatesAutoresizingMaskIntoConstraints = false + toolbarVC?.view.snp.makeConstraints { make in + make.edges.equalTo(self) + } + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} diff --git a/Box42/Extensions/NSImage.swift b/Box42/Extensions/NSImage.swift new file mode 100644 index 0000000..602020e --- /dev/null +++ b/Box42/Extensions/NSImage.swift @@ -0,0 +1,30 @@ +// +// NSImage.swift +// Box42 +// +// Created by Chanhee Kim on 8/19/23. +// + +import Cocoa + +extension NSImage { + func resized(to newSize: CGSize) -> NSImage? { + if let bitmapRepresentation = NSBitmapImageRep( + bitmapDataPlanes: nil, pixelsWide: Int(newSize.width), pixelsHigh: Int(newSize.height), + bitsPerSample: 8, samplesPerPixel: 4, hasAlpha: true, isPlanar: false, + colorSpaceName: NSColorSpaceName.deviceRGB, bytesPerRow: 0, bitsPerPixel: 0) { + + bitmapRepresentation.size = newSize + NSGraphicsContext.saveGraphicsState() + NSGraphicsContext.current = NSGraphicsContext(bitmapImageRep: bitmapRepresentation) + self.draw(in: NSRect(x: 0, y: 0, width: newSize.width, height: newSize.height), from: .zero, operation: .copy, fraction: 1.0) + NSGraphicsContext.restoreGraphicsState() + + let resizedImage = NSImage(size: newSize) + resizedImage.addRepresentation(bitmapRepresentation) + return resizedImage + } + + return nil + } +} diff --git a/Box42/Main/BoxButtonHandler.swift b/Box42/Main/BoxButtonHandler.swift deleted file mode 100644 index 2c5440c..0000000 --- a/Box42/Main/BoxButtonHandler.swift +++ /dev/null @@ -1,34 +0,0 @@ -// -// BoxButtonHandler.swift -// Box42 -// -// Created by Chanhee Kim on 8/11/23. -// - -import Cocoa - -class BoxButtonHandler { - func clickBtn(sender: NSButton) {} -// guard let clickCount = NSApp.currentEvent?.clickCount else { return } -// if sender.title == "Preferences" { -//// boxView.contentGroup.subviews.removeAll() -//// boxView.contentGroup.addSubview(preferencesVC.view) -//// preferencesVC.viewDidAppear() -// return -// } -// if clickCount == 2 { -// WebViewList.shared.list[sender.title]!.reload() -// print("Dobule Click") -// } else if clickCount > 2 { -//// let rqURL = URLRequest(url: boxVM.URLdict[sender.title]!) -//// WebViewList.shared.list[sender.title]!.load(rqURL) -// print("Triple Click") -// } else if clickCount < 2 { -//// boxView.contentGroup.subviews.removeAll() -//// boxView.contentGroup.addSubview(WebViewList.shared.list[sender.title]!) -// WebViewList.shared.list[sender.title]!.configuration.preferences.javaScriptCanOpenWindowsAutomatically = true -// WebViewList.shared.list[sender.title]!.configuration.preferences.javaScriptEnabled = true -// WebViewList.shared.list[sender.title]?.viewDidMoveToSuperview() -// } -// } -} diff --git a/Box42/Main/BoxViewController.swift b/Box42/Main/BoxViewController.swift index 3b1ba65..15e782b 100644 --- a/Box42/Main/BoxViewController.swift +++ b/Box42/Main/BoxViewController.swift @@ -11,9 +11,8 @@ import WebKit class BoxViewController: NSViewController { var boxView: BoxBaseContainerViewController! = BoxBaseContainerViewController() - + var gradientLayer: CAGradientLayer! let preferencesVC = PreferencesViewController() - let buttonHandler = BoxButtonHandler() weak var menubarVCDelegate: MenubarViewControllerDelegate? @@ -23,11 +22,31 @@ class BoxViewController: NSViewController { override func viewDidLoad() { super.viewDidLoad() - + menubarVCDelegate = (NSApplication.shared.delegate as? AppDelegate)?.menubarController + + self.view.wantsLayer = true + setupGradientLayer() + + NotificationCenter.default.addObserver(self, selector: #selector(boundsDidChange), name: NSWindow.didResizeNotification, object: self.view.window) } + func setupGradientLayer() { + gradientLayer = CAGradientLayer() + gradientLayer.frame = self.view.bounds + let startingColor = NSColor(red: 1.0, green: 0.804, blue: 0.0, alpha: 0.9).cgColor + let endingColor = NSColor(red: 1.0, green: 0.447, blue: 0.0, alpha: 0.7).cgColor + gradientLayer.colors = [startingColor, endingColor] + self.view.layer?.addSublayer(gradientLayer) + } + + @objc func boundsDidChange(notification: NSNotification) { + if let window = notification.object as? NSWindow { + gradientLayer.frame = window.contentView!.bounds + } + } + @objc func doubleClickBtn(sender: NSButton) { WebViewList.shared.list[sender.title]!.reload() @@ -52,7 +71,7 @@ extension BoxViewController { StorageConfig.shared.setPeriod(.period10s) } if event.keyCode == 2 { -// SdtorageConfig.shared.setThreshold(.percentage30) + // SdtorageConfig.shared.setThreshold(.percentage30) DispatchQueue.main.async { StorageConfig.shared.setThreshold(.percentage30) } diff --git a/Box42/Resources/Assets.xcassets/Icons/Contents.json b/Box42/Resources/Assets.xcassets/Icons/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Box42/Resources/Assets.xcassets/Icons/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Box42/Resources/Assets.xcassets/Icons/arrow.clockwise.imageset/Contents.json b/Box42/Resources/Assets.xcassets/Icons/arrow.clockwise.imageset/Contents.json new file mode 100644 index 0000000..e6da493 --- /dev/null +++ b/Box42/Resources/Assets.xcassets/Icons/arrow.clockwise.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "arrow.clockwise@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Box42/Resources/Assets.xcassets/Icons/arrow.clockwise.imageset/arrow.clockwise@2x.png b/Box42/Resources/Assets.xcassets/Icons/arrow.clockwise.imageset/arrow.clockwise@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..be10d0bdf05f8dcdd3fc35308000b79e2905d097 GIT binary patch literal 1114 zcmV-g1f~0lP)Px#L}ge>W=%~1DgXcg2mk?xX#fNO00031000^Q000001E2u_0{{R30RRC20H6W@ z1ONa40RR91BcKBS1ONa40RR91F8}}l0DVlZrT_o~#7RU!R9Fe^msyC7VHn3T#x|C0 z8DkmQqmZ&>Y^9kig_H|~Y#~>2As0eiC^wemiXx?y$XYWomd0B4HM<%jLdG6`|1;m) zJm))ezVDp#nR9MD^*hh=yvy@G=Y8Mrd*3gwQ8XDx_f^mg?net1z4rw|Jn)zkHC$fA z08{AS$%`=_{Q+)ze%dN(GF6ON2Cco3C!pWKZO>0jMNQ@-qn(0MunE1vzXLgu9*lY# z-2TyKo}QCTyg|F8Z9@0(r>2uolx1qdKwY5-3gI^#2ko1-&=@Ac3wQ{j(loS1e1l=Q z+OVUcAL#w!mv5#(32y==dd!s9YbyIN(d_9FUIe|v8Yij$PWeQ5pQJuk95yqWiS;lb zAc$t-C$xlQ@$#u_0fCaNvpOw=6=3((AN;FO;pr#nFW^K84TtT}$`ztFL$&c!Hnq;{ zz&)l;D`40%b)d}=UtcY6#_FWv-DX4y?FW3S6_CX!II-O5? zT5KXqQs|eoNgrx%nScke3zD|3t56~*z$UV^t~xVoj|o_X-8qFYYID-`Q$ov9=oi>z zj4xnmVC%Zd{l0#Y648?*nP017znAzeH-3<*rFF6uV~2Ax)tc(N;MTk(jX-6z-37DK z=o8pfN4-m=5<8V6A~0a4m0BkI4mpRfw`@*C$@DcNUpIEvO`T2M%&5DAP52D_lfrr&z$w+qBs@U%Yel>*+DXUFzeR*D#?~=U2~9P#LVanx}oEbvwQz*n;6pkS}Tik4s?lz`Vy4T gfB8QH4L$>Z0fK|Kq4O9|&j0`b07*qoM6N<$f**nGw*UYD literal 0 HcmV?d00001 diff --git a/Box42/Resources/Assets.xcassets/Icons/arrow.left.imageset/Contents.json b/Box42/Resources/Assets.xcassets/Icons/arrow.left.imageset/Contents.json new file mode 100644 index 0000000..4b93ed1 --- /dev/null +++ b/Box42/Resources/Assets.xcassets/Icons/arrow.left.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "arrow.left@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Box42/Resources/Assets.xcassets/Icons/arrow.left.imageset/arrow.left@2x.png b/Box42/Resources/Assets.xcassets/Icons/arrow.left.imageset/arrow.left@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..dd616af1f5c6826b7870cbe94f4db32f123b6b38 GIT binary patch literal 677 zcmeAS@N?(olHy`uVBq!ia0vp^DnKm9!3HE<9_|SSQjEnx?oJHr&dIz4iKRw(ruq6Z zXaU(A42G$TlC0TWzSWdSpsEeBF~aK7_x1_ma6PZ!6K z2+qCJeYIU3C64P~_ZHfAZ+n>2rVU5j;=-nRT@SNs%2$~0v}VfM)}x}6TBkgT4ZG)+ zr0n|fckwd6?K_Xp%zkF~b@%x>#^-I$|35c#W^uk*@GMi~9JyT&IQAXr4xKt->0HCp z7o>V?kFR%mTff`uI8SSm$)0nD?nyhk6=u&!-n3pVtl*80_6fCTEm504Jc}?k+@rMd z`}WIf&*rR?tnf6vr}<>PJtugFe0+oK?AvZyV?J4CnVFzX$MNF6;7R@GOGJsNW_EdIdp>#y(~F4mO^3pL&z z5xiho$l!QZ&4cyqW8-YE?`)2{bECxs%ia^_oKb z7v&|glvJE5$*7vUbpDz?`Q#(7Yq#?~v)`A@RsF+Uo-0cib literal 0 HcmV?d00001 diff --git a/Box42/Resources/Assets.xcassets/Icons/arrow.right.imageset/Contents.json b/Box42/Resources/Assets.xcassets/Icons/arrow.right.imageset/Contents.json new file mode 100644 index 0000000..483e2db --- /dev/null +++ b/Box42/Resources/Assets.xcassets/Icons/arrow.right.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "arrow.right@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Box42/Resources/Assets.xcassets/Icons/arrow.right.imageset/arrow.right@2x.png b/Box42/Resources/Assets.xcassets/Icons/arrow.right.imageset/arrow.right@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..f3362b8c3974b221da2e324d79b487f0626e1de8 GIT binary patch literal 633 zcmeAS@N?(olHy`uVBq!ia0vp^DnKm9!3HE<9_|SSQjEnx?oJHr&dIz4iKRw(ruq6Z zXaU(A42G$TlC0TWzSWdSpsEeBF~aK7_xpt8rFE{-7) zoM)%+^kR0DX%BB^x#%Y7x<@NeBzLR8L5*8n+x9giB&+^lna5$*#Q%VC+Ck=xLb-cB z=&jAUqSku+JNM=dZAZ?YI`{71!_zV|&(!>UpO!Yc=up4mvN>)16`b|I5{%0X{;=ge z6fzRf&|>cWCO;>w!#Z8`D=&x2)KBrs7dpb-t~>7kIpx`WhSWDVzx<7C(Oq)1Z=qn- zRRt!`n*x)LD4IC)Ym`V%U1?p>G%3;BgImr)x@5KE6xGz=7t)=z8SQ!jJA%Gn=}tSf zYyykQ)YhsO%&kj~EnG1rSCP}>)rl$0uM}cdvcKy8Dfd~Zb;9m@nxeVfhXWYjJ^igJ zx>SJg=iO+g#S6B2r*(Z->U9jWX3w4RNNS7jli=%KmaJP}ZIGCM=I=Yl=tDdj-dua_ zmuK%}pF5%D#L0DX9@2vj5ENnX0!orlfVWa=)K>v?#Ttq($=9mo4W*s@3i; z+s9yKRipeyWZQ;C;c4AvH;wjf`!BITwp{kh4lDk~{U7*aLoy%#nILNeigr&|KbLh* G2~7YBh5MEO literal 0 HcmV?d00001 diff --git a/Box42/Resources/Assets.xcassets/Icons/doc.on.doc.imageset/Contents.json b/Box42/Resources/Assets.xcassets/Icons/doc.on.doc.imageset/Contents.json new file mode 100644 index 0000000..97e4fcf --- /dev/null +++ b/Box42/Resources/Assets.xcassets/Icons/doc.on.doc.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "doc.on.doc@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Box42/Resources/Assets.xcassets/Icons/doc.on.doc.imageset/doc.on.doc@2x.png b/Box42/Resources/Assets.xcassets/Icons/doc.on.doc.imageset/doc.on.doc@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..5a880b3a0033eb8c28d3e273eee5429edaee9b31 GIT binary patch literal 1301 zcmV+w1?u{VP)Px#L}ge>W=%~1DgXcg2mk?xX#fNO00031000^Q000001E2u_0{{R30RRC20H6W@ z1ONa40RR91D4+uX1ONa40RR91F#rGn02daMUjP6Ee@R3^R9Fe^m|3V*WfaHnZBi>T z$R=zMy;6##%@a{X6a@thK9!mEBn9~pR8ZkV^$_%s(P)-fQnvx=rQyMc$R2#Dl!|N) z8$d!ci?THP{Z9M4t+UTL`|Q2Xxg8%|@ZaBBYp-v8|NV`7@8O|pGL`V#!6o333RS-( zb~P9UyDHQh8mT%k@rbUlvSz%Th5o$M+EUn9w!T%td)cjtV0b0UuYgYzTw zMW8gvP`9Hxn>(8Vo<={uV|4S4$3nf7;}v{|Hixyh_G|BM@y-pNpU|C$n}e^c`dt=y z3gt7P>pU(?@QA=*1N!g5uA(j>*dbO<16A{F zNtxYJlqJ|wu?L5XLz2!%rZ`*PI(i zf!OUQWB&@26Tl5%8~6bH0P2YKCHXv<0nP)DgT>%a(2%qby5#QxSAn=^HG&E*d${)& zSPDALO}80O9_2FdjY^Oy=pF#mGT%Ftw}QX49b$WN1-KeiAxC)QB)XjPMR25!8sfIK z0DPO(y^wMlXmF9-HDDe{BJ+)4dvfH;W3gxDeABU40UNTxPGWoQWDCw4!3)3x;9_t$ zxZes_fF$3e+ycH%jyC1B_#VvsUr|m2j)Wvv0vp;2lEgjpUYtIBC)vOa2`WD98VR1H zmC2)&MdVUkD%YX7k4adPGr>wA$uuV=bR|&E$dLs8p|!Kn+rAKlm=<+B3EG&4 zzh`lhb5XQQFV0>Gx}|iJWduAKf-XQ`66`{?^pk`vJA-bIoDZTe+#XZkMRP?PuXxfp zPq%3lNgaZphJ+*N&j!1!I)T8`z}jvV>I|_P?i<|_m$-jiiJ0<}HJ9uT>~+8)^UN(X z7YS<|fxe(B2mM9tV+tQ_3g;EbyXNap1>N$2F!Ct#?Uk}#k!NWtH zoqJ;srqf2ATkCE!;UW8``o4G_SQs*XI7otvAhI}+kzjsre0h)rZM*1Gz*n`6gCrO_ zZ%q9g?PK64!rOWWNzm`<*Cm1M0sev50)7KyGDw2{!?CvtWpCVOnh56!=2uZua374A z-(l@45{!SJj_z8cw}4|p_1JE3H>(o-F}TuSsNm|GIzpz|AzN%WxSLfM$$Bt7bI+&r zP1n`6J@fTi97uv$z~8#*$I&kI_d!>2PRsxjGSUAfqcoI$G8MMz6Zz@48C(R?6QYir zIAV7Kd$Fs;Rpo!V>w*7KTr7SX#`~DH#M8m)@)>v&_(kY9O)2>YZAhy(!^vU#00000 LNkvXXu0mjf*TPJ; literal 0 HcmV?d00001 diff --git a/Box42/Resources/Assets.xcassets/Icons/ellipsis.imageset/Contents.json b/Box42/Resources/Assets.xcassets/Icons/ellipsis.imageset/Contents.json new file mode 100644 index 0000000..849e448 --- /dev/null +++ b/Box42/Resources/Assets.xcassets/Icons/ellipsis.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "ellipsis@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Box42/Resources/Assets.xcassets/Icons/ellipsis.imageset/ellipsis@2x.png b/Box42/Resources/Assets.xcassets/Icons/ellipsis.imageset/ellipsis@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..e027e56412dc5da67a7faf1a845a0635d55048bd GIT binary patch literal 459 zcmeAS@N?(olHy`uVBq!ia0vp^szA)a!3HGj)|kBpQjEnx?oJHr&dIz4a$Hg)JkxxA z8MHvE7#Q0#8CXC{fLIEM85o!sFfuR$X-1IP0w%bu>H=msn**e9<;+*RfXYlgT^vI! z1m{k%_jU@DIJR}g!jo*qQ|y|XuLzjEn4ZD4(qBQZ*D*Vn&(eZLQsW0_jFx+}66c&l z7X{j<1(|&KKH<>Qf_K_K4!ytk+3tMp`T5o7cV0YEe`H7O0Y#sMyrvR|SDpBDK=X~W z{JV$DVMq1&=QJOibCBESfXXRVK3)$;gIy}=AEZU*ZWAkdnNk15HN&#Xz<0tGMM;s& z{f>!~Pm9VlN^4!=vRb$C#MMMrGnx3GhA(_q-xI&yA=$rh``^WUpX7=)pHAaF|ChzL z`%~*S=UeGICadqyQQMj-lE41t$}_7>k6&35*V}m5Zm!pwU7Y`RUtAx0`{I(kgWG4e zzbJP*Zo4O~Bi`*l-$#}9Udsckv;2D=aF+b~<{*6Kq~<~Kh>ty%ZOk_s{dY9FZ*bzi grti>xRJPcHeYTs0g%oS?Sx`WFy85}Sb4q9e01lL^;Q#;t literal 0 HcmV?d00001 diff --git a/Box42/Resources/Assets.xcassets/Icons/figure.skating.imageset/Contents.json b/Box42/Resources/Assets.xcassets/Icons/figure.skating.imageset/Contents.json new file mode 100644 index 0000000..99f8ebe --- /dev/null +++ b/Box42/Resources/Assets.xcassets/Icons/figure.skating.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "figure.skating@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Box42/Resources/Assets.xcassets/Icons/figure.skating.imageset/figure.skating@2x.png b/Box42/Resources/Assets.xcassets/Icons/figure.skating.imageset/figure.skating@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..1ddfa0f5d0e4fdc5b728177e6e5c2fbd05bbacdf GIT binary patch literal 1333 zcmV-51Px#L}ge>W=%~1DgXcg2mk?xX#fNO00031000^Q000001E2u_0{{R30RRC20H6W@ z1ONa40RR91C7=TU1ONa40RR91F#rGn00pQpO#lD{pGibPR9Fe^m}`iZMHI)^)eucX zlhyUoW@3aF)TI)Iq%tLX3os}wkj)DS`mI6)IcXV z4xhmhXb~yrQ&&NwLp}Wo5EKn8N?s=L3!dO@&@F`?9$QIOWKu7NJ`{ah@FiS$Qr%OM zlBq@B)X9vbg7zY(Z(~YQm$7{lvbPQy?t)&s>`{2aiFK9!eAw^k|L>}f6fLS#XLXWF{6Wo|?8LV9Q}T>n+6y+AmrC znC9y-PN6sTCWE_L0W@uI!Iea(HKw#V-k#Z;^BYkrNgE-~0+eZH=4OsFI% zpw6hhptW@oBzm(Sg4SF}&S7{Bbm&S>!9aLSod{`)t>`A!Fd7?7C-9tuev4!4K>ro! z1!{23KP(o`eG~igsfc^q3PO(RuOj6paPezQY z$7ff-PiyFUz?NIB`qP-8;@B=DLKp0t6Mr+#JU>An+B_LyZ<-ZgE$B3t^Z`}sTDSzR z^h0q1zJoFFFxb+QjtcAdwlZ&9NsR;rGt!NQZi+iV71qcjG`<2=js+=vp>PTT`Z zSW~G)JAo0kD`Bfq#6A_=m6<4JyGo~jnEqtAYU#Vu{uK1J%7{wDV952hG##$2M=>Al z543%*(OKxRYXeLN)hi>4uicnSd`T&Q*21fx=59-{aMD&aC4$wW`oVzq{6<@~s z@j_=-chK)jx_4AmR|XF-em zuFK~{Y=nJK85zAVeuqHg)<%vgxy9@(P1&F%s21_#NjvK?00;AihGaS0_Lw!IU80+# r659#yLCh}v6+f-Vj<6CMAWCik2kOHm^(~4k00000NkvXXu0mjfKUZ9v literal 0 HcmV?d00001 diff --git a/Box42/Resources/Assets.xcassets/Icons/figure.snowboarding.imageset/Contents.json b/Box42/Resources/Assets.xcassets/Icons/figure.snowboarding.imageset/Contents.json new file mode 100644 index 0000000..f437f7e --- /dev/null +++ b/Box42/Resources/Assets.xcassets/Icons/figure.snowboarding.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "figure.snowboarding@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Box42/Resources/Assets.xcassets/Icons/figure.snowboarding.imageset/figure.snowboarding@2x.png b/Box42/Resources/Assets.xcassets/Icons/figure.snowboarding.imageset/figure.snowboarding@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..d7972331cb9541497de78c2b7e97830fb679906c GIT binary patch literal 1277 zcmVPx#L}ge>W=%~1DgXcg2mk?xX#fNO00031000^Q000001E2u_0{{R30RRC20H6W@ z1ONa40RR91E1&}a1ONa40RR91CjbBd0IMvj`2YX}XGugsR9Fekn0cs=Ss2HE7>2Rs z;ud0Dw@?a0WQmZa8DvYAvTMR$l%niJNY?nzKm0SMhLAN`Q{s<%NA@*|Nh8bD*tgG@ zd)#x+J@0bfD?IhN?|Gi{oO7P{yw6#Fw^HuwNiT*P1o?0W{(y_{-N|Aiy6SKleH5gY zN*>QD*lK(1w&?|mNFxJrS{vc`7Q5HD=Zm#EH8x93f4F7|XcNF>?#d#{7 z7Qti3?p57Ey-to%X)*&QK~<+tssh~v+d#ocmcZzbrP4oo3E8!UrIIYcnvM%7D95`S zgY&$Oz7)=u*n9KT%5MmFUb zhJ&d;1QWqtBdB3gp~eg~9@3mb)$r>9T4+j-`w%P@NrPsLrY$SYzU&63)L01*-HJFp z>&)sUx4_SFoyXL*qE27rC0qb)k%^KuSbctXEAkDdJ$E)V0Qbd$QzJ{T8gwK0_E^lH zMHihZa0&F;ufQ+hUXto#(}ALXi{Ke}B{W!l{>|XdlCSeM7>`>Owy2I1PHqa-TxBI9Wucdk1#?*I_v78YA?Z*p(VeuXf;0UTbW1 z;W*?%Pq3s#r9SuTPk=nfSHC25(rFf5DKrN6O^iM2`5P5^QI#e3E_BB(13`hRQPyC4({_M5uw*;s zOO~#pW`CArD?-<)6)aiOpa!Gt2m3!M+B%G2BJp;@E=JEWw_)M$oEWX6bfOJA)A| zx`mK*KQR8@XO^7(k)9?)9%xI_#Uo0FQPBYo!>K5z5c?RMwPDu@Y4jC+n=_WaUN_C` zIZ&XFU?=~&1p1mM6|5G_3aAI)t7r$AX>wLGI|Q`d6oT}u_Xe6) nNObRb1-gu10qr)*`8OW`GFrqIvIRX%00000NkvXXu0mjf87n^L literal 0 HcmV?d00001 diff --git a/Box42/Resources/Assets.xcassets/Icons/figure.surfing.imageset/Contents.json b/Box42/Resources/Assets.xcassets/Icons/figure.surfing.imageset/Contents.json new file mode 100644 index 0000000..faa8a6b --- /dev/null +++ b/Box42/Resources/Assets.xcassets/Icons/figure.surfing.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "figure.surfing@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Box42/Resources/Assets.xcassets/Icons/figure.surfing.imageset/figure.surfing@2x.png b/Box42/Resources/Assets.xcassets/Icons/figure.surfing.imageset/figure.surfing@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..3e6b0e9172603b167b50a3551a52b1d81239b6c8 GIT binary patch literal 1570 zcmV+-2Hp9IP)Px#L}ge>W=%~1DgXcg2mk?xX#fNO00031000^Q000001E2u_0{{R30RRC20H6W@ z1ONa40RR91E}#Pd1ONa40RR91F8}}l0B`aQv;Y7Fj7da6RA>dwn0xG(Qyj;CsEFuF zl*X1QS!$N#x{%vgi8eI$bDPn$*+Pk_t+_2V%B7H*85=egnGJvB(p*NRNz%-^p^!>Z z!t2$3XC0@f-}8K*=le77?X~Be&-py(e9n2!?fY$LsIN|;y0_sgm;(F2|5~kx?shQX z_)vz|BypXAC;3H{e0<=w9+ev;JEQ{<0{1Ehy zYzs(_hYgXfP_pbCY)|cz;k=Ai97U(ir%_o)(sSXk$QF_-NL&Vg1VfSMzD1l8A4kq0 zvVxwEeHg?+lWk~(te`FH1tUz3{uq%h%!uxMY_G%F8D$@5*kaR1ai&OmzambFkBevy{0dHicxO70 z{Ke1>3}!nh_x4MmotZ=~&Pm`-R9IyK50x(_@fP$0_vKi}lQB>aq&4t6yaVp_b}Hyy z5@TR?lu%BZDD&eoOjJ z@GI3tRi;WBfTQQMIW8?A-x1ua-F@8S|AI=Y=ZL!(KL>erF2m;z_!>&9UL)>qF&hpk z5XqtVj06v@Mc_K9S@jBh5-sPQj&X3ddn%j;pMYCyO{z!W=g{KVnp)lMd<4nM!E3_O z-RAsM-h9lfp%V_CmYs7Poff0OJ$xc`fK&$Wz8~`qc@MljR5kD!)HrmHTK6<{qA=Zl!T&T-+O~1U{S!9)vtC!Ql!>k96W*<7xKOk1FJ;-Mc zZrQ;5P+^`{;P7moQ&esz#4j1-ZPSxDbjY+{=7q9>|H;cmh{uHRy_g;hn1$K|Z;*X7WP_xPgZbRPq zro%upCFR!U{yweN_p1aR+B%)YSoAD*J(&k$L(#N>I|}cEb8|dA3h_vhZB|!PdS>F`AbghC zMw34_vE5BR?p#uwpEYQIPI(LS^Lcs|`C;JP{i5leFa=&BpDxf7uzi{M-ABH(LIbYs z58wbe3H%9mDYOSiZU{Xa;qN;ADf-paQE`ll02b?nZLYSYfff>*nipY5! z*S&zeJ6K)hh#Gt&II3+SRZk30LI}bRJPxjh=5!Z@;T@k<&Wh&R$t@dz$1@NI^9p(Q zXHVc%j;^Er8eEwcR>`{n%cvhOT@OPctP2`RfBIX{Lh44n z1K>n(f%gJCS5zx;yh!KtGZw9&te+z)Z$uT?nV#U+aIs5g=+K1cifgD1tb<+p2OM+? U#-r7d`2YX_07*qoM6N<$f(KU8s{jB1 literal 0 HcmV?d00001 diff --git a/Box42/Resources/Assets.xcassets/Icons/minus.imageset/Contents.json b/Box42/Resources/Assets.xcassets/Icons/minus.imageset/Contents.json new file mode 100644 index 0000000..c437350 --- /dev/null +++ b/Box42/Resources/Assets.xcassets/Icons/minus.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "minus@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Box42/Resources/Assets.xcassets/Icons/minus.imageset/minus@2x.png b/Box42/Resources/Assets.xcassets/Icons/minus.imageset/minus@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..2a101f6b805c60f296c058b60618d675879606f0 GIT binary patch literal 212 zcmeAS@N?(olHy`uVBq!ia0vp^3P8-l!3HGXyW3s?QjEnx?oJHr&dIz4a$Hg)JkxxA z8MJ_G4hF{dOa>N^5+IfWVg?501&j>LK$;OGwtxvPtFV9>&IajVm~s5IIgqmRba4#P z5KT@=NO-{hh(X~QYf@EHyu;}-W2R0~ha3<8*%ROVI>PcqLz(l!?32fNwtTb|n9Xb` fJvW!#^`I9+aTnVc(ZXx0AQL@Z{an^LB{Ts5$Hy>S literal 0 HcmV?d00001 diff --git a/Box42/Resources/Assets.xcassets/Icons/pin.fill.imageset/Contents.json b/Box42/Resources/Assets.xcassets/Icons/pin.fill.imageset/Contents.json new file mode 100644 index 0000000..ff506bf --- /dev/null +++ b/Box42/Resources/Assets.xcassets/Icons/pin.fill.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "pin.fill@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Box42/Resources/Assets.xcassets/Icons/pin.fill.imageset/pin.fill@2x.png b/Box42/Resources/Assets.xcassets/Icons/pin.fill.imageset/pin.fill@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..164fbcfda65f9c2ef0c2a6736acf1d5de29f6cbd GIT binary patch literal 890 zcmV-=1BLvFP)Px#L}ge>W=%~1DgXcg2mk?xX#fNO00031000^Q000001E2u_0{{R30RRC20H6W@ z1ONa40RR919-spN1ONa40RR91F8}}l09F8|GXMYrpbGezFy}jL;yWLxx3>@?3&71ezd9(NC-2wlp37ab?u?;00gv4rFpIH|8 zOP?<=gnI-^<EiF3`%lP#bq&si)uPBHYM!sD0Go_K=VRy1#?>2v0mc2 z_8o$U@qp2Ps3&soCBC78QSH}&YlkjyloOBjWRCqjp#!3f589^zD}^|NpZJP>sN$A3 z$lOaFVFf!0eP;VIZ?&ydvYg`X1KgyzwsFpTEHQ<7oEKyG-MA(ZtPJHeHnJP%=a?FM zH;LD@9TaErBxy}5STEuO+@^d&j~)F2UZO|L;7^)eLy}32f)LWI{279Ai1#gSV8obQEekub?j=RMlC< zLDd5=x&gO-$bOhYWP$ww552DtSQN5C?RY~}SIkK5_+v4sC?#OcdycAD`586KdBnQC zmbsXlH#0Z))BP$>#1TenPu+Hb$5s0U=&`oKjlN=WKO0Gz9t&$G%s!J8%8LVhV*R|y zcdfQFDN`$o>X*PpMLN6|3nSJ+OK0pC@hU5*u-S5`bx7@nTHuHAYs*II7TN{BH?Ac@ z*(lvYdtixK4P)Px#L}ge>W=%~1DgXcg2mk?xX#fNO00031000^Q000001E2u_0{{R30RRC20H6W@ z1ONa40RR919-spN1ONa40RR91F8}}l09F8|GXMYsL`g(JR9Fe^ms^NVQ546=Wn3CE zZl!T452BDr8I6aLNW2*o%8N(EliZ)=!Na5!MM?>UBBfm7$t@2qiQHaHNpdNk?{oH=v8yv(Zq?6uZj`@ha!XP>pdsjK@>(l5$86?-9Qi2S`Ze?ssKTm^qb z=830cp9KRnQ6o75Z@akrTY?t!S|(MhR{fC->>NseRSK8882jCkL!Zx@&9?5T>0Q*r zSkDbwao%ffMH3&)!yGp z7OVs>Y~fh+L1w$E$^`j_vI}eiUxU-fYKax6limh?$tcU0phTnlcQdD+P*KtnYoX3T zI1B1Ji95jm83fUJs47_!HyVSImRg?qg6caS5uBCAEQy`O$zx8hgs+L?N_I~ZdpTo5 ze<-g~9G5w1jYe%B(47r-h&?? zNa~K$63>RIC9pA0DZ^YPRel$BxHfPBB=+{u$bFIY$v`b{fs87mjux6rQrH`u`@rRR zGAZ#Ig0=(iJ}T#Ra1T5L@4zSU8>r-?z%(!iECLgO%O#8*Ks<@E4X@uYx3JfOhQ#P( zr#7S4a|$@udF+v(o9HI-z`fYRyG8ZPv4U__DDa*`AL0~xm%52Uzy_b}rLHgGj&bh^ zd^#N0Y+`GeC~%w$*OPJ%ZE%*7E(fcCqyuaOm2M!#Cx(YUiKZrWdV#gfRS!s#oV4Z5ed3-j_4gpI z2Vd%#H}QRA&eeDGCVoZYaH(IhhsdnzTFfgSSg4;#r}Gf}1unUl$)^gPz5oCK07*qo IM6N<$f{dfOf&c&j literal 0 HcmV?d00001 diff --git a/Box42/Resources/Assets.xcassets/Icons/plus.imageset/Contents.json b/Box42/Resources/Assets.xcassets/Icons/plus.imageset/Contents.json new file mode 100644 index 0000000..ace344d --- /dev/null +++ b/Box42/Resources/Assets.xcassets/Icons/plus.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "plus@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Box42/Resources/Assets.xcassets/Icons/plus.imageset/plus@2x.png b/Box42/Resources/Assets.xcassets/Icons/plus.imageset/plus@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..3b9f6216ee1a78dfcbed2c3cbd99402d1d67b79c GIT binary patch literal 354 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}E~ycoX}-P; zT0k}j17mw80}DtA5K93u0|WB{Mh0de%?J`(zyz07Sip>6gA}f5OZp6?&Um^whD2~C zCn(5AFl>!ud^Fo(j@vpzpC?%?uRb#+g{}CfP;_?T5yl*kX-bEzRbC3TtBt6RbokqM PApd!~`njxgN@xNA^=WS< literal 0 HcmV?d00001 diff --git a/Box42/Resources/Assets.xcassets/Icons/shippingbox.imageset/Contents.json b/Box42/Resources/Assets.xcassets/Icons/shippingbox.imageset/Contents.json new file mode 100644 index 0000000..e79e1f2 --- /dev/null +++ b/Box42/Resources/Assets.xcassets/Icons/shippingbox.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "shippingbox@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Box42/Resources/Assets.xcassets/Icons/shippingbox.imageset/shippingbox@2x.png b/Box42/Resources/Assets.xcassets/Icons/shippingbox.imageset/shippingbox@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..9a0a5b3b044dc1c370cf0b1d103f45bdbae75c15 GIT binary patch literal 1530 zcmVPx#L}ge>W=%~1DgXcg2mk?xX#fNO00031000^Q000001E2u_0{{R30RRC20H6W@ z1ONa40RR91C!hlW1ONa40RR91D*ylh0Q^4WJyFpR9Fe^n0ttoMHq)Q%XSqj z%A~YHx@l^KnnGYm*WL1hWmy|h(Pg#NFr_6GB#OMHB_^rh9~PFE3<@l}SXfHvAKAsq zjkMUx)?&MvyP|e`p6$#s=i76>J$tGB#~(a9Gw;kd^L{h$%r|E{c4!-&M>m&2PpE^B zVGA6F7OP{6pZxd1z9bL9upIr=U|R~S;m;iPO`2NjTz7h&0%PHrCPvvq{akpjiFS>u zo9kR>dbkrNKv#(M83j2BT;gJgwUvTSei<9n^38Fsl#VK(SE57XYaV1Oac%$)&w#;+PWDk=02|=%L|rJJNyeBg35HC%pY$161xGTrMoF4; zJ!m}@#z3;2yKo{D8b?EEJ01E#tSSogVN+}j`A#7drA6djl0|SKBpt)l!RJOpA27~- zgEZ}>@CiTb7^`ujw zyM`21Qa2m6gI|<;py9kSALMR)6h_0=U?e>jZilxrspT~NMdeH268lUp{e*EA_!2sn zrEr*L88e05q<6!3h?nz3$}{0rxB}ATjM?_eM57~=SHLykX7WWEDb2aicr%%i@Hluj z1@$Jg6jnkXh;=-L3E+&~2=O?^l`&;}AAr1yAIjT^3ghiLaEYFW_zQ3;<(J_xaHf2b z*Wp3v0zt-=Vc|yjCK%Jwc(;ZPk=8!colC~uI4l@4sZPh6NV9RZ2>c4=Tt4ivQa420 zFkgN*6~<#Zd=)i{9gE{?9c>D6Eb1yd7P2Y|EWAs*5RdT}Kzl)Pl{QYHF_+edOKCjD zakL^)PJ2FYU0XPpxAWFk9CfaxGkA37S~GK=N2)V)tIxIXpK$H3|K?RkzDyzSSEIdj z0RxwW!Hv1ip+I^Ytb%@#?f=LYGsqC6U z@HV6T-7-t(yawG0uR)OZvEY?wJcNhHwwVUfli%D0a9Y&sKJxd%2Axpee!b#&rP&2R zPO;bQjc{!+wleL>^H0JWxG3t&Z}So;g)Q2HbLQ1{xB+HD4FvTf>WP)Ft|aGL$S5M&UK0SCJuiXfkcP~pqCxlWB5?IrIlmch=*o|SFRnPvcc z`}JQBv8pL7gmO4PQ!#^dIJi`?YAGy-l@PB8#l~umb3SeRkuVKTheG8o*yG8#tts@O z<~kSpbt&%xXRA0E^Q7Cb&wDaPU;cPEB*=VV?2IWDOYo@u_m z3|c@o2Loe!CIbsd2@p#GF#`kh0!9XAAk7F8TfhXD)my*}XRCk|N+{VZWnf?u_H=O! ziQs%Y(^|*HQKYThmP^#pL&Rl`%a_$xE^y8L+7+&0$~CvmY0;G+B|(?P3zi8@Z3 zZQNnEL2pKDQmD-~@hxW$tZFeoBqrjhcSBn#Sjd{g?Thq3wl@b%YtpB(h&OY~X;kmq z{eyoa*S_0)cLM|rbPnn!X(CcUKR%w=Jxy(T!O?HbPpZ@Zzk3>z=kH_@s+T#tIlbdb%*sVC zYtAh6+5CE?^0cjK(+k!Ht0@Qu75Ui~UA*)}Xx$94s6*br%k`I6RmyA$+y1uc6jO$; z%*vfXuG((BTJbY4J%6&=!R&U-p{>VfH@SH9v>iU->OI+eN7AixmD!fRi=MTnTQC1) zJMaC+_-_t&p>;O{C3pMSuDcwNoO@o;#M6C(8oaZ?>4+%{*n_aBIQF{-Ea# zyA$jK1pKt$EVj=5`s&i6nX5C*udz8_)8+rte0Bq0YuJJGaM|1X8*eSU>!kg|?o@`n z0srl9o}t3L%nL4SEp4oo@G>>J{9xghtMQtr3s^Rm7tQxxcqDvL4=9; Void)? + + init(image: NSImage, completion: @escaping () -> Void) { + super.init(frame: .zero) + + self.image = image + self.bezelStyle = .texturedRounded + self.target = self + self.action = #selector(goBackWebView) + self.callback = completion + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + @objc func goBackWebView() { + callback?() + } +} diff --git a/Box42/Toolbar/View/GoForwardInToolbar.swift b/Box42/Toolbar/View/GoForwardInToolbar.swift new file mode 100644 index 0000000..e5f04fb --- /dev/null +++ b/Box42/Toolbar/View/GoForwardInToolbar.swift @@ -0,0 +1,31 @@ +// +// GoForwardInToolbar.swift +// Box42 +// +// Created by Chanhee Kim on 8/18/23. +// + +import AppKit + +class GoForwardInToolbar: NSButton { + + private var callback: (() -> Void)? + + init(image: NSImage, completion: @escaping () -> Void) { + super.init(frame: .zero) + + self.image = image + self.bezelStyle = .texturedRounded + self.target = self + self.action = #selector(goForwardWebView) + self.callback = completion + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + @objc func goForwardWebView() { + callback?() + } +} diff --git a/Box42/Toolbar/View/GoHomePageViaToolbar().swift b/Box42/Toolbar/View/GoHomePageViaToolbar().swift new file mode 100644 index 0000000..2728ff3 --- /dev/null +++ b/Box42/Toolbar/View/GoHomePageViaToolbar().swift @@ -0,0 +1,31 @@ +// +// GoHomePageViaToolbar.swift +// Box42 +// +// Created by Chanhee Kim on 8/18/23. +// + +import AppKit + +class GoHomePageViaToolbar: NSButton { + + private var callback: (() -> Void)? + + init(image: NSImage, completion: @escaping () -> Void) { + super.init(frame: .zero) + + self.image = image + self.bezelStyle = .texturedRounded + self.target = self + self.action = #selector(goToHomePageWebView) + self.callback = completion + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + @objc func goToHomePageWebView() { + callback?() + } +} diff --git a/Box42/Toolbar/View/RefreshPageViaToolbar.swift b/Box42/Toolbar/View/RefreshPageViaToolbar.swift new file mode 100644 index 0000000..8be72bc --- /dev/null +++ b/Box42/Toolbar/View/RefreshPageViaToolbar.swift @@ -0,0 +1,31 @@ +// +// ReloadPageViaToolbar.swift +// Box42 +// +// Created by Chanhee Kim on 8/18/23. +// + +import AppKit + +class ReloadPageViaToolbar: NSButton { + + private var callback: (() -> Void)? + + init(image: NSImage, completion: @escaping () -> Void) { + super.init(frame: .zero) + + self.image = image + self.bezelStyle = .texturedRounded + self.target = self + self.action = #selector(reloadWebView) + self.callback = completion + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + @objc func reloadWebView() { + callback?() + } +} diff --git a/Box42/Toolbar/View/SideBarLeading.swift b/Box42/Toolbar/View/SideBarLeading.swift new file mode 100644 index 0000000..9849a05 --- /dev/null +++ b/Box42/Toolbar/View/SideBarLeading.swift @@ -0,0 +1,31 @@ +// +// SideBarLeading.swift +// Box42 +// +// Created by Chanhee Kim on 8/18/23. +// + +import AppKit + +class SideBarLeading: NSButton { + + private var callback: (() -> Void)? + + init(image: NSImage, completion: @escaping () -> Void) { + super.init(frame: .zero) + + self.image = image + self.bezelStyle = .texturedRounded + self.target = self + self.action = #selector(sideBarLeading) + self.callback = completion + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + @objc func sideBarLeading() { + callback?() + } +} diff --git a/Box42/UI/BackGroundView.swift b/Box42/UI/BackGroundView.swift deleted file mode 100644 index de430ed..0000000 --- a/Box42/UI/BackGroundView.swift +++ /dev/null @@ -1,40 +0,0 @@ -// -// GradientView.swift -// Box42 -// -// Created by Chanhee Kim on 8/18/23. -// - -import Cocoa - -// MARK: - BackGround Gradient -//layer caching 기법. -//레이어 캐싱: 복잡한 그래픽 연산이 필요한 뷰의 경우 wantsLayer를 true로 설정하고 shouldRasterize 속성을 true로 설정하여 렌더링 결과를 캐시할 수 있습니다. 하지만 이를 과도하게 사용하면 메모리 사용량이 증가할 수 있으므로 주의가 필요합니다. - -class BackGroundView: NSView { - override init(frame frameRect: NSRect) { - super.init(frame: frameRect) - self.setupLayerCaching() - } - - required init?(coder: NSCoder) { - super.init(coder: coder) - self.setupLayerCaching() - } - - private func setupLayerCaching() { - self.wantsLayer = true - self.layer?.shouldRasterize = true - self.layer?.rasterizationScale = self.window?.backingScaleFactor ?? 1.0 - } - - override func draw(_ dirtyRect: NSRect) { - super.draw(dirtyRect) - - let startingColor = NSColor(red: 1.0, green: 0.804, blue: 0.0, alpha: 0.9) - let endingColor = NSColor(red: 1.0, green: 0.447, blue: 0.0, alpha: 0.7) - let gradient = NSGradient(starting: startingColor, ending: endingColor) - gradient?.draw(in: self.bounds, angle: 90) - } -} - diff --git a/Box42/Window/BoxWindowController.swift b/Box42/Window/BoxWindowController.swift index caa3aca..8ce6c4c 100644 --- a/Box42/Window/BoxWindowController.swift +++ b/Box42/Window/BoxWindowController.swift @@ -7,50 +7,121 @@ import Cocoa -class BoxWindowController: NSWindowController { - var windowInstance: NSWindow! - var gradientView: NSView! - +class BoxWindowController: NSWindowController, NSToolbarDelegate { + override init(window: NSWindow?) { let contentRect = BoxSizeManager.shared.boxViewSizeNSRect - let styleMask: NSWindow.StyleMask = [.resizable] // [.titled, .closable, .miniaturizable] - windowInstance = NSWindow(contentRect: contentRect, styleMask: styleMask, backing: .buffered, defer: false) + let styleMask: NSWindow.StyleMask = [.resizable, .closable, .miniaturizable, .fullSizeContentView, .titled] + + let windowInstance = NSWindow(contentRect: contentRect, styleMask: styleMask, backing: .buffered, defer: false) + + windowInstance.titlebarAppearsTransparent = true + windowInstance.titleVisibility = .hidden windowInstance.title = "Box" - windowInstance.styleMask.insert(.resizable) windowInstance.isReleasedWhenClosed = false - windowInstance.isOpaque = false - windowInstance.isMovableByWindowBackground = true - - super.init(window: windowInstance) - windowInstance.isOpaque = false windowInstance.backgroundColor = .clear + windowInstance.isMovableByWindowBackground = true - gradientView = BackGroundView(frame: contentRect) - let boxViewController = BoxViewController(nibName: nil, bundle: nil) windowInstance.contentViewController = boxViewController - windowInstance.contentView?.addSubview(gradientView, positioned: .below, relativeTo: nil) - gradientView.translatesAutoresizingMaskIntoConstraints = false - gradientViewAutoLayout() + + super.init(window: windowInstance) + + setupToolbar() } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } - override func windowDidLoad() { - super.windowDidLoad() + // MARK: - Toolbar + + func setupToolbar() { + let toolbar = NSToolbar(identifier: "MainToolbar") + toolbar.delegate = self + toolbar.displayMode = .iconOnly + toolbar.sizeMode = .small + self.window?.toolbar = toolbar + } + + func toolbarDefaultItemIdentifiers(_ toolbar: NSToolbar) -> [NSToolbarItem.Identifier] { + return [.group] } - func gradientViewAutoLayout() { - if let contentView = windowInstance.contentView { - NSLayoutConstraint.activate([ - gradientView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor), - gradientView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor), - gradientView.topAnchor.constraint(equalTo: contentView.topAnchor), - gradientView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor) - ]) + func toolbarAllowedItemIdentifiers(_ toolbar: NSToolbar) -> [NSToolbarItem.Identifier] { + return [.group, .flexibleSpace, .sidebar, .flexibleSpace, .goBack, .flexibleSpace, .goFoward, .flexibleSpace, .reloadPage, .flexibleSpace, .goToHome] + } + + func toolbar(_ toolbar: NSToolbar, itemForItemIdentifier itemIdentifier: NSToolbarItem.Identifier, willBeInsertedIntoToolbar flag: Bool) -> NSToolbarItem? { + switch itemIdentifier { + case .group: + let groupItem = NSToolbarItemGroup(itemIdentifier: .group) + + let sidebarItem = NSToolbarItem(itemIdentifier: .sidebar) + sidebarItem.label = "Sidebar" + sidebarItem.image = NSImage(named: NSImage.Name("sidebar.leading")) + sidebarItem.action = #selector(toggleSidebar) + sidebarItem.minSize = NSSize(width: 40, height: 40) + sidebarItem.maxSize = NSSize(width: 40, height: 40) + + let goBack = NSToolbarItem(itemIdentifier: .goBack) + goBack.label = "left" + goBack.image = NSImage(named: NSImage.Name("arrow.left")) // 이미지 설정 + goBack.action = #selector(goBackAction) // 해당 action 설정 + + let goFoward = NSToolbarItem(itemIdentifier: .goFoward) + goFoward.label = "right" + goFoward.image = NSImage(named: NSImage.Name("arrow.right")) + goFoward.action = #selector(goFowardAction) + + let reloadPage = NSToolbarItem(itemIdentifier: .reloadPage) + reloadPage.label = "clockwise" + reloadPage.image = NSImage(named: NSImage.Name("arrow.clockwise")) + reloadPage.action = #selector(reloadPageAction) + + let goToHome = NSToolbarItem(itemIdentifier: .goToHome) + goToHome.label = "skating" + goToHome.image = NSImage(named: NSImage.Name("figure.skating")) + goToHome.action = #selector(goToHomeAction) + + groupItem.subitems = [sidebarItem, goBack, goFoward, reloadPage, goToHome] + + return groupItem + + default: + return nil } } + + @objc func toggleSidebar() { + print("sidebar") + } + + @objc func goBackAction() { + WebViewList.shared.hostingWebView?.goBack() + } + + @objc func goFowardAction() { + WebViewList.shared.hostingWebView?.goForward() + } + + @objc func reloadPageAction() { + WebViewList.shared.hostingWebView?.reload() + } + + @objc func goToHomeAction() { + if let item = WebViewList.shared.hostingWebView?.backForwardList.backList.first { + WebViewList.shared.hostingWebView?.go(to: item) + } + } +} + +extension NSToolbarItem.Identifier { + static let sidebar = NSToolbarItem.Identifier(rawValue: "SidebarButton") + static let goBack = NSToolbarItem.Identifier(rawValue: "goBackButton") + static let goFoward = NSToolbarItem.Identifier(rawValue: "goFowardButton") + static let reloadPage = NSToolbarItem.Identifier(rawValue: "reloadPageButton") + static let goToHome = NSToolbarItem.Identifier(rawValue: "goToHomeButton") + static let group = NSToolbarItem.Identifier(rawValue: "ItemGroup") } From fcbb4f695ac14e4bc3bc14e359231339bc6ded39 Mon Sep 17 00:00:00 2001 From: chanhihi Date: Sat, 19 Aug 2023 04:21:06 +0900 Subject: [PATCH 10/19] =?UTF-8?q?fix(webview):=20=EB=B3=B5=EC=82=AC=20?= =?UTF-8?q?=EB=B6=99=EC=97=AC=EB=84=A3=EA=B8=B0=20edit=20menu=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Box42/Resources/Main.storyboard | 319 ++++++++++++++++++++++++++ Box42/WebView/WebViewController.swift | 39 +--- Box42/WebView/WebViewList.swift | 3 + 3 files changed, 333 insertions(+), 28 deletions(-) diff --git a/Box42/Resources/Main.storyboard b/Box42/Resources/Main.storyboard index 0fece80..a34efc7 100644 --- a/Box42/Resources/Main.storyboard +++ b/Box42/Resources/Main.storyboard @@ -148,6 +148,325 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Box42/WebView/WebViewController.swift b/Box42/WebView/WebViewController.swift index ac3eddb..3b73e89 100644 --- a/Box42/WebView/WebViewController.swift +++ b/Box42/WebView/WebViewController.swift @@ -44,6 +44,7 @@ class WebViewController: NSViewController { } func webViewInit() { + WebViewList.shared.hostingWebView = self.webView DispatchQueue.main.async { self.webView.load(self.URLVM.requestURL(self.URLVM.safeURL())) } @@ -59,8 +60,12 @@ class WebViewController: NSViewController { override func viewDidLoad() { super.viewDidLoad() + if let scrollView = webView.enclosingScrollView { + scrollView.verticalScroller = CustomScroller() + scrollView.horizontalScroller = CustomScroller() + } } - + func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) { print(message.name) } @@ -70,32 +75,10 @@ extension WebViewController { override func keyDown(with event: NSEvent) { print(event.keyCode) - if (event.modifierFlags.contains(.command) && event.charactersIgnoringModifiers == "c") || - (event.modifierFlags.contains(.command) && event.charactersIgnoringModifiers == "ㅊ") { - // 복사 동작 처리 - webView.evaluateJavaScript("document.execCommand('copy')") { (_, error) in - if let error = error { - print("Copy error: \(error)") - } else { - print("Copy success") - } - } - } else if (event.modifierFlags.contains(.command) && event.charactersIgnoringModifiers == "v") || - (event.modifierFlags.contains(.command) && event.charactersIgnoringModifiers == "ㅍ") { - // 붙여넣기 동작 처리 - let pasteboard = NSPasteboard.general - if let pasteString = pasteboard.string(forType: .string) { - let escapedPasteString = pasteString.escapedForJavaScript - webView.evaluateJavaScript("document.execCommand('insertText', false, '\(escapedPasteString)')") { (_, error) in - if let error = error { - print("Paste error: \(error)") - } else { - print("Paste success") - } - } - } - } else { - super.keyDown(with: event) // 기본 키 이벤트 처리 - } + // 키보드 이벤트 처리 + // if (event) { + // } else { + // super.keyDown(with: event) // 기본 키 이벤트 처리 + // } } } diff --git a/Box42/WebView/WebViewList.swift b/Box42/WebView/WebViewList.swift index e4535fc..b5dbe13 100644 --- a/Box42/WebView/WebViewList.swift +++ b/Box42/WebView/WebViewList.swift @@ -12,6 +12,9 @@ typealias WebViewMapping = [String : WKWebView] class WebViewList { static let shared = WebViewList() + var hostingname: String? + var hostingWebView: WKWebView? + var list: WebViewMapping! private init() { From 0519a4499a7c88e8a7ddb0658c81aa464fc6aa80 Mon Sep 17 00:00:00 2001 From: chanhihi Date: Mon, 21 Aug 2023 03:57:44 +0900 Subject: [PATCH 11/19] =?UTF-8?q?refactor:=20Resources=20=EC=9C=84?= =?UTF-8?q?=EC=B9=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Box42/Resources/Info.plist | 5 + Box42/Resources/Main.storyboard | 110 +++++++++--------- .../sh/brewInGoinfre.sh | 0 Box42/{Scripts => Resources}/sh/cleanCache.sh | 0 .../sh/exportMacOSInfo.sh | 0 .../sh/importMacOSInfo.sh | 0 Box42/{Scripts => Resources}/sh/keyMapping.sh | 0 .../{Scripts => Resources}/sh/nodeInstall.sh | 0 8 files changed, 60 insertions(+), 55 deletions(-) rename Box42/{Scripts => Resources}/sh/brewInGoinfre.sh (100%) rename Box42/{Scripts => Resources}/sh/cleanCache.sh (100%) rename Box42/{Scripts => Resources}/sh/exportMacOSInfo.sh (100%) rename Box42/{Scripts => Resources}/sh/importMacOSInfo.sh (100%) rename Box42/{Scripts => Resources}/sh/keyMapping.sh (100%) rename Box42/{Scripts => Resources}/sh/nodeInstall.sh (100%) diff --git a/Box42/Resources/Info.plist b/Box42/Resources/Info.plist index b61be39..1520f65 100644 --- a/Box42/Resources/Info.plist +++ b/Box42/Resources/Info.plist @@ -2,6 +2,11 @@ + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleExecutable diff --git a/Box42/Resources/Main.storyboard b/Box42/Resources/Main.storyboard index a34efc7..f542723 100644 --- a/Box42/Resources/Main.storyboard +++ b/Box42/Resources/Main.storyboard @@ -78,24 +78,36 @@ - + + + + - + + + + + + + + + + - + - + @@ -106,7 +118,7 @@ - + @@ -132,60 +144,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -248,6 +210,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Box42/Scripts/sh/brewInGoinfre.sh b/Box42/Resources/sh/brewInGoinfre.sh similarity index 100% rename from Box42/Scripts/sh/brewInGoinfre.sh rename to Box42/Resources/sh/brewInGoinfre.sh diff --git a/Box42/Scripts/sh/cleanCache.sh b/Box42/Resources/sh/cleanCache.sh similarity index 100% rename from Box42/Scripts/sh/cleanCache.sh rename to Box42/Resources/sh/cleanCache.sh diff --git a/Box42/Scripts/sh/exportMacOSInfo.sh b/Box42/Resources/sh/exportMacOSInfo.sh similarity index 100% rename from Box42/Scripts/sh/exportMacOSInfo.sh rename to Box42/Resources/sh/exportMacOSInfo.sh diff --git a/Box42/Scripts/sh/importMacOSInfo.sh b/Box42/Resources/sh/importMacOSInfo.sh similarity index 100% rename from Box42/Scripts/sh/importMacOSInfo.sh rename to Box42/Resources/sh/importMacOSInfo.sh diff --git a/Box42/Scripts/sh/keyMapping.sh b/Box42/Resources/sh/keyMapping.sh similarity index 100% rename from Box42/Scripts/sh/keyMapping.sh rename to Box42/Resources/sh/keyMapping.sh diff --git a/Box42/Scripts/sh/nodeInstall.sh b/Box42/Resources/sh/nodeInstall.sh similarity index 100% rename from Box42/Scripts/sh/nodeInstall.sh rename to Box42/Resources/sh/nodeInstall.sh From 58dde9db27c903adeda3320cb037c1f85b46c3e4 Mon Sep 17 00:00:00 2001 From: chanhihi Date: Mon, 21 Aug 2023 03:58:41 +0900 Subject: [PATCH 12/19] chore: xcode.proj --- Box42.xcodeproj/project.pbxproj | 93 ++++++++++++++----- .../xcshareddata/xcschemes/Box42.xcscheme | 78 ++++++++++++++++ 2 files changed, 147 insertions(+), 24 deletions(-) create mode 100644 Box42.xcodeproj/xcshareddata/xcschemes/Box42.xcscheme diff --git a/Box42.xcodeproj/project.pbxproj b/Box42.xcodeproj/project.pbxproj index 89f0ba3..54be299 100644 --- a/Box42.xcodeproj/project.pbxproj +++ b/Box42.xcodeproj/project.pbxproj @@ -17,11 +17,10 @@ DE018BED2A509B2600FF0AA3 /* URLModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE018BEC2A509B2600FF0AA3 /* URLModel.swift */; }; DE018BF02A509B2F00FF0AA3 /* MenubarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE018BEF2A509B2F00FF0AA3 /* MenubarViewController.swift */; }; DE018BF32A509B3300FF0AA3 /* MenubarModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE018BF22A509B3300FF0AA3 /* MenubarModel.swift */; }; - DE018BF62A509B3600FF0AA3 /* MenubarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE018BF52A509B3600FF0AA3 /* MenubarView.swift */; }; DE018C032A509B5D00FF0AA3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DE018C022A509B5D00FF0AA3 /* Main.storyboard */; }; DE0A915D2A8E348D00D1D6F1 /* SnapKit in Frameworks */ = {isa = PBXBuildFile; productRef = DE0A915C2A8E348D00D1D6F1 /* SnapKit */; }; DE0A91632A8E6A5400D1D6F1 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A91622A8E6A5400D1D6F1 /* Constants.swift */; }; - DE0A91672A8E6CA700D1D6F1 /* WebViewList.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A91662A8E6CA700D1D6F1 /* WebViewList.swift */; }; + DE0A91672A8E6CA700D1D6F1 /* WebViewManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A91662A8E6CA700D1D6F1 /* WebViewManager.swift */; }; DE0A916D2A8E7DD700D1D6F1 /* HoverButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A916C2A8E7DD700D1D6F1 /* HoverButton.swift */; }; DE0A91782A8F014F00D1D6F1 /* WebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A91772A8F014F00D1D6F1 /* WebView.swift */; }; DE0A917B2A8F0CA800D1D6F1 /* AppleScripts+ShowMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A917A2A8F0CA800D1D6F1 /* AppleScripts+ShowMessage.swift */; }; @@ -32,7 +31,6 @@ DE0A918D2A8F88BC00D1D6F1 /* GoBackInToolbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A918C2A8F88BC00D1D6F1 /* GoBackInToolbar.swift */; }; DE0A91902A8F88CA00D1D6F1 /* DisplayURLInToolbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A918F2A8F88CA00D1D6F1 /* DisplayURLInToolbar.swift */; }; DE0A91982A8F977F00D1D6F1 /* ToolbarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A91972A8F977F00D1D6F1 /* ToolbarViewController.swift */; }; - DE0A91A22A8FAC3F00D1D6F1 /* WebView+CustomScroller.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A91A12A8FAC3E00D1D6F1 /* WebView+CustomScroller.swift */; }; DE0A91A72A8FC66600D1D6F1 /* SideBarLeading.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0A91A62A8FC66600D1D6F1 /* SideBarLeading.swift */; }; DE1F1A142A8B506600A88DD8 /* importMacOSInfo.sh in Resources */ = {isa = PBXBuildFile; fileRef = DE1F1A112A8B506600A88DD8 /* importMacOSInfo.sh */; }; DE1F1A152A8B506600A88DD8 /* exportMacOSInfo.sh in Resources */ = {isa = PBXBuildFile; fileRef = DE1F1A122A8B506600A88DD8 /* exportMacOSInfo.sh */; }; @@ -40,7 +38,6 @@ DE1F1A1C2A8B50C500A88DD8 /* BoxBaseContainerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1F1A192A8B50C500A88DD8 /* BoxBaseContainerViewController.swift */; }; DE1F1A1D2A8B50C500A88DD8 /* BoxContentsViewGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1F1A1A2A8B50C500A88DD8 /* BoxContentsViewGroup.swift */; }; DE1F1A1E2A8B50C500A88DD8 /* BoxButtonViewGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1F1A1B2A8B50C500A88DD8 /* BoxButtonViewGroup.swift */; }; - DE1F1A252A8B50D500A88DD8 /* BoxViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1F1A222A8B50D500A88DD8 /* BoxViewModel.swift */; }; DE1F1A262A8B50D500A88DD8 /* BoxViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1F1A232A8B50D500A88DD8 /* BoxViewController.swift */; }; DE1F1A292A8B50E200A88DD8 /* BoxSizeManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1F1A282A8B50E200A88DD8 /* BoxSizeManager.swift */; }; DE1F1A2E2A8BCC9800A88DD8 /* Storage.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1F1A2D2A8BCC9800A88DD8 /* Storage.swift */; }; @@ -50,6 +47,14 @@ DE24E6382A8FE10400E29F5D /* BoxBaseSplitView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE24E6372A8FE10300E29F5D /* BoxBaseSplitView.swift */; }; DE24E63B2A8FE93900E29F5D /* NSImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE24E63A2A8FE93900E29F5D /* NSImage.swift */; }; DE2AD3292A824EEB00002D51 /* Accessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE2AD3282A824EEB00002D51 /* Accessibility.swift */; }; + DE4407FA2A923E860091937A /* BoxFunctionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE4407F92A923E860091937A /* BoxFunctionViewController.swift */; }; + DE4407FE2A923EA90091937A /* PreferenceButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE4407FD2A923EA90091937A /* PreferenceButtonView.swift */; }; + DE4408022A923EB60091937A /* PinButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE4408012A923EB60091937A /* PinButtonView.swift */; }; + DE4408052A923EC00091937A /* QuitButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE4408042A923EC00091937A /* QuitButtonView.swift */; }; + DE4408082A9240300091937A /* BoxFunctionButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE4408072A9240300091937A /* BoxFunctionButtonView.swift */; }; + DE44080C2A924B520091937A /* BoxFunctionViewGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE44080B2A924B520091937A /* BoxFunctionViewGroup.swift */; }; + DE4408152A92750D0091937A /* keyDown+BoxViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE4408142A92750D0091937A /* keyDown+BoxViewController.swift */; }; + DE44081D2A928F760091937A /* TopDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE44081C2A928F760091937A /* TopDivider.swift */; }; DE77BA512A82580400713683 /* MenubarViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE77BA502A82580400713683 /* MenubarViewModel.swift */; }; DE77BA562A82637900713683 /* StateManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE77BA552A82637900713683 /* StateManager.swift */; }; DE7A257A2A6D8CA20043225A /* PreferencesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE7A25792A6D8CA20043225A /* PreferencesViewController.swift */; }; @@ -77,30 +82,27 @@ DE018BEC2A509B2600FF0AA3 /* URLModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = URLModel.swift; sourceTree = ""; }; DE018BEF2A509B2F00FF0AA3 /* MenubarViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenubarViewController.swift; sourceTree = ""; }; DE018BF22A509B3300FF0AA3 /* MenubarModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenubarModel.swift; sourceTree = ""; }; - DE018BF52A509B3600FF0AA3 /* MenubarView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenubarView.swift; sourceTree = ""; }; DE018C022A509B5D00FF0AA3 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; DE018C192A509DBA00FF0AA3 /* Box42.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Box42.entitlements; sourceTree = ""; }; DE0A91622A8E6A5400D1D6F1 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; - DE0A91662A8E6CA700D1D6F1 /* WebViewList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewList.swift; sourceTree = ""; }; + DE0A91662A8E6CA700D1D6F1 /* WebViewManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewManager.swift; sourceTree = ""; }; DE0A916C2A8E7DD700D1D6F1 /* HoverButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HoverButton.swift; sourceTree = ""; }; DE0A91772A8F014F00D1D6F1 /* WebView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebView.swift; sourceTree = ""; }; DE0A917A2A8F0CA800D1D6F1 /* AppleScripts+ShowMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AppleScripts+ShowMessage.swift"; sourceTree = ""; }; - DE0A917E2A8F865400D1D6F1 /* BoxToolbarViewGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = BoxToolbarViewGroup.swift; path = Box/BoxToolbarViewGroup.swift; sourceTree = ""; }; + DE0A917E2A8F865400D1D6F1 /* BoxToolbarViewGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoxToolbarViewGroup.swift; sourceTree = ""; }; DE0A91822A8F889000D1D6F1 /* GoHomePageViaToolbar().swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GoHomePageViaToolbar().swift"; sourceTree = ""; }; DE0A91852A8F889F00D1D6F1 /* RefreshPageViaToolbar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RefreshPageViaToolbar.swift; sourceTree = ""; }; DE0A91892A8F88A900D1D6F1 /* GoForwardInToolbar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoForwardInToolbar.swift; sourceTree = ""; }; DE0A918C2A8F88BC00D1D6F1 /* GoBackInToolbar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoBackInToolbar.swift; sourceTree = ""; }; DE0A918F2A8F88CA00D1D6F1 /* DisplayURLInToolbar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayURLInToolbar.swift; sourceTree = ""; }; DE0A91972A8F977F00D1D6F1 /* ToolbarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToolbarViewController.swift; sourceTree = ""; }; - DE0A91A12A8FAC3E00D1D6F1 /* WebView+CustomScroller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WebView+CustomScroller.swift"; sourceTree = ""; }; DE0A91A62A8FC66600D1D6F1 /* SideBarLeading.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SideBarLeading.swift; sourceTree = ""; }; DE1F1A112A8B506600A88DD8 /* importMacOSInfo.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = importMacOSInfo.sh; sourceTree = ""; }; DE1F1A122A8B506600A88DD8 /* exportMacOSInfo.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = exportMacOSInfo.sh; sourceTree = ""; }; DE1F1A132A8B506600A88DD8 /* keyMapping.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = keyMapping.sh; sourceTree = ""; }; DE1F1A192A8B50C500A88DD8 /* BoxBaseContainerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = BoxBaseContainerViewController.swift; path = Box/BoxBaseContainerViewController.swift; sourceTree = ""; }; - DE1F1A1A2A8B50C500A88DD8 /* BoxContentsViewGroup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = BoxContentsViewGroup.swift; path = Box/BoxContentsViewGroup.swift; sourceTree = ""; }; - DE1F1A1B2A8B50C500A88DD8 /* BoxButtonViewGroup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = BoxButtonViewGroup.swift; path = Box/BoxButtonViewGroup.swift; sourceTree = ""; }; - DE1F1A222A8B50D500A88DD8 /* BoxViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = BoxViewModel.swift; path = Main/BoxViewModel.swift; sourceTree = ""; }; + DE1F1A1A2A8B50C500A88DD8 /* BoxContentsViewGroup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoxContentsViewGroup.swift; sourceTree = ""; }; + DE1F1A1B2A8B50C500A88DD8 /* BoxButtonViewGroup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoxButtonViewGroup.swift; sourceTree = ""; }; DE1F1A232A8B50D500A88DD8 /* BoxViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = BoxViewController.swift; path = Main/BoxViewController.swift; sourceTree = ""; }; DE1F1A282A8B50E200A88DD8 /* BoxSizeManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoxSizeManager.swift; sourceTree = ""; }; DE1F1A2D2A8BCC9800A88DD8 /* Storage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Storage.swift; sourceTree = ""; }; @@ -110,6 +112,14 @@ DE24E6372A8FE10300E29F5D /* BoxBaseSplitView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoxBaseSplitView.swift; sourceTree = ""; }; DE24E63A2A8FE93900E29F5D /* NSImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSImage.swift; sourceTree = ""; }; DE2AD3282A824EEB00002D51 /* Accessibility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Accessibility.swift; sourceTree = ""; }; + DE4407F92A923E860091937A /* BoxFunctionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoxFunctionViewController.swift; sourceTree = ""; }; + DE4407FD2A923EA90091937A /* PreferenceButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferenceButtonView.swift; sourceTree = ""; }; + DE4408012A923EB60091937A /* PinButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PinButtonView.swift; sourceTree = ""; }; + DE4408042A923EC00091937A /* QuitButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuitButtonView.swift; sourceTree = ""; }; + DE4408072A9240300091937A /* BoxFunctionButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoxFunctionButtonView.swift; sourceTree = ""; }; + DE44080B2A924B520091937A /* BoxFunctionViewGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoxFunctionViewGroup.swift; sourceTree = ""; }; + DE4408142A92750D0091937A /* keyDown+BoxViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "keyDown+BoxViewController.swift"; path = "Main/keyDown+BoxViewController.swift"; sourceTree = ""; }; + DE44081C2A928F760091937A /* TopDivider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TopDivider.swift; sourceTree = ""; }; DE77BA502A82580400713683 /* MenubarViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenubarViewModel.swift; sourceTree = ""; }; DE77BA552A82637900713683 /* StateManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StateManager.swift; sourceTree = ""; }; DE7A25792A6D8CA20043225A /* PreferencesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreferencesViewController.swift; sourceTree = ""; }; @@ -168,6 +178,7 @@ DE018C062A509B9000FF0AA3 /* System */, DE018C082A509BB500FF0AA3 /* WebView */, DE0A917D2A8F864300D1D6F1 /* Toolbar */, + DE4407F82A923E5B0091937A /* FunctionButton */, DE1F1A182A8B50BB00A88DD8 /* Box */, DE018C0E2A509C0C00FF0AA3 /* Menubar */, ); @@ -189,9 +200,9 @@ isa = PBXGroup; children = ( DE018C0B2A509BC100FF0AA3 /* URL */, + DE0A91662A8E6CA700D1D6F1 /* WebViewManager.swift */, DE018BE92A509B2100FF0AA3 /* WebViewModel.swift */, DE018BE62A509B1E00FF0AA3 /* WebViewController.swift */, - DE0A91662A8E6CA700D1D6F1 /* WebViewList.swift */, DE0A91772A8F014F00D1D6F1 /* WebView.swift */, ); path = WebView; @@ -208,6 +219,7 @@ DE018C0C2A509BDF00FF0AA3 /* Resources */ = { isa = PBXGroup; children = ( + DEB862DE2A85348600278FCD /* sh */, DE018C192A509DBA00FF0AA3 /* Box42.entitlements */, DE018BB22A5099F900FF0AA3 /* AppDelegate.swift */, DE018BDF2A509B0600FF0AA3 /* Assets.xcassets */, @@ -223,7 +235,6 @@ children = ( DE018BEF2A509B2F00FF0AA3 /* MenubarViewController.swift */, DE018BF22A509B3300FF0AA3 /* MenubarModel.swift */, - DE018BF52A509B3600FF0AA3 /* MenubarView.swift */, DE77BA502A82580400713683 /* MenubarViewModel.swift */, ); path = Menubar; @@ -233,7 +244,6 @@ isa = PBXGroup; children = ( DE0A916C2A8E7DD700D1D6F1 /* HoverButton.swift */, - DE0A91A12A8FAC3E00D1D6F1 /* WebView+CustomScroller.swift */, DE24E6342A8FE02A00E29F5D /* MovableContainerView.swift */, ); path = UI; @@ -257,6 +267,7 @@ DE0A918C2A8F88BC00D1D6F1 /* GoBackInToolbar.swift */, DE0A91892A8F88A900D1D6F1 /* GoForwardInToolbar.swift */, DE0A91852A8F889F00D1D6F1 /* RefreshPageViaToolbar.swift */, + DE0A917E2A8F865400D1D6F1 /* BoxToolbarViewGroup.swift */, ); path = View; sourceTree = ""; @@ -271,11 +282,8 @@ DE1F1A182A8B50BB00A88DD8 /* Box */ = { isa = PBXGroup; children = ( - DE0A917E2A8F865400D1D6F1 /* BoxToolbarViewGroup.swift */, + DE4408202A9297EE0091937A /* View */, DE1F1A192A8B50C500A88DD8 /* BoxBaseContainerViewController.swift */, - DE1F1A1B2A8B50C500A88DD8 /* BoxButtonViewGroup.swift */, - DE1F1A1A2A8B50C500A88DD8 /* BoxContentsViewGroup.swift */, - DE24E6372A8FE10300E29F5D /* BoxBaseSplitView.swift */, ); name = Box; sourceTree = ""; @@ -284,11 +292,44 @@ isa = PBXGroup; children = ( DE1F1A232A8B50D500A88DD8 /* BoxViewController.swift */, - DE1F1A222A8B50D500A88DD8 /* BoxViewModel.swift */, + DE4408142A92750D0091937A /* keyDown+BoxViewController.swift */, ); name = Main; sourceTree = ""; }; + DE4407F82A923E5B0091937A /* FunctionButton */ = { + isa = PBXGroup; + children = ( + DE4407FC2A923E920091937A /* View */, + DE4407F92A923E860091937A /* BoxFunctionViewController.swift */, + ); + path = FunctionButton; + sourceTree = ""; + }; + DE4407FC2A923E920091937A /* View */ = { + isa = PBXGroup; + children = ( + DE44081C2A928F760091937A /* TopDivider.swift */, + DE4407FD2A923EA90091937A /* PreferenceButtonView.swift */, + DE4408012A923EB60091937A /* PinButtonView.swift */, + DE4408042A923EC00091937A /* QuitButtonView.swift */, + DE4408072A9240300091937A /* BoxFunctionButtonView.swift */, + DE44080B2A924B520091937A /* BoxFunctionViewGroup.swift */, + ); + path = View; + sourceTree = ""; + }; + DE4408202A9297EE0091937A /* View */ = { + isa = PBXGroup; + children = ( + DE1F1A1B2A8B50C500A88DD8 /* BoxButtonViewGroup.swift */, + DE1F1A1A2A8B50C500A88DD8 /* BoxContentsViewGroup.swift */, + DE24E6372A8FE10300E29F5D /* BoxBaseSplitView.swift */, + ); + name = View; + path = Box/View; + sourceTree = ""; + }; DE77BA542A82636500713683 /* Shared */ = { isa = PBXGroup; children = ( @@ -314,7 +355,6 @@ DEB862D22A8511D600278FCD /* Scripts */ = { isa = PBXGroup; children = ( - DEB862DE2A85348600278FCD /* sh */, DEB862DB2A85347400278FCD /* Scripts.swift */, DE0A917A2A8F0CA800D1D6F1 /* AppleScripts+ShowMessage.swift */, ); @@ -439,19 +479,21 @@ DE018BB82A5099F900FF0AA3 /* Box42.xcdatamodeld in Sources */, DE874F542A591F1400FC3B77 /* PreferencesView.swift in Sources */, DE0A91982A8F977F00D1D6F1 /* ToolbarViewController.swift in Sources */, + DE4408082A9240300091937A /* BoxFunctionButtonView.swift in Sources */, DE77BA562A82637900713683 /* StateManager.swift in Sources */, DE1F1A1C2A8B50C500A88DD8 /* BoxBaseContainerViewController.swift in Sources */, - DE018BF62A509B3600FF0AA3 /* MenubarView.swift in Sources */, DE018BE72A509B1E00FF0AA3 /* WebViewController.swift in Sources */, + DE4407FA2A923E860091937A /* BoxFunctionViewController.swift in Sources */, + DE4407FE2A923EA90091937A /* PreferenceButtonView.swift in Sources */, DEF749322A85657600D987C8 /* NSScreen.swift in Sources */, DE018BF02A509B2F00FF0AA3 /* MenubarViewController.swift in Sources */, DE77BA512A82580400713683 /* MenubarViewModel.swift in Sources */, + DE44080C2A924B520091937A /* BoxFunctionViewGroup.swift in Sources */, DE018BE42A509B1700FF0AA3 /* CPU.swift in Sources */, DE874F5F2A5935CC00FC3B77 /* String.swift in Sources */, DE0A91862A8F889F00D1D6F1 /* RefreshPageViaToolbar.swift in Sources */, DE874F4E2A591DEA00FC3B77 /* Hotkey.swift in Sources */, DE0A91832A8F889000D1D6F1 /* GoHomePageViaToolbar().swift in Sources */, - DE1F1A252A8B50D500A88DD8 /* BoxViewModel.swift in Sources */, DE018BB32A5099F900FF0AA3 /* AppDelegate.swift in Sources */, DE0A91632A8E6A5400D1D6F1 /* Constants.swift in Sources */, DE0A91902A8F88CA00D1D6F1 /* DisplayURLInToolbar.swift in Sources */, @@ -459,8 +501,11 @@ DE7A257A2A6D8CA20043225A /* PreferencesViewController.swift in Sources */, DE24E63B2A8FE93900E29F5D /* NSImage.swift in Sources */, DE0A916D2A8E7DD700D1D6F1 /* HoverButton.swift in Sources */, - DE0A91672A8E6CA700D1D6F1 /* WebViewList.swift in Sources */, + DE4408022A923EB60091937A /* PinButtonView.swift in Sources */, + DE0A91672A8E6CA700D1D6F1 /* WebViewManager.swift in Sources */, + DE4408152A92750D0091937A /* keyDown+BoxViewController.swift in Sources */, DE018BED2A509B2600FF0AA3 /* URLModel.swift in Sources */, + DE4408052A923EC00091937A /* QuitButtonView.swift in Sources */, DE0A918A2A8F88A900D1D6F1 /* GoForwardInToolbar.swift in Sources */, DE1F1A1E2A8B50C500A88DD8 /* BoxButtonViewGroup.swift in Sources */, DEB862EB2A853F7F00278FCD /* BoxWindowController.swift in Sources */, @@ -473,9 +518,9 @@ DE1F1A362A8BDDDF00A88DD8 /* StorageConfig.swift in Sources */, DE2AD3292A824EEB00002D51 /* Accessibility.swift in Sources */, DE24E6382A8FE10400E29F5D /* BoxBaseSplitView.swift in Sources */, + DE44081D2A928F760091937A /* TopDivider.swift in Sources */, DE874F572A591F2500FC3B77 /* Icon.swift in Sources */, DE1F1A2E2A8BCC9800A88DD8 /* Storage.swift in Sources */, - DE0A91A22A8FAC3F00D1D6F1 /* WebView+CustomScroller.swift in Sources */, DE0A91782A8F014F00D1D6F1 /* WebView.swift in Sources */, DE1F1A312A8BD68F00A88DD8 /* Double.swift in Sources */, DE0A917F2A8F865400D1D6F1 /* BoxToolbarViewGroup.swift in Sources */, diff --git a/Box42.xcodeproj/xcshareddata/xcschemes/Box42.xcscheme b/Box42.xcodeproj/xcshareddata/xcschemes/Box42.xcscheme new file mode 100644 index 0000000..d8294f7 --- /dev/null +++ b/Box42.xcodeproj/xcshareddata/xcschemes/Box42.xcscheme @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 8cf0e3be12ce94d26475753a4d5aca06c8ec38d6 Mon Sep 17 00:00:00 2001 From: chanhihi Date: Mon, 21 Aug 2023 03:59:54 +0900 Subject: [PATCH 13/19] =?UTF-8?q?feat:=20split=20view=EB=A5=BC=20=ED=99=9C?= =?UTF-8?q?=EC=9A=A9=ED=95=B4=EC=84=9C=20button=EA=B3=BC=20contents?= =?UTF-8?q?=EB=A5=BC=20=EA=B5=AC=EB=B6=84=ED=95=A9=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Box/BoxBaseContainerViewController.swift | 62 +++++++++++++------ Box42/{ => Box/View}/BoxBaseSplitView.swift | 4 +- Box42/Shared/BoxSizeManager.swift | 2 + 3 files changed, 45 insertions(+), 23 deletions(-) rename Box42/{ => Box/View}/BoxBaseSplitView.swift (88%) diff --git a/Box42/Box/BoxBaseContainerViewController.swift b/Box42/Box/BoxBaseContainerViewController.swift index 6aaa7de..538078f 100644 --- a/Box42/Box/BoxBaseContainerViewController.swift +++ b/Box42/Box/BoxBaseContainerViewController.swift @@ -12,9 +12,10 @@ class BoxBaseContainerViewController: NSViewController { var splitView: BoxBaseSplitView! = BoxBaseSplitView() var contentGroup: BoxContentsViewGroup! = BoxContentsViewGroup() var toolbarGroup: BoxToolbarViewGroup! = BoxToolbarViewGroup() + var functionGroupVC: BoxFunctionViewController! = BoxFunctionViewController() var buttonGroup: BoxButtonViewGroup! var leftContainer: MovableContainerView! - + override func loadView() { self.view = NSView() self.view.addSubview(splitView) @@ -35,17 +36,13 @@ class BoxBaseContainerViewController: NSViewController { func clickBtn(sender: NSButton) { guard let clickCount = NSApp.currentEvent?.clickCount else { return } - if sender.title == "Preferences" { - contentGroup.removeAllSubviews() - contentGroup.showPreferences() - return - } if clickCount == 2 { - WebViewList.shared.list[sender.title]!.reload() + WebViewManager.shared.list[sender.title]!.reload() print("Dobule Click") } else if clickCount > 2 { - // let rqURL = URLRequest(url: boxVM.URLdict[sender.title]!) - // WebViewList.shared.list[sender.title]!.load(rqURL) + if let currentURL = WebViewManager.shared.hostingWebView?.url { + NSWorkspace.shared.open(currentURL) + } print("Triple Click") } else if clickCount < 2 { contentGroup.removeAllSubviews() @@ -57,6 +54,29 @@ class BoxBaseContainerViewController: NSViewController { leftContainer = MovableContainerView() leftContainer.addSubview(buttonGroup) leftContainer.addSubview(toolbarGroup) + leftContainer.addSubview(functionGroupVC.view) + leftContainerAutolayout() + leftContainer.frame.size.width = BoxSizeManager.shared.windowButtonGroupSize.width + } + + private func leftContainerAutolayout() { + toolbarGroup.snp.makeConstraints { make in + make.top.equalTo(leftContainer).offset(Constants.UI.GroupAutolayout) + make.right.equalTo(leftContainer).offset(-Constants.UI.GroupAutolayout) + make.left.equalTo(leftContainer) + } + + buttonGroup.snp.makeConstraints { make in + make.top.equalTo(toolbarGroup.snp.bottom).offset(Constants.UI.GroupAutolayout) + make.right.equalTo(leftContainer).offset(-Constants.UI.GroupAutolayout) + make.left.equalTo(leftContainer) + } + + functionGroupVC.view.snp.makeConstraints { make in + make.top.equalTo(buttonGroup.snp.bottom).offset(Constants.UI.GroupAutolayout) + make.right.equalTo(leftContainer).offset(-Constants.UI.GroupAutolayout) + make.left.bottom.equalTo(leftContainer) + } } func viewInit() { @@ -68,19 +88,9 @@ class BoxBaseContainerViewController: NSViewController { splitView.snp.makeConstraints { make in make.top.equalTo(self.view).offset(Constants.UI.GroupAutolayout) - make.bottom.equalTo(self.view).offset(-Constants.UI.GroupAutolayout) make.left.equalTo(self.view).offset(Constants.UI.GroupAutolayout) make.right.equalTo(self.view).offset(-Constants.UI.GroupAutolayout) - } - - toolbarGroup.snp.makeConstraints { make in - make.top.equalTo(leftContainer).offset(Constants.UI.GroupAutolayout) - make.left.right.equalTo(leftContainer) - } - - buttonGroup.snp.makeConstraints { make in - make.top.equalTo(toolbarGroup.snp.bottom).offset(Constants.UI.GroupAutolayout) - make.left.right.bottom.equalTo(leftContainer) + make.bottom.equalTo(self.view).offset(-Constants.UI.GroupAutolayout) } } @@ -92,6 +102,7 @@ class BoxBaseContainerViewController: NSViewController { extension BoxBaseContainerViewController: NSSplitViewDelegate { func splitView(_ splitView: NSSplitView, constrainMinCoordinate proposedMinimumPosition: CGFloat, ofSubviewAt dividerIndex: Int) -> CGFloat { + if dividerIndex == 0 { return 132 } @@ -104,4 +115,15 @@ extension BoxBaseContainerViewController: NSSplitViewDelegate { } return proposedMaximumPosition } + + func splitView(_ splitView: NSSplitView, resizeSubviewsWithOldSize oldSize: NSSize) { + let dividerThickness = splitView.dividerThickness + let newWidth = splitView.frame.width - dividerThickness + + let leftWidth = leftContainer.frame.width + let contentWidth = newWidth - leftWidth + + leftContainer.frame = NSRect(x: 0, y: 0, width: leftWidth, height: splitView.bounds.height) + contentGroup.frame = NSRect(x: leftWidth + dividerThickness, y: 0, width: contentWidth, height: splitView.bounds.height) + } } diff --git a/Box42/BoxBaseSplitView.swift b/Box42/Box/View/BoxBaseSplitView.swift similarity index 88% rename from Box42/BoxBaseSplitView.swift rename to Box42/Box/View/BoxBaseSplitView.swift index d432a99..3def6e3 100644 --- a/Box42/BoxBaseSplitView.swift +++ b/Box42/Box/View/BoxBaseSplitView.swift @@ -10,10 +10,8 @@ import AppKit class BoxBaseSplitView: NSSplitView { init() { super.init(frame: .zero) - self.isVertical = true - self.dividerStyle = .thin - + self.dividerStyle = .thick } required init?(coder: NSCoder) { diff --git a/Box42/Shared/BoxSizeManager.swift b/Box42/Shared/BoxSizeManager.swift index 3fe2aac..acd32f4 100644 --- a/Box42/Shared/BoxSizeManager.swift +++ b/Box42/Shared/BoxSizeManager.swift @@ -18,6 +18,7 @@ struct BoxSizeManager { var boxViewSizeNSRect: NSRect var boxViewSizeNSSize: NSSize var buttonGroupSizeNSRect: NSRect + var windowButtonGroupSize: (width: CGFloat, height: CGFloat)! init() { halfSize = (NSScreen.halfOfScreen.x, NSScreen.halfOfScreen.y) @@ -28,5 +29,6 @@ struct BoxSizeManager { boxViewSizeNSRect = NSRect(x: 0, y: 0, width: size.width, height: size.height) boxViewSizeNSSize = NSSize(width: size.width, height: size.height) buttonGroupSizeNSRect = NSRect(x: 0, y: 0, width: buttonGroupSize.width, height: buttonGroupSize.height) + windowButtonGroupSize = (CGFloat(200), NSScreen.customScreenSize.y) } } From b04de9e6158d418c4a18f10726e58f4972eb636f Mon Sep 17 00:00:00 2001 From: chanhihi Date: Mon, 21 Aug 2023 04:01:21 +0900 Subject: [PATCH 14/19] =?UTF-8?q?chore(=F0=9F=9A=9A):=20=EA=B2=BD=EB=A1=9C?= =?UTF-8?q?=EB=A5=BC=20=EB=B3=80=EA=B2=BD=ED=95=A9=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Box42/Box/BoxButtonViewGroup.swift | 181 ------------------ Box42/Box/BoxToolbarViewGroup.swift | 31 --- Box42/Box/View/BoxButtonViewGroup.swift | 92 +++++++++ .../Box/{ => View}/BoxContentsViewGroup.swift | 7 +- Box42/Main/BoxViewModel.swift | 14 -- Box42/Menubar/MenubarView.swift | 13 -- Box42/UI/GradientView.swift | 37 ---- Box42/WebView/WebViewList.swift | 23 --- 8 files changed, 95 insertions(+), 303 deletions(-) delete mode 100644 Box42/Box/BoxButtonViewGroup.swift delete mode 100644 Box42/Box/BoxToolbarViewGroup.swift create mode 100644 Box42/Box/View/BoxButtonViewGroup.swift rename Box42/Box/{ => View}/BoxContentsViewGroup.swift (90%) delete mode 100644 Box42/Main/BoxViewModel.swift delete mode 100644 Box42/Menubar/MenubarView.swift delete mode 100644 Box42/UI/GradientView.swift delete mode 100644 Box42/WebView/WebViewList.swift diff --git a/Box42/Box/BoxButtonViewGroup.swift b/Box42/Box/BoxButtonViewGroup.swift deleted file mode 100644 index 0160c5b..0000000 --- a/Box42/Box/BoxButtonViewGroup.swift +++ /dev/null @@ -1,181 +0,0 @@ -// -// BoxButtonView.swift -// Box42 -// -// Created by Chanhee Kim on 8/11/23. -// - -import Cocoa -import SnapKit - -class BoxButtonViewGroup: NSView { - var boxVM: WebViewModel! = WebViewModel() - var divider : NSBox = NSBox() - var pinSwitch : NSSwitch = NSSwitch() - var clickAction: ((NSButton) -> Void)? - var lastAddedButton: NSView? - var loginInfo: NSView? - - init(clickAction: @escaping (NSButton) -> Void) { - self.clickAction = clickAction - super.init(frame: BoxSizeManager.shared.buttonGroupSizeNSRect) - setupButtons() - divide() - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override func draw(_ dirtyRect: NSRect) { - // 뷰의 커스텀 렌더링에 사용됨. - } - - private func setupButtons() { - for subview in self.subviews { - subview.removeFromSuperview() - } - - for (name, _) in boxVM.webViewURL.URLstring { - self.createButton(name) - } - createLoginInfo() - preferencesButton() - createQuitButton() - createPinButton() - } - - func createLoginInfo() { - - } - - @objc private func clickBtn(sender: NSButton) { - clickAction?(sender) - } - - private func createButton(_ title: String) { - let button: NSButton - - if title == "home" { - button = NSButton(title: "home", image: NSImage(imageLiteralResourceName: "42box_logo"), target: self, action: #selector(clickBtn(sender:))) - button.imagePosition = .imageOnly - button.isBordered = false - } else { - button = HoverButton() - button.title = title - - button.wantsLayer = true - button.contentTintColor = NSColor.black - button.layer?.borderColor = NSColor.black.cgColor - button.layer?.borderWidth = 1.0 - button.layer?.cornerRadius = 5.0 - button.layer?.opacity = 0.7 - } - super.addSubview(button) - - button.target = self - button.action = #selector(clickBtn(sender:)) - - let fontSize: CGFloat = 16.0 - button.font = NSFont.systemFont(ofSize: fontSize) - button.setButtonType(.momentaryLight) - button.translatesAutoresizingMaskIntoConstraints = false - - button.snp.makeConstraints { make in - make.centerX.equalToSuperview() - make.leading.equalToSuperview().offset(10) - make.trailing.equalToSuperview().offset(-10) - - if title == "home" { - make.height.equalTo(50) - } else { - make.height.equalTo(50) - } - - if let lastButton = lastAddedButton { - make.top.equalTo(lastButton.snp.bottom).offset(10) - } else { - make.top.equalToSuperview().offset(10) - } - } - - lastAddedButton = button - } - - func createQuitButton() { - let button = NSButton() - button.title = "Quit Box" - button.setButtonType(.momentaryLight) - - button.translatesAutoresizingMaskIntoConstraints = false - button.action = #selector(NSApplication.terminate(_:)) - button.isBordered = true - button.bezelStyle = .roundRect - button.showsBorderOnlyWhileMouseInside = true - - self.addSubview(button) - - button.snp.makeConstraints { make in - make.leading.equalToSuperview().offset(20) - make.trailing.equalToSuperview().offset(-20) - make.bottom.equalToSuperview() - } - - lastAddedButton = button // 이 부분 추가 - } - - func createPinButton() { - let button = NSButton() - button.title = "Pin Box" - button.setButtonType(.toggle) - button.contentTintColor = .orange - button.translatesAutoresizingMaskIntoConstraints = false - - button.target = self - button.action = #selector(clickBtn(sender:)) - - button.isBordered = true - button.bezelStyle = .roundRect - button.showsBorderOnlyWhileMouseInside = true - - self.addSubview(button) - - button.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: 20).isActive = true - button.bottomAnchor.constraint(equalTo: self.bottomAnchor, constant: -50).isActive = true - button.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: -20).isActive = true - } - - func preferencesButton() { - let button = NSButton() - button.title = "Preferences" - button.setButtonType(.momentaryLight) - - button.translatesAutoresizingMaskIntoConstraints = false - - button.target = self - button.action = #selector(clickBtn(sender:)) - - button.isBordered = true - button.bezelStyle = .roundRect - button.showsBorderOnlyWhileMouseInside = true - - self.addSubview(button) - - button.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: 20).isActive = true - button.bottomAnchor.constraint(equalTo: self.bottomAnchor, constant: -90).isActive = true - button.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: -20).isActive = true - } - - func divide() { - divider.boxType = .separator - divider.translatesAutoresizingMaskIntoConstraints = false - self.addSubview(divider) - NSLayoutConstraint.activate([ - divider.leadingAnchor.constraint(equalTo: self.leadingAnchor), - divider.trailingAnchor.constraint(equalTo: self.trailingAnchor), - divider.bottomAnchor.constraint(equalTo: self.bottomAnchor, constant: -40), - divider.heightAnchor.constraint(equalToConstant: 1) - ]) - } - -} diff --git a/Box42/Box/BoxToolbarViewGroup.swift b/Box42/Box/BoxToolbarViewGroup.swift deleted file mode 100644 index ac17e8c..0000000 --- a/Box42/Box/BoxToolbarViewGroup.swift +++ /dev/null @@ -1,31 +0,0 @@ -// -// BoxToolbarViewGroup.swift -// Box42 -// -// Created by Chanhee Kim on 8/18/23. -// - -import AppKit -import SnapKit - -class BoxToolbarViewGroup: NSView { - var toolbarVC: ToolbarViewController? - - init() { -// toolbarVC = ToolbarViewController(nibName: nil, bundle: nil) - - super.init(frame: NSRect(x: 0, y: 0, width: BoxSizeManager.shared.size.width - BoxSizeManager.shared.toolbarGroupSize.width, height: BoxSizeManager.shared.toolbarGroupSize.height)) - - self.wantsLayer = true -// self.addSubview(toolbarVC!.view) - - toolbarVC?.view.translatesAutoresizingMaskIntoConstraints = false - toolbarVC?.view.snp.makeConstraints { make in - make.edges.equalTo(self) - } - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } -} diff --git a/Box42/Box/View/BoxButtonViewGroup.swift b/Box42/Box/View/BoxButtonViewGroup.swift new file mode 100644 index 0000000..44a2299 --- /dev/null +++ b/Box42/Box/View/BoxButtonViewGroup.swift @@ -0,0 +1,92 @@ +// +// BoxButtonView.swift +// Box42 +// +// Created by Chanhee Kim on 8/11/23. +// + +import Cocoa +import SnapKit + +class BoxButtonViewGroup: NSView { + var boxVM: WebViewModel! = WebViewModel() + var pinSwitch : NSSwitch = NSSwitch() + var clickAction: ((NSButton) -> Void)? + var lastAddedButton: NSView? + var loginInfo: NSView? + + init(clickAction: @escaping (NSButton) -> Void) { + self.clickAction = clickAction + super.init(frame: BoxSizeManager.shared.buttonGroupSizeNSRect) + setupButtons() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func draw(_ dirtyRect: NSRect) { + // 뷰의 커스텀 렌더링에 사용됨. + } + + private func setupButtons() { + for subview in self.subviews { + subview.removeFromSuperview() + } + + for (name, _) in boxVM.webViewURL.URLstring { + self.createButton(name) + } + } + @objc private func clickBtn(sender: NSButton) { + clickAction?(sender) + } + + private func createButton(_ title: String) { + let button: NSButton + + if title == "home" { + button = NSButton(title: "home", image: NSImage(imageLiteralResourceName: "42box_logo"), target: self, action: #selector(clickBtn(sender:))) + button.imagePosition = .imageOnly + button.isBordered = false + } else { + button = HoverButton() + button.title = title + + button.wantsLayer = true + button.contentTintColor = NSColor.black + button.layer?.borderColor = NSColor.black.cgColor + button.layer?.borderWidth = 1.0 + button.layer?.cornerRadius = 5.0 + button.layer?.opacity = 0.7 + } + super.addSubview(button) + + button.target = self + button.action = #selector(clickBtn(sender:)) + + let fontSize: CGFloat = 16.0 + button.font = NSFont.systemFont(ofSize: fontSize) + button.setButtonType(.momentaryLight) + button.translatesAutoresizingMaskIntoConstraints = false + + button.snp.makeConstraints { make in + make.centerX.equalToSuperview() + make.leading.equalToSuperview().offset(10) + make.trailing.equalToSuperview().offset(-10) + + if title == "home" { + make.height.equalTo(50) + } else { + make.height.equalTo(50) + } + + if let lastButton = lastAddedButton { + make.top.equalTo(lastButton.snp.bottom).offset(10) + } else { + make.top.equalToSuperview().offset(10) + } + } + lastAddedButton = button + } +} diff --git a/Box42/Box/BoxContentsViewGroup.swift b/Box42/Box/View/BoxContentsViewGroup.swift similarity index 90% rename from Box42/Box/BoxContentsViewGroup.swift rename to Box42/Box/View/BoxContentsViewGroup.swift index 0493128..215d0ce 100644 --- a/Box42/Box/BoxContentsViewGroup.swift +++ b/Box42/Box/View/BoxContentsViewGroup.swift @@ -28,7 +28,6 @@ class BoxContentsViewGroup: NSView { make.edges.equalTo(self) } } - required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") @@ -51,13 +50,13 @@ class BoxContentsViewGroup: NSView { } func showWebviews(_ sender: NSButton) { - guard let currentWebview = WebViewList.shared.list[sender.title] else { + guard let currentWebview = WebViewManager.shared.list[sender.title] else { print("No WebView found for title: \(sender.title)") return } - WebViewList.shared.hostingname = sender.title - WebViewList.shared.hostingWebView = currentWebview + WebViewManager.shared.hostingname = sender.title + WebViewManager.shared.hostingWebView = currentWebview self.addSubview(currentWebview) diff --git a/Box42/Main/BoxViewModel.swift b/Box42/Main/BoxViewModel.swift deleted file mode 100644 index 3ae31fd..0000000 --- a/Box42/Main/BoxViewModel.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// URLViewModel.swift -// Box42 -// -// Created by Chanhee Kim on 8/9/23. -// - -import Foundation -import Combine - -// CRUD 4가지 형태의 데이터 가공 create, read, update, delete -class BoxViewModel: ObservableObject { - // Box View Model은 전체적인 View Model을 담당하게 될것. -} diff --git a/Box42/Menubar/MenubarView.swift b/Box42/Menubar/MenubarView.swift deleted file mode 100644 index 7a0e63a..0000000 --- a/Box42/Menubar/MenubarView.swift +++ /dev/null @@ -1,13 +0,0 @@ -// -// MenubarView.swift -// Box42 -// -// Created by Chan on 2023/03/16. -// - -import Foundation -import AppKit - -class MenuBarView { - -} diff --git a/Box42/UI/GradientView.swift b/Box42/UI/GradientView.swift deleted file mode 100644 index 7afd87e..0000000 --- a/Box42/UI/GradientView.swift +++ /dev/null @@ -1,37 +0,0 @@ -// -// GradientView.swift -// Box42 -// -// Created by Chanhee Kim on 8/18/23. -// - -import Cocoa - -//layer caching 기법. -//레이어 캐싱: 복잡한 그래픽 연산이 필요한 뷰의 경우 wantsLayer를 true로 설정하고 shouldRasterize 속성을 true로 설정하여 렌더링 결과를 캐시할 수 있습니다. 하지만 이를 과도하게 사용하면 메모리 사용량이 증가할 수 있으므로 주의가 필요합니다. -class GradientView: NSView { - override init(frame frameRect: NSRect) { - super.init(frame: frameRect) - self.setupLayerCaching() - } - - required init?(coder: NSCoder) { - super.init(coder: coder) - self.setupLayerCaching() - } - - private func setupLayerCaching() { - self.wantsLayer = true - self.layer?.shouldRasterize = true - self.layer?.rasterizationScale = self.window?.backingScaleFactor ?? 1.0 - } - - override func draw(_ dirtyRect: NSRect) { - super.draw(dirtyRect) - - let startingColor = NSColor(red: 1.0, green: 0.804, blue: 0.0, alpha: 0.9) - let endingColor = NSColor(red: 1.0, green: 0.447, blue: 0.0, alpha: 0.7) - let gradient = NSGradient(starting: startingColor, ending: endingColor) - gradient?.draw(in: self.bounds, angle: 90) - } -} diff --git a/Box42/WebView/WebViewList.swift b/Box42/WebView/WebViewList.swift deleted file mode 100644 index b5dbe13..0000000 --- a/Box42/WebView/WebViewList.swift +++ /dev/null @@ -1,23 +0,0 @@ -// -// WebViewList.swift -// Box42 -// -// Created by Chanhee Kim on 8/17/23. -// - -import WebKit - -typealias WebViewMapping = [String : WKWebView] - -class WebViewList { - static let shared = WebViewList() - - var hostingname: String? - var hostingWebView: WKWebView? - - var list: WebViewMapping! - - private init() { - list = [:] - } -} From 68ecc98c412aa4e3c1027d0529ea9730e10c790c Mon Sep 17 00:00:00 2001 From: chanhihi Date: Mon, 21 Aug 2023 04:02:15 +0900 Subject: [PATCH 15/19] =?UTF-8?q?refactor(function):=20button=EA=B7=B8?= =?UTF-8?q?=EB=A3=B9=20=ED=95=98=EB=8B=A8=EC=9D=98=20function=ED=83=AD?= =?UTF-8?q?=EC=9D=98=20=EB=B7=B0=EB=A5=BC=20=EB=B3=80=EA=B2=BD=ED=95=98?= =?UTF-8?q?=EC=98=80=EC=8A=B5=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BoxFunctionViewController.swift | 42 +++++++++++ .../View/BoxFunctionButtonView.swift | 31 ++++++++ .../View/BoxFunctionViewGroup.swift | 75 +++++++++++++++++++ Box42/FunctionButton/View/PinButtonView.swift | 31 ++++++++ .../View/PreferenceButtonView.swift | 30 ++++++++ .../FunctionButton/View/QuitButtonView.swift | 31 ++++++++ Box42/FunctionButton/View/TopDivider.swift | 28 +++++++ 7 files changed, 268 insertions(+) create mode 100644 Box42/FunctionButton/BoxFunctionViewController.swift create mode 100644 Box42/FunctionButton/View/BoxFunctionButtonView.swift create mode 100644 Box42/FunctionButton/View/BoxFunctionViewGroup.swift create mode 100644 Box42/FunctionButton/View/PinButtonView.swift create mode 100644 Box42/FunctionButton/View/PreferenceButtonView.swift create mode 100644 Box42/FunctionButton/View/QuitButtonView.swift create mode 100644 Box42/FunctionButton/View/TopDivider.swift diff --git a/Box42/FunctionButton/BoxFunctionViewController.swift b/Box42/FunctionButton/BoxFunctionViewController.swift new file mode 100644 index 0000000..a2a482e --- /dev/null +++ b/Box42/FunctionButton/BoxFunctionViewController.swift @@ -0,0 +1,42 @@ +// +// FunctionButtonViewController.swift +// Box42 +// +// Created by Chanhee Kim on 8/20/23. +// + +import Cocoa + +class BoxFunctionViewController: NSViewController { + override func loadView() { + let functionViewGroup = BoxFunctionViewGroup() + + functionViewGroup.preferenceAction = preference + functionViewGroup.pinAction = pin + functionViewGroup.quitAction = quit + functionViewGroup.boxAction = box + + self.view = functionViewGroup + } + + override func viewDidLoad() { + super.viewDidLoad() + } + + func preference() { + print("preference") + } + + func pin() { + print("pin") + } + + func quit() { + print("quit") + NSApplication.shared.terminate(self) + } + + func box() { + print("box") + } +} diff --git a/Box42/FunctionButton/View/BoxFunctionButtonView.swift b/Box42/FunctionButton/View/BoxFunctionButtonView.swift new file mode 100644 index 0000000..01eb568 --- /dev/null +++ b/Box42/FunctionButton/View/BoxFunctionButtonView.swift @@ -0,0 +1,31 @@ +// +// BoxFunctionButtonView.swift +// Box42 +// +// Created by Chanhee Kim on 8/20/23. +// + +import AppKit + +class BoxFunctionButtonView: NSButton { + + private var callback: (() -> Void)? + + init(image: NSImage, completion: @escaping () -> Void) { + super.init(frame: .zero) + + self.image = image + self.bezelStyle = .texturedRounded + self.target = self + self.action = #selector(BoxFunction) + self.callback = completion + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + @objc func BoxFunction() { + callback?() + } +} diff --git a/Box42/FunctionButton/View/BoxFunctionViewGroup.swift b/Box42/FunctionButton/View/BoxFunctionViewGroup.swift new file mode 100644 index 0000000..9e5fa88 --- /dev/null +++ b/Box42/FunctionButton/View/BoxFunctionViewGroup.swift @@ -0,0 +1,75 @@ +// +// BoxFunctionViewGroup.swift +// Box42 +// +// Created by Chanhee Kim on 8/20/23. +// + +import AppKit +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"), 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?() }) + lazy var divider: NSBox! = TopDivider(completion: { self.dividerAction?() }) + + var preferenceAction: (() -> Void)? + var pinAction: (() -> Void)? + var quitAction: (() -> Void)? + var boxAction: (() -> Void)? + var dividerAction: (() -> Void)? + + override init(frame: NSRect) { + super.init(frame: frame) + setupViews() + setupConstraints() + } + + required init?(coder: NSCoder) { + super.init(coder: coder) + setupViews() + setupConstraints() + } + + private func setupViews() { + self.addSubview(preferenceButton) + self.addSubview(pinButton) + self.addSubview(quitButton) + self.addSubview(boxButton) + self.addSubview(divider) + } + + private func setupConstraints() { + divider.snp.makeConstraints { make in + make.top.equalToSuperview() + make.left.right.equalToSuperview() + } + + preferenceButton.snp.makeConstraints { make in + make.top.equalTo(divider).offset(10) + make.bottom.equalToSuperview() + make.left.equalToSuperview() + make.width.equalTo(pinButton) + } + + pinButton.snp.makeConstraints { make in + make.top.bottom.equalTo(preferenceButton) + make.left.equalTo(preferenceButton.snp.right).offset(10) + make.width.equalTo(quitButton) + } + + quitButton.snp.makeConstraints { make in + make.top.bottom.equalTo(preferenceButton) + make.left.equalTo(pinButton.snp.right).offset(10) + make.width.equalTo(boxButton) + } + + boxButton.snp.makeConstraints { make in + make.top.bottom.equalTo(preferenceButton) + make.left.equalTo(quitButton.snp.right).offset(10) + make.right.equalToSuperview() + } + } +} diff --git a/Box42/FunctionButton/View/PinButtonView.swift b/Box42/FunctionButton/View/PinButtonView.swift new file mode 100644 index 0000000..a91036b --- /dev/null +++ b/Box42/FunctionButton/View/PinButtonView.swift @@ -0,0 +1,31 @@ +// +// PinButtonView.swift +// Box42 +// +// Created by Chanhee Kim on 8/20/23. +// + +import AppKit + +class PinButtonView: NSButton { + + private var callback: (() -> Void)? + + init(image: NSImage, completion: @escaping () -> Void) { + super.init(frame: .zero) + + self.image = image + self.bezelStyle = .texturedRounded + self.target = self + self.action = #selector(pin) + self.callback = completion + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + @objc func pin() { + callback?() + } +} diff --git a/Box42/FunctionButton/View/PreferenceButtonView.swift b/Box42/FunctionButton/View/PreferenceButtonView.swift new file mode 100644 index 0000000..ffc8102 --- /dev/null +++ b/Box42/FunctionButton/View/PreferenceButtonView.swift @@ -0,0 +1,30 @@ +// +// PreferenceButtonView.swift +// Box42 +// +// Created by Chanhee Kim on 8/20/23. +// + +import AppKit + +class PreferenceButtonView: NSButton { + + private var callback: (() -> Void)? + + init(image: NSImage, completion: @escaping () -> Void) { + super.init(frame: .zero) + self.image = image + self.bezelStyle = .texturedRounded + self.target = self + self.action = #selector(preference) + self.callback = completion + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + @objc func preference() { + callback?() + } +} diff --git a/Box42/FunctionButton/View/QuitButtonView.swift b/Box42/FunctionButton/View/QuitButtonView.swift new file mode 100644 index 0000000..aaf9259 --- /dev/null +++ b/Box42/FunctionButton/View/QuitButtonView.swift @@ -0,0 +1,31 @@ +// +// QuitButtonView.swift +// Box42 +// +// Created by Chanhee Kim on 8/20/23. +// + +import AppKit + +class QuitButtonView: NSButton { + + private var callback: (() -> Void)? + + init(image: NSImage, completion: @escaping () -> Void) { + super.init(frame: .zero) + + self.image = image + self.bezelStyle = .texturedRounded + self.target = self + self.action = #selector(QuitButton) + self.callback = completion + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + @objc func QuitButton() { + callback?() + } +} diff --git a/Box42/FunctionButton/View/TopDivider.swift b/Box42/FunctionButton/View/TopDivider.swift new file mode 100644 index 0000000..81a39de --- /dev/null +++ b/Box42/FunctionButton/View/TopDivider.swift @@ -0,0 +1,28 @@ +// +// TopDivider.swift +// Box42 +// +// Created by Chanhee Kim on 8/21/23. +// + +import AppKit + +class TopDivider: NSBox { + + private var callback: (() -> Void)? + + init(completion: @escaping () -> Void) { + super.init(frame: .zero) + self.title = "" + self.boxType = .separator + self.callback = completion + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + @objc func preference() { + callback?() + } +} From 3561a72032ac9077f8db25a10a9afb5013add8f1 Mon Sep 17 00:00:00 2001 From: chanhihi Date: Mon, 21 Aug 2023 04:02:41 +0900 Subject: [PATCH 16/19] =?UTF-8?q?refactor:=20=EC=95=8C=EC=95=84=EB=B3=B4?= =?UTF-8?q?=EA=B8=B0=EC=89=BD=EA=B2=8C=20keydown=EC=9D=84=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC=ED=95=98=EC=98=80=EC=8A=B5=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Box42/Main/BoxViewController.swift | 28 +----------------- Box42/Main/keyDown+BoxViewController.swift | 33 ++++++++++++++++++++++ 2 files changed, 34 insertions(+), 27 deletions(-) create mode 100644 Box42/Main/keyDown+BoxViewController.swift diff --git a/Box42/Main/BoxViewController.swift b/Box42/Main/BoxViewController.swift index 15e782b..a9692c8 100644 --- a/Box42/Main/BoxViewController.swift +++ b/Box42/Main/BoxViewController.swift @@ -5,7 +5,6 @@ // Created by Chan on 2023/03/16. // -import Cocoa import AppKit import WebKit @@ -49,7 +48,7 @@ class BoxViewController: NSViewController { @objc func doubleClickBtn(sender: NSButton) { - WebViewList.shared.list[sender.title]!.reload() + WebViewManager.shared.list[sender.title]!.reload() } @objc @@ -62,28 +61,3 @@ class BoxViewController: NSViewController { print(message.name) } } - -extension BoxViewController { - override func keyDown(with event: NSEvent) { - print(event.keyCode) - if event.keyCode == 1 { - StorageConfig.shared.setThreshold(.percentage50) - StorageConfig.shared.setPeriod(.period10s) - } - if event.keyCode == 2 { - // SdtorageConfig.shared.setThreshold(.percentage30) - DispatchQueue.main.async { - StorageConfig.shared.setThreshold(.percentage30) - } - StorageConfig.shared.setPeriod(.period1s) - } - - - if event.keyCode == 53 { // Escape 키의 keyCode는 53입니다. - print("escape") - menubarVCDelegate?.toggleWindow(sender: nil) - } else { - super.keyDown(with: event) // 기타 키를 처리하기 위해 상위 클래스에게 전달 - } - } -} diff --git a/Box42/Main/keyDown+BoxViewController.swift b/Box42/Main/keyDown+BoxViewController.swift new file mode 100644 index 0000000..63b89e2 --- /dev/null +++ b/Box42/Main/keyDown+BoxViewController.swift @@ -0,0 +1,33 @@ +// +// keyDown+BoxViewController.swift +// Box42 +// +// Created by Chanhee Kim on 8/21/23. +// + +import AppKit + +extension BoxViewController { + override func keyDown(with event: NSEvent) { + print(event.keyCode) + if event.keyCode == 1 { + StorageConfig.shared.setThreshold(.percentage50) + StorageConfig.shared.setPeriod(.period10s) + } + if event.keyCode == 2 { + // SdtorageConfig.shared.setThreshold(.percentage30) + DispatchQueue.main.async { + StorageConfig.shared.setThreshold(.percentage30) + } + StorageConfig.shared.setPeriod(.period1s) + } + + + if event.keyCode == 53 { // Escape 키의 keyCode는 53입니다. + print("escape") + menubarVCDelegate?.toggleWindow(sender: nil) + } else { + super.keyDown(with: event) // 기타 키를 처리하기 위해 상위 클래스에게 전달 + } + } +} From ac3b11d81ab8b154b7919de3ca171cc8dfad78a7 Mon Sep 17 00:00:00 2001 From: chanhihi Date: Mon, 21 Aug 2023 04:03:37 +0900 Subject: [PATCH 17/19] =?UTF-8?q?chore:=20=EC=93=B8=EB=AA=A8=EC=97=86?= =?UTF-8?q?=EB=8A=94=20=EB=B6=80=EB=B6=84=EC=9D=84=20=EC=A0=9C=EA=B1=B0?= =?UTF-8?q?=ED=95=98=EC=98=80=EC=8A=B5=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Box42/Menubar/MenubarViewController.swift | 1 - .../PreferencesViewController.swift | 30 ++++++++--------- Box42/System/Storage.swift | 33 +++++++++---------- Box42/System/StorageConfig.swift | 2 +- Box42/WebView/WebViewController.swift | 25 +++++--------- 5 files changed, 40 insertions(+), 51 deletions(-) diff --git a/Box42/Menubar/MenubarViewController.swift b/Box42/Menubar/MenubarViewController.swift index a409ed8..2cb1a3f 100644 --- a/Box42/Menubar/MenubarViewController.swift +++ b/Box42/Menubar/MenubarViewController.swift @@ -11,7 +11,6 @@ import AppKit class MenubarViewController: NSWorkspace { var popover = NSPopover() var statusBarVM = StatusBarViewModel() - let menuBarView = MenuBarView() lazy var eventMonitor: EventMonitor = self.setupEventMonitor() var boxWindowController: BoxWindowController? diff --git a/Box42/Preferences/PreferencesViewController.swift b/Box42/Preferences/PreferencesViewController.swift index 786e21d..6604203 100644 --- a/Box42/Preferences/PreferencesViewController.swift +++ b/Box42/Preferences/PreferencesViewController.swift @@ -104,21 +104,21 @@ class PreferencesViewController: NSViewController { task.standardError = outputPipe - outputPipe.fileHandleForReading.readabilityHandler = { [weak self] fileHandle in - if #available(OSX 10.15.4, *) { - if let data = try? fileHandle.readToEnd(), let output = String(data: data, encoding: .utf8) { - DispatchQueue.main.async { - if let outputView = self?.outputView { - outputView.string += "\(output)" - } else { - print("outputView is nil") - } - } - } - } else { - // Fallback on earlier versions - } - } +// outputPipe.fileHandleForReading.readabilityHandler = { [weak self] fileHandle in +// if #available(OSX 10.15.4, *) { +// if let data = try? fileHandle.readToEnd(), let output = String(data: data, encoding: .utf8) { +// DispatchQueue.main.async { +// if let outputView = self?.outputView { +// outputView.string += "\(output)" +// } else { +// print("outputView is nil") +// } +// } +// } +// } else { +// // Fallback on earlier versions +// } +// } task.launch() diff --git a/Box42/System/Storage.swift b/Box42/System/Storage.swift index 6b06a22..4024446 100644 --- a/Box42/System/Storage.swift +++ b/Box42/System/Storage.swift @@ -73,23 +73,22 @@ class Storage { self.cleanSh() self.count += 1 if self.count > 2 { - showMessageWithAppleScript("캐시 문제가 아닙니다. ncdu ~ 를 확인해주세요.", "재시작") { button in - print("timer") - dump(button) - if let button = button { - switch button { - case "재시작": - StateManager.shared.setOnIsAutoStorage() - print("재시작 버튼을 클릭했습니다.") - case "취소": - // 취소 관련 로직 실행 - print("취소 버튼을 클릭했습니다.") - default: - break - } - } - } - +// showMessageWithAppleScript("캐시 문제가 아닙니다. ncdu ~ 를 확인해주세요.", "재시작") { button in +// print("timer") +// dump(button) +// if let button = button { +// switch button { +// case "재시작": +// StateManager.shared.setOnIsAutoStorage() +// print("재시작 버튼을 클릭했습니다.") +// case "취소": +// // 취소 관련 로직 실행 +// print("취소 버튼을 클릭했습니다.") +// default: +// break +// } +// } +// } StateManager.shared.setOffIsAutoStorage() // 여기서도 타이머를 중지시켜야 합니다. self.storageTimer?.invalidate() diff --git a/Box42/System/StorageConfig.swift b/Box42/System/StorageConfig.swift index 7b9f615..002581c 100644 --- a/Box42/System/StorageConfig.swift +++ b/Box42/System/StorageConfig.swift @@ -27,7 +27,7 @@ class StorageConfig: ObservableObject { @Published var threshold: StorageThreshold @Published var period: StoragePeriod - init(_ threshold: StorageThreshold = .percentage10, _ period: StoragePeriod = .period3s) { + init(_ threshold: StorageThreshold = .percentage30, _ period: StoragePeriod = .period3s) { self.threshold = threshold self.period = period } diff --git a/Box42/WebView/WebViewController.swift b/Box42/WebView/WebViewController.swift index 3b73e89..e0d1f02 100644 --- a/Box42/WebView/WebViewController.swift +++ b/Box42/WebView/WebViewController.swift @@ -31,7 +31,7 @@ class WebViewController: NSViewController { func loadWebView(_ name: String, _ url: URL) { let wkWebView = WebView() - WebViewList.shared.list[name] = wkWebView + WebViewManager.shared.list[name] = wkWebView DispatchQueue.main.async { wkWebView.load(self.URLVM.requestURL(url)) } @@ -44,7 +44,7 @@ class WebViewController: NSViewController { } func webViewInit() { - WebViewList.shared.hostingWebView = self.webView + WebViewManager.shared.hostingWebView = self.webView DispatchQueue.main.async { self.webView.load(self.URLVM.requestURL(self.URLVM.safeURL())) } @@ -60,25 +60,16 @@ class WebViewController: NSViewController { override func viewDidLoad() { super.viewDidLoad() - if let scrollView = webView.enclosingScrollView { - scrollView.verticalScroller = CustomScroller() - scrollView.horizontalScroller = CustomScroller() - } } func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) { print(message.name) } -} - -extension WebViewController { - override func keyDown(with event: NSEvent) { - print(event.keyCode) - - // 키보드 이벤트 처리 - // if (event) { - // } else { - // super.keyDown(with: event) // 기본 키 이벤트 처리 - // } + + func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? { + if let url = navigationAction.request.url { + webView.load(URLRequest(url: url)) + } + return nil } } From ec556f1277bc1330b4dae1d41ed4813e52188fc6 Mon Sep 17 00:00:00 2001 From: chanhihi Date: Mon, 21 Aug 2023 04:05:00 +0900 Subject: [PATCH 18/19] =?UTF-8?q?refactor(webview):=20=EC=8B=B1=EA=B8=80?= =?UTF-8?q?=ED=86=A4=20=ED=8C=A8=ED=84=B4=20=EA=B5=AC=EC=A1=B0=EC=9D=98=20?= =?UTF-8?q?WebViewManager=EB=A1=9C=20content=20hosting=20view=EB=A5=BC=20?= =?UTF-8?q?=EA=B4=80=EB=A6=AC=ED=95=98=EA=B2=8C=20=EB=90=A9=EB=8B=88?= =?UTF-8?q?=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Box42/Toolbar/ToolbarViewController.swift | 10 +++--- Box42/Toolbar/View/BoxToolbarViewGroup.swift | 31 +++++++++++++++++ Box42/Toolbar/View/DisplayURLInToolbar.swift | 4 +-- Box42/WebView/WebViewManager.swift | 23 +++++++++++++ Box42/Window/BoxWindowController.swift | 35 +++++++++++++------- 5 files changed, 84 insertions(+), 19 deletions(-) create mode 100644 Box42/Toolbar/View/BoxToolbarViewGroup.swift create mode 100644 Box42/WebView/WebViewManager.swift diff --git a/Box42/Toolbar/ToolbarViewController.swift b/Box42/Toolbar/ToolbarViewController.swift index c31b378..ea32aab 100644 --- a/Box42/Toolbar/ToolbarViewController.swift +++ b/Box42/Toolbar/ToolbarViewController.swift @@ -38,20 +38,20 @@ class ToolbarViewController: NSViewController { } func goBack() { - WebViewList.shared.hostingWebView?.goBack() + WebViewManager.shared.hostingWebView?.goBack() } func goFoward() { - WebViewList.shared.hostingWebView?.goForward() + WebViewManager.shared.hostingWebView?.goForward() } func reloadPage() { - WebViewList.shared.hostingWebView?.reload() + WebViewManager.shared.hostingWebView?.reload() } func goToHome() { - if let item = WebViewList.shared.hostingWebView?.backForwardList.backList.first { - WebViewList.shared.hostingWebView?.go(to: item) + if let item = WebViewManager.shared.hostingWebView?.backForwardList.backList.first { + WebViewManager.shared.hostingWebView?.go(to: item) } } } diff --git a/Box42/Toolbar/View/BoxToolbarViewGroup.swift b/Box42/Toolbar/View/BoxToolbarViewGroup.swift new file mode 100644 index 0000000..ac17e8c --- /dev/null +++ b/Box42/Toolbar/View/BoxToolbarViewGroup.swift @@ -0,0 +1,31 @@ +// +// BoxToolbarViewGroup.swift +// Box42 +// +// Created by Chanhee Kim on 8/18/23. +// + +import AppKit +import SnapKit + +class BoxToolbarViewGroup: NSView { + var toolbarVC: ToolbarViewController? + + init() { +// toolbarVC = ToolbarViewController(nibName: nil, bundle: nil) + + super.init(frame: NSRect(x: 0, y: 0, width: BoxSizeManager.shared.size.width - BoxSizeManager.shared.toolbarGroupSize.width, height: BoxSizeManager.shared.toolbarGroupSize.height)) + + self.wantsLayer = true +// self.addSubview(toolbarVC!.view) + + toolbarVC?.view.translatesAutoresizingMaskIntoConstraints = false + toolbarVC?.view.snp.makeConstraints { make in + make.edges.equalTo(self) + } + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} diff --git a/Box42/Toolbar/View/DisplayURLInToolbar.swift b/Box42/Toolbar/View/DisplayURLInToolbar.swift index 147c39f..d8026dd 100644 --- a/Box42/Toolbar/View/DisplayURLInToolbar.swift +++ b/Box42/Toolbar/View/DisplayURLInToolbar.swift @@ -16,7 +16,7 @@ class DisplayURLInToolbar: NSTextField { self.isBordered = false // 테두리를 제거합니다. self.backgroundColor = NSColor.clear // 배경색을 투명하게 만듭니다. - if let url = WebViewList.shared.hostingWebView?.url { + if let url = WebViewManager.shared.hostingWebView?.url { self.stringValue = url.absoluteString } } @@ -26,7 +26,7 @@ class DisplayURLInToolbar: NSTextField { } func updateURL() { - if let url = WebViewList.shared.hostingWebView?.url { + if let url = WebViewManager.shared.hostingWebView?.url { self.stringValue = url.absoluteString } } diff --git a/Box42/WebView/WebViewManager.swift b/Box42/WebView/WebViewManager.swift new file mode 100644 index 0000000..bdf0fe1 --- /dev/null +++ b/Box42/WebView/WebViewManager.swift @@ -0,0 +1,23 @@ +// +// WebViewList.swift +// Box42 +// +// Created by Chanhee Kim on 8/17/23. +// + +import WebKit + +typealias WebViewMapping = [String : WKWebView] + +class WebViewManager { + static let shared = WebViewManager() + + var hostingname: String? + var hostingWebView: WKWebView? + + var list: WebViewMapping! + + private init() { + list = [:] + } +} diff --git a/Box42/Window/BoxWindowController.swift b/Box42/Window/BoxWindowController.swift index 8ce6c4c..dc69045 100644 --- a/Box42/Window/BoxWindowController.swift +++ b/Box42/Window/BoxWindowController.swift @@ -7,14 +7,14 @@ import Cocoa -class BoxWindowController: NSWindowController, NSToolbarDelegate { +class BoxWindowController: NSWindowController, NSToolbarDelegate, NSWindowDelegate { override init(window: NSWindow?) { let contentRect = BoxSizeManager.shared.boxViewSizeNSRect let styleMask: NSWindow.StyleMask = [.resizable, .closable, .miniaturizable, .fullSizeContentView, .titled] let windowInstance = NSWindow(contentRect: contentRect, styleMask: styleMask, backing: .buffered, defer: false) - + windowInstance.titlebarAppearsTransparent = true windowInstance.titleVisibility = .hidden windowInstance.title = "Box" @@ -22,21 +22,32 @@ class BoxWindowController: NSWindowController, NSToolbarDelegate { windowInstance.isOpaque = false windowInstance.backgroundColor = .clear windowInstance.isMovableByWindowBackground = true - + let boxViewController = BoxViewController(nibName: nil, bundle: nil) windowInstance.contentViewController = boxViewController - + super.init(window: windowInstance) + windowInstance.delegate = self + setupToolbar() } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } - - // MARK: - Toolbar - +} + +extension BoxWindowController { + func windowShouldClose(_ sender: NSWindow) -> Bool { +// NSApplication.shared.terminate(self) + StateManager.shared.setToggleIsShowWindow() + return true + } +} + +// MARK: - Toolbar +extension BoxWindowController { func setupToolbar() { let toolbar = NSToolbar(identifier: "MainToolbar") toolbar.delegate = self @@ -99,20 +110,20 @@ class BoxWindowController: NSWindowController, NSToolbarDelegate { } @objc func goBackAction() { - WebViewList.shared.hostingWebView?.goBack() + WebViewManager.shared.hostingWebView?.goBack() } @objc func goFowardAction() { - WebViewList.shared.hostingWebView?.goForward() + WebViewManager.shared.hostingWebView?.goForward() } @objc func reloadPageAction() { - WebViewList.shared.hostingWebView?.reload() + WebViewManager.shared.hostingWebView?.reload() } @objc func goToHomeAction() { - if let item = WebViewList.shared.hostingWebView?.backForwardList.backList.first { - WebViewList.shared.hostingWebView?.go(to: item) + if let item = WebViewManager.shared.hostingWebView?.backForwardList.backList.first { + WebViewManager.shared.hostingWebView?.go(to: item) } } } From b8f6fef7b5c28e6e596f1cdedef471c9c54f00b2 Mon Sep 17 00:00:00 2001 From: chanhihi Date: Mon, 21 Aug 2023 04:06:31 +0900 Subject: [PATCH 19/19] =?UTF-8?q?feat(front):=20=E2=9C=A8=20front=20deploy?= =?UTF-8?q?=EC=97=90=20=EB=94=B0=EB=9D=BC=EC=84=9C=20url=EC=9D=84=20?= =?UTF-8?q?=EB=93=B1=EB=A1=9D=ED=95=A9=EB=8B=88=EB=8B=A4!=20=E2=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Box42/WebView/URL/URLModel.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Box42/WebView/URL/URLModel.swift b/Box42/WebView/URL/URLModel.swift index d27e9e3..014f62c 100644 --- a/Box42/WebView/URL/URLModel.swift +++ b/Box42/WebView/URL/URLModel.swift @@ -26,7 +26,8 @@ struct URLModels { // Network logic api call 날려서 받아올 것. let URLstring: [nameUrl] = [ - ("home", "https://42box.github.io/front-end/"), + ("home", "http://42box.kr/"), + ("23Coaltheme", "https://42box.github.io/front-end/"), // ("home", "http://127.0.0.1:3000/"), ("Box 42", "https://42box.github.io/front-end/#/box"), ("Intra 42", "https://intra.42.fr"),