Fix Doug's remarks

This commit is contained in:
ismailgulek
2022-01-26 15:58:37 +03:00
parent db2549ebd8
commit d79af0e26d
14 changed files with 83 additions and 59 deletions

View File

@@ -296,7 +296,7 @@ final class ThreadListViewModel: ThreadListViewModelProtocol {
return
}
longPressedThread = threads[index]
viewState = .showingLongPressActions
viewState = .showingLongPressActions(index)
}
private func actionViewInRoom() {
@@ -311,19 +311,22 @@ final class ThreadListViewModel: ThreadListViewModelProtocol {
guard let thread = longPressedThread else {
return
}
if let permalink = MXTools.permalink(toEvent: thread.id, inRoom: thread.roomId) {
MXKPasteboardManager.shared.pasteboard.string = permalink
if let permalink = MXTools.permalink(toEvent: thread.id, inRoom: thread.roomId),
let url = URL(string: permalink) {
MXKPasteboardManager.shared.pasteboard.url = url
viewState = .toastForCopyLink
}
longPressedThread = nil
}
private func actionShare() {
guard let thread = longPressedThread else {
guard let thread = longPressedThread,
let index = threads.firstIndex(of: thread) else {
return
}
if let permalink = MXTools.permalink(toEvent: thread.id, inRoom: thread.roomId) {
viewState = .share(permalink)
if let permalink = MXTools.permalink(toEvent: thread.id, inRoom: thread.roomId),
let url = URL(string: permalink) {
viewState = .share(url, index)
}
longPressedThread = nil
}