Merge pull request #230 from vector-im/feature/e2e_hint

Change hint for encrypted room (fix #210)
This commit is contained in:
Benoit Marty 2019-06-26 21:05:19 +02:00 committed by GitHub
commit 76b890fe06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 4 deletions

View file

@ -501,6 +501,7 @@ class RoomDetailFragment :
} else if (state.asyncInviter.complete) { } else if (state.asyncInviter.complete) {
vectorBaseActivity.finish() vectorBaseActivity.finish()
} }
composerLayout.setRoomEncrypted(state.isEncrypted)
} }
private fun renderRoomSummary(state: RoomDetailViewState) { private fun renderRoomSummary(state: RoomDetailViewState) {

View file

@ -484,7 +484,10 @@ class RoomDetailViewModel(initialState: RoomDetailViewState,
private fun observeRoomSummary() { private fun observeRoomSummary() {
room.rx().liveRoomSummary() room.rx().liveRoomSummary()
.execute { async -> .execute { async ->
copy(asyncRoomSummary = async) copy(
asyncRoomSummary = async,
isEncrypted = room.isEncrypted()
)
} }
} }

View file

@ -46,7 +46,8 @@ data class RoomDetailViewState(
val asyncInviter: Async<User> = Uninitialized, val asyncInviter: Async<User> = Uninitialized,
val asyncRoomSummary: Async<RoomSummary> = Uninitialized, val asyncRoomSummary: Async<RoomSummary> = Uninitialized,
val sendMode: SendMode = SendMode.REGULAR, val sendMode: SendMode = SendMode.REGULAR,
val selectedEvent: TimelineEvent? = null val selectedEvent: TimelineEvent? = null,
val isEncrypted: Boolean = false
) : MvRxState { ) : MvRxState {
constructor(args: RoomDetailArgs) : this(roomId = args.roomId, eventId = args.eventId) constructor(args: RoomDetailArgs) : this(roomId = args.roomId, eventId = args.eventId)

View file

@ -9,7 +9,6 @@ import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintLayout
import androidx.constraintlayout.widget.ConstraintSet import androidx.constraintlayout.widget.ConstraintSet
import androidx.core.view.isVisible
import androidx.transition.AutoTransition import androidx.transition.AutoTransition
import androidx.transition.Transition import androidx.transition.Transition
import androidx.transition.TransitionManager import androidx.transition.TransitionManager
@ -113,4 +112,13 @@ class TextComposerView @JvmOverloads constructor(context: Context, attrs: Attrib
it.applyTo(this) it.applyTo(this)
} }
} }
fun setRoomEncrypted(isEncrypted: Boolean) {
composerEditText.setHint(
if (isEncrypted) {
R.string.room_message_placeholder_encrypted
} else {
R.string.room_message_placeholder_not_encrypted
})
}
} }

View file

@ -116,12 +116,12 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:hint="@string/room_message_placeholder_not_encrypted"
android:nextFocusLeft="@id/composerEditText" android:nextFocusLeft="@id/composerEditText"
android:nextFocusUp="@id/composerEditText" android:nextFocusUp="@id/composerEditText"
android:padding="8dp" android:padding="8dp"
android:textColor="?vctr_message_text_color" android:textColor="?vctr_message_text_color"
android:textSize="14sp" android:textSize="14sp"
tools:hint="@string/room_message_placeholder_not_encrypted"
tools:ignore="MissingConstraints" /> tools:ignore="MissingConstraints" />
</merge> </merge>