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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,19 @@
"cSpell.enabledFileTypes": {
"swift": true
},
"cSpell.words": ["Deinitialization", "GRDB", "stylex"],
"cSpell.words": [
"Autoresizing",
"Bezeled",
"Deinitialization",
"GRDB",
"Rajabifard",
"stylex",
"Sublayer",
"sublayers",
"Subview",
"Superlayer",
"superview"
],

// Protocol Buffers
"protoc": {
Expand Down
1 change: 0 additions & 1 deletion apple/.swiftformat
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
--hexgrouping 4
--octalgrouping 4
--exponentcase lowercase
--header strip
--ifdef no-indent
--linebreaks lf
--patternlet hoist
Expand Down
6 changes: 3 additions & 3 deletions apple/Inline.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 14.6;
MACOSX_DEPLOYMENT_TARGET = 15.2;
MARKETING_VERSION = 0.1;
PRODUCT_BUNDLE_IDENTIFIER = chat.inline.InlineMac.debug;
PRODUCT_NAME = Inline;
Expand Down Expand Up @@ -1111,7 +1111,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 14.6;
MACOSX_DEPLOYMENT_TARGET = 15.2;
MARKETING_VERSION = 0.1;
PRODUCT_BUNDLE_IDENTIFIER = chat.inline.InlineMac;
PRODUCT_NAME = Inline;
Expand Down Expand Up @@ -1304,7 +1304,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 14.6;
MACOSX_DEPLOYMENT_TARGET = 15.2;
MARKETING_VERSION = 0.1;
PRODUCT_BUNDLE_IDENTIFIER = chat.inline.InlineMac.debug2;
PRODUCT_NAME = Inline;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public struct HomeChatItem: Codable, FetchableRecord, PersistableRecord, Hashabl
}

// Add a static method to create the request
static func all() -> QueryInterfaceRequest<HomeChatItem> {
public static func all() -> QueryInterfaceRequest<HomeChatItem> {
Dialog
.including(
optional: Dialog.peerUser
Expand Down Expand Up @@ -270,7 +270,7 @@ public extension AppDatabase {
}

public extension HomeViewModel {
nonisolated static func sortChats(_ chats: [HomeChatItem]) -> [HomeChatItem] {
nonisolated public static func sortChats(_ chats: [HomeChatItem]) -> [HomeChatItem] {
chats.sorted { item1, item2 in
// First sort by pinned status
let pinned1 = item1.dialog.pinned ?? false
Expand All @@ -284,11 +284,11 @@ public extension HomeViewModel {
}
}

nonisolated static func filterArchived(_ chats: [HomeChatItem], archived: Bool) -> [HomeChatItem] {
nonisolated public static func filterArchived(_ chats: [HomeChatItem], archived: Bool) -> [HomeChatItem] {
chats.filter { $0.dialog.archived == archived }
}

nonisolated static func filterEmptyChats(_ chats: [HomeChatItem]) -> [HomeChatItem] {
nonisolated public static func filterEmptyChats(_ chats: [HomeChatItem]) -> [HomeChatItem] {
chats.filter { $0.chat != nil }
}
}
39 changes: 22 additions & 17 deletions apple/InlineMac/App/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import UserNotifications

class AppDelegate: NSObject, NSApplicationDelegate {
// Main Window
private var mainWindowController: MainWindowController?
private var mainWindowController: NSWindowController?

@MainActor private let dockBadgeService = DockBadgeService()

Expand All @@ -27,7 +27,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {

private var cancellables = Set<AnyCancellable>()

func applicationWillFinishLaunching(_ notification: Notification) {
func applicationWillFinishLaunching(_: Notification) {
// Disable native tabbing
NSWindow.allowsAutomaticWindowTabbing = false

Expand All @@ -41,7 +41,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
dependencies.logOut = logOut
}

func applicationDidFinishLaunching(_ aNotification: Notification) {
func applicationDidFinishLaunching(_: Notification) {
initializeServices()
setupMainWindow()
setupMainMenu()
Expand Down Expand Up @@ -85,7 +85,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
true
}

func applicationDidResignActive(_ notification: Notification) {
func applicationDidResignActive(_: Notification) {
// Task {
// if Auth.shared.isLoggedIn {
// // Mark offline
Expand All @@ -94,7 +94,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
// }
}

func applicationDidBecomeActive(_ notification: Notification) {
func applicationDidBecomeActive(_: Notification) {
// Task {
// if Auth.shared.isLoggedIn {
// // Mark online
Expand All @@ -112,19 +112,24 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}

// Create new window controller if it doesn't exist
let controller = MainWindowController(dependencies: dependencies)
let controller: NSWindowController
if AppSettings.shared.enableNewMacUI {
controller = MainWindowController(dependencies: dependencies)
} else {
controller = LegacyMainWindowController(dependencies: dependencies)
}
controller.showWindow(nil)
mainWindowController = controller
}

func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
func applicationShouldHandleReopen(_: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
if !flag {
setupMainWindow()
}
return true
}

func application(_ application: NSApplication, open urls: [URL]) {
func application(_: NSApplication, open urls: [URL]) {
// Handle URLs when app is already running
for url in urls {
log.debug("Received URL via application:open: \(url)")
Expand All @@ -149,12 +154,12 @@ class AppDelegate: NSObject, NSApplicationDelegate {

// Handle different URL patterns
switch url.host {
case "user":
handleUserURL(pathComponents: pathComponents)
case "integrations":
NotificationCenter.default.post(name: .integrationCallback, object: url)
default:
log.warning("Unhandled URL host: \(url.host ?? "nil")")
case "user":
handleUserURL(pathComponents: pathComponents)
case "integrations":
NotificationCenter.default.post(name: .integrationCallback, object: url)
default:
log.warning("Unhandled URL host: \(url.host ?? "nil")")
}
}
}
Expand Down Expand Up @@ -214,7 +219,7 @@ extension AppDelegate {
}

func application(
_ application: NSApplication,
_: NSApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data
) {
log.debug("Registered for remote notifications: \(deviceToken)")
Expand All @@ -223,7 +228,7 @@ extension AppDelegate {
}

func application(
_ application: NSApplication,
_: NSApplication,
didFailToRegisterForRemoteNotificationsWithError error: Error
) {
log.error("Failed to register for remote notifications \(error)")
Expand Down Expand Up @@ -290,7 +295,7 @@ extension AppDelegate {
// MARK: - URL Scheme Handling

extension AppDelegate {
@objc func handleURLEvent(_ event: NSAppleEventDescriptor, withReplyEvent replyEvent: NSAppleEventDescriptor) {
@objc func handleURLEvent(_ event: NSAppleEventDescriptor, withReplyEvent _: NSAppleEventDescriptor) {
guard let urlString = event.paramDescriptor(forKeyword: keyDirectObject)?.stringValue,
let url = URL(string: urlString)
else {
Expand Down
12 changes: 7 additions & 5 deletions apple/InlineMac/App/AppDependencies.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public struct AppDependencies {

// Per window
let nav: Nav = .main
var nav2: Nav2? = nil
var keyMonitor: KeyMonitor?

// Optional
Expand All @@ -26,7 +27,8 @@ public struct AppDependencies {
}

extension View {
func environment(dependencies deps: AppDependencies) -> AnyView {
@ViewBuilder
func environment(dependencies deps: AppDependencies) -> some View {
var result = environment(\.auth, deps.auth)
.environmentObject(deps.viewModel)
.environmentObject(deps.overlay)
Expand All @@ -42,12 +44,12 @@ extension View {
.environment(\.logOut, deps.logOut)
.environment(\.keyMonitor, deps.keyMonitor)
.environment(\.dependencies, deps)
.eraseToAnyView()
.environment(deps.nav2)

if let rootData = deps.rootData {
result = result.environmentObject(rootData).eraseToAnyView()
result.environmentObject(rootData)
} else {
result
}

return result
}
}
Loading