mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +00:00
clean
This commit is contained in:
parent
d9eb2c7585
commit
b03ba5bfa7
@ -178,7 +178,7 @@ class DatabaseAttachmentProvider(context: Context, helper: SQLCipherOpenHelper)
|
|||||||
override fun updateMessageAsDeleted(timestamp: Long, author: String) {
|
override fun updateMessageAsDeleted(timestamp: Long, author: String) {
|
||||||
val database = DatabaseFactory.getMmsSmsDatabase(context)
|
val database = DatabaseFactory.getMmsSmsDatabase(context)
|
||||||
val address = Address.fromSerialized(author)
|
val address = Address.fromSerialized(author)
|
||||||
val message = database.getMessageFor(timestamp, address)!!
|
val message = database.getMessageFor(timestamp, address) ?: return
|
||||||
val messagingDatabase: MessagingDatabase = if (message.isMms) DatabaseFactory.getMmsDatabase(context)
|
val messagingDatabase: MessagingDatabase = if (message.isMms) DatabaseFactory.getMmsDatabase(context)
|
||||||
else DatabaseFactory.getSmsDatabase(context)
|
else DatabaseFactory.getSmsDatabase(context)
|
||||||
messagingDatabase.markAsDeleted(message.id, message.isRead)
|
messagingDatabase.markAsDeleted(message.id, message.isRead)
|
||||||
|
@ -211,7 +211,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
const val INVITE_CONTACTS = 124
|
const val INVITE_CONTACTS = 124
|
||||||
|
|
||||||
//flag
|
//flag
|
||||||
val isUnsendRequestsEnabled = false
|
const val IS_UNSEND_REQUESTS_ENABLED = false
|
||||||
}
|
}
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
@ -1121,7 +1121,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
stopAudioHandler.removeCallbacks(stopVoiceMessageRecordingTask)
|
stopAudioHandler.removeCallbacks(stopVoiceMessageRecordingTask)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildUsendRequest(message: MessageRecord): UnsendRequest? {
|
private fun buildUnsendRequest(message: MessageRecord): UnsendRequest? {
|
||||||
if (this.thread.isOpenGroupRecipient) return null
|
if (this.thread.isOpenGroupRecipient) return null
|
||||||
val messageDataProvider = MessagingModuleConfiguration.shared.messageDataProvider
|
val messageDataProvider = MessagingModuleConfiguration.shared.messageDataProvider
|
||||||
messageDataProvider.getServerHashForMessage(message.id) ?: return null
|
messageDataProvider.getServerHashForMessage(message.id) ?: return null
|
||||||
@ -1137,7 +1137,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun deleteLocally(message: MessageRecord) {
|
private fun deleteLocally(message: MessageRecord) {
|
||||||
buildUsendRequest(message)?.let { unsendRequest ->
|
buildUnsendRequest(message)?.let { unsendRequest ->
|
||||||
TextSecurePreferences.getLocalNumber(this@ConversationActivityV2)?.let {
|
TextSecurePreferences.getLocalNumber(this@ConversationActivityV2)?.let {
|
||||||
MessageSender.send(unsendRequest, Address.fromSerialized(it))
|
MessageSender.send(unsendRequest, Address.fromSerialized(it))
|
||||||
}
|
}
|
||||||
@ -1146,7 +1146,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun deleteForEveryone(message: MessageRecord) {
|
private fun deleteForEveryone(message: MessageRecord) {
|
||||||
buildUsendRequest(message)?.let { unsendRequest ->
|
buildUnsendRequest(message)?.let { unsendRequest ->
|
||||||
MessageSender.send(unsendRequest, thread.address)
|
MessageSender.send(unsendRequest, thread.address)
|
||||||
}
|
}
|
||||||
val messageDataProvider = MessagingModuleConfiguration.shared.messageDataProvider
|
val messageDataProvider = MessagingModuleConfiguration.shared.messageDataProvider
|
||||||
@ -1218,7 +1218,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun deleteMessages(messages: Set<MessageRecord>) {
|
override fun deleteMessages(messages: Set<MessageRecord>) {
|
||||||
if (!isUnsendRequestsEnabled) {
|
if (!IS_UNSEND_REQUESTS_ENABLED) {
|
||||||
deleteMessagesWithoutUnsendRequest(messages)
|
deleteMessagesWithoutUnsendRequest(messages)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -38,14 +38,14 @@ class ConversationActionModeCallback(private val adapter: ConversationAdapter, p
|
|||||||
val allSentByCurrentUser = selectedItems.all { it.isOutgoing }
|
val allSentByCurrentUser = selectedItems.all { it.isOutgoing }
|
||||||
|
|
||||||
// Remove this after the unsend request is enabled
|
// Remove this after the unsend request is enabled
|
||||||
if (!ConversationActivityV2.isUnsendRequestsEnabled) {
|
if (!ConversationActivityV2.IS_UNSEND_REQUESTS_ENABLED) {
|
||||||
if (openGroup == null) { return true }
|
if (openGroup == null) { return true }
|
||||||
if (allSentByCurrentUser) { return true }
|
if (allSentByCurrentUser) { return true }
|
||||||
return OpenGroupAPIV2.isUserModerator(userPublicKey, openGroup.room, openGroup.server)
|
return OpenGroupAPIV2.isUserModerator(userPublicKey, openGroup.room, openGroup.server)
|
||||||
}
|
}
|
||||||
|
|
||||||
val allReceivedByByCurrentUser = selectedItems.all { !it.isOutgoing }
|
val allReceivedByCurrentUser = selectedItems.all { !it.isOutgoing }
|
||||||
if (openGroup == null) { return allSentByCurrentUser || allReceivedByByCurrentUser }
|
if (openGroup == null) { return allSentByCurrentUser || allReceivedByCurrentUser }
|
||||||
if (allSentByCurrentUser) { return true }
|
if (allSentByCurrentUser) { return true }
|
||||||
return OpenGroupAPIV2.isUserModerator(userPublicKey, openGroup.room, openGroup.server)
|
return OpenGroupAPIV2.isUserModerator(userPublicKey, openGroup.room, openGroup.server)
|
||||||
}
|
}
|
||||||
|
@ -13,13 +13,13 @@
|
|||||||
android:id="@+id/deleteForMeTextView"
|
android:id="@+id/deleteForMeTextView"
|
||||||
style="@style/BottomSheetActionItem"
|
style="@style/BottomSheetActionItem"
|
||||||
android:text="@string/delete_message_for_me"
|
android:text="@string/delete_message_for_me"
|
||||||
android:textColor="@color/core_red"/>
|
android:textColor="@color/destructive"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/deleteForEveryoneTextView"
|
android:id="@+id/deleteForEveryoneTextView"
|
||||||
style="@style/BottomSheetActionItem"
|
style="@style/BottomSheetActionItem"
|
||||||
android:text="@string/delete_message_for_everyone"
|
android:text="@string/delete_message_for_everyone"
|
||||||
android:textColor="@color/core_red"/>
|
android:textColor="@color/destructive"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/cancelTextView"
|
android:id="@+id/cancelTextView"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user