diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/space/SpaceHierarchySummary.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/space/SpaceHierarchyData.kt similarity index 96% rename from matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/space/SpaceHierarchySummary.kt rename to matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/space/SpaceHierarchyData.kt index 481d6867ca..ecc3eb5224 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/space/SpaceHierarchySummary.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/space/SpaceHierarchyData.kt @@ -20,7 +20,7 @@ import org.matrix.android.sdk.api.session.events.model.Event import org.matrix.android.sdk.api.session.room.model.RoomSummary import org.matrix.android.sdk.api.session.room.model.SpaceChildInfo -data class SpaceHierarchySummary( +data class SpaceHierarchyData( val rootSummary: RoomSummary, val children: List, val childrenState: List, diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/space/SpaceService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/space/SpaceService.kt index 5a8a0398f7..bcc36b579a 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/space/SpaceService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/space/SpaceService.kt @@ -21,7 +21,6 @@ import androidx.lifecycle.LiveData import org.matrix.android.sdk.api.session.events.model.Event import org.matrix.android.sdk.api.session.room.RoomSummaryQueryParams import org.matrix.android.sdk.api.session.room.model.RoomSummary -import org.matrix.android.sdk.internal.session.space.SpaceHierarchySummary import org.matrix.android.sdk.internal.session.space.peeking.SpacePeekResult typealias SpaceSummaryQueryParams = RoomSummaryQueryParams @@ -61,7 +60,6 @@ interface SpaceService { * Get's information of a space by querying the server * @param suggestedOnly If true, return only child events and rooms where the m.space.child event has suggested: true. * @param limit a client-defined limit to the maximum number of rooms to return per page. Must be a non-negative integer. - * @param maxDepth: Optional: The maximum depth in the tree (from the root room) to return. * @param from: Optional. Pagination token given to retrieve the next set of rooms. Note that if a pagination token is provided, * then the parameters given for suggested_only and max_depth must be the same. */ @@ -70,7 +68,7 @@ interface SpaceService { limit: Int? = null, from: String? = null, // when paginating, pass back the m.space.child state events - knownStateList: List? = null): SpaceHierarchySummary + knownStateList: List? = null): SpaceHierarchyData /** * Get a live list of space summaries. This list is refreshed as soon as the data changes. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/DefaultSpaceService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/DefaultSpaceService.kt index e23179b9e8..7be4cdcda9 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/DefaultSpaceService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/DefaultSpaceService.kt @@ -36,6 +36,7 @@ import org.matrix.android.sdk.api.session.room.powerlevels.PowerLevelsHelper import org.matrix.android.sdk.api.session.space.CreateSpaceParams import org.matrix.android.sdk.api.session.space.JoinSpaceResult import org.matrix.android.sdk.api.session.space.Space +import org.matrix.android.sdk.api.session.space.SpaceHierarchyData 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.model.SpaceChildContent @@ -112,7 +113,7 @@ internal class DefaultSpaceService @Inject constructor( suggestedOnly: Boolean?, limit: Int?, from: String?, - knownStateList: List?): SpaceHierarchySummary { + knownStateList: List?): SpaceHierarchyData { return resolveSpaceInfoTask.execute( ResolveSpaceInfoTask.Params( spaceId = spaceId, limit = limit, maxDepth = 1, from = from, suggestedOnly = suggestedOnly @@ -164,7 +165,7 @@ internal class DefaultSpaceService @Inject constructor( }.orEmpty() } .orEmpty() - SpaceHierarchySummary( + SpaceHierarchyData( rootSummary = root, children = children, childrenState = spaceDesc?.childrenState.orEmpty(), diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/SpaceApi.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/SpaceApi.kt index 43958fd556..edd10bc2ef 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/SpaceApi.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/SpaceApi.kt @@ -24,10 +24,10 @@ import retrofit2.http.Query internal interface SpaceApi { /** + * @param suggestedOnly Optional. If true, return only child events and rooms where the m.space.child event has suggested: true. * @param limit: Optional: a client-defined limit to the maximum number of rooms to return per page. Must be a non-negative integer. - * @param max_depth: Optional: The maximum depth in the tree (from the root room) to return. + * @param maxDepth: Optional: The maximum depth in the tree (from the root room) to return. * The deepest depth returned will not include children events. Defaults to no-limit. Must be a non-negative integer. - * * @param from: Optional. Pagination token given to retrieve the next set of rooms. * Note that if a pagination token is provided, then the parameters given for suggested_only and max_depth must be the same. */ diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/SpaceChildSummaryResponse.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/SpaceChildSummaryResponse.kt index 7188e77c4f..e0f273d0c2 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/SpaceChildSummaryResponse.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/space/SpaceChildSummaryResponse.kt @@ -24,7 +24,7 @@ import org.matrix.android.sdk.api.session.events.model.Event * The fields are the same as those returned by /publicRooms (see spec), with the addition of: * room_type: the value of the m.type field from the room's m.room.create event, if any. * children_state: The m.space.child events of the room. - * For each event, only the following fields are included1: type, state_key, content, room_id, sender, + * For each event, only the following fields are included: type, state_key, content, room_id, sender, * with the addition of: origin_server_ts: This is required for sorting of rooms as specified below. */ @JsonClass(generateAdapter = true) diff --git a/vector/src/main/java/im/vector/app/features/matrixto/SpaceCardRenderer.kt b/vector/src/main/java/im/vector/app/features/matrixto/SpaceCardRenderer.kt index 88d65e23b1..00d107513c 100644 --- a/vector/src/main/java/im/vector/app/features/matrixto/SpaceCardRenderer.kt +++ b/vector/src/main/java/im/vector/app/features/matrixto/SpaceCardRenderer.kt @@ -62,7 +62,7 @@ class SpaceCardRenderer @Inject constructor( inCard.matrixToAccessImage.isVisible = true inCard.matrixToAccessImage.setImageResource(R.drawable.ic_room_private) } - val memberCount = spaceSummary.joinedMembersCount?.let { it - 1 } ?: 0 + val memberCount = spaceSummary.joinedMembersCount ?: 0 if (memberCount != 0) { inCard.matrixToMemberPills.isVisible = true inCard.spaceChildMemberCountText.text = stringProvider.getQuantityString(R.plurals.room_title_members, memberCount, memberCount) diff --git a/vector/src/main/java/im/vector/app/features/spaces/explore/SpaceDirectoryController.kt b/vector/src/main/java/im/vector/app/features/spaces/explore/SpaceDirectoryController.kt index c76eec257b..4aa4256857 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/explore/SpaceDirectoryController.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/explore/SpaceDirectoryController.kt @@ -175,7 +175,7 @@ class SpaceDirectoryController @Inject constructor( errorWithRetryItem { id("error_${currentRootId}_${hierarchySummary.nextToken}") text(host.errorFormatter.toHumanReadable(paginationStatus.error)) - listener { host.listener?.retry() } + listener { host.listener?.loadAdditionalItemsIfNeeded() } } } else { loadingItem { diff --git a/vector/src/main/java/im/vector/app/features/spaces/explore/SpaceDirectoryState.kt b/vector/src/main/java/im/vector/app/features/spaces/explore/SpaceDirectoryState.kt index f762ac7629..33b494075d 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/explore/SpaceDirectoryState.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/explore/SpaceDirectoryState.kt @@ -21,13 +21,13 @@ import com.airbnb.mvrx.MvRxState import org.matrix.android.sdk.api.session.room.members.ChangeMembershipState import org.matrix.android.sdk.api.session.room.model.RoomSummary import org.matrix.android.sdk.api.session.room.model.SpaceChildInfo -import org.matrix.android.sdk.internal.session.space.SpaceHierarchySummary +import org.matrix.android.sdk.api.session.space.SpaceHierarchyData data class SpaceDirectoryState( // The current filter val spaceId: String, val currentFilter: String = "", - val apiResults: Map> = emptyMap(), + val apiResults: Map> = emptyMap(), val currentRootSummary: RoomSummary? = null, val childList: List = emptyList(), val hierarchyStack: List = emptyList(), @@ -37,7 +37,7 @@ data class SpaceDirectoryState( val changeMembershipStates: Map = emptyMap(), val canAddRooms: Boolean = false, // cached room summaries of known rooms, we use it because computed room name would be better using it - val knownRoomSummaries : List = emptyList(), + val knownRoomSummaries: List = emptyList(), val paginationStatus: Map> = emptyMap() ) : MvRxState { constructor(args: SpaceDirectoryArgs) : this( diff --git a/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceManageRoomViewState.kt b/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceManageRoomViewState.kt index 064a561aa0..34173828a7 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceManageRoomViewState.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceManageRoomViewState.kt @@ -20,18 +20,18 @@ import com.airbnb.mvrx.Async import com.airbnb.mvrx.MvRxState import com.airbnb.mvrx.Uninitialized import org.matrix.android.sdk.api.session.room.model.RoomSummary -import org.matrix.android.sdk.internal.session.space.SpaceHierarchySummary +import org.matrix.android.sdk.api.session.space.SpaceHierarchyData data class SpaceManageRoomViewState( val spaceId: String, val spaceSummary: Async = Uninitialized, - val childrenInfo: Async = Uninitialized, + val childrenInfo: Async = Uninitialized, val selectedRooms: List = emptyList(), val currentFilter: String = "", val actionState: Async = Uninitialized, val paginationStatus: Async = Uninitialized, // cached room summaries of known rooms, we use it because computed room name would be better using it - val knownRoomSummaries : List = emptyList() + val knownRoomSummaries: List = emptyList() ) : MvRxState { constructor(args: SpaceManageArgs) : this( spaceId = args.spaceId diff --git a/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceManageRoomsController.kt b/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceManageRoomsController.kt index dadcf9d826..f9dfec8f40 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceManageRoomsController.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceManageRoomsController.kt @@ -101,7 +101,7 @@ class SpaceManageRoomsController @Inject constructor( errorWithRetryItem { id("error_$nextToken") text(host.errorFormatter.toHumanReadable(paginationStatus.error)) - listener { host.listener?.retry() } + listener { host.listener?.loadAdditionalItemsIfNeeded() } } } else { loadingItem {