Move PermalinkBuilder, MatrixToConverter and PermalinkParser content to the impl project in order to remove projects.appconfig dependency from matrix.api module.

This commit is contained in:
Benoit Marty 2024-04-02 12:35:35 +02:00 committed by Benoit Marty
parent 5ee1b8f79b
commit db3f17fd7d
52 changed files with 771 additions and 318 deletions

View file

@ -0,0 +1,37 @@
/*
* Copyright (c) 2024 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.element.android.libraries.matrix.test.permalink
import io.element.android.libraries.matrix.api.core.RoomId
import io.element.android.libraries.matrix.api.core.UserId
import io.element.android.libraries.matrix.api.permalink.PermalinkBuilder
class FakePermalinkBuilder(
private val result: () -> Result<String> = { Result.failure(Exception("Not implemented")) }
) : PermalinkBuilder {
override fun permalinkForUser(userId: UserId): Result<String> {
return result()
}
override fun permalinkForRoomAlias(roomAlias: String): Result<String> {
return result()
}
override fun permalinkForRoomId(roomId: RoomId): Result<String> {
return result()
}
}

View file

@ -0,0 +1,37 @@
/*
* Copyright (c) 2024 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.element.android.libraries.matrix.test.permalink
import android.net.Uri
import io.element.android.libraries.matrix.api.permalink.PermalinkData
import io.element.android.libraries.matrix.api.permalink.PermalinkParser
class FakePermalinkParser(
private var result: () -> PermalinkData = { throw Exception("Not implemented") }
) : PermalinkParser {
fun givenResult(result: PermalinkData) {
this.result = { result }
}
override fun parse(uriString: String): PermalinkData {
return result()
}
override fun parse(uri: Uri): PermalinkData {
TODO("Not yet implemented")
}
}