Skip to content

Commit 7092ab5

Browse files
committed
Fixed SwiftLint errors
1 parent f87b417 commit 7092ab5

4 files changed

Lines changed: 36 additions & 8 deletions

File tree

CodeEdit/AppDelegate.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {
2929
// Add test notification
3030
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) {
3131
NotificationManager.shared.post(
32-
iconSymbol: "bell.badge",
32+
iconText: "👋",
33+
iconTextColor: .white,
34+
iconColor: .indigo,
3335
title: "Welcome to CodeEdit",
3436
description: "This is a test notification to demonstrate the notification system.",
35-
actionButtonTitle: "Learn More",
37+
actionButtonTitle: "Learn More...",
3638
action: {
3739
print("Action button clicked!")
3840
}
@@ -85,7 +87,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {
8587
handleOpen()
8688
return false
8789
}
88-
90+
8991
/// Check if all windows are either miniaturized or not visible.
9092
/// If so, attempt to find the first miniaturized window and deminiaturize it.
9193
guard sender.windows.allSatisfy({ $0.isMiniaturized || !$0.isVisible }) else { return false }
@@ -164,9 +166,9 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {
164166
func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply {
165167
let projects: [String] = CodeEditDocumentController.shared.documents
166168
.compactMap { ($0 as? WorkspaceDocument)?.fileURL?.path }
167-
169+
168170
UserDefaults.standard.set(projects, forKey: AppDelegate.recoverWorkspacesKey)
169-
171+
170172
let areAllDocumentsClean = CodeEditDocumentController.shared.documents.allSatisfy { !$0.isDocumentEdited }
171173
guard areAllDocumentsClean else {
172174
CodeEditDocumentController.shared.closeAllDocuments(

CodeEdit/Features/InspectorArea/FileInspector/FileInspectorView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ struct FileInspectorView: View {
9191

9292
func addTestNotification () {
9393
NotificationManager.shared.post(
94-
iconSymbol: "bell",
94+
iconSymbol: "bell.badge.fill",
9595
iconColor: .red,
9696
title: "New Notification Created",
9797
description: "Successfully created new notification",

CodeEdit/Features/Notifications/Models/CENotification.swift

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,30 @@ struct CENotification: Identifiable, Equatable {
115115
self.isRead = isRead
116116
self.timestamp = Date()
117117
}
118-
118+
119+
init(
120+
id: UUID = UUID(),
121+
iconText: String,
122+
iconTextColor: Color? = nil,
123+
iconColor: Color? = nil,
124+
title: String,
125+
description: String,
126+
actionButtonTitle: String,
127+
action: @escaping () -> Void,
128+
isSticky: Bool = false,
129+
isRead: Bool = false
130+
) {
131+
self.id = id
132+
self.icon = .text(iconText, backgroundColor: iconColor, textColor: iconTextColor)
133+
self.title = title
134+
self.description = description
135+
self.actionButtonTitle = actionButtonTitle
136+
self.action = action
137+
self.isSticky = isSticky
138+
self.isRead = isRead
139+
self.timestamp = Date()
140+
}
141+
119142
init(
120143
id: UUID = UUID(),
121144
iconImage: Image,

CodeEdit/Features/Notifications/Views/NotificationOverlayView.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@
88
import SwiftUI
99

1010
struct NotificationOverlayView: View {
11+
@Environment(\.controlActiveState)
12+
private var controlActiveState
13+
1114
@ObservedObject private var notificationManager = NotificationManager.shared
15+
1216
@Namespace private var animation
13-
@Environment(\.controlActiveState) private var controlActiveState
1417

1518
var body: some View {
1619
VStack(spacing: 10) {

0 commit comments

Comments
 (0)