Improvements to logging (#457)

* Use `.info` logging in most places.
* Remove old objc logging support.
* Fix table view controller.
* Make sure timeline item content isn't logged.
* Add tests.
This commit is contained in:
Doug
2023-01-17 09:28:01 +00:00
committed by GitHub
parent 4b56e4af73
commit c8937505d7
57 changed files with 542 additions and 275 deletions
@@ -49,10 +49,10 @@ final class RoomScreenCoordinator: CoordinatorProtocol {
// MARK: - Public
func start() {
viewModel?.callback = { [weak self] result in
viewModel?.callback = { [weak self] action in
guard let self else { return }
MXLog.debug("RoomScreenViewModel did complete with result: \(result).")
switch result {
switch action {
case .displayRoomDetails:
self.displayRoomDetails()
case .displayVideo(let fileURL, let title), .displayFile(let fileURL, let title):
@@ -103,8 +103,8 @@ final class RoomScreenCoordinator: CoordinatorProtocol {
coordinator.callback = { [weak self] action in
switch action {
case let .emojiSelected(emoji: emoji, itemId: itemId):
MXLog.debug("Selected \(emoji) for \(itemId)")
self?.navigationStackCoordinator.setSheetCoordinator(nil)
MXLog.debug("Save \(emoji) for \(itemId)")
Task {
await timelineController.sendReaction(emoji, for: itemId)
}
@@ -242,8 +242,6 @@ class TimelineTableViewController: UIViewController {
updateTopPadding()
guard snapshot.numberOfItems != previousLayout.numberOfItems else { return }
if previousLayout.isBottomVisible {
scrollToBottom(animated: false)
} else if let pinnedItem = previousLayout.pinnedItem {
@@ -357,15 +355,19 @@ class TimelineTableViewController: UIViewController {
extension TimelineTableViewController: UITableViewDelegate {
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let isAtBottom = isAtBottom()
// Only update the binding on changes to avoid needlessly recomputing the hierarchy when scrolling.
if scrollToBottomButtonVisible != isAtBottom {
// Dispatch to fix runtime warning about making changes during a view update.
DispatchQueue.main.async { self.scrollToBottomButtonVisible = isAtBottom }
}
paginateBackwardsPublisher.send(())
// Dispatch to fix runtime warning about making changes during a view update.
DispatchQueue.main.async { [weak self] in
guard let self else { return }
let isAtBottom = self.isAtBottom()
// Only update the binding on changes to avoid needlessly recomputing the hierarchy when scrolling.
if self.scrollToBottomButtonVisible != isAtBottom {
self.scrollToBottomButtonVisible = isAtBottom
}
}
}
// MARK: ScrollViewAdapter Methods