mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-2916 App | Tech | Prepare staging release (#1666)
Co-authored-by: Konstantin Ivanov <54908981+konstantiniiv@users.noreply.github.com>
This commit is contained in:
parent
14af7b40c1
commit
b78e3e4d0d
203 changed files with 2606 additions and 1726 deletions
|
@ -336,6 +336,7 @@ class BlockMiddleware(
|
|||
)
|
||||
|
||||
override suspend fun searchObjects(
|
||||
space: SpaceId,
|
||||
sorts: List<DVSort>,
|
||||
filters: List<DVFilter>,
|
||||
fulltext: String,
|
||||
|
@ -343,6 +344,7 @@ class BlockMiddleware(
|
|||
limit: Int,
|
||||
keys: List<Id>
|
||||
): List<Map<String, Any?>> = middleware.objectSearch(
|
||||
space = space,
|
||||
sorts = sorts,
|
||||
filters = filters,
|
||||
fulltext = fulltext,
|
||||
|
@ -356,6 +358,7 @@ class BlockMiddleware(
|
|||
): List<Command.SearchWithMeta.Result> = middleware.objectSearchWithMeta(command)
|
||||
|
||||
override suspend fun searchObjectsWithSubscription(
|
||||
space: SpaceId,
|
||||
subscription: Id,
|
||||
sorts: List<DVSort>,
|
||||
filters: List<DVFilter>,
|
||||
|
@ -369,6 +372,7 @@ class BlockMiddleware(
|
|||
noDepSubscription: Boolean?,
|
||||
collection: Id?
|
||||
): SearchResult = middleware.objectSearchSubscribe(
|
||||
space = space,
|
||||
subscription = subscription,
|
||||
sorts = sorts,
|
||||
filters = filters,
|
||||
|
@ -384,10 +388,12 @@ class BlockMiddleware(
|
|||
)
|
||||
|
||||
override suspend fun searchObjectsByIdWithSubscription(
|
||||
space: SpaceId,
|
||||
subscription: Id,
|
||||
ids: List<Id>,
|
||||
keys: List<String>
|
||||
): SearchResult = middleware.objectIdsSubscribe(
|
||||
space = space,
|
||||
subscription = subscription,
|
||||
ids = ids,
|
||||
keys = keys
|
||||
|
|
|
@ -1049,11 +1049,13 @@ class Middleware @Inject constructor(
|
|||
|
||||
@Throws(Exception::class)
|
||||
fun objectIdsSubscribe(
|
||||
space: SpaceId,
|
||||
subscription: Id,
|
||||
ids: List<Id>,
|
||||
keys: List<String>
|
||||
): SearchResult {
|
||||
val request = Rpc.Object.SubscribeIds.Request(
|
||||
spaceId = space.id,
|
||||
subId = subscription,
|
||||
keys = keys,
|
||||
ids = ids
|
||||
|
@ -1227,6 +1229,7 @@ class Middleware @Inject constructor(
|
|||
|
||||
@Throws(Exception::class)
|
||||
fun objectSearch(
|
||||
space: SpaceId,
|
||||
sorts: List<DVSort>,
|
||||
filters: List<DVFilter>,
|
||||
fulltext: String,
|
||||
|
@ -1235,6 +1238,7 @@ class Middleware @Inject constructor(
|
|||
keys: List<Id>
|
||||
): List<Map<String, Any?>> {
|
||||
val request = Rpc.Object.Search.Request(
|
||||
spaceId = space.id,
|
||||
sorts = sorts.map { it.toMiddlewareModel() },
|
||||
filters = filters.map { it.toMiddlewareModel() },
|
||||
fullText = fulltext,
|
||||
|
@ -1251,6 +1255,7 @@ class Middleware @Inject constructor(
|
|||
@Throws(Exception::class)
|
||||
fun objectSearchWithMeta(command: Command.SearchWithMeta): List<Command.SearchWithMeta.Result> {
|
||||
val request = Rpc.Object.SearchWithMeta.Request(
|
||||
spaceId = command.space.id,
|
||||
sorts = command.sorts.map { it.toMiddlewareModel() },
|
||||
filters = command.filters.map { it.toMiddlewareModel() },
|
||||
fullText = command.query,
|
||||
|
@ -1266,6 +1271,7 @@ class Middleware @Inject constructor(
|
|||
|
||||
@Throws(Exception::class)
|
||||
fun objectSearchSubscribe(
|
||||
space: SpaceId,
|
||||
subscription: Id,
|
||||
sorts: List<DVSort>,
|
||||
filters: List<DVFilter>,
|
||||
|
@ -1280,6 +1286,7 @@ class Middleware @Inject constructor(
|
|||
collection: Id?
|
||||
): SearchResult {
|
||||
val request = Rpc.Object.SearchSubscribe.Request(
|
||||
spaceId = space.id,
|
||||
subId = subscription,
|
||||
sorts = sorts.map { it.toMiddlewareModel() },
|
||||
filters = filters.map { it.toMiddlewareModel() },
|
||||
|
@ -1289,7 +1296,6 @@ class Middleware @Inject constructor(
|
|||
beforeId = beforeId.orEmpty(),
|
||||
afterId = afterId.orEmpty(),
|
||||
source = source,
|
||||
ignoreWorkspace = ignoreWorkspace?.toString() ?: "",
|
||||
noDepSubscription = noDepSubscription ?: false,
|
||||
collectionId = collection.orEmpty()
|
||||
)
|
||||
|
@ -1966,7 +1972,7 @@ class Middleware @Inject constructor(
|
|||
fun workspaceCreate(details: Struct): Id {
|
||||
val request = Rpc.Workspace.Create.Request(
|
||||
details = details,
|
||||
useCase = Rpc.Object.ImportUseCase.Request.UseCase.EMPTY
|
||||
useCase = Rpc.Object.ImportUseCase.Request.UseCase.GET_STARTED
|
||||
)
|
||||
logRequestIfDebug(request)
|
||||
val (response, time) = measureTimedValue { service.workspaceCreate(request) }
|
||||
|
|
|
@ -21,32 +21,35 @@ interface MiddlewareProtobufLogger {
|
|||
private val featureToggles: FeatureToggles
|
||||
) : MiddlewareProtobufLogger {
|
||||
|
||||
private val isConciseLogging: Boolean
|
||||
get() = featureToggles.isConciseLogging
|
||||
|
||||
override fun logRequest(any: Any) {
|
||||
if (featureToggles.isLogMiddlewareInteraction) {
|
||||
Timber.d("request -> ${any.toLogMessage()}")
|
||||
Timber.d("request -> ${any.toLogMessage(isConciseLogging)}")
|
||||
}
|
||||
}
|
||||
|
||||
override fun logResponse(any: Any) {
|
||||
if (featureToggles.isLogMiddlewareInteraction) {
|
||||
Timber.d("response -> ${any.toLogMessage()}")
|
||||
Timber.d("response -> ${any.toLogMessage(isConciseLogging)}")
|
||||
}
|
||||
}
|
||||
|
||||
override fun logResponse(any: Any, time: Duration?) {
|
||||
Timber.d("response -> ${any.toLogMessage()} [${time.format()}ms] ")
|
||||
Timber.d("response -> ${any.toLogMessage(isConciseLogging)} [${time.format()}ms] ")
|
||||
}
|
||||
|
||||
private fun Duration?.format(): Long? = this?.toLong(DurationUnit.MILLISECONDS)
|
||||
|
||||
override fun logEvent(any: Any) {
|
||||
if (featureToggles.isLogMiddlewareInteraction) {
|
||||
Timber.d("event -> ${any.toLogMessage()}")
|
||||
Timber.d("event -> ${any.toLogMessage(isConciseLogging)}")
|
||||
}
|
||||
}
|
||||
|
||||
private fun Any.toLogMessage(): String {
|
||||
return if (featureToggles.isConciseLogging) {
|
||||
private fun Any.toLogMessage(isConcise: Boolean): String {
|
||||
return if (isConcise) {
|
||||
this::class.java.canonicalName
|
||||
} else {
|
||||
"${this::class.java.canonicalName}:\n${
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue