Skip to content

Commit

Permalink
legacy groups removal (#6268)
Browse files Browse the repository at this point in the history
  • Loading branch information
fedrunov authored Jul 15, 2022
1 parent 92801f6 commit c7b54b8
Show file tree
Hide file tree
Showing 90 changed files with 749 additions and 3,037 deletions.
1 change: 1 addition & 0 deletions changelog.d/5733.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Communities/Groups are removed completely
1 change: 1 addition & 0 deletions changelog.d/5733.sdk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Communities/Groups are removed completely
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ import org.matrix.android.sdk.api.session.crypto.crosssigning.MXCrossSigningInfo
import org.matrix.android.sdk.api.session.crypto.crosssigning.PrivateKeysInfo
import org.matrix.android.sdk.api.session.crypto.model.CryptoDeviceInfo
import org.matrix.android.sdk.api.session.crypto.model.DeviceInfo
import org.matrix.android.sdk.api.session.group.GroupSummaryQueryParams
import org.matrix.android.sdk.api.session.group.model.GroupSummary
import org.matrix.android.sdk.api.session.identity.ThreePid
import org.matrix.android.sdk.api.session.pushers.Pusher
import org.matrix.android.sdk.api.session.room.RoomSortOrder
Expand Down Expand Up @@ -59,13 +57,6 @@ class FlowSession(private val session: Session) {
}
}

fun liveGroupSummaries(queryParams: GroupSummaryQueryParams): Flow<List<GroupSummary>> {
return session.groupService().getGroupSummariesLive(queryParams).asFlow()
.startWith(session.coroutineDispatchers.io) {
session.groupService().getGroupSummaries(queryParams)
}
}

fun liveSpaceSummaries(queryParams: SpaceSummaryQueryParams): Flow<List<RoomSummary>> {
return session.spaceService().getSpaceSummariesLive(queryParams).asFlow()
.startWith(session.coroutineDispatchers.io) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import org.matrix.android.sdk.api.session.crypto.CryptoService
import org.matrix.android.sdk.api.session.events.EventService
import org.matrix.android.sdk.api.session.file.ContentDownloadStateTracker
import org.matrix.android.sdk.api.session.file.FileService
import org.matrix.android.sdk.api.session.group.GroupService
import org.matrix.android.sdk.api.session.homeserver.HomeServerCapabilitiesService
import org.matrix.android.sdk.api.session.identity.IdentityService
import org.matrix.android.sdk.api.session.integrationmanager.IntegrationManagerService
Expand Down Expand Up @@ -154,11 +153,6 @@ interface Session {
*/
fun roomDirectoryService(): RoomDirectoryService

/**
* Returns the GroupService associated with the session.
*/
fun groupService(): GroupService

/**
* Returns the UserService associated with the session.
*/
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,5 @@ sealed class PermalinkData {

data class UserLink(val userId: String) : PermalinkData()

data class GroupLink(val groupId: String) : PermalinkData()

data class FallbackLink(val uri: Uri) : PermalinkData()
data class FallbackLink(val uri: Uri, val isLegacyGroupLink: Boolean = false) : PermalinkData()
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,27 +61,29 @@ object PermalinkParser {
val params = safeFragment
.split(MatrixPatterns.SEP_REGEX)
.filter { it.isNotEmpty() }
.map { URLDecoder.decode(it, "UTF-8") }
.take(2)

val decodedParams = params
.map { URLDecoder.decode(it, "UTF-8") }

val identifier = params.getOrNull(0)
val extraParameter = params.getOrNull(1)
val decodedIdentifier = decodedParams.getOrNull(0)
val extraParameter = decodedParams.getOrNull(1)
return when {
identifier.isNullOrEmpty() -> PermalinkData.FallbackLink(uri)
MatrixPatterns.isUserId(identifier) -> PermalinkData.UserLink(userId = identifier)
MatrixPatterns.isGroupId(identifier) -> PermalinkData.GroupLink(groupId = identifier)
MatrixPatterns.isRoomId(identifier) -> {
handleRoomIdCase(fragment, identifier, matrixToUri, extraParameter, viaQueryParameters)
identifier.isNullOrEmpty() || decodedIdentifier.isNullOrEmpty() -> PermalinkData.FallbackLink(uri)
MatrixPatterns.isUserId(decodedIdentifier) -> PermalinkData.UserLink(userId = decodedIdentifier)
MatrixPatterns.isRoomId(decodedIdentifier) -> {
handleRoomIdCase(fragment, decodedIdentifier, matrixToUri, extraParameter, viaQueryParameters)
}
MatrixPatterns.isRoomAlias(identifier) -> {
MatrixPatterns.isRoomAlias(decodedIdentifier) -> {
PermalinkData.RoomLink(
roomIdOrAlias = identifier,
roomIdOrAlias = decodedIdentifier,
isRoomAlias = true,
eventId = extraParameter.takeIf { !it.isNullOrEmpty() && MatrixPatterns.isEventId(it) },
viaParameters = viaQueryParameters
)
}
else -> PermalinkData.FallbackLink(uri)
else -> PermalinkData.FallbackLink(uri, MatrixPatterns.isGroupId(identifier))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ data class RoomSummaryQueryParams(
* Used to filter room using the current space.
*/
val spaceFilter: SpaceFilter?,
/**
* Used to filter room using the current group.
*/
val activeGroupId: String? = null
) {

/**
Expand All @@ -106,7 +102,6 @@ data class RoomSummaryQueryParams(
var excludeType: List<String?>? = listOf(RoomType.SPACE)
var includeType: List<String?>? = null
var spaceFilter: SpaceFilter? = null
var activeGroupId: String? = null

fun build() = RoomSummaryQueryParams(
displayName = displayName,
Expand All @@ -117,7 +112,6 @@ data class RoomSummaryQueryParams(
excludeType = excludeType,
includeType = includeType,
spaceFilter = spaceFilter,
activeGroupId = activeGroupId
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ enum class InitialSyncStep {
ImportingAccount,
ImportingAccountCrypto,
ImportingAccountRoom,
ImportingAccountGroups,
ImportingAccountData,
ImportingAccountJoinedRooms,
ImportingAccountInvitedRooms,
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit c7b54b8

Please sign in to comment.