Skip to content

Commit

Permalink
Add FXView initializer, prepare for alpha.2-preview
Browse files Browse the repository at this point in the history
TODO:
• Reorganize inherited classes
• Add FXView controller/protocol
• Implement Material (aka "Styles")
• Implement Visualizer (WKWebView themes)
• Implement Menu bar with custom assets
  • Loading branch information
revblaze committed Jun 26, 2021
1 parent d2b73c8 commit 2d68d5f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
4 changes: 0 additions & 4 deletions macOS/Ultra.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
C2A923DA26727EE1009638C2 /* dist in Resources */ = {isa = PBXBuildFile; fileRef = C2A923D926727EE1009638C2 /* dist */; };
C2A923DE267283BD009638C2 /* DebugMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2A923DD267283BD009638C2 /* DebugMenu.swift */; };
C2A923E12672840A009638C2 /* WK+JavaScript.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2A923E02672840A009638C2 /* WK+JavaScript.swift */; };
C2B55C022687AF5C00BF9A33 /* CustomizerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2B55C012687AF5C00BF9A33 /* CustomizerView.swift */; };
C2B55C052687B0EB00BF9A33 /* CustomizerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2B55C042687B0EB00BF9A33 /* CustomizerViewController.swift */; };
C2B55C082687B27F00BF9A33 /* WebContent in Resources */ = {isa = PBXBuildFile; fileRef = C2B55C072687B27F00BF9A33 /* WebContent */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -68,7 +67,6 @@
C2A923D926727EE1009638C2 /* dist */ = {isa = PBXFileReference; lastKnownFileType = folder; name = dist; path = ../../../TypeSwift/dist; sourceTree = "<group>"; };
C2A923DD267283BD009638C2 /* DebugMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DebugMenu.swift; sourceTree = "<group>"; };
C2A923E02672840A009638C2 /* WK+JavaScript.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WK+JavaScript.swift"; sourceTree = "<group>"; };
C2B55C012687AF5C00BF9A33 /* CustomizerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomizerView.swift; sourceTree = "<group>"; };
C2B55C042687B0EB00BF9A33 /* CustomizerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomizerViewController.swift; sourceTree = "<group>"; };
C2B55C072687B27F00BF9A33 /* WebContent */ = {isa = PBXFileReference; lastKnownFileType = folder; path = WebContent; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -222,7 +220,6 @@
C200422A267A28CF00DE5CA6 /* Theme */,
C2004227267A280700DE5CA6 /* Legacy */,
C2A923B826726B2C009638C2 /* FXView.swift */,
C2B55C012687AF5C00BF9A33 /* CustomizerView.swift */,
);
path = CoreFX;
sourceTree = "<group>";
Expand Down Expand Up @@ -393,7 +390,6 @@
C2004231267A2A5800DE5CA6 /* DefaultsManager.swift in Sources */,
C2A923A72672687D009638C2 /* AppDelegate.swift in Sources */,
C2A923C026726CD3009638C2 /* URLDidChange.swift in Sources */,
C2B55C022687AF5C00BF9A33 /* CustomizerView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
15 changes: 12 additions & 3 deletions macOS/Ultra/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@ class ViewController: NSViewController, NSWindowDelegate, WKUIDelegate, WKNaviga
// Set Observers
webViewURLObserver = webView.observe(\.url, options: .new) { [weak self] webView, change in
self?.urlDidChange("\(String(describing: change.newValue))") }
}

override func viewDidAppear() {

NotificationCenter.default.addObserver(self, selector: #selector(self.setWallpaper), name: .setWallpaper, object: nil)
}

func webView(_ webView: WKWebView, didCommit navigation: WKNavigation!) {
Expand All @@ -53,6 +51,11 @@ class ViewController: NSViewController, NSWindowDelegate, WKUIDelegate, WKNaviga

}

@objc func setWallpaper() {
let image = NSImage(named: wallpaperName)
fxView.setImage((image ?? NSImage(named: "monterey"))!)
}

func initFXView() {
let image = NSImage(imageLiteralResourceName: "monterey")
fxView.setImage(image)
Expand Down Expand Up @@ -119,3 +122,9 @@ class ViewController: NSViewController, NSWindowDelegate, WKUIDelegate, WKNaviga

}


// MARK: Type-Safe Notifications
extension Notification.Name {
static let setWallpaper = Notification.Name("setWallpaper")
}

0 comments on commit 2d68d5f

Please sign in to comment.