diff --git a/app/src/main/java/com/anytypeio/anytype/ui/update/MigrationErrorScreen.kt b/app/src/main/java/com/anytypeio/anytype/ui/update/MigrationErrorScreen.kt
index b802689131..6ef6a803e0 100644
--- a/app/src/main/java/com/anytypeio/anytype/ui/update/MigrationErrorScreen.kt
+++ b/app/src/main/java/com/anytypeio/anytype/ui/update/MigrationErrorScreen.kt
@@ -13,10 +13,12 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.shape.CircleShape
+import androidx.compose.material.ModalBottomSheetValue
import androidx.compose.material.Text
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ModalBottomSheet
+import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
@@ -142,7 +144,11 @@ fun MigrationStartScreen(
fun MigrationReadMoreBottomSheet(
onDismissRequest: () -> Unit
) {
+ val sheetState = rememberModalBottomSheetState(
+ skipPartiallyExpanded = true
+ )
ModalBottomSheet(
+ sheetState = sheetState,
onDismissRequest = onDismissRequest,
dragHandle = {
Dragger(
@@ -198,7 +204,7 @@ fun MigrationReadMoreScreenContent() {
modifier = Modifier
.background(
shape = CircleShape,
- color = colorResource(R.color.palette_dark_blue)
+ color = colorResource(R.color.palette_dark_purple)
)
.size(48.dp)
) {
@@ -274,7 +280,7 @@ fun MigrationInProgressScreen(
}
Spacer(modifier = Modifier.height(16.dp))
Text(
- text = stringResource(R.string.migration_migration_is_in_progress),
+ text = stringResource(R.string.migration_update_is_in_progress),
style = HeadlineHeading,
color = colorResource(R.color.text_primary),
textAlign = TextAlign.Center,
diff --git a/app/src/main/java/com/anytypeio/anytype/ui/widgets/types/DataViewWidget.kt b/app/src/main/java/com/anytypeio/anytype/ui/widgets/types/DataViewWidget.kt
index f94f785807..3fa4fe69fb 100644
--- a/app/src/main/java/com/anytypeio/anytype/ui/widgets/types/DataViewWidget.kt
+++ b/app/src/main/java/com/anytypeio/anytype/ui/widgets/types/DataViewWidget.kt
@@ -117,7 +117,7 @@ fun DataViewListWidgetCard(
isInEditMode = mode is InteractionMode.Edit,
hasReadOnlyAccess = mode is InteractionMode.ReadOnly,
onDropDownMenuAction = onDropDownMenuAction,
- canCreate = mode is InteractionMode.Default,
+ canCreate = mode is InteractionMode.Default && item.canCreateObjectOfType,
onCreateElement = { onCreateElement(item) },
onWidgetMenuTriggered = { onWidgetMenuTriggered(item.id) }
)
@@ -160,24 +160,35 @@ fun DataViewListWidgetCard(
}
} else {
if (item.isExpanded) {
- when {
- item.isLoading -> EmptyWidgetPlaceholder(R.string.loading)
- item.tabs.isNotEmpty() -> EmptyWidgetPlaceholderWithCreateButton(
- R.string.empty_list_widget,
- onCreateClicked = {
- onCreateDataViewObject(
- item.id, item.tabs.find { it.isSelected }?.id
+ if (item.isLoading) {
+ EmptyWidgetPlaceholder(R.string.loading)
+ } else if (item.canCreateObjectOfType) {
+ if (mode !is InteractionMode.ReadOnly) {
+ if (item.tabs.isNotEmpty()) {
+ EmptyWidgetPlaceholderWithCreateButton(
+ R.string.empty_list_widget,
+ onCreateClicked = {
+ onCreateDataViewObject(
+ item.id, item.tabs.find { it.isSelected }?.id
+ )
+ }
+ )
+ } else {
+ EmptyWidgetPlaceholderWithCreateButton(
+ text = R.string.empty_list_widget_no_view,
+ onCreateClicked = {
+ onCreateDataViewObject(
+ item.id, item.tabs.find { it.isSelected }?.id
+ )
+ }
)
}
- )
- else -> EmptyWidgetPlaceholderWithCreateButton(
- text = R.string.empty_list_widget_no_view,
- onCreateClicked = {
- onCreateDataViewObject(
- item.id, item.tabs.find { it.isSelected }?.id
- )
- }
- )
+ } else {
+ EmptyWidgetPlaceholder(R.string.empty_list_widget_no_objects)
+ }
+ } else {
+ // Cannot create an object of the given type.
+ EmptyWidgetPlaceholder(R.string.empty_list_widget_no_objects)
}
Spacer(modifier = Modifier.height(2.dp))
}
diff --git a/app/src/main/java/com/anytypeio/anytype/ui/widgets/types/TreeWidget.kt b/app/src/main/java/com/anytypeio/anytype/ui/widgets/types/TreeWidget.kt
index 704ec5613e..d77c315672 100644
--- a/app/src/main/java/com/anytypeio/anytype/ui/widgets/types/TreeWidget.kt
+++ b/app/src/main/java/com/anytypeio/anytype/ui/widgets/types/TreeWidget.kt
@@ -127,12 +127,18 @@ fun TreeWidgetCard(
if (item.isLoading) {
EmptyWidgetPlaceholder(R.string.loading)
} else {
- EmptyWidgetPlaceholderWithCreateButton(
- R.string.empty_tree_widget,
- onCreateClicked = {
- onCreateObjectInsideWidget(item.id)
- }
- )
+ if (mode !is InteractionMode.ReadOnly) {
+ EmptyWidgetPlaceholderWithCreateButton(
+ R.string.empty_tree_widget,
+ onCreateClicked = {
+ onCreateObjectInsideWidget(item.id)
+ }
+ )
+ } else {
+ EmptyWidgetPlaceholder(
+ R.string.empty_tree_widget_reader_access
+ )
+ }
}
Spacer(modifier = Modifier.height(2.dp))
}
diff --git a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/multiplayer/Inviting.kt b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/multiplayer/Inviting.kt
index d921ba11a8..ce0e37a237 100644
--- a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/multiplayer/Inviting.kt
+++ b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/multiplayer/Inviting.kt
@@ -29,6 +29,7 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.anytypeio.anytype.core_ui.R
+import com.anytypeio.anytype.core_ui.common.DefaultPreviews
import com.anytypeio.anytype.core_ui.foundation.Divider
import com.anytypeio.anytype.core_ui.foundation.noRippleClickable
import com.anytypeio.anytype.core_ui.views.BodyCalloutRegular
@@ -39,15 +40,28 @@ import com.anytypeio.anytype.core_ui.views.ButtonSize
import com.anytypeio.anytype.core_ui.views.Title1
@Composable
-@Preview(backgroundColor = 0xFFFFFFFF, showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_NO, name = "Light Mode")
-@Preview(backgroundColor = 0x000000, showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES, name = "Dark Mode")
-fun ShareInviteLinkCardPreview() {
+@DefaultPreviews
+fun ShareInviteLinkCardNotOwnerPreview() {
ShareInviteLinkCard(
link = "https://anytype.io/ibafyrfhfsag6rea3ifffsasssa3ifffsasssga3ifffsasssga3ifffsas",
onShareInviteClicked = {},
onDeleteLinkClicked = {},
onShowQrCodeClicked = {},
- modifier = Modifier
+ modifier = Modifier,
+ isCurrentUserOwner = false
+ )
+}
+
+@Composable
+@DefaultPreviews
+fun ShareInviteLinkCardOwnerPreview() {
+ ShareInviteLinkCard(
+ link = "https://anytype.io/ibafyrfhfsag6rea3ifffsasssa3ifffsasssga3ifffsasssga3ifffsas",
+ onShareInviteClicked = {},
+ onDeleteLinkClicked = {},
+ onShowQrCodeClicked = {},
+ modifier = Modifier,
+ isCurrentUserOwner = true
)
}
@@ -65,6 +79,7 @@ fun GenerateInviteLinkCardPreview() {
fun ShareInviteLinkCard(
modifier: Modifier = Modifier,
link: String,
+ isCurrentUserOwner: Boolean,
onShareInviteClicked: () -> Unit,
onDeleteLinkClicked: () -> Unit,
onShowQrCodeClicked: () -> Unit
@@ -91,35 +106,37 @@ fun ShareInviteLinkCard(
color = colorResource(id = R.color.text_primary),
modifier = Modifier.weight(1.0f)
)
- Box {
- Image(
- painter = painterResource(id = R.drawable.ic_action_more),
- contentDescription = "Menu button",
- modifier = Modifier.noRippleClickable {
- isMenuExpanded = true
- }
- )
- DropdownMenu(
- expanded = isMenuExpanded,
- onDismissRequest = {
- isMenuExpanded = false
- },
- modifier = Modifier.background(
- color = colorResource(id = R.color.background_secondary)
- )
- ) {
- DropdownMenuItem(
- onClick = {
- onDeleteLinkClicked()
- isMenuExpanded = false
+ if (isCurrentUserOwner) {
+ Box {
+ Image(
+ painter = painterResource(id = R.drawable.ic_action_more),
+ contentDescription = "Menu button",
+ modifier = Modifier.noRippleClickable {
+ isMenuExpanded = true
}
- ) {
- Text(
- text = stringResource(id = R.string.multiplayer_delete_link),
- style = BodyRegular,
- color = colorResource(id = R.color.palette_dark_red),
- modifier = Modifier.weight(1.0f)
+ )
+ DropdownMenu(
+ expanded = isMenuExpanded,
+ onDismissRequest = {
+ isMenuExpanded = false
+ },
+ modifier = Modifier.background(
+ color = colorResource(id = R.color.background_secondary)
)
+ ) {
+ DropdownMenuItem(
+ onClick = {
+ onDeleteLinkClicked()
+ isMenuExpanded = false
+ }
+ ) {
+ Text(
+ text = stringResource(id = R.string.multiplayer_delete_link),
+ style = BodyRegular,
+ color = colorResource(id = R.color.palette_dark_red),
+ modifier = Modifier.weight(1.0f)
+ )
+ }
}
}
}
diff --git a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/multiplayer/ShareSpaceScreen.kt b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/multiplayer/ShareSpaceScreen.kt
index 650b4829d4..c1cf9d27c6 100644
--- a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/multiplayer/ShareSpaceScreen.kt
+++ b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/multiplayer/ShareSpaceScreen.kt
@@ -183,7 +183,7 @@ fun ShareSpaceScreen(
modifier = Modifier.weight(1.0f)
)
}
- if (spaceAccessType == SpaceAccessType.SHARED) {
+ if (spaceAccessType == SpaceAccessType.SHARED && isCurrentUserOwner) {
Divider(
paddingStart = 0.dp,
paddingEnd = 0.dp
@@ -205,11 +205,9 @@ fun ShareSpaceScreen(
}
}
}
- if (isCurrentUserOwner) {
- Section(
- title = stringResource(R.string.multiplayer_members_and_requests)
- )
- }
+ Section(
+ title = stringResource(R.string.multiplayer_members_and_requests)
+ )
Incentive(
incentiveState = incentiveState,
onIncentiveClicked = onIncentiveClicked
@@ -315,7 +313,8 @@ fun ShareSpaceScreen(
link = shareLinkViewState.link,
onShareInviteClicked = onShareInviteLinkClicked,
onDeleteLinkClicked = onDeleteLinkClicked,
- onShowQrCodeClicked = onShareQrCodeClicked
+ onShowQrCodeClicked = onShareQrCodeClicked,
+ isCurrentUserOwner = isCurrentUserOwner
)
}
}
diff --git a/localization/src/main/res/values-be-rBY/strings.xml b/localization/src/main/res/values-be-rBY/strings.xml
index 38417c56b7..3a9f90f512 100644
--- a/localization/src/main/res/values-be-rBY/strings.xml
+++ b/localization/src/main/res/values-be-rBY/strings.xml
@@ -1681,7 +1681,6 @@
It cannot be restored after confirmation
Delete this message?
Query of
- Migration is in progress
This may take some time. Please don’t close the app until the process is complete.
Паспрабуйце яшчэ раз
Памылка міграцыі
diff --git a/localization/src/main/res/values-de-rDE/strings.xml b/localization/src/main/res/values-de-rDE/strings.xml
index 4dff9cc026..ebe2e5813c 100644
--- a/localization/src/main/res/values-de-rDE/strings.xml
+++ b/localization/src/main/res/values-de-rDE/strings.xml
@@ -1655,7 +1655,6 @@ Bitte mache hier genaue Angaben zu deinen Bedarf.
Sie kann nach der Bestätigung nicht wiederhergestellt werden
Diese Nachricht löschen?
Abfrage von
- Migration läuft
Dies kann einige Zeit dauern. Bitte schließe die App nicht, bis der Vorgang abgeschlossen ist.
Erneut versuchen
Migration fehlgeschlagen
diff --git a/localization/src/main/res/values-es-rES/strings.xml b/localization/src/main/res/values-es-rES/strings.xml
index d672a359cb..0230b35624 100644
--- a/localization/src/main/res/values-es-rES/strings.xml
+++ b/localization/src/main/res/values-es-rES/strings.xml
@@ -1655,7 +1655,6 @@ En concreto,
Después de confirmar esto, no podrás restaurarlo.
¿Eliminar este mensaje?
Consulta de
- La migración está en curso
Esto puede llevar algún tiempo. No cierres la aplicación hasta que termine el proceso.
Inténtalo de nuevo
La migración ha fallado
diff --git a/localization/src/main/res/values-fr-rFR/strings.xml b/localization/src/main/res/values-fr-rFR/strings.xml
index 6da53d6911..4546575e21 100644
--- a/localization/src/main/res/values-fr-rFR/strings.xml
+++ b/localization/src/main/res/values-fr-rFR/strings.xml
@@ -1652,7 +1652,6 @@ Merci de décrire ici vos besoins spécifiques.
Il ne pourra pas être restauré après confirmation
Supprimer ce message ?
Query of
- Migration en cours
Cela peut prendre un certain temps. Veuillez ne pas fermer l\'application avant que le processus soit terminé.
Essayez de nouveau
Échec de la migration
diff --git a/localization/src/main/res/values-in-rID/strings.xml b/localization/src/main/res/values-in-rID/strings.xml
index 001d20a808..cc838d9cb0 100644
--- a/localization/src/main/res/values-in-rID/strings.xml
+++ b/localization/src/main/res/values-in-rID/strings.xml
@@ -1642,7 +1642,6 @@ Please provide specific details of your needs here.
Pesan tak dapat dikembalikan lagi
Hapus pesan ini?
Kueri dari
- Migrasi sedang berlangsung
Ini mungkin perlu beberapa waktu. Mohon tidak menutup aplikasi hingga proses selesai.
Coba lagi
Migrasi gagal
diff --git a/localization/src/main/res/values-it-rIT/strings.xml b/localization/src/main/res/values-it-rIT/strings.xml
index 62b78933d8..6da3c0db5a 100644
--- a/localization/src/main/res/values-it-rIT/strings.xml
+++ b/localization/src/main/res/values-it-rIT/strings.xml
@@ -1656,7 +1656,6 @@ Please provide specific details of your needs here.
Non può essere ripristinato dopo la conferma
Eliminare questo messaggio?
Query of
- Migrazione in corso
Questo potrebbe richiedere un po \'di tempo. Si prega di non chiudere l\'app fino a quando il processo è completato.
Riprova
Migrazione fallita
diff --git a/localization/src/main/res/values-nl-rNL/strings.xml b/localization/src/main/res/values-nl-rNL/strings.xml
index f8cf9ee9cd..341754bee4 100644
--- a/localization/src/main/res/values-nl-rNL/strings.xml
+++ b/localization/src/main/res/values-nl-rNL/strings.xml
@@ -1655,7 +1655,6 @@ Geef alsjeblieft specifieke details van jouw wensen hier aan.
Het kan niet worden hersteld na bevestiging
Verwijder dit bericht?
Query of
- Bezig met migreren...
Dit kan enige tijd duren. Sluit de app alsjeblieft niet voordat het proces is voltooid.
Probeer opnieuw
Migratie mislukt
diff --git a/localization/src/main/res/values-no-rNO/strings.xml b/localization/src/main/res/values-no-rNO/strings.xml
index e9c72968ec..48df7da243 100644
--- a/localization/src/main/res/values-no-rNO/strings.xml
+++ b/localization/src/main/res/values-no-rNO/strings.xml
@@ -1655,7 +1655,6 @@ Please provide specific details of your needs here.
It cannot be restored after confirmation
Delete this message?
Query of
- Migration is in progress
This may take some time. Please don’t close the app until the process is complete.
Prøv igjen
Migration failed
diff --git a/localization/src/main/res/values-pt-rBR/strings.xml b/localization/src/main/res/values-pt-rBR/strings.xml
index 5c5d4ae927..82f215bc29 100644
--- a/localization/src/main/res/values-pt-rBR/strings.xml
+++ b/localization/src/main/res/values-pt-rBR/strings.xml
@@ -1652,7 +1652,6 @@ forneça detalhes específicos das suas necessidades aqui.
Não pode ser restaurado após a confirmação
Excluir esta mensagem?
Query of
- Migration is in progress
This may take some time. Please don’t close the app until the process is complete.
Tente novamente
Migration failed
diff --git a/localization/src/main/res/values-ru-rRU/strings.xml b/localization/src/main/res/values-ru-rRU/strings.xml
index fd9561ed7f..941e0d1ea7 100644
--- a/localization/src/main/res/values-ru-rRU/strings.xml
+++ b/localization/src/main/res/values-ru-rRU/strings.xml
@@ -1684,7 +1684,6 @@
Его нельзя восстановить после подтверждения
Удалить это сообщение?
Query of
- Миграция в процессе
Это может занять некоторое время. Пожалуйста, не закрывайте приложение, пока процесс не завершится.
Попробуйте еще раз
Сбой миграции
diff --git a/localization/src/main/res/values-tr-rTR/strings.xml b/localization/src/main/res/values-tr-rTR/strings.xml
index 7bba061e9b..990b7ff9b9 100644
--- a/localization/src/main/res/values-tr-rTR/strings.xml
+++ b/localization/src/main/res/values-tr-rTR/strings.xml
@@ -1655,7 +1655,6 @@ Lütfen ihtiyaçlarınızla ilgili özel ayrıntıları burada belirtin.Onaylandıktan sonra geri getirilemez
Bu mesaj silinsin mi?
Sorgu
- Geçiş işlemi devam ediyor
Bu işlem biraz zaman alabilir. Lütfen işlem tamamlanana kadar uygulamayı kapatmayın.
Tekrar deneyin
Geçiş başarısız oldu
diff --git a/localization/src/main/res/values-uk-rUA/strings.xml b/localization/src/main/res/values-uk-rUA/strings.xml
index 46026f4d1a..8a0ce852a7 100644
--- a/localization/src/main/res/values-uk-rUA/strings.xml
+++ b/localization/src/main/res/values-uk-rUA/strings.xml
@@ -1681,7 +1681,6 @@ Please provide specific details of your needs here.
It cannot be restored after confirmation
Delete this message?
Query of
- Migration is in progress
This may take some time. Please don’t close the app until the process is complete.
Try again
Migration failed
diff --git a/localization/src/main/res/values-zh-rCN/strings.xml b/localization/src/main/res/values-zh-rCN/strings.xml
index a0c5a45976..72ca4c61cc 100644
--- a/localization/src/main/res/values-zh-rCN/strings.xml
+++ b/localization/src/main/res/values-zh-rCN/strings.xml
@@ -1638,7 +1638,6 @@
确认后无法恢复
删除此消息?
的查询
- 迁移正在进行
这可能需要一些时间。不要关闭本软件,直至更新完成。
请再试一次
迁移失败
diff --git a/localization/src/main/res/values-zh-rTW/strings.xml b/localization/src/main/res/values-zh-rTW/strings.xml
index fbb0379a9a..c9beba311c 100644
--- a/localization/src/main/res/values-zh-rTW/strings.xml
+++ b/localization/src/main/res/values-zh-rTW/strings.xml
@@ -1642,7 +1642,6 @@ Please provide specific details of your needs here.
It cannot be restored after confirmation
Delete this message?
Query of
- Migration is in progress
This may take some time. Please don’t close the app until the process is complete.
請再試一次
Migration failed
diff --git a/localization/src/main/res/values/strings.xml b/localization/src/main/res/values/strings.xml
index a0514a3723..3b5f343ac4 100644
--- a/localization/src/main/res/values/strings.xml
+++ b/localization/src/main/res/values/strings.xml
@@ -888,7 +888,9 @@
Remove
This object has no links to other objects.\nTry to create a new one.
+ This object has no links to other objects.
This view has no objects.\nTry to create a new one.
+ There are no objects in this widget yet.
This data view has no objects.\nTry to create a new one.
This widget has no objects.\nTry to create a new one.
Emoji
@@ -1929,7 +1931,7 @@ Please provide specific details of your needs here.
It cannot be restored after confirmation
Delete this message?
Query of
- Migration is in progress
+ Update is in progress
This may take some time. Please don’t close the app until the process is complete.
Try again
Migration failed
diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/home/HomeScreenViewModel.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/home/HomeScreenViewModel.kt
index 0c4f7bd372..80022e89e0 100644
--- a/presentation/src/main/java/com/anytypeio/anytype/presentation/home/HomeScreenViewModel.kt
+++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/home/HomeScreenViewModel.kt
@@ -735,7 +735,10 @@ class HomeScreenViewModel(
}
}
is WidgetDispatchEvent.SourcePicked.Bundled -> {
- if (dispatch.source == BundledWidgetSourceView.AllObjects.id) {
+ if (
+ dispatch.source == BundledWidgetSourceView.AllObjects.id
+ || dispatch.source == BundledWidgetSourceView.Bin.id
+ ) {
// Applying link layout automatically to all-objects widget
proceedWithCreatingWidget(
ctx = config.widgets,
@@ -2054,6 +2057,7 @@ class HomeScreenViewModel(
}
fun onCreateObjectInsideWidget(widget: Id) {
+ Timber.d("onCreateObjectInsideWidget: ${widget}")
when(val target = widgets.value.orEmpty().find { it.id == widget }) {
is Widget.Tree -> {
val source = target.source
@@ -2111,6 +2115,7 @@ class HomeScreenViewModel(
)
).fold(
onSuccess = { obj ->
+ Timber.d("onCreateDataViewObject:gotDataViewPreview")
val dv = obj.blocks.find { it.content is DV }?.content as? DV
val viewer = if (view.isNullOrEmpty())
dv?.viewers?.firstOrNull()
@@ -2118,6 +2123,7 @@ class HomeScreenViewModel(
dv?.viewers?.find { it.id == view }
if (widgetSource.obj.layout == ObjectType.Layout.COLLECTION) {
+ Timber.d("onCreateDataViewObject:source is collection")
if (dv != null && viewer != null) {
proceedWithAddingObjectToCollection(
viewer = viewer,
@@ -2125,12 +2131,15 @@ class HomeScreenViewModel(
collection = widgetSource.obj.id
)
}
- } else if (widgetSource.obj.layout == ObjectType.Layout.SET) {
+ } else if (widgetSource.obj.layout == ObjectType.Layout.SET || widgetSource.obj.layout == ObjectType.Layout.OBJECT_TYPE) {
+ Timber.d("onCreateDataViewObject:source is set")
val dataViewSource = widgetSource.obj.setOf.firstOrNull()
if (dataViewSource != null) {
- val dataViewSourceObj =
- ObjectWrapper.Basic(obj.details[dataViewSource].orEmpty())
+ val dataViewSourceObj = ObjectWrapper.Basic(
+ obj.details[dataViewSource].orEmpty()
+ )
if (dv != null && viewer != null) {
+ Timber.d("onCreateDataViewObject:found dv and view")
when (val layout = dataViewSourceObj.layout) {
ObjectType.Layout.OBJECT_TYPE -> {
proceedWithCreatingDataViewObject(
@@ -2140,7 +2149,6 @@ class HomeScreenViewModel(
navigate = navigate
)
}
-
ObjectType.Layout.RELATION -> {
proceedWithCreatingDataViewObject(
viewer,
@@ -2228,6 +2236,7 @@ class HomeScreenViewModel(
dv: DV,
navigate: Boolean = false
) {
+ Timber.d("proceedWithCreatingDataViewObject")
val dataViewSourceType = dataViewSourceObj.uniqueKey
val (_, defaultTemplate) = resolveTypeAndActiveViewTemplate(
viewer,
diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/SelectWidgetSourceViewModel.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/SelectWidgetSourceViewModel.kt
index 541b290bd4..53e685dd50 100644
--- a/presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/SelectWidgetSourceViewModel.kt
+++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/SelectWidgetSourceViewModel.kt
@@ -244,7 +244,10 @@ class SelectWidgetSourceViewModel(
isInEditMode = curr.isInEditMode
)
}
- if (view is BundledWidgetSourceView.AllObjects) {
+ if (
+ view is BundledWidgetSourceView.AllObjects
+ || view is BundledWidgetSourceView.Bin
+ ) {
isDismissed.value = true
}
}
diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/WidgetConfig.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/WidgetConfig.kt
index f683c5ffd1..36252637ad 100644
--- a/presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/WidgetConfig.kt
+++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/WidgetConfig.kt
@@ -32,6 +32,7 @@ object WidgetConfig {
code == ObjectType.Layout.PARTICIPANT.code ||
code == ObjectType.Layout.IMAGE.code ||
code == ObjectType.Layout.VIDEO.code ||
+ code == ObjectType.Layout.AUDIO.code ||
code == ObjectType.Layout.FILE.code
}
diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/WidgetView.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/WidgetView.kt
index 7f5b047cbf..13d500a8d7 100644
--- a/presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/WidgetView.kt
+++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/WidgetView.kt
@@ -1,10 +1,12 @@
package com.anytypeio.anytype.presentation.widgets
import com.anytypeio.anytype.core_models.Id
+import com.anytypeio.anytype.core_models.ObjectType
import com.anytypeio.anytype.core_models.ObjectWrapper
import com.anytypeio.anytype.core_models.RelativeDate
import com.anytypeio.anytype.core_models.SHARED_SPACE_TYPE
import com.anytypeio.anytype.core_models.SpaceType
+import com.anytypeio.anytype.core_models.SupportedLayouts
import com.anytypeio.anytype.presentation.editor.cover.CoverView
import com.anytypeio.anytype.presentation.editor.model.Indent
import com.anytypeio.anytype.presentation.objects.ObjectIcon
@@ -72,12 +74,31 @@ sealed class WidgetView {
val isExpanded: Boolean,
val isCompact: Boolean = false,
val name: Name
- ) : WidgetView(), Draggable {
+ ) : WidgetView(), Draggable {
+ val canCreateObjectOfType : Boolean get() {
+ return when(source) {
+ Widget.Source.Bundled.AllObjects -> false
+ Widget.Source.Bundled.Bin -> false
+ Widget.Source.Bundled.Favorites -> true
+ Widget.Source.Bundled.Recent -> false
+ Widget.Source.Bundled.RecentLocal -> false
+ is Widget.Source.Default -> {
+ if (source.obj.layout == ObjectType.Layout.OBJECT_TYPE) {
+ val wrapper = ObjectWrapper.Type(source.obj.map)
+ SupportedLayouts.createObjectLayouts.contains(wrapper.recommendedLayout)
+ } else {
+ true
+ }
+ }
+ }
+ }
+
data class Tab(
val id: Id,
val name: String,
val isSelected: Boolean
)
+
data class Element(
override val objectIcon: ObjectIcon,
override val obj: ObjectWrapper.Basic,