Skip to content

Commit

Permalink
Merge pull request #1632 from nextcloud/macos-fixes
Browse files Browse the repository at this point in the history
Macos fixes
  • Loading branch information
Ivansss committed Apr 25, 2024
2 parents 6008a40 + b9e8f13 commit 503986d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
7 changes: 7 additions & 0 deletions NextcloudTalk/ChatViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1580,6 +1580,13 @@ import UIKit
})
}

// Show "Add reaction" when running on MacOS because we don't have an accessory view
if self.isMessageReactable(message: message), hasChatPermissions, NCUtils.isiOSAppOnMac() {
actions.append(UIAction(title: NSLocalizedString("Add reaction", comment: ""), image: .init(systemName: "face.smiling")) { _ in
self.didPressAddReaction(for: message, at: indexPath)
})
}

// Reply-privately option (only to other users and not in one-to-one)
if self.isMessageReplyable(message: message), self.room.type != kNCRoomTypeOneToOne, message.actorType == "users", message.actorId != activeAccount.userId {
actions.append(UIAction(title: NSLocalizedString("Reply privately", comment: ""), image: .init(systemName: "person")) { _ in
Expand Down
11 changes: 10 additions & 1 deletion NextcloudTalk/InputbarViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ import UIKit
self.textView.layoutSubviews()
self.textView.layer.cornerRadius = self.textView.frame.size.height / 2

// Need a compile-time check here for old xcode version on CI
#if swift(>=5.9)
if #available(iOS 17.0, *), NCUtils.isiOSAppOnMac() {
self.textView.inlinePredictionType = .no
}
#endif

self.textInputbar.editorTitle.textColor = .darkGray
self.textInputbar.editorLeftButton.tintColor = .systemBlue
self.textInputbar.editorRightButton.tintColor = .systemBlue
Expand Down Expand Up @@ -191,7 +198,9 @@ import UIKit

func setTitleView() {
let titleView = NCChatTitleView()
titleView.frame = .init(x: 0, y: 0, width: Int.max, height: 30)

// Int.max is problematic when running on MacOS, so we use Int32.max here
titleView.frame = .init(x: 0, y: 0, width: Int(Int32.max), height: 30)
titleView.delegate = self
titleView.titleTextView.accessibilityHint = NSLocalizedString("Double tap to go to conversation information", comment: "")

Expand Down
6 changes: 6 additions & 0 deletions NextcloudTalk/NCSplitViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@
}

func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) {
if NCUtils.isiOSAppOnMac() {
// When the app is running on MacOS there's a gap between the titleBar and the navigationBar.
// We can remove that gap when setting a negative additionalSafeAreaInsets.top
navigationController.additionalSafeAreaInsets.top = -navigationController.navigationBar.frame.maxY
}

if !isCollapsed {
return
}
Expand Down
3 changes: 3 additions & 0 deletions NextcloudTalk/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@
/* No comment provided by engineer. */
"Add participants" = "Add participants";

/* No comment provided by engineer. */
"Add reaction" = "Add reaction";

/* No comment provided by engineer. */
"Add to favorites" = "Add to favorites";

Expand Down

0 comments on commit 503986d

Please sign in to comment.