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 289a3cead3..e7cbc83e4d 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 @@ -1342,7 +1342,7 @@ class HomeScreenViewModel( when(result) { is DeepLinkToObjectDelegate.Result.Error -> { val link = deeplink.invite - if (link != null) { + if (link != null && result is DeepLinkToObjectDelegate.Result.Error.PermissionNeeded) { commands.emit( Command.Deeplink.Invite( link = spaceInviteResolver.createInviteLink( diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/navigation/DeepLinkToObjectDelegate.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/navigation/DeepLinkToObjectDelegate.kt index efc184e3bf..afb95d62d7 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/navigation/DeepLinkToObjectDelegate.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/navigation/DeepLinkToObjectDelegate.kt @@ -60,16 +60,16 @@ interface DeepLinkToObjectDelegate { saveCurrentSpace.async(SaveCurrentSpace.Params(space = space)) Result.Success(wrapper) } else { - Result.Error + Result.Error.CouldNotOpenSpace } } else { return Result.Success(wrapper) } } else { - Result.Error + Result.Error.PermissionNeeded } } else { - return Result.Error + return Result.Error.ObjectNotFound } } @@ -101,24 +101,28 @@ interface DeepLinkToObjectDelegate { saveCurrentSpace.async(SaveCurrentSpace.Params(space = space)) Result.Success(wrapper) } else { - Result.Error + Result.Error.CouldNotOpenSpace } } else { Result.Success(wrapper) } } else { - Result.Error + Result.Error.PermissionNeeded } } ) } else { - emit(Result.Error) + emit(Result.Error.ObjectNotFound) } } } sealed class Result { - data object Error : Result() + sealed class Error : Result() { + object PermissionNeeded: Error() + object ObjectNotFound: Error() + object CouldNotOpenSpace: Error() + } data class Success(val obj: ObjectWrapper.Basic): Result() } } \ No newline at end of file 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 4dcdb449d3..e39ac133c6 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 @@ -209,7 +209,7 @@ class VaultViewModel( when(result) { is DeepLinkToObjectDelegate.Result.Error -> { val link = deeplink.invite - if (link != null) { + if (link != null && result is DeepLinkToObjectDelegate.Result.Error.PermissionNeeded) { commands.emit( Command.Deeplink.Invite( link = spaceInviteResolver.createInviteLink(