mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-24 23:09:02 +03:00
Change related to Epoxy 4.6.0 upgrade - step 1: handle DSL restriction
This commit is contained in:
parent
9d7f092016
commit
a0d04c40e9
72 changed files with 776 additions and 658 deletions
vector/src/main/java/im/vector/app
core/ui/bottomsheet
features
attachments/preview
autocomplete
command
emoji
group
member
room
contactsbook
crypto
keysbackup/settings
verification
cancel
choose
conclusion
emoji
qrconfirmation
request
devtools
discovery
home/room
login/terms
reactions
roomdirectory
roommemberprofile
roomprofile
settings
crosssigning
devices
devtools
AccountDataEpoxyController.ktGossipingTrailPagedEpoxyController.ktIncomingKeyRequestPagedController.kt
homeserver
ignored
locale
push
threepids
share
signout/soft
spaces
terms
userdirectory
|
@ -34,12 +34,13 @@ abstract class BottomSheetGenericController<State : BottomSheetGenericState, Act
|
||||||
|
|
||||||
override fun buildModels(state: State?) {
|
override fun buildModels(state: State?) {
|
||||||
state ?: return
|
state ?: return
|
||||||
|
val host = this
|
||||||
// Title
|
// Title
|
||||||
getTitle()?.let { title ->
|
getTitle()?.let { title ->
|
||||||
bottomSheetTitleItem {
|
bottomSheetTitleItem {
|
||||||
id("title")
|
id("title")
|
||||||
title(title)
|
title(title)
|
||||||
subTitle(getSubTitle())
|
subTitle(host.getSubTitle())
|
||||||
}
|
}
|
||||||
|
|
||||||
// dividerItem {
|
// dividerItem {
|
||||||
|
|
|
@ -41,13 +41,14 @@ class AttachmentMiniaturePreviewController @Inject constructor() : TypedEpoxyCon
|
||||||
var callback: Callback? = null
|
var callback: Callback? = null
|
||||||
|
|
||||||
override fun buildModels(data: AttachmentsPreviewViewState) {
|
override fun buildModels(data: AttachmentsPreviewViewState) {
|
||||||
|
val host = this
|
||||||
data.attachments.forEachIndexed { index, contentAttachmentData ->
|
data.attachments.forEachIndexed { index, contentAttachmentData ->
|
||||||
attachmentMiniaturePreviewItem {
|
attachmentMiniaturePreviewItem {
|
||||||
id(contentAttachmentData.queryUri.toString())
|
id(contentAttachmentData.queryUri.toString())
|
||||||
attachment(contentAttachmentData)
|
attachment(contentAttachmentData)
|
||||||
checked(data.currentAttachmentIndex == index)
|
checked(data.currentAttachmentIndex == index)
|
||||||
clickListener { _ ->
|
clickListener { _ ->
|
||||||
callback?.onAttachmentClicked(index, contentAttachmentData)
|
host.callback?.onAttachmentClicked(index, contentAttachmentData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,14 +30,15 @@ class AutocompleteCommandController @Inject constructor(private val stringProvid
|
||||||
if (data.isNullOrEmpty()) {
|
if (data.isNullOrEmpty()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
val host = this
|
||||||
data.forEach { command ->
|
data.forEach { command ->
|
||||||
autocompleteCommandItem {
|
autocompleteCommandItem {
|
||||||
id(command.command)
|
id(command.command)
|
||||||
name(command.command)
|
name(command.command)
|
||||||
parameters(command.parameters)
|
parameters(command.parameters)
|
||||||
description(stringProvider.getString(command.description))
|
description(host.stringProvider.getString(command.description))
|
||||||
clickListener { _ ->
|
clickListener { _ ->
|
||||||
listener?.onItemClick(command)
|
host.listener?.onItemClick(command)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,17 +43,18 @@ class AutocompleteEmojiController @Inject constructor(
|
||||||
if (data.isNullOrEmpty()) {
|
if (data.isNullOrEmpty()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
val host = this
|
||||||
data
|
data
|
||||||
.take(MAX)
|
.take(MAX)
|
||||||
.forEach { emojiItem ->
|
.forEach { emojiItem ->
|
||||||
autocompleteEmojiItem {
|
autocompleteEmojiItem {
|
||||||
id(emojiItem.name)
|
id(emojiItem.name)
|
||||||
emojiItem(emojiItem)
|
emojiItem(emojiItem)
|
||||||
emojiTypeFace(emojiTypeface)
|
emojiTypeFace(host.emojiTypeface)
|
||||||
onClickListener(
|
onClickListener(
|
||||||
object : ReactionClickListener {
|
object : ReactionClickListener {
|
||||||
override fun onReactionSelected(reaction: String) {
|
override fun onReactionSelected(reaction: String) {
|
||||||
listener?.onItemClick(reaction)
|
host.listener?.onItemClick(reaction)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -34,13 +34,14 @@ class AutocompleteGroupController @Inject constructor() : TypedEpoxyController<L
|
||||||
if (data.isNullOrEmpty()) {
|
if (data.isNullOrEmpty()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
val host = this
|
||||||
data.forEach { groupSummary ->
|
data.forEach { groupSummary ->
|
||||||
autocompleteMatrixItem {
|
autocompleteMatrixItem {
|
||||||
id(groupSummary.groupId)
|
id(groupSummary.groupId)
|
||||||
matrixItem(groupSummary.toMatrixItem())
|
matrixItem(groupSummary.toMatrixItem())
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
clickListener { _ ->
|
clickListener { _ ->
|
||||||
listener?.onItemClick(groupSummary)
|
host.listener?.onItemClick(groupSummary)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,13 +34,14 @@ class AutocompleteMemberController @Inject constructor() : TypedEpoxyController<
|
||||||
if (data.isNullOrEmpty()) {
|
if (data.isNullOrEmpty()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
val host = this
|
||||||
data.forEach { user ->
|
data.forEach { user ->
|
||||||
autocompleteMatrixItem {
|
autocompleteMatrixItem {
|
||||||
id(user.userId)
|
id(user.userId)
|
||||||
matrixItem(user.toMatrixItem())
|
matrixItem(user.toMatrixItem())
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
clickListener { _ ->
|
clickListener { _ ->
|
||||||
listener?.onItemClick(user)
|
host.listener?.onItemClick(user)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,14 +32,15 @@ class AutocompleteRoomController @Inject constructor(private val avatarRenderer:
|
||||||
if (data.isNullOrEmpty()) {
|
if (data.isNullOrEmpty()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
val host = this
|
||||||
data.forEach { roomSummary ->
|
data.forEach { roomSummary ->
|
||||||
autocompleteMatrixItem {
|
autocompleteMatrixItem {
|
||||||
id(roomSummary.roomId)
|
id(roomSummary.roomId)
|
||||||
matrixItem(roomSummary.toMatrixItem())
|
matrixItem(roomSummary.toMatrixItem())
|
||||||
subName(roomSummary.canonicalAlias)
|
subName(roomSummary.canonicalAlias)
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
clickListener { _ ->
|
clickListener { _ ->
|
||||||
listener?.onItemClick(roomSummary)
|
host.listener?.onItemClick(roomSummary)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,16 +61,18 @@ class ContactsBookController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renderLoading() {
|
private fun renderLoading() {
|
||||||
|
val host = this
|
||||||
loadingItem {
|
loadingItem {
|
||||||
id("loading")
|
id("loading")
|
||||||
loadingText(stringProvider.getString(R.string.loading_contact_book))
|
loadingText(host.stringProvider.getString(R.string.loading_contact_book))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renderFailure(failure: Throwable) {
|
private fun renderFailure(failure: Throwable) {
|
||||||
|
val host = this
|
||||||
errorWithRetryItem {
|
errorWithRetryItem {
|
||||||
id("error")
|
id("error")
|
||||||
text(errorFormatter.toHumanReadable(failure))
|
text(host.errorFormatter.toHumanReadable(failure))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,11 +87,12 @@ class ContactsBookController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renderContacts(mappedContacts: List<MappedContact>, onlyBoundContacts: Boolean) {
|
private fun renderContacts(mappedContacts: List<MappedContact>, onlyBoundContacts: Boolean) {
|
||||||
|
val host = this
|
||||||
for (mappedContact in mappedContacts) {
|
for (mappedContact in mappedContacts) {
|
||||||
contactItem {
|
contactItem {
|
||||||
id(mappedContact.id)
|
id(mappedContact.id)
|
||||||
mappedContact(mappedContact)
|
mappedContact(mappedContact)
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
}
|
}
|
||||||
mappedContact.emails
|
mappedContact.emails
|
||||||
.forEachIndexed { index, it ->
|
.forEachIndexed { index, it ->
|
||||||
|
@ -101,9 +104,9 @@ class ContactsBookController @Inject constructor(
|
||||||
matrixId(it.matrixId)
|
matrixId(it.matrixId)
|
||||||
clickListener {
|
clickListener {
|
||||||
if (it.matrixId != null) {
|
if (it.matrixId != null) {
|
||||||
callback?.onMatrixIdClick(it.matrixId)
|
host.callback?.onMatrixIdClick(it.matrixId)
|
||||||
} else {
|
} else {
|
||||||
callback?.onThreePidClick(ThreePid.Email(it.email))
|
host.callback?.onThreePidClick(ThreePid.Email(it.email))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,9 +121,9 @@ class ContactsBookController @Inject constructor(
|
||||||
matrixId(it.matrixId)
|
matrixId(it.matrixId)
|
||||||
clickListener {
|
clickListener {
|
||||||
if (it.matrixId != null) {
|
if (it.matrixId != null) {
|
||||||
callback?.onMatrixIdClick(it.matrixId)
|
host.callback?.onMatrixIdClick(it.matrixId)
|
||||||
} else {
|
} else {
|
||||||
callback?.onThreePidClick(ThreePid.Msisdn(it.phoneNumber))
|
host.callback?.onThreePidClick(ThreePid.Msisdn(it.phoneNumber))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,6 +132,7 @@ class ContactsBookController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renderEmptyState(hasSearch: Boolean) {
|
private fun renderEmptyState(hasSearch: Boolean) {
|
||||||
|
val host = this
|
||||||
val noResultRes = if (hasSearch) {
|
val noResultRes = if (hasSearch) {
|
||||||
R.string.no_result_placeholder
|
R.string.no_result_placeholder
|
||||||
} else {
|
} else {
|
||||||
|
@ -136,7 +140,7 @@ class ContactsBookController @Inject constructor(
|
||||||
}
|
}
|
||||||
noResultItem {
|
noResultItem {
|
||||||
id("noResult")
|
id("noResult")
|
||||||
text(stringProvider.getString(noResultRes))
|
text(host.stringProvider.getString(noResultRes))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ class KeysBackupSettingsRecyclerViewController @Inject constructor(private val s
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val host = this
|
||||||
var isBackupAlreadySetup = false
|
var isBackupAlreadySetup = false
|
||||||
|
|
||||||
val keyBackupState = data.keysBackupState
|
val keyBackupState = data.keysBackupState
|
||||||
|
@ -55,8 +56,8 @@ class KeysBackupSettingsRecyclerViewController @Inject constructor(private val s
|
||||||
KeysBackupState.Unknown -> {
|
KeysBackupState.Unknown -> {
|
||||||
errorWithRetryItem {
|
errorWithRetryItem {
|
||||||
id("summary")
|
id("summary")
|
||||||
text(stringProvider.getString(R.string.keys_backup_unable_to_get_keys_backup_data))
|
text(host.stringProvider.getString(R.string.keys_backup_unable_to_get_keys_backup_data))
|
||||||
listener { listener?.loadKeysBackupState() }
|
listener { host.listener?.loadKeysBackupState() }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nothing else to display
|
// Nothing else to display
|
||||||
|
@ -65,17 +66,17 @@ class KeysBackupSettingsRecyclerViewController @Inject constructor(private val s
|
||||||
KeysBackupState.CheckingBackUpOnHomeserver -> {
|
KeysBackupState.CheckingBackUpOnHomeserver -> {
|
||||||
loadingItem {
|
loadingItem {
|
||||||
id("summary")
|
id("summary")
|
||||||
loadingText(stringProvider.getString(R.string.keys_backup_settings_checking_backup_state))
|
loadingText(host.stringProvider.getString(R.string.keys_backup_settings_checking_backup_state))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
KeysBackupState.Disabled -> {
|
KeysBackupState.Disabled -> {
|
||||||
genericItem {
|
genericItem {
|
||||||
id("summary")
|
id("summary")
|
||||||
title(stringProvider.getString(R.string.keys_backup_settings_status_not_setup))
|
title(host.stringProvider.getString(R.string.keys_backup_settings_status_not_setup))
|
||||||
style(ItemStyle.BIG_TEXT)
|
style(ItemStyle.BIG_TEXT)
|
||||||
|
|
||||||
if (data.keysBackupVersionTrust()?.usable == false) {
|
if (data.keysBackupVersionTrust()?.usable == false) {
|
||||||
description(stringProvider.getString(R.string.keys_backup_settings_untrusted_backup))
|
description(host.stringProvider.getString(R.string.keys_backup_settings_untrusted_backup))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,10 +87,10 @@ class KeysBackupSettingsRecyclerViewController @Inject constructor(private val s
|
||||||
KeysBackupState.Enabling -> {
|
KeysBackupState.Enabling -> {
|
||||||
genericItem {
|
genericItem {
|
||||||
id("summary")
|
id("summary")
|
||||||
title(stringProvider.getString(R.string.keys_backup_settings_status_ko))
|
title(host.stringProvider.getString(R.string.keys_backup_settings_status_ko))
|
||||||
style(ItemStyle.BIG_TEXT)
|
style(ItemStyle.BIG_TEXT)
|
||||||
if (data.keysBackupVersionTrust()?.usable == false) {
|
if (data.keysBackupVersionTrust()?.usable == false) {
|
||||||
description(stringProvider.getString(R.string.keys_backup_settings_untrusted_backup))
|
description(host.stringProvider.getString(R.string.keys_backup_settings_untrusted_backup))
|
||||||
} else {
|
} else {
|
||||||
description(keyBackupState.toString())
|
description(keyBackupState.toString())
|
||||||
}
|
}
|
||||||
|
@ -101,12 +102,12 @@ class KeysBackupSettingsRecyclerViewController @Inject constructor(private val s
|
||||||
KeysBackupState.ReadyToBackUp -> {
|
KeysBackupState.ReadyToBackUp -> {
|
||||||
genericItem {
|
genericItem {
|
||||||
id("summary")
|
id("summary")
|
||||||
title(stringProvider.getString(R.string.keys_backup_settings_status_ok))
|
title(host.stringProvider.getString(R.string.keys_backup_settings_status_ok))
|
||||||
style(ItemStyle.BIG_TEXT)
|
style(ItemStyle.BIG_TEXT)
|
||||||
if (data.keysBackupVersionTrust()?.usable == false) {
|
if (data.keysBackupVersionTrust()?.usable == false) {
|
||||||
description(stringProvider.getString(R.string.keys_backup_settings_untrusted_backup))
|
description(host.stringProvider.getString(R.string.keys_backup_settings_untrusted_backup))
|
||||||
} else {
|
} else {
|
||||||
description(stringProvider.getString(R.string.keys_backup_info_keys_all_backup_up))
|
description(host.stringProvider.getString(R.string.keys_backup_info_keys_all_backup_up))
|
||||||
}
|
}
|
||||||
endIconResourceId(R.drawable.unit_test_ok)
|
endIconResourceId(R.drawable.unit_test_ok)
|
||||||
}
|
}
|
||||||
|
@ -117,19 +118,19 @@ class KeysBackupSettingsRecyclerViewController @Inject constructor(private val s
|
||||||
KeysBackupState.BackingUp -> {
|
KeysBackupState.BackingUp -> {
|
||||||
genericItem {
|
genericItem {
|
||||||
id("summary")
|
id("summary")
|
||||||
title(stringProvider.getString(R.string.keys_backup_settings_status_ok))
|
title(host.stringProvider.getString(R.string.keys_backup_settings_status_ok))
|
||||||
style(ItemStyle.BIG_TEXT)
|
style(ItemStyle.BIG_TEXT)
|
||||||
hasIndeterminateProcess(true)
|
hasIndeterminateProcess(true)
|
||||||
|
|
||||||
val totalKeys = session.cryptoService().inboundGroupSessionsCount(false)
|
val totalKeys = host.session.cryptoService().inboundGroupSessionsCount(false)
|
||||||
val backedUpKeys = session.cryptoService().inboundGroupSessionsCount(true)
|
val backedUpKeys = host.session.cryptoService().inboundGroupSessionsCount(true)
|
||||||
|
|
||||||
val remainingKeysToBackup = totalKeys - backedUpKeys
|
val remainingKeysToBackup = totalKeys - backedUpKeys
|
||||||
|
|
||||||
if (data.keysBackupVersionTrust()?.usable == false) {
|
if (data.keysBackupVersionTrust()?.usable == false) {
|
||||||
description(stringProvider.getString(R.string.keys_backup_settings_untrusted_backup))
|
description(host.stringProvider.getString(R.string.keys_backup_settings_untrusted_backup))
|
||||||
} else {
|
} else {
|
||||||
description(stringProvider.getQuantityString(R.plurals.keys_backup_info_keys_backing_up, remainingKeysToBackup, remainingKeysToBackup))
|
description(host.stringProvider.getQuantityString(R.plurals.keys_backup_info_keys_backing_up, remainingKeysToBackup, remainingKeysToBackup))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,13 +142,13 @@ class KeysBackupSettingsRecyclerViewController @Inject constructor(private val s
|
||||||
// Add infos
|
// Add infos
|
||||||
genericItem {
|
genericItem {
|
||||||
id("version")
|
id("version")
|
||||||
title(stringProvider.getString(R.string.keys_backup_info_title_version))
|
title(host.stringProvider.getString(R.string.keys_backup_info_title_version))
|
||||||
description(keyVersionResult?.version ?: "")
|
description(keyVersionResult?.version ?: "")
|
||||||
}
|
}
|
||||||
|
|
||||||
genericItem {
|
genericItem {
|
||||||
id("algorithm")
|
id("algorithm")
|
||||||
title(stringProvider.getString(R.string.keys_backup_info_title_algorithm))
|
title(host.stringProvider.getString(R.string.keys_backup_info_title_algorithm))
|
||||||
description(keyVersionResult?.algorithm ?: "")
|
description(keyVersionResult?.algorithm ?: "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,19 +162,20 @@ class KeysBackupSettingsRecyclerViewController @Inject constructor(private val s
|
||||||
id("footer")
|
id("footer")
|
||||||
|
|
||||||
if (isBackupAlreadySetup) {
|
if (isBackupAlreadySetup) {
|
||||||
textButton1(stringProvider.getString(R.string.keys_backup_settings_restore_backup_button))
|
textButton1(host.stringProvider.getString(R.string.keys_backup_settings_restore_backup_button))
|
||||||
clickOnButton1(View.OnClickListener { listener?.didSelectRestoreMessageRecovery() })
|
clickOnButton1(View.OnClickListener { host.listener?.didSelectRestoreMessageRecovery() })
|
||||||
|
|
||||||
textButton2(stringProvider.getString(R.string.keys_backup_settings_delete_backup_button))
|
textButton2(host.stringProvider.getString(R.string.keys_backup_settings_delete_backup_button))
|
||||||
clickOnButton2(View.OnClickListener { listener?.didSelectDeleteSetupMessageRecovery() })
|
clickOnButton2(View.OnClickListener { host.listener?.didSelectDeleteSetupMessageRecovery() })
|
||||||
} else {
|
} else {
|
||||||
textButton1(stringProvider.getString(R.string.keys_backup_setup))
|
textButton1(host.stringProvider.getString(R.string.keys_backup_setup))
|
||||||
clickOnButton1(View.OnClickListener { listener?.didSelectSetupMessageRecovery() })
|
clickOnButton1(View.OnClickListener { host.listener?.didSelectSetupMessageRecovery() })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildKeysBackupTrust(keysVersionTrust: Async<KeysBackupVersionTrust>) {
|
private fun buildKeysBackupTrust(keysVersionTrust: Async<KeysBackupVersionTrust>) {
|
||||||
|
val host = this
|
||||||
when (keysVersionTrust) {
|
when (keysVersionTrust) {
|
||||||
is Uninitialized -> Unit
|
is Uninitialized -> Unit
|
||||||
is Loading -> {
|
is Loading -> {
|
||||||
|
@ -185,7 +187,7 @@ class KeysBackupSettingsRecyclerViewController @Inject constructor(private val s
|
||||||
keysVersionTrust().signatures.forEach {
|
keysVersionTrust().signatures.forEach {
|
||||||
genericItem {
|
genericItem {
|
||||||
id(UUID.randomUUID().toString())
|
id(UUID.randomUUID().toString())
|
||||||
title(stringProvider.getString(R.string.keys_backup_info_title_signature))
|
title(host.stringProvider.getString(R.string.keys_backup_info_title_signature))
|
||||||
|
|
||||||
val isDeviceKnown = it.device != null
|
val isDeviceKnown = it.device != null
|
||||||
val isDeviceVerified = it.device?.isVerified ?: false
|
val isDeviceVerified = it.device?.isVerified ?: false
|
||||||
|
@ -193,19 +195,19 @@ class KeysBackupSettingsRecyclerViewController @Inject constructor(private val s
|
||||||
val deviceId: String = it.deviceId ?: ""
|
val deviceId: String = it.deviceId ?: ""
|
||||||
|
|
||||||
if (!isDeviceKnown) {
|
if (!isDeviceKnown) {
|
||||||
description(stringProvider.getString(R.string.keys_backup_settings_signature_from_unknown_device, deviceId))
|
description(host.stringProvider.getString(R.string.keys_backup_settings_signature_from_unknown_device, deviceId))
|
||||||
endIconResourceId(R.drawable.e2e_warning)
|
endIconResourceId(R.drawable.e2e_warning)
|
||||||
} else {
|
} else {
|
||||||
if (isSignatureValid) {
|
if (isSignatureValid) {
|
||||||
if (session.sessionParams.deviceId == it.deviceId) {
|
if (host.session.sessionParams.deviceId == it.deviceId) {
|
||||||
description(stringProvider.getString(R.string.keys_backup_settings_valid_signature_from_this_device))
|
description(host.stringProvider.getString(R.string.keys_backup_settings_valid_signature_from_this_device))
|
||||||
endIconResourceId(R.drawable.e2e_verified)
|
endIconResourceId(R.drawable.e2e_verified)
|
||||||
} else {
|
} else {
|
||||||
if (isDeviceVerified) {
|
if (isDeviceVerified) {
|
||||||
description(stringProvider.getString(R.string.keys_backup_settings_valid_signature_from_verified_device, deviceId))
|
description(host.stringProvider.getString(R.string.keys_backup_settings_valid_signature_from_verified_device, deviceId))
|
||||||
endIconResourceId(R.drawable.e2e_verified)
|
endIconResourceId(R.drawable.e2e_verified)
|
||||||
} else {
|
} else {
|
||||||
description(stringProvider.getString(R.string.keys_backup_settings_valid_signature_from_unverified_device, deviceId))
|
description(host.stringProvider.getString(R.string.keys_backup_settings_valid_signature_from_unverified_device, deviceId))
|
||||||
endIconResourceId(R.drawable.e2e_warning)
|
endIconResourceId(R.drawable.e2e_warning)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,9 +215,9 @@ class KeysBackupSettingsRecyclerViewController @Inject constructor(private val s
|
||||||
// Invalid signature
|
// Invalid signature
|
||||||
endIconResourceId(R.drawable.e2e_warning)
|
endIconResourceId(R.drawable.e2e_warning)
|
||||||
if (isDeviceVerified) {
|
if (isDeviceVerified) {
|
||||||
description(stringProvider.getString(R.string.keys_backup_settings_invalid_signature_from_verified_device, deviceId))
|
description(host.stringProvider.getString(R.string.keys_backup_settings_invalid_signature_from_verified_device, deviceId))
|
||||||
} else {
|
} else {
|
||||||
description(stringProvider.getString(R.string.keys_backup_settings_invalid_signature_from_unverified_device, deviceId))
|
description(host.stringProvider.getString(R.string.keys_backup_settings_invalid_signature_from_unverified_device, deviceId))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,8 +227,8 @@ class KeysBackupSettingsRecyclerViewController @Inject constructor(private val s
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
errorWithRetryItem {
|
errorWithRetryItem {
|
||||||
id("trust")
|
id("trust")
|
||||||
text(stringProvider.getString(R.string.keys_backup_unable_to_get_trust_info))
|
text(host.stringProvider.getString(R.string.keys_backup_unable_to_get_trust_info))
|
||||||
listener { listener?.loadTrustData() }
|
listener { host.listener?.loadTrustData() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,17 +44,17 @@ class VerificationCancelController @Inject constructor(
|
||||||
|
|
||||||
override fun buildModels() {
|
override fun buildModels() {
|
||||||
val state = viewState ?: return
|
val state = viewState ?: return
|
||||||
|
val host = this
|
||||||
if (state.isMe) {
|
if (state.isMe) {
|
||||||
if (state.currentDeviceCanCrossSign) {
|
if (state.currentDeviceCanCrossSign) {
|
||||||
bottomSheetVerificationNoticeItem {
|
bottomSheetVerificationNoticeItem {
|
||||||
id("notice")
|
id("notice")
|
||||||
notice(stringProvider.getString(R.string.verify_cancel_self_verification_from_trusted))
|
notice(host.stringProvider.getString(R.string.verify_cancel_self_verification_from_trusted))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
bottomSheetVerificationNoticeItem {
|
bottomSheetVerificationNoticeItem {
|
||||||
id("notice")
|
id("notice")
|
||||||
notice(stringProvider.getString(R.string.verify_cancel_self_verification_from_untrusted))
|
notice(host.stringProvider.getString(R.string.verify_cancel_self_verification_from_untrusted))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -63,9 +63,9 @@ class VerificationCancelController @Inject constructor(
|
||||||
bottomSheetVerificationNoticeItem {
|
bottomSheetVerificationNoticeItem {
|
||||||
id("notice")
|
id("notice")
|
||||||
notice(
|
notice(
|
||||||
stringProvider.getString(R.string.verify_cancel_other, otherDisplayName, otherUserID)
|
host.stringProvider.getString(R.string.verify_cancel_other, otherDisplayName, otherUserID)
|
||||||
.toSpannable()
|
.toSpannable()
|
||||||
.colorizeMatchingText(otherUserID, colorProvider.getColorFromAttribute(R.attr.vctr_notice_text_color))
|
.colorizeMatchingText(otherUserID, host.colorProvider.getColorFromAttribute(R.attr.vctr_notice_text_color))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,11 +76,11 @@ class VerificationCancelController @Inject constructor(
|
||||||
|
|
||||||
bottomSheetVerificationActionItem {
|
bottomSheetVerificationActionItem {
|
||||||
id("cancel")
|
id("cancel")
|
||||||
title(stringProvider.getString(R.string.skip))
|
title(host.stringProvider.getString(R.string.skip))
|
||||||
titleColor(colorProvider.getColor(R.color.riotx_destructive_accent))
|
titleColor(host.colorProvider.getColor(R.color.riotx_destructive_accent))
|
||||||
iconRes(R.drawable.ic_arrow_right)
|
iconRes(R.drawable.ic_arrow_right)
|
||||||
iconColor(colorProvider.getColor(R.color.riotx_destructive_accent))
|
iconColor(host.colorProvider.getColor(R.color.riotx_destructive_accent))
|
||||||
listener { listener?.onTapCancel() }
|
listener { host.listener?.onTapCancel() }
|
||||||
}
|
}
|
||||||
|
|
||||||
dividerItem {
|
dividerItem {
|
||||||
|
@ -89,11 +89,11 @@ class VerificationCancelController @Inject constructor(
|
||||||
|
|
||||||
bottomSheetVerificationActionItem {
|
bottomSheetVerificationActionItem {
|
||||||
id("continue")
|
id("continue")
|
||||||
title(stringProvider.getString(R.string._continue))
|
title(host.stringProvider.getString(R.string._continue))
|
||||||
titleColor(colorProvider.getColor(R.color.riotx_positive_accent))
|
titleColor(host.colorProvider.getColor(R.color.riotx_positive_accent))
|
||||||
iconRes(R.drawable.ic_arrow_right)
|
iconRes(R.drawable.ic_arrow_right)
|
||||||
iconColor(colorProvider.getColor(R.color.riotx_positive_accent))
|
iconColor(host.colorProvider.getColor(R.color.riotx_positive_accent))
|
||||||
listener { listener?.onTapContinue() }
|
listener { host.listener?.onTapContinue() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,9 +43,10 @@ class VerificationNotMeController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun buildModels() {
|
override fun buildModels() {
|
||||||
|
val host = this
|
||||||
bottomSheetVerificationNoticeItem {
|
bottomSheetVerificationNoticeItem {
|
||||||
id("notice")
|
id("notice")
|
||||||
notice(eventHtmlRenderer.render(stringProvider.getString(R.string.verify_not_me_self_verification)))
|
notice(host.eventHtmlRenderer.render(host.stringProvider.getString(R.string.verify_not_me_self_verification)))
|
||||||
}
|
}
|
||||||
|
|
||||||
dividerItem {
|
dividerItem {
|
||||||
|
@ -54,11 +55,11 @@ class VerificationNotMeController @Inject constructor(
|
||||||
|
|
||||||
bottomSheetVerificationActionItem {
|
bottomSheetVerificationActionItem {
|
||||||
id("skip")
|
id("skip")
|
||||||
title(stringProvider.getString(R.string.skip))
|
title(host.stringProvider.getString(R.string.skip))
|
||||||
titleColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
titleColor(host.colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
||||||
iconRes(R.drawable.ic_arrow_right)
|
iconRes(R.drawable.ic_arrow_right)
|
||||||
iconColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
iconColor(host.colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
||||||
listener { listener?.onTapSkip() }
|
listener { host.listener?.onTapSkip() }
|
||||||
}
|
}
|
||||||
|
|
||||||
dividerItem {
|
dividerItem {
|
||||||
|
@ -67,11 +68,11 @@ class VerificationNotMeController @Inject constructor(
|
||||||
|
|
||||||
bottomSheetVerificationActionItem {
|
bottomSheetVerificationActionItem {
|
||||||
id("settings")
|
id("settings")
|
||||||
title(stringProvider.getString(R.string.settings))
|
title(host.stringProvider.getString(R.string.settings))
|
||||||
titleColor(colorProvider.getColor(R.color.riotx_positive_accent))
|
titleColor(host.colorProvider.getColor(R.color.riotx_positive_accent))
|
||||||
iconRes(R.drawable.ic_arrow_right)
|
iconRes(R.drawable.ic_arrow_right)
|
||||||
iconColor(colorProvider.getColor(R.color.riotx_positive_accent))
|
iconColor(host.colorProvider.getColor(R.color.riotx_positive_accent))
|
||||||
listener { listener?.onTapSettings() }
|
listener { host.listener?.onTapSettings() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,11 +42,12 @@ class VerificationChooseMethodController @Inject constructor(
|
||||||
|
|
||||||
override fun buildModels() {
|
override fun buildModels() {
|
||||||
val state = viewState ?: return
|
val state = viewState ?: return
|
||||||
|
val host = this
|
||||||
|
|
||||||
if (state.otherCanScanQrCode || state.otherCanShowQrCode) {
|
if (state.otherCanScanQrCode || state.otherCanShowQrCode) {
|
||||||
bottomSheetVerificationNoticeItem {
|
bottomSheetVerificationNoticeItem {
|
||||||
id("notice")
|
id("notice")
|
||||||
notice(stringProvider.getString(R.string.verification_scan_notice))
|
notice(host.stringProvider.getString(R.string.verification_scan_notice))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.otherCanScanQrCode && !state.qrCodeText.isNullOrBlank()) {
|
if (state.otherCanScanQrCode && !state.qrCodeText.isNullOrBlank()) {
|
||||||
|
@ -63,11 +64,11 @@ class VerificationChooseMethodController @Inject constructor(
|
||||||
if (state.otherCanShowQrCode) {
|
if (state.otherCanShowQrCode) {
|
||||||
bottomSheetVerificationActionItem {
|
bottomSheetVerificationActionItem {
|
||||||
id("openCamera")
|
id("openCamera")
|
||||||
title(stringProvider.getString(R.string.verification_scan_their_code))
|
title(host.stringProvider.getString(R.string.verification_scan_their_code))
|
||||||
titleColor(colorProvider.getColor(R.color.riotx_accent))
|
titleColor(host.colorProvider.getColor(R.color.riotx_accent))
|
||||||
iconRes(R.drawable.ic_camera)
|
iconRes(R.drawable.ic_camera)
|
||||||
iconColor(colorProvider.getColor(R.color.riotx_accent))
|
iconColor(host.colorProvider.getColor(R.color.riotx_accent))
|
||||||
listener { listener?.openCamera() }
|
listener { host.listener?.openCamera() }
|
||||||
}
|
}
|
||||||
|
|
||||||
dividerItem {
|
dividerItem {
|
||||||
|
@ -77,21 +78,21 @@ class VerificationChooseMethodController @Inject constructor(
|
||||||
|
|
||||||
bottomSheetVerificationActionItem {
|
bottomSheetVerificationActionItem {
|
||||||
id("openEmoji")
|
id("openEmoji")
|
||||||
title(stringProvider.getString(R.string.verification_scan_emoji_title))
|
title(host.stringProvider.getString(R.string.verification_scan_emoji_title))
|
||||||
titleColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
titleColor(host.colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
||||||
subTitle(stringProvider.getString(R.string.verification_scan_emoji_subtitle))
|
subTitle(host.stringProvider.getString(R.string.verification_scan_emoji_subtitle))
|
||||||
iconRes(R.drawable.ic_arrow_right)
|
iconRes(R.drawable.ic_arrow_right)
|
||||||
iconColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
iconColor(host.colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
||||||
listener { listener?.doVerifyBySas() }
|
listener { host.listener?.doVerifyBySas() }
|
||||||
}
|
}
|
||||||
} else if (state.sasModeAvailable) {
|
} else if (state.sasModeAvailable) {
|
||||||
bottomSheetVerificationActionItem {
|
bottomSheetVerificationActionItem {
|
||||||
id("openEmoji")
|
id("openEmoji")
|
||||||
title(stringProvider.getString(R.string.verification_no_scan_emoji_title))
|
title(host.stringProvider.getString(R.string.verification_no_scan_emoji_title))
|
||||||
titleColor(colorProvider.getColor(R.color.riotx_accent))
|
titleColor(host.colorProvider.getColor(R.color.riotx_accent))
|
||||||
iconRes(R.drawable.ic_arrow_right)
|
iconRes(R.drawable.ic_arrow_right)
|
||||||
iconColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
iconColor(host.colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
||||||
listener { listener?.doVerifyBySas() }
|
listener { host.listener?.doVerifyBySas() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,12 +103,12 @@ class VerificationChooseMethodController @Inject constructor(
|
||||||
|
|
||||||
bottomSheetVerificationActionItem {
|
bottomSheetVerificationActionItem {
|
||||||
id("wasnote")
|
id("wasnote")
|
||||||
title(stringProvider.getString(R.string.verify_new_session_was_not_me))
|
title(host.stringProvider.getString(R.string.verify_new_session_was_not_me))
|
||||||
titleColor(colorProvider.getColor(R.color.riotx_destructive_accent))
|
titleColor(host.colorProvider.getColor(R.color.riotx_destructive_accent))
|
||||||
subTitle(stringProvider.getString(R.string.verify_new_session_compromized))
|
subTitle(host.stringProvider.getString(R.string.verify_new_session_compromized))
|
||||||
iconRes(R.drawable.ic_arrow_right)
|
iconRes(R.drawable.ic_arrow_right)
|
||||||
iconColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
iconColor(host.colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
||||||
listener { listener?.onClickOnWasNotMe() }
|
listener { host.listener?.onClickOnWasNotMe() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,12 +45,13 @@ class VerificationConclusionController @Inject constructor(
|
||||||
|
|
||||||
override fun buildModels() {
|
override fun buildModels() {
|
||||||
val state = viewState ?: return
|
val state = viewState ?: return
|
||||||
|
val host = this
|
||||||
|
|
||||||
when (state.conclusionState) {
|
when (state.conclusionState) {
|
||||||
ConclusionState.SUCCESS -> {
|
ConclusionState.SUCCESS -> {
|
||||||
bottomSheetVerificationNoticeItem {
|
bottomSheetVerificationNoticeItem {
|
||||||
id("notice")
|
id("notice")
|
||||||
notice(stringProvider.getString(
|
notice(host.stringProvider.getString(
|
||||||
if (state.isSelfVerification) R.string.verification_conclusion_ok_self_notice
|
if (state.isSelfVerification) R.string.verification_conclusion_ok_self_notice
|
||||||
else R.string.verification_conclusion_ok_notice))
|
else R.string.verification_conclusion_ok_notice))
|
||||||
}
|
}
|
||||||
|
@ -65,7 +66,7 @@ class VerificationConclusionController @Inject constructor(
|
||||||
ConclusionState.WARNING -> {
|
ConclusionState.WARNING -> {
|
||||||
bottomSheetVerificationNoticeItem {
|
bottomSheetVerificationNoticeItem {
|
||||||
id("notice")
|
id("notice")
|
||||||
notice(stringProvider.getString(R.string.verification_conclusion_not_secure))
|
notice(host.stringProvider.getString(R.string.verification_conclusion_not_secure))
|
||||||
}
|
}
|
||||||
|
|
||||||
bottomSheetVerificationBigImageItem {
|
bottomSheetVerificationBigImageItem {
|
||||||
|
@ -75,7 +76,7 @@ class VerificationConclusionController @Inject constructor(
|
||||||
|
|
||||||
bottomSheetVerificationNoticeItem {
|
bottomSheetVerificationNoticeItem {
|
||||||
id("warning_notice")
|
id("warning_notice")
|
||||||
notice(eventHtmlRenderer.render(stringProvider.getString(R.string.verification_conclusion_compromised)))
|
notice(host.eventHtmlRenderer.render(host.stringProvider.getString(R.string.verification_conclusion_compromised)))
|
||||||
}
|
}
|
||||||
|
|
||||||
bottomDone()
|
bottomDone()
|
||||||
|
@ -83,7 +84,7 @@ class VerificationConclusionController @Inject constructor(
|
||||||
ConclusionState.CANCELLED -> {
|
ConclusionState.CANCELLED -> {
|
||||||
bottomSheetVerificationNoticeItem {
|
bottomSheetVerificationNoticeItem {
|
||||||
id("notice_cancelled")
|
id("notice_cancelled")
|
||||||
notice(stringProvider.getString(R.string.verify_cancelled_notice))
|
notice(host.stringProvider.getString(R.string.verify_cancelled_notice))
|
||||||
}
|
}
|
||||||
|
|
||||||
dividerItem {
|
dividerItem {
|
||||||
|
@ -92,28 +93,29 @@ class VerificationConclusionController @Inject constructor(
|
||||||
|
|
||||||
bottomSheetVerificationActionItem {
|
bottomSheetVerificationActionItem {
|
||||||
id("got_it")
|
id("got_it")
|
||||||
title(stringProvider.getString(R.string.sas_got_it))
|
title(host.stringProvider.getString(R.string.sas_got_it))
|
||||||
titleColor(colorProvider.getColor(R.color.riotx_accent))
|
titleColor(host.colorProvider.getColor(R.color.riotx_accent))
|
||||||
iconRes(R.drawable.ic_arrow_right)
|
iconRes(R.drawable.ic_arrow_right)
|
||||||
iconColor(colorProvider.getColor(R.color.riotx_accent))
|
iconColor(host.colorProvider.getColor(R.color.riotx_accent))
|
||||||
listener { listener?.onButtonTapped() }
|
listener { host.listener?.onButtonTapped() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun bottomDone() {
|
private fun bottomDone() {
|
||||||
|
val host = this
|
||||||
dividerItem {
|
dividerItem {
|
||||||
id("sep0")
|
id("sep0")
|
||||||
}
|
}
|
||||||
|
|
||||||
bottomSheetVerificationActionItem {
|
bottomSheetVerificationActionItem {
|
||||||
id("done")
|
id("done")
|
||||||
title(stringProvider.getString(R.string.done))
|
title(host.stringProvider.getString(R.string.done))
|
||||||
titleColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
titleColor(host.colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
||||||
iconRes(R.drawable.ic_arrow_right)
|
iconRes(R.drawable.ic_arrow_right)
|
||||||
iconColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
iconColor(host.colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
||||||
listener { listener?.onButtonTapped() }
|
listener { host.listener?.onButtonTapped() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,11 +58,12 @@ class VerificationEmojiCodeController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildEmojiItem(state: VerificationEmojiCodeViewState) {
|
private fun buildEmojiItem(state: VerificationEmojiCodeViewState) {
|
||||||
|
val host = this
|
||||||
when (val emojiDescription = state.emojiDescription) {
|
when (val emojiDescription = state.emojiDescription) {
|
||||||
is Success -> {
|
is Success -> {
|
||||||
bottomSheetVerificationNoticeItem {
|
bottomSheetVerificationNoticeItem {
|
||||||
id("notice")
|
id("notice")
|
||||||
notice(stringProvider.getString(R.string.verification_emoji_notice))
|
notice(host.stringProvider.getString(R.string.verification_emoji_notice))
|
||||||
}
|
}
|
||||||
|
|
||||||
bottomSheetVerificationEmojisItem {
|
bottomSheetVerificationEmojisItem {
|
||||||
|
@ -81,24 +82,25 @@ class VerificationEmojiCodeController @Inject constructor(
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
errorWithRetryItem {
|
errorWithRetryItem {
|
||||||
id("error")
|
id("error")
|
||||||
text(errorFormatter.toHumanReadable(emojiDescription.error))
|
text(host.errorFormatter.toHumanReadable(emojiDescription.error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
bottomSheetVerificationWaitingItem {
|
bottomSheetVerificationWaitingItem {
|
||||||
id("waiting")
|
id("waiting")
|
||||||
title(stringProvider.getString(R.string.please_wait))
|
title(host.stringProvider.getString(R.string.please_wait))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildDecimal(state: VerificationEmojiCodeViewState) {
|
private fun buildDecimal(state: VerificationEmojiCodeViewState) {
|
||||||
|
val host = this
|
||||||
when (val decimalDescription = state.decimalDescription) {
|
when (val decimalDescription = state.decimalDescription) {
|
||||||
is Success -> {
|
is Success -> {
|
||||||
bottomSheetVerificationNoticeItem {
|
bottomSheetVerificationNoticeItem {
|
||||||
id("notice")
|
id("notice")
|
||||||
notice(stringProvider.getString(R.string.verification_code_notice))
|
notice(host.stringProvider.getString(R.string.verification_code_notice))
|
||||||
}
|
}
|
||||||
|
|
||||||
bottomSheetVerificationDecimalCodeItem {
|
bottomSheetVerificationDecimalCodeItem {
|
||||||
|
@ -111,19 +113,20 @@ class VerificationEmojiCodeController @Inject constructor(
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
errorWithRetryItem {
|
errorWithRetryItem {
|
||||||
id("error")
|
id("error")
|
||||||
text(errorFormatter.toHumanReadable(decimalDescription.error))
|
text(host.errorFormatter.toHumanReadable(decimalDescription.error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
bottomSheetVerificationWaitingItem {
|
bottomSheetVerificationWaitingItem {
|
||||||
id("waiting")
|
id("waiting")
|
||||||
title(stringProvider.getString(R.string.please_wait))
|
title(host.stringProvider.getString(R.string.please_wait))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildActions(state: VerificationEmojiCodeViewState) {
|
private fun buildActions(state: VerificationEmojiCodeViewState) {
|
||||||
|
val host = this
|
||||||
dividerItem {
|
dividerItem {
|
||||||
id("sep0")
|
id("sep0")
|
||||||
}
|
}
|
||||||
|
@ -131,27 +134,27 @@ class VerificationEmojiCodeController @Inject constructor(
|
||||||
if (state.isWaitingFromOther) {
|
if (state.isWaitingFromOther) {
|
||||||
bottomSheetVerificationWaitingItem {
|
bottomSheetVerificationWaitingItem {
|
||||||
id("waiting")
|
id("waiting")
|
||||||
title(stringProvider.getString(R.string.verification_request_waiting_for, state.otherUser?.getBestName() ?: ""))
|
title(host.stringProvider.getString(R.string.verification_request_waiting_for, state.otherUser?.getBestName() ?: ""))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
bottomSheetVerificationActionItem {
|
bottomSheetVerificationActionItem {
|
||||||
id("ko")
|
id("ko")
|
||||||
title(stringProvider.getString(R.string.verification_sas_do_not_match))
|
title(host.stringProvider.getString(R.string.verification_sas_do_not_match))
|
||||||
titleColor(colorProvider.getColor(R.color.vector_error_color))
|
titleColor(host.colorProvider.getColor(R.color.vector_error_color))
|
||||||
iconRes(R.drawable.ic_check_off)
|
iconRes(R.drawable.ic_check_off)
|
||||||
iconColor(colorProvider.getColor(R.color.vector_error_color))
|
iconColor(host.colorProvider.getColor(R.color.vector_error_color))
|
||||||
listener { listener?.onDoNotMatchButtonTapped() }
|
listener { host.listener?.onDoNotMatchButtonTapped() }
|
||||||
}
|
}
|
||||||
dividerItem {
|
dividerItem {
|
||||||
id("sep1")
|
id("sep1")
|
||||||
}
|
}
|
||||||
bottomSheetVerificationActionItem {
|
bottomSheetVerificationActionItem {
|
||||||
id("ok")
|
id("ok")
|
||||||
title(stringProvider.getString(R.string.verification_sas_match))
|
title(host.stringProvider.getString(R.string.verification_sas_match))
|
||||||
titleColor(colorProvider.getColor(R.color.riotx_accent))
|
titleColor(host.colorProvider.getColor(R.color.riotx_accent))
|
||||||
iconRes(R.drawable.ic_check_on)
|
iconRes(R.drawable.ic_check_on)
|
||||||
iconColor(colorProvider.getColor(R.color.riotx_accent))
|
iconColor(host.colorProvider.getColor(R.color.riotx_accent))
|
||||||
listener { listener?.onMatchButtonTapped() }
|
listener { host.listener?.onMatchButtonTapped() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,11 +40,12 @@ class VerificationQRWaitingController @Inject constructor(
|
||||||
|
|
||||||
override fun buildModels() {
|
override fun buildModels() {
|
||||||
val params = args ?: return
|
val params = args ?: return
|
||||||
|
val host = this
|
||||||
|
|
||||||
bottomSheetVerificationNoticeItem {
|
bottomSheetVerificationNoticeItem {
|
||||||
id("notice")
|
id("notice")
|
||||||
apply {
|
apply {
|
||||||
notice(stringProvider.getString(R.string.qr_code_scanned_verif_waiting_notice))
|
notice(host.stringProvider.getString(R.string.qr_code_scanned_verif_waiting_notice))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +56,7 @@ class VerificationQRWaitingController @Inject constructor(
|
||||||
|
|
||||||
bottomSheetVerificationWaitingItem {
|
bottomSheetVerificationWaitingItem {
|
||||||
id("waiting")
|
id("waiting")
|
||||||
title(stringProvider.getString(R.string.qr_code_scanned_verif_waiting, params.otherUserName))
|
title(host.stringProvider.getString(R.string.qr_code_scanned_verif_waiting, params.otherUserName))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,15 +44,16 @@ class VerificationQrScannedByOtherController @Inject constructor(
|
||||||
|
|
||||||
override fun buildModels() {
|
override fun buildModels() {
|
||||||
val state = viewState ?: return
|
val state = viewState ?: return
|
||||||
|
val host = this
|
||||||
|
|
||||||
bottomSheetVerificationNoticeItem {
|
bottomSheetVerificationNoticeItem {
|
||||||
id("notice")
|
id("notice")
|
||||||
apply {
|
apply {
|
||||||
if (state.isMe) {
|
if (state.isMe) {
|
||||||
notice(stringProvider.getString(R.string.qr_code_scanned_self_verif_notice))
|
notice(host.stringProvider.getString(R.string.qr_code_scanned_self_verif_notice))
|
||||||
} else {
|
} else {
|
||||||
val name = state.otherUserMxItem?.getBestName() ?: ""
|
val name = state.otherUserMxItem?.getBestName() ?: ""
|
||||||
notice(stringProvider.getString(R.string.qr_code_scanned_by_other_notice, name))
|
notice(host.stringProvider.getString(R.string.qr_code_scanned_by_other_notice, name))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,11 +69,11 @@ class VerificationQrScannedByOtherController @Inject constructor(
|
||||||
|
|
||||||
bottomSheetVerificationActionItem {
|
bottomSheetVerificationActionItem {
|
||||||
id("deny")
|
id("deny")
|
||||||
title(stringProvider.getString(R.string.qr_code_scanned_by_other_no))
|
title(host.stringProvider.getString(R.string.qr_code_scanned_by_other_no))
|
||||||
titleColor(colorProvider.getColor(R.color.vector_error_color))
|
titleColor(host.colorProvider.getColor(R.color.vector_error_color))
|
||||||
iconRes(R.drawable.ic_check_off)
|
iconRes(R.drawable.ic_check_off)
|
||||||
iconColor(colorProvider.getColor(R.color.vector_error_color))
|
iconColor(host.colorProvider.getColor(R.color.vector_error_color))
|
||||||
listener { listener?.onUserDeniesQrCodeScanned() }
|
listener { host.listener?.onUserDeniesQrCodeScanned() }
|
||||||
}
|
}
|
||||||
|
|
||||||
dividerItem {
|
dividerItem {
|
||||||
|
@ -81,11 +82,11 @@ class VerificationQrScannedByOtherController @Inject constructor(
|
||||||
|
|
||||||
bottomSheetVerificationActionItem {
|
bottomSheetVerificationActionItem {
|
||||||
id("confirm")
|
id("confirm")
|
||||||
title(stringProvider.getString(R.string.qr_code_scanned_by_other_yes))
|
title(host.stringProvider.getString(R.string.qr_code_scanned_by_other_yes))
|
||||||
titleColor(colorProvider.getColor(R.color.riotx_accent))
|
titleColor(host.colorProvider.getColor(R.color.riotx_accent))
|
||||||
iconRes(R.drawable.ic_check_on)
|
iconRes(R.drawable.ic_check_on)
|
||||||
iconColor(colorProvider.getColor(R.color.riotx_accent))
|
iconColor(host.colorProvider.getColor(R.color.riotx_accent))
|
||||||
listener { listener?.onUserConfirmsQrCodeScanned() }
|
listener { host.listener?.onUserConfirmsQrCodeScanned() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,12 +50,13 @@ class VerificationRequestController @Inject constructor(
|
||||||
override fun buildModels() {
|
override fun buildModels() {
|
||||||
val state = viewState ?: return
|
val state = viewState ?: return
|
||||||
val matrixItem = viewState?.otherUserMxItem ?: return
|
val matrixItem = viewState?.otherUserMxItem ?: return
|
||||||
|
val host = this
|
||||||
|
|
||||||
if (state.selfVerificationMode) {
|
if (state.selfVerificationMode) {
|
||||||
if (state.hasAnyOtherSession) {
|
if (state.hasAnyOtherSession) {
|
||||||
bottomSheetVerificationNoticeItem {
|
bottomSheetVerificationNoticeItem {
|
||||||
id("notice")
|
id("notice")
|
||||||
notice(stringProvider.getString(R.string.verification_open_other_to_verify))
|
notice(host.stringProvider.getString(R.string.verification_open_other_to_verify))
|
||||||
}
|
}
|
||||||
|
|
||||||
bottomSheetSelfWaitItem {
|
bottomSheetSelfWaitItem {
|
||||||
|
@ -75,12 +76,12 @@ class VerificationRequestController @Inject constructor(
|
||||||
}
|
}
|
||||||
bottomSheetVerificationActionItem {
|
bottomSheetVerificationActionItem {
|
||||||
id("passphrase")
|
id("passphrase")
|
||||||
title(stringProvider.getString(R.string.verification_cannot_access_other_session))
|
title(host.stringProvider.getString(R.string.verification_cannot_access_other_session))
|
||||||
titleColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
titleColor(host.colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
||||||
subTitle(subtitle)
|
subTitle(subtitle)
|
||||||
iconRes(R.drawable.ic_arrow_right)
|
iconRes(R.drawable.ic_arrow_right)
|
||||||
iconColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
iconColor(host.colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
||||||
listener { listener?.onClickRecoverFromPassphrase() }
|
listener { host.listener?.onClickRecoverFromPassphrase() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,11 +91,11 @@ class VerificationRequestController @Inject constructor(
|
||||||
|
|
||||||
bottomSheetVerificationActionItem {
|
bottomSheetVerificationActionItem {
|
||||||
id("skip")
|
id("skip")
|
||||||
title(stringProvider.getString(R.string.skip))
|
title(host.stringProvider.getString(R.string.skip))
|
||||||
titleColor(colorProvider.getColor(R.color.riotx_destructive_accent))
|
titleColor(host.colorProvider.getColor(R.color.riotx_destructive_accent))
|
||||||
iconRes(R.drawable.ic_arrow_right)
|
iconRes(R.drawable.ic_arrow_right)
|
||||||
iconColor(colorProvider.getColor(R.color.riotx_destructive_accent))
|
iconColor(host.colorProvider.getColor(R.color.riotx_destructive_accent))
|
||||||
listener { listener?.onClickSkip() }
|
listener { host.listener?.onClickSkip() }
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val styledText =
|
val styledText =
|
||||||
|
@ -121,18 +122,18 @@ class VerificationRequestController @Inject constructor(
|
||||||
is Uninitialized -> {
|
is Uninitialized -> {
|
||||||
bottomSheetVerificationActionItem {
|
bottomSheetVerificationActionItem {
|
||||||
id("start")
|
id("start")
|
||||||
title(stringProvider.getString(R.string.start_verification))
|
title(host.stringProvider.getString(R.string.start_verification))
|
||||||
titleColor(colorProvider.getColor(R.color.riotx_accent))
|
titleColor(host.colorProvider.getColor(R.color.riotx_accent))
|
||||||
subTitle(stringProvider.getString(R.string.verification_request_start_notice))
|
subTitle(host.stringProvider.getString(R.string.verification_request_start_notice))
|
||||||
iconRes(R.drawable.ic_arrow_right)
|
iconRes(R.drawable.ic_arrow_right)
|
||||||
iconColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
iconColor(host.colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
||||||
listener { listener?.onClickOnVerificationStart() }
|
listener { host.listener?.onClickOnVerificationStart() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Loading -> {
|
is Loading -> {
|
||||||
bottomSheetVerificationWaitingItem {
|
bottomSheetVerificationWaitingItem {
|
||||||
id("waiting")
|
id("waiting")
|
||||||
title(stringProvider.getString(R.string.verification_request_waiting_for, matrixItem.getBestName()))
|
title(host.stringProvider.getString(R.string.verification_request_waiting_for, matrixItem.getBestName()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Success -> {
|
is Success -> {
|
||||||
|
@ -140,12 +141,12 @@ class VerificationRequestController @Inject constructor(
|
||||||
if (state.isMe) {
|
if (state.isMe) {
|
||||||
bottomSheetVerificationWaitingItem {
|
bottomSheetVerificationWaitingItem {
|
||||||
id("waiting")
|
id("waiting")
|
||||||
title(stringProvider.getString(R.string.verification_request_waiting))
|
title(host.stringProvider.getString(R.string.verification_request_waiting))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
bottomSheetVerificationWaitingItem {
|
bottomSheetVerificationWaitingItem {
|
||||||
id("waiting")
|
id("waiting")
|
||||||
title(stringProvider.getString(R.string.verification_request_waiting_for, matrixItem.getBestName()))
|
title(host.stringProvider.getString(R.string.verification_request_waiting_for, matrixItem.getBestName()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,12 +161,12 @@ class VerificationRequestController @Inject constructor(
|
||||||
|
|
||||||
bottomSheetVerificationActionItem {
|
bottomSheetVerificationActionItem {
|
||||||
id("wasnote")
|
id("wasnote")
|
||||||
title(stringProvider.getString(R.string.verify_new_session_was_not_me))
|
title(host.stringProvider.getString(R.string.verify_new_session_was_not_me))
|
||||||
titleColor(colorProvider.getColor(R.color.riotx_destructive_accent))
|
titleColor(host.colorProvider.getColor(R.color.riotx_destructive_accent))
|
||||||
subTitle(stringProvider.getString(R.string.verify_new_session_compromized))
|
subTitle(host.stringProvider.getString(R.string.verify_new_session_compromized))
|
||||||
iconRes(R.drawable.ic_arrow_right)
|
iconRes(R.drawable.ic_arrow_right)
|
||||||
iconColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
iconColor(host.colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
||||||
listener { listener?.onClickOnWasNotMe() }
|
listener { host.listener?.onClickOnWasNotMe() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,25 +34,26 @@ class RoomDevToolRootController @Inject constructor(
|
||||||
var interactionListener: DevToolsInteractionListener? = null
|
var interactionListener: DevToolsInteractionListener? = null
|
||||||
|
|
||||||
override fun buildModels() {
|
override fun buildModels() {
|
||||||
|
val host = this
|
||||||
genericButtonItem {
|
genericButtonItem {
|
||||||
id("explore")
|
id("explore")
|
||||||
text(stringProvider.getString(R.string.dev_tools_explore_room_state))
|
text(host.stringProvider.getString(R.string.dev_tools_explore_room_state))
|
||||||
buttonClickAction(View.OnClickListener {
|
buttonClickAction(View.OnClickListener {
|
||||||
interactionListener?.processAction(RoomDevToolAction.ExploreRoomState)
|
host.interactionListener?.processAction(RoomDevToolAction.ExploreRoomState)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
genericButtonItem {
|
genericButtonItem {
|
||||||
id("send")
|
id("send")
|
||||||
text(stringProvider.getString(R.string.dev_tools_send_custom_event))
|
text(host.stringProvider.getString(R.string.dev_tools_send_custom_event))
|
||||||
buttonClickAction(View.OnClickListener {
|
buttonClickAction(View.OnClickListener {
|
||||||
interactionListener?.processAction(RoomDevToolAction.SendCustomEvent(false))
|
host.interactionListener?.processAction(RoomDevToolAction.SendCustomEvent(false))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
genericButtonItem {
|
genericButtonItem {
|
||||||
id("send_state")
|
id("send_state")
|
||||||
text(stringProvider.getString(R.string.dev_tools_send_state_event))
|
text(host.stringProvider.getString(R.string.dev_tools_send_state_event))
|
||||||
buttonClickAction(View.OnClickListener {
|
buttonClickAction(View.OnClickListener {
|
||||||
interactionListener?.processAction(RoomDevToolAction.SendCustomEvent(true))
|
host.interactionListener?.processAction(RoomDevToolAction.SendCustomEvent(true))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ class RoomDevToolSendFormController @Inject constructor(
|
||||||
|
|
||||||
override fun buildModels(data: RoomDevToolViewState?) {
|
override fun buildModels(data: RoomDevToolViewState?) {
|
||||||
val sendEventForm = (data?.displayMode as? RoomDevToolViewState.Mode.SendEventForm) ?: return
|
val sendEventForm = (data?.displayMode as? RoomDevToolViewState.Mode.SendEventForm) ?: return
|
||||||
|
val host = this
|
||||||
|
|
||||||
genericFooterItem {
|
genericFooterItem {
|
||||||
id("topSpace")
|
id("topSpace")
|
||||||
|
@ -41,10 +42,10 @@ class RoomDevToolSendFormController @Inject constructor(
|
||||||
id("event_type")
|
id("event_type")
|
||||||
enabled(true)
|
enabled(true)
|
||||||
value(data.sendEventDraft?.type)
|
value(data.sendEventDraft?.type)
|
||||||
hint(stringProvider.getString(R.string.dev_tools_form_hint_type))
|
hint(host.stringProvider.getString(R.string.dev_tools_form_hint_type))
|
||||||
showBottomSeparator(false)
|
showBottomSeparator(false)
|
||||||
onTextChange { text ->
|
onTextChange { text ->
|
||||||
interactionListener?.processAction(RoomDevToolAction.CustomEventTypeChange(text))
|
host.interactionListener?.processAction(RoomDevToolAction.CustomEventTypeChange(text))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,10 +54,10 @@ class RoomDevToolSendFormController @Inject constructor(
|
||||||
id("state_key")
|
id("state_key")
|
||||||
enabled(true)
|
enabled(true)
|
||||||
value(data.sendEventDraft?.stateKey)
|
value(data.sendEventDraft?.stateKey)
|
||||||
hint(stringProvider.getString(R.string.dev_tools_form_hint_state_key))
|
hint(host.stringProvider.getString(R.string.dev_tools_form_hint_state_key))
|
||||||
showBottomSeparator(false)
|
showBottomSeparator(false)
|
||||||
onTextChange { text ->
|
onTextChange { text ->
|
||||||
interactionListener?.processAction(RoomDevToolAction.CustomEventStateKeyChange(text))
|
host.interactionListener?.processAction(RoomDevToolAction.CustomEventStateKeyChange(text))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,10 +66,10 @@ class RoomDevToolSendFormController @Inject constructor(
|
||||||
id("event_content")
|
id("event_content")
|
||||||
enabled(true)
|
enabled(true)
|
||||||
value(data.sendEventDraft?.content)
|
value(data.sendEventDraft?.content)
|
||||||
hint(stringProvider.getString(R.string.dev_tools_form_hint_event_content))
|
hint(host.stringProvider.getString(R.string.dev_tools_form_hint_event_content))
|
||||||
showBottomSeparator(false)
|
showBottomSeparator(false)
|
||||||
onTextChange { text ->
|
onTextChange { text ->
|
||||||
interactionListener?.processAction(RoomDevToolAction.CustomEventContentChange(text))
|
host.interactionListener?.processAction(RoomDevToolAction.CustomEventContentChange(text))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ class RoomStateListController @Inject constructor(
|
||||||
var interactionListener: DevToolsInteractionListener? = null
|
var interactionListener: DevToolsInteractionListener? = null
|
||||||
|
|
||||||
override fun buildModels(data: RoomDevToolViewState?) {
|
override fun buildModels(data: RoomDevToolViewState?) {
|
||||||
|
val host = this
|
||||||
when (data?.displayMode) {
|
when (data?.displayMode) {
|
||||||
RoomDevToolViewState.Mode.StateEventList -> {
|
RoomDevToolViewState.Mode.StateEventList -> {
|
||||||
val stateEventsGroups = data.stateEvents.invoke().orEmpty().groupBy { it.getClearType() }
|
val stateEventsGroups = data.stateEvents.invoke().orEmpty().groupBy { it.getClearType() }
|
||||||
|
@ -42,17 +43,17 @@ class RoomStateListController @Inject constructor(
|
||||||
if (stateEventsGroups.isEmpty()) {
|
if (stateEventsGroups.isEmpty()) {
|
||||||
noResultItem {
|
noResultItem {
|
||||||
id("no state events")
|
id("no state events")
|
||||||
text(stringProvider.getString(R.string.no_result_placeholder))
|
text(host.stringProvider.getString(R.string.no_result_placeholder))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
stateEventsGroups.forEach { entry ->
|
stateEventsGroups.forEach { entry ->
|
||||||
genericItem {
|
genericItem {
|
||||||
id(entry.key)
|
id(entry.key)
|
||||||
title(entry.key)
|
title(entry.key)
|
||||||
description(stringProvider.getQuantityString(R.plurals.entries, entry.value.size, entry.value.size))
|
description(host.stringProvider.getQuantityString(R.plurals.entries, entry.value.size, entry.value.size))
|
||||||
itemClickAction(GenericItem.Action("view").apply {
|
itemClickAction(GenericItem.Action("view").apply {
|
||||||
perform = Runnable {
|
perform = Runnable {
|
||||||
interactionListener?.processAction(RoomDevToolAction.ShowStateEventType(entry.key))
|
host.interactionListener?.processAction(RoomDevToolAction.ShowStateEventType(entry.key))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -64,7 +65,7 @@ class RoomStateListController @Inject constructor(
|
||||||
if (stateEvents.isEmpty()) {
|
if (stateEvents.isEmpty()) {
|
||||||
noResultItem {
|
noResultItem {
|
||||||
id("no state events")
|
id("no state events")
|
||||||
text(stringProvider.getString(R.string.no_result_placeholder))
|
text(host.stringProvider.getString(R.string.no_result_placeholder))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
stateEvents.forEach { stateEvent ->
|
stateEvents.forEach { stateEvent ->
|
||||||
|
@ -80,13 +81,13 @@ class RoomStateListController @Inject constructor(
|
||||||
title(span {
|
title(span {
|
||||||
+"Type: "
|
+"Type: "
|
||||||
span {
|
span {
|
||||||
textColor = colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)
|
textColor = host.colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)
|
||||||
text = "\"${stateEvent.type}\""
|
text = "\"${stateEvent.type}\""
|
||||||
textStyle = "normal"
|
textStyle = "normal"
|
||||||
}
|
}
|
||||||
+"\nState Key: "
|
+"\nState Key: "
|
||||||
span {
|
span {
|
||||||
textColor = colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)
|
textColor = host.colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)
|
||||||
text = stateEvent.stateKey.let { "\"$it\"" }
|
text = stateEvent.stateKey.let { "\"$it\"" }
|
||||||
textStyle = "normal"
|
textStyle = "normal"
|
||||||
}
|
}
|
||||||
|
@ -94,7 +95,7 @@ class RoomStateListController @Inject constructor(
|
||||||
description(contentJson)
|
description(contentJson)
|
||||||
itemClickAction(GenericItem.Action("view").apply {
|
itemClickAction(GenericItem.Action("view").apply {
|
||||||
perform = Runnable {
|
perform = Runnable {
|
||||||
interactionListener?.processAction(RoomDevToolAction.ShowStateEvent(stateEvent))
|
host.interactionListener?.processAction(RoomDevToolAction.ShowStateEvent(stateEvent))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,7 @@ class DiscoverySettingsController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildConsentSection(data: DiscoverySettingsState) {
|
private fun buildConsentSection(data: DiscoverySettingsState) {
|
||||||
|
val host = this
|
||||||
settingsSectionTitleItem {
|
settingsSectionTitleItem {
|
||||||
id("idConsentTitle")
|
id("idConsentTitle")
|
||||||
titleResId(R.string.settings_discovery_consent_title)
|
titleResId(R.string.settings_discovery_consent_title)
|
||||||
|
@ -86,10 +87,10 @@ class DiscoverySettingsController @Inject constructor(
|
||||||
}
|
}
|
||||||
settingsButtonItem {
|
settingsButtonItem {
|
||||||
id("idConsentButton")
|
id("idConsentButton")
|
||||||
colorProvider(colorProvider)
|
colorProvider(host.colorProvider)
|
||||||
buttonTitleId(R.string.settings_discovery_consent_action_revoke)
|
buttonTitleId(R.string.settings_discovery_consent_action_revoke)
|
||||||
buttonStyle(ButtonStyle.DESTRUCTIVE)
|
buttonStyle(ButtonStyle.DESTRUCTIVE)
|
||||||
buttonClickListener { listener?.onTapUpdateUserConsent(false) }
|
buttonClickListener { host.listener?.onTapUpdateUserConsent(false) }
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
settingsInfoItem {
|
settingsInfoItem {
|
||||||
|
@ -98,15 +99,16 @@ class DiscoverySettingsController @Inject constructor(
|
||||||
}
|
}
|
||||||
settingsButtonItem {
|
settingsButtonItem {
|
||||||
id("idConsentButton")
|
id("idConsentButton")
|
||||||
colorProvider(colorProvider)
|
colorProvider(host.colorProvider)
|
||||||
buttonTitleId(R.string.settings_discovery_consent_action_give_consent)
|
buttonTitleId(R.string.settings_discovery_consent_action_give_consent)
|
||||||
buttonClickListener { listener?.onTapUpdateUserConsent(true) }
|
buttonClickListener { host.listener?.onTapUpdateUserConsent(true) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildIdentityServerSection(data: DiscoverySettingsState) {
|
private fun buildIdentityServerSection(data: DiscoverySettingsState) {
|
||||||
val identityServer = data.identityServer() ?: stringProvider.getString(R.string.none)
|
val identityServer = data.identityServer() ?: stringProvider.getString(R.string.none)
|
||||||
|
val host = this
|
||||||
|
|
||||||
settingsSectionTitleItem {
|
settingsSectionTitleItem {
|
||||||
id("idServerTitle")
|
id("idServerTitle")
|
||||||
|
@ -121,22 +123,22 @@ class DiscoverySettingsController @Inject constructor(
|
||||||
if (data.identityServer() != null && data.termsNotSigned) {
|
if (data.identityServer() != null && data.termsNotSigned) {
|
||||||
settingsInfoItem {
|
settingsInfoItem {
|
||||||
id("idServerFooter")
|
id("idServerFooter")
|
||||||
helperText(stringProvider.getString(R.string.settings_agree_to_terms, identityServer))
|
helperText(host.stringProvider.getString(R.string.settings_agree_to_terms, identityServer))
|
||||||
showCompoundDrawable(true)
|
showCompoundDrawable(true)
|
||||||
itemClickListener(View.OnClickListener { listener?.openIdentityServerTerms() })
|
itemClickListener(View.OnClickListener { host.listener?.openIdentityServerTerms() })
|
||||||
}
|
}
|
||||||
settingsButtonItem {
|
settingsButtonItem {
|
||||||
id("seeTerms")
|
id("seeTerms")
|
||||||
colorProvider(colorProvider)
|
colorProvider(host.colorProvider)
|
||||||
buttonTitle(stringProvider.getString(R.string.open_terms_of, identityServer))
|
buttonTitle(host.stringProvider.getString(R.string.open_terms_of, identityServer))
|
||||||
buttonClickListener { listener?.openIdentityServerTerms() }
|
buttonClickListener { host.listener?.openIdentityServerTerms() }
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
settingsInfoItem {
|
settingsInfoItem {
|
||||||
id("idServerFooter")
|
id("idServerFooter")
|
||||||
showCompoundDrawable(false)
|
showCompoundDrawable(false)
|
||||||
if (data.identityServer() != null) {
|
if (data.identityServer() != null) {
|
||||||
helperText(stringProvider.getString(R.string.settings_discovery_identity_server_info, identityServer))
|
helperText(host.stringProvider.getString(R.string.settings_discovery_identity_server_info, identityServer))
|
||||||
} else {
|
} else {
|
||||||
helperTextResId(R.string.settings_discovery_identity_server_info_none)
|
helperTextResId(R.string.settings_discovery_identity_server_info_none)
|
||||||
}
|
}
|
||||||
|
@ -145,13 +147,13 @@ class DiscoverySettingsController @Inject constructor(
|
||||||
|
|
||||||
settingsButtonItem {
|
settingsButtonItem {
|
||||||
id("change")
|
id("change")
|
||||||
colorProvider(colorProvider)
|
colorProvider(host.colorProvider)
|
||||||
if (data.identityServer() == null) {
|
if (data.identityServer() == null) {
|
||||||
buttonTitleId(R.string.add_identity_server)
|
buttonTitleId(R.string.add_identity_server)
|
||||||
} else {
|
} else {
|
||||||
buttonTitleId(R.string.change_identity_server)
|
buttonTitleId(R.string.change_identity_server)
|
||||||
}
|
}
|
||||||
buttonClickListener { listener?.onTapChangeIdentityServer() }
|
buttonClickListener { host.listener?.onTapChangeIdentityServer() }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.identityServer() != null) {
|
if (data.identityServer() != null) {
|
||||||
|
@ -161,15 +163,16 @@ class DiscoverySettingsController @Inject constructor(
|
||||||
}
|
}
|
||||||
settingsButtonItem {
|
settingsButtonItem {
|
||||||
id("remove")
|
id("remove")
|
||||||
colorProvider(colorProvider)
|
colorProvider(host.colorProvider)
|
||||||
buttonTitleId(R.string.disconnect_identity_server)
|
buttonTitleId(R.string.disconnect_identity_server)
|
||||||
buttonStyle(ButtonStyle.DESTRUCTIVE)
|
buttonStyle(ButtonStyle.DESTRUCTIVE)
|
||||||
buttonClickListener { listener?.onTapDisconnectIdentityServer() }
|
buttonClickListener { host.listener?.onTapDisconnectIdentityServer() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildEmailsSection(emails: Async<List<PidInfo>>) {
|
private fun buildEmailsSection(emails: Async<List<PidInfo>>) {
|
||||||
|
val host = this
|
||||||
settingsSectionTitleItem {
|
settingsSectionTitleItem {
|
||||||
id("emails")
|
id("emails")
|
||||||
titleResId(R.string.settings_discovery_emails_title)
|
titleResId(R.string.settings_discovery_emails_title)
|
||||||
|
@ -190,7 +193,7 @@ class DiscoverySettingsController @Inject constructor(
|
||||||
if (emails().isEmpty()) {
|
if (emails().isEmpty()) {
|
||||||
settingsInfoItem {
|
settingsInfoItem {
|
||||||
id("emailsEmpty")
|
id("emailsEmpty")
|
||||||
helperText(stringProvider.getString(R.string.settings_discovery_no_mails))
|
helperText(host.stringProvider.getString(R.string.settings_discovery_no_mails))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
emails().forEach { buildEmail(it) }
|
emails().forEach { buildEmail(it) }
|
||||||
|
@ -202,6 +205,7 @@ class DiscoverySettingsController @Inject constructor(
|
||||||
private fun buildEmail(pidInfo: PidInfo) {
|
private fun buildEmail(pidInfo: PidInfo) {
|
||||||
buildThreePid(pidInfo)
|
buildThreePid(pidInfo)
|
||||||
|
|
||||||
|
val host = this
|
||||||
if (pidInfo.isShared is Fail) {
|
if (pidInfo.isShared is Fail) {
|
||||||
buildSharedFail(pidInfo)
|
buildSharedFail(pidInfo)
|
||||||
} else if (pidInfo.isShared() == SharedState.BINDING_IN_PROGRESS) {
|
} else if (pidInfo.isShared() == SharedState.BINDING_IN_PROGRESS) {
|
||||||
|
@ -210,14 +214,14 @@ class DiscoverySettingsController @Inject constructor(
|
||||||
is Loading ->
|
is Loading ->
|
||||||
settingsInformationItem {
|
settingsInformationItem {
|
||||||
id("info${pidInfo.threePid.value}")
|
id("info${pidInfo.threePid.value}")
|
||||||
colorProvider(colorProvider)
|
colorProvider(host.colorProvider)
|
||||||
message(stringProvider.getString(R.string.settings_discovery_confirm_mail, pidInfo.threePid.value))
|
message(host.stringProvider.getString(R.string.settings_discovery_confirm_mail, pidInfo.threePid.value))
|
||||||
}
|
}
|
||||||
is Fail ->
|
is Fail ->
|
||||||
settingsInformationItem {
|
settingsInformationItem {
|
||||||
id("info${pidInfo.threePid.value}")
|
id("info${pidInfo.threePid.value}")
|
||||||
colorProvider(colorProvider)
|
colorProvider(host.colorProvider)
|
||||||
message(stringProvider.getString(R.string.settings_discovery_confirm_mail_not_clicked, pidInfo.threePid.value))
|
message(host.stringProvider.getString(R.string.settings_discovery_confirm_mail_not_clicked, pidInfo.threePid.value))
|
||||||
textColorId(R.color.riotx_destructive_accent)
|
textColorId(R.color.riotx_destructive_accent)
|
||||||
}
|
}
|
||||||
is Success -> Unit /* Cannot happen */
|
is Success -> Unit /* Cannot happen */
|
||||||
|
@ -236,6 +240,7 @@ class DiscoverySettingsController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildMsisdnSection(msisdns: Async<List<PidInfo>>) {
|
private fun buildMsisdnSection(msisdns: Async<List<PidInfo>>) {
|
||||||
|
val host = this
|
||||||
settingsSectionTitleItem {
|
settingsSectionTitleItem {
|
||||||
id("msisdn")
|
id("msisdn")
|
||||||
titleResId(R.string.settings_discovery_msisdn_title)
|
titleResId(R.string.settings_discovery_msisdn_title)
|
||||||
|
@ -257,7 +262,7 @@ class DiscoverySettingsController @Inject constructor(
|
||||||
if (msisdns().isEmpty()) {
|
if (msisdns().isEmpty()) {
|
||||||
settingsInfoItem {
|
settingsInfoItem {
|
||||||
id("no_msisdn")
|
id("no_msisdn")
|
||||||
helperText(stringProvider.getString(R.string.settings_discovery_no_msisdn))
|
helperText(host.stringProvider.getString(R.string.settings_discovery_no_msisdn))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
msisdns().forEach { buildMsisdn(it) }
|
msisdns().forEach { buildMsisdn(it) }
|
||||||
|
@ -267,6 +272,7 @@ class DiscoverySettingsController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildMsisdn(pidInfo: PidInfo) {
|
private fun buildMsisdn(pidInfo: PidInfo) {
|
||||||
|
val host = this
|
||||||
val phoneNumber = pidInfo.threePid.getFormattedValue()
|
val phoneNumber = pidInfo.threePid.getFormattedValue()
|
||||||
|
|
||||||
buildThreePid(pidInfo, phoneNumber)
|
buildThreePid(pidInfo, phoneNumber)
|
||||||
|
@ -289,19 +295,19 @@ class DiscoverySettingsController @Inject constructor(
|
||||||
}
|
}
|
||||||
settingsEditTextItem {
|
settingsEditTextItem {
|
||||||
id("msisdnVerification${pidInfo.threePid.value}")
|
id("msisdnVerification${pidInfo.threePid.value}")
|
||||||
descriptionText(stringProvider.getString(R.string.settings_text_message_sent, phoneNumber))
|
descriptionText(host.stringProvider.getString(R.string.settings_text_message_sent, phoneNumber))
|
||||||
errorText(errorText)
|
errorText(errorText)
|
||||||
inProgress(pidInfo.finalRequest is Loading)
|
inProgress(pidInfo.finalRequest is Loading)
|
||||||
interactionListener(object : SettingsEditTextItem.Listener {
|
interactionListener(object : SettingsEditTextItem.Listener {
|
||||||
override fun onValidate() {
|
override fun onValidate() {
|
||||||
val code = codes[pidInfo.threePid]
|
val code = host.codes[pidInfo.threePid]
|
||||||
if (pidInfo.threePid is ThreePid.Msisdn && code != null) {
|
if (pidInfo.threePid is ThreePid.Msisdn && code != null) {
|
||||||
listener?.sendMsisdnVerificationCode(pidInfo.threePid, code)
|
host.listener?.sendMsisdnVerificationCode(pidInfo.threePid, code)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onTextChange(text: String) {
|
override fun onTextChange(text: String) {
|
||||||
codes[pidInfo.threePid] = text
|
host.codes[pidInfo.threePid] = text
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -310,11 +316,12 @@ class DiscoverySettingsController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildThreePid(pidInfo: PidInfo, title: String = pidInfo.threePid.value) {
|
private fun buildThreePid(pidInfo: PidInfo, title: String = pidInfo.threePid.value) {
|
||||||
|
val host = this
|
||||||
settingsTextButtonSingleLineItem {
|
settingsTextButtonSingleLineItem {
|
||||||
id(pidInfo.threePid.value)
|
id(pidInfo.threePid.value)
|
||||||
title(title)
|
title(title)
|
||||||
colorProvider(colorProvider)
|
colorProvider(host.colorProvider)
|
||||||
stringProvider(stringProvider)
|
stringProvider(host.stringProvider)
|
||||||
when (pidInfo.isShared) {
|
when (pidInfo.isShared) {
|
||||||
is Loading -> {
|
is Loading -> {
|
||||||
buttonIndeterminate(true)
|
buttonIndeterminate(true)
|
||||||
|
@ -322,9 +329,9 @@ class DiscoverySettingsController @Inject constructor(
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
buttonType(ButtonType.NORMAL)
|
buttonType(ButtonType.NORMAL)
|
||||||
buttonStyle(ButtonStyle.DESTRUCTIVE)
|
buttonStyle(ButtonStyle.DESTRUCTIVE)
|
||||||
buttonTitle(stringProvider.getString(R.string.global_retry))
|
buttonTitle(host.stringProvider.getString(R.string.global_retry))
|
||||||
iconMode(IconMode.ERROR)
|
iconMode(IconMode.ERROR)
|
||||||
buttonClickListener { listener?.onTapRetryToRetrieveBindings() }
|
buttonClickListener { host.listener?.onTapRetryToRetrieveBindings() }
|
||||||
}
|
}
|
||||||
is Success -> when (pidInfo.isShared()) {
|
is Success -> when (pidInfo.isShared()) {
|
||||||
SharedState.SHARED,
|
SharedState.SHARED,
|
||||||
|
@ -333,9 +340,9 @@ class DiscoverySettingsController @Inject constructor(
|
||||||
checked(pidInfo.isShared() == SharedState.SHARED)
|
checked(pidInfo.isShared() == SharedState.SHARED)
|
||||||
switchChangeListener { _, checked ->
|
switchChangeListener { _, checked ->
|
||||||
if (checked) {
|
if (checked) {
|
||||||
listener?.onTapShare(pidInfo.threePid)
|
host.listener?.onTapShare(pidInfo.threePid)
|
||||||
} else {
|
} else {
|
||||||
listener?.onTapRevoke(pidInfo.threePid)
|
host.listener?.onTapRevoke(pidInfo.threePid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -353,32 +360,34 @@ class DiscoverySettingsController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildSharedFail(pidInfo: PidInfo) {
|
private fun buildSharedFail(pidInfo: PidInfo) {
|
||||||
|
val host = this
|
||||||
settingsInformationItem {
|
settingsInformationItem {
|
||||||
id("info${pidInfo.threePid.value}")
|
id("info${pidInfo.threePid.value}")
|
||||||
colorProvider(colorProvider)
|
colorProvider(host.colorProvider)
|
||||||
textColorId(R.color.vector_error_color)
|
textColorId(R.color.vector_error_color)
|
||||||
message((pidInfo.isShared as? Fail)?.error?.message ?: "")
|
message((pidInfo.isShared as? Fail)?.error?.message ?: "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildContinueCancel(threePid: ThreePid) {
|
private fun buildContinueCancel(threePid: ThreePid) {
|
||||||
|
val host = this
|
||||||
settingsContinueCancelItem {
|
settingsContinueCancelItem {
|
||||||
id("bottom${threePid.value}")
|
id("bottom${threePid.value}")
|
||||||
continueOnClick {
|
continueOnClick {
|
||||||
when (threePid) {
|
when (threePid) {
|
||||||
is ThreePid.Email -> {
|
is ThreePid.Email -> {
|
||||||
listener?.checkEmailVerification(threePid)
|
host.listener?.checkEmailVerification(threePid)
|
||||||
}
|
}
|
||||||
is ThreePid.Msisdn -> {
|
is ThreePid.Msisdn -> {
|
||||||
val code = codes[threePid]
|
val code = host.codes[threePid]
|
||||||
if (code != null) {
|
if (code != null) {
|
||||||
listener?.sendMsisdnVerificationCode(threePid, code)
|
host.listener?.sendMsisdnVerificationCode(threePid, code)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cancelOnClick {
|
cancelOnClick {
|
||||||
listener?.cancelBinding(threePid)
|
host.listener?.cancelBinding(threePid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ class BreadcrumbsController @Inject constructor(
|
||||||
|
|
||||||
override fun buildModels() {
|
override fun buildModels() {
|
||||||
val safeViewState = viewState ?: return
|
val safeViewState = viewState ?: return
|
||||||
|
val host = this
|
||||||
// Add a ZeroItem to avoid automatic scroll when the breadcrumbs are updated from another client
|
// Add a ZeroItem to avoid automatic scroll when the breadcrumbs are updated from another client
|
||||||
zeroItem {
|
zeroItem {
|
||||||
id("top")
|
id("top")
|
||||||
|
@ -57,7 +57,7 @@ class BreadcrumbsController @Inject constructor(
|
||||||
breadcrumbsItem {
|
breadcrumbsItem {
|
||||||
id(it.roomId)
|
id(it.roomId)
|
||||||
hasTypingUsers(it.typingUsers.isNotEmpty())
|
hasTypingUsers(it.typingUsers.isNotEmpty())
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
matrixItem(it.toMatrixItem())
|
matrixItem(it.toMatrixItem())
|
||||||
unreadNotificationCount(it.notificationCount)
|
unreadNotificationCount(it.notificationCount)
|
||||||
showHighlighted(it.highlightCount > 0)
|
showHighlighted(it.highlightCount > 0)
|
||||||
|
@ -65,7 +65,7 @@ class BreadcrumbsController @Inject constructor(
|
||||||
hasDraft(it.userDrafts.isNotEmpty())
|
hasDraft(it.userDrafts.isNotEmpty())
|
||||||
itemClickListener(
|
itemClickListener(
|
||||||
DebouncedClickListener({ _ ->
|
DebouncedClickListener({ _ ->
|
||||||
listener?.onBreadcrumbClicked(it.roomId)
|
host.listener?.onBreadcrumbClicked(it.roomId)
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,15 +61,16 @@ class SearchResultController @Inject constructor(
|
||||||
override fun buildModels(data: SearchViewState?) {
|
override fun buildModels(data: SearchViewState?) {
|
||||||
data ?: return
|
data ?: return
|
||||||
|
|
||||||
|
val host = this
|
||||||
val searchItems = buildSearchResultItems(data)
|
val searchItems = buildSearchResultItems(data)
|
||||||
|
|
||||||
if (data.hasMoreResult) {
|
if (data.hasMoreResult) {
|
||||||
loadingItem {
|
loadingItem {
|
||||||
// Always use a different id, because we can be notified several times of visibility state changed
|
// Always use a different id, because we can be notified several times of visibility state changed
|
||||||
id("loadMore${idx++}")
|
id("loadMore${host.idx++}")
|
||||||
onVisibilityStateChanged { _, _, visibilityState ->
|
onVisibilityStateChanged { _, _, visibilityState ->
|
||||||
if (visibilityState == VisibilityState.VISIBLE) {
|
if (visibilityState == VisibilityState.VISIBLE) {
|
||||||
listener?.loadMore()
|
host.listener?.loadMore()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,12 +79,12 @@ class SearchResultController @Inject constructor(
|
||||||
// All returned results by the server has been filtered out and there is no more result
|
// All returned results by the server has been filtered out and there is no more result
|
||||||
noResultItem {
|
noResultItem {
|
||||||
id("noResult")
|
id("noResult")
|
||||||
text(stringProvider.getString(R.string.no_result_placeholder))
|
text(host.stringProvider.getString(R.string.no_result_placeholder))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
noResultItem {
|
noResultItem {
|
||||||
id("noMoreResult")
|
id("noMoreResult")
|
||||||
text(stringProvider.getString(R.string.no_more_results))
|
text(host.stringProvider.getString(R.string.no_more_results))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -456,9 +456,10 @@ class TimelineEventController @Inject constructor(private val dateFormatter: Vec
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun LoadingItem_.setVisibilityStateChangedListener(direction: Timeline.Direction): LoadingItem_ {
|
private fun LoadingItem_.setVisibilityStateChangedListener(direction: Timeline.Direction): LoadingItem_ {
|
||||||
|
val host = this@TimelineEventController
|
||||||
return onVisibilityStateChanged { _, _, visibilityState ->
|
return onVisibilityStateChanged { _, _, visibilityState ->
|
||||||
if (visibilityState == VisibilityState.VISIBLE) {
|
if (visibilityState == VisibilityState.VISIBLE) {
|
||||||
callback?.onLoadMore(direction)
|
host.callback?.onLoadMore(direction)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -498,8 +499,9 @@ class TimelineEventController @Inject constructor(private val dateFormatter: Vec
|
||||||
* Return true if added
|
* Return true if added
|
||||||
*/
|
*/
|
||||||
private fun LoadingItem_.addWhenLoading(direction: Timeline.Direction): Boolean {
|
private fun LoadingItem_.addWhenLoading(direction: Timeline.Direction): Boolean {
|
||||||
val shouldAdd = timeline?.hasMoreToLoad(direction) ?: false
|
val host = this@TimelineEventController
|
||||||
addIf(shouldAdd, this@TimelineEventController)
|
val shouldAdd = host.timeline?.hasMoreToLoad(direction) ?: false
|
||||||
|
addIf(shouldAdd, host)
|
||||||
return shouldAdd
|
return shouldAdd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,19 +61,20 @@ class MessageActionsEpoxyController @Inject constructor(
|
||||||
var listener: MessageActionsEpoxyControllerListener? = null
|
var listener: MessageActionsEpoxyControllerListener? = null
|
||||||
|
|
||||||
override fun buildModels(state: MessageActionState) {
|
override fun buildModels(state: MessageActionState) {
|
||||||
|
val host = this
|
||||||
// Message preview
|
// Message preview
|
||||||
val date = state.timelineEvent()?.root?.originServerTs
|
val date = state.timelineEvent()?.root?.originServerTs
|
||||||
val formattedDate = dateFormatter.format(date, DateFormatKind.MESSAGE_DETAIL)
|
val formattedDate = dateFormatter.format(date, DateFormatKind.MESSAGE_DETAIL)
|
||||||
bottomSheetMessagePreviewItem {
|
bottomSheetMessagePreviewItem {
|
||||||
id("preview")
|
id("preview")
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
matrixItem(state.informationData.matrixItem)
|
matrixItem(state.informationData.matrixItem)
|
||||||
movementMethod(createLinkMovementMethod(listener))
|
movementMethod(createLinkMovementMethod(host.listener))
|
||||||
imageContentRenderer(imageContentRenderer)
|
imageContentRenderer(host.imageContentRenderer)
|
||||||
data(state.timelineEvent()?.buildImageContentRendererData(dimensionConverter.dpToPx(66)))
|
data(state.timelineEvent()?.buildImageContentRendererData(host.dimensionConverter.dpToPx(66)))
|
||||||
userClicked { listener?.didSelectMenuAction(EventSharedAction.OpenUserProfile(state.informationData.senderId)) }
|
userClicked { host.listener?.didSelectMenuAction(EventSharedAction.OpenUserProfile(state.informationData.senderId)) }
|
||||||
body(state.messageBody.linkify(listener))
|
body(state.messageBody.linkify(host.listener))
|
||||||
bodyDetails(eventDetailsFormatter.format(state.timelineEvent()?.root))
|
bodyDetails(host.eventDetailsFormatter.format(state.timelineEvent()?.root))
|
||||||
time(formattedDate)
|
time(formattedDate)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,14 +95,14 @@ class MessageActionsEpoxyController @Inject constructor(
|
||||||
bottomSheetSendStateItem {
|
bottomSheetSendStateItem {
|
||||||
id("send_state")
|
id("send_state")
|
||||||
showProgress(true)
|
showProgress(true)
|
||||||
text(stringProvider.getString(R.string.event_status_sending_message))
|
text(host.stringProvider.getString(R.string.event_status_sending_message))
|
||||||
}
|
}
|
||||||
} else if (sendState == SendState.SENT) {
|
} else if (sendState == SendState.SENT) {
|
||||||
bottomSheetSendStateItem {
|
bottomSheetSendStateItem {
|
||||||
id("send_state")
|
id("send_state")
|
||||||
showProgress(false)
|
showProgress(false)
|
||||||
drawableStart(R.drawable.ic_message_sent)
|
drawableStart(R.drawable.ic_message_sent)
|
||||||
text(stringProvider.getString(R.string.event_status_sent_message))
|
text(host.stringProvider.getString(R.string.event_status_sent_message))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +111,7 @@ class MessageActionsEpoxyController @Inject constructor(
|
||||||
bottomSheetSendStateItem {
|
bottomSheetSendStateItem {
|
||||||
id("e2e_clear")
|
id("e2e_clear")
|
||||||
showProgress(false)
|
showProgress(false)
|
||||||
text(stringProvider.getString(R.string.unencrypted))
|
text(host.stringProvider.getString(R.string.unencrypted))
|
||||||
drawableStart(R.drawable.ic_shield_warning_small)
|
drawableStart(R.drawable.ic_shield_warning_small)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,7 +120,7 @@ class MessageActionsEpoxyController @Inject constructor(
|
||||||
bottomSheetSendStateItem {
|
bottomSheetSendStateItem {
|
||||||
id("e2e_unverified")
|
id("e2e_unverified")
|
||||||
showProgress(false)
|
showProgress(false)
|
||||||
text(stringProvider.getString(R.string.encrypted_unverified))
|
text(host.stringProvider.getString(R.string.encrypted_unverified))
|
||||||
drawableStart(R.drawable.ic_shield_warning_small)
|
drawableStart(R.drawable.ic_shield_warning_small)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,12 +138,12 @@ class MessageActionsEpoxyController @Inject constructor(
|
||||||
|
|
||||||
bottomSheetQuickReactionsItem {
|
bottomSheetQuickReactionsItem {
|
||||||
id("quick_reaction")
|
id("quick_reaction")
|
||||||
fontProvider(fontProvider)
|
fontProvider(host.fontProvider)
|
||||||
texts(state.quickStates()?.map { it.reaction }.orEmpty())
|
texts(state.quickStates()?.map { it.reaction }.orEmpty())
|
||||||
selecteds(state.quickStates.invoke().map { it.isSelected })
|
selecteds(state.quickStates.invoke().map { it.isSelected })
|
||||||
listener(object : BottomSheetQuickReactionsItem.Listener {
|
listener(object : BottomSheetQuickReactionsItem.Listener {
|
||||||
override fun didSelect(emoji: String, selected: Boolean) {
|
override fun didSelect(emoji: String, selected: Boolean) {
|
||||||
listener?.didSelectMenuAction(EventSharedAction.QuickReact(state.eventId, emoji, selected))
|
host.listener?.didSelectMenuAction(EventSharedAction.QuickReact(state.eventId, emoji, selected))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -168,7 +169,7 @@ class MessageActionsEpoxyController @Inject constructor(
|
||||||
textRes(action.titleRes)
|
textRes(action.titleRes)
|
||||||
showExpand(action is EventSharedAction.ReportContent)
|
showExpand(action is EventSharedAction.ReportContent)
|
||||||
expanded(state.expendedReportContentMenu)
|
expanded(state.expendedReportContentMenu)
|
||||||
listener(View.OnClickListener { listener?.didSelectMenuAction(action) })
|
listener(View.OnClickListener { host.listener?.didSelectMenuAction(action) })
|
||||||
destructive(action.destructive)
|
destructive(action.destructive)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +185,7 @@ class MessageActionsEpoxyController @Inject constructor(
|
||||||
subMenuItem(true)
|
subMenuItem(true)
|
||||||
iconRes(actionReport.iconResId)
|
iconRes(actionReport.iconResId)
|
||||||
textRes(actionReport.titleRes)
|
textRes(actionReport.titleRes)
|
||||||
listener(View.OnClickListener { listener?.didSelectMenuAction(actionReport) })
|
listener(View.OnClickListener { host.listener?.didSelectMenuAction(actionReport) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@ class ViewEditHistoryEpoxyController(private val context: Context,
|
||||||
val eventHtmlRenderer: EventHtmlRenderer) : TypedEpoxyController<ViewEditHistoryViewState>() {
|
val eventHtmlRenderer: EventHtmlRenderer) : TypedEpoxyController<ViewEditHistoryViewState>() {
|
||||||
|
|
||||||
override fun buildModels(state: ViewEditHistoryViewState) {
|
override fun buildModels(state: ViewEditHistoryViewState) {
|
||||||
|
val host = this
|
||||||
when (state.editList) {
|
when (state.editList) {
|
||||||
is Incomplete -> {
|
is Incomplete -> {
|
||||||
genericLoaderItem {
|
genericLoaderItem {
|
||||||
|
@ -56,7 +57,8 @@ class ViewEditHistoryEpoxyController(private val context: Context,
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
genericFooterItem {
|
genericFooterItem {
|
||||||
id("failure")
|
id("failure")
|
||||||
text(context.getString(R.string.unknown_error))
|
// FIXME Should use stringprovider
|
||||||
|
text(host.context.getString(R.string.unknown_error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Success -> {
|
is Success -> {
|
||||||
|
@ -66,10 +68,12 @@ class ViewEditHistoryEpoxyController(private val context: Context,
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renderEvents(sourceEvents: List<Event>, isOriginalReply: Boolean) {
|
private fun renderEvents(sourceEvents: List<Event>, isOriginalReply: Boolean) {
|
||||||
|
val host = this
|
||||||
if (sourceEvents.isEmpty()) {
|
if (sourceEvents.isEmpty()) {
|
||||||
genericItem {
|
genericItem {
|
||||||
id("footer")
|
id("footer")
|
||||||
title(context.getString(R.string.no_message_edits_found))
|
// TODO use a stringProvider
|
||||||
|
title(host.context.getString(R.string.no_message_edits_found))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var lastDate: Calendar? = null
|
var lastDate: Calendar? = null
|
||||||
|
@ -83,7 +87,7 @@ class ViewEditHistoryEpoxyController(private val context: Context,
|
||||||
// need to display header with day
|
// need to display header with day
|
||||||
genericItemHeader {
|
genericItemHeader {
|
||||||
id(evDate.hashCode())
|
id(evDate.hashCode())
|
||||||
text(dateFormatter.format(evDate.timeInMillis, DateFormatKind.EDIT_HISTORY_HEADER))
|
text(host.dateFormatter.format(evDate.timeInMillis, DateFormatKind.EDIT_HISTORY_HEADER))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lastDate = evDate
|
lastDate = evDate
|
||||||
|
@ -127,7 +131,7 @@ class ViewEditHistoryEpoxyController(private val context: Context,
|
||||||
}
|
}
|
||||||
genericItem {
|
genericItem {
|
||||||
id(timelineEvent.eventId)
|
id(timelineEvent.eventId)
|
||||||
title(dateFormatter.format(timelineEvent.originServerTs, DateFormatKind.EDIT_HISTORY_ROW))
|
title(host.dateFormatter.format(timelineEvent.originServerTs, DateFormatKind.EDIT_HISTORY_ROW))
|
||||||
description(spannedDiff ?: body)
|
description(spannedDiff ?: body)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ class ViewReactionsEpoxyController @Inject constructor(
|
||||||
var listener: Listener? = null
|
var listener: Listener? = null
|
||||||
|
|
||||||
override fun buildModels(state: DisplayReactionsViewState) {
|
override fun buildModels(state: DisplayReactionsViewState) {
|
||||||
|
val host = this
|
||||||
when (state.mapReactionKeyToMemberList) {
|
when (state.mapReactionKeyToMemberList) {
|
||||||
is Incomplete -> {
|
is Incomplete -> {
|
||||||
genericLoaderItem {
|
genericLoaderItem {
|
||||||
|
@ -47,7 +48,7 @@ class ViewReactionsEpoxyController @Inject constructor(
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
genericFooterItem {
|
genericFooterItem {
|
||||||
id("failure")
|
id("failure")
|
||||||
text(stringProvider.getString(R.string.unknown_error))
|
text(host.stringProvider.getString(R.string.unknown_error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Success -> {
|
is Success -> {
|
||||||
|
@ -55,9 +56,9 @@ class ViewReactionsEpoxyController @Inject constructor(
|
||||||
reactionInfoSimpleItem {
|
reactionInfoSimpleItem {
|
||||||
id(it.eventId)
|
id(it.eventId)
|
||||||
timeStamp(it.timestamp)
|
timeStamp(it.timestamp)
|
||||||
reactionKey(emojiCompatWrapper.safeEmojiSpanify(it.reactionKey))
|
reactionKey(host.emojiCompatWrapper.safeEmojiSpanify(it.reactionKey))
|
||||||
authorDisplayName(it.authorName ?: it.authorId)
|
authorDisplayName(it.authorName ?: it.authorId)
|
||||||
userClicked { listener?.didSelectUser(it.authorId) }
|
userClicked { host.listener?.didSelectUser(it.authorId) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,25 +37,26 @@ class RoomWidgetsController @Inject constructor(
|
||||||
var listener: Listener? = null
|
var listener: Listener? = null
|
||||||
|
|
||||||
override fun buildModels(widgets: List<Widget>) {
|
override fun buildModels(widgets: List<Widget>) {
|
||||||
|
val host = this
|
||||||
if (widgets.isEmpty()) {
|
if (widgets.isEmpty()) {
|
||||||
genericFooterItem {
|
genericFooterItem {
|
||||||
id("empty")
|
id("empty")
|
||||||
text(stringProvider.getString(R.string.room_no_active_widgets))
|
text(host.stringProvider.getString(R.string.room_no_active_widgets))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
widgets.forEach {
|
widgets.forEach {
|
||||||
roomWidgetItem {
|
roomWidgetItem {
|
||||||
id(it.widgetId)
|
id(it.widgetId)
|
||||||
widget(it)
|
widget(it)
|
||||||
widgetClicked { listener?.didSelectWidget(it) }
|
widgetClicked { host.listener?.didSelectWidget(it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
genericButtonItem {
|
genericButtonItem {
|
||||||
id("addIntegration")
|
id("addIntegration")
|
||||||
text(stringProvider.getString(R.string.room_manage_integrations))
|
text(host.stringProvider.getString(R.string.room_manage_integrations))
|
||||||
textColor(colorProvider.getColor(R.color.riotx_accent))
|
textColor(host.colorProvider.getColor(R.color.riotx_accent))
|
||||||
buttonClickAction(View.OnClickListener { listener?.didSelectManageWidgets() })
|
buttonClickAction(View.OnClickListener { host.listener?.didSelectManageWidgets() })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,11 +33,12 @@ class RoomListFooterController @Inject constructor(
|
||||||
var listener: RoomListListener? = null
|
var listener: RoomListListener? = null
|
||||||
|
|
||||||
override fun buildModels(data: RoomListViewState?) {
|
override fun buildModels(data: RoomListViewState?) {
|
||||||
|
val host = this
|
||||||
when (data?.displayMode) {
|
when (data?.displayMode) {
|
||||||
RoomListDisplayMode.FILTERED -> {
|
RoomListDisplayMode.FILTERED -> {
|
||||||
filteredRoomFooterItem {
|
filteredRoomFooterItem {
|
||||||
id("filter_footer")
|
id("filter_footer")
|
||||||
listener(listener)
|
listener(host.listener)
|
||||||
currentFilter(data.roomFilter)
|
currentFilter(data.roomFilter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +46,7 @@ class RoomListFooterController @Inject constructor(
|
||||||
if (userPreferencesProvider.shouldShowLongClickOnRoomHelp()) {
|
if (userPreferencesProvider.shouldShowLongClickOnRoomHelp()) {
|
||||||
helpFooterItem {
|
helpFooterItem {
|
||||||
id("long_click_help")
|
id("long_click_help")
|
||||||
text(stringProvider.getString(R.string.help_long_click_on_room_for_more_options))
|
text(host.stringProvider.getString(R.string.help_long_click_on_room_for_more_options))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,20 +38,21 @@ class RoomListQuickActionsEpoxyController @Inject constructor(
|
||||||
|
|
||||||
override fun buildModels(state: RoomListQuickActionsState) {
|
override fun buildModels(state: RoomListQuickActionsState) {
|
||||||
val roomSummary = state.roomSummary() ?: return
|
val roomSummary = state.roomSummary() ?: return
|
||||||
|
val host = this
|
||||||
val showAll = state.mode == RoomListActionsArgs.Mode.FULL
|
val showAll = state.mode == RoomListActionsArgs.Mode.FULL
|
||||||
|
|
||||||
if (showAll) {
|
if (showAll) {
|
||||||
// Preview, favorite, settings
|
// Preview, favorite, settings
|
||||||
bottomSheetRoomPreviewItem {
|
bottomSheetRoomPreviewItem {
|
||||||
id("room_preview")
|
id("room_preview")
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
matrixItem(roomSummary.toMatrixItem())
|
matrixItem(roomSummary.toMatrixItem())
|
||||||
stringProvider(stringProvider)
|
stringProvider(host.stringProvider)
|
||||||
izLowPriority(roomSummary.isLowPriority)
|
izLowPriority(roomSummary.isLowPriority)
|
||||||
izFavorite(roomSummary.isFavorite)
|
izFavorite(roomSummary.isFavorite)
|
||||||
settingsClickListener { listener?.didSelectMenuAction(RoomListQuickActionsSharedAction.Settings(roomSummary.roomId)) }
|
settingsClickListener { host.listener?.didSelectMenuAction(RoomListQuickActionsSharedAction.Settings(roomSummary.roomId)) }
|
||||||
favoriteClickListener { listener?.didSelectMenuAction(RoomListQuickActionsSharedAction.Favorite(roomSummary.roomId)) }
|
favoriteClickListener { host.listener?.didSelectMenuAction(RoomListQuickActionsSharedAction.Favorite(roomSummary.roomId)) }
|
||||||
lowPriorityClickListener { listener?.didSelectMenuAction(RoomListQuickActionsSharedAction.LowPriority(roomSummary.roomId)) }
|
lowPriorityClickListener { host.listener?.didSelectMenuAction(RoomListQuickActionsSharedAction.LowPriority(roomSummary.roomId)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notifications
|
// Notifications
|
||||||
|
@ -72,6 +73,7 @@ class RoomListQuickActionsEpoxyController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun RoomListQuickActionsSharedAction.toBottomSheetItem(index: Int, roomNotificationState: RoomNotificationState? = null) {
|
private fun RoomListQuickActionsSharedAction.toBottomSheetItem(index: Int, roomNotificationState: RoomNotificationState? = null) {
|
||||||
|
val host = this@RoomListQuickActionsEpoxyController
|
||||||
val selected = when (this) {
|
val selected = when (this) {
|
||||||
is RoomListQuickActionsSharedAction.NotificationsAllNoisy -> roomNotificationState == RoomNotificationState.ALL_MESSAGES_NOISY
|
is RoomListQuickActionsSharedAction.NotificationsAllNoisy -> roomNotificationState == RoomNotificationState.ALL_MESSAGES_NOISY
|
||||||
is RoomListQuickActionsSharedAction.NotificationsAll -> roomNotificationState == RoomNotificationState.ALL_MESSAGES
|
is RoomListQuickActionsSharedAction.NotificationsAll -> roomNotificationState == RoomNotificationState.ALL_MESSAGES
|
||||||
|
@ -85,7 +87,7 @@ class RoomListQuickActionsEpoxyController @Inject constructor(
|
||||||
iconRes(iconResId)
|
iconRes(iconResId)
|
||||||
textRes(titleRes)
|
textRes(titleRes)
|
||||||
destructive(this@toBottomSheetItem.destructive)
|
destructive(this@toBottomSheetItem.destructive)
|
||||||
listener(View.OnClickListener { listener?.didSelectMenuAction(this@toBottomSheetItem) })
|
listener(View.OnClickListener { host.listener?.didSelectMenuAction(this@toBottomSheetItem) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,16 +28,17 @@ class PolicyController @Inject constructor() : TypedEpoxyController<List<Localiz
|
||||||
var homeServer: String? = null
|
var homeServer: String? = null
|
||||||
|
|
||||||
override fun buildModels(data: List<LocalizedFlowDataLoginTermsChecked>) {
|
override fun buildModels(data: List<LocalizedFlowDataLoginTermsChecked>) {
|
||||||
|
val host = this
|
||||||
data.forEach { entry ->
|
data.forEach { entry ->
|
||||||
policyItem {
|
policyItem {
|
||||||
id(entry.localizedFlowDataLoginTerms.policyName)
|
id(entry.localizedFlowDataLoginTerms.policyName)
|
||||||
checked(entry.checked)
|
checked(entry.checked)
|
||||||
title(entry.localizedFlowDataLoginTerms.localizedName)
|
title(entry.localizedFlowDataLoginTerms.localizedName)
|
||||||
subtitle(homeServer)
|
subtitle(host.homeServer)
|
||||||
|
|
||||||
clickListener(View.OnClickListener { listener?.openPolicy(entry.localizedFlowDataLoginTerms) })
|
clickListener(View.OnClickListener { host.listener?.openPolicy(entry.localizedFlowDataLoginTerms) })
|
||||||
checkChangeListener { _, isChecked ->
|
checkChangeListener { _, isChecked ->
|
||||||
listener?.setChecked(entry.localizedFlowDataLoginTerms, isChecked)
|
host.listener?.setChecked(entry.localizedFlowDataLoginTerms, isChecked)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,19 +45,20 @@ class EmojiSearchResultController @Inject constructor(
|
||||||
|
|
||||||
override fun buildModels(data: EmojiSearchResultViewState?) {
|
override fun buildModels(data: EmojiSearchResultViewState?) {
|
||||||
val results = data?.results ?: return
|
val results = data?.results ?: return
|
||||||
|
val host = this
|
||||||
|
|
||||||
if (results.isEmpty()) {
|
if (results.isEmpty()) {
|
||||||
if (data.query.isEmpty()) {
|
if (data.query.isEmpty()) {
|
||||||
// display 'Type something to find'
|
// display 'Type something to find'
|
||||||
genericFooterItem {
|
genericFooterItem {
|
||||||
id("type.query.item")
|
id("type.query.item")
|
||||||
text(stringProvider.getString(R.string.reaction_search_type_hint))
|
text(host.stringProvider.getString(R.string.reaction_search_type_hint))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Display no search Results
|
// Display no search Results
|
||||||
genericFooterItem {
|
genericFooterItem {
|
||||||
id("no.results.item")
|
id("no.results.item")
|
||||||
text(stringProvider.getString(R.string.no_result_placeholder))
|
text(host.stringProvider.getString(R.string.no_result_placeholder))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -66,9 +67,9 @@ class EmojiSearchResultController @Inject constructor(
|
||||||
emojiSearchResultItem {
|
emojiSearchResultItem {
|
||||||
id(it.name)
|
id(it.name)
|
||||||
emojiItem(it)
|
emojiItem(it)
|
||||||
emojiTypeFace(emojiTypeface)
|
emojiTypeFace(host.emojiTypeface)
|
||||||
currentQuery(data.query)
|
currentQuery(data.query)
|
||||||
onClickListener(listener)
|
onClickListener(host.listener)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ class PublicRoomsController @Inject constructor(private val stringProvider: Stri
|
||||||
var callback: Callback? = null
|
var callback: Callback? = null
|
||||||
|
|
||||||
override fun buildModels(viewState: PublicRoomsViewState) {
|
override fun buildModels(viewState: PublicRoomsViewState) {
|
||||||
|
val host = this
|
||||||
val publicRooms = viewState.publicRooms
|
val publicRooms = viewState.publicRooms
|
||||||
|
|
||||||
val unknownRoomItem = viewState.buildUnknownRoomIfNeeded()
|
val unknownRoomItem = viewState.buildUnknownRoomIfNeeded()
|
||||||
|
@ -51,7 +52,7 @@ class PublicRoomsController @Inject constructor(private val stringProvider: Stri
|
||||||
// No result
|
// No result
|
||||||
noResultItem {
|
noResultItem {
|
||||||
id("noResult")
|
id("noResult")
|
||||||
text(stringProvider.getString(R.string.no_result_placeholder))
|
text(host.stringProvider.getString(R.string.no_result_placeholder))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
publicRooms.forEach {
|
publicRooms.forEach {
|
||||||
|
@ -71,7 +72,7 @@ class PublicRoomsController @Inject constructor(private val stringProvider: Stri
|
||||||
}
|
}
|
||||||
onVisibilityStateChanged { _, _, visibilityState ->
|
onVisibilityStateChanged { _, _, visibilityState ->
|
||||||
if (visibilityState == VisibilityState.VISIBLE) {
|
if (visibilityState == VisibilityState.VISIBLE) {
|
||||||
callback?.loadMore()
|
host.callback?.loadMore()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,15 +82,16 @@ class PublicRoomsController @Inject constructor(private val stringProvider: Stri
|
||||||
if (viewState.asyncPublicRoomsRequest is Fail) {
|
if (viewState.asyncPublicRoomsRequest is Fail) {
|
||||||
errorWithRetryItem {
|
errorWithRetryItem {
|
||||||
id("error")
|
id("error")
|
||||||
text(errorFormatter.toHumanReadable(viewState.asyncPublicRoomsRequest.error))
|
text(host.errorFormatter.toHumanReadable(viewState.asyncPublicRoomsRequest.error))
|
||||||
listener { callback?.loadMore() }
|
listener { host.callback?.loadMore() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildPublicRoom(publicRoom: PublicRoom, viewState: PublicRoomsViewState) {
|
private fun buildPublicRoom(publicRoom: PublicRoom, viewState: PublicRoomsViewState) {
|
||||||
|
val host = this
|
||||||
publicRoomItem {
|
publicRoomItem {
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
id(publicRoom.roomId)
|
id(publicRoom.roomId)
|
||||||
matrixItem(publicRoom.toMatrixItem())
|
matrixItem(publicRoom.toMatrixItem())
|
||||||
roomAlias(publicRoom.getPrimaryAlias())
|
roomAlias(publicRoom.getPrimaryAlias())
|
||||||
|
@ -107,10 +109,10 @@ class PublicRoomsController @Inject constructor(private val stringProvider: Stri
|
||||||
joinState(joinState)
|
joinState(joinState)
|
||||||
|
|
||||||
joinListener {
|
joinListener {
|
||||||
callback?.onPublicRoomJoin(publicRoom)
|
host.callback?.onPublicRoomJoin(publicRoom)
|
||||||
}
|
}
|
||||||
globalListener {
|
globalListener {
|
||||||
callback?.onPublicRoomClicked(publicRoom, joinState)
|
host.callback?.onPublicRoomClicked(publicRoom, joinState)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,13 +126,14 @@ class PublicRoomsController @Inject constructor(private val stringProvider: Stri
|
||||||
isRoomId -> MatrixItem.RoomItem(roomIdOrAlias)
|
isRoomId -> MatrixItem.RoomItem(roomIdOrAlias)
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
val host = this@PublicRoomsController
|
||||||
return roomItem?.let {
|
return roomItem?.let {
|
||||||
UnknownRoomItem_().apply {
|
UnknownRoomItem_().apply {
|
||||||
id(roomIdOrAlias)
|
id(roomIdOrAlias)
|
||||||
matrixItem(it)
|
matrixItem(it)
|
||||||
avatarRenderer(this@PublicRoomsController.avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
globalListener {
|
globalListener {
|
||||||
callback?.onUnknownRoomClicked(roomIdOrAlias)
|
host.callback?.onUnknownRoomClicked(roomIdOrAlias)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,12 +45,13 @@ class CreateRoomController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildForm(viewState: CreateRoomViewState, enableFormElement: Boolean) {
|
private fun buildForm(viewState: CreateRoomViewState, enableFormElement: Boolean) {
|
||||||
|
val host = this
|
||||||
formEditableAvatarItem {
|
formEditableAvatarItem {
|
||||||
id("avatar")
|
id("avatar")
|
||||||
enabled(enableFormElement)
|
enabled(enableFormElement)
|
||||||
imageUri(viewState.avatarUri)
|
imageUri(viewState.avatarUri)
|
||||||
clickListener { listener?.onAvatarChange() }
|
clickListener { host.listener?.onAvatarChange() }
|
||||||
deleteListener { listener?.onAvatarDelete() }
|
deleteListener { host.listener?.onAvatarDelete() }
|
||||||
}
|
}
|
||||||
settingsSectionTitleItem {
|
settingsSectionTitleItem {
|
||||||
id("nameSection")
|
id("nameSection")
|
||||||
|
@ -60,10 +61,10 @@ class CreateRoomController @Inject constructor(
|
||||||
id("name")
|
id("name")
|
||||||
enabled(enableFormElement)
|
enabled(enableFormElement)
|
||||||
value(viewState.roomName)
|
value(viewState.roomName)
|
||||||
hint(stringProvider.getString(R.string.create_room_name_hint))
|
hint(host.stringProvider.getString(R.string.create_room_name_hint))
|
||||||
|
|
||||||
onTextChange { text ->
|
onTextChange { text ->
|
||||||
listener?.onNameChange(text)
|
host.listener?.onNameChange(text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
settingsSectionTitleItem {
|
settingsSectionTitleItem {
|
||||||
|
@ -74,10 +75,10 @@ class CreateRoomController @Inject constructor(
|
||||||
id("topic")
|
id("topic")
|
||||||
enabled(enableFormElement)
|
enabled(enableFormElement)
|
||||||
value(viewState.roomTopic)
|
value(viewState.roomTopic)
|
||||||
hint(stringProvider.getString(R.string.create_room_topic_hint))
|
hint(host.stringProvider.getString(R.string.create_room_topic_hint))
|
||||||
|
|
||||||
onTextChange { text ->
|
onTextChange { text ->
|
||||||
listener?.onTopicChange(text)
|
host.listener?.onTopicChange(text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
settingsSectionTitleItem {
|
settingsSectionTitleItem {
|
||||||
|
@ -87,13 +88,13 @@ class CreateRoomController @Inject constructor(
|
||||||
formSwitchItem {
|
formSwitchItem {
|
||||||
id("public")
|
id("public")
|
||||||
enabled(enableFormElement)
|
enabled(enableFormElement)
|
||||||
title(stringProvider.getString(R.string.create_room_public_title))
|
title(host.stringProvider.getString(R.string.create_room_public_title))
|
||||||
summary(stringProvider.getString(R.string.create_room_public_description))
|
summary(host.stringProvider.getString(R.string.create_room_public_description))
|
||||||
switchChecked(viewState.roomVisibilityType is CreateRoomViewState.RoomVisibilityType.Public)
|
switchChecked(viewState.roomVisibilityType is CreateRoomViewState.RoomVisibilityType.Public)
|
||||||
showDivider(viewState.roomVisibilityType !is CreateRoomViewState.RoomVisibilityType.Public)
|
showDivider(viewState.roomVisibilityType !is CreateRoomViewState.RoomVisibilityType.Public)
|
||||||
|
|
||||||
listener { value ->
|
listener { value ->
|
||||||
listener?.setIsPublic(value)
|
host.listener?.setIsPublic(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (viewState.roomVisibilityType is CreateRoomViewState.RoomVisibilityType.Public) {
|
if (viewState.roomVisibilityType is CreateRoomViewState.RoomVisibilityType.Public) {
|
||||||
|
@ -104,11 +105,11 @@ class CreateRoomController @Inject constructor(
|
||||||
value(viewState.roomVisibilityType.aliasLocalPart)
|
value(viewState.roomVisibilityType.aliasLocalPart)
|
||||||
homeServer(":" + viewState.homeServerName)
|
homeServer(":" + viewState.homeServerName)
|
||||||
errorMessage(
|
errorMessage(
|
||||||
roomAliasErrorFormatter.format(
|
host.roomAliasErrorFormatter.format(
|
||||||
(((viewState.asyncCreateRoomRequest as? Fail)?.error) as? CreateRoomFailure.AliasError)?.aliasError)
|
(((viewState.asyncCreateRoomRequest as? Fail)?.error) as? CreateRoomFailure.AliasError)?.aliasError)
|
||||||
)
|
)
|
||||||
onTextChange { value ->
|
onTextChange { value ->
|
||||||
listener?.setAliasLocalPart(value)
|
host.listener?.setAliasLocalPart(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -116,43 +117,43 @@ class CreateRoomController @Inject constructor(
|
||||||
formSwitchItem {
|
formSwitchItem {
|
||||||
id("encryption")
|
id("encryption")
|
||||||
enabled(enableFormElement)
|
enabled(enableFormElement)
|
||||||
title(stringProvider.getString(R.string.create_room_encryption_title))
|
title(host.stringProvider.getString(R.string.create_room_encryption_title))
|
||||||
summary(
|
summary(
|
||||||
if (viewState.hsAdminHasDisabledE2E) {
|
if (viewState.hsAdminHasDisabledE2E) {
|
||||||
stringProvider.getString(R.string.settings_hs_admin_e2e_disabled)
|
host.stringProvider.getString(R.string.settings_hs_admin_e2e_disabled)
|
||||||
} else {
|
} else {
|
||||||
stringProvider.getString(R.string.create_room_encryption_description)
|
host.stringProvider.getString(R.string.create_room_encryption_description)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
switchChecked(viewState.isEncrypted)
|
switchChecked(viewState.isEncrypted)
|
||||||
|
|
||||||
listener { value ->
|
listener { value ->
|
||||||
listener?.setIsEncrypted(value)
|
host.listener?.setIsEncrypted(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
formAdvancedToggleItem {
|
formAdvancedToggleItem {
|
||||||
id("showAdvanced")
|
id("showAdvanced")
|
||||||
title(stringProvider.getString(if (viewState.showAdvanced) R.string.hide_advanced else R.string.show_advanced))
|
title(host.stringProvider.getString(if (viewState.showAdvanced) R.string.hide_advanced else R.string.show_advanced))
|
||||||
expanded(!viewState.showAdvanced)
|
expanded(!viewState.showAdvanced)
|
||||||
listener { listener?.toggleShowAdvanced() }
|
listener { host.listener?.toggleShowAdvanced() }
|
||||||
}
|
}
|
||||||
if (viewState.showAdvanced) {
|
if (viewState.showAdvanced) {
|
||||||
formSwitchItem {
|
formSwitchItem {
|
||||||
id("federation")
|
id("federation")
|
||||||
enabled(enableFormElement)
|
enabled(enableFormElement)
|
||||||
title(stringProvider.getString(R.string.create_room_disable_federation_title, viewState.homeServerName))
|
title(host.stringProvider.getString(R.string.create_room_disable_federation_title, viewState.homeServerName))
|
||||||
summary(stringProvider.getString(R.string.create_room_disable_federation_description))
|
summary(host.stringProvider.getString(R.string.create_room_disable_federation_description))
|
||||||
switchChecked(viewState.disableFederation)
|
switchChecked(viewState.disableFederation)
|
||||||
showDivider(false)
|
showDivider(false)
|
||||||
listener { value -> listener?.setDisableFederation(value) }
|
listener { value -> host.listener?.setDisableFederation(value) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
formSubmitButtonItem {
|
formSubmitButtonItem {
|
||||||
id("submit")
|
id("submit")
|
||||||
enabled(enableFormElement)
|
enabled(enableFormElement)
|
||||||
buttonTitleId(R.string.create_room_action_create)
|
buttonTitleId(R.string.create_room_action_create)
|
||||||
buttonClickListener { listener?.submit() }
|
buttonClickListener { host.listener?.submit() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ class RoomDirectoryPickerController @Inject constructor(private val stringProvid
|
||||||
var index = 0
|
var index = 0
|
||||||
|
|
||||||
override fun buildModels(viewState: RoomDirectoryPickerViewState) {
|
override fun buildModels(viewState: RoomDirectoryPickerViewState) {
|
||||||
|
val host = this
|
||||||
val asyncThirdPartyProtocol = viewState.asyncThirdPartyRequest
|
val asyncThirdPartyProtocol = viewState.asyncThirdPartyRequest
|
||||||
|
|
||||||
when (asyncThirdPartyProtocol) {
|
when (asyncThirdPartyProtocol) {
|
||||||
|
@ -56,24 +57,25 @@ class RoomDirectoryPickerController @Inject constructor(private val stringProvid
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
errorWithRetryItem {
|
errorWithRetryItem {
|
||||||
id("error")
|
id("error")
|
||||||
text(errorFormatter.toHumanReadable(asyncThirdPartyProtocol.error))
|
text(host.errorFormatter.toHumanReadable(asyncThirdPartyProtocol.error))
|
||||||
listener { callback?.retry() }
|
listener { host.callback?.retry() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildDirectory(roomDirectoryData: RoomDirectoryData) {
|
private fun buildDirectory(roomDirectoryData: RoomDirectoryData) {
|
||||||
|
val host = this
|
||||||
roomDirectoryItem {
|
roomDirectoryItem {
|
||||||
id(index++)
|
id(host.index++)
|
||||||
|
|
||||||
directoryName(roomDirectoryData.displayName)
|
directoryName(roomDirectoryData.displayName)
|
||||||
|
|
||||||
val description = when {
|
val description = when {
|
||||||
roomDirectoryData.includeAllNetworks ->
|
roomDirectoryData.includeAllNetworks ->
|
||||||
stringProvider.getString(R.string.directory_server_all_rooms_on_server, roomDirectoryData.displayName)
|
host.stringProvider.getString(R.string.directory_server_all_rooms_on_server, roomDirectoryData.displayName)
|
||||||
"Matrix" == roomDirectoryData.displayName ->
|
"Matrix" == roomDirectoryData.displayName ->
|
||||||
stringProvider.getString(R.string.directory_server_native_rooms, roomDirectoryData.displayName)
|
host.stringProvider.getString(R.string.directory_server_native_rooms, roomDirectoryData.displayName)
|
||||||
else ->
|
else ->
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
@ -83,7 +85,7 @@ class RoomDirectoryPickerController @Inject constructor(private val stringProvid
|
||||||
includeAllNetworks(roomDirectoryData.includeAllNetworks)
|
includeAllNetworks(roomDirectoryData.includeAllNetworks)
|
||||||
|
|
||||||
globalListener {
|
globalListener {
|
||||||
callback?.onRoomDirectoryClicked(roomDirectoryData)
|
host.callback?.onRoomDirectoryClicked(roomDirectoryData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,7 @@ class RoomMemberProfileController @Inject constructor(
|
||||||
private fun buildSecuritySection(state: RoomMemberProfileViewState) {
|
private fun buildSecuritySection(state: RoomMemberProfileViewState) {
|
||||||
// Security
|
// Security
|
||||||
buildProfileSection(stringProvider.getString(R.string.room_profile_section_security))
|
buildProfileSection(stringProvider.getString(R.string.room_profile_section_security))
|
||||||
|
val host = this
|
||||||
|
|
||||||
if (state.isRoomEncrypted) {
|
if (state.isRoomEncrypted) {
|
||||||
if (state.userMXCrossSigningInfo != null) {
|
if (state.userMXCrossSigningInfo != null) {
|
||||||
|
@ -152,7 +153,7 @@ class RoomMemberProfileController @Inject constructor(
|
||||||
|
|
||||||
genericFooterItem {
|
genericFooterItem {
|
||||||
id("verify_footer")
|
id("verify_footer")
|
||||||
text(stringProvider.getString(R.string.room_profile_encrypted_subtitle))
|
text(host.stringProvider.getString(R.string.room_profile_encrypted_subtitle))
|
||||||
centered(false)
|
centered(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,7 +171,7 @@ class RoomMemberProfileController @Inject constructor(
|
||||||
} else {
|
} else {
|
||||||
genericFooterItem {
|
genericFooterItem {
|
||||||
id("verify_footer_not_encrypted")
|
id("verify_footer_not_encrypted")
|
||||||
text(stringProvider.getString(R.string.room_profile_not_encrypted_subtitle))
|
text(host.stringProvider.getString(R.string.room_profile_not_encrypted_subtitle))
|
||||||
centered(false)
|
centered(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,16 +50,15 @@ class DeviceListEpoxyController @Inject constructor(private val stringProvider:
|
||||||
var interactionListener: InteractionListener? = null
|
var interactionListener: InteractionListener? = null
|
||||||
|
|
||||||
override fun buildModels(data: DeviceListViewState?) {
|
override fun buildModels(data: DeviceListViewState?) {
|
||||||
if (data == null) {
|
data ?: return
|
||||||
return
|
val host = this
|
||||||
}
|
|
||||||
when (data.cryptoDevices) {
|
when (data.cryptoDevices) {
|
||||||
Uninitialized -> {
|
Uninitialized -> {
|
||||||
}
|
}
|
||||||
is Loading -> {
|
is Loading -> {
|
||||||
loadingItem {
|
loadingItem {
|
||||||
id("loading")
|
id("loading")
|
||||||
loadingText(stringProvider.getString(R.string.loading))
|
loadingText(host.stringProvider.getString(R.string.loading))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Success -> {
|
is Success -> {
|
||||||
|
@ -77,11 +76,11 @@ class DeviceListEpoxyController @Inject constructor(private val stringProvider:
|
||||||
style(ItemStyle.BIG_TEXT)
|
style(ItemStyle.BIG_TEXT)
|
||||||
titleIconResourceId(if (allGreen) R.drawable.ic_shield_trusted else R.drawable.ic_shield_warning)
|
titleIconResourceId(if (allGreen) R.drawable.ic_shield_trusted else R.drawable.ic_shield_warning)
|
||||||
title(
|
title(
|
||||||
stringProvider.getString(
|
host.stringProvider.getString(
|
||||||
if (allGreen) R.string.verification_profile_verified else R.string.verification_profile_warning
|
if (allGreen) R.string.verification_profile_verified else R.string.verification_profile_warning
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
description(stringProvider.getString(R.string.verification_conclusion_ok_notice))
|
description(host.stringProvider.getString(R.string.verification_conclusion_ok_notice))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vectorPreferences.developerMode()) {
|
if (vectorPreferences.developerMode()) {
|
||||||
|
@ -92,13 +91,13 @@ class DeviceListEpoxyController @Inject constructor(private val stringProvider:
|
||||||
genericItem {
|
genericItem {
|
||||||
id("sessions")
|
id("sessions")
|
||||||
style(ItemStyle.BIG_TEXT)
|
style(ItemStyle.BIG_TEXT)
|
||||||
title(stringProvider.getString(R.string.room_member_profile_sessions_section_title))
|
title(host.stringProvider.getString(R.string.room_member_profile_sessions_section_title))
|
||||||
}
|
}
|
||||||
if (deviceList.isEmpty()) {
|
if (deviceList.isEmpty()) {
|
||||||
// Can this really happen?
|
// Can this really happen?
|
||||||
genericFooterItem {
|
genericFooterItem {
|
||||||
id("empty")
|
id("empty")
|
||||||
text(stringProvider.getString(R.string.search_no_results))
|
text(host.stringProvider.getString(R.string.search_no_results))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Build list of device with status
|
// Build list of device with status
|
||||||
|
@ -107,14 +106,14 @@ class DeviceListEpoxyController @Inject constructor(private val stringProvider:
|
||||||
id(device.deviceId)
|
id(device.deviceId)
|
||||||
titleIconResourceId(if (device.isVerified) R.drawable.ic_shield_trusted else R.drawable.ic_shield_warning)
|
titleIconResourceId(if (device.isVerified) R.drawable.ic_shield_trusted else R.drawable.ic_shield_warning)
|
||||||
apply {
|
apply {
|
||||||
if (vectorPreferences.developerMode()) {
|
if (host.vectorPreferences.developerMode()) {
|
||||||
val seq = span {
|
val seq = span {
|
||||||
+(device.displayName() ?: device.deviceId)
|
+(device.displayName() ?: device.deviceId)
|
||||||
+"\n"
|
+"\n"
|
||||||
span {
|
span {
|
||||||
text = "(${device.deviceId})"
|
text = "(${device.deviceId})"
|
||||||
textColor = colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)
|
textColor = host.colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)
|
||||||
textSize = dimensionConverter.spToPx(14)
|
textSize = host.dimensionConverter.spToPx(14)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
title(seq)
|
title(seq)
|
||||||
|
@ -123,17 +122,17 @@ class DeviceListEpoxyController @Inject constructor(private val stringProvider:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
value(
|
value(
|
||||||
stringProvider.getString(
|
host.stringProvider.getString(
|
||||||
if (device.isVerified) R.string.trusted else R.string.not_trusted
|
if (device.isVerified) R.string.trusted else R.string.not_trusted
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
valueColorInt(
|
valueColorInt(
|
||||||
colorProvider.getColor(
|
host.colorProvider.getColor(
|
||||||
if (device.isVerified) R.color.riotx_positive_accent else R.color.riotx_destructive_accent
|
if (device.isVerified) R.color.riotx_positive_accent else R.color.riotx_destructive_accent
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
itemClickAction(View.OnClickListener {
|
itemClickAction(View.OnClickListener {
|
||||||
interactionListener?.onDeviceSelected(device)
|
host.interactionListener?.onDeviceSelected(device)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,7 +141,7 @@ class DeviceListEpoxyController @Inject constructor(private val stringProvider:
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
errorWithRetryItem {
|
errorWithRetryItem {
|
||||||
id("error")
|
id("error")
|
||||||
text(stringProvider.getString(R.string.room_member_profile_failed_to_get_devices))
|
text(host.stringProvider.getString(R.string.room_member_profile_failed_to_get_devices))
|
||||||
listener {
|
listener {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
@ -152,6 +151,7 @@ class DeviceListEpoxyController @Inject constructor(private val stringProvider:
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addDebugInfo(data: DeviceListViewState) {
|
private fun addDebugInfo(data: DeviceListViewState) {
|
||||||
|
val host = this
|
||||||
data.memberCrossSigningKey?.masterKey()?.let {
|
data.memberCrossSigningKey?.masterKey()?.let {
|
||||||
genericItemWithValue {
|
genericItemWithValue {
|
||||||
id("msk")
|
id("msk")
|
||||||
|
@ -161,8 +161,8 @@ class DeviceListEpoxyController @Inject constructor(private val stringProvider:
|
||||||
+"Master Key:\n"
|
+"Master Key:\n"
|
||||||
span {
|
span {
|
||||||
text = it.unpaddedBase64PublicKey ?: ""
|
text = it.unpaddedBase64PublicKey ?: ""
|
||||||
textColor = colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)
|
textColor = host.colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)
|
||||||
textSize = dimensionConverter.spToPx(12)
|
textSize = host.dimensionConverter.spToPx(12)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -177,8 +177,8 @@ class DeviceListEpoxyController @Inject constructor(private val stringProvider:
|
||||||
+"User Key:\n"
|
+"User Key:\n"
|
||||||
span {
|
span {
|
||||||
text = it.unpaddedBase64PublicKey ?: ""
|
text = it.unpaddedBase64PublicKey ?: ""
|
||||||
textColor = colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)
|
textColor = host.colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)
|
||||||
textSize = dimensionConverter.spToPx(12)
|
textSize = host.dimensionConverter.spToPx(12)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -193,8 +193,8 @@ class DeviceListEpoxyController @Inject constructor(private val stringProvider:
|
||||||
+"Self Signed Key:\n"
|
+"Self Signed Key:\n"
|
||||||
span {
|
span {
|
||||||
text = it.unpaddedBase64PublicKey ?: ""
|
text = it.unpaddedBase64PublicKey ?: ""
|
||||||
textColor = colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)
|
textColor = host.colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)
|
||||||
textSize = dimensionConverter.spToPx(12)
|
textSize = host.dimensionConverter.spToPx(12)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -44,6 +44,7 @@ class DeviceTrustInfoEpoxyController @Inject constructor(private val stringProvi
|
||||||
var interactionListener: InteractionListener? = null
|
var interactionListener: InteractionListener? = null
|
||||||
|
|
||||||
override fun buildModels(data: DeviceListViewState?) {
|
override fun buildModels(data: DeviceListViewState?) {
|
||||||
|
val host = this
|
||||||
data?.selectedDevice?.let {
|
data?.selectedDevice?.let {
|
||||||
val isVerified = it.trustLevel?.isVerified() == true
|
val isVerified = it.trustLevel?.isVerified() == true
|
||||||
genericItem {
|
genericItem {
|
||||||
|
@ -51,7 +52,7 @@ class DeviceTrustInfoEpoxyController @Inject constructor(private val stringProvi
|
||||||
style(ItemStyle.BIG_TEXT)
|
style(ItemStyle.BIG_TEXT)
|
||||||
titleIconResourceId(if (isVerified) R.drawable.ic_shield_trusted else R.drawable.ic_shield_warning)
|
titleIconResourceId(if (isVerified) R.drawable.ic_shield_trusted else R.drawable.ic_shield_warning)
|
||||||
title(
|
title(
|
||||||
stringProvider.getString(
|
host.stringProvider.getString(
|
||||||
if (isVerified) R.string.verification_profile_verified else R.string.verification_profile_warning
|
if (isVerified) R.string.verification_profile_verified else R.string.verification_profile_warning
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -59,16 +60,16 @@ class DeviceTrustInfoEpoxyController @Inject constructor(private val stringProvi
|
||||||
genericFooterItem {
|
genericFooterItem {
|
||||||
id("desc")
|
id("desc")
|
||||||
centered(false)
|
centered(false)
|
||||||
textColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
textColor(host.colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
||||||
apply {
|
apply {
|
||||||
if (isVerified) {
|
if (isVerified) {
|
||||||
// TODO FORMAT
|
// TODO FORMAT
|
||||||
text(stringProvider.getString(R.string.verification_profile_device_verified_because,
|
text(host.stringProvider.getString(R.string.verification_profile_device_verified_because,
|
||||||
data.userItem?.displayName ?: "",
|
data.userItem?.displayName ?: "",
|
||||||
data.userItem?.id ?: ""))
|
data.userItem?.id ?: ""))
|
||||||
} else {
|
} else {
|
||||||
// TODO what if mine
|
// TODO what if mine
|
||||||
text(stringProvider.getString(R.string.verification_profile_device_new_signing,
|
text(host.stringProvider.getString(R.string.verification_profile_device_new_signing,
|
||||||
data.userItem?.displayName ?: "",
|
data.userItem?.displayName ?: "",
|
||||||
data.userItem?.id ?: ""))
|
data.userItem?.id ?: ""))
|
||||||
}
|
}
|
||||||
|
@ -84,8 +85,8 @@ class DeviceTrustInfoEpoxyController @Inject constructor(private val stringProvi
|
||||||
+(it.displayName() ?: "")
|
+(it.displayName() ?: "")
|
||||||
span {
|
span {
|
||||||
text = " (${it.deviceId})"
|
text = " (${it.deviceId})"
|
||||||
textColor = colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)
|
textColor = host.colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)
|
||||||
textSize = dimensionConverter.spToPx(14)
|
textSize = host.dimensionConverter.spToPx(14)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -95,18 +96,18 @@ class DeviceTrustInfoEpoxyController @Inject constructor(private val stringProvi
|
||||||
genericFooterItem {
|
genericFooterItem {
|
||||||
id("warn")
|
id("warn")
|
||||||
centered(false)
|
centered(false)
|
||||||
textColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
textColor(host.colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
||||||
text(stringProvider.getString(R.string.verification_profile_device_untrust_info))
|
text(host.stringProvider.getString(R.string.verification_profile_device_untrust_info))
|
||||||
}
|
}
|
||||||
|
|
||||||
bottomSheetVerificationActionItem {
|
bottomSheetVerificationActionItem {
|
||||||
id("verify")
|
id("verify")
|
||||||
title(stringProvider.getString(R.string.cross_signing_verify_by_emoji))
|
title(host.stringProvider.getString(R.string.cross_signing_verify_by_emoji))
|
||||||
titleColor(colorProvider.getColor(R.color.riotx_accent))
|
titleColor(host.colorProvider.getColor(R.color.riotx_accent))
|
||||||
iconRes(R.drawable.ic_arrow_right)
|
iconRes(R.drawable.ic_arrow_right)
|
||||||
iconColor(colorProvider.getColor(R.color.riotx_accent))
|
iconColor(host.colorProvider.getColor(R.color.riotx_accent))
|
||||||
listener {
|
listener {
|
||||||
interactionListener?.onVerifyManually(it)
|
host.interactionListener?.onVerifyManually(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,9 +62,8 @@ class RoomProfileController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun buildModels(data: RoomProfileViewState?) {
|
override fun buildModels(data: RoomProfileViewState?) {
|
||||||
if (data == null) {
|
data ?: return
|
||||||
return
|
val host = this
|
||||||
}
|
|
||||||
val roomSummary = data.roomSummary() ?: return
|
val roomSummary = data.roomSummary() ?: return
|
||||||
|
|
||||||
// Topic
|
// Topic
|
||||||
|
@ -83,7 +82,7 @@ class RoomProfileController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onUrlLongClicked(url: String): Boolean {
|
override fun onUrlLongClicked(url: String): Boolean {
|
||||||
callback?.onUrlInTopicLongClicked(url)
|
host.callback?.onUrlInTopicLongClicked(url)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
@ -100,7 +99,7 @@ class RoomProfileController @Inject constructor(
|
||||||
genericFooterItem {
|
genericFooterItem {
|
||||||
id("e2e info")
|
id("e2e info")
|
||||||
centered(false)
|
centered(false)
|
||||||
text(stringProvider.getString(learnMoreSubtitle))
|
text(host.stringProvider.getString(learnMoreSubtitle))
|
||||||
}
|
}
|
||||||
buildEncryptionAction(data.actionPermissions, roomSummary)
|
buildEncryptionAction(data.actionPermissions, roomSummary)
|
||||||
|
|
||||||
|
|
|
@ -77,34 +77,36 @@ class RoomAliasController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildRoomDirectoryVisibility(data: RoomAliasViewState) {
|
private fun buildRoomDirectoryVisibility(data: RoomAliasViewState) {
|
||||||
|
val host = this
|
||||||
when (data.roomDirectoryVisibility) {
|
when (data.roomDirectoryVisibility) {
|
||||||
Uninitialized -> Unit
|
Uninitialized -> Unit
|
||||||
is Loading -> Unit
|
is Loading -> Unit
|
||||||
is Success -> {
|
is Success -> {
|
||||||
formSwitchItem {
|
formSwitchItem {
|
||||||
id("roomVisibility")
|
id("roomVisibility")
|
||||||
title(stringProvider.getString(R.string.room_alias_publish_to_directory, data.homeServerName))
|
title(host.stringProvider.getString(R.string.room_alias_publish_to_directory, data.homeServerName))
|
||||||
showDivider(false)
|
showDivider(false)
|
||||||
switchChecked(data.roomDirectoryVisibility() == RoomDirectoryVisibility.PUBLIC)
|
switchChecked(data.roomDirectoryVisibility() == RoomDirectoryVisibility.PUBLIC)
|
||||||
listener {
|
listener {
|
||||||
if (it) {
|
if (it) {
|
||||||
callback?.setRoomDirectoryVisibility(RoomDirectoryVisibility.PUBLIC)
|
host.callback?.setRoomDirectoryVisibility(RoomDirectoryVisibility.PUBLIC)
|
||||||
} else {
|
} else {
|
||||||
callback?.setRoomDirectoryVisibility(RoomDirectoryVisibility.PRIVATE)
|
host.callback?.setRoomDirectoryVisibility(RoomDirectoryVisibility.PRIVATE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
errorWithRetryItem {
|
errorWithRetryItem {
|
||||||
text(stringProvider.getString(R.string.room_alias_publish_to_directory_error,
|
text(host.stringProvider.getString(R.string.room_alias_publish_to_directory_error,
|
||||||
errorFormatter.toHumanReadable(data.roomDirectoryVisibility.error)))
|
host.errorFormatter.toHumanReadable(data.roomDirectoryVisibility.error)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildPublishInfo(data: RoomAliasViewState) {
|
private fun buildPublishInfo(data: RoomAliasViewState) {
|
||||||
|
val host = this
|
||||||
buildProfileSection(
|
buildProfileSection(
|
||||||
stringProvider.getString(R.string.room_alias_published_alias_title)
|
stringProvider.getString(R.string.room_alias_published_alias_title)
|
||||||
)
|
)
|
||||||
|
@ -120,8 +122,8 @@ class RoomAliasController @Inject constructor(
|
||||||
profileActionItem {
|
profileActionItem {
|
||||||
id("canonical")
|
id("canonical")
|
||||||
title(data.canonicalAlias)
|
title(data.canonicalAlias)
|
||||||
subtitle(stringProvider.getString(R.string.room_alias_published_alias_main))
|
subtitle(host.stringProvider.getString(R.string.room_alias_published_alias_main))
|
||||||
listener { callback?.openAliasDetail(canonicalAlias) }
|
listener { host.callback?.openAliasDetail(canonicalAlias) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +145,7 @@ class RoomAliasController @Inject constructor(
|
||||||
profileActionItem {
|
profileActionItem {
|
||||||
id("alt_$idx")
|
id("alt_$idx")
|
||||||
title(altAlias)
|
title(altAlias)
|
||||||
listener { callback?.openAliasDetail(altAlias) }
|
listener { host.callback?.openAliasDetail(altAlias) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,14 +156,15 @@ class RoomAliasController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildPublishManuallyForm(data: RoomAliasViewState) {
|
private fun buildPublishManuallyForm(data: RoomAliasViewState) {
|
||||||
|
val host = this
|
||||||
when (data.publishManuallyState) {
|
when (data.publishManuallyState) {
|
||||||
RoomAliasViewState.AddAliasState.Hidden -> Unit
|
RoomAliasViewState.AddAliasState.Hidden -> Unit
|
||||||
RoomAliasViewState.AddAliasState.Closed -> {
|
RoomAliasViewState.AddAliasState.Closed -> {
|
||||||
settingsButtonItem {
|
settingsButtonItem {
|
||||||
id("publishManually")
|
id("publishManually")
|
||||||
colorProvider(colorProvider)
|
colorProvider(host.colorProvider)
|
||||||
buttonTitleId(R.string.room_alias_published_alias_add_manually)
|
buttonTitleId(R.string.room_alias_published_alias_add_manually)
|
||||||
buttonClickListener { callback?.toggleManualPublishForm() }
|
buttonClickListener { host.callback?.toggleManualPublishForm() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is RoomAliasViewState.AddAliasState.Editing -> {
|
is RoomAliasViewState.AddAliasState.Editing -> {
|
||||||
|
@ -169,29 +172,30 @@ class RoomAliasController @Inject constructor(
|
||||||
id("publishManuallyEdit")
|
id("publishManuallyEdit")
|
||||||
value(data.publishManuallyState.value)
|
value(data.publishManuallyState.value)
|
||||||
showBottomSeparator(false)
|
showBottomSeparator(false)
|
||||||
hint(stringProvider.getString(R.string.room_alias_address_hint))
|
hint(host.stringProvider.getString(R.string.room_alias_address_hint))
|
||||||
inputType(InputType.TYPE_CLASS_TEXT)
|
inputType(InputType.TYPE_CLASS_TEXT)
|
||||||
onTextChange { text ->
|
onTextChange { text ->
|
||||||
callback?.setNewAlias(text)
|
host.callback?.setNewAlias(text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
settingsContinueCancelItem {
|
settingsContinueCancelItem {
|
||||||
id("publishManuallySubmit")
|
id("publishManuallySubmit")
|
||||||
continueText(stringProvider.getString(R.string.room_alias_published_alias_add_manually_submit))
|
continueText(host.stringProvider.getString(R.string.room_alias_published_alias_add_manually_submit))
|
||||||
continueOnClick { callback?.addAlias() }
|
continueOnClick { host.callback?.addAlias() }
|
||||||
cancelOnClick { callback?.toggleManualPublishForm() }
|
cancelOnClick { host.callback?.toggleManualPublishForm() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildLocalInfo(data: RoomAliasViewState) {
|
private fun buildLocalInfo(data: RoomAliasViewState) {
|
||||||
|
val host = this
|
||||||
buildProfileSection(
|
buildProfileSection(
|
||||||
stringProvider.getString(R.string.room_alias_local_address_title)
|
stringProvider.getString(R.string.room_alias_local_address_title)
|
||||||
)
|
)
|
||||||
settingsInfoItem {
|
settingsInfoItem {
|
||||||
id("localInfo")
|
id("localInfo")
|
||||||
helperText(stringProvider.getString(R.string.room_alias_local_address_subtitle, data.homeServerName))
|
helperText(host.stringProvider.getString(R.string.room_alias_local_address_subtitle, data.homeServerName))
|
||||||
}
|
}
|
||||||
|
|
||||||
when (val localAliases = data.localAliases) {
|
when (val localAliases = data.localAliases) {
|
||||||
|
@ -211,7 +215,7 @@ class RoomAliasController @Inject constructor(
|
||||||
profileActionItem {
|
profileActionItem {
|
||||||
id("loc_$idx")
|
id("loc_$idx")
|
||||||
title(localAlias)
|
title(localAlias)
|
||||||
listener { callback?.openAliasDetail(localAlias) }
|
listener { host.callback?.openAliasDetail(localAlias) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,7 +223,7 @@ class RoomAliasController @Inject constructor(
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
errorWithRetryItem {
|
errorWithRetryItem {
|
||||||
id("alt_error")
|
id("alt_error")
|
||||||
text(errorFormatter.toHumanReadable(localAliases.error))
|
text(host.errorFormatter.toHumanReadable(localAliases.error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -229,14 +233,15 @@ class RoomAliasController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildAddLocalAlias(data: RoomAliasViewState) {
|
private fun buildAddLocalAlias(data: RoomAliasViewState) {
|
||||||
|
val host = this
|
||||||
when (data.newLocalAliasState) {
|
when (data.newLocalAliasState) {
|
||||||
RoomAliasViewState.AddAliasState.Hidden -> Unit
|
RoomAliasViewState.AddAliasState.Hidden -> Unit
|
||||||
RoomAliasViewState.AddAliasState.Closed -> {
|
RoomAliasViewState.AddAliasState.Closed -> {
|
||||||
settingsButtonItem {
|
settingsButtonItem {
|
||||||
id("newLocalAliasButton")
|
id("newLocalAliasButton")
|
||||||
colorProvider(colorProvider)
|
colorProvider(host.colorProvider)
|
||||||
buttonTitleId(R.string.room_alias_local_address_add)
|
buttonTitleId(R.string.room_alias_local_address_add)
|
||||||
buttonClickListener { callback?.toggleLocalAliasForm() }
|
buttonClickListener { host.callback?.toggleLocalAliasForm() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is RoomAliasViewState.AddAliasState.Editing -> {
|
is RoomAliasViewState.AddAliasState.Editing -> {
|
||||||
|
@ -245,16 +250,16 @@ class RoomAliasController @Inject constructor(
|
||||||
value(data.newLocalAliasState.value)
|
value(data.newLocalAliasState.value)
|
||||||
homeServer(":" + data.homeServerName)
|
homeServer(":" + data.homeServerName)
|
||||||
showBottomSeparator(false)
|
showBottomSeparator(false)
|
||||||
errorMessage(roomAliasErrorFormatter.format((data.newLocalAliasState.asyncRequest as? Fail)?.error as? RoomAliasError))
|
errorMessage(host.roomAliasErrorFormatter.format((data.newLocalAliasState.asyncRequest as? Fail)?.error as? RoomAliasError))
|
||||||
onTextChange { value ->
|
onTextChange { value ->
|
||||||
callback?.setNewLocalAliasLocalPart(value)
|
host.callback?.setNewLocalAliasLocalPart(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
settingsContinueCancelItem {
|
settingsContinueCancelItem {
|
||||||
id("newLocalAliasSubmit")
|
id("newLocalAliasSubmit")
|
||||||
continueText(stringProvider.getString(R.string.action_add))
|
continueText(host.stringProvider.getString(R.string.action_add))
|
||||||
continueOnClick { callback?.addLocalAlias() }
|
continueOnClick { host.callback?.addLocalAlias() }
|
||||||
cancelOnClick { callback?.toggleLocalAliasForm() }
|
cancelOnClick { host.callback?.toggleLocalAliasForm() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,12 +73,13 @@ class RoomAliasBottomSheetController @Inject constructor() : TypedEpoxyControlle
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun RoomAliasBottomSheetSharedAction.toBottomSheetItem(index: Int) {
|
private fun RoomAliasBottomSheetSharedAction.toBottomSheetItem(index: Int) {
|
||||||
|
val host = this@RoomAliasBottomSheetController
|
||||||
return bottomSheetActionItem {
|
return bottomSheetActionItem {
|
||||||
id("action_$index")
|
id("action_$index")
|
||||||
iconRes(iconResId)
|
iconRes(iconResId)
|
||||||
textRes(titleRes)
|
textRes(titleRes)
|
||||||
destructive(this@toBottomSheetItem.destructive)
|
destructive(this@toBottomSheetItem.destructive)
|
||||||
listener(View.OnClickListener { listener?.didSelectMenuAction(this@toBottomSheetItem) })
|
listener(View.OnClickListener { host.listener?.didSelectMenuAction(this@toBottomSheetItem) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@ class RoomBannedMemberListController @Inject constructor(
|
||||||
|
|
||||||
override fun buildModels(data: RoomBannedMemberListViewState?) {
|
override fun buildModels(data: RoomBannedMemberListViewState?) {
|
||||||
val bannedList = data?.bannedMemberSummaries?.invoke() ?: return
|
val bannedList = data?.bannedMemberSummaries?.invoke() ?: return
|
||||||
|
val host = this
|
||||||
|
|
||||||
val quantityString = stringProvider.getQuantityString(R.plurals.room_settings_banned_users_count, bannedList.size, bannedList.size)
|
val quantityString = stringProvider.getQuantityString(R.plurals.room_settings_banned_users_count, bannedList.size, bannedList.size)
|
||||||
|
|
||||||
|
@ -74,7 +75,7 @@ class RoomBannedMemberListController @Inject constructor(
|
||||||
profileMatrixItemWithProgress {
|
profileMatrixItemWithProgress {
|
||||||
id(roomMember.userId)
|
id(roomMember.userId)
|
||||||
matrixItem(roomMember.toMatrixItem())
|
matrixItem(roomMember.toMatrixItem())
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
apply {
|
apply {
|
||||||
if (actionInProgress) {
|
if (actionInProgress) {
|
||||||
inProgress(true)
|
inProgress(true)
|
||||||
|
@ -83,7 +84,7 @@ class RoomBannedMemberListController @Inject constructor(
|
||||||
inProgress(false)
|
inProgress(false)
|
||||||
editable(true)
|
editable(true)
|
||||||
clickListener { _ ->
|
clickListener { _ ->
|
||||||
callback?.onUnbanClicked(roomMember)
|
host.callback?.onUnbanClicked(roomMember)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,7 +93,7 @@ class RoomBannedMemberListController @Inject constructor(
|
||||||
between = { _, roomMemberBefore ->
|
between = { _, roomMemberBefore ->
|
||||||
dividerItem {
|
dividerItem {
|
||||||
id("divider_${roomMemberBefore.userId}")
|
id("divider_${roomMemberBefore.userId}")
|
||||||
color(dividerColor)
|
color(host.dividerColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -55,6 +55,7 @@ class RoomMemberListController @Inject constructor(
|
||||||
|
|
||||||
override fun buildModels(data: RoomMemberListViewState?) {
|
override fun buildModels(data: RoomMemberListViewState?) {
|
||||||
data ?: return
|
data ?: return
|
||||||
|
val host = this
|
||||||
|
|
||||||
roomMemberSummaryFilter.filter = data.filter
|
roomMemberSummaryFilter.filter = data.filter
|
||||||
|
|
||||||
|
@ -93,17 +94,17 @@ class RoomMemberListController @Inject constructor(
|
||||||
profileMatrixItem {
|
profileMatrixItem {
|
||||||
id(roomMember.userId)
|
id(roomMember.userId)
|
||||||
matrixItem(roomMember.toMatrixItem())
|
matrixItem(roomMember.toMatrixItem())
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
userEncryptionTrustLevel(data.trustLevelMap.invoke()?.get(roomMember.userId))
|
userEncryptionTrustLevel(data.trustLevelMap.invoke()?.get(roomMember.userId))
|
||||||
clickListener { _ ->
|
clickListener { _ ->
|
||||||
callback?.onRoomMemberClicked(roomMember)
|
host.callback?.onRoomMemberClicked(roomMember)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
between = { _, roomMemberBefore ->
|
between = { _, roomMemberBefore ->
|
||||||
dividerItem {
|
dividerItem {
|
||||||
id("divider_${roomMemberBefore.userId}")
|
id("divider_${roomMemberBefore.userId}")
|
||||||
color(dividerColor)
|
color(host.dividerColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -111,7 +112,7 @@ class RoomMemberListController @Inject constructor(
|
||||||
// Display the threepid invite after the regular invite
|
// Display the threepid invite after the regular invite
|
||||||
dividerItem {
|
dividerItem {
|
||||||
id("divider_threepidinvites")
|
id("divider_threepidinvites")
|
||||||
color(dividerColor)
|
color(host.dividerColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
buildThreePidInvites(data)
|
buildThreePidInvites(data)
|
||||||
|
@ -130,6 +131,7 @@ class RoomMemberListController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildThreePidInvites(data: RoomMemberListViewState) {
|
private fun buildThreePidInvites(data: RoomMemberListViewState) {
|
||||||
|
val host = this
|
||||||
data.threePidInvites()
|
data.threePidInvites()
|
||||||
?.filter { it.content.toModel<RoomThirdPartyInviteContent>() != null }
|
?.filter { it.content.toModel<RoomThirdPartyInviteContent>() != null }
|
||||||
?.join(
|
?.join(
|
||||||
|
@ -139,10 +141,10 @@ class RoomMemberListController @Inject constructor(
|
||||||
profileMatrixItem {
|
profileMatrixItem {
|
||||||
id("3pid_$idx")
|
id("3pid_$idx")
|
||||||
matrixItem(content.toMatrixItem())
|
matrixItem(content.toMatrixItem())
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
editable(data.actionsPermissions.canRevokeThreePidInvite)
|
editable(data.actionsPermissions.canRevokeThreePidInvite)
|
||||||
clickListener { _ ->
|
clickListener { _ ->
|
||||||
callback?.onThreePidInviteClicked(event)
|
host.callback?.onThreePidInviteClicked(event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,7 +152,7 @@ class RoomMemberListController @Inject constructor(
|
||||||
between = { idx, _ ->
|
between = { idx, _ ->
|
||||||
dividerItem {
|
dividerItem {
|
||||||
id("divider3_$idx")
|
id("divider3_$idx")
|
||||||
color(dividerColor)
|
color(host.dividerColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -88,6 +88,7 @@ class RoomPermissionsController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun buildModels(data: RoomPermissionsViewState?) {
|
override fun buildModels(data: RoomPermissionsViewState?) {
|
||||||
|
val host = this
|
||||||
buildProfileSection(
|
buildProfileSection(
|
||||||
stringProvider.getString(R.string.room_permissions_title)
|
stringProvider.getString(R.string.room_permissions_title)
|
||||||
)
|
)
|
||||||
|
@ -97,17 +98,18 @@ class RoomPermissionsController @Inject constructor(
|
||||||
else -> {
|
else -> {
|
||||||
loadingItem {
|
loadingItem {
|
||||||
id("loading")
|
id("loading")
|
||||||
loadingText(stringProvider.getString(R.string.loading))
|
loadingText(host.stringProvider.getString(R.string.loading))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildPermissions(data: RoomPermissionsViewState, content: PowerLevelsContent) {
|
private fun buildPermissions(data: RoomPermissionsViewState, content: PowerLevelsContent) {
|
||||||
|
val host = this
|
||||||
val editable = data.actionPermissions.canChangePowerLevels
|
val editable = data.actionPermissions.canChangePowerLevels
|
||||||
settingsInfoItem {
|
settingsInfoItem {
|
||||||
id("notice")
|
id("notice")
|
||||||
helperText(stringProvider.getString(if (editable) R.string.room_permissions_notice else R.string.room_permissions_notice_read_only))
|
helperText(host.stringProvider.getString(if (editable) R.string.room_permissions_notice else R.string.room_permissions_notice_read_only))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Useful permissions
|
// Useful permissions
|
||||||
|
@ -116,9 +118,9 @@ class RoomPermissionsController @Inject constructor(
|
||||||
// Toggle
|
// Toggle
|
||||||
formAdvancedToggleItem {
|
formAdvancedToggleItem {
|
||||||
id("showAdvanced")
|
id("showAdvanced")
|
||||||
title(stringProvider.getString(if (data.showAdvancedPermissions) R.string.hide_advanced else R.string.show_advanced))
|
title(host.stringProvider.getString(if (data.showAdvancedPermissions) R.string.hide_advanced else R.string.show_advanced))
|
||||||
expanded(!data.showAdvancedPermissions)
|
expanded(!data.showAdvancedPermissions)
|
||||||
listener { callback?.toggleShowAllPermissions() }
|
listener { host.callback?.toggleShowAllPermissions() }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Advanced permissions
|
// Advanced permissions
|
||||||
|
|
|
@ -62,6 +62,7 @@ class RoomSettingsController @Inject constructor(
|
||||||
|
|
||||||
override fun buildModels(data: RoomSettingsViewState?) {
|
override fun buildModels(data: RoomSettingsViewState?) {
|
||||||
val roomSummary = data?.roomSummary?.invoke() ?: return
|
val roomSummary = data?.roomSummary?.invoke() ?: return
|
||||||
|
val host = this
|
||||||
|
|
||||||
formEditableAvatarItem {
|
formEditableAvatarItem {
|
||||||
id("avatar")
|
id("avatar")
|
||||||
|
@ -69,7 +70,7 @@ class RoomSettingsController @Inject constructor(
|
||||||
when (val avatarAction = data.avatarAction) {
|
when (val avatarAction = data.avatarAction) {
|
||||||
RoomSettingsViewState.AvatarAction.None -> {
|
RoomSettingsViewState.AvatarAction.None -> {
|
||||||
// Use the current value
|
// Use the current value
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
// We do not want to use the fallback avatar url, which can be the other user avatar, or the current user avatar.
|
// We do not want to use the fallback avatar url, which can be the other user avatar, or the current user avatar.
|
||||||
matrixItem(roomSummary.toMatrixItem().copy(avatarUrl = data.currentRoomAvatarUrl))
|
matrixItem(roomSummary.toMatrixItem().copy(avatarUrl = data.currentRoomAvatarUrl))
|
||||||
}
|
}
|
||||||
|
@ -78,8 +79,8 @@ class RoomSettingsController @Inject constructor(
|
||||||
is RoomSettingsViewState.AvatarAction.UpdateAvatar ->
|
is RoomSettingsViewState.AvatarAction.UpdateAvatar ->
|
||||||
imageUri(avatarAction.newAvatarUri)
|
imageUri(avatarAction.newAvatarUri)
|
||||||
}
|
}
|
||||||
clickListener { callback?.onAvatarChange() }
|
clickListener { host.callback?.onAvatarChange() }
|
||||||
deleteListener { callback?.onAvatarDelete() }
|
deleteListener { host.callback?.onAvatarDelete() }
|
||||||
}
|
}
|
||||||
|
|
||||||
buildProfileSection(
|
buildProfileSection(
|
||||||
|
@ -90,10 +91,10 @@ class RoomSettingsController @Inject constructor(
|
||||||
id("name")
|
id("name")
|
||||||
enabled(data.actionPermissions.canChangeName)
|
enabled(data.actionPermissions.canChangeName)
|
||||||
value(data.newName ?: roomSummary.displayName)
|
value(data.newName ?: roomSummary.displayName)
|
||||||
hint(stringProvider.getString(R.string.room_settings_name_hint))
|
hint(host.stringProvider.getString(R.string.room_settings_name_hint))
|
||||||
|
|
||||||
onTextChange { text ->
|
onTextChange { text ->
|
||||||
callback?.onNameChanged(text)
|
host.callback?.onNameChanged(text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,10 +102,10 @@ class RoomSettingsController @Inject constructor(
|
||||||
id("topic")
|
id("topic")
|
||||||
enabled(data.actionPermissions.canChangeTopic)
|
enabled(data.actionPermissions.canChangeTopic)
|
||||||
value(data.newTopic ?: roomSummary.topic)
|
value(data.newTopic ?: roomSummary.topic)
|
||||||
hint(stringProvider.getString(R.string.room_settings_topic_hint))
|
hint(host.stringProvider.getString(R.string.room_settings_topic_hint))
|
||||||
|
|
||||||
onTextChange { text ->
|
onTextChange { text ->
|
||||||
callback?.onTopicChanged(text)
|
host.callback?.onTopicChanged(text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,10 +135,10 @@ class RoomSettingsController @Inject constructor(
|
||||||
// add guest access option?
|
// add guest access option?
|
||||||
formSwitchItem {
|
formSwitchItem {
|
||||||
id("guest_access")
|
id("guest_access")
|
||||||
title(stringProvider.getString(R.string.room_settings_guest_access_title))
|
title(host.stringProvider.getString(R.string.room_settings_guest_access_title))
|
||||||
switchChecked(guestAccess == GuestAccess.CanJoin)
|
switchChecked(guestAccess == GuestAccess.CanJoin)
|
||||||
listener {
|
listener {
|
||||||
callback?.onToggleGuestAccess()
|
host.callback?.onToggleGuestAccess()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,16 +49,17 @@ class UploadsFileController @Inject constructor(
|
||||||
|
|
||||||
override fun buildModels(data: RoomUploadsViewState?) {
|
override fun buildModels(data: RoomUploadsViewState?) {
|
||||||
data ?: return
|
data ?: return
|
||||||
|
val host = this
|
||||||
|
|
||||||
buildFileItems(data.fileEvents)
|
buildFileItems(data.fileEvents)
|
||||||
|
|
||||||
if (data.hasMore) {
|
if (data.hasMore) {
|
||||||
loadingItem {
|
loadingItem {
|
||||||
// Always use a different id, because we can be notified several times of visibility state changed
|
// Always use a different id, because we can be notified several times of visibility state changed
|
||||||
id("loadMore${idx++}")
|
id("loadMore${host.idx++}")
|
||||||
onVisibilityStateChanged { _, _, visibilityState ->
|
onVisibilityStateChanged { _, _, visibilityState ->
|
||||||
if (visibilityState == VisibilityState.VISIBLE) {
|
if (visibilityState == VisibilityState.VISIBLE) {
|
||||||
listener?.loadMore()
|
host.listener?.loadMore()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,24 +67,25 @@ class UploadsFileController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildFileItems(fileEvents: List<UploadEvent>) {
|
private fun buildFileItems(fileEvents: List<UploadEvent>) {
|
||||||
|
val host = this
|
||||||
fileEvents.forEach { uploadEvent ->
|
fileEvents.forEach { uploadEvent ->
|
||||||
uploadsFileItem {
|
uploadsFileItem {
|
||||||
id(uploadEvent.eventId)
|
id(uploadEvent.eventId)
|
||||||
title(uploadEvent.contentWithAttachmentContent.body)
|
title(uploadEvent.contentWithAttachmentContent.body)
|
||||||
subtitle(stringProvider.getString(R.string.uploads_files_subtitle,
|
subtitle(host.stringProvider.getString(R.string.uploads_files_subtitle,
|
||||||
uploadEvent.senderInfo.disambiguatedDisplayName,
|
uploadEvent.senderInfo.disambiguatedDisplayName,
|
||||||
dateFormatter.format(uploadEvent.root.originServerTs, DateFormatKind.DEFAULT_DATE_AND_TIME)))
|
host.dateFormatter.format(uploadEvent.root.originServerTs, DateFormatKind.DEFAULT_DATE_AND_TIME)))
|
||||||
listener(object : UploadsFileItem.Listener {
|
listener(object : UploadsFileItem.Listener {
|
||||||
override fun onItemClicked() {
|
override fun onItemClicked() {
|
||||||
listener?.onOpenClicked(uploadEvent)
|
host.listener?.onOpenClicked(uploadEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDownloadClicked() {
|
override fun onDownloadClicked() {
|
||||||
listener?.onDownloadClicked(uploadEvent)
|
host.listener?.onDownloadClicked(uploadEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onShareClicked() {
|
override fun onShareClicked() {
|
||||||
listener?.onShareClicked(uploadEvent)
|
host.listener?.onShareClicked(uploadEvent)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,16 +60,17 @@ class UploadsMediaController @Inject constructor(
|
||||||
|
|
||||||
override fun buildModels(data: RoomUploadsViewState?) {
|
override fun buildModels(data: RoomUploadsViewState?) {
|
||||||
data ?: return
|
data ?: return
|
||||||
|
val host = this
|
||||||
|
|
||||||
buildMediaItems(data.mediaEvents)
|
buildMediaItems(data.mediaEvents)
|
||||||
|
|
||||||
if (data.hasMore) {
|
if (data.hasMore) {
|
||||||
squareLoadingItem {
|
squareLoadingItem {
|
||||||
// Always use a different id, because we can be notified several times of visibility state changed
|
// Always use a different id, because we can be notified several times of visibility state changed
|
||||||
id("loadMore${idx++}")
|
id("loadMore${host.idx++}")
|
||||||
onVisibilityStateChanged { _, _, visibilityState ->
|
onVisibilityStateChanged { _, _, visibilityState ->
|
||||||
if (visibilityState == VisibilityState.VISIBLE) {
|
if (visibilityState == VisibilityState.VISIBLE) {
|
||||||
listener?.loadMore()
|
host.listener?.loadMore()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,17 +78,18 @@ class UploadsMediaController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildMediaItems(mediaEvents: List<UploadEvent>) {
|
private fun buildMediaItems(mediaEvents: List<UploadEvent>) {
|
||||||
|
val host = this
|
||||||
mediaEvents.forEach { uploadEvent ->
|
mediaEvents.forEach { uploadEvent ->
|
||||||
when (uploadEvent.contentWithAttachmentContent.msgType) {
|
when (uploadEvent.contentWithAttachmentContent.msgType) {
|
||||||
MessageType.MSGTYPE_IMAGE -> {
|
MessageType.MSGTYPE_IMAGE -> {
|
||||||
val data = uploadEvent.toImageContentRendererData() ?: return@forEach
|
val data = uploadEvent.toImageContentRendererData() ?: return@forEach
|
||||||
uploadsImageItem {
|
uploadsImageItem {
|
||||||
id(uploadEvent.eventId)
|
id(uploadEvent.eventId)
|
||||||
imageContentRenderer(imageContentRenderer)
|
imageContentRenderer(host.imageContentRenderer)
|
||||||
data(data)
|
data(data)
|
||||||
listener(object : UploadsImageItem.Listener {
|
listener(object : UploadsImageItem.Listener {
|
||||||
override fun onItemClicked(view: View, data: ImageContentRenderer.Data) {
|
override fun onItemClicked(view: View, data: ImageContentRenderer.Data) {
|
||||||
listener?.onOpenImageClicked(view, data)
|
host.listener?.onOpenImageClicked(view, data)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -96,11 +98,11 @@ class UploadsMediaController @Inject constructor(
|
||||||
val data = uploadEvent.toVideoContentRendererData() ?: return@forEach
|
val data = uploadEvent.toVideoContentRendererData() ?: return@forEach
|
||||||
uploadsVideoItem {
|
uploadsVideoItem {
|
||||||
id(uploadEvent.eventId)
|
id(uploadEvent.eventId)
|
||||||
imageContentRenderer(imageContentRenderer)
|
imageContentRenderer(host.imageContentRenderer)
|
||||||
data(data)
|
data(data)
|
||||||
listener(object : UploadsVideoItem.Listener {
|
listener(object : UploadsVideoItem.Listener {
|
||||||
override fun onItemClicked(view: View, data: VideoContentRenderer.Data) {
|
override fun onItemClicked(view: View, data: VideoContentRenderer.Data) {
|
||||||
listener?.onOpenVideoClicked(view, data)
|
host.listener?.onOpenVideoClicked(view, data)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,18 +42,19 @@ class CrossSigningSettingsController @Inject constructor(
|
||||||
|
|
||||||
override fun buildModels(data: CrossSigningSettingsViewState?) {
|
override fun buildModels(data: CrossSigningSettingsViewState?) {
|
||||||
if (data == null) return
|
if (data == null) return
|
||||||
|
val host = this
|
||||||
when {
|
when {
|
||||||
data.xSigningKeyCanSign -> {
|
data.xSigningKeyCanSign -> {
|
||||||
genericItem {
|
genericItem {
|
||||||
id("can")
|
id("can")
|
||||||
titleIconResourceId(R.drawable.ic_shield_trusted)
|
titleIconResourceId(R.drawable.ic_shield_trusted)
|
||||||
title(stringProvider.getString(R.string.encryption_information_dg_xsigning_complete))
|
title(host.stringProvider.getString(R.string.encryption_information_dg_xsigning_complete))
|
||||||
}
|
}
|
||||||
genericButtonItem {
|
genericButtonItem {
|
||||||
id("Reset")
|
id("Reset")
|
||||||
text(stringProvider.getString(R.string.reset_cross_signing))
|
text(host.stringProvider.getString(R.string.reset_cross_signing))
|
||||||
buttonClickAction(DebouncedClickListener({
|
buttonClickAction(DebouncedClickListener({
|
||||||
interactionListener?.didTapInitializeCrossSigning()
|
host.interactionListener?.didTapInitializeCrossSigning()
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,13 +62,13 @@ class CrossSigningSettingsController @Inject constructor(
|
||||||
genericItem {
|
genericItem {
|
||||||
id("trusted")
|
id("trusted")
|
||||||
titleIconResourceId(R.drawable.ic_shield_custom)
|
titleIconResourceId(R.drawable.ic_shield_custom)
|
||||||
title(stringProvider.getString(R.string.encryption_information_dg_xsigning_trusted))
|
title(host.stringProvider.getString(R.string.encryption_information_dg_xsigning_trusted))
|
||||||
}
|
}
|
||||||
genericButtonItem {
|
genericButtonItem {
|
||||||
id("Reset")
|
id("Reset")
|
||||||
text(stringProvider.getString(R.string.reset_cross_signing))
|
text(host.stringProvider.getString(R.string.reset_cross_signing))
|
||||||
buttonClickAction(DebouncedClickListener({
|
buttonClickAction(DebouncedClickListener({
|
||||||
interactionListener?.didTapInitializeCrossSigning()
|
host.interactionListener?.didTapInitializeCrossSigning()
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,27 +76,27 @@ class CrossSigningSettingsController @Inject constructor(
|
||||||
genericItem {
|
genericItem {
|
||||||
id("enable")
|
id("enable")
|
||||||
titleIconResourceId(R.drawable.ic_shield_black)
|
titleIconResourceId(R.drawable.ic_shield_black)
|
||||||
title(stringProvider.getString(R.string.encryption_information_dg_xsigning_not_trusted))
|
title(host.stringProvider.getString(R.string.encryption_information_dg_xsigning_not_trusted))
|
||||||
}
|
}
|
||||||
genericButtonItem {
|
genericButtonItem {
|
||||||
id("Reset")
|
id("Reset")
|
||||||
text(stringProvider.getString(R.string.reset_cross_signing))
|
text(host.stringProvider.getString(R.string.reset_cross_signing))
|
||||||
buttonClickAction(DebouncedClickListener({
|
buttonClickAction(DebouncedClickListener({
|
||||||
interactionListener?.didTapInitializeCrossSigning()
|
host.interactionListener?.didTapInitializeCrossSigning()
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
genericItem {
|
genericItem {
|
||||||
id("not")
|
id("not")
|
||||||
title(stringProvider.getString(R.string.encryption_information_dg_xsigning_disabled))
|
title(host.stringProvider.getString(R.string.encryption_information_dg_xsigning_disabled))
|
||||||
}
|
}
|
||||||
|
|
||||||
genericPositiveButtonItem {
|
genericPositiveButtonItem {
|
||||||
id("Initialize")
|
id("Initialize")
|
||||||
text(stringProvider.getString(R.string.initialize_cross_signing))
|
text(host.stringProvider.getString(R.string.initialize_cross_signing))
|
||||||
buttonClickAction(DebouncedClickListener({
|
buttonClickAction(DebouncedClickListener({
|
||||||
interactionListener?.didTapInitializeCrossSigning()
|
host.interactionListener?.didTapInitializeCrossSigning()
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,8 +113,8 @@ class CrossSigningSettingsController @Inject constructor(
|
||||||
+"Master Key:\n"
|
+"Master Key:\n"
|
||||||
span {
|
span {
|
||||||
text = it.unpaddedBase64PublicKey ?: ""
|
text = it.unpaddedBase64PublicKey ?: ""
|
||||||
textColor = colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)
|
textColor = host.colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)
|
||||||
textSize = dimensionConverter.spToPx(12)
|
textSize = host.dimensionConverter.spToPx(12)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -128,8 +129,8 @@ class CrossSigningSettingsController @Inject constructor(
|
||||||
+"User Key:\n"
|
+"User Key:\n"
|
||||||
span {
|
span {
|
||||||
text = it.unpaddedBase64PublicKey ?: ""
|
text = it.unpaddedBase64PublicKey ?: ""
|
||||||
textColor = colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)
|
textColor = host.colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)
|
||||||
textSize = dimensionConverter.spToPx(12)
|
textSize = host.dimensionConverter.spToPx(12)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -144,8 +145,8 @@ class CrossSigningSettingsController @Inject constructor(
|
||||||
+"Self Signed Key:\n"
|
+"Self Signed Key:\n"
|
||||||
span {
|
span {
|
||||||
text = it.unpaddedBase64PublicKey ?: ""
|
text = it.unpaddedBase64PublicKey ?: ""
|
||||||
textColor = colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)
|
textColor = host.colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)
|
||||||
textSize = dimensionConverter.spToPx(12)
|
textSize = host.dimensionConverter.spToPx(12)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -80,6 +80,7 @@ class DeviceVerificationInfoBottomSheetController @Inject constructor(
|
||||||
val isMine = data.isMine
|
val isMine = data.isMine
|
||||||
val currentSessionIsTrusted = data.accountCrossSigningIsTrusted
|
val currentSessionIsTrusted = data.accountCrossSigningIsTrusted
|
||||||
Timber.v("handleE2EWithCrossSigning $isMine, $cryptoDeviceInfo, $shield")
|
Timber.v("handleE2EWithCrossSigning $isMine, $cryptoDeviceInfo, $shield")
|
||||||
|
val host = this
|
||||||
|
|
||||||
if (isMine) {
|
if (isMine) {
|
||||||
if (currentSessionIsTrusted) {
|
if (currentSessionIsTrusted) {
|
||||||
|
@ -87,8 +88,8 @@ class DeviceVerificationInfoBottomSheetController @Inject constructor(
|
||||||
id("trust${cryptoDeviceInfo.deviceId}")
|
id("trust${cryptoDeviceInfo.deviceId}")
|
||||||
style(ItemStyle.BIG_TEXT)
|
style(ItemStyle.BIG_TEXT)
|
||||||
titleIconResourceId(shield)
|
titleIconResourceId(shield)
|
||||||
title(stringProvider.getString(R.string.encryption_information_verified))
|
title(host.stringProvider.getString(R.string.encryption_information_verified))
|
||||||
description(stringProvider.getString(R.string.settings_active_sessions_verified_device_desc))
|
description(host.stringProvider.getString(R.string.settings_active_sessions_verified_device_desc))
|
||||||
}
|
}
|
||||||
} else if (data.canVerifySession) {
|
} else if (data.canVerifySession) {
|
||||||
// You need to complete security, only if there are other session(s) available, or if 4S contains secrets
|
// You need to complete security, only if there are other session(s) available, or if 4S contains secrets
|
||||||
|
@ -96,11 +97,11 @@ class DeviceVerificationInfoBottomSheetController @Inject constructor(
|
||||||
id("trust${cryptoDeviceInfo.deviceId}")
|
id("trust${cryptoDeviceInfo.deviceId}")
|
||||||
style(ItemStyle.BIG_TEXT)
|
style(ItemStyle.BIG_TEXT)
|
||||||
titleIconResourceId(shield)
|
titleIconResourceId(shield)
|
||||||
title(stringProvider.getString(R.string.crosssigning_verify_this_session))
|
title(host.stringProvider.getString(R.string.crosssigning_verify_this_session))
|
||||||
if (data.hasOtherSessions) {
|
if (data.hasOtherSessions) {
|
||||||
description(stringProvider.getString(R.string.confirm_your_identity))
|
description(host.stringProvider.getString(R.string.confirm_your_identity))
|
||||||
} else {
|
} else {
|
||||||
description(stringProvider.getString(R.string.confirm_your_identity_quad_s))
|
description(host.stringProvider.getString(R.string.confirm_your_identity_quad_s))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,16 +117,16 @@ class DeviceVerificationInfoBottomSheetController @Inject constructor(
|
||||||
id("trust${cryptoDeviceInfo.deviceId}")
|
id("trust${cryptoDeviceInfo.deviceId}")
|
||||||
style(ItemStyle.BIG_TEXT)
|
style(ItemStyle.BIG_TEXT)
|
||||||
titleIconResourceId(shield)
|
titleIconResourceId(shield)
|
||||||
title(stringProvider.getString(R.string.encryption_information_verified))
|
title(host.stringProvider.getString(R.string.encryption_information_verified))
|
||||||
description(stringProvider.getString(R.string.settings_active_sessions_verified_device_desc))
|
description(host.stringProvider.getString(R.string.settings_active_sessions_verified_device_desc))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
genericItem {
|
genericItem {
|
||||||
id("trust${cryptoDeviceInfo.deviceId}")
|
id("trust${cryptoDeviceInfo.deviceId}")
|
||||||
titleIconResourceId(shield)
|
titleIconResourceId(shield)
|
||||||
style(ItemStyle.BIG_TEXT)
|
style(ItemStyle.BIG_TEXT)
|
||||||
title(stringProvider.getString(R.string.encryption_information_not_verified))
|
title(host.stringProvider.getString(R.string.encryption_information_not_verified))
|
||||||
description(stringProvider.getString(R.string.settings_active_sessions_unverified_device_desc))
|
description(host.stringProvider.getString(R.string.settings_active_sessions_unverified_device_desc))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,12 +146,12 @@ class DeviceVerificationInfoBottomSheetController @Inject constructor(
|
||||||
}
|
}
|
||||||
bottomSheetVerificationActionItem {
|
bottomSheetVerificationActionItem {
|
||||||
id("completeSecurity")
|
id("completeSecurity")
|
||||||
title(stringProvider.getString(R.string.crosssigning_verify_this_session))
|
title(host.stringProvider.getString(R.string.crosssigning_verify_this_session))
|
||||||
titleColor(colorProvider.getColor(R.color.riotx_accent))
|
titleColor(host.colorProvider.getColor(R.color.riotx_accent))
|
||||||
iconRes(R.drawable.ic_arrow_right)
|
iconRes(R.drawable.ic_arrow_right)
|
||||||
iconColor(colorProvider.getColor(R.color.riotx_accent))
|
iconColor(host.colorProvider.getColor(R.color.riotx_accent))
|
||||||
listener {
|
listener {
|
||||||
callback?.onAction(DevicesAction.CompleteSecurity)
|
host.callback?.onAction(DevicesAction.CompleteSecurity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!isMine) {
|
} else if (!isMine) {
|
||||||
|
@ -165,6 +166,7 @@ class DeviceVerificationInfoBottomSheetController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleE2EInLegacy(data: DeviceVerificationInfoBottomSheetViewState, cryptoDeviceInfo: CryptoDeviceInfo, shield: Int) {
|
private fun handleE2EInLegacy(data: DeviceVerificationInfoBottomSheetViewState, cryptoDeviceInfo: CryptoDeviceInfo, shield: Int) {
|
||||||
|
val host = this
|
||||||
// ==== Legacy
|
// ==== Legacy
|
||||||
val isMine = data.isMine
|
val isMine = data.isMine
|
||||||
|
|
||||||
|
@ -174,16 +176,16 @@ class DeviceVerificationInfoBottomSheetController @Inject constructor(
|
||||||
id("trust${cryptoDeviceInfo.deviceId}")
|
id("trust${cryptoDeviceInfo.deviceId}")
|
||||||
style(ItemStyle.BIG_TEXT)
|
style(ItemStyle.BIG_TEXT)
|
||||||
titleIconResourceId(shield)
|
titleIconResourceId(shield)
|
||||||
title(stringProvider.getString(R.string.encryption_information_verified))
|
title(host.stringProvider.getString(R.string.encryption_information_verified))
|
||||||
description(stringProvider.getString(R.string.settings_active_sessions_verified_device_desc))
|
description(host.stringProvider.getString(R.string.settings_active_sessions_verified_device_desc))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
genericItem {
|
genericItem {
|
||||||
id("trust${cryptoDeviceInfo.deviceId}")
|
id("trust${cryptoDeviceInfo.deviceId}")
|
||||||
titleIconResourceId(shield)
|
titleIconResourceId(shield)
|
||||||
style(ItemStyle.BIG_TEXT)
|
style(ItemStyle.BIG_TEXT)
|
||||||
title(stringProvider.getString(R.string.encryption_information_not_verified))
|
title(host.stringProvider.getString(R.string.encryption_information_not_verified))
|
||||||
description(stringProvider.getString(R.string.settings_active_sessions_unverified_device_desc))
|
description(host.stringProvider.getString(R.string.settings_active_sessions_unverified_device_desc))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,29 +205,30 @@ class DeviceVerificationInfoBottomSheetController @Inject constructor(
|
||||||
}
|
}
|
||||||
bottomSheetVerificationActionItem {
|
bottomSheetVerificationActionItem {
|
||||||
id("verify${cryptoDeviceInfo.deviceId}")
|
id("verify${cryptoDeviceInfo.deviceId}")
|
||||||
title(stringProvider.getString(R.string.verification_verify_device))
|
title(host.stringProvider.getString(R.string.verification_verify_device))
|
||||||
titleColor(colorProvider.getColor(R.color.riotx_accent))
|
titleColor(host.colorProvider.getColor(R.color.riotx_accent))
|
||||||
iconRes(R.drawable.ic_arrow_right)
|
iconRes(R.drawable.ic_arrow_right)
|
||||||
iconColor(colorProvider.getColor(R.color.riotx_accent))
|
iconColor(host.colorProvider.getColor(R.color.riotx_accent))
|
||||||
listener {
|
listener {
|
||||||
callback?.onAction(DevicesAction.VerifyMyDevice(cryptoDeviceInfo.deviceId))
|
host.callback?.onAction(DevicesAction.VerifyMyDevice(cryptoDeviceInfo.deviceId))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addVerifyActions(cryptoDeviceInfo: CryptoDeviceInfo) {
|
private fun addVerifyActions(cryptoDeviceInfo: CryptoDeviceInfo) {
|
||||||
|
val host = this
|
||||||
dividerItem {
|
dividerItem {
|
||||||
id("verifyDiv")
|
id("verifyDiv")
|
||||||
}
|
}
|
||||||
bottomSheetVerificationActionItem {
|
bottomSheetVerificationActionItem {
|
||||||
id("verify_text")
|
id("verify_text")
|
||||||
title(stringProvider.getString(R.string.cross_signing_verify_by_text))
|
title(host.stringProvider.getString(R.string.cross_signing_verify_by_text))
|
||||||
titleColor(colorProvider.getColor(R.color.riotx_accent))
|
titleColor(host.colorProvider.getColor(R.color.riotx_accent))
|
||||||
iconRes(R.drawable.ic_arrow_right)
|
iconRes(R.drawable.ic_arrow_right)
|
||||||
iconColor(colorProvider.getColor(R.color.riotx_accent))
|
iconColor(host.colorProvider.getColor(R.color.riotx_accent))
|
||||||
listener {
|
listener {
|
||||||
callback?.onAction(DevicesAction.VerifyMyDeviceManually(cryptoDeviceInfo.deviceId))
|
host.callback?.onAction(DevicesAction.VerifyMyDeviceManually(cryptoDeviceInfo.deviceId))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dividerItem {
|
dividerItem {
|
||||||
|
@ -233,17 +236,18 @@ class DeviceVerificationInfoBottomSheetController @Inject constructor(
|
||||||
}
|
}
|
||||||
bottomSheetVerificationActionItem {
|
bottomSheetVerificationActionItem {
|
||||||
id("verify_emoji")
|
id("verify_emoji")
|
||||||
title(stringProvider.getString(R.string.cross_signing_verify_by_emoji))
|
title(host.stringProvider.getString(R.string.cross_signing_verify_by_emoji))
|
||||||
titleColor(colorProvider.getColor(R.color.riotx_accent))
|
titleColor(host.colorProvider.getColor(R.color.riotx_accent))
|
||||||
iconRes(R.drawable.ic_arrow_right)
|
iconRes(R.drawable.ic_arrow_right)
|
||||||
iconColor(colorProvider.getColor(R.color.riotx_accent))
|
iconColor(host.colorProvider.getColor(R.color.riotx_accent))
|
||||||
listener {
|
listener {
|
||||||
callback?.onAction(DevicesAction.VerifyMyDevice(cryptoDeviceInfo.deviceId))
|
host.callback?.onAction(DevicesAction.VerifyMyDevice(cryptoDeviceInfo.deviceId))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addGenericDeviceManageActions(data: DeviceVerificationInfoBottomSheetViewState, deviceId: String) {
|
private fun addGenericDeviceManageActions(data: DeviceVerificationInfoBottomSheetViewState, deviceId: String) {
|
||||||
|
val host = this
|
||||||
// Offer delete session if not me
|
// Offer delete session if not me
|
||||||
if (!data.isMine) {
|
if (!data.isMine) {
|
||||||
// Add the delete option
|
// Add the delete option
|
||||||
|
@ -252,12 +256,12 @@ class DeviceVerificationInfoBottomSheetController @Inject constructor(
|
||||||
}
|
}
|
||||||
bottomSheetVerificationActionItem {
|
bottomSheetVerificationActionItem {
|
||||||
id("delete")
|
id("delete")
|
||||||
title(stringProvider.getString(R.string.settings_active_sessions_signout_device))
|
title(host.stringProvider.getString(R.string.settings_active_sessions_signout_device))
|
||||||
titleColor(colorProvider.getColor(R.color.riotx_destructive_accent))
|
titleColor(host.colorProvider.getColor(R.color.riotx_destructive_accent))
|
||||||
iconRes(R.drawable.ic_arrow_right)
|
iconRes(R.drawable.ic_arrow_right)
|
||||||
iconColor(colorProvider.getColor(R.color.riotx_destructive_accent))
|
iconColor(host.colorProvider.getColor(R.color.riotx_destructive_accent))
|
||||||
listener {
|
listener {
|
||||||
callback?.onAction(DevicesAction.Delete(deviceId))
|
host.callback?.onAction(DevicesAction.Delete(deviceId))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -268,17 +272,18 @@ class DeviceVerificationInfoBottomSheetController @Inject constructor(
|
||||||
}
|
}
|
||||||
bottomSheetVerificationActionItem {
|
bottomSheetVerificationActionItem {
|
||||||
id("rename")
|
id("rename")
|
||||||
title(stringProvider.getString(R.string.rename))
|
title(host.stringProvider.getString(R.string.rename))
|
||||||
titleColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
titleColor(host.colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
||||||
iconRes(R.drawable.ic_arrow_right)
|
iconRes(R.drawable.ic_arrow_right)
|
||||||
iconColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
iconColor(host.colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
||||||
listener {
|
listener {
|
||||||
callback?.onAction(DevicesAction.PromptRename(deviceId))
|
host.callback?.onAction(DevicesAction.PromptRename(deviceId))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleNonE2EDevice(data: DeviceVerificationInfoBottomSheetViewState) {
|
private fun handleNonE2EDevice(data: DeviceVerificationInfoBottomSheetViewState) {
|
||||||
|
val host = this
|
||||||
val info = data.deviceInfo.invoke() ?: return
|
val info = data.deviceInfo.invoke() ?: return
|
||||||
genericItem {
|
genericItem {
|
||||||
id("info${info.deviceId}")
|
id("info${info.deviceId}")
|
||||||
|
@ -288,7 +293,7 @@ class DeviceVerificationInfoBottomSheetController @Inject constructor(
|
||||||
|
|
||||||
genericFooterItem {
|
genericFooterItem {
|
||||||
id("infoCrypto${info.deviceId}")
|
id("infoCrypto${info.deviceId}")
|
||||||
text(stringProvider.getString(R.string.settings_failed_to_get_crypto_device_info))
|
text(host.stringProvider.getString(R.string.settings_failed_to_get_crypto_device_info))
|
||||||
}
|
}
|
||||||
|
|
||||||
info.deviceId?.let { addGenericDeviceManageActions(data, it) }
|
info.deviceId?.let { addGenericDeviceManageActions(data, it) }
|
||||||
|
|
|
@ -61,6 +61,7 @@ class DevicesController @Inject constructor(private val errorFormatter: ErrorFor
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildDevicesModels(state: DevicesViewState) {
|
private fun buildDevicesModels(state: DevicesViewState) {
|
||||||
|
val host = this
|
||||||
when (val devices = state.devices) {
|
when (val devices = state.devices) {
|
||||||
is Loading,
|
is Loading,
|
||||||
is Uninitialized ->
|
is Uninitialized ->
|
||||||
|
@ -70,8 +71,8 @@ class DevicesController @Inject constructor(private val errorFormatter: ErrorFor
|
||||||
is Fail ->
|
is Fail ->
|
||||||
errorWithRetryItem {
|
errorWithRetryItem {
|
||||||
id("error")
|
id("error")
|
||||||
text(errorFormatter.toHumanReadable(devices.error))
|
text(host.errorFormatter.toHumanReadable(devices.error))
|
||||||
listener { callback?.retry() }
|
listener { host.callback?.retry() }
|
||||||
}
|
}
|
||||||
is Success ->
|
is Success ->
|
||||||
buildDevicesList(devices(), state.myDeviceId, !state.hasAccountCrossSigning, state.accountCrossSigningIsTrusted)
|
buildDevicesList(devices(), state.myDeviceId, !state.hasAccountCrossSigning, state.accountCrossSigningIsTrusted)
|
||||||
|
@ -82,6 +83,7 @@ class DevicesController @Inject constructor(private val errorFormatter: ErrorFor
|
||||||
myDeviceId: String,
|
myDeviceId: String,
|
||||||
legacyMode: Boolean,
|
legacyMode: Boolean,
|
||||||
currentSessionCrossTrusted: Boolean) {
|
currentSessionCrossTrusted: Boolean) {
|
||||||
|
val host = this
|
||||||
devices
|
devices
|
||||||
.firstOrNull {
|
.firstOrNull {
|
||||||
it.deviceInfo.deviceId == myDeviceId
|
it.deviceInfo.deviceId == myDeviceId
|
||||||
|
@ -90,21 +92,21 @@ class DevicesController @Inject constructor(private val errorFormatter: ErrorFor
|
||||||
// Current device
|
// Current device
|
||||||
genericItemHeader {
|
genericItemHeader {
|
||||||
id("current")
|
id("current")
|
||||||
text(stringProvider.getString(R.string.devices_current_device))
|
text(host.stringProvider.getString(R.string.devices_current_device))
|
||||||
}
|
}
|
||||||
|
|
||||||
deviceItem {
|
deviceItem {
|
||||||
id("myDevice${deviceInfo.deviceId}")
|
id("myDevice${deviceInfo.deviceId}")
|
||||||
legacyMode(legacyMode)
|
legacyMode(legacyMode)
|
||||||
trustedSession(currentSessionCrossTrusted)
|
trustedSession(currentSessionCrossTrusted)
|
||||||
dimensionConverter(dimensionConverter)
|
dimensionConverter(host.dimensionConverter)
|
||||||
colorProvider(colorProvider)
|
colorProvider(host.colorProvider)
|
||||||
detailedMode(vectorPreferences.developerMode())
|
detailedMode(host.vectorPreferences.developerMode())
|
||||||
deviceInfo(deviceInfo)
|
deviceInfo(deviceInfo)
|
||||||
currentDevice(true)
|
currentDevice(true)
|
||||||
e2eCapable(true)
|
e2eCapable(true)
|
||||||
lastSeenFormatted(dateFormatter.format(deviceInfo.lastSeenTs, DateFormatKind.DEFAULT_DATE_AND_TIME))
|
lastSeenFormatted(host.dateFormatter.format(deviceInfo.lastSeenTs, DateFormatKind.DEFAULT_DATE_AND_TIME))
|
||||||
itemClickAction { callback?.onDeviceClicked(deviceInfo) }
|
itemClickAction { host.callback?.onDeviceClicked(deviceInfo) }
|
||||||
trusted(DeviceTrustLevel(currentSessionCrossTrusted, true))
|
trusted(DeviceTrustLevel(currentSessionCrossTrusted, true))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +128,7 @@ class DevicesController @Inject constructor(private val errorFormatter: ErrorFor
|
||||||
if (devices.size > 1) {
|
if (devices.size > 1) {
|
||||||
genericItemHeader {
|
genericItemHeader {
|
||||||
id("others")
|
id("others")
|
||||||
text(stringProvider.getString(R.string.devices_other_devices))
|
text(host.stringProvider.getString(R.string.devices_other_devices))
|
||||||
}
|
}
|
||||||
|
|
||||||
devices
|
devices
|
||||||
|
@ -140,12 +142,12 @@ class DevicesController @Inject constructor(private val errorFormatter: ErrorFor
|
||||||
id("device$idx")
|
id("device$idx")
|
||||||
legacyMode(legacyMode)
|
legacyMode(legacyMode)
|
||||||
trustedSession(currentSessionCrossTrusted)
|
trustedSession(currentSessionCrossTrusted)
|
||||||
dimensionConverter(dimensionConverter)
|
dimensionConverter(host.dimensionConverter)
|
||||||
colorProvider(colorProvider)
|
colorProvider(host.colorProvider)
|
||||||
detailedMode(vectorPreferences.developerMode())
|
detailedMode(host.vectorPreferences.developerMode())
|
||||||
deviceInfo(deviceInfo)
|
deviceInfo(deviceInfo)
|
||||||
currentDevice(false)
|
currentDevice(false)
|
||||||
itemClickAction { callback?.onDeviceClicked(deviceInfo) }
|
itemClickAction { host.callback?.onDeviceClicked(deviceInfo) }
|
||||||
e2eCapable(cryptoInfo != null)
|
e2eCapable(cryptoInfo != null)
|
||||||
trusted(cryptoInfo?.trustLevel)
|
trusted(cryptoInfo?.trustLevel)
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,11 +43,12 @@ class AccountDataEpoxyController @Inject constructor(
|
||||||
|
|
||||||
override fun buildModels(data: AccountDataViewState?) {
|
override fun buildModels(data: AccountDataViewState?) {
|
||||||
if (data == null) return
|
if (data == null) return
|
||||||
|
val host = this
|
||||||
when (data.accountData) {
|
when (data.accountData) {
|
||||||
is Loading -> {
|
is Loading -> {
|
||||||
loadingItem {
|
loadingItem {
|
||||||
id("loading")
|
id("loading")
|
||||||
loadingText(stringProvider.getString(R.string.loading))
|
loadingText(host.stringProvider.getString(R.string.loading))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
|
@ -61,7 +62,7 @@ class AccountDataEpoxyController @Inject constructor(
|
||||||
if (dataList.isEmpty()) {
|
if (dataList.isEmpty()) {
|
||||||
genericFooterItem {
|
genericFooterItem {
|
||||||
id("noResults")
|
id("noResults")
|
||||||
text(stringProvider.getString(R.string.no_result_placeholder))
|
text(host.stringProvider.getString(R.string.no_result_placeholder))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dataList.forEach { accountData ->
|
dataList.forEach { accountData ->
|
||||||
|
@ -69,10 +70,10 @@ class AccountDataEpoxyController @Inject constructor(
|
||||||
id(accountData.type)
|
id(accountData.type)
|
||||||
title(accountData.type)
|
title(accountData.type)
|
||||||
itemClickAction(DebouncedClickListener({
|
itemClickAction(DebouncedClickListener({
|
||||||
interactionListener?.didTap(accountData)
|
host.interactionListener?.didTap(accountData)
|
||||||
}))
|
}))
|
||||||
itemLongClickAction(View.OnLongClickListener {
|
itemLongClickAction(View.OnLongClickListener {
|
||||||
interactionListener?.didLongTap(accountData)
|
host.interactionListener?.didLongTap(accountData)
|
||||||
true
|
true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,10 +54,11 @@ class GossipingTrailPagedEpoxyController @Inject constructor(
|
||||||
var interactionListener: InteractionListener? = null
|
var interactionListener: InteractionListener? = null
|
||||||
|
|
||||||
override fun buildItemModel(currentPosition: Int, item: Event?): EpoxyModel<*> {
|
override fun buildItemModel(currentPosition: Int, item: Event?): EpoxyModel<*> {
|
||||||
|
val host = this
|
||||||
val event = item ?: return GenericItem_().apply { id(currentPosition) }
|
val event = item ?: return GenericItem_().apply { id(currentPosition) }
|
||||||
return GenericItem_().apply {
|
return GenericItem_().apply {
|
||||||
id(event.hashCode())
|
id(event.hashCode())
|
||||||
itemClickAction(GenericItem.Action("view").apply { perform = Runnable { interactionListener?.didTap(event) } })
|
itemClickAction(GenericItem.Action("view").apply { perform = Runnable { host.interactionListener?.didTap(event) } })
|
||||||
title(
|
title(
|
||||||
if (event.isEncrypted()) {
|
if (event.isEncrypted()) {
|
||||||
"${event.getClearType()} [encrypted]"
|
"${event.getClearType()} [encrypted]"
|
||||||
|
@ -67,7 +68,7 @@ class GossipingTrailPagedEpoxyController @Inject constructor(
|
||||||
)
|
)
|
||||||
description(
|
description(
|
||||||
span {
|
span {
|
||||||
+vectorDateFormatter.format(event.ageLocalTs, DateFormatKind.DEFAULT_DATE_AND_TIME)
|
+host.vectorDateFormatter.format(event.ageLocalTs, DateFormatKind.DEFAULT_DATE_AND_TIME)
|
||||||
span("\nfrom: ") {
|
span("\nfrom: ") {
|
||||||
textStyle = "bold"
|
textStyle = "bold"
|
||||||
}
|
}
|
||||||
|
@ -98,7 +99,7 @@ class GossipingTrailPagedEpoxyController @Inject constructor(
|
||||||
val content = event.getClearContent().toModel<ForwardedRoomKeyContent>()
|
val content = event.getClearContent().toModel<ForwardedRoomKeyContent>()
|
||||||
if (event.mxDecryptionResult == null) {
|
if (event.mxDecryptionResult == null) {
|
||||||
span("**Failed to Decrypt** ${event.mCryptoError}") {
|
span("**Failed to Decrypt** ${event.mCryptoError}") {
|
||||||
textColor = colorProvider.getColor(R.color.vector_error_color)
|
textColor = host.colorProvider.getColor(R.color.vector_error_color)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
span("\nsessionId:") {
|
span("\nsessionId:") {
|
||||||
|
@ -157,7 +158,7 @@ class GossipingTrailPagedEpoxyController @Inject constructor(
|
||||||
+"${content?.requestingDeviceId}"
|
+"${content?.requestingDeviceId}"
|
||||||
} else if (event.getClearType() == EventType.ENCRYPTED) {
|
} else if (event.getClearType() == EventType.ENCRYPTED) {
|
||||||
span("**Failed to Decrypt** ${event.mCryptoError}") {
|
span("**Failed to Decrypt** ${event.mCryptoError}") {
|
||||||
textColor = colorProvider.getColor(R.color.vector_error_color)
|
textColor = host.colorProvider.getColor(R.color.vector_error_color)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ class IncomingKeyRequestPagedController @Inject constructor(
|
||||||
var interactionListener: InteractionListener? = null
|
var interactionListener: InteractionListener? = null
|
||||||
|
|
||||||
override fun buildItemModel(currentPosition: Int, item: IncomingRoomKeyRequest?): EpoxyModel<*> {
|
override fun buildItemModel(currentPosition: Int, item: IncomingRoomKeyRequest?): EpoxyModel<*> {
|
||||||
|
val host = this
|
||||||
val roomKeyRequest = item ?: return GenericItem_().apply { id(currentPosition) }
|
val roomKeyRequest = item ?: return GenericItem_().apply { id(currentPosition) }
|
||||||
|
|
||||||
return GenericItem_().apply {
|
return GenericItem_().apply {
|
||||||
|
@ -51,7 +52,7 @@ class IncomingKeyRequestPagedController @Inject constructor(
|
||||||
textStyle = "bold"
|
textStyle = "bold"
|
||||||
}
|
}
|
||||||
span("${roomKeyRequest.userId}")
|
span("${roomKeyRequest.userId}")
|
||||||
+vectorDateFormatter.format(roomKeyRequest.localCreationTimestamp, DateFormatKind.DEFAULT_DATE_AND_TIME)
|
+host.vectorDateFormatter.format(roomKeyRequest.localCreationTimestamp, DateFormatKind.DEFAULT_DATE_AND_TIME)
|
||||||
span("\nsessionId:") {
|
span("\nsessionId:") {
|
||||||
textStyle = "bold"
|
textStyle = "bold"
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ class HomeserverSettingsController @Inject constructor(
|
||||||
|
|
||||||
override fun buildModels(data: HomeServerSettingsViewState?) {
|
override fun buildModels(data: HomeServerSettingsViewState?) {
|
||||||
data ?: return
|
data ?: return
|
||||||
|
val host = this
|
||||||
|
|
||||||
buildHeader(data)
|
buildHeader(data)
|
||||||
buildCapabilities(data)
|
buildCapabilities(data)
|
||||||
|
@ -58,8 +59,8 @@ class HomeserverSettingsController @Inject constructor(
|
||||||
is Fail ->
|
is Fail ->
|
||||||
errorWithRetryItem {
|
errorWithRetryItem {
|
||||||
id("error")
|
id("error")
|
||||||
text(errorFormatter.toHumanReadable(federationVersion.error))
|
text(host.errorFormatter.toHumanReadable(federationVersion.error))
|
||||||
listener { callback?.retry() }
|
listener { host.callback?.retry() }
|
||||||
}
|
}
|
||||||
is Success ->
|
is Success ->
|
||||||
buildFederationVersion(federationVersion())
|
buildFederationVersion(federationVersion())
|
||||||
|
@ -101,6 +102,7 @@ class HomeserverSettingsController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildCapabilities(data: HomeServerSettingsViewState) {
|
private fun buildCapabilities(data: HomeServerSettingsViewState) {
|
||||||
|
val host = this
|
||||||
settingsSectionTitleItem {
|
settingsSectionTitleItem {
|
||||||
id("uploadTitle")
|
id("uploadTitle")
|
||||||
titleResId(R.string.settings_server_upload_size_title)
|
titleResId(R.string.settings_server_upload_size_title)
|
||||||
|
@ -113,7 +115,7 @@ class HomeserverSettingsController @Inject constructor(
|
||||||
if (limit == HomeServerCapabilities.MAX_UPLOAD_FILE_SIZE_UNKNOWN) {
|
if (limit == HomeServerCapabilities.MAX_UPLOAD_FILE_SIZE_UNKNOWN) {
|
||||||
helperTextResId(R.string.settings_server_upload_size_unknown)
|
helperTextResId(R.string.settings_server_upload_size_unknown)
|
||||||
} else {
|
} else {
|
||||||
helperText(stringProvider.getString(R.string.settings_server_upload_size_content, "${limit / 1048576L} MB"))
|
helperText(host.stringProvider.getString(R.string.settings_server_upload_size_content, "${limit / 1048576L} MB"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,18 +46,19 @@ class IgnoredUsersController @Inject constructor(private val stringProvider: Str
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildIgnoredUserModels(users: List<User>) {
|
private fun buildIgnoredUserModels(users: List<User>) {
|
||||||
|
val host = this
|
||||||
if (users.isEmpty()) {
|
if (users.isEmpty()) {
|
||||||
noResultItem {
|
noResultItem {
|
||||||
id("empty")
|
id("empty")
|
||||||
text(stringProvider.getString(R.string.no_ignored_users))
|
text(host.stringProvider.getString(R.string.no_ignored_users))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
users.forEach { user ->
|
users.forEach { user ->
|
||||||
userItem {
|
userItem {
|
||||||
id(user.userId)
|
id(user.userId)
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
matrixItem(user.toMatrixItem())
|
matrixItem(user.toMatrixItem())
|
||||||
itemClickAction { callback?.onUserIdClicked(user.userId) }
|
itemClickAction { host.callback?.onUserIdClicked(user.userId) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,35 +40,36 @@ class LocalePickerController @Inject constructor(
|
||||||
@ExperimentalStdlibApi
|
@ExperimentalStdlibApi
|
||||||
override fun buildModels(data: LocalePickerViewState?) {
|
override fun buildModels(data: LocalePickerViewState?) {
|
||||||
val list = data?.locales ?: return
|
val list = data?.locales ?: return
|
||||||
|
val host = this
|
||||||
|
|
||||||
profileSectionItem {
|
profileSectionItem {
|
||||||
id("currentTitle")
|
id("currentTitle")
|
||||||
title(stringProvider.getString(R.string.choose_locale_current_locale_title))
|
title(host.stringProvider.getString(R.string.choose_locale_current_locale_title))
|
||||||
}
|
}
|
||||||
localeItem {
|
localeItem {
|
||||||
id(data.currentLocale.toString())
|
id(data.currentLocale.toString())
|
||||||
title(VectorLocale.localeToLocalisedString(data.currentLocale).safeCapitalize(data.currentLocale))
|
title(VectorLocale.localeToLocalisedString(data.currentLocale).safeCapitalize(data.currentLocale))
|
||||||
if (vectorPreferences.developerMode()) {
|
if (host.vectorPreferences.developerMode()) {
|
||||||
subtitle(VectorLocale.localeToLocalisedStringInfo(data.currentLocale))
|
subtitle(VectorLocale.localeToLocalisedStringInfo(data.currentLocale))
|
||||||
}
|
}
|
||||||
clickListener { listener?.onUseCurrentClicked() }
|
clickListener { host.listener?.onUseCurrentClicked() }
|
||||||
}
|
}
|
||||||
profileSectionItem {
|
profileSectionItem {
|
||||||
id("otherTitle")
|
id("otherTitle")
|
||||||
title(stringProvider.getString(R.string.choose_locale_other_locales_title))
|
title(host.stringProvider.getString(R.string.choose_locale_other_locales_title))
|
||||||
}
|
}
|
||||||
when (list) {
|
when (list) {
|
||||||
is Incomplete -> {
|
is Incomplete -> {
|
||||||
loadingItem {
|
loadingItem {
|
||||||
id("loading")
|
id("loading")
|
||||||
loadingText(stringProvider.getString(R.string.choose_locale_loading_locales))
|
loadingText(host.stringProvider.getString(R.string.choose_locale_loading_locales))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Success ->
|
is Success ->
|
||||||
if (list().isEmpty()) {
|
if (list().isEmpty()) {
|
||||||
noResultItem {
|
noResultItem {
|
||||||
id("noResult")
|
id("noResult")
|
||||||
text(stringProvider.getString(R.string.no_result_placeholder))
|
text(host.stringProvider.getString(R.string.no_result_placeholder))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
list()
|
list()
|
||||||
|
@ -77,10 +78,10 @@ class LocalePickerController @Inject constructor(
|
||||||
localeItem {
|
localeItem {
|
||||||
id(it.toString())
|
id(it.toString())
|
||||||
title(VectorLocale.localeToLocalisedString(it).safeCapitalize(it))
|
title(VectorLocale.localeToLocalisedString(it).safeCapitalize(it))
|
||||||
if (vectorPreferences.developerMode()) {
|
if (host.vectorPreferences.developerMode()) {
|
||||||
subtitle(VectorLocale.localeToLocalisedStringInfo(it))
|
subtitle(VectorLocale.localeToLocalisedStringInfo(it))
|
||||||
}
|
}
|
||||||
clickListener { listener?.onLocaleClicked(it) }
|
clickListener { host.listener?.onLocaleClicked(it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,11 +27,12 @@ class PushGateWayController @Inject constructor(
|
||||||
) : TypedEpoxyController<PushGatewayViewState>() {
|
) : TypedEpoxyController<PushGatewayViewState>() {
|
||||||
|
|
||||||
override fun buildModels(data: PushGatewayViewState?) {
|
override fun buildModels(data: PushGatewayViewState?) {
|
||||||
|
val host = this
|
||||||
data?.pushGateways?.invoke()?.let { pushers ->
|
data?.pushGateways?.invoke()?.let { pushers ->
|
||||||
if (pushers.isEmpty()) {
|
if (pushers.isEmpty()) {
|
||||||
genericFooterItem {
|
genericFooterItem {
|
||||||
id("footer")
|
id("footer")
|
||||||
text(stringProvider.getString(R.string.settings_push_gateway_no_pushers))
|
text(host.stringProvider.getString(R.string.settings_push_gateway_no_pushers))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pushers.forEach {
|
pushers.forEach {
|
||||||
|
@ -44,7 +45,7 @@ class PushGateWayController @Inject constructor(
|
||||||
} ?: run {
|
} ?: run {
|
||||||
genericFooterItem {
|
genericFooterItem {
|
||||||
id("loading")
|
id("loading")
|
||||||
text(stringProvider.getString(R.string.loading))
|
text(host.stringProvider.getString(R.string.loading))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ class PushRulesController @Inject constructor(
|
||||||
) : TypedEpoxyController<PushRulesViewState>() {
|
) : TypedEpoxyController<PushRulesViewState>() {
|
||||||
|
|
||||||
override fun buildModels(data: PushRulesViewState?) {
|
override fun buildModels(data: PushRulesViewState?) {
|
||||||
|
val host = this
|
||||||
data?.let {
|
data?.let {
|
||||||
it.rules.forEach {
|
it.rules.forEach {
|
||||||
pushRuleItem {
|
pushRuleItem {
|
||||||
|
@ -37,7 +38,7 @@ class PushRulesController @Inject constructor(
|
||||||
} ?: run {
|
} ?: run {
|
||||||
genericFooterItem {
|
genericFooterItem {
|
||||||
id("footer")
|
id("footer")
|
||||||
text(stringProvider.getString(R.string.settings_push_rules_no_rules))
|
text(host.stringProvider.getString(R.string.settings_push_rules_no_rules))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,7 @@ class ThreePidsSettingsController @Inject constructor(
|
||||||
|
|
||||||
override fun buildModels(data: ThreePidsSettingsViewState?) {
|
override fun buildModels(data: ThreePidsSettingsViewState?) {
|
||||||
if (data == null) return
|
if (data == null) return
|
||||||
|
val host = this
|
||||||
|
|
||||||
if (data.uiState is ThreePidsSettingsUiState.Idle) {
|
if (data.uiState is ThreePidsSettingsUiState.Idle) {
|
||||||
currentInputValue = ""
|
currentInputValue = ""
|
||||||
|
@ -80,7 +81,7 @@ class ThreePidsSettingsController @Inject constructor(
|
||||||
is Loading -> {
|
is Loading -> {
|
||||||
loadingItem {
|
loadingItem {
|
||||||
id("loading")
|
id("loading")
|
||||||
loadingText(stringProvider.getString(R.string.loading))
|
loadingText(host.stringProvider.getString(R.string.loading))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
|
@ -97,13 +98,14 @@ class ThreePidsSettingsController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildThreePids(list: List<ThreePid>, data: ThreePidsSettingsViewState) {
|
private fun buildThreePids(list: List<ThreePid>, data: ThreePidsSettingsViewState) {
|
||||||
|
val host = this
|
||||||
val splited = list.groupBy { it is ThreePid.Email }
|
val splited = list.groupBy { it is ThreePid.Email }
|
||||||
val emails = splited[true].orEmpty()
|
val emails = splited[true].orEmpty()
|
||||||
val msisdn = splited[false].orEmpty()
|
val msisdn = splited[false].orEmpty()
|
||||||
|
|
||||||
settingsSectionTitleItem {
|
settingsSectionTitleItem {
|
||||||
id("email")
|
id("email")
|
||||||
title(stringProvider.getString(R.string.settings_emails))
|
title(host.stringProvider.getString(R.string.settings_emails))
|
||||||
}
|
}
|
||||||
|
|
||||||
emails.forEach { buildThreePid("email ", it) }
|
emails.forEach { buildThreePid("email ", it) }
|
||||||
|
@ -116,7 +118,7 @@ class ThreePidsSettingsController @Inject constructor(
|
||||||
if (pendingList.isEmpty() && emails.isEmpty()) {
|
if (pendingList.isEmpty() && emails.isEmpty()) {
|
||||||
noResultItem {
|
noResultItem {
|
||||||
id("noEmail")
|
id("noEmail")
|
||||||
text(stringProvider.getString(R.string.settings_emails_empty))
|
text(host.stringProvider.getString(R.string.settings_emails_empty))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,15 +129,15 @@ class ThreePidsSettingsController @Inject constructor(
|
||||||
ThreePidsSettingsUiState.Idle ->
|
ThreePidsSettingsUiState.Idle ->
|
||||||
genericButtonItem {
|
genericButtonItem {
|
||||||
id("addEmail")
|
id("addEmail")
|
||||||
text(stringProvider.getString(R.string.settings_add_email_address))
|
text(host.stringProvider.getString(R.string.settings_add_email_address))
|
||||||
textColor(colorProvider.getColor(R.color.riotx_accent))
|
textColor(host.colorProvider.getColor(R.color.riotx_accent))
|
||||||
buttonClickAction(View.OnClickListener { interactionListener?.addEmail() })
|
buttonClickAction(View.OnClickListener { host.interactionListener?.addEmail() })
|
||||||
}
|
}
|
||||||
is ThreePidsSettingsUiState.AddingEmail -> {
|
is ThreePidsSettingsUiState.AddingEmail -> {
|
||||||
settingsEditTextItem {
|
settingsEditTextItem {
|
||||||
id("addingEmail")
|
id("addingEmail")
|
||||||
inputType(InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS)
|
inputType(InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS)
|
||||||
hint(stringProvider.getString(R.string.medium_email))
|
hint(host.stringProvider.getString(R.string.medium_email))
|
||||||
if (data.editTextReinitiator.isTrue()) {
|
if (data.editTextReinitiator.isTrue()) {
|
||||||
value("")
|
value("")
|
||||||
requestFocus(true)
|
requestFocus(true)
|
||||||
|
@ -143,18 +145,18 @@ class ThreePidsSettingsController @Inject constructor(
|
||||||
errorText(data.uiState.error)
|
errorText(data.uiState.error)
|
||||||
interactionListener(object : SettingsEditTextItem.Listener {
|
interactionListener(object : SettingsEditTextItem.Listener {
|
||||||
override fun onValidate() {
|
override fun onValidate() {
|
||||||
interactionListener?.doAddEmail(currentInputValue)
|
host.interactionListener?.doAddEmail(host.currentInputValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onTextChange(text: String) {
|
override fun onTextChange(text: String) {
|
||||||
currentInputValue = text
|
host.currentInputValue = text
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
settingsContinueCancelItem {
|
settingsContinueCancelItem {
|
||||||
id("contAddingEmail")
|
id("contAddingEmail")
|
||||||
continueOnClick { interactionListener?.doAddEmail(currentInputValue) }
|
continueOnClick { host.interactionListener?.doAddEmail(host.currentInputValue) }
|
||||||
cancelOnClick { interactionListener?.cancelAdding() }
|
cancelOnClick { host.interactionListener?.cancelAdding() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is ThreePidsSettingsUiState.AddingPhoneNumber -> Unit
|
is ThreePidsSettingsUiState.AddingPhoneNumber -> Unit
|
||||||
|
@ -162,7 +164,7 @@ class ThreePidsSettingsController @Inject constructor(
|
||||||
|
|
||||||
settingsSectionTitleItem {
|
settingsSectionTitleItem {
|
||||||
id("msisdn")
|
id("msisdn")
|
||||||
title(stringProvider.getString(R.string.settings_phone_numbers))
|
title(host.stringProvider.getString(R.string.settings_phone_numbers))
|
||||||
}
|
}
|
||||||
|
|
||||||
msisdn.forEach { buildThreePid("msisdn ", it) }
|
msisdn.forEach { buildThreePid("msisdn ", it) }
|
||||||
|
@ -175,7 +177,7 @@ class ThreePidsSettingsController @Inject constructor(
|
||||||
if (pendingList.isEmpty() && msisdn.isEmpty()) {
|
if (pendingList.isEmpty() && msisdn.isEmpty()) {
|
||||||
noResultItem {
|
noResultItem {
|
||||||
id("noMsisdn")
|
id("noMsisdn")
|
||||||
text(stringProvider.getString(R.string.settings_phone_number_empty))
|
text(host.stringProvider.getString(R.string.settings_phone_number_empty))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,20 +188,20 @@ class ThreePidsSettingsController @Inject constructor(
|
||||||
ThreePidsSettingsUiState.Idle ->
|
ThreePidsSettingsUiState.Idle ->
|
||||||
genericButtonItem {
|
genericButtonItem {
|
||||||
id("addMsisdn")
|
id("addMsisdn")
|
||||||
text(stringProvider.getString(R.string.settings_add_phone_number))
|
text(host.stringProvider.getString(R.string.settings_add_phone_number))
|
||||||
textColor(colorProvider.getColor(R.color.riotx_accent))
|
textColor(host.colorProvider.getColor(R.color.riotx_accent))
|
||||||
buttonClickAction(View.OnClickListener { interactionListener?.addMsisdn() })
|
buttonClickAction(View.OnClickListener { host.interactionListener?.addMsisdn() })
|
||||||
}
|
}
|
||||||
is ThreePidsSettingsUiState.AddingEmail -> Unit
|
is ThreePidsSettingsUiState.AddingEmail -> Unit
|
||||||
is ThreePidsSettingsUiState.AddingPhoneNumber -> {
|
is ThreePidsSettingsUiState.AddingPhoneNumber -> {
|
||||||
settingsInfoItem {
|
settingsInfoItem {
|
||||||
id("addingMsisdnInfo")
|
id("addingMsisdnInfo")
|
||||||
helperText(stringProvider.getString(R.string.login_msisdn_notice))
|
helperText(host.stringProvider.getString(R.string.login_msisdn_notice))
|
||||||
}
|
}
|
||||||
settingsEditTextItem {
|
settingsEditTextItem {
|
||||||
id("addingMsisdn")
|
id("addingMsisdn")
|
||||||
inputType(InputType.TYPE_CLASS_PHONE)
|
inputType(InputType.TYPE_CLASS_PHONE)
|
||||||
hint(stringProvider.getString(R.string.medium_phone_number))
|
hint(host.stringProvider.getString(R.string.medium_phone_number))
|
||||||
if (data.editTextReinitiator.isTrue()) {
|
if (data.editTextReinitiator.isTrue()) {
|
||||||
value("")
|
value("")
|
||||||
requestFocus(true)
|
requestFocus(true)
|
||||||
|
@ -207,34 +209,36 @@ class ThreePidsSettingsController @Inject constructor(
|
||||||
errorText(data.uiState.error)
|
errorText(data.uiState.error)
|
||||||
interactionListener(object : SettingsEditTextItem.Listener {
|
interactionListener(object : SettingsEditTextItem.Listener {
|
||||||
override fun onValidate() {
|
override fun onValidate() {
|
||||||
interactionListener?.doAddMsisdn(currentInputValue)
|
host.interactionListener?.doAddMsisdn(host.currentInputValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onTextChange(text: String) {
|
override fun onTextChange(text: String) {
|
||||||
currentInputValue = text
|
host.currentInputValue = text
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
settingsContinueCancelItem {
|
settingsContinueCancelItem {
|
||||||
id("contAddingMsisdn")
|
id("contAddingMsisdn")
|
||||||
continueOnClick { interactionListener?.doAddMsisdn(currentInputValue) }
|
continueOnClick { host.interactionListener?.doAddMsisdn(host.currentInputValue) }
|
||||||
cancelOnClick { interactionListener?.cancelAdding() }
|
cancelOnClick { host.interactionListener?.cancelAdding() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.exhaustive
|
}.exhaustive
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildThreePid(idPrefix: String, threePid: ThreePid) {
|
private fun buildThreePid(idPrefix: String, threePid: ThreePid) {
|
||||||
|
val host = this
|
||||||
threePidItem {
|
threePidItem {
|
||||||
id(idPrefix + threePid.value)
|
id(idPrefix + threePid.value)
|
||||||
// TODO Add an icon for emails
|
// TODO Add an icon for emails
|
||||||
// iconResId(if (threePid is ThreePid.Msisdn) R.drawable.ic_phone else null)
|
// iconResId(if (threePid is ThreePid.Msisdn) R.drawable.ic_phone else null)
|
||||||
title(threePid.getFormattedValue())
|
title(threePid.getFormattedValue())
|
||||||
deleteClickListener { interactionListener?.deleteThreePid(threePid) }
|
deleteClickListener { host.interactionListener?.deleteThreePid(threePid) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildPendingThreePid(data: ThreePidsSettingsViewState, idPrefix: String, threePid: ThreePid) {
|
private fun buildPendingThreePid(data: ThreePidsSettingsViewState, idPrefix: String, threePid: ThreePid) {
|
||||||
|
val host = this
|
||||||
threePidItem {
|
threePidItem {
|
||||||
id(idPrefix + threePid.value)
|
id(idPrefix + threePid.value)
|
||||||
// TODO Add an icon for emails
|
// TODO Add an icon for emails
|
||||||
|
@ -246,43 +250,43 @@ class ThreePidsSettingsController @Inject constructor(
|
||||||
is ThreePid.Email -> {
|
is ThreePid.Email -> {
|
||||||
settingsInformationItem {
|
settingsInformationItem {
|
||||||
id("info" + idPrefix + threePid.value)
|
id("info" + idPrefix + threePid.value)
|
||||||
message(stringProvider.getString(R.string.account_email_validation_message))
|
message(host.stringProvider.getString(R.string.account_email_validation_message))
|
||||||
colorProvider(colorProvider)
|
colorProvider(host.colorProvider)
|
||||||
}
|
}
|
||||||
settingsContinueCancelItem {
|
settingsContinueCancelItem {
|
||||||
id("cont" + idPrefix + threePid.value)
|
id("cont" + idPrefix + threePid.value)
|
||||||
continueOnClick { interactionListener?.continueThreePid(threePid) }
|
continueOnClick { host.interactionListener?.continueThreePid(threePid) }
|
||||||
cancelOnClick { interactionListener?.cancelThreePid(threePid) }
|
cancelOnClick { host.interactionListener?.cancelThreePid(threePid) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is ThreePid.Msisdn -> {
|
is ThreePid.Msisdn -> {
|
||||||
settingsInformationItem {
|
settingsInformationItem {
|
||||||
id("info" + idPrefix + threePid.value)
|
id("info" + idPrefix + threePid.value)
|
||||||
message(stringProvider.getString(R.string.settings_text_message_sent, threePid.getFormattedValue()))
|
message(host.stringProvider.getString(R.string.settings_text_message_sent, threePid.getFormattedValue()))
|
||||||
colorProvider(colorProvider)
|
colorProvider(host.colorProvider)
|
||||||
}
|
}
|
||||||
settingsEditTextItem {
|
settingsEditTextItem {
|
||||||
id("msisdnVerification${threePid.value}")
|
id("msisdnVerification${threePid.value}")
|
||||||
inputType(InputType.TYPE_CLASS_NUMBER)
|
inputType(InputType.TYPE_CLASS_NUMBER)
|
||||||
hint(stringProvider.getString(R.string.settings_text_message_sent_hint))
|
hint(host.stringProvider.getString(R.string.settings_text_message_sent_hint))
|
||||||
if (data.msisdnValidationReinitiator[threePid]?.isTrue() == true) {
|
if (data.msisdnValidationReinitiator[threePid]?.isTrue() == true) {
|
||||||
value("")
|
value("")
|
||||||
}
|
}
|
||||||
errorText(getCodeError(data, threePid))
|
errorText(host.getCodeError(data, threePid))
|
||||||
interactionListener(object : SettingsEditTextItem.Listener {
|
interactionListener(object : SettingsEditTextItem.Listener {
|
||||||
override fun onValidate() {
|
override fun onValidate() {
|
||||||
interactionListener?.submitCode(threePid, currentCodes[threePid] ?: "")
|
host.interactionListener?.submitCode(threePid, host.currentCodes[threePid] ?: "")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onTextChange(text: String) {
|
override fun onTextChange(text: String) {
|
||||||
currentCodes[threePid] = text
|
host.currentCodes[threePid] = text
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
settingsContinueCancelItem {
|
settingsContinueCancelItem {
|
||||||
id("cont" + idPrefix + threePid.value)
|
id("cont" + idPrefix + threePid.value)
|
||||||
continueOnClick { interactionListener?.submitCode(threePid, currentCodes[threePid] ?: "") }
|
continueOnClick { host.interactionListener?.submitCode(threePid, host.currentCodes[threePid] ?: "") }
|
||||||
cancelOnClick { interactionListener?.cancelThreePid(threePid) }
|
cancelOnClick { host.interactionListener?.cancelThreePid(threePid) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ class IncomingShareController @Inject constructor(private val roomSummaryItemFac
|
||||||
var callback: Callback? = null
|
var callback: Callback? = null
|
||||||
|
|
||||||
override fun buildModels(data: IncomingShareViewState) {
|
override fun buildModels(data: IncomingShareViewState) {
|
||||||
|
val host = this
|
||||||
if (data.sharedData == null || data.filteredRoomSummaries is Incomplete) {
|
if (data.sharedData == null || data.filteredRoomSummaries is Incomplete) {
|
||||||
loadingItem {
|
loadingItem {
|
||||||
id("loading")
|
id("loading")
|
||||||
|
@ -47,7 +48,7 @@ class IncomingShareController @Inject constructor(private val roomSummaryItemFac
|
||||||
if (roomSummaries.isNullOrEmpty()) {
|
if (roomSummaries.isNullOrEmpty()) {
|
||||||
noResultItem {
|
noResultItem {
|
||||||
id("no_result")
|
id("no_result")
|
||||||
text(stringProvider.getString(R.string.no_result_placeholder))
|
text(host.stringProvider.getString(R.string.no_result_placeholder))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
roomSummaries.forEach { roomSummary ->
|
roomSummaries.forEach { roomSummary ->
|
||||||
|
|
|
@ -65,20 +65,21 @@ class SoftLogoutController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildHeader(state: SoftLogoutViewState) {
|
private fun buildHeader(state: SoftLogoutViewState) {
|
||||||
|
val host = this
|
||||||
loginHeaderItem {
|
loginHeaderItem {
|
||||||
id("header")
|
id("header")
|
||||||
}
|
}
|
||||||
loginTitleItem {
|
loginTitleItem {
|
||||||
id("title")
|
id("title")
|
||||||
text(stringProvider.getString(R.string.soft_logout_title))
|
text(host.stringProvider.getString(R.string.soft_logout_title))
|
||||||
}
|
}
|
||||||
loginTitleSmallItem {
|
loginTitleSmallItem {
|
||||||
id("signTitle")
|
id("signTitle")
|
||||||
text(stringProvider.getString(R.string.soft_logout_signin_title))
|
text(host.stringProvider.getString(R.string.soft_logout_signin_title))
|
||||||
}
|
}
|
||||||
loginTextItem {
|
loginTextItem {
|
||||||
id("signText1")
|
id("signText1")
|
||||||
text(stringProvider.getString(R.string.soft_logout_signin_notice,
|
text(host.stringProvider.getString(R.string.soft_logout_signin_notice,
|
||||||
state.homeServerUrl.toReducedUrl(),
|
state.homeServerUrl.toReducedUrl(),
|
||||||
state.userDisplayName,
|
state.userDisplayName,
|
||||||
state.userId))
|
state.userId))
|
||||||
|
@ -86,12 +87,13 @@ class SoftLogoutController @Inject constructor(
|
||||||
if (state.hasUnsavedKeys) {
|
if (state.hasUnsavedKeys) {
|
||||||
loginTextItem {
|
loginTextItem {
|
||||||
id("signText2")
|
id("signText2")
|
||||||
text(stringProvider.getString(R.string.soft_logout_signin_e2e_warning_notice))
|
text(host.stringProvider.getString(R.string.soft_logout_signin_e2e_warning_notice))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildForm(state: SoftLogoutViewState) {
|
private fun buildForm(state: SoftLogoutViewState) {
|
||||||
|
val host = this
|
||||||
when (state.asyncHomeServerLoginFlowRequest) {
|
when (state.asyncHomeServerLoginFlowRequest) {
|
||||||
is Incomplete -> {
|
is Incomplete -> {
|
||||||
loadingItem {
|
loadingItem {
|
||||||
|
@ -101,8 +103,8 @@ class SoftLogoutController @Inject constructor(
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
loginErrorWithRetryItem {
|
loginErrorWithRetryItem {
|
||||||
id("errorRetry")
|
id("errorRetry")
|
||||||
text(errorFormatter.toHumanReadable(state.asyncHomeServerLoginFlowRequest.error))
|
text(host.errorFormatter.toHumanReadable(state.asyncHomeServerLoginFlowRequest.error))
|
||||||
listener { listener?.retry() }
|
listener { host.listener?.retry() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Success -> {
|
is Success -> {
|
||||||
|
@ -110,21 +112,21 @@ class SoftLogoutController @Inject constructor(
|
||||||
LoginMode.Password -> {
|
LoginMode.Password -> {
|
||||||
loginPasswordFormItem {
|
loginPasswordFormItem {
|
||||||
id("passwordForm")
|
id("passwordForm")
|
||||||
stringProvider(stringProvider)
|
stringProvider(host.stringProvider)
|
||||||
passwordShown(state.passwordShown)
|
passwordShown(state.passwordShown)
|
||||||
submitEnabled(state.submitEnabled)
|
submitEnabled(state.submitEnabled)
|
||||||
onPasswordEdited { listener?.passwordEdited(it) }
|
onPasswordEdited { host.listener?.passwordEdited(it) }
|
||||||
errorText((state.asyncLoginAction as? Fail)?.error?.let { errorFormatter.toHumanReadable(it) })
|
errorText((state.asyncLoginAction as? Fail)?.error?.let { host.errorFormatter.toHumanReadable(it) })
|
||||||
passwordRevealClickListener { listener?.revealPasswordClicked() }
|
passwordRevealClickListener { host.listener?.revealPasswordClicked() }
|
||||||
forgetPasswordClickListener { listener?.forgetPasswordClicked() }
|
forgetPasswordClickListener { host.listener?.forgetPasswordClicked() }
|
||||||
submitClickListener { password -> listener?.signinSubmit(password) }
|
submitClickListener { password -> host.listener?.signinSubmit(password) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is LoginMode.Sso -> {
|
is LoginMode.Sso -> {
|
||||||
loginCenterButtonItem {
|
loginCenterButtonItem {
|
||||||
id("sso")
|
id("sso")
|
||||||
text(stringProvider.getString(R.string.login_signin_sso))
|
text(host.stringProvider.getString(R.string.login_signin_sso))
|
||||||
listener { listener?.signinFallbackSubmit() }
|
listener { host.listener?.signinFallbackSubmit() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is LoginMode.SsoAndPassword -> {
|
is LoginMode.SsoAndPassword -> {
|
||||||
|
@ -132,8 +134,8 @@ class SoftLogoutController @Inject constructor(
|
||||||
LoginMode.Unsupported -> {
|
LoginMode.Unsupported -> {
|
||||||
loginCenterButtonItem {
|
loginCenterButtonItem {
|
||||||
id("fallback")
|
id("fallback")
|
||||||
text(stringProvider.getString(R.string.login_signin))
|
text(host.stringProvider.getString(R.string.login_signin))
|
||||||
listener { listener?.signinFallbackSubmit() }
|
listener { host.listener?.signinFallbackSubmit() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LoginMode.Unknown -> Unit // Should not happen
|
LoginMode.Unknown -> Unit // Should not happen
|
||||||
|
@ -143,18 +145,19 @@ class SoftLogoutController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildClearDataSection() {
|
private fun buildClearDataSection() {
|
||||||
|
val host = this
|
||||||
loginTitleSmallItem {
|
loginTitleSmallItem {
|
||||||
id("clearDataTitle")
|
id("clearDataTitle")
|
||||||
text(stringProvider.getString(R.string.soft_logout_clear_data_title))
|
text(host.stringProvider.getString(R.string.soft_logout_clear_data_title))
|
||||||
}
|
}
|
||||||
loginTextItem {
|
loginTextItem {
|
||||||
id("clearDataText")
|
id("clearDataText")
|
||||||
text(stringProvider.getString(R.string.soft_logout_clear_data_notice))
|
text(host.stringProvider.getString(R.string.soft_logout_clear_data_notice))
|
||||||
}
|
}
|
||||||
loginRedButtonItem {
|
loginRedButtonItem {
|
||||||
id("clearDataSubmit")
|
id("clearDataSubmit")
|
||||||
text(stringProvider.getString(R.string.soft_logout_clear_data_submit))
|
text(host.stringProvider.getString(R.string.soft_logout_clear_data_submit))
|
||||||
listener { listener?.clearData() }
|
listener { host.listener?.clearData() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ class SpaceSummaryController @Inject constructor(
|
||||||
|
|
||||||
override fun buildModels() {
|
override fun buildModels() {
|
||||||
val nonNullViewState = viewState ?: return
|
val nonNullViewState = viewState ?: return
|
||||||
|
val host = this
|
||||||
buildGroupModels(
|
buildGroupModels(
|
||||||
nonNullViewState.asyncSpaces(),
|
nonNullViewState.asyncSpaces(),
|
||||||
nonNullViewState.selectedGroupingMethod,
|
nonNullViewState.selectedGroupingMethod,
|
||||||
|
@ -74,30 +75,30 @@ class SpaceSummaryController @Inject constructor(
|
||||||
|
|
||||||
genericItemHeader {
|
genericItemHeader {
|
||||||
id("legacy_groups")
|
id("legacy_groups")
|
||||||
text(stringProvider.getString(R.string.groups_header))
|
text(host.stringProvider.getString(R.string.groups_header))
|
||||||
textColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
textColor(host.colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
||||||
}
|
}
|
||||||
|
|
||||||
// add home for communities
|
// add home for communities
|
||||||
nonNullViewState.myMxItem.invoke()?.let { mxItem ->
|
nonNullViewState.myMxItem.invoke()?.let { mxItem ->
|
||||||
groupSummaryItem {
|
groupSummaryItem {
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
id("all_communities")
|
id("all_communities")
|
||||||
matrixItem(mxItem.copy(displayName = stringProvider.getString(R.string.group_all_communities)))
|
matrixItem(mxItem.copy(displayName = host.stringProvider.getString(R.string.group_all_communities)))
|
||||||
selected(nonNullViewState.selectedGroupingMethod is RoomGroupingMethod.ByLegacyGroup
|
selected(nonNullViewState.selectedGroupingMethod is RoomGroupingMethod.ByLegacyGroup
|
||||||
&& nonNullViewState.selectedGroupingMethod.group() == null)
|
&& nonNullViewState.selectedGroupingMethod.group() == null)
|
||||||
listener { callback?.onGroupSelected(null) }
|
listener { host.callback?.onGroupSelected(null) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nonNullViewState.legacyGroups.forEach { groupSummary ->
|
nonNullViewState.legacyGroups.forEach { groupSummary ->
|
||||||
groupSummaryItem {
|
groupSummaryItem {
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
id(groupSummary.groupId)
|
id(groupSummary.groupId)
|
||||||
matrixItem(groupSummary.toMatrixItem())
|
matrixItem(groupSummary.toMatrixItem())
|
||||||
selected(nonNullViewState.selectedGroupingMethod is RoomGroupingMethod.ByLegacyGroup
|
selected(nonNullViewState.selectedGroupingMethod is RoomGroupingMethod.ByLegacyGroup
|
||||||
&& nonNullViewState.selectedGroupingMethod.group()?.groupId == groupSummary.groupId)
|
&& nonNullViewState.selectedGroupingMethod.group()?.groupId == groupSummary.groupId)
|
||||||
listener { callback?.onGroupSelected(groupSummary) }
|
listener { host.callback?.onGroupSelected(groupSummary) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,10 +109,11 @@ class SpaceSummaryController @Inject constructor(
|
||||||
rootSpaces: List<RoomSummary>?,
|
rootSpaces: List<RoomSummary>?,
|
||||||
expandedStates: Map<String, Boolean>,
|
expandedStates: Map<String, Boolean>,
|
||||||
homeCount: RoomAggregateNotificationCount) {
|
homeCount: RoomAggregateNotificationCount) {
|
||||||
|
val host = this
|
||||||
spaceBetaHeaderItem {
|
spaceBetaHeaderItem {
|
||||||
id("beta_header")
|
id("beta_header")
|
||||||
clickAction(View.OnClickListener {
|
clickAction(View.OnClickListener {
|
||||||
callback?.sendFeedBack()
|
host.callback?.sendFeedBack()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,13 +122,13 @@ class SpaceSummaryController @Inject constructor(
|
||||||
summaries?.filter { it.membership == Membership.INVITE }
|
summaries?.filter { it.membership == Membership.INVITE }
|
||||||
?.forEach {
|
?.forEach {
|
||||||
spaceSummaryItem {
|
spaceSummaryItem {
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
id(it.roomId)
|
id(it.roomId)
|
||||||
matrixItem(it.toMatrixItem())
|
matrixItem(it.toMatrixItem())
|
||||||
countState(UnreadCounterBadgeView.State(1, true))
|
countState(UnreadCounterBadgeView.State(1, true))
|
||||||
selected(false)
|
selected(false)
|
||||||
description(stringProvider.getString(R.string.you_are_invited))
|
description(host.stringProvider.getString(R.string.you_are_invited))
|
||||||
listener { callback?.onSpaceInviteSelected(it) }
|
listener { host.callback?.onSpaceInviteSelected(it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +136,7 @@ class SpaceSummaryController @Inject constructor(
|
||||||
id("space_home")
|
id("space_home")
|
||||||
selected(selected is RoomGroupingMethod.BySpace && selected.space() == null)
|
selected(selected is RoomGroupingMethod.BySpace && selected.space() == null)
|
||||||
countState(UnreadCounterBadgeView.State(homeCount.totalCount, homeCount.isHighlight))
|
countState(UnreadCounterBadgeView.State(homeCount.totalCount, homeCount.isHighlight))
|
||||||
listener { callback?.onSpaceSelected(null) }
|
listener { host.callback?.onSpaceSelected(null) }
|
||||||
}
|
}
|
||||||
|
|
||||||
rootSpaces
|
rootSpaces
|
||||||
|
@ -149,15 +151,15 @@ class SpaceSummaryController @Inject constructor(
|
||||||
val expanded = expandedStates[groupSummary.roomId] == true
|
val expanded = expandedStates[groupSummary.roomId] == true
|
||||||
|
|
||||||
spaceSummaryItem {
|
spaceSummaryItem {
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
id(groupSummary.roomId)
|
id(groupSummary.roomId)
|
||||||
hasChildren(hasChildren)
|
hasChildren(hasChildren)
|
||||||
expanded(expanded)
|
expanded(expanded)
|
||||||
matrixItem(groupSummary.toMatrixItem())
|
matrixItem(groupSummary.toMatrixItem())
|
||||||
selected(isSelected)
|
selected(isSelected)
|
||||||
onMore { callback?.onSpaceSettings(groupSummary) }
|
onMore { host.callback?.onSpaceSettings(groupSummary) }
|
||||||
listener { callback?.onSpaceSelected(groupSummary) }
|
listener { host.callback?.onSpaceSelected(groupSummary) }
|
||||||
toggleExpand { callback?.onToggleExpand(groupSummary) }
|
toggleExpand { host.callback?.onToggleExpand(groupSummary) }
|
||||||
countState(
|
countState(
|
||||||
UnreadCounterBadgeView.State(
|
UnreadCounterBadgeView.State(
|
||||||
groupSummary.notificationCount,
|
groupSummary.notificationCount,
|
||||||
|
@ -176,7 +178,7 @@ class SpaceSummaryController @Inject constructor(
|
||||||
|
|
||||||
spaceAddItem {
|
spaceAddItem {
|
||||||
id("create")
|
id("create")
|
||||||
listener { callback?.onAddSpaceSelected() }
|
listener { host.callback?.onAddSpaceSelected() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,6 +186,7 @@ class SpaceSummaryController @Inject constructor(
|
||||||
expandedStates: Map<String, Boolean>,
|
expandedStates: Map<String, Boolean>,
|
||||||
selected: RoomGroupingMethod,
|
selected: RoomGroupingMethod,
|
||||||
info: SpaceChildInfo, currentDepth: Int, maxDepth: Int) {
|
info: SpaceChildInfo, currentDepth: Int, maxDepth: Int) {
|
||||||
|
val host = this
|
||||||
if (currentDepth >= maxDepth) return
|
if (currentDepth >= maxDepth) return
|
||||||
val childSummary = summaries?.firstOrNull { it.roomId == info.childRoomId } ?: return
|
val childSummary = summaries?.firstOrNull { it.roomId == info.childRoomId } ?: return
|
||||||
// does it have children?
|
// does it have children?
|
||||||
|
@ -194,15 +197,15 @@ class SpaceSummaryController @Inject constructor(
|
||||||
val isSelected = selected is RoomGroupingMethod.BySpace && childSummary.roomId == selected.space()?.roomId
|
val isSelected = selected is RoomGroupingMethod.BySpace && childSummary.roomId == selected.space()?.roomId
|
||||||
|
|
||||||
subSpaceSummaryItem {
|
subSpaceSummaryItem {
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
id(childSummary.roomId)
|
id(childSummary.roomId)
|
||||||
hasChildren(!subSpaces.isNullOrEmpty())
|
hasChildren(!subSpaces.isNullOrEmpty())
|
||||||
selected(isSelected)
|
selected(isSelected)
|
||||||
expanded(expanded)
|
expanded(expanded)
|
||||||
onMore { callback?.onSpaceSettings(childSummary) }
|
onMore { host.callback?.onSpaceSettings(childSummary) }
|
||||||
matrixItem(childSummary.toMatrixItem())
|
matrixItem(childSummary.toMatrixItem())
|
||||||
listener { callback?.onSpaceSelected(childSummary) }
|
listener { host.callback?.onSpaceSelected(childSummary) }
|
||||||
toggleExpand { callback?.onToggleExpand(childSummary) }
|
toggleExpand { host.callback?.onToggleExpand(childSummary) }
|
||||||
indent(currentDepth)
|
indent(currentDepth)
|
||||||
countState(
|
countState(
|
||||||
UnreadCounterBadgeView.State(
|
UnreadCounterBadgeView.State(
|
||||||
|
|
|
@ -36,23 +36,24 @@ class SpaceDefaultRoomEpoxyController @Inject constructor(
|
||||||
// var shouldForceFocusOnce = true
|
// var shouldForceFocusOnce = true
|
||||||
|
|
||||||
override fun buildModels(data: CreateSpaceState?) {
|
override fun buildModels(data: CreateSpaceState?) {
|
||||||
|
val host = this
|
||||||
genericFooterItem {
|
genericFooterItem {
|
||||||
id("info_help_header")
|
id("info_help_header")
|
||||||
style(ItemStyle.TITLE)
|
style(ItemStyle.TITLE)
|
||||||
text(
|
text(
|
||||||
if (data?.spaceType == SpaceType.Public) {
|
if (data?.spaceType == SpaceType.Public) {
|
||||||
stringProvider.getString(R.string.create_spaces_room_public_header, data.name)
|
host.stringProvider.getString(R.string.create_spaces_room_public_header, data.name)
|
||||||
} else {
|
} else {
|
||||||
stringProvider.getString(R.string.create_spaces_room_private_header)
|
host.stringProvider.getString(R.string.create_spaces_room_private_header)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
textColor(colorProvider.getColorFromAttribute(R.attr.riot_primary_text_color))
|
textColor(host.colorProvider.getColorFromAttribute(R.attr.riot_primary_text_color))
|
||||||
}
|
}
|
||||||
|
|
||||||
genericFooterItem {
|
genericFooterItem {
|
||||||
id("info_help")
|
id("info_help")
|
||||||
text(
|
text(
|
||||||
stringProvider.getString(
|
host.stringProvider.getString(
|
||||||
if (data?.spaceType == SpaceType.Public) {
|
if (data?.spaceType == SpaceType.Public) {
|
||||||
R.string.create_spaces_room_public_header_desc
|
R.string.create_spaces_room_public_header_desc
|
||||||
} else {
|
} else {
|
||||||
|
@ -60,7 +61,7 @@ class SpaceDefaultRoomEpoxyController @Inject constructor(
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
textColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary))
|
textColor(host.colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary))
|
||||||
}
|
}
|
||||||
|
|
||||||
val firstRoomName = data?.defaultRooms?.get(0)
|
val firstRoomName = data?.defaultRooms?.get(0)
|
||||||
|
@ -69,11 +70,11 @@ class SpaceDefaultRoomEpoxyController @Inject constructor(
|
||||||
enabled(true)
|
enabled(true)
|
||||||
value(firstRoomName)
|
value(firstRoomName)
|
||||||
singleLine(true)
|
singleLine(true)
|
||||||
hint(stringProvider.getString(R.string.create_room_name_section))
|
hint(host.stringProvider.getString(R.string.create_room_name_section))
|
||||||
endIconMode(TextInputLayout.END_ICON_CLEAR_TEXT)
|
endIconMode(TextInputLayout.END_ICON_CLEAR_TEXT)
|
||||||
showBottomSeparator(false)
|
showBottomSeparator(false)
|
||||||
onTextChange { text ->
|
onTextChange { text ->
|
||||||
listener?.onNameChange(0, text)
|
host.listener?.onNameChange(0, text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,11 +84,11 @@ class SpaceDefaultRoomEpoxyController @Inject constructor(
|
||||||
enabled(true)
|
enabled(true)
|
||||||
value(secondRoomName)
|
value(secondRoomName)
|
||||||
singleLine(true)
|
singleLine(true)
|
||||||
hint(stringProvider.getString(R.string.create_room_name_section))
|
hint(host.stringProvider.getString(R.string.create_room_name_section))
|
||||||
endIconMode(TextInputLayout.END_ICON_CLEAR_TEXT)
|
endIconMode(TextInputLayout.END_ICON_CLEAR_TEXT)
|
||||||
showBottomSeparator(false)
|
showBottomSeparator(false)
|
||||||
onTextChange { text ->
|
onTextChange { text ->
|
||||||
listener?.onNameChange(1, text)
|
host.listener?.onNameChange(1, text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,11 +98,11 @@ class SpaceDefaultRoomEpoxyController @Inject constructor(
|
||||||
enabled(true)
|
enabled(true)
|
||||||
value(thirdRoomName)
|
value(thirdRoomName)
|
||||||
singleLine(true)
|
singleLine(true)
|
||||||
hint(stringProvider.getString(R.string.create_room_name_section))
|
hint(host.stringProvider.getString(R.string.create_room_name_section))
|
||||||
endIconMode(TextInputLayout.END_ICON_CLEAR_TEXT)
|
endIconMode(TextInputLayout.END_ICON_CLEAR_TEXT)
|
||||||
showBottomSeparator(false)
|
showBottomSeparator(false)
|
||||||
onTextChange { text ->
|
onTextChange { text ->
|
||||||
listener?.onNameChange(2, text)
|
host.listener?.onNameChange(2, text)
|
||||||
}
|
}
|
||||||
// onBind { _, view, _ ->
|
// onBind { _, view, _ ->
|
||||||
// if (shouldForceFocusOnce
|
// if (shouldForceFocusOnce
|
||||||
|
|
|
@ -37,13 +37,14 @@ class SpaceDetailEpoxyController @Inject constructor(
|
||||||
// var shouldForceFocusOnce = true
|
// var shouldForceFocusOnce = true
|
||||||
|
|
||||||
override fun buildModels(data: CreateSpaceState?) {
|
override fun buildModels(data: CreateSpaceState?) {
|
||||||
|
val host = this
|
||||||
genericFooterItem {
|
genericFooterItem {
|
||||||
id("info_help")
|
id("info_help")
|
||||||
text(
|
text(
|
||||||
if (data?.spaceType == SpaceType.Public) {
|
if (data?.spaceType == SpaceType.Public) {
|
||||||
stringProvider.getString(R.string.create_spaces_details_public_header)
|
host.stringProvider.getString(R.string.create_spaces_details_public_header)
|
||||||
} else {
|
} else {
|
||||||
stringProvider.getString(R.string.create_spaces_details_private_header)
|
host.stringProvider.getString(R.string.create_spaces_details_private_header)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -52,17 +53,17 @@ class SpaceDetailEpoxyController @Inject constructor(
|
||||||
id("avatar")
|
id("avatar")
|
||||||
enabled(true)
|
enabled(true)
|
||||||
imageUri(data?.avatarUri)
|
imageUri(data?.avatarUri)
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
matrixItem(data?.name?.let { MatrixItem.RoomItem("!", it, null).takeIf { !it.displayName.isNullOrBlank() } })
|
matrixItem(data?.name?.let { MatrixItem.RoomItem("!", it, null).takeIf { !it.displayName.isNullOrBlank() } })
|
||||||
clickListener { listener?.onAvatarChange() }
|
clickListener { host.listener?.onAvatarChange() }
|
||||||
deleteListener { listener?.onAvatarDelete() }
|
deleteListener { host.listener?.onAvatarDelete() }
|
||||||
}
|
}
|
||||||
|
|
||||||
formEditTextItem {
|
formEditTextItem {
|
||||||
id("name")
|
id("name")
|
||||||
enabled(true)
|
enabled(true)
|
||||||
value(data?.name)
|
value(data?.name)
|
||||||
hint(stringProvider.getString(R.string.create_room_name_hint))
|
hint(host.stringProvider.getString(R.string.create_room_name_hint))
|
||||||
singleLine(true)
|
singleLine(true)
|
||||||
showBottomSeparator(false)
|
showBottomSeparator(false)
|
||||||
errorMessage(data?.nameInlineError)
|
errorMessage(data?.nameInlineError)
|
||||||
|
@ -76,7 +77,7 @@ class SpaceDetailEpoxyController @Inject constructor(
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
onTextChange { text ->
|
onTextChange { text ->
|
||||||
listener?.onNameChange(text)
|
host.listener?.onNameChange(text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,11 +85,11 @@ class SpaceDetailEpoxyController @Inject constructor(
|
||||||
id("topic")
|
id("topic")
|
||||||
enabled(true)
|
enabled(true)
|
||||||
value(data?.topic)
|
value(data?.topic)
|
||||||
hint(stringProvider.getString(R.string.create_space_topic_hint))
|
hint(host.stringProvider.getString(R.string.create_space_topic_hint))
|
||||||
showBottomSeparator(false)
|
showBottomSeparator(false)
|
||||||
textSizeSp(16)
|
textSizeSp(16)
|
||||||
onTextChange { text ->
|
onTextChange { text ->
|
||||||
listener?.onTopicChange(text)
|
host.listener?.onTopicChange(text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,7 @@ class SpaceDirectoryController @Inject constructor(
|
||||||
var listener: InteractionListener? = null
|
var listener: InteractionListener? = null
|
||||||
|
|
||||||
override fun buildModels(data: SpaceDirectoryState?) {
|
override fun buildModels(data: SpaceDirectoryState?) {
|
||||||
|
val host = this
|
||||||
val results = data?.spaceSummaryApiResult
|
val results = data?.spaceSummaryApiResult
|
||||||
|
|
||||||
if (results is Incomplete) {
|
if (results is Incomplete) {
|
||||||
|
@ -70,13 +71,13 @@ class SpaceDirectoryController @Inject constructor(
|
||||||
tintIcon(false)
|
tintIcon(false)
|
||||||
text(
|
text(
|
||||||
span {
|
span {
|
||||||
span(stringProvider.getString(R.string.spaces_no_server_support_title)) {
|
span(host.stringProvider.getString(R.string.spaces_no_server_support_title)) {
|
||||||
textStyle = "bold"
|
textStyle = "bold"
|
||||||
textColor = colorProvider.getColorFromAttribute(R.attr.riotx_text_primary)
|
textColor = host.colorProvider.getColorFromAttribute(R.attr.riotx_text_primary)
|
||||||
}
|
}
|
||||||
+"\n\n"
|
+"\n\n"
|
||||||
span(stringProvider.getString(R.string.spaces_no_server_support_description)) {
|
span(host.stringProvider.getString(R.string.spaces_no_server_support_description)) {
|
||||||
textColor = colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)
|
textColor = host.colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -84,8 +85,8 @@ class SpaceDirectoryController @Inject constructor(
|
||||||
} else {
|
} else {
|
||||||
errorWithRetryItem {
|
errorWithRetryItem {
|
||||||
id("api_err")
|
id("api_err")
|
||||||
text(errorFormatter.toHumanReadable(failure))
|
text(host.errorFormatter.toHumanReadable(failure))
|
||||||
listener { listener?.retry() }
|
listener { host.listener?.retry() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -98,7 +99,7 @@ class SpaceDirectoryController @Inject constructor(
|
||||||
if (flattenChildInfo.isEmpty()) {
|
if (flattenChildInfo.isEmpty()) {
|
||||||
genericFooterItem {
|
genericFooterItem {
|
||||||
id("empty_footer")
|
id("empty_footer")
|
||||||
stringProvider.getString(R.string.no_result_placeholder)
|
host.stringProvider.getString(R.string.no_result_placeholder)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
flattenChildInfo.forEach { info ->
|
flattenChildInfo.forEach { info ->
|
||||||
|
@ -108,23 +109,23 @@ class SpaceDirectoryController @Inject constructor(
|
||||||
spaceChildInfoItem {
|
spaceChildInfoItem {
|
||||||
id(info.childRoomId)
|
id(info.childRoomId)
|
||||||
matrixItem(MatrixItem.RoomItem(info.childRoomId, info.name, info.avatarUrl))
|
matrixItem(MatrixItem.RoomItem(info.childRoomId, info.name, info.avatarUrl))
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
topic(info.topic)
|
topic(info.topic)
|
||||||
memberCount(info.activeMemberCount ?: 0)
|
memberCount(info.activeMemberCount ?: 0)
|
||||||
space(isSpace)
|
space(isSpace)
|
||||||
loading(isLoading)
|
loading(isLoading)
|
||||||
buttonLabel(
|
buttonLabel(
|
||||||
if (isJoined) stringProvider.getString(R.string.action_open)
|
if (isJoined) host.stringProvider.getString(R.string.action_open)
|
||||||
else stringProvider.getString(R.string.join)
|
else host.stringProvider.getString(R.string.join)
|
||||||
)
|
)
|
||||||
apply {
|
apply {
|
||||||
if (isSpace) {
|
if (isSpace) {
|
||||||
itemClickListener(View.OnClickListener { listener?.onSpaceChildClick(info) })
|
itemClickListener(View.OnClickListener { host.listener?.onSpaceChildClick(info) })
|
||||||
} else {
|
} else {
|
||||||
itemClickListener(View.OnClickListener { listener?.onRoomClick(info) })
|
itemClickListener(View.OnClickListener { host.listener?.onRoomClick(info) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buttonClickListener(View.OnClickListener { listener?.onButtonClick(info) })
|
buttonClickListener(View.OnClickListener { host.listener?.onButtonClick(info) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,6 +88,7 @@ class AddRoomListController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun addModels(models: List<EpoxyModel<*>>) {
|
override fun addModels(models: List<EpoxyModel<*>>) {
|
||||||
|
val host = this
|
||||||
val filteredModel = if (ignoreRooms == null) {
|
val filteredModel = if (ignoreRooms == null) {
|
||||||
models
|
models
|
||||||
} else {
|
} else {
|
||||||
|
@ -100,7 +101,7 @@ class AddRoomListController @Inject constructor(
|
||||||
add(
|
add(
|
||||||
RoomCategoryItem_().apply {
|
RoomCategoryItem_().apply {
|
||||||
id("header")
|
id("header")
|
||||||
title(sectionName ?: "")
|
title(host.sectionName ?: "")
|
||||||
expanded(true)
|
expanded(true)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -108,7 +109,7 @@ class AddRoomListController @Inject constructor(
|
||||||
add(
|
add(
|
||||||
GenericPillItem_().apply {
|
GenericPillItem_().apply {
|
||||||
id("sub_header")
|
id("sub_header")
|
||||||
text(subHeaderText)
|
text(host.subHeaderText)
|
||||||
imageRes(R.drawable.ic_info)
|
imageRes(R.drawable.ic_info)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -123,15 +124,16 @@ class AddRoomListController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun buildItemModel(currentPosition: Int, item: RoomSummary?): EpoxyModel<*> {
|
override fun buildItemModel(currentPosition: Int, item: RoomSummary?): EpoxyModel<*> {
|
||||||
|
val host = this
|
||||||
if (item == null) return RoomSelectionPlaceHolderItem_().apply { id(currentPosition) }
|
if (item == null) return RoomSelectionPlaceHolderItem_().apply { id(currentPosition) }
|
||||||
return RoomSelectionItem_().apply {
|
return RoomSelectionItem_().apply {
|
||||||
id(item.roomId)
|
id(item.roomId)
|
||||||
matrixItem(item.toMatrixItem())
|
matrixItem(item.toMatrixItem())
|
||||||
avatarRenderer(this@AddRoomListController.avatarRenderer)
|
avatarRenderer(this@AddRoomListController.avatarRenderer)
|
||||||
space(item.roomType == RoomType.SPACE)
|
space(item.roomType == RoomType.SPACE)
|
||||||
selected(selectedItems[item.roomId] ?: false)
|
selected(host.selectedItems[item.roomId] ?: false)
|
||||||
itemClickListener(DebouncedClickListener({
|
itemClickListener(DebouncedClickListener({
|
||||||
listener?.onItemSelected(item)
|
host.listener?.onItemSelected(item)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ class SpaceManageRoomsController @Inject constructor(
|
||||||
private val matchFilter = SpaceChildInfoMatchFilter()
|
private val matchFilter = SpaceChildInfoMatchFilter()
|
||||||
|
|
||||||
override fun buildModels(data: SpaceManageRoomViewState?) {
|
override fun buildModels(data: SpaceManageRoomViewState?) {
|
||||||
|
val host = this
|
||||||
val roomListAsync = data?.childrenInfo
|
val roomListAsync = data?.childrenInfo
|
||||||
if (roomListAsync is Incomplete) {
|
if (roomListAsync is Incomplete) {
|
||||||
loadingItem { id("loading") }
|
loadingItem { id("loading") }
|
||||||
|
@ -51,8 +52,8 @@ class SpaceManageRoomsController @Inject constructor(
|
||||||
if (roomListAsync is Fail) {
|
if (roomListAsync is Fail) {
|
||||||
errorWithRetryItem {
|
errorWithRetryItem {
|
||||||
id("Api Error")
|
id("Api Error")
|
||||||
text(errorFormatter.toHumanReadable(roomListAsync.error))
|
text(host.errorFormatter.toHumanReadable(roomListAsync.error))
|
||||||
listener { listener?.retry() }
|
listener { host.listener?.retry() }
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -70,12 +71,12 @@ class SpaceManageRoomsController @Inject constructor(
|
||||||
roomManageSelectionItem {
|
roomManageSelectionItem {
|
||||||
id(childInfo.childRoomId)
|
id(childInfo.childRoomId)
|
||||||
matrixItem(childInfo.toMatrixItem())
|
matrixItem(childInfo.toMatrixItem())
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
suggested(childInfo.suggested ?: false)
|
suggested(childInfo.suggested ?: false)
|
||||||
space(childInfo.roomType == RoomType.SPACE)
|
space(childInfo.roomType == RoomType.SPACE)
|
||||||
selected(data.selectedRooms.contains(childInfo.childRoomId))
|
selected(data.selectedRooms.contains(childInfo.childRoomId))
|
||||||
itemClickListener(DebouncedClickListener({
|
itemClickListener(DebouncedClickListener({
|
||||||
listener?.toggleSelection(childInfo)
|
host.listener?.toggleSelection(childInfo)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,7 @@ class SpaceSettingsController @Inject constructor(
|
||||||
|
|
||||||
override fun buildModels(data: RoomSettingsViewState?) {
|
override fun buildModels(data: RoomSettingsViewState?) {
|
||||||
val roomSummary = data?.roomSummary?.invoke() ?: return
|
val roomSummary = data?.roomSummary?.invoke() ?: return
|
||||||
|
val host = this
|
||||||
|
|
||||||
formEditableSquareAvatarItem {
|
formEditableSquareAvatarItem {
|
||||||
id("avatar")
|
id("avatar")
|
||||||
|
@ -68,7 +69,7 @@ class SpaceSettingsController @Inject constructor(
|
||||||
when (val avatarAction = data.avatarAction) {
|
when (val avatarAction = data.avatarAction) {
|
||||||
RoomSettingsViewState.AvatarAction.None -> {
|
RoomSettingsViewState.AvatarAction.None -> {
|
||||||
// Use the current value
|
// Use the current value
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
// We do not want to use the fallback avatar url, which can be the other user avatar, or the current user avatar.
|
// We do not want to use the fallback avatar url, which can be the other user avatar, or the current user avatar.
|
||||||
matrixItem(roomSummary.toMatrixItem().copy(avatarUrl = data.currentRoomAvatarUrl))
|
matrixItem(roomSummary.toMatrixItem().copy(avatarUrl = data.currentRoomAvatarUrl))
|
||||||
}
|
}
|
||||||
|
@ -77,8 +78,8 @@ class SpaceSettingsController @Inject constructor(
|
||||||
is RoomSettingsViewState.AvatarAction.UpdateAvatar ->
|
is RoomSettingsViewState.AvatarAction.UpdateAvatar ->
|
||||||
imageUri(avatarAction.newAvatarUri)
|
imageUri(avatarAction.newAvatarUri)
|
||||||
}
|
}
|
||||||
clickListener { callback?.onAvatarChange() }
|
clickListener { host.callback?.onAvatarChange() }
|
||||||
deleteListener { callback?.onAvatarDelete() }
|
deleteListener { host.callback?.onAvatarDelete() }
|
||||||
}
|
}
|
||||||
|
|
||||||
buildProfileSection(
|
buildProfileSection(
|
||||||
|
@ -89,10 +90,10 @@ class SpaceSettingsController @Inject constructor(
|
||||||
id("name")
|
id("name")
|
||||||
enabled(data.actionPermissions.canChangeName)
|
enabled(data.actionPermissions.canChangeName)
|
||||||
value(data.newName ?: roomSummary.displayName)
|
value(data.newName ?: roomSummary.displayName)
|
||||||
hint(stringProvider.getString(R.string.create_room_name_hint))
|
hint(host.stringProvider.getString(R.string.create_room_name_hint))
|
||||||
showBottomSeparator(false)
|
showBottomSeparator(false)
|
||||||
onTextChange { text ->
|
onTextChange { text ->
|
||||||
callback?.onNameChanged(text)
|
host.callback?.onNameChanged(text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,10 +101,10 @@ class SpaceSettingsController @Inject constructor(
|
||||||
id("topic")
|
id("topic")
|
||||||
enabled(data.actionPermissions.canChangeTopic)
|
enabled(data.actionPermissions.canChangeTopic)
|
||||||
value(data.newTopic ?: roomSummary.topic)
|
value(data.newTopic ?: roomSummary.topic)
|
||||||
hint(stringProvider.getString(R.string.create_space_topic_hint))
|
hint(host.stringProvider.getString(R.string.create_space_topic_hint))
|
||||||
showBottomSeparator(false)
|
showBottomSeparator(false)
|
||||||
onTextChange { text ->
|
onTextChange { text ->
|
||||||
callback?.onTopicChanged(text)
|
host.callback?.onTopicChanged(text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,11 +123,11 @@ class SpaceSettingsController @Inject constructor(
|
||||||
formSwitchItem {
|
formSwitchItem {
|
||||||
id("isPublic")
|
id("isPublic")
|
||||||
enabled(data.actionPermissions.canChangeJoinRule)
|
enabled(data.actionPermissions.canChangeJoinRule)
|
||||||
title(stringProvider.getString(R.string.make_this_space_public))
|
title(host.stringProvider.getString(R.string.make_this_space_public))
|
||||||
switchChecked(isPublic)
|
switchChecked(isPublic)
|
||||||
|
|
||||||
listener { value ->
|
listener { value ->
|
||||||
callback?.setIsPublic(value)
|
host.callback?.setIsPublic(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,7 @@ class SpacePeopleListController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun buildModels(data: RoomMemberListViewState?) {
|
override fun buildModels(data: RoomMemberListViewState?) {
|
||||||
|
val host = this
|
||||||
val memberSummaries = data?.roomMemberSummaries?.invoke()
|
val memberSummaries = data?.roomMemberSummaries?.invoke()
|
||||||
if (memberSummaries == null) {
|
if (memberSummaries == null) {
|
||||||
loadingItem { id("loading") }
|
loadingItem { id("loading") }
|
||||||
|
@ -72,7 +73,7 @@ class SpacePeopleListController @Inject constructor(
|
||||||
if (filtered.isNotEmpty()) {
|
if (filtered.isNotEmpty()) {
|
||||||
dividerItem {
|
dividerItem {
|
||||||
id("divider_type_${memberEntry.first.titleRes}")
|
id("divider_type_${memberEntry.first.titleRes}")
|
||||||
color(dividerColor)
|
color(host.dividerColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foundCount += filtered.size
|
foundCount += filtered.size
|
||||||
|
@ -82,15 +83,15 @@ class SpacePeopleListController @Inject constructor(
|
||||||
profileMatrixItemWithPowerLevel {
|
profileMatrixItemWithPowerLevel {
|
||||||
id(roomMember.userId)
|
id(roomMember.userId)
|
||||||
matrixItem(roomMember.toMatrixItem())
|
matrixItem(roomMember.toMatrixItem())
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
userEncryptionTrustLevel(data.trustLevelMap.invoke()?.get(roomMember.userId))
|
userEncryptionTrustLevel(data.trustLevelMap.invoke()?.get(roomMember.userId))
|
||||||
.apply {
|
.apply {
|
||||||
val pl = memberEntry.first.toPowerLevelLabel()
|
val pl = memberEntry.first.toPowerLevelLabel()
|
||||||
if (memberEntry.first == RoomMemberListCategories.INVITE) {
|
if (memberEntry.first == RoomMemberListCategories.INVITE) {
|
||||||
powerLevelLabel(
|
powerLevelLabel(
|
||||||
span {
|
span {
|
||||||
span(stringProvider.getString(R.string.invited)) {
|
span(host.stringProvider.getString(R.string.invited)) {
|
||||||
textColor = colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)
|
textColor = host.colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)
|
||||||
textStyle = "bold"
|
textStyle = "bold"
|
||||||
// fontFamily = "monospace"
|
// fontFamily = "monospace"
|
||||||
}
|
}
|
||||||
|
@ -100,10 +101,10 @@ class SpacePeopleListController @Inject constructor(
|
||||||
powerLevelLabel(
|
powerLevelLabel(
|
||||||
span {
|
span {
|
||||||
span(" $pl ") {
|
span(" $pl ") {
|
||||||
backgroundColor = colorProvider.getColor(R.color.notification_accent_color)
|
backgroundColor = host.colorProvider.getColor(R.color.notification_accent_color)
|
||||||
paddingTop = dimensionConverter.dpToPx(2)
|
paddingTop = host.dimensionConverter.dpToPx(2)
|
||||||
paddingBottom = dimensionConverter.dpToPx(2)
|
paddingBottom = host.dimensionConverter.dpToPx(2)
|
||||||
textColor = colorProvider.getColor(R.color.white)
|
textColor = host.colorProvider.getColor(R.color.white)
|
||||||
textStyle = "bold"
|
textStyle = "bold"
|
||||||
// fontFamily = "monospace"
|
// fontFamily = "monospace"
|
||||||
}
|
}
|
||||||
|
@ -115,14 +116,14 @@ class SpacePeopleListController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
clickListener { _ ->
|
clickListener { _ ->
|
||||||
listener?.onSpaceMemberClicked(roomMember)
|
host.listener?.onSpaceMemberClicked(roomMember)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
between = { _, roomMemberBefore ->
|
between = { _, roomMemberBefore ->
|
||||||
dividerItem {
|
dividerItem {
|
||||||
id("divider_${roomMemberBefore.userId}")
|
id("divider_${roomMemberBefore.userId}")
|
||||||
color(dividerColor)
|
color(host.dividerColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -135,22 +136,22 @@ class SpacePeopleListController @Inject constructor(
|
||||||
title(
|
title(
|
||||||
span {
|
span {
|
||||||
+"\n"
|
+"\n"
|
||||||
+stringProvider.getString(R.string.no_result_placeholder)
|
+host.stringProvider.getString(R.string.no_result_placeholder)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
description(
|
description(
|
||||||
span {
|
span {
|
||||||
+stringProvider.getString(R.string.looking_for_someone_not_in_space, data.roomSummary.invoke()?.displayName ?: "")
|
+host.stringProvider.getString(R.string.looking_for_someone_not_in_space, data.roomSummary.invoke()?.displayName ?: "")
|
||||||
+"\n"
|
+"\n"
|
||||||
span("Invite them") {
|
span("Invite them") {
|
||||||
textColor = colorProvider.getColorFromAttribute(R.attr.colorAccent)
|
textColor = host.colorProvider.getColorFromAttribute(R.attr.colorAccent)
|
||||||
textStyle = "bold"
|
textStyle = "bold"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
itemClickAction(GenericItem.Action("invite").apply {
|
itemClickAction(GenericItem.Action("invite").apply {
|
||||||
perform = Runnable {
|
perform = Runnable {
|
||||||
listener?.onInviteToSpaceSelected()
|
host.listener?.onInviteToSpaceSelected()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,11 +37,12 @@ class SpacePreviewController @Inject constructor(
|
||||||
var interactionListener: InteractionListener? = null
|
var interactionListener: InteractionListener? = null
|
||||||
|
|
||||||
override fun buildModels(data: SpacePreviewState?) {
|
override fun buildModels(data: SpacePreviewState?) {
|
||||||
|
val host = this
|
||||||
val memberCount = data?.spaceInfo?.invoke()?.memberCount ?: 0
|
val memberCount = data?.spaceInfo?.invoke()?.memberCount ?: 0
|
||||||
|
|
||||||
spaceTopSummaryItem {
|
spaceTopSummaryItem {
|
||||||
id("info")
|
id("info")
|
||||||
formattedMemberCount(stringProvider.getQuantityString(R.plurals.room_title_members, memberCount, memberCount))
|
formattedMemberCount(host.stringProvider.getQuantityString(R.plurals.room_title_members, memberCount, memberCount))
|
||||||
topic(data?.spaceInfo?.invoke()?.topic ?: data?.topic ?: "")
|
topic(data?.spaceInfo?.invoke()?.topic ?: data?.topic ?: "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +50,7 @@ class SpacePreviewController @Inject constructor(
|
||||||
if (result.isNotEmpty()) {
|
if (result.isNotEmpty()) {
|
||||||
genericItemHeader {
|
genericItemHeader {
|
||||||
id("header_rooms")
|
id("header_rooms")
|
||||||
text(stringProvider.getString(R.string.rooms))
|
text(host.stringProvider.getString(R.string.rooms))
|
||||||
}
|
}
|
||||||
|
|
||||||
buildChildren(result, 0)
|
buildChildren(result, 0)
|
||||||
|
@ -57,6 +58,7 @@ class SpacePreviewController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildChildren(children: List<ChildInfo>, depth: Int) {
|
private fun buildChildren(children: List<ChildInfo>, depth: Int) {
|
||||||
|
val host = this
|
||||||
children.forEach { child ->
|
children.forEach { child ->
|
||||||
|
|
||||||
if (child.isSubSpace == true) {
|
if (child.isSubSpace == true) {
|
||||||
|
@ -66,7 +68,7 @@ class SpacePreviewController @Inject constructor(
|
||||||
title(child.name)
|
title(child.name)
|
||||||
depth(depth)
|
depth(depth)
|
||||||
avatarUrl(child.avatarUrl)
|
avatarUrl(child.avatarUrl)
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
}
|
}
|
||||||
when (child.children) {
|
when (child.children) {
|
||||||
is Loading -> {
|
is Loading -> {
|
||||||
|
@ -87,7 +89,7 @@ class SpacePreviewController @Inject constructor(
|
||||||
topic(child.topic ?: "")
|
topic(child.topic ?: "")
|
||||||
avatarUrl(child.avatarUrl)
|
avatarUrl(child.avatarUrl)
|
||||||
memberCount(TextUtils.formatCountToShortDecimal(child.memberCount ?: 0))
|
memberCount(TextUtils.formatCountToShortDecimal(child.memberCount ?: 0))
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// when (child) {
|
// when (child) {
|
||||||
|
|
|
@ -36,6 +36,7 @@ class TermsController @Inject constructor(
|
||||||
|
|
||||||
override fun buildModels(data: ReviewTermsViewState?) {
|
override fun buildModels(data: ReviewTermsViewState?) {
|
||||||
data ?: return
|
data ?: return
|
||||||
|
val host = this
|
||||||
|
|
||||||
when (data.termsList) {
|
when (data.termsList) {
|
||||||
is Incomplete -> {
|
is Incomplete -> {
|
||||||
|
@ -46,8 +47,8 @@ class TermsController @Inject constructor(
|
||||||
is Fail -> {
|
is Fail -> {
|
||||||
errorWithRetryItem {
|
errorWithRetryItem {
|
||||||
id("errorRetry")
|
id("errorRetry")
|
||||||
text(errorFormatter.toHumanReadable(data.termsList.error))
|
text(host.errorFormatter.toHumanReadable(data.termsList.error))
|
||||||
listener { listener?.retry() }
|
listener { host.listener?.retry() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Success -> buildTerms(data.termsList.invoke())
|
is Success -> buildTerms(data.termsList.invoke())
|
||||||
|
@ -55,6 +56,7 @@ class TermsController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildTerms(termsList: List<Term>) {
|
private fun buildTerms(termsList: List<Term>) {
|
||||||
|
val host = this
|
||||||
settingsSectionTitleItem {
|
settingsSectionTitleItem {
|
||||||
id("header")
|
id("header")
|
||||||
titleResId(R.string.widget_integration_review_terms)
|
titleResId(R.string.widget_integration_review_terms)
|
||||||
|
@ -63,12 +65,12 @@ class TermsController @Inject constructor(
|
||||||
termItem {
|
termItem {
|
||||||
id(term.url)
|
id(term.url)
|
||||||
name(term.name)
|
name(term.name)
|
||||||
description(description)
|
description(host.description)
|
||||||
checked(term.accepted)
|
checked(term.accepted)
|
||||||
|
|
||||||
clickListener(View.OnClickListener { listener?.review(term) })
|
clickListener(View.OnClickListener { host.listener?.review(term) })
|
||||||
checkChangeListener { _, isChecked ->
|
checkChangeListener { _, isChecked ->
|
||||||
listener?.setChecked(term, isChecked)
|
host.listener?.setChecked(term, isChecked)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,36 +51,37 @@ class UserListController @Inject constructor(private val session: Session,
|
||||||
|
|
||||||
override fun buildModels() {
|
override fun buildModels() {
|
||||||
val currentState = state ?: return
|
val currentState = state ?: return
|
||||||
|
val host = this
|
||||||
|
|
||||||
// Build generic items
|
// Build generic items
|
||||||
if (currentState.searchTerm.isBlank()) {
|
if (currentState.searchTerm.isBlank()) {
|
||||||
if (currentState.showInviteActions()) {
|
if (currentState.showInviteActions()) {
|
||||||
actionItem {
|
actionItem {
|
||||||
id(R.drawable.ic_share)
|
id(R.drawable.ic_share)
|
||||||
title(stringProvider.getString(R.string.invite_friends))
|
title(host.stringProvider.getString(R.string.invite_friends))
|
||||||
actionIconRes(R.drawable.ic_share)
|
actionIconRes(R.drawable.ic_share)
|
||||||
clickAction(View.OnClickListener {
|
clickAction(View.OnClickListener {
|
||||||
callback?.onInviteFriendClick()
|
host.callback?.onInviteFriendClick()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (currentState.showContactBookAction) {
|
if (currentState.showContactBookAction) {
|
||||||
actionItem {
|
actionItem {
|
||||||
id(R.drawable.ic_baseline_perm_contact_calendar_24)
|
id(R.drawable.ic_baseline_perm_contact_calendar_24)
|
||||||
title(stringProvider.getString(R.string.contacts_book_title))
|
title(host.stringProvider.getString(R.string.contacts_book_title))
|
||||||
actionIconRes(R.drawable.ic_baseline_perm_contact_calendar_24)
|
actionIconRes(R.drawable.ic_baseline_perm_contact_calendar_24)
|
||||||
clickAction(View.OnClickListener {
|
clickAction(View.OnClickListener {
|
||||||
callback?.onContactBookClick()
|
host.callback?.onContactBookClick()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (currentState.showInviteActions()) {
|
if (currentState.showInviteActions()) {
|
||||||
actionItem {
|
actionItem {
|
||||||
id(R.drawable.ic_qr_code_add)
|
id(R.drawable.ic_qr_code_add)
|
||||||
title(stringProvider.getString(R.string.qr_code))
|
title(host.stringProvider.getString(R.string.qr_code))
|
||||||
actionIconRes(R.drawable.ic_qr_code_add)
|
actionIconRes(R.drawable.ic_qr_code_add)
|
||||||
clickAction(View.OnClickListener {
|
clickAction(View.OnClickListener {
|
||||||
callback?.onUseQRCode()
|
host.callback?.onUseQRCode()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,12 +110,13 @@ class UserListController @Inject constructor(private val session: Session,
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildKnownUsers(currentState: UserListViewState, selectedUsers: List<String>) {
|
private fun buildKnownUsers(currentState: UserListViewState, selectedUsers: List<String>) {
|
||||||
|
val host = this
|
||||||
currentState.knownUsers()
|
currentState.knownUsers()
|
||||||
?.filter { it.userId != session.myUserId }
|
?.filter { it.userId != session.myUserId }
|
||||||
?.let { userList ->
|
?.let { userList ->
|
||||||
userListHeaderItem {
|
userListHeaderItem {
|
||||||
id("known_header")
|
id("known_header")
|
||||||
header(stringProvider.getString(R.string.direct_room_user_list_known_title))
|
header(host.stringProvider.getString(R.string.direct_room_user_list_known_title))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userList.isEmpty()) {
|
if (userList.isEmpty()) {
|
||||||
|
@ -127,9 +129,9 @@ class UserListController @Inject constructor(private val session: Session,
|
||||||
id(item.userId)
|
id(item.userId)
|
||||||
selected(isSelected)
|
selected(isSelected)
|
||||||
matrixItem(item.toMatrixItem())
|
matrixItem(item.toMatrixItem())
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
clickListener { _ ->
|
clickListener { _ ->
|
||||||
callback?.onItemClick(item)
|
host.callback?.onItemClick(item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,6 +139,7 @@ class UserListController @Inject constructor(private val session: Session,
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildDirectoryUsers(directoryUsers: List<User>, selectedUsers: List<String>, searchTerms: String, ignoreIds: List<String>) {
|
private fun buildDirectoryUsers(directoryUsers: List<User>, selectedUsers: List<String>, searchTerms: String, ignoreIds: List<String>) {
|
||||||
|
val host = this
|
||||||
val toDisplay = directoryUsers
|
val toDisplay = directoryUsers
|
||||||
.filter { !ignoreIds.contains(it.userId) && it.userId != session.myUserId }
|
.filter { !ignoreIds.contains(it.userId) && it.userId != session.myUserId }
|
||||||
|
|
||||||
|
@ -145,7 +148,7 @@ class UserListController @Inject constructor(private val session: Session,
|
||||||
}
|
}
|
||||||
userListHeaderItem {
|
userListHeaderItem {
|
||||||
id("suggestions")
|
id("suggestions")
|
||||||
header(stringProvider.getString(R.string.direct_room_user_list_suggestions_title))
|
header(host.stringProvider.getString(R.string.direct_room_user_list_suggestions_title))
|
||||||
}
|
}
|
||||||
if (toDisplay.isEmpty()) {
|
if (toDisplay.isEmpty()) {
|
||||||
renderEmptyState()
|
renderEmptyState()
|
||||||
|
@ -156,9 +159,9 @@ class UserListController @Inject constructor(private val session: Session,
|
||||||
id(user.userId)
|
id(user.userId)
|
||||||
selected(isSelected)
|
selected(isSelected)
|
||||||
matrixItem(user.toMatrixItem())
|
matrixItem(user.toMatrixItem())
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
clickListener { _ ->
|
clickListener { _ ->
|
||||||
callback?.onItemClick(user)
|
host.callback?.onItemClick(user)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -172,16 +175,18 @@ class UserListController @Inject constructor(private val session: Session,
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renderEmptyState() {
|
private fun renderEmptyState() {
|
||||||
|
val host = this
|
||||||
noResultItem {
|
noResultItem {
|
||||||
id("noResult")
|
id("noResult")
|
||||||
text(stringProvider.getString(R.string.no_result_placeholder))
|
text(host.stringProvider.getString(R.string.no_result_placeholder))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renderFailure(failure: Throwable) {
|
private fun renderFailure(failure: Throwable) {
|
||||||
|
val host = this
|
||||||
errorWithRetryItem {
|
errorWithRetryItem {
|
||||||
id("error")
|
id("error")
|
||||||
text(errorFormatter.toHumanReadable(failure))
|
text(host.errorFormatter.toHumanReadable(failure))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue