diff --git a/app/src/main/java/com/anytypeio/anytype/ui/main/MainActivity.kt b/app/src/main/java/com/anytypeio/anytype/ui/main/MainActivity.kt index d2669d508c..959467b209 100644 --- a/app/src/main/java/com/anytypeio/anytype/ui/main/MainActivity.kt +++ b/app/src/main/java/com/anytypeio/anytype/ui/main/MainActivity.kt @@ -225,6 +225,9 @@ class MainActivity : AppCompatActivity(R.layout.activity_main), AppNavigation.Pr is OpenObjectNavigation.UnexpectedLayoutError -> { toast(getString(R.string.error_unexpected_layout)) } + OpenObjectNavigation.NonValidObject -> { + toast(getString(R.string.error_non_valid_object)) + } } } is Command.Deeplink.DeepLinkToObjectNotWorking -> { diff --git a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/holders/other/Title.kt b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/holders/other/Title.kt index 103bbd9f6b..405207d125 100644 --- a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/holders/other/Title.kt +++ b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/features/editor/holders/other/Title.kt @@ -111,7 +111,7 @@ sealed class Title(view: View) : BlockViewHolder(view), TextHolder { CoverGradient.GREEN_ORANGE -> R.drawable.wallpaper_gradient_3 CoverGradient.SKY -> R.drawable.wallpaper_gradient_4 else -> { - Timber.e("Unknown cover gradient: $coverGradient") + Timber.w("Unknown cover gradient: $coverGradient") 0 } } diff --git a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/widgets/TypeTemplatesWidget.kt b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/widgets/TypeTemplatesWidget.kt index 6d5f75acee..a628600429 100644 --- a/core-ui/src/main/java/com/anytypeio/anytype/core_ui/widgets/TypeTemplatesWidget.kt +++ b/core-ui/src/main/java/com/anytypeio/anytype/core_ui/widgets/TypeTemplatesWidget.kt @@ -719,7 +719,7 @@ private fun TemplateItemCoverImage(item: TemplateView.Template) { @Composable private fun TemplateItemCoverGradient(item: TemplateView.Template) { - item.coverGradient?.let { it -> + item.coverGradient?.let { val resourceId = when (it) { CoverGradient.YELLOW -> R.drawable.cover_gradient_yellow CoverGradient.RED -> R.drawable.cover_gradient_red @@ -730,7 +730,7 @@ private fun TemplateItemCoverGradient(item: TemplateView.Template) { CoverGradient.GREEN_ORANGE -> R.drawable.wallpaper_gradient_3 CoverGradient.SKY -> R.drawable.wallpaper_gradient_4 else -> { - Timber.e("Unknown cover gradient: $it") + Timber.w("Unknown cover gradient: $it") null } } diff --git a/domain/src/main/java/com/anytypeio/anytype/domain/launch/GetDefaultObjectType.kt b/domain/src/main/java/com/anytypeio/anytype/domain/launch/GetDefaultObjectType.kt index e963e99b87..faea1f4ebd 100644 --- a/domain/src/main/java/com/anytypeio/anytype/domain/launch/GetDefaultObjectType.kt +++ b/domain/src/main/java/com/anytypeio/anytype/domain/launch/GetDefaultObjectType.kt @@ -17,7 +17,6 @@ import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers import com.anytypeio.anytype.domain.base.ResultInteractor import com.anytypeio.anytype.domain.block.repo.BlockRepository import com.anytypeio.anytype.domain.config.UserSettingsRepository -import com.anytypeio.anytype.domain.workspace.SpaceManager import javax.inject.Inject class GetDefaultObjectType @Inject constructor( @@ -43,14 +42,14 @@ class GetDefaultObjectType @Inject constructor( defaultTemplate = item.defaultTemplateId ) } else { - fetchDefaultType(params) + fetchFallbackObjectType(params) } } else { - return fetchDefaultType(params) + return fetchFallbackObjectType(params) } } - private suspend fun fetchDefaultType(space: SpaceId): Response { + private suspend fun fetchFallbackObjectType(space: SpaceId): Response { val structs = blockRepository.searchObjects( space = space, limit = 1, diff --git a/feature-all-content/src/main/java/com/anytypeio/anytype/feature_allcontent/presentation/AllContentViewModel.kt b/feature-all-content/src/main/java/com/anytypeio/anytype/feature_allcontent/presentation/AllContentViewModel.kt index 44f61f3e83..83f35b1c54 100644 --- a/feature-all-content/src/main/java/com/anytypeio/anytype/feature_allcontent/presentation/AllContentViewModel.kt +++ b/feature-all-content/src/main/java/com/anytypeio/anytype/feature_allcontent/presentation/AllContentViewModel.kt @@ -14,6 +14,7 @@ import com.anytypeio.anytype.core_models.Relations import com.anytypeio.anytype.core_models.primitives.SpaceId import com.anytypeio.anytype.core_ui.extensions.simpleIcon import com.anytypeio.anytype.core_utils.ext.orNull +import com.anytypeio.anytype.core_utils.ext.toast import com.anytypeio.anytype.domain.all_content.RestoreAllContentState import com.anytypeio.anytype.domain.all_content.UpdateAllContentState import com.anytypeio.anytype.domain.base.fold @@ -704,6 +705,9 @@ class AllContentViewModel( Timber.e("Unexpected layout: ${navigation.layout}") commands.emit(Command.SendToast.UnexpectedLayout(navigation.layout?.name.orEmpty())) } + OpenObjectNavigation.NonValidObject -> { + Timber.e("Object id is missing") + } } } } diff --git a/localization/src/main/res/values/strings.xml b/localization/src/main/res/values/strings.xml index cdb22631c8..04fba93b70 100644 --- a/localization/src/main/res/values/strings.xml +++ b/localization/src/main/res/values/strings.xml @@ -1655,6 +1655,7 @@ Please provide specific details of your needs here. Create bookmark from clipboard Error: unexpected layout + Error: object ID is missing Pending..." per %1$s diff --git a/middleware/src/main/java/com/anytypeio/anytype/middleware/discovery/MDNSResolver.kt b/middleware/src/main/java/com/anytypeio/anytype/middleware/discovery/MDNSResolver.kt index 5b5798f14a..4df0b3bc50 100644 --- a/middleware/src/main/java/com/anytypeio/anytype/middleware/discovery/MDNSResolver.kt +++ b/middleware/src/main/java/com/anytypeio/anytype/middleware/discovery/MDNSResolver.kt @@ -58,7 +58,7 @@ class MDNSResolver( lock.release() } } catch (e: Exception) { - Timber.e(e, "Error while stopping MDNS resolver") + Timber.w(e, "Error while stopping MDNS resolver") } } diff --git a/payments/src/main/java/com/anytypeio/anytype/payments/playbilling/BillingClientLifecycle.kt b/payments/src/main/java/com/anytypeio/anytype/payments/playbilling/BillingClientLifecycle.kt index d1d405fd58..74e2444bf7 100644 --- a/payments/src/main/java/com/anytypeio/anytype/payments/playbilling/BillingClientLifecycle.kt +++ b/payments/src/main/java/com/anytypeio/anytype/payments/playbilling/BillingClientLifecycle.kt @@ -189,7 +189,7 @@ class BillingClientLifecycle( Timber.d("onProductDetailsResponse: ${productDetailsList.size} product(s)") processProductDetails(productDetailsList) } else { - Timber.e("onProductDetailsResponse: ${billingResult.responseCode}") + Timber.w("onProductDetailsResponse: ${billingResult.responseCode}") _builderSubProductWithProductDetails.value = BillingClientState.Error("onProductDetailsResponse: ${billingResult.responseCode}") } diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/EditorViewModel.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/EditorViewModel.kt index 12b6d381d6..5ea23e5e58 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/EditorViewModel.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/EditorViewModel.kt @@ -59,6 +59,7 @@ import com.anytypeio.anytype.core_utils.ext.cancel import com.anytypeio.anytype.core_utils.ext.isEndLineClick import com.anytypeio.anytype.core_utils.ext.replace import com.anytypeio.anytype.core_utils.ext.switchToLatestFrom +import com.anytypeio.anytype.core_utils.ext.toast import com.anytypeio.anytype.core_utils.ext.withLatestFrom import com.anytypeio.anytype.core_utils.tools.FeatureToggles import com.anytypeio.anytype.core_utils.tools.toPrettyString @@ -4438,6 +4439,9 @@ class EditorViewModel( is OpenObjectNavigation.UnexpectedLayoutError -> { sendToast("Unexpected layout: ${navigation.layout}") } + OpenObjectNavigation.NonValidObject -> { + sendToast("Object id is missing") + } } } @@ -4748,7 +4752,6 @@ class EditorViewModel( proceedWithSlashItem(item, target.requireTarget()) } else { controlPanelInteractor.onEvent(ControlPanelMachine.Event.Slash.OnStop) - Timber.e("Slash Widget Error, target is empty") } } 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 c7ed8e9c6c..a23bbbe741 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 @@ -1362,6 +1362,9 @@ class HomeScreenViewModel( is OpenObjectNavigation.UnexpectedLayoutError -> { sendToast("Unexpected layout: ${navigation.layout}") } + OpenObjectNavigation.NonValidObject -> { + sendToast("Object id is missing") + } } } @@ -2292,9 +2295,11 @@ sealed class OpenObjectNavigation { data class OpenEditor(val target: Id, val space: Id) : OpenObjectNavigation() data class OpenDataView(val target: Id, val space: Id): OpenObjectNavigation() data class UnexpectedLayoutError(val layout: ObjectType.Layout?): OpenObjectNavigation() + data object NonValidObject: OpenObjectNavigation() } fun ObjectWrapper.Basic.navigation() : OpenObjectNavigation { + if (!isValid) return OpenObjectNavigation.NonValidObject return when (layout) { ObjectType.Layout.BASIC, ObjectType.Layout.NOTE, diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/library/LibraryViewModel.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/library/LibraryViewModel.kt index 117436f406..5d71d3ac85 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/library/LibraryViewModel.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/library/LibraryViewModel.kt @@ -238,6 +238,9 @@ class LibraryViewModel( is OpenObjectNavigation.UnexpectedLayoutError -> { sendToast("Unexpected layout: ${navigation.layout}") } + OpenObjectNavigation.NonValidObject -> { + sendToast("Object id is missing") + } } } diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/objects/SelectObjectTypeViewModel.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/objects/SelectObjectTypeViewModel.kt index a18aec9831..3941dac9e8 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/objects/SelectObjectTypeViewModel.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/objects/SelectObjectTypeViewModel.kt @@ -13,6 +13,7 @@ import com.anytypeio.anytype.core_models.Id import com.anytypeio.anytype.core_models.Key import com.anytypeio.anytype.core_models.Marketplace import com.anytypeio.anytype.core_models.ObjectOrigin +import com.anytypeio.anytype.core_models.ObjectTypeIds import com.anytypeio.anytype.core_models.ObjectTypeUniqueKeys import com.anytypeio.anytype.core_models.ObjectWrapper import com.anytypeio.anytype.core_models.Relations @@ -223,6 +224,7 @@ class SelectObjectTypeViewModel( defaultObjectTypePipeline.emit(response.type) }, onFailure = { + defaultObjectTypePipeline.emit(TypeKey(ObjectTypeIds.NOTE)) Timber.e(it, "Error while getting default object type for init") } ) diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/sets/ObjectSetViewModel.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/sets/ObjectSetViewModel.kt index b68b8e07f4..8c1b1cfdb3 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/sets/ObjectSetViewModel.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/sets/ObjectSetViewModel.kt @@ -1694,9 +1694,9 @@ class ObjectSetViewModel( } } } - is ObjectRelationView.ObjectType.Deleted -> TODO() - is ObjectRelationView.Source -> TODO() - else -> TODO() + else -> { + Timber.d("Ignoring click on relation, relation:[${clicked.relation}]") + } } } is ListenerType.Relation.Featured -> { @@ -1706,7 +1706,7 @@ class ObjectSetViewModel( ) } else -> { - Timber.d("Ignoring click") + Timber.d("Ignoring click, listener:[${clicked}]") } } } diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/settings/SpacesStorageViewModel.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/settings/SpacesStorageViewModel.kt index 438a8352e6..865b5a6974 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/settings/SpacesStorageViewModel.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/settings/SpacesStorageViewModel.kt @@ -73,6 +73,7 @@ class SpacesStorageViewModel( private val jobs = mutableListOf() init { + Timber.d("SpacesStorageViewModel init, spaceId: ${vmParams.spaceId}") subscribeToViewEvents() subscribeToMiddlewareEvents() proceedWithGettingNodeUsageInfo() @@ -370,7 +371,7 @@ class SpacesStorageViewModel( val nodeSpaces = nodeUsageInfo.spaces if (activeSpace == null || bytesLimit == null || bytesLimit == 0F) { - Timber.e("SpacesStorage, Space Id or Node bytesLimit is null or 0") + Timber.w("SpacesStorage, Space Id or Node bytesLimit is null or 0") return emptyList() } diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/vault/VaultViewModel.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/vault/VaultViewModel.kt index 51fd8fc6c9..bdb85b8895 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/vault/VaultViewModel.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/vault/VaultViewModel.kt @@ -262,6 +262,9 @@ class VaultViewModel( is OpenObjectNavigation.UnexpectedLayoutError -> { sendToast("Unexpected layout: ${navigation.layout}") } + OpenObjectNavigation.NonValidObject -> { + sendToast("Object id is missing") + } } } diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/collection/CollectionViewModel.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/collection/CollectionViewModel.kt index 365e8ae200..5d55a36121 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/collection/CollectionViewModel.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/widgets/collection/CollectionViewModel.kt @@ -927,6 +927,9 @@ class CollectionViewModel( is OpenObjectNavigation.UnexpectedLayoutError -> { toasts.emit("Unexpected layout: ${navigation.layout}") } + OpenObjectNavigation.NonValidObject -> { + toasts.emit("Object id is missing") + } } }