Switched to admin based ephemeral mode
This commit is contained in:
parent
20543832b5
commit
336e8510b9
6 changed files with 14 additions and 10 deletions
|
@ -668,14 +668,15 @@ class DetailChatRoomFragment : MasterFragment<ChatRoomDetailFragmentBinding, Cha
|
|||
}
|
||||
|
||||
if (viewModel.ephemeralChatRoom) {
|
||||
if (chatRoom.currentParams.ephemeralMode == ChatRoomEphemeralMode.AdminManaged &&
|
||||
viewModel.meAdmin.value == false
|
||||
) {
|
||||
if (chatRoom.currentParams.ephemeralMode == ChatRoomEphemeralMode.AdminManaged) {
|
||||
if (chatRoom.me?.isAdmin == false) {
|
||||
Log.w("[Chat Room] Hiding ephemeral menu as mode is admin managed and we aren't admin")
|
||||
popupView.ephemeralHidden = true
|
||||
totalSize -= itemSize
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// When using WRAP_CONTENT instead of real size, fails to place the
|
||||
// popup window above if not enough space is available below
|
||||
|
|
|
@ -169,6 +169,7 @@ class ChatRoomCreationViewModel : ErrorReportingViewModel() {
|
|||
else
|
||||
ChatRoomEphemeralMode.AdminManaged
|
||||
params.ephemeralLifetime = 0 // Make sure ephemeral is disabled by default
|
||||
Log.i("[Chat Room Creation] Ephemeral mode is ${params.ephemeralMode}, lifetime is ${params.ephemeralLifetime}")
|
||||
params.subject = AppUtils.getString(R.string.chat_room_dummy_subject)
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ class EphemeralViewModel(private val chatRoom: ChatRoom) : ViewModel() {
|
|||
}
|
||||
|
||||
init {
|
||||
Log.i("[Ephemeral Messages] Current duration is ${chatRoom.ephemeralLifetime}, ephemeral enabled? ${chatRoom.ephemeralEnabled()}")
|
||||
Log.i("[Ephemeral Messages] Current lifetime is ${chatRoom.ephemeralLifetime}, ephemeral enabled? ${chatRoom.ephemeralEnabled()}")
|
||||
currentSelectedDuration = if (chatRoom.ephemeralEnabled()) chatRoom.ephemeralLifetime else 0
|
||||
computeEphemeralDurationValues()
|
||||
}
|
||||
|
|
|
@ -125,6 +125,7 @@ class GroupInfoViewModel(val chatRoom: ChatRoom?) : ErrorReportingViewModel() {
|
|||
ChatRoomEphemeralMode.AdminManaged
|
||||
}
|
||||
params.ephemeralLifetime = 0 // Make sure ephemeral is disabled by default
|
||||
Log.i("[Chat Room Group Info] Ephemeral mode is ${params.ephemeralMode}, lifetime is ${params.ephemeralLifetime}")
|
||||
params.subject = subject.value
|
||||
|
||||
val addresses = arrayOfNulls<Address>(participants.value.orEmpty().size)
|
||||
|
|
|
@ -424,9 +424,8 @@ class CorePreferences constructor(private val context: Context) {
|
|||
val voiceMessagesFormatMkv: Boolean
|
||||
get() = config.getBool("app", "record_voice_messages_in_mkv_format", true)
|
||||
|
||||
// TODO FIXME: Keeping it device based until we have the API to know if all participants support the new mode
|
||||
val useEphemeralPerDeviceMode: Boolean
|
||||
get() = config.getBool("app", "ephemeral_chat_messages_settings_per_device", true)
|
||||
get() = config.getBool("app", "ephemeral_chat_messages_settings_per_device", false)
|
||||
|
||||
/* Default values related */
|
||||
|
||||
|
|
|
@ -61,7 +61,8 @@
|
|||
|
||||
<LinearLayout
|
||||
android:layout_width="@dimen/chat_message_bubble_file_size"
|
||||
android:layout_height="@dimen/chat_message_bubble_file_size"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/chat_message_bubble_file_size"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:background="?attr/backgroundColor"
|
||||
|
@ -74,7 +75,6 @@
|
|||
android:layout_margin="5dp"
|
||||
android:ellipsize="middle"
|
||||
android:singleLine="true"
|
||||
android:padding="10dp"
|
||||
android:gravity="center"
|
||||
android:textAlignment="center"
|
||||
android:drawablePadding="5dp"
|
||||
|
@ -87,6 +87,8 @@
|
|||
style="@style/chat_file_attachment_font"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:text="@{data.downloadLabel}"
|
||||
android:onClick="@{() -> data.download()}"
|
||||
android:visibility="@{data.downloadable ? View.VISIBLE : View.GONE}"/>
|
||||
|
|
Loading…
Reference in a new issue