mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
Post rebase fixes
This commit is contained in:
parent
715bd29c75
commit
8a35a786b4
14 changed files with 89 additions and 111 deletions
|
@ -135,15 +135,12 @@ class SpaceCreationTest : InstrumentedTest {
|
|||
|
||||
val roomName = "My Space"
|
||||
val topic = "A public space for test"
|
||||
val spaceId: String
|
||||
val firstChild: String
|
||||
val secondChild: String
|
||||
|
||||
spaceId = runBlocking { aliceSession.spaceService().createSpace(roomName, topic, null, true) }
|
||||
val spaceId: String = runBlocking { aliceSession.spaceService().createSpace(roomName, topic, null, true) }
|
||||
val syncedSpace = aliceSession.spaceService().getSpace(spaceId)
|
||||
|
||||
// create a room
|
||||
firstChild = runBlocking {
|
||||
val firstChild: String = runBlocking {
|
||||
awaitCallback<String> {
|
||||
aliceSession.createRoom(CreateRoomParams().apply {
|
||||
this.name = "FirstRoom"
|
||||
|
@ -157,7 +154,7 @@ class SpaceCreationTest : InstrumentedTest {
|
|||
syncedSpace?.addChildren(firstChild, listOf(aliceSession.sessionParams.homeServerHost ?: ""), "a", true)
|
||||
}
|
||||
|
||||
secondChild = runBlocking {
|
||||
val secondChild: String = runBlocking {
|
||||
awaitCallback {
|
||||
aliceSession.createRoom(CreateRoomParams().apply {
|
||||
this.name = "SecondRoom"
|
||||
|
|
|
@ -327,8 +327,8 @@ class SpaceHierarchyTest : InstrumentedTest {
|
|||
}
|
||||
|
||||
// part from b room
|
||||
commonTestHelper.doSync<Unit> {
|
||||
bRoom!!.leave(null, it)
|
||||
runBlocking {
|
||||
bRoom!!.leave(null)
|
||||
}
|
||||
// The room should have disapear from flat children
|
||||
GlobalScope.launch(Dispatchers.Main) { flatAChildren.observeForever(childObserver) }
|
||||
|
@ -399,6 +399,7 @@ class SpaceHierarchyTest : InstrumentedTest {
|
|||
spaceB!!.addChildren(spaceCInfo.spaceId, viaServers, null, true)
|
||||
}
|
||||
|
||||
Thread.sleep(2000)
|
||||
// + A
|
||||
// a1, a2
|
||||
// + B
|
||||
|
|
|
@ -35,14 +35,3 @@ data class RoomHistoryVisibilityContent(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun safeHistoryVisibility(): RoomHistoryVisibility? {
|
||||
return when (historyVisibility) {
|
||||
"world_readable" -> RoomHistoryVisibility.WORLD_READABLE
|
||||
"shared" -> RoomHistoryVisibility.SHARED
|
||||
"invited" -> RoomHistoryVisibility.INVITED
|
||||
"joined" -> RoomHistoryVisibility.JOINED
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,8 +27,7 @@ interface Space {
|
|||
|
||||
val spaceId: String
|
||||
|
||||
fun leave(reason: String? = null,
|
||||
callback: MatrixCallback<Unit>): Cancelable
|
||||
suspend fun leave(reason: String? = null)
|
||||
|
||||
/**
|
||||
* A current snapshot of [RoomSummary] associated with the space
|
||||
|
|
|
@ -896,7 +896,7 @@ internal class DefaultCryptoService @Inject constructor(
|
|||
|
||||
private fun onRoomHistoryVisibilityEvent(roomId: String, event: Event) {
|
||||
val eventContent = event.content.toModel<RoomHistoryVisibilityContent>()
|
||||
eventContent?.safeHistoryVisibility()?.let {
|
||||
eventContent?.historyVisibility?.let {
|
||||
cryptoStore.setShouldEncryptForInvitedMembers(roomId, it != RoomHistoryVisibility.JOINED)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,8 @@ internal class SessionRealmConfigurationFactory @Inject constructor(
|
|||
.allowWritesOnUiThread(true)
|
||||
.modules(SessionRealmModule())
|
||||
.schemaVersion(RealmSessionStoreMigration.SESSION_STORE_SCHEMA_VERSION)
|
||||
.migration(migration)
|
||||
.deleteRealmIfMigrationNeeded()
|
||||
// .migration(migration)
|
||||
.build()
|
||||
|
||||
// Try creating a realm instance and if it succeeds we can clear the flag
|
||||
|
|
|
@ -132,7 +132,7 @@ internal class CreateRoomBodyBuilder @Inject constructor(
|
|||
Event(
|
||||
type = EventType.STATE_ROOM_GUEST_ACCESS,
|
||||
stateKey = "",
|
||||
content = RoomGuestAccessContent(it).toContent()
|
||||
content = RoomGuestAccessContent(it.name).toContent()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,8 +39,8 @@ internal class DefaultSpace(
|
|||
|
||||
override val spaceId = room.roomId
|
||||
|
||||
override fun leave(reason: String?, callback: MatrixCallback<Unit>): Cancelable {
|
||||
return room.leave(reason, callback)
|
||||
override suspend fun leave(reason: String?) {
|
||||
return room.leave(reason)
|
||||
}
|
||||
|
||||
override fun spaceSummary(): RoomSummary? {
|
||||
|
|
|
@ -42,8 +42,8 @@ import im.vector.app.features.call.dialpad.DialPadLookup
|
|||
import im.vector.app.features.call.webrtc.WebRtcCallManager
|
||||
import im.vector.app.features.command.CommandParser
|
||||
import im.vector.app.features.command.ParsedCommand
|
||||
import im.vector.app.features.crypto.keysrequest.OutboundSessionKeySharingStrategy
|
||||
import im.vector.app.features.createdirect.DirectRoomHelper
|
||||
import im.vector.app.features.crypto.keysrequest.OutboundSessionKeySharingStrategy
|
||||
import im.vector.app.features.crypto.verification.SupportedVerificationMethodsProvider
|
||||
import im.vector.app.features.home.room.detail.composer.rainbow.RainbowGenerator
|
||||
import im.vector.app.features.home.room.detail.sticker.StickerPickerActionHandler
|
||||
|
@ -98,7 +98,6 @@ import org.matrix.android.sdk.api.session.room.timeline.getLastMessageContent
|
|||
import org.matrix.android.sdk.api.session.room.timeline.getRelationContent
|
||||
import org.matrix.android.sdk.api.session.room.timeline.getTextEditableContent
|
||||
import org.matrix.android.sdk.api.session.space.CreateSpaceParams
|
||||
import org.matrix.android.sdk.api.session.widgets.model.Widget
|
||||
import org.matrix.android.sdk.api.session.widgets.model.WidgetType
|
||||
import org.matrix.android.sdk.api.util.appendParamToUrl
|
||||
import org.matrix.android.sdk.api.util.toOptional
|
||||
|
@ -876,9 +875,7 @@ class RoomDetailViewModel @AssistedInject constructor(
|
|||
is ParsedCommand.LeaveRoom -> {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
try {
|
||||
awaitCallback {
|
||||
session.getRoom(slashCommandResult.roomId)?.leave(null, it)
|
||||
}
|
||||
session.getRoom(slashCommandResult.roomId)?.leave(null)
|
||||
} catch (failure: Throwable) {
|
||||
_viewEvents.post(RoomDetailViewEvents.SlashCommandResultError(failure))
|
||||
}
|
||||
|
|
|
@ -60,21 +60,21 @@ class TimelineItemFactory @Inject constructor(private val messageItemFactory: Me
|
|||
EventType.STATE_ROOM_HISTORY_VISIBILITY,
|
||||
EventType.STATE_ROOM_SERVER_ACL,
|
||||
EventType.STATE_ROOM_GUEST_ACCESS,
|
||||
EventType.REDACTION,
|
||||
EventType.STATE_ROOM_ALIASES,
|
||||
EventType.KEY_VERIFICATION_START,
|
||||
EventType.KEY_VERIFICATION_ACCEPT,
|
||||
EventType.KEY_VERIFICATION_START,
|
||||
EventType.KEY_VERIFICATION_KEY,
|
||||
EventType.KEY_VERIFICATION_READY,
|
||||
EventType.CALL_CANDIDATES,
|
||||
EventType.KEY_VERIFICATION_MAC,
|
||||
EventType.CALL_CANDIDATES,
|
||||
EventType.CALL_REPLACES,
|
||||
EventType.CALL_SELECT_ANSWER,
|
||||
EventType.CALL_NEGOTIATE,
|
||||
EventType.REACTION,
|
||||
EventType.STATE_ROOM_POWER_LEVELS,
|
||||
EventType.STATE_SPACE_CHILD,
|
||||
EventType.STATE_SPACE_PARENT,
|
||||
EventType.REDACTION -> noticeItemFactory.create(event, highlight, callback)
|
||||
EventType.STATE_ROOM_POWER_LEVELS -> noticeItemFactory.create(params)
|
||||
EventType.STATE_ROOM_WIDGET_LEGACY,
|
||||
EventType.STATE_ROOM_WIDGET -> widgetItemFactory.create(params)
|
||||
EventType.STATE_ROOM_ENCRYPTION -> encryptionItemFactory.create(params)
|
||||
|
|
|
@ -273,7 +273,7 @@ class NoticeEventFormatter @Inject constructor(
|
|||
}
|
||||
|
||||
private fun formatRoomHistoryVisibilityEvent(event: Event, senderName: String?, rs: RoomSummary?): CharSequence? {
|
||||
val historyVisibility = event.getClearContent().toModel<RoomHistoryVisibilityContent>()?.safeHistoryVisibility() ?: return null
|
||||
val historyVisibility = event.getClearContent().toModel<RoomHistoryVisibilityContent>()?.historyVisibility ?: return null
|
||||
|
||||
val historyVisibilitySuffix = roomHistoryVisibilityFormatter.getNoticeSuffix(historyVisibility)
|
||||
return if (event.isSentByCurrentUser()) {
|
||||
|
|
|
@ -136,7 +136,7 @@ class RoomSettingsViewModel @AssistedInject constructor(@Assisted initialState:
|
|||
.mapOptional { it.content.toModel<RoomHistoryVisibilityContent>() }
|
||||
.unwrap()
|
||||
.subscribe {
|
||||
it.safeHistoryVisibility()?.let {
|
||||
it.historyVisibility?.let {
|
||||
setState { copy(currentHistoryVisibility = it) }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,6 @@ import kotlinx.coroutines.launch
|
|||
import kotlinx.parcelize.Parcelize
|
||||
import org.matrix.android.sdk.api.session.room.powerlevels.PowerLevelsHelper
|
||||
import org.matrix.android.sdk.api.util.toMatrixItem
|
||||
import org.matrix.android.sdk.internal.util.awaitCallback
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
|
@ -119,9 +118,7 @@ class SpaceSettingsMenuBottomSheet : VectorBaseBottomSheetDialogFragment<BottomS
|
|||
.setPositiveButton(R.string.leave) { _, _ ->
|
||||
GlobalScope.launch {
|
||||
try {
|
||||
awaitCallback {
|
||||
session.getRoom(spaceArgs.spaceId)?.leave(null, it)
|
||||
}
|
||||
session.getRoom(spaceArgs.spaceId)?.leave(null)
|
||||
} catch (failure: Throwable) {
|
||||
Timber.e(failure, "Failed to leave space")
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ import org.matrix.android.sdk.api.session.Session
|
|||
import org.matrix.android.sdk.api.session.room.model.Membership
|
||||
import org.matrix.android.sdk.api.session.room.model.RoomSummary
|
||||
import org.matrix.android.sdk.api.session.room.roomSummaryQueryParams
|
||||
import org.matrix.android.sdk.internal.util.awaitCallback
|
||||
import org.matrix.android.sdk.rx.rx
|
||||
|
||||
const val ALL_COMMUNITIES_GROUP_ID = "+ALL_COMMUNITIES_GROUP_ID"
|
||||
|
@ -146,10 +145,8 @@ class SpacesListViewModel @AssistedInject constructor(@Assisted initialState: Sp
|
|||
|
||||
private fun handleLeaveSpace(action: SpaceListAction.LeaveSpace) {
|
||||
viewModelScope.launch {
|
||||
awaitCallback {
|
||||
tryOrNull("Failed to leave space ${action.spaceSummary.roomId}") {
|
||||
session.spaceService().getSpace(action.spaceSummary.roomId)?.leave(null, it)
|
||||
}
|
||||
session.spaceService().getSpace(action.spaceSummary.roomId)?.leave(null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue