1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-07 21:37:02 +09:00

DROID-2966 Chat | Fix | Misc. fixes (#2441)

This commit is contained in:
Evgenii Kozlov 2025-05-23 14:04:59 +02:00 committed by GitHub
parent 64e3b503b3
commit c6c5b1dac2
Signed by: github
GPG key ID: B5690EEEBB952194
11 changed files with 43 additions and 34 deletions

View file

@ -10,9 +10,12 @@ import androidx.activity.compose.BackHandler
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.statusBars
import androidx.compose.foundation.layout.systemBarsPadding
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.MaterialTheme
import androidx.compose.material3.ExperimentalMaterial3Api
@ -94,7 +97,7 @@ class ChatFragment : BaseComposeFragment() {
Column(
modifier = Modifier
.fillMaxSize()
.systemBarsPadding()
.windowInsetsPadding(WindowInsets.statusBars)
) {
ChatTopToolbar(
header = vm.header.collectAsStateWithLifecycle().value,

View file

@ -7,9 +7,12 @@ import android.view.ViewGroup
import android.widget.Toast
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.statusBars
import androidx.compose.foundation.layout.systemBarsPadding
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.MaterialTheme
import androidx.compose.material3.ExperimentalMaterial3Api
@ -114,7 +117,6 @@ class HomeScreenFragment : BaseComposeFragment(),
Box(
modifier = Modifier
.fillMaxSize()
.systemBarsPadding()
) {
HomeScreenToolbar(
spaceIconView = view?.icon ?: SpaceIconView.Loading,

View file

@ -35,7 +35,8 @@ sealed class Command {
class UploadFile(
val space: SpaceId,
val path: String,
val type: Block.Content.File.Type?
val type: Block.Content.File.Type?,
val createTypeWidgetIfMissing: Boolean = true
)
class FileDrop(

View file

@ -15,7 +15,8 @@ class SetDocumentImageIcon @Inject constructor(
command = Command.UploadFile(
path = params.path,
type = Block.Content.File.Type.IMAGE,
space = params.spaceId
space = params.spaceId,
createTypeWidgetIfMissing = params.createTypeWidgetIfMissing
)
)
val payload = repo.setDocumentImageIcon(

View file

@ -14,6 +14,7 @@ abstract class SetImageIcon<T> : BaseUseCase<Pair<Payload, Hash>, SetImageIcon.P
data class Params<T>(
val target: T,
val path: String,
val spaceId: SpaceId
val spaceId: SpaceId,
val createTypeWidgetIfMissing: Boolean = true
)
}

View file

@ -15,7 +15,8 @@ class SetTextBlockImage(
command = Command.UploadFile(
path = params.path,
type = Block.Content.File.Type.IMAGE,
space = params.spaceId
space = params.spaceId,
createTypeWidgetIfMissing = params.createTypeWidgetIfMissing
)
)
val payload = repo.setTextIcon(

View file

@ -19,7 +19,8 @@ class UploadFile @Inject constructor(
command = Command.UploadFile(
path = params.path,
type = params.type,
space = params.space
space = params.space,
createTypeWidgetIfMissing = params.createTypeWidgetIfMissing
)
)
@ -27,5 +28,6 @@ class UploadFile @Inject constructor(
val path: String,
val space: SpaceId,
val type: Block.Content.File.Type = Block.Content.File.Type.FILE,
val createTypeWidgetIfMissing: Boolean = true
)
}

View file

@ -390,23 +390,25 @@ class ChatViewModel @Inject constructor(
val results = members.get().let { store ->
when (store) {
is Store.Data -> {
store.members.map { member ->
MentionPanelState.Member(
member.id,
name = member.name.orEmpty(),
icon = SpaceMemberIconView.icon(
obj = member,
urlBuilder = urlBuilder
),
isUser = member.identity == account
)
}.filter { m ->
if (query != null) {
m.name.contains(query.query, true)
} else {
true
store.members
.filter { member -> member.permissions?.isAtLeastReader() == true }
.map { member ->
MentionPanelState.Member(
member.id,
name = member.name.orEmpty(),
icon = SpaceMemberIconView.icon(
obj = member,
urlBuilder = urlBuilder
),
isUser = member.identity == account
)
}.filter { m ->
if (query != null) {
m.name.contains(query.query, true)
} else {
true
}
}
}
}
Store.Empty -> {

View file

@ -133,7 +133,8 @@ class ProfileSettingsViewModel(
SetImageIcon.Params(
target = config.profile,
path = path,
spaceId = SpaceId(config.techSpace)
spaceId = SpaceId(config.techSpace),
createTypeWidgetIfMissing = false
)
).process(
failure = {

View file

@ -78,15 +78,10 @@ fun NewSpaceSettingsScreen(
containerColor = colorResource(id = R.color.background_primary),
topBar = {
Box(
modifier = if (Build.VERSION.SDK_INT >= EDGE_TO_EDGE_MIN_SDK)
Modifier
.windowInsetsPadding(WindowInsets.statusBars)
.fillMaxWidth()
.height(48.dp)
else
Modifier
.fillMaxWidth()
.height(48.dp)
modifier = Modifier
.windowInsetsPadding(WindowInsets.statusBars)
.fillMaxWidth()
.height(48.dp)
) {
Box(
modifier = Modifier

View file

@ -830,7 +830,7 @@ class Middleware @Inject constructor(
localPath = command.path,
type = type,
spaceId = command.space.id,
createTypeWidgetIfMissing = true
createTypeWidgetIfMissing = command.createTypeWidgetIfMissing
)
logRequestIfDebug(request)
val (response, time) = measureTimedValue { service.fileUpload(request) }