Move the class RoomDirectoryData form the SDK to the app

This commit is contained in:
Benoit Marty 2021-05-26 16:08:56 +02:00
parent 65f8546268
commit 64222ff704
10 changed files with 13 additions and 17 deletions

View file

@ -65,6 +65,7 @@ import im.vector.app.features.pin.PinActivity
import im.vector.app.features.pin.PinArgs import im.vector.app.features.pin.PinArgs
import im.vector.app.features.pin.PinMode import im.vector.app.features.pin.PinMode
import im.vector.app.features.roomdirectory.RoomDirectoryActivity import im.vector.app.features.roomdirectory.RoomDirectoryActivity
import im.vector.app.features.roomdirectory.RoomDirectoryData
import im.vector.app.features.roomdirectory.createroom.CreateRoomActivity import im.vector.app.features.roomdirectory.createroom.CreateRoomActivity
import im.vector.app.features.roomdirectory.roompreview.RoomPreviewActivity import im.vector.app.features.roomdirectory.roompreview.RoomPreviewActivity
import im.vector.app.features.roomdirectory.roompreview.RoomPreviewData import im.vector.app.features.roomdirectory.roompreview.RoomPreviewData
@ -86,7 +87,6 @@ import im.vector.app.features.widgets.WidgetArgsBuilder
import im.vector.app.space import im.vector.app.space
import org.matrix.android.sdk.api.session.crypto.verification.IncomingSasVerificationTransaction import org.matrix.android.sdk.api.session.crypto.verification.IncomingSasVerificationTransaction
import org.matrix.android.sdk.api.session.room.model.roomdirectory.PublicRoom import org.matrix.android.sdk.api.session.room.model.roomdirectory.PublicRoom
import org.matrix.android.sdk.api.session.room.model.thirdparty.RoomDirectoryData
import org.matrix.android.sdk.api.session.terms.TermsService import org.matrix.android.sdk.api.session.terms.TermsService
import org.matrix.android.sdk.api.session.widgets.model.Widget 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.session.widgets.model.WidgetType
@ -129,7 +129,7 @@ class DefaultNavigator @Inject constructor(
} }
appStateHandler.setCurrentSpace(spaceId) appStateHandler.setCurrentSpace(spaceId)
when (postSwitchSpaceAction) { when (postSwitchSpaceAction) {
Navigator.PostSwitchSpaceAction.None -> { Navigator.PostSwitchSpaceAction.None -> {
// go back to home if we are showing room details? // go back to home if we are showing room details?
// This is a bit ugly, but the navigator is supposed to know about the activity stack // This is a bit ugly, but the navigator is supposed to know about the activity stack
if (context is RoomDetailActivity) { if (context is RoomDetailActivity) {
@ -139,7 +139,7 @@ class DefaultNavigator @Inject constructor(
Navigator.PostSwitchSpaceAction.OpenAddExistingRooms -> { Navigator.PostSwitchSpaceAction.OpenAddExistingRooms -> {
startActivity(context, SpaceManageActivity.newIntent(context, spaceId, ManageType.AddRooms), false) startActivity(context, SpaceManageActivity.newIntent(context, spaceId, ManageType.AddRooms), false)
} }
is Navigator.PostSwitchSpaceAction.OpenDefaultRoom -> { is Navigator.PostSwitchSpaceAction.OpenDefaultRoom -> {
val args = RoomDetailArgs( val args = RoomDetailArgs(
postSwitchSpaceAction.roomId, postSwitchSpaceAction.roomId,
eventId = null, eventId = null,
@ -278,7 +278,7 @@ class DefaultNavigator @Inject constructor(
val intent = RoomDirectoryActivity.getIntent(context, initialFilter) val intent = RoomDirectoryActivity.getIntent(context, initialFilter)
context.startActivity(intent) context.startActivity(intent)
} }
is RoomGroupingMethod.BySpace -> { is RoomGroupingMethod.BySpace -> {
val selectedSpace = groupingMethod.space() val selectedSpace = groupingMethod.space()
if (selectedSpace == null) { if (selectedSpace == null) {
val intent = RoomDirectoryActivity.getIntent(context, initialFilter) val intent = RoomDirectoryActivity.getIntent(context, initialFilter)
@ -320,7 +320,7 @@ class DefaultNavigator @Inject constructor(
val intent = InviteUsersToRoomActivity.getIntent(context, roomId) val intent = InviteUsersToRoomActivity.getIntent(context, roomId)
context.startActivity(intent) context.startActivity(intent)
} }
is RoomGroupingMethod.BySpace -> { is RoomGroupingMethod.BySpace -> {
if (currentGroupingMethod.spaceSummary != null) { if (currentGroupingMethod.spaceSummary != null) {
// let user decides if he does it from space or room // let user decides if he does it from space or room
(context as? AppCompatActivity)?.supportFragmentManager?.let { fm -> (context as? AppCompatActivity)?.supportFragmentManager?.let { fm ->

View file

@ -26,11 +26,11 @@ import im.vector.app.features.crypto.recover.SetupMode
import im.vector.app.features.login.LoginConfig import im.vector.app.features.login.LoginConfig
import im.vector.app.features.media.AttachmentData import im.vector.app.features.media.AttachmentData
import im.vector.app.features.pin.PinMode import im.vector.app.features.pin.PinMode
import im.vector.app.features.roomdirectory.RoomDirectoryData
import im.vector.app.features.roomdirectory.roompreview.RoomPreviewData import im.vector.app.features.roomdirectory.roompreview.RoomPreviewData
import im.vector.app.features.settings.VectorSettingsActivity import im.vector.app.features.settings.VectorSettingsActivity
import im.vector.app.features.share.SharedData import im.vector.app.features.share.SharedData
import org.matrix.android.sdk.api.session.room.model.roomdirectory.PublicRoom import org.matrix.android.sdk.api.session.room.model.roomdirectory.PublicRoom
import org.matrix.android.sdk.api.session.room.model.thirdparty.RoomDirectoryData
import org.matrix.android.sdk.api.session.terms.TermsService import org.matrix.android.sdk.api.session.terms.TermsService
import org.matrix.android.sdk.api.session.widgets.model.Widget import org.matrix.android.sdk.api.session.widgets.model.Widget
import org.matrix.android.sdk.api.util.MatrixItem import org.matrix.android.sdk.api.util.MatrixItem
@ -44,7 +44,7 @@ interface Navigator {
sealed class PostSwitchSpaceAction { sealed class PostSwitchSpaceAction {
object None : PostSwitchSpaceAction() object None : PostSwitchSpaceAction()
data class OpenDefaultRoom(val roomId: String, val showShareSheet: Boolean) : PostSwitchSpaceAction() data class OpenDefaultRoom(val roomId: String, val showShareSheet: Boolean) : PostSwitchSpaceAction()
object OpenAddExistingRooms: PostSwitchSpaceAction() object OpenAddExistingRooms : PostSwitchSpaceAction()
} }
fun switchToSpace(context: Context, spaceId: String, postSwitchSpaceAction: PostSwitchSpaceAction) fun switchToSpace(context: Context, spaceId: String, postSwitchSpaceAction: PostSwitchSpaceAction)

View file

@ -21,7 +21,6 @@ import com.airbnb.mvrx.MvRxState
import com.airbnb.mvrx.Uninitialized import com.airbnb.mvrx.Uninitialized
import org.matrix.android.sdk.api.session.room.members.ChangeMembershipState import org.matrix.android.sdk.api.session.room.members.ChangeMembershipState
import org.matrix.android.sdk.api.session.room.model.roomdirectory.PublicRoom import org.matrix.android.sdk.api.session.room.model.roomdirectory.PublicRoom
import org.matrix.android.sdk.api.session.room.model.thirdparty.RoomDirectoryData
data class PublicRoomsViewState( data class PublicRoomsViewState(
// The current filter // The current filter

View file

@ -17,7 +17,6 @@
package im.vector.app.features.roomdirectory package im.vector.app.features.roomdirectory
import im.vector.app.core.platform.VectorViewModelAction import im.vector.app.core.platform.VectorViewModelAction
import org.matrix.android.sdk.api.session.room.model.thirdparty.RoomDirectoryData
sealed class RoomDirectoryAction : VectorViewModelAction { sealed class RoomDirectoryAction : VectorViewModelAction {
data class SetRoomDirectoryData(val roomDirectoryData: RoomDirectoryData) : RoomDirectoryAction() data class SetRoomDirectoryData(val roomDirectoryData: RoomDirectoryData) : RoomDirectoryAction()

View file

@ -1,5 +1,5 @@
/* /*
* Copyright 2020 The Matrix.org Foundation C.I.C. * Copyright (c) 2021 New Vector Ltd
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.matrix.android.sdk.api.session.room.model.thirdparty package im.vector.app.features.roomdirectory
/** /**
* This class describes a rooms directory server. * This class describes a rooms directory server.

View file

@ -37,7 +37,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.Membership
import org.matrix.android.sdk.api.session.room.model.roomdirectory.PublicRoomsFilter import org.matrix.android.sdk.api.session.room.model.roomdirectory.PublicRoomsFilter
import org.matrix.android.sdk.api.session.room.model.roomdirectory.PublicRoomsParams import org.matrix.android.sdk.api.session.room.model.roomdirectory.PublicRoomsParams
import org.matrix.android.sdk.api.session.room.model.thirdparty.RoomDirectoryData
import org.matrix.android.sdk.api.session.room.roomSummaryQueryParams import org.matrix.android.sdk.api.session.room.roomSummaryQueryParams
import org.matrix.android.sdk.rx.rx import org.matrix.android.sdk.rx.rx
import timber.log.Timber import timber.log.Timber

View file

@ -18,8 +18,8 @@ package im.vector.app.features.roomdirectory.picker
import im.vector.app.R import im.vector.app.R
import im.vector.app.core.resources.StringArrayProvider import im.vector.app.core.resources.StringArrayProvider
import im.vector.app.features.roomdirectory.RoomDirectoryData
import org.matrix.android.sdk.api.session.Session import org.matrix.android.sdk.api.session.Session
import org.matrix.android.sdk.api.session.room.model.thirdparty.RoomDirectoryData
import org.matrix.android.sdk.api.session.room.model.thirdparty.ThirdPartyProtocol import org.matrix.android.sdk.api.session.room.model.thirdparty.ThirdPartyProtocol
import javax.inject.Inject import javax.inject.Inject

View file

@ -25,7 +25,7 @@ import im.vector.app.core.epoxy.errorWithRetryItem
import im.vector.app.core.epoxy.loadingItem import im.vector.app.core.epoxy.loadingItem
import im.vector.app.core.error.ErrorFormatter import im.vector.app.core.error.ErrorFormatter
import im.vector.app.core.resources.StringProvider import im.vector.app.core.resources.StringProvider
import org.matrix.android.sdk.api.session.room.model.thirdparty.RoomDirectoryData import im.vector.app.features.roomdirectory.RoomDirectoryData
import javax.inject.Inject import javax.inject.Inject
class RoomDirectoryPickerController @Inject constructor(private val stringProvider: StringProvider, class RoomDirectoryPickerController @Inject constructor(private val stringProvider: StringProvider,

View file

@ -31,11 +31,10 @@ import im.vector.app.core.extensions.configureWith
import im.vector.app.core.platform.VectorBaseFragment import im.vector.app.core.platform.VectorBaseFragment
import im.vector.app.databinding.FragmentRoomDirectoryPickerBinding import im.vector.app.databinding.FragmentRoomDirectoryPickerBinding
import im.vector.app.features.roomdirectory.RoomDirectoryAction import im.vector.app.features.roomdirectory.RoomDirectoryAction
import im.vector.app.features.roomdirectory.RoomDirectoryData
import im.vector.app.features.roomdirectory.RoomDirectorySharedAction import im.vector.app.features.roomdirectory.RoomDirectorySharedAction
import im.vector.app.features.roomdirectory.RoomDirectorySharedActionViewModel import im.vector.app.features.roomdirectory.RoomDirectorySharedActionViewModel
import im.vector.app.features.roomdirectory.RoomDirectoryViewModel import im.vector.app.features.roomdirectory.RoomDirectoryViewModel
import org.matrix.android.sdk.api.session.room.model.thirdparty.RoomDirectoryData
import timber.log.Timber import timber.log.Timber
import javax.inject.Inject import javax.inject.Inject

View file

@ -25,9 +25,9 @@ import im.vector.app.core.extensions.addFragment
import im.vector.app.core.platform.ToolbarConfigurable import im.vector.app.core.platform.ToolbarConfigurable
import im.vector.app.core.platform.VectorBaseActivity import im.vector.app.core.platform.VectorBaseActivity
import im.vector.app.databinding.ActivitySimpleBinding import im.vector.app.databinding.ActivitySimpleBinding
import im.vector.app.features.roomdirectory.RoomDirectoryData
import kotlinx.parcelize.Parcelize import kotlinx.parcelize.Parcelize
import org.matrix.android.sdk.api.session.room.model.roomdirectory.PublicRoom import org.matrix.android.sdk.api.session.room.model.roomdirectory.PublicRoom
import org.matrix.android.sdk.api.session.room.model.thirdparty.RoomDirectoryData
import org.matrix.android.sdk.api.util.MatrixItem import org.matrix.android.sdk.api.util.MatrixItem
import timber.log.Timber import timber.log.Timber