disable the swipe actions when in the "leaving" state

pull/799/head
ryanzhao 2 years ago
parent bf08394ebd
commit 079d6f8c9f

@ -627,6 +627,7 @@ final class HomeVC: BaseVC, UITableViewDataSource, UITableViewDelegate, SeedRemi
return nil
case .threads:
let threadViewModel: SessionThreadViewModel = section.elements[indexPath.row]
if threadViewModel.interactionVariant?.isGroupLeavingStatus == true { return nil }
let hasUnread: Bool = (threadViewModel.threadUnreadCount ?? 0) > 0
let mark: UIContextualAction = UIContextualAction(
title: ((hasUnread) ? "mark_read_button_text".localized() : "mark_unread_button_text".localized()),
@ -686,6 +687,7 @@ final class HomeVC: BaseVC, UITableViewDataSource, UITableViewDelegate, SeedRemi
case .threads:
let threadViewModel: SessionThreadViewModel = section.elements[indexPath.row]
if threadViewModel.interactionVariant?.isGroupLeavingStatus == true { return nil }
let pin: UIContextualAction = UIContextualAction(
title: (threadViewModel.threadIsPinned ? "UNPIN_BUTTON_TEXT".localized() : "PIN_BUTTON_TEXT".localized()),

@ -110,6 +110,15 @@ public struct Interaction: Codable, Identifiable, Equatable, FetchableRecord, Mu
}
}
public var isGroupLeavingStatus: Bool {
switch self {
case .infoClosedGroupCurrentUserLeft, .infoClosedGroupCurrentUserLeaving, .infoClosedGroupCurrentUserErrorLeaving:
return true
default:
return false
}
}
/// This flag controls whether the `wasRead` flag is automatically set to true based on the message variant (as a result it they will
/// or won't affect the unread count)
fileprivate var canBeUnread: Bool {

Loading…
Cancel
Save