Move SpacePeekResult to api package, and cleanup
This commit is contained in:
parent
b4dbb389b1
commit
73d22d0622
|
@ -22,7 +22,7 @@ import org.matrix.android.sdk.api.session.events.model.Event
|
||||||
import org.matrix.android.sdk.api.session.room.RoomSortOrder
|
import org.matrix.android.sdk.api.session.room.RoomSortOrder
|
||||||
import org.matrix.android.sdk.api.session.room.RoomSummaryQueryParams
|
import org.matrix.android.sdk.api.session.room.RoomSummaryQueryParams
|
||||||
import org.matrix.android.sdk.api.session.room.model.RoomSummary
|
import org.matrix.android.sdk.api.session.room.model.RoomSummary
|
||||||
import org.matrix.android.sdk.internal.session.space.peeking.SpacePeekResult
|
import org.matrix.android.sdk.api.session.space.peeking.SpacePeekResult
|
||||||
|
|
||||||
typealias SpaceSummaryQueryParams = RoomSummaryQueryParams
|
typealias SpaceSummaryQueryParams = RoomSummaryQueryParams
|
||||||
|
|
||||||
|
|
|
@ -14,11 +14,18 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.matrix.android.sdk.internal.session.space.peeking
|
package org.matrix.android.sdk.api.session.space.peeking
|
||||||
|
|
||||||
import org.matrix.android.sdk.api.session.room.peeking.PeekResult
|
import org.matrix.android.sdk.api.session.room.peeking.PeekResult
|
||||||
|
|
||||||
// TODO Move to api package
|
sealed class SpacePeekResult {
|
||||||
|
abstract class SpacePeekError : SpacePeekResult()
|
||||||
|
data class FailedToResolve(val spaceId: String, val roomPeekResult: PeekResult) : SpacePeekError()
|
||||||
|
data class NotSpaceType(val spaceId: String) : SpacePeekError()
|
||||||
|
|
||||||
|
data class Success(val summary: SpacePeekSummary) : SpacePeekResult()
|
||||||
|
}
|
||||||
|
|
||||||
data class SpacePeekSummary(
|
data class SpacePeekSummary(
|
||||||
val idOrAlias: String,
|
val idOrAlias: String,
|
||||||
val roomPeekResult: PeekResult.Success,
|
val roomPeekResult: PeekResult.Success,
|
||||||
|
@ -28,30 +35,18 @@ data class SpacePeekSummary(
|
||||||
interface ISpaceChild {
|
interface ISpaceChild {
|
||||||
val id: String
|
val id: String
|
||||||
val roomPeekResult: PeekResult
|
val roomPeekResult: PeekResult
|
||||||
|
|
||||||
// val default: Boolean?
|
|
||||||
val order: String?
|
val order: String?
|
||||||
}
|
}
|
||||||
|
|
||||||
data class SpaceChildPeekResult(
|
data class SpaceChildPeekResult(
|
||||||
override val id: String,
|
override val id: String,
|
||||||
override val roomPeekResult: PeekResult,
|
override val roomPeekResult: PeekResult,
|
||||||
// override val default: Boolean? = null,
|
|
||||||
override val order: String? = null
|
override val order: String? = null
|
||||||
) : ISpaceChild
|
) : ISpaceChild
|
||||||
|
|
||||||
data class SpaceSubChildPeekResult(
|
data class SpaceSubChildPeekResult(
|
||||||
override val id: String,
|
override val id: String,
|
||||||
override val roomPeekResult: PeekResult,
|
override val roomPeekResult: PeekResult,
|
||||||
// override val default: Boolean?,
|
|
||||||
override val order: String?,
|
override val order: String?,
|
||||||
val children: List<ISpaceChild>
|
val children: List<ISpaceChild>
|
||||||
) : ISpaceChild
|
) : ISpaceChild
|
||||||
|
|
||||||
sealed class SpacePeekResult {
|
|
||||||
abstract class SpacePeekError : SpacePeekResult()
|
|
||||||
data class FailedToResolve(val spaceId: String, val roomPeekResult: PeekResult) : SpacePeekError()
|
|
||||||
data class NotSpaceType(val spaceId: String) : SpacePeekError()
|
|
||||||
|
|
||||||
data class Success(val summary: SpacePeekSummary) : SpacePeekResult()
|
|
||||||
}
|
|
|
@ -43,6 +43,7 @@ import org.matrix.android.sdk.api.session.space.SpaceService
|
||||||
import org.matrix.android.sdk.api.session.space.SpaceSummaryQueryParams
|
import org.matrix.android.sdk.api.session.space.SpaceSummaryQueryParams
|
||||||
import org.matrix.android.sdk.api.session.space.model.SpaceChildContent
|
import org.matrix.android.sdk.api.session.space.model.SpaceChildContent
|
||||||
import org.matrix.android.sdk.api.session.space.model.SpaceParentContent
|
import org.matrix.android.sdk.api.session.space.model.SpaceParentContent
|
||||||
|
import org.matrix.android.sdk.api.session.space.peeking.SpacePeekResult
|
||||||
import org.matrix.android.sdk.internal.di.UserId
|
import org.matrix.android.sdk.internal.di.UserId
|
||||||
import org.matrix.android.sdk.internal.session.room.RoomGetter
|
import org.matrix.android.sdk.internal.session.room.RoomGetter
|
||||||
import org.matrix.android.sdk.internal.session.room.SpaceGetter
|
import org.matrix.android.sdk.internal.session.room.SpaceGetter
|
||||||
|
@ -51,7 +52,6 @@ import org.matrix.android.sdk.internal.session.room.membership.leaving.LeaveRoom
|
||||||
import org.matrix.android.sdk.internal.session.room.state.StateEventDataSource
|
import org.matrix.android.sdk.internal.session.room.state.StateEventDataSource
|
||||||
import org.matrix.android.sdk.internal.session.room.summary.RoomSummaryDataSource
|
import org.matrix.android.sdk.internal.session.room.summary.RoomSummaryDataSource
|
||||||
import org.matrix.android.sdk.internal.session.space.peeking.PeekSpaceTask
|
import org.matrix.android.sdk.internal.session.space.peeking.PeekSpaceTask
|
||||||
import org.matrix.android.sdk.internal.session.space.peeking.SpacePeekResult
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
internal class DefaultSpaceService @Inject constructor(
|
internal class DefaultSpaceService @Inject constructor(
|
||||||
|
|
|
@ -23,6 +23,11 @@ import org.matrix.android.sdk.api.session.room.model.RoomType
|
||||||
import org.matrix.android.sdk.api.session.room.model.create.RoomCreateContent
|
import org.matrix.android.sdk.api.session.room.model.create.RoomCreateContent
|
||||||
import org.matrix.android.sdk.api.session.room.peeking.PeekResult
|
import org.matrix.android.sdk.api.session.room.peeking.PeekResult
|
||||||
import org.matrix.android.sdk.api.session.space.model.SpaceChildContent
|
import org.matrix.android.sdk.api.session.space.model.SpaceChildContent
|
||||||
|
import org.matrix.android.sdk.api.session.space.peeking.ISpaceChild
|
||||||
|
import org.matrix.android.sdk.api.session.space.peeking.SpaceChildPeekResult
|
||||||
|
import org.matrix.android.sdk.api.session.space.peeking.SpacePeekResult
|
||||||
|
import org.matrix.android.sdk.api.session.space.peeking.SpacePeekSummary
|
||||||
|
import org.matrix.android.sdk.api.session.space.peeking.SpaceSubChildPeekResult
|
||||||
import org.matrix.android.sdk.internal.session.room.peeking.PeekRoomTask
|
import org.matrix.android.sdk.internal.session.room.peeking.PeekRoomTask
|
||||||
import org.matrix.android.sdk.internal.session.room.peeking.ResolveRoomStateTask
|
import org.matrix.android.sdk.internal.session.room.peeking.ResolveRoomStateTask
|
||||||
import org.matrix.android.sdk.internal.task.Task
|
import org.matrix.android.sdk.internal.task.Task
|
||||||
|
|
|
@ -35,8 +35,8 @@ import org.matrix.android.sdk.api.session.Session
|
||||||
import org.matrix.android.sdk.api.session.room.model.RoomType
|
import org.matrix.android.sdk.api.session.room.model.RoomType
|
||||||
import org.matrix.android.sdk.api.session.room.peeking.PeekResult
|
import org.matrix.android.sdk.api.session.room.peeking.PeekResult
|
||||||
import org.matrix.android.sdk.api.session.space.JoinSpaceResult
|
import org.matrix.android.sdk.api.session.space.JoinSpaceResult
|
||||||
import org.matrix.android.sdk.internal.session.space.peeking.SpacePeekResult
|
import org.matrix.android.sdk.api.session.space.peeking.SpacePeekResult
|
||||||
import org.matrix.android.sdk.internal.session.space.peeking.SpaceSubChildPeekResult
|
import org.matrix.android.sdk.api.session.space.peeking.SpaceSubChildPeekResult
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
|
||||||
class SpacePreviewViewModel @AssistedInject constructor(
|
class SpacePreviewViewModel @AssistedInject constructor(
|
||||||
|
|
Loading…
Reference in New Issue