Skip to content

Commit

Permalink
Merge pull request #1542 from nextcloud/adjust-message-editing
Browse files Browse the repository at this point in the history
Adjust message editing
  • Loading branch information
Ivansss authored Feb 16, 2024
2 parents 722400b + 2a09c80 commit 32512a8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion NextcloudTalk/ChatViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,7 @@ import UIKit
let timestampDate = Date(timeIntervalSince1970: TimeInterval(message.lastEditTimestamp))

let editInfo = UIAction(title: NSLocalizedString("Edited by", comment: "A message was edited by ...") + " " + lastEditActorDisplayName, attributes: [.disabled], handler: {_ in })
editInfo.subtitle = NCUtils.readableTimeOrDate(fromDate: timestampDate)
editInfo.subtitle = NCUtils.readableTimeAndDate(fromDate: timestampDate)

actions.append(UIMenu(options: [.displayInline], children: [editInfo]))
}
Expand Down
6 changes: 6 additions & 0 deletions NextcloudTalk/InputbarViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ import UIKit
self.textInputbar.editorLeftButton.tintColor = .systemBlue
self.textInputbar.editorRightButton.tintColor = .systemBlue

self.textInputbar.editorLeftButton.setImage(.init(systemName: "xmark"), for: .normal)
self.textInputbar.editorRightButton.setImage(.init(systemName: "checkmark"), for: .normal)

self.textInputbar.editorLeftButton.setTitle("", for: .normal)
self.textInputbar.editorRightButton.setTitle("", for: .normal)

self.navigationController?.navigationBar.tintColor = NCAppBranding.themeTextColor()
self.navigationController?.navigationBar.barTintColor = NCAppBranding.themeColor()
self.navigationController?.navigationBar.isTranslucent = false
Expand Down
12 changes: 12 additions & 0 deletions NextcloudTalk/NCUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,18 @@ import UniformTypeIdentifiers
return dateFormatter.string(from: date)
}

public static func readableTimeAndDate(fromDate date: Date) -> String {
if Calendar.current.isDateInToday(date) {
return self.getTime(fromDate: date)
}

let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .medium
dateFormatter.timeStyle = .short

return dateFormatter.string(from: date)
}

public static func getTime(fromDate date: Date) -> String {
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .none
Expand Down

0 comments on commit 32512a8

Please sign in to comment.