mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-10 06:14:10 +01:00
changes
Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
This commit is contained in:
parent
39305d7e96
commit
46efdf4b0c
@ -741,7 +741,7 @@ class ConversationInfoActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!spreedCapabilities.features!!.contains(ARCHIVED_CONVERSATIONS)) {
|
if (!CapabilitiesUtil.isArchiveConversationsAvailable(spreedCapabilities)) {
|
||||||
binding.archiveConversationBtn.visibility = GONE
|
binding.archiveConversationBtn.visibility = GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -750,19 +750,23 @@ class ConversationInfoActivity :
|
|||||||
viewModel.unarchiveConversation(conversationUser, conversationToken)
|
viewModel.unarchiveConversation(conversationUser, conversationToken)
|
||||||
binding.archiveConversationIcon.setImageDrawable(resources.getDrawable(R.drawable.outline_archive_24))
|
binding.archiveConversationIcon.setImageDrawable(resources.getDrawable(R.drawable.outline_archive_24))
|
||||||
binding.archiveConversationText.text = resources.getString(R.string.archive_conversation)
|
binding.archiveConversationText.text = resources.getString(R.string.archive_conversation)
|
||||||
|
binding.archiveConversationTextHint.text = resources.getString(R.string.archive_hint)
|
||||||
} else {
|
} else {
|
||||||
viewModel.archiveConversation(conversationUser, conversationToken)
|
viewModel.archiveConversation(conversationUser, conversationToken)
|
||||||
binding.archiveConversationIcon.setImageDrawable(resources.getDrawable(R.drawable.ic_eye))
|
binding.archiveConversationIcon.setImageDrawable(resources.getDrawable(R.drawable.ic_eye))
|
||||||
binding.archiveConversationText.text = resources.getString(R.string.unarchive_conversation)
|
binding.archiveConversationText.text = resources.getString(R.string.unarchive_conversation)
|
||||||
|
binding.archiveConversationTextHint.text = resources.getString(R.string.unarchive_hint)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conversation!!.hasArchived) {
|
if (conversation!!.hasArchived) {
|
||||||
binding.archiveConversationIcon.setImageDrawable(resources.getDrawable(R.drawable.ic_eye))
|
binding.archiveConversationIcon.setImageDrawable(resources.getDrawable(R.drawable.ic_eye))
|
||||||
binding.archiveConversationText.text = resources.getString(R.string.unarchive_conversation)
|
binding.archiveConversationText.text = resources.getString(R.string.unarchive_conversation)
|
||||||
|
binding.archiveConversationTextHint.text = resources.getString(R.string.unarchive_hint)
|
||||||
} else {
|
} else {
|
||||||
binding.archiveConversationIcon.setImageDrawable(resources.getDrawable(R.drawable.outline_archive_24))
|
binding.archiveConversationIcon.setImageDrawable(resources.getDrawable(R.drawable.outline_archive_24))
|
||||||
binding.archiveConversationText.text = resources.getString(R.string.archive_conversation)
|
binding.archiveConversationText.text = resources.getString(R.string.archive_conversation)
|
||||||
|
binding.archiveConversationTextHint.text = resources.getString(R.string.archive_hint)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isDestroyed) {
|
if (!isDestroyed) {
|
||||||
@ -1469,7 +1473,6 @@ class ConversationInfoActivity :
|
|||||||
private const val DEMOTE_OR_PROMOTE = 1
|
private const val DEMOTE_OR_PROMOTE = 1
|
||||||
private const val REMOVE_FROM_CONVERSATION = 2
|
private const val REMOVE_FROM_CONVERSATION = 2
|
||||||
private const val BAN_FROM_CONVERSATION = 3
|
private const val BAN_FROM_CONVERSATION = 3
|
||||||
private const val ARCHIVED_CONVERSATIONS = "archived-conversations"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -214,7 +214,7 @@ class ConversationInfoViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onError(e: Throwable) {
|
override fun onError(e: Throwable) {
|
||||||
Log.d("Julius", "Error in archive $e")
|
Log.d(TAG, "Error in archive $e")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onComplete() {
|
override fun onComplete() {
|
||||||
@ -222,7 +222,7 @@ class ConversationInfoViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onNext(n: GenericOverall) {
|
override fun onNext(n: GenericOverall) {
|
||||||
Log.d("Julius", "Archived successful")
|
Log.d(TAG, "Archived successful")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -239,7 +239,7 @@ class ConversationInfoViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onError(e: Throwable) {
|
override fun onError(e: Throwable) {
|
||||||
Log.d("Julius", "Error in unarchive $e")
|
Log.d(TAG, "Error in unarchive $e")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onComplete() {
|
override fun onComplete() {
|
||||||
@ -247,7 +247,7 @@ class ConversationInfoViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onNext(n: GenericOverall) {
|
override fun onNext(n: GenericOverall) {
|
||||||
Log.d("Julius", "unArchived successful")
|
Log.d(TAG, "unArchived successful")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -382,7 +382,7 @@ class ConversationsListActivity :
|
|||||||
sortConversations(conversationItemsWithHeader)
|
sortConversations(conversationItemsWithHeader)
|
||||||
|
|
||||||
// Filter Conversations
|
// Filter Conversations
|
||||||
if (!containsTrue()) filterableConversationItems = conversationItems
|
if (!hasFilterEnabled()) filterableConversationItems = conversationItems
|
||||||
filterConversation()
|
filterConversation()
|
||||||
adapter!!.updateDataSet(filterableConversationItems, false)
|
adapter!!.updateDataSet(filterableConversationItems, false)
|
||||||
Handler().postDelayed({ checkToShowUnreadBubble() }, UNREAD_BUBBLE_DELAY.toLong())
|
Handler().postDelayed({ checkToShowUnreadBubble() }, UNREAD_BUBBLE_DELAY.toLong())
|
||||||
@ -397,7 +397,7 @@ class ConversationsListActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun containsTrue(): Boolean {
|
private fun hasFilterEnabled(): Boolean {
|
||||||
for ((k, v) in filterState) {
|
for ((k, v) in filterState) {
|
||||||
if (k != FilterConversationFragment.DEFAULT && v) return true
|
if (k != FilterConversationFragment.DEFAULT && v) return true
|
||||||
}
|
}
|
||||||
@ -473,7 +473,7 @@ class ConversationsListActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.d("Julius", "Conversation: ${conversation.name} Result: $result")
|
Log.d(TAG, "Conversation: ${conversation.name} Result: $result")
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -670,7 +670,7 @@ class ConversationsListActivity :
|
|||||||
override fun onMenuItemActionExpand(item: MenuItem): Boolean {
|
override fun onMenuItemActionExpand(item: MenuItem): Boolean {
|
||||||
initSearchDisposable()
|
initSearchDisposable()
|
||||||
adapter!!.setHeadersShown(true)
|
adapter!!.setHeadersShown(true)
|
||||||
if (!containsTrue()) filterableConversationItems = searchableConversationItems
|
if (!hasFilterEnabled()) filterableConversationItems = searchableConversationItems
|
||||||
adapter!!.updateDataSet(filterableConversationItems, false)
|
adapter!!.updateDataSet(filterableConversationItems, false)
|
||||||
adapter!!.showAllHeaders()
|
adapter!!.showAllHeaders()
|
||||||
binding.swipeRefreshLayoutView?.isEnabled = false
|
binding.swipeRefreshLayoutView?.isEnabled = false
|
||||||
@ -680,7 +680,7 @@ class ConversationsListActivity :
|
|||||||
|
|
||||||
override fun onMenuItemActionCollapse(item: MenuItem): Boolean {
|
override fun onMenuItemActionCollapse(item: MenuItem): Boolean {
|
||||||
adapter!!.setHeadersShown(false)
|
adapter!!.setHeadersShown(false)
|
||||||
if (!containsTrue()) filterableConversationItems = conversationItemsWithHeader
|
if (!hasFilterEnabled()) filterableConversationItems = conversationItemsWithHeader
|
||||||
adapter!!.updateDataSet(filterableConversationItems, false)
|
adapter!!.updateDataSet(filterableConversationItems, false)
|
||||||
adapter!!.hideAllHeaders()
|
adapter!!.hideAllHeaders()
|
||||||
if (searchHelper != null) {
|
if (searchHelper != null) {
|
||||||
@ -1847,7 +1847,7 @@ class ConversationsListActivity :
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun updateFilterConversationButtonColor() {
|
fun updateFilterConversationButtonColor() {
|
||||||
if (containsTrue()) {
|
if (hasFilterEnabled()) {
|
||||||
binding.filterConversationsButton.let { viewThemeUtils.platform.colorImageView(it, ColorRole.PRIMARY) }
|
binding.filterConversationsButton.let { viewThemeUtils.platform.colorImageView(it, ColorRole.PRIMARY) }
|
||||||
} else {
|
} else {
|
||||||
binding.filterConversationsButton.let {
|
binding.filterConversationsButton.let {
|
||||||
|
@ -40,6 +40,13 @@ object Migrations {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val MIGRATION_11_12 = object : Migration(11, 12) {
|
||||||
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
|
Log.i("Migrations", "Migrating 11 to 12")
|
||||||
|
addArchiveConversations(db)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun migrateToRoom(db: SupportSQLiteDatabase) {
|
fun migrateToRoom(db: SupportSQLiteDatabase) {
|
||||||
db.execSQL(
|
db.execSQL(
|
||||||
"CREATE TABLE User_new (" +
|
"CREATE TABLE User_new (" +
|
||||||
@ -237,4 +244,16 @@ object Migrations {
|
|||||||
"ON `ChatBlocks` (`internalConversationId`)"
|
"ON `ChatBlocks` (`internalConversationId`)"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun addArchiveConversations(db: SupportSQLiteDatabase) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
db.execSQL(
|
||||||
|
"ALTER TABLE Conversations " +
|
||||||
|
"ADD `hasArchived` INTEGER;"
|
||||||
|
)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.i("Migrations", "hasArchived already exists")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,9 +49,9 @@ import java.util.Locale
|
|||||||
ChatMessageEntity::class,
|
ChatMessageEntity::class,
|
||||||
ChatBlockEntity::class
|
ChatBlockEntity::class
|
||||||
],
|
],
|
||||||
version = 11,
|
version = 12,
|
||||||
autoMigrations = [
|
autoMigrations = [
|
||||||
AutoMigration(from = 9, to = 10)
|
AutoMigration(from = 9, to = 11)
|
||||||
],
|
],
|
||||||
exportSchema = true
|
exportSchema = true
|
||||||
)
|
)
|
||||||
@ -113,7 +113,8 @@ abstract class TalkDatabase : RoomDatabase() {
|
|||||||
Migrations.MIGRATION_6_8,
|
Migrations.MIGRATION_6_8,
|
||||||
Migrations.MIGRATION_7_8,
|
Migrations.MIGRATION_7_8,
|
||||||
Migrations.MIGRATION_8_9,
|
Migrations.MIGRATION_8_9,
|
||||||
Migrations.MIGRATION_10_11
|
Migrations.MIGRATION_10_11,
|
||||||
|
Migrations.MIGRATION_11_12
|
||||||
)
|
)
|
||||||
.allowMainThreadQueries()
|
.allowMainThreadQueries()
|
||||||
.addCallback(
|
.addCallback(
|
||||||
|
@ -55,7 +55,8 @@ enum class SpreedFeatures(val value: String) {
|
|||||||
FEDERATION_V1("federation-v1"),
|
FEDERATION_V1("federation-v1"),
|
||||||
DELETE_MESSAGES_UNLIMITED("delete-messages-unlimited"),
|
DELETE_MESSAGES_UNLIMITED("delete-messages-unlimited"),
|
||||||
BAN_V1("ban-v1"),
|
BAN_V1("ban-v1"),
|
||||||
EDIT_MESSAGES_NOTE_TO_SELF("edit-messages-note-to-self")
|
EDIT_MESSAGES_NOTE_TO_SELF("edit-messages-note-to-self"),
|
||||||
|
ARCHIVE_CONVERSATIONS("archived-conversations")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("TooManyFunctions")
|
@Suppress("TooManyFunctions")
|
||||||
@ -255,6 +256,10 @@ object CapabilitiesUtil {
|
|||||||
user.capabilities!!.spreedCapability!!.config!!["federation"]!!.containsKey("enabled")
|
user.capabilities!!.spreedCapability!!.config!!["federation"]!!.containsKey("enabled")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun isArchiveConversationsAvailable(spreedCapabilities: SpreedCapability): Boolean {
|
||||||
|
return hasSpreedFeatureCapability(spreedCapabilities, SpreedFeatures.ARCHIVE_CONVERSATIONS)
|
||||||
|
}
|
||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
//region ThemingCapabilities
|
//region ThemingCapabilities
|
||||||
|
@ -414,6 +414,13 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<com.google.android.material.textview.MaterialTextView
|
||||||
|
android:id="@+id/archive_conversation_text_hint"
|
||||||
|
android:layout_marginHorizontal="@dimen/standard_margin"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/archive_hint" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/danger_zone_options"
|
android:id="@+id/danger_zone_options"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -818,4 +818,6 @@ How to translate with transifex:
|
|||||||
<string name="archive_conversation">Archive Conversation</string>
|
<string name="archive_conversation">Archive Conversation</string>
|
||||||
<string name="unarchive_conversation">Unarchive Conversation</string>
|
<string name="unarchive_conversation">Unarchive Conversation</string>
|
||||||
<string name="archived">Archived</string>
|
<string name="archived">Archived</string>
|
||||||
|
<string name="archive_hint">Once a conversation is archived, it will be hidden by default. Select the filter \'Archived\' to view archived conversations. Direct mentions will still be received.</string>
|
||||||
|
<string name="unarchive_hint">Once a conversation is unarchived, it will be shown by default again.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user