1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 05:47:05 +09:00

DROID-2899 Multiplayer | Fix | Return verbose error when opening deep link to object (#1929)

This commit is contained in:
Evgenii Kozlov 2024-12-17 00:41:44 +01:00 committed by Evgenii Kozlov
parent 61496ff700
commit 7cea5bd9a8
3 changed files with 13 additions and 9 deletions

View file

@ -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(

View file

@ -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()
}
}

View file

@ -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(