Merge pull request #995 from RyanRory/observing-sogs-permission-change

Show message input box when permission changed in a convo
pull/1006/head
Morgan Pretty 9 months ago committed by GitHub
commit 009c017ca2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -804,9 +804,11 @@ extension ConversationVC:
} }
func hideInputAccessoryView() { func hideInputAccessoryView() {
DispatchQueue.main.async {
self.inputAccessoryView?.isHidden = true self.inputAccessoryView?.isHidden = true
self.inputAccessoryView?.alpha = 0 self.inputAccessoryView?.alpha = 0
} }
}
func showInputAccessoryView() { func showInputAccessoryView() {
UIView.animate(withDuration: 0.25, animations: { UIView.animate(withDuration: 0.25, animations: {

@ -74,9 +74,11 @@ final class ConversationVC: BaseVC, LibSessionRespondingViewController, Conversa
} }
override var inputAccessoryView: UIView? { override var inputAccessoryView: UIView? {
guard viewModel.threadData.canWrite else { return nil } return (
(viewModel.threadData.canWrite && isShowingSearchUI) ?
return (isShowingSearchUI ? searchController.resultsBar : snInputView) searchController.resultsBar :
snInputView
)
} }
/// The height of the visible part of the table view, i.e. the distance from the navigation bar (where the table view's origin is) /// The height of the visible part of the table view, i.e. the distance from the navigation bar (where the table view's origin is)
@ -750,6 +752,12 @@ final class ConversationVC: BaseVC, LibSessionRespondingViewController, Conversa
viewModel.threadData.threadIsMessageRequest != updatedThreadData.threadIsMessageRequest || viewModel.threadData.threadIsMessageRequest != updatedThreadData.threadIsMessageRequest ||
viewModel.threadData.threadRequiresApproval != updatedThreadData.threadRequiresApproval viewModel.threadData.threadRequiresApproval != updatedThreadData.threadRequiresApproval
{ {
if updatedThreadData.canWrite {
self.showInputAccessoryView()
} else {
self.hideInputAccessoryView()
}
let messageRequestsViewWasVisible: Bool = (self.messageRequestFooterView.isHidden == false) let messageRequestsViewWasVisible: Bool = (self.messageRequestFooterView.isHidden == false)
UIView.animate(withDuration: 0.3) { [weak self] in UIView.animate(withDuration: 0.3) { [weak self] in

@ -491,14 +491,12 @@ extension OpenGroupAPI {
return true return true
} }
// Note: This might need to be updated in the future when we start tracking
// user permissions if changes to permissions don't trigger a change to
// the 'infoUpdates'
return ( return (
responseBody.activeUsers != existingOpenGroup.userCount || ( responseBody.activeUsers != existingOpenGroup.userCount || (
responseBody.details != nil && responseBody.details != nil &&
responseBody.details?.infoUpdates != existingOpenGroup.infoUpdates responseBody.details?.infoUpdates != existingOpenGroup.infoUpdates
) ) ||
OpenGroup.Permissions(roomInfo: responseBody) != existingOpenGroup.permissions
) )
default: return true default: return true

Loading…
Cancel
Save