diff --git a/Moc.xcodeproj/project.pbxproj b/Moc.xcodeproj/project.pbxproj index 531dafba..f351fc95 100644 --- a/Moc.xcodeproj/project.pbxproj +++ b/Moc.xcodeproj/project.pbxproj @@ -144,7 +144,7 @@ 43C227D128CB097A00AE237C /* View+Faded.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43C227D028CB097A00AE237C /* View+Faded.swift */; }; 43C29C04287D8D9E00D10AB8 /* Animation+FastStartSlowStop.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43C29C03287D8D9E00D10AB8 /* Animation+FastStartSlowStop.swift */; }; 43EC18E22856782F00FCAD43 /* SearchField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43EC18E12856782F00FCAD43 /* SearchField.swift */; platformFilter = ios; }; - 43F610FB28AFB8AE0098C3BD /* VisualEffectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43F610FA28AFB8AE0098C3BD /* VisualEffectView.swift */; }; + 43F610FB28AFB8AE0098C3BD /* VisualEffectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43F610FA28AFB8AE0098C3BD /* VisualEffectView.swift */; platformFilters = (macos, ); }; 43F610FE28B01E830098C3BD /* MessageBubbleShape.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43F610FD28B01E830098C3BD /* MessageBubbleShape.swift */; }; 43F7C504287DCFB40083E9E9 /* ScrollOffsetPreferenceKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43F7C503287DCFB40083E9E9 /* ScrollOffsetPreferenceKey.swift */; }; 43F7D4CF28DA65FF00878BD8 /* Color+ContrastRatio.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43F7D4CE28DA65FE00878BD8 /* Color+ContrastRatio.swift */; }; diff --git a/Shared/Utils/Color+DynamicUserID.swift b/Shared/Utils/Color+DynamicUserID.swift index 3c1cfcaa..73b66f2e 100644 --- a/Shared/Utils/Color+DynamicUserID.swift +++ b/Shared/Utils/Color+DynamicUserID.swift @@ -65,9 +65,11 @@ extension Color { @unknown default: newLuminosity = 0.6 } - - let nsColor = NSColor(self) - guard let coreColour = CIColor(color: nsColor) else { return self } + #if os(macOS) + guard let coreColour = CIColor(color: NSColor(self)) else { return self } + #elseif os(iOS) + let coreColour = CIColor(color: UIColor(self)) + #endif var red = coreColour.red var green = coreColour.green var blue = coreColour.blue diff --git a/Shared/Views/Common/FormattedTextView.swift b/Shared/Views/Common/FormattedTextView.swift index a25a9734..7f5fc57e 100644 --- a/Shared/Views/Common/FormattedTextView.swift +++ b/Shared/Views/Common/FormattedTextView.swift @@ -39,13 +39,13 @@ struct FormattedTextView: View { switch entity.type { case .bold: - if #available(macOS 13.0, *) { + if #available(macOS 13, iOS 16, *) { resultString[range].font = .system(.body, weight: .bold) } else { resultString[range].font = .body.bold() } case .italic: - if #available(macOS 13.0, *) { + if #available(macOS 13, iOS 16, *) { resultString[range].font = .system(.body).italic() } else { resultString[range].font = .body.italic() @@ -54,17 +54,25 @@ struct FormattedTextView: View { case .url: resultString[range].link = URL(string: rawStringPart) resultString[range].underlineStyle = .single + #if os(macOS) resultString[range].cursor = .pointingHand + #endif case let .textUrl(info): resultString[range].link = URL(string: info.url) resultString[range].underlineStyle = .single + #if os(macOS) resultString[range].cursor = .pointingHand + #endif case .phoneNumber: resultString[range].link = URL(string: "tel:\(rawStringPart)") + #if os(macOS) resultString[range].cursor = .pointingHand + #endif case .emailAddress: resultString[range].link = URL(string: "mailto:\(rawStringPart)") + #if os(macOS) resultString[range].cursor = .pointingHand + #endif default: break } diff --git a/Shared/Views/RootView.swift b/Shared/Views/RootView.swift index 2f0ba45a..1bcab5da 100644 --- a/Shared/Views/RootView.swift +++ b/Shared/Views/RootView.swift @@ -58,7 +58,7 @@ struct RootView: View { openedChat = instance } - private var chatList: some View { + private var chatListView: some View { ScrollView { LazyVStack { ForEach(viewModel.chatList) { chat in @@ -163,10 +163,12 @@ struct RootView: View { } } + #if os(macOS) private func toggleSidebar() { NSApp.keyWindow?.firstResponder?.tryToPerform( #selector(NSSplitViewController.toggleSidebar(_:)), with: nil) } + #endif private func makeFolderItem( name: String, @@ -206,7 +208,7 @@ struct RootView: View { } .buttonStyle(.plain) #if os(iOS) - .hoverEffect(viewModel.openChatList == chatList ? .lift : .highlight) + .hoverEffect(.lift) #endif } @@ -305,7 +307,7 @@ struct RootView: View { Group { switch selectedTab { case .chat: - chatList + chatListView case .contacts: Text("Contacts") case .calls: diff --git a/Storage/Sources/Storage/StorageService.swift b/Storage/Sources/Storage/StorageService.swift index 7455f081..d8284d0c 100644 --- a/Storage/Sources/Storage/StorageService.swift +++ b/Storage/Sources/Storage/StorageService.swift @@ -50,7 +50,7 @@ public class StorageService { } else { dir = url.path } - if #available(macOS 13.0, *) { + if #available(macOS 13, iOS 16, *) { dir.replace("%20", with: " ") } else { dir = dir.replacingOccurrences(of: "%20", with: " ")