mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-07-28 20:49:50 +00:00
desktop: use correct remote host when creating/connecting via links (#3409)
This commit is contained in:
+4
-3
@@ -9,10 +9,11 @@ import dev.icerock.moko.resources.compose.painterResource
|
||||
import dev.icerock.moko.resources.compose.stringResource
|
||||
import androidx.compose.ui.unit.sp
|
||||
import chat.simplex.common.model.ChatModel
|
||||
import chat.simplex.common.model.RemoteHostInfo
|
||||
import chat.simplex.res.MR
|
||||
|
||||
@Composable
|
||||
actual fun ConnectViaLinkView(m: ChatModel, rhId: Long?, close: () -> Unit) {
|
||||
actual fun ConnectViaLinkView(m: ChatModel, rh: RemoteHostInfo?, close: () -> Unit) {
|
||||
// TODO this should close if remote host changes in model
|
||||
val selection = remember {
|
||||
mutableStateOf(
|
||||
@@ -32,10 +33,10 @@ actual fun ConnectViaLinkView(m: ChatModel, rhId: Long?, close: () -> Unit) {
|
||||
Column(Modifier.weight(1f)) {
|
||||
when (selection.value) {
|
||||
ConnectViaLinkTab.SCAN -> {
|
||||
ScanToConnectView(m, rhId, close)
|
||||
ScanToConnectView(m, rh, close)
|
||||
}
|
||||
ConnectViaLinkTab.PASTE -> {
|
||||
PasteToConnectView(m, rhId, close)
|
||||
PasteToConnectView(m, rh, close)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -4,17 +4,18 @@ import android.Manifest
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import chat.simplex.common.model.ChatModel
|
||||
import chat.simplex.common.model.RemoteHostInfo
|
||||
import com.google.accompanist.permissions.rememberPermissionState
|
||||
|
||||
@Composable
|
||||
actual fun ScanToConnectView(chatModel: ChatModel, rhId: Long?, close: () -> Unit) {
|
||||
actual fun ScanToConnectView(chatModel: ChatModel, rh: RemoteHostInfo?, close: () -> Unit) {
|
||||
val cameraPermissionState = rememberPermissionState(permission = Manifest.permission.CAMERA)
|
||||
LaunchedEffect(Unit) {
|
||||
cameraPermissionState.launchPermissionRequest()
|
||||
}
|
||||
ConnectContactLayout(
|
||||
chatModel = chatModel,
|
||||
rhId = rhId,
|
||||
rh = rh,
|
||||
incognitoPref = chatModel.controller.appPrefs.incognito,
|
||||
close = close
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user