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