1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 05:47:05 +09:00

DROID-1566 App | Tech | Add request for debugging subscription list (#234)

This commit is contained in:
Evgenii Kozlov 2023-07-20 17:20:00 +02:00 committed by GitHub
parent 093fb263db
commit b53ec846dd
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 37 additions and 2 deletions

View file

@ -438,6 +438,8 @@ class BlockDataRepository(
override suspend fun debugLocalStore(path: String): String =
remote.debugLocalStore(path)
override suspend fun debugSubscriptions(): List<Id> = remote.debugSubscriptions()
override suspend fun setObjectDetail(
ctx: Id,
key: String,

View file

@ -181,6 +181,8 @@ interface BlockRemote {
suspend fun debugLocalStore(path: String): String
suspend fun debugSubscriptions(): List<Id>
suspend fun setObjectDetail(
ctx: Id,
key: String,

View file

@ -223,6 +223,8 @@ interface BlockRepository {
suspend fun debugLocalStore(path: String): String
suspend fun debugSubscriptions(): List<Id>
suspend fun turnInto(
context: Id,
targets: List<Id>,

View file

@ -397,8 +397,11 @@ class BlockMiddleware(
override suspend fun debugObject(objectId: Id, path: String): String =
middleware.debugObject(objectId = objectId, path = path)
override suspend fun debugLocalStore(path: String): String =
middleware.debugExportLocalStore(path)
override suspend fun debugLocalStore(
path: String
): String = middleware.debugExportLocalStore(path)
override suspend fun debugSubscriptions(): List<Id> = middleware.debugSubscriptions()
override suspend fun turnInto(
context: String,

View file

@ -781,6 +781,15 @@ class Middleware @Inject constructor(
return response.infos.toCoreModel()
}
@Throws(Exception::class)
fun debugSubscriptions(): List<Id> {
val request = Rpc.Debug.Subscriptions.Request()
if (BuildConfig.DEBUG) logRequest(request)
val response = service.debugSubscriptions(request)
if (BuildConfig.DEBUG) logResponse(response)
return response.subscriptions
}
@Throws(Exception::class)
fun debugObject(objectId: Id, path: String): String {
val request = Rpc.Debug.Tree.Request(

View file

@ -420,6 +420,10 @@ interface MiddlewareService {
@Throws(Exception::class)
fun debugExportLocalStore(request: Rpc.Debug.ExportLocalstore.Request): Rpc.Debug.ExportLocalstore.Response
@Throws(Exception::class)
fun debugSubscriptions(request: Rpc.Debug.Subscriptions.Request): Rpc.Debug.Subscriptions.Response
//endregion
//region WIDGETS commands

View file

@ -579,6 +579,19 @@ class MiddlewareServiceImplementation @Inject constructor(
}
}
override fun debugSubscriptions(request: Rpc.Debug.Subscriptions.Request): Rpc.Debug.Subscriptions.Response {
val encoded = Service.debugSubscriptions(
Rpc.Debug.Subscriptions.Request.ADAPTER.encode(request)
)
val response = Rpc.Debug.Subscriptions.Response.ADAPTER.decode(encoded)
val error = response.error
if (error != null && error.code != Rpc.Debug.Subscriptions.Response.Error.Code.NULL) {
throw Exception(error.description)
} else {
return response
}
}
override fun debugSpace(request: Rpc.Debug.SpaceSummary.Request): Rpc.Debug.SpaceSummary.Response {
val encoded = Service.debugSpaceSummary(Rpc.Debug.SpaceSummary.Request.ADAPTER.encode(request))
val response = Rpc.Debug.SpaceSummary.Response.ADAPTER.decode(encoded)