mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-2987 Widgets | Non valid object (#1740)
This commit is contained in:
parent
b3e96476fd
commit
b19f8765c3
16 changed files with 42 additions and 15 deletions
|
@ -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 -> {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1655,6 +1655,7 @@ Please provide specific details of your needs here.</string>
|
|||
|
||||
<string name="clipboard_panel_create_bookmark_from_clipboard">Create bookmark from clipboard</string>
|
||||
<string name="error_unexpected_layout">Error: unexpected layout</string>
|
||||
<string name="error_non_valid_object">Error: object ID is missing</string>
|
||||
|
||||
<string name="membership_price_pending">Pending...</string>"
|
||||
<string name="per_period">per %1$s</string>
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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}")
|
||||
}
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -238,6 +238,9 @@ class LibraryViewModel(
|
|||
is OpenObjectNavigation.UnexpectedLayoutError -> {
|
||||
sendToast("Unexpected layout: ${navigation.layout}")
|
||||
}
|
||||
OpenObjectNavigation.NonValidObject -> {
|
||||
sendToast("Object id is missing")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
)
|
||||
|
|
|
@ -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}]")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,6 +73,7 @@ class SpacesStorageViewModel(
|
|||
private val jobs = mutableListOf<Job>()
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
|
|
|
@ -262,6 +262,9 @@ class VaultViewModel(
|
|||
is OpenObjectNavigation.UnexpectedLayoutError -> {
|
||||
sendToast("Unexpected layout: ${navigation.layout}")
|
||||
}
|
||||
OpenObjectNavigation.NonValidObject -> {
|
||||
sendToast("Object id is missing")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -927,6 +927,9 @@ class CollectionViewModel(
|
|||
is OpenObjectNavigation.UnexpectedLayoutError -> {
|
||||
toasts.emit("Unexpected layout: ${navigation.layout}")
|
||||
}
|
||||
OpenObjectNavigation.NonValidObject -> {
|
||||
toasts.emit("Object id is missing")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue