|
|
@ -25,29 +25,13 @@ extension ConversationVC:
|
|
|
|
// Don't take the user to settings for unapproved threads
|
|
|
|
// Don't take the user to settings for unapproved threads
|
|
|
|
guard viewModel.threadData.threadRequiresApproval == false else { return }
|
|
|
|
guard viewModel.threadData.threadRequiresApproval == false else { return }
|
|
|
|
|
|
|
|
|
|
|
|
openSettings()
|
|
|
|
openSettingsFromTitleView()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@objc func openSettings() {
|
|
|
|
@objc func openSettingsFromTitleView() {
|
|
|
|
switch self.titleView.currentLabelType {
|
|
|
|
switch self.titleView.currentLabelType {
|
|
|
|
case.empty, .notificationSettings, .userCount:
|
|
|
|
case.empty, .notificationSettings, .userCount:
|
|
|
|
let viewController = SessionTableViewController(viewModel: ThreadSettingsViewModel(
|
|
|
|
openSettings()
|
|
|
|
threadId: self.viewModel.threadData.threadId,
|
|
|
|
|
|
|
|
threadVariant: self.viewModel.threadData.threadVariant,
|
|
|
|
|
|
|
|
didTriggerSearch: { [weak self] in
|
|
|
|
|
|
|
|
DispatchQueue.main.async {
|
|
|
|
|
|
|
|
self?.showSearchUI()
|
|
|
|
|
|
|
|
self?.popAllConversationSettingsViews {
|
|
|
|
|
|
|
|
// Note: Without this delay the search bar doesn't show
|
|
|
|
|
|
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
|
|
|
|
|
|
|
self?.searchController.uiSearchController.searchBar.becomeFirstResponder()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
navigationController?.pushViewController(viewController, animated: true)
|
|
|
|
|
|
|
|
break
|
|
|
|
break
|
|
|
|
case .disappearingMessageSetting:
|
|
|
|
case .disappearingMessageSetting:
|
|
|
|
let viewController = SessionTableViewController(viewModel: ThreadDisappearingMessagesViewModel(
|
|
|
|
let viewController = SessionTableViewController(viewModel: ThreadDisappearingMessagesViewModel(
|
|
|
@ -62,6 +46,26 @@ extension ConversationVC:
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@objc func openSettings() {
|
|
|
|
|
|
|
|
let viewController = SessionTableViewController(viewModel: ThreadSettingsViewModel(
|
|
|
|
|
|
|
|
threadId: self.viewModel.threadData.threadId,
|
|
|
|
|
|
|
|
threadVariant: self.viewModel.threadData.threadVariant,
|
|
|
|
|
|
|
|
didTriggerSearch: { [weak self] in
|
|
|
|
|
|
|
|
DispatchQueue.main.async {
|
|
|
|
|
|
|
|
self?.showSearchUI()
|
|
|
|
|
|
|
|
self?.popAllConversationSettingsViews {
|
|
|
|
|
|
|
|
// Note: Without this delay the search bar doesn't show
|
|
|
|
|
|
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
|
|
|
|
|
|
|
self?.searchController.uiSearchController.searchBar.becomeFirstResponder()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
navigationController?.pushViewController(viewController, animated: true)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// MARK: - ScrollToBottomButtonDelegate
|
|
|
|
// MARK: - ScrollToBottomButtonDelegate
|
|
|
|
|
|
|
|
|
|
|
|
func handleScrollToBottomButtonTapped() {
|
|
|
|
func handleScrollToBottomButtonTapped() {
|
|
|
@ -452,13 +456,6 @@ extension ConversationVC:
|
|
|
|
body: text,
|
|
|
|
body: text,
|
|
|
|
timestampMs: sentTimestampMs,
|
|
|
|
timestampMs: sentTimestampMs,
|
|
|
|
hasMention: Interaction.isUserMentioned(db, threadId: threadId, body: text),
|
|
|
|
hasMention: Interaction.isUserMentioned(db, threadId: threadId, body: text),
|
|
|
|
// No matter the disappearing message type is D.A.R or D.A.S, it is the same on the sender's side
|
|
|
|
|
|
|
|
expiresInSeconds: try? DisappearingMessagesConfiguration
|
|
|
|
|
|
|
|
.select(.durationSeconds)
|
|
|
|
|
|
|
|
.filter(id: threadId)
|
|
|
|
|
|
|
|
.filter(DisappearingMessagesConfiguration.Columns.isEnabled == true)
|
|
|
|
|
|
|
|
.asRequest(of: TimeInterval.self)
|
|
|
|
|
|
|
|
.fetchOne(db),
|
|
|
|
|
|
|
|
linkPreviewUrl: linkPreviewDraft?.urlString
|
|
|
|
linkPreviewUrl: linkPreviewDraft?.urlString
|
|
|
|
).inserted(db)
|
|
|
|
).inserted(db)
|
|
|
|
|
|
|
|
|
|
|
@ -575,13 +572,7 @@ extension ConversationVC:
|
|
|
|
variant: .standardOutgoing,
|
|
|
|
variant: .standardOutgoing,
|
|
|
|
body: text,
|
|
|
|
body: text,
|
|
|
|
timestampMs: sentTimestampMs,
|
|
|
|
timestampMs: sentTimestampMs,
|
|
|
|
hasMention: Interaction.isUserMentioned(db, threadId: threadId, body: text),
|
|
|
|
hasMention: Interaction.isUserMentioned(db, threadId: threadId, body: text)
|
|
|
|
expiresInSeconds: try? DisappearingMessagesConfiguration
|
|
|
|
|
|
|
|
.select(.durationSeconds)
|
|
|
|
|
|
|
|
.filter(id: threadId)
|
|
|
|
|
|
|
|
.filter(DisappearingMessagesConfiguration.Columns.isEnabled == true)
|
|
|
|
|
|
|
|
.asRequest(of: TimeInterval.self)
|
|
|
|
|
|
|
|
.fetchOne(db)
|
|
|
|
|
|
|
|
).inserted(db)
|
|
|
|
).inserted(db)
|
|
|
|
|
|
|
|
|
|
|
|
try MessageSender.send(
|
|
|
|
try MessageSender.send(
|
|
|
|