WIP review

This commit is contained in:
Valere 2020-11-13 09:27:34 +01:00 committed by Benoit Marty
parent 2626a761ea
commit 264bc52bcc
5 changed files with 16 additions and 18 deletions

View File

@ -17,6 +17,9 @@
package org.matrix.android.sdk.internal.session.room.alias package org.matrix.android.sdk.internal.session.room.alias
import com.zhuinden.monarchy.Monarchy import com.zhuinden.monarchy.Monarchy
import io.realm.Realm
import org.greenrobot.eventbus.EventBus
import org.matrix.android.sdk.api.extensions.tryOrNull
import org.matrix.android.sdk.api.util.Optional import org.matrix.android.sdk.api.util.Optional
import org.matrix.android.sdk.internal.database.model.RoomSummaryEntity import org.matrix.android.sdk.internal.database.model.RoomSummaryEntity
import org.matrix.android.sdk.internal.database.query.findByAlias import org.matrix.android.sdk.internal.database.query.findByAlias
@ -24,9 +27,6 @@ import org.matrix.android.sdk.internal.di.SessionDatabase
import org.matrix.android.sdk.internal.network.executeRequest import org.matrix.android.sdk.internal.network.executeRequest
import org.matrix.android.sdk.internal.session.room.RoomAPI import org.matrix.android.sdk.internal.session.room.RoomAPI
import org.matrix.android.sdk.internal.task.Task import org.matrix.android.sdk.internal.task.Task
import io.realm.Realm
import org.greenrobot.eventbus.EventBus
import timber.log.Timber
import javax.inject.Inject import javax.inject.Inject
internal interface GetRoomIdByAliasTask : Task<GetRoomIdByAliasTask.Params, Optional<String>> { internal interface GetRoomIdByAliasTask : Task<GetRoomIdByAliasTask.Params, Optional<String>> {
@ -51,14 +51,11 @@ internal class DefaultGetRoomIdByAliasTask @Inject constructor(
} else if (!params.searchOnServer) { } else if (!params.searchOnServer) {
Optional.from<String>(null) Optional.from<String>(null)
} else { } else {
roomId = try { roomId = tryOrNull("## Failed to get roomId from alias") {
executeRequest<RoomAliasDescription>(eventBus) { executeRequest<RoomAliasDescription>(eventBus) {
apiCall = roomAPI.getRoomIdByAlias(params.roomAlias) apiCall = roomAPI.getRoomIdByAlias(params.roomAlias)
}.roomId }
} catch (throwable: Throwable) { }?.roomId
Timber.d(throwable, "## Failed to get roomId from alias")
null
}
Optional.from(roomId) Optional.from(roomId)
} }
} }

View File

@ -155,12 +155,13 @@ abstract class MergedRoomCreationItem : BasedMergedItem<MergedRoomCreationItem.H
})) }))
} }
} else { } else {
holder.roomTopicText.setTextOrHide(span { holder.roomTopicText.setTextOrHide(
span(holder.view.resources.getString(R.string.topic_prefix)) { span {
textStyle = "bold" span(holder.view.resources.getString(R.string.topic_prefix)) {
} textStyle = "bold"
+topic.linkify(attributes.callback) }
} +topic.linkify(attributes.callback)
}
) )
} }
holder.roomTopicText.movementMethod = movementMethod holder.roomTopicText.movementMethod = movementMethod

View File

@ -161,7 +161,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(RRstringProvider.getString(R.string.room_profile_not_encrypted_subtitle))
centered(false) centered(false)
} }
} }

View File

@ -104,7 +104,7 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/roomNameDescriptionText" app:layout_constraintTop_toBottomOf="@id/roomNameDescriptionText"
tools:text="Add a topic to let people know what this room is about. " /> tools:text="@string/room_created_summary_no_topic_creation_text" />
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout

View File

@ -2407,7 +2407,7 @@
<string name="this_is_the_beginning_of_room_no_name">This is the beginning of this conversation.</string> <string name="this_is_the_beginning_of_room_no_name">This is the beginning of this conversation.</string>
<string name="this_is_the_beginning_of_dm">This is the beginning of your direct message history with %s.</string> <string name="this_is_the_beginning_of_dm">This is the beginning of your direct message history with %s.</string>
<!-- First param will be replaced by the value of add_a_topic_link_text, that will be clickable--> <!-- First param will be replaced by the value of add_a_topic_link_text, that will be clickable-->
<string name="room_created_summary_no_topic_creation_text">%s to let people know what this room is about. </string> <string name="room_created_summary_no_topic_creation_text">%s to let people know what this room is about.</string>
<string name="add_a_topic_link_text">Add a topic</string> <string name="add_a_topic_link_text">Add a topic</string>
<string name="topic_prefix">"Topic: "</string> <string name="topic_prefix">"Topic: "</string>