-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Global Notification System #1984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 11 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
5aac83d
Added global notifications system
austincondiff 779e3a6
Refactored FeatureIcon and notifications to support custom images
austincondiff 6988330
Fixed SwiftLint errors
austincondiff 9b524bd
Fixed SwiftLint errors
austincondiff 99041cf
Deleted unused file
austincondiff 13d3bca
Added sticky notifications. Allowed multiple notifications to overlay…
austincondiff 2471175
Streamlined UI getting rid of the notifications popover in favor of t…
austincondiff b91877e
Added a close button click state, allows clicking under scroll view.
austincondiff d3d26d1
Fix SwiftLint errors by splitting up NotificationManager
austincondiff a4846e9
Fixed SwiftLint errors
austincondiff 8349007
Remove test notification
austincondiff 85f4656
Improve notification handling and workspace panel behavior
austincondiff 721389c
Fixed SwiftLint and PR issues
austincondiff b839c1a
Added an Internal Development Inspector for debug purposes. This insp…
austincondiff c292c7d
Fixed animation glitch when taking action on a notification while not…
austincondiff cd1bf2d
Changed variable name isManuallyShown to isPresented, and notificatio…
austincondiff d2060e7
SwiftLint error fix
austincondiff dc33a4e
SwiftLint fixes
austincondiff 4815194
Refactored CENotification to use delegated inits.
austincondiff 749c716
Moved CloseButtonStyle into CodeEditUI and renamed it OverlayButtonStyle
austincondiff 5e6c608
Using cancelables so workspace cleanup is more concise
austincondiff File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| // | ||
| // FeatureIcon.swift | ||
| // CodeEdit | ||
| // | ||
| // Created by Austin Condiff on 12/2/24. | ||
| // | ||
|
|
||
| import SwiftUI | ||
| import CodeEditSymbols | ||
|
|
||
| struct FeatureIcon: View { | ||
| private let content: IconContent | ||
| private let color: Color? | ||
| private let size: CGFloat | ||
|
|
||
| init( | ||
| symbol: String, | ||
| color: Color? = nil, | ||
| size: CGFloat? = nil | ||
| ) { | ||
| self.content = .symbol(symbol) | ||
| self.color = color ?? .accentColor | ||
| self.size = size ?? 20 | ||
| } | ||
|
|
||
| init( | ||
| text: String, | ||
| textColor: Color? = nil, | ||
| color: Color? = nil, | ||
| size: CGFloat? = nil | ||
| ) { | ||
| self.content = .text(text, textColor: textColor) | ||
| self.color = color ?? .accentColor | ||
| self.size = size ?? 20 | ||
| } | ||
|
|
||
| init( | ||
| image: Image, | ||
| size: CGFloat? = nil | ||
| ) { | ||
| self.content = .image(image) | ||
| self.color = nil | ||
| self.size = size ?? 20 | ||
| } | ||
|
|
||
| private func getSafeImage(named: String) -> Image { | ||
| if NSImage(systemSymbolName: named, accessibilityDescription: nil) != nil { | ||
| return Image(systemName: named) | ||
| } else { | ||
| return Image(symbol: named) | ||
| } | ||
| } | ||
|
|
||
| var body: some View { | ||
| RoundedRectangle(cornerRadius: size / 4, style: .continuous) | ||
| .fill(background) | ||
| .overlay { | ||
| switch content { | ||
| case let .symbol(name): | ||
| getSafeImage(named: name) | ||
| .resizable() | ||
| .aspectRatio(contentMode: .fit) | ||
| .foregroundColor(.white) | ||
| .padding(size / 8) | ||
| case let .text(text, textColor): | ||
| Text(text) | ||
| .font(.system(size: size * 0.65)) | ||
| .foregroundColor(textColor ?? .primary) | ||
| case let .image(image): | ||
| image | ||
| .resizable() | ||
| .aspectRatio(contentMode: .fill) | ||
| } | ||
| } | ||
| .clipShape(RoundedRectangle(cornerRadius: size / 4, style: .continuous)) | ||
| .shadow( | ||
| color: Color(NSColor.black).opacity(0.25), | ||
| radius: size / 40, | ||
| y: size / 40 | ||
| ) | ||
| .frame(width: size, height: size) | ||
| } | ||
|
|
||
| private var background: AnyShapeStyle { | ||
| switch content { | ||
| case .symbol, .text: | ||
| return AnyShapeStyle((color ?? .accentColor).gradient) | ||
| case .image: | ||
| return AnyShapeStyle(.regularMaterial) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private enum IconContent { | ||
| case symbol(String) | ||
| case text(String, textColor: Color?) | ||
| case image(Image) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.