mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-3123 Spaces | Fix | Handle invite link for space where user is already a member and open this space (#1864)
(cherry picked from commit c02de4699e
)
This commit is contained in:
parent
9891019df0
commit
e71a36037b
3 changed files with 22 additions and 3 deletions
|
@ -21,6 +21,7 @@ import androidx.compose.ui.res.stringResource
|
|||
import androidx.core.os.bundleOf
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.ext.EMPTY_STRING_VALUE
|
||||
|
@ -39,6 +40,8 @@ import com.anytypeio.anytype.di.common.componentManager
|
|||
import com.anytypeio.anytype.presentation.common.TypedViewState
|
||||
import com.anytypeio.anytype.presentation.multiplayer.RequestJoinSpaceViewModel
|
||||
import com.anytypeio.anytype.presentation.multiplayer.RequestJoinSpaceViewModel.ErrorView
|
||||
import com.anytypeio.anytype.presentation.spaces.Command
|
||||
import com.anytypeio.anytype.ui.home.HomeScreenFragment
|
||||
import com.anytypeio.anytype.ui.notifications.NotificationPermissionPromptDialog
|
||||
import com.anytypeio.anytype.ui.settings.typography
|
||||
import javax.inject.Inject
|
||||
|
@ -268,6 +271,18 @@ class RequestJoinSpaceFragment : BaseBottomSheetComposeFragment() {
|
|||
}
|
||||
}
|
||||
}
|
||||
is RequestJoinSpaceViewModel.Command.SwitchToSpace -> {
|
||||
runCatching {
|
||||
findNavController().popBackStack(R.id.vaultScreen, false)
|
||||
findNavController().navigate(
|
||||
R.id.actionOpenSpaceFromVault,
|
||||
HomeScreenFragment.args(
|
||||
space = command.space.id,
|
||||
deeplink = null
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -614,7 +614,11 @@
|
|||
|
||||
<dialog
|
||||
android:id="@+id/requestJoinSpaceScreen"
|
||||
android:name="com.anytypeio.anytype.ui.multiplayer.RequestJoinSpaceFragment"/>
|
||||
android:name="com.anytypeio.anytype.ui.multiplayer.RequestJoinSpaceFragment">
|
||||
<action
|
||||
android:id="@+id/actionOpenSpaceFromVault"
|
||||
app:destination="@id/homeScreen" />
|
||||
</dialog>
|
||||
|
||||
<dialog
|
||||
android:id="@+id/howToShareSpaceScreen"
|
||||
|
|
|
@ -169,8 +169,7 @@ class RequestJoinSpaceViewModel(
|
|||
} else {
|
||||
spaceManager.set(space.id)
|
||||
saveCurrentSpace.async(params = SaveCurrentSpace.Params(space))
|
||||
// TODO navigate to the target space instead of dismissing
|
||||
commands.emit(Command.Dismiss)
|
||||
commands.emit(Command.SwitchToSpace(space))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -220,6 +219,7 @@ class RequestJoinSpaceViewModel(
|
|||
}
|
||||
data class ShowGenericMultiplayerError(val error: MultiplayerError.Generic) : Command()
|
||||
data object Dismiss: Command()
|
||||
data class SwitchToSpace(val space: SpaceId): Command()
|
||||
}
|
||||
|
||||
sealed class ErrorView {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue