Your Android phone and your Windows PC, working as one. Local-first, end-to-end encrypted, no account.
Android: phone microphone requests on Home, Stop, and a per-PC switch
Bee2192f4ae1831
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex a22d330..30535c3 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -32,7 +32,13 @@ change things that need a step from you, and its notes say so.([#7](https://github.com/thtbee/nectarlink/issues/7)). A microphone ofNectarLink's own, without the cable, needs an audio driver and comeslater. A volume slider sets how loud it plays, and the phone evens out a- quiet voice where it can.+ quiet voice where it can. The request also shows on the phone's Home,+ with Start and Not now, so it's seen with notifications off; Not now+ tells the PC, which stops waiting, and so does a request left unanswered+ for two minutes. While it's on, Home has a Stop button. Choosing another+ output on the PC moves the sound there right away, and **Use this phone+ as a microphone** in the phone's Settings, for each PC, turns asking off+ for that PC. Thanks to Jochen Kirstätter for finding the gaps.- **Pair a phone with a tablet (or another phone).** In NectarLink'spairing screen, **Pair a phone or tablet instead** shows a code to scanfrom the other device. Once paired, each shows the other on Home with itsdiff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xmlindex c3f1bbb..e0985e0 100644--- a/android/app/src/main/AndroidManifest.xml+++ b/android/app/src/main/AndroidManifest.xml@@ -337,6 +337,10 @@android:taskAffinity=""android:theme="@android:style/Theme.Translucent.NoTitleBar" />+ <receiver+ android:name=".mic.MicDeclineReceiver"+ android:exported="false" />+<serviceandroid:name=".webcam.WebcamService"android:exported="false"diff --git a/android/app/src/main/kotlin/app/nectarlink/android/core/Core.kt b/android/app/src/main/kotlin/app/nectarlink/android/core/Core.ktindex c689b62..d9e380c 100644--- a/android/app/src/main/kotlin/app/nectarlink/android/core/Core.kt+++ b/android/app/src/main/kotlin/app/nectarlink/android/core/Core.kt@@ -98,8 +98,12 @@ class Core(context: Context, private val scope: CoroutineScope) : EventListenerphoneMedia,onLink = { pc, url -> LinkNotifications.show(this.context, _state.value.nameOf(pc).orEmpty(), url) },onMic = { pc ->+ // Asked on Home too, so it's seen with notifications off or while the app is open.+ _state.update { it.copy(micRequestFrom = pc) }app.nectarlink.android.mic.MicRequests.show(this.context, pc, _state.value.nameOf(pc).orEmpty())+ true},+ onMicStop = { pc -> clearMicRequest(pc) },onWatch = { pc, player, title, file ->app.nectarlink.android.media.WatchOffers.show(this.context,@@ -360,10 +364,7 @@ class Core(context: Context, private val scope: CoroutineScope) : EventListener}node = startedval devices = runCatching { started.pairedDevices() }.getOrDefault(emptyList())- val storageAllowed = devices.mapNotNull { dev ->- val toggles = runCatching { started.deviceToggles(dev.id) }.getOrDefault(emptyList())- if (toggles.any { it.name == PhoneStorage.TOGGLE_NAME && it.enabled }) dev.id else null- }.toSet()+ val pcToggles = perPcToggles(started, devices.map { it.id })val clipHistEnabled = runCatching { started.clipboardHistoryEnabled() }.getOrDefault(true)val clipHist = if (clipHistEnabled) {runCatching { started.clipboardHistory(null) }.getOrDefault(emptyList())@@ -382,7 +383,7 @@ class Core(context: Context, private val scope: CoroutineScope) : EventListenerlocalsendMulticast?.runCatching { if (lsEnabled) acquire() else release() }pruneOldTempCaches()_state.update {- it.withDevices(devices, storageAllowed).copy(+ it.withDevices(devices, pcToggles.storageAllowed, pcToggles.micOff).copy(status = CoreStatus.Ready(started.deviceId()),sendQueue = initialQueue,clipboardHistoryEnabled = clipHistEnabled,@@ -561,14 +562,7 @@ class Core(context: Context, private val scope: CoroutineScope) : EventListener}val prevPhotos = _state.value.photoAccessval currentNode = node- val storageAllowed = if (currentNode != null) {- _state.value.devices.mapNotNull { dev ->- val devToggles = runCatching { currentNode.deviceToggles(dev.id) }.getOrDefault(emptyList())- if (devToggles.any { it.name == PhoneStorage.TOGGLE_NAME && it.enabled }) dev.id else null- }.toSet()- } else {- emptySet()- }+ val pcToggles = currentNode?.let { perPcToggles(it, _state.value.devices.map { d -> d.id }) }_state.update {it.copy(notificationAccess = granted,@@ -587,8 +581,10 @@ class Core(context: Context, private val scope: CoroutineScope) : EventListenerstorageAllFilesAccess = storageAllFilesAccess,storageSafFolders = storageSafFolders,localNetwork = localNetwork,- devices = if (currentNode != null) {- it.devices.map { d -> d.copy(storageEnabled = d.id in storageAllowed) }+ devices = if (pcToggles != null) {+ it.devices.map { d ->+ d.copy(storageEnabled = d.id in pcToggles.storageAllowed, micEnabled = d.id !in pcToggles.micOff)+ }} else {it.devices},@@ -967,6 +963,47 @@ class Core(context: Context, private val scope: CoroutineScope) : EventListenercommand { it.micStop(pcId) }}+ /** The PC's request for the microphone is answered or withdrawn: take it off Home and the shade. */+ fun clearMicRequest(pcId: String) {+ app.nectarlink.android.mic.MicRequests.dismiss(context, pcId)+ _state.update { if (it.micRequestFrom == pcId) it.copy(micRequestFrom = null) else it }+ }++ /** Not now: the PC stops waiting. */+ fun declineMicRequest(pcId: String) {+ clearMicRequest(pcId)+ micStop(pcId)+ }++ /**+ * Lets [pcId] ask for this phone's microphone, or not (on by default). Turning it off+ * also ends a stream to that PC, and the core tells the PC.+ */+ fun setMicEnabled(pcId: String, enabled: Boolean) {+ _state.update { it.withMicEnabled(pcId, enabled) }+ if (!enabled) app.nectarlink.android.mic.MicRequests.dismiss(context, pcId)+ scope.launch(Dispatchers.IO) {+ startJob?.join()+ val currentNode = node ?: return@launch+ runCatching { currentNode.setDeviceToggle(pcId, app.nectarlink.android.mic.MicService.TOGGLE_NAME, enabled) }+ .onFailure { Log.w(TAG, "can't change the microphone toggle", it) }+ }+ }++ /** Which PCs may browse this phone's storage, and which may not ask for its microphone. */+ private class PerPcToggles(val storageAllowed: Set<String>, val micOff: Set<String>)++ private fun perPcToggles(node: NectarlinkNode, ids: List<String>): PerPcToggles {+ val storage = mutableSetOf<String>()+ val micOff = mutableSetOf<String>()+ for (id in ids) {+ val toggles = runCatching { node.deviceToggles(id) }.getOrNull() ?: continue+ if (toggles.any { it.name == PhoneStorage.TOGGLE_NAME && it.enabled }) storage += id+ if (toggles.any { it.name == app.nectarlink.android.mic.MicService.TOGGLE_NAME && !it.enabled }) micOff += id+ }+ return PerPcToggles(storage, micOff)+ }+fun clearWebcamRequest(pcId: String? = null) {if (pcId != null) WebcamRequests.dismiss(context, pcId)_state.update { s ->diff --git a/android/app/src/main/kotlin/app/nectarlink/android/core/CoreState.kt b/android/app/src/main/kotlin/app/nectarlink/android/core/CoreState.ktindex c82576b..97b1527 100644--- a/android/app/src/main/kotlin/app/nectarlink/android/core/CoreState.kt+++ b/android/app/src/main/kotlin/app/nectarlink/android/core/CoreState.kt@@ -143,6 +143,8 @@ data class Device(val deckState: app.nectarlink.core.DeckState? = null,/** Whether this PC is allowed to browse this phone's storage in File Explorer (off by default). */val storageEnabled: Boolean = false,+ /** Whether this PC may ask for this phone's microphone (on by default). */+ val micEnabled: Boolean = true,) {/** A paired phone or tablet rather than a PC. */val isAndroid: Boolean@@ -211,6 +213,8 @@ data class CoreState(val storageRequestedFrom: String? = null,/** Pending request from a paired PC asking to use this phone's camera as a webcam. */val webcamRequest: WebcamRequest? = null,+ /** ID of a paired PC asking for this phone's microphone, until the user answers. */+ val micRequestFrom: String? = null,/** File transfers, newest first (running ones and the latest finished). */val transfers: List<Transfer> = emptyList(),/** Persistent outbound send queue items waiting to send, sending, failed, or expired. */@@ -251,7 +255,11 @@ data class CoreState(?: discovered.firstOrNull { it.id == id }?.name?: localsendPeers.firstOrNull { it.id == id }?.alias- fun withDevices(paired: List<PairedDevice>, storageAllowed: Set<String> = emptySet()): CoreState {+ fun withDevices(+ paired: List<PairedDevice>,+ storageAllowed: Set<String> = emptySet(),+ micOff: Set<String> = emptySet(),+ ): CoreState {val prevById = devices.associateBy { it.id }return copy(devices = paired.map { p ->@@ -260,6 +268,7 @@ data class CoreState(deckLayout = prev?.deckLayout,deckState = prev?.deckState,storageEnabled = if (p.id in storageAllowed) true else prev?.storageEnabled ?: false,+ micEnabled = p.id !in micOff,)}.sortedWith(deviceOrder),)@@ -268,6 +277,11 @@ data class CoreState(fun withWakeState(id: String, state: WakeState): CoreState =update(id) { it.copy(wakeState = state) }+ fun withMicEnabled(id: String, enabled: Boolean): CoreState =+ update(id) { it.copy(micEnabled = enabled) }.copy(+ micRequestFrom = if (!enabled && micRequestFrom == id) null else micRequestFrom,+ )+fun withStorageEnabled(id: String, enabled: Boolean): CoreState =update(id) { it.copy(storageEnabled = enabled) }.copy(storageRequestedFrom = if (enabled && storageRequestedFrom == id) null else storageRequestedFrom,@@ -285,6 +299,7 @@ data class CoreState(ringingFrom = if (ringingFrom == nameOf(event.id)) null else ringingFrom,storageRequestedFrom = if (storageRequestedFrom == event.id) null else storageRequestedFrom,webcamRequest = if (webcamRequest?.pcId == event.id) null else webcamRequest,+ micRequestFrom = if (micRequestFrom == event.id) null else micRequestFrom,keyboardFromPc = keyboardFromPc - event.id,)is Event.LinkChanged -> {@@ -313,6 +328,8 @@ data class CoreState(updated.copy(devices = if (onlineChanged) updated.devices.sortedWith(deviceOrder) else updated.devices,keyboardFromPc = if (newLink is Link.Offline) updated.keyboardFromPc - event.id else updated.keyboardFromPc,+ // A PC that went away can't take the microphone it asked for.+ micRequestFrom = updated.micRequestFrom.takeUnless { newLink is Link.Offline && it == event.id },)}}diff --git a/android/app/src/main/kotlin/app/nectarlink/android/core/PhonePlatform.kt b/android/app/src/main/kotlin/app/nectarlink/android/core/PhonePlatform.ktindex 6539905..37b64a1 100644--- a/android/app/src/main/kotlin/app/nectarlink/android/core/PhonePlatform.kt+++ b/android/app/src/main/kotlin/app/nectarlink/android/core/PhonePlatform.kt@@ -65,6 +65,8 @@ internal class PhonePlatform(private val onWatch: (String, String, String?, app.nectarlink.core.WatchFileOffer?) -> Boolean,/** Asks the user to start the microphone for a PC: PC's ID → asked. */private val onMic: (String) -> Boolean,+ /** The PC stopped asking for (or listening to) the microphone: PC's ID. */+ private val onMicStop: (String) -> Unit,/** Shows or updates a watched task from a PC: (PC's ID, task) → shown. */private val onTask: (String, TaskNotify) -> Boolean,/** The phone's calls (created after this). */@@ -211,7 +213,7 @@ internal class PhonePlatform(override fun micRequested(pcId: String): Boolean = onMic(pcId)override fun micStopRequested(pcId: String) {- app.nectarlink.android.mic.MicRequests.dismiss(context, pcId)+ onMicStop(pcId)app.nectarlink.android.mic.MicService.stop(context)}diff --git a/android/app/src/main/kotlin/app/nectarlink/android/mic/MicRequests.kt b/android/app/src/main/kotlin/app/nectarlink/android/mic/MicRequests.ktindex 53a6c7d..d7fad9b 100644--- a/android/app/src/main/kotlin/app/nectarlink/android/mic/MicRequests.kt+++ b/android/app/src/main/kotlin/app/nectarlink/android/mic/MicRequests.kt@@ -5,6 +5,7 @@ import android.Manifestimport android.app.NotificationChannelimport android.app.NotificationManagerimport android.app.PendingIntent+import android.content.BroadcastReceiverimport android.content.Contextimport android.content.Intentimport android.content.pm.PackageManager@@ -14,12 +15,14 @@ import androidx.activity.result.contract.ActivityResultContractsimport androidx.core.app.NotificationCompatimport androidx.core.app.NotificationManagerCompatimport androidx.core.content.ContextCompat+import app.nectarlink.android.NectarlinkApplicationimport app.nectarlink.android.R/*** A PC asking for this phone's microphone (`mic.start`). The microphone only turns on when- * the user taps: the notification opens [MicStartActivity], which asks for the microphone- * permission if needed and starts [MicService] from the foreground, as Android requires.+ * the user taps: the notification (or the card on Home) opens [MicStartActivity], which asks+ * for the microphone permission if needed and starts [MicService] from the foreground, as+ * Android requires. Not now, or swiping the notification away, tells the PC ([MicDeclineReceiver]).*/object MicRequests {private const val CHANNEL = "mic_requests"@@ -44,6 +47,12 @@ object MicRequests {.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK),PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT,)+ val decline = PendingIntent.getBroadcast(+ context,+ pcId.hashCode(),+ Intent(context, MicDeclineReceiver::class.java).putExtra(MicStartActivity.EXTRA_PC, pcId),+ PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT,+ )val from = pcName.ifEmpty { context.getString(R.string.your_pc) }val notification = NotificationCompat.Builder(context, CHANNEL).setSmallIcon(R.drawable.ic_notification)@@ -51,6 +60,8 @@ object MicRequests {.setContentText(context.getString(R.string.mic_request_text)).setContentIntent(start).addAction(0, context.getString(R.string.mic_request_start), start)+ .addAction(0, context.getString(R.string.action_not_now), decline)+ .setDeleteIntent(decline).setAutoCancel(true).setTimeoutAfter(REQUEST_TIMEOUT_MS).setCategory(NotificationCompat.CATEGORY_CALL)@@ -81,7 +92,7 @@ class MicStartActivity : ComponentActivity() {return}pcId = pc- MicRequests.dismiss(this, pc)+ (application as NectarlinkApplication).core.clearMicRequest(pc)if (MicService.hasPermission(this)) {MicService.start(this, pc)finish()@@ -94,3 +105,11 @@ class MicStartActivity : ComponentActivity() {const val EXTRA_PC = "mic_pc"}}++/** Not now on a PC's microphone request, or the request swiped away: the PC stops waiting. */+class MicDeclineReceiver : BroadcastReceiver() {+ override fun onReceive(context: Context, intent: Intent) {+ val pc = intent.getStringExtra(MicStartActivity.EXTRA_PC) ?: return+ (context.applicationContext as NectarlinkApplication).core.declineMicRequest(pc)+ }+}diff --git a/android/app/src/main/kotlin/app/nectarlink/android/mic/MicService.kt b/android/app/src/main/kotlin/app/nectarlink/android/mic/MicService.ktindex b34c657..fe2bdb3 100644--- a/android/app/src/main/kotlin/app/nectarlink/android/mic/MicService.kt+++ b/android/app/src/main/kotlin/app/nectarlink/android/mic/MicService.kt@@ -212,12 +212,23 @@ class MicService : Service() {ContextCompat.startForegroundService(context, intent)}+ /** The per-device toggle that lets a PC ask for the microphone (docs/protocol/mic.md). */+ const val TOGGLE_NAME = "mic"+/** The PC stopped listening. */fun stop(context: Context) {if (_streaming.value == null) returncontext.startService(Intent(context, MicService::class.java).setAction(ACTION_STOP))}+ /** The phone's user stopped it in the app: the PC is told. */+ fun stopFromUser(context: Context) {+ if (_streaming.value == null) return+ context.startService(+ Intent(context, MicService::class.java).setAction(ACTION_STOP).putExtra(EXTRA_FROM_USER, true),+ )+ }+private fun createChannel(context: Context) {context.getSystemService(NotificationManager::class.java)?.createNotificationChannel(NotificationChannel(CHANNEL, context.getString(R.string.channel_mic), NotificationManager.IMPORTANCE_LOW)diff --git a/android/app/src/main/kotlin/app/nectarlink/android/ui/MainActivity.kt b/android/app/src/main/kotlin/app/nectarlink/android/ui/MainActivity.ktindex 0196bc5..8180d09 100644--- a/android/app/src/main/kotlin/app/nectarlink/android/ui/MainActivity.kt+++ b/android/app/src/main/kotlin/app/nectarlink/android/ui/MainActivity.kt@@ -770,6 +770,7 @@ private fun App(val context = LocalContext.currentval mirrorSession by MirrorService.session.collectAsStateWithLifecycle()val webcamSession by WebcamService.session.collectAsStateWithLifecycle()+ val micStreamingTo by app.nectarlink.android.mic.MicService.streaming.collectAsStateWithLifecycle()val recorderFlow = remember {RecorderService.session.distinctUntilChanged { a, b ->a.active == b.active &&@@ -882,6 +883,9 @@ private fun App(mirrorSession = mirrorSession,webcamSession = webcamSession,recorderSession = recorderSession,+ micStreamingTo = micStreamingTo,+ onDeclineMicRequest = core::declineMicRequest,+ onStopMic = { app.nectarlink.android.mic.MicService.stopFromUser(context) },onStopMirror = { MirrorService.stopCurrent() },onOpenWebcam = { pcId ->webcamAutoStart = false@@ -925,6 +929,7 @@ private fun App(onAccessChanged = core::refreshNotificationAccess,updater = (context.applicationContext as NectarlinkApplication).updater,onSetStorageEnabled = core::setStorageEnabled,+ onSetMicEnabled = core::setMicEnabled,onAddSafFolder = core::addSafFolder,onRemoveSafFolder = core::removeSafFolder,onSetClipboardHistoryEnabled = core::setClipboardHistoryEnabled,diff --git a/android/app/src/main/kotlin/app/nectarlink/android/ui/home/HomeScreen.kt b/android/app/src/main/kotlin/app/nectarlink/android/ui/home/HomeScreen.ktindex 9cbbb4e..9107c01 100644--- a/android/app/src/main/kotlin/app/nectarlink/android/ui/home/HomeScreen.kt+++ b/android/app/src/main/kotlin/app/nectarlink/android/ui/home/HomeScreen.kt@@ -201,6 +201,8 @@ fun HomeScreen(onDismissStorageRequest: () -> Unit = {},onAcceptWebcamRequest: (app.nectarlink.android.webcam.WebcamRequest) -> Unit = {},onDismissWebcamRequest: () -> Unit = {},+ onDeclineMicRequest: (pcId: String) -> Unit = {},+ onStopMic: () -> Unit = {},onCopyClipboardHistory: (id: String) -> Unit = {},onPinClipboardHistory: (id: String, pinned: Boolean) -> Unit = { _, _ -> },onDeleteClipboardHistory: (id: String) -> Unit = {},@@ -221,6 +223,8 @@ fun HomeScreen(mirrorSession: MirrorSession = MirrorSession(),webcamSession: WebcamSession = WebcamSession(),recorderSession: RecorderSession = RecorderSession(),+ /** The PC this phone's microphone streams to, if any. */+ micStreamingTo: String? = null,onStopMirror: () -> Unit = {},onOpenWebcam: (pcId: String) -> Unit = {},onStopWebcam: () -> Unit = {},@@ -431,6 +435,17 @@ fun HomeScreen()}}+ micStreamingTo?.let { pcId ->+ item(key = "mic_active_banner", contentType = "banner") {+ val pcName = state.nameOf(pcId) ?: stringResource(R.string.your_pc)+ LiveStreamingBanner(+ title = stringResource(R.string.mic_notification_title, pcName),+ subtitle = stringResource(R.string.mic_notification_text),+ primaryActionLabel = stringResource(R.string.action_stop),+ onPrimaryAction = onStopMic,+ )+ }+ }state.keyboardFromPc.forEach { pcId ->item(key = "keyboard_$pcId", contentType = "banner") {val pcName = state.nameOf(pcId) ?: stringResource(R.string.your_pc)@@ -469,6 +484,43 @@ fun HomeScreen(}}}+ state.micRequestFrom?.takeIf { it != micStreamingTo }?.let { pcId ->+ item(key = "mic_request", contentType = "request") {+ val pcName = state.nameOf(pcId) ?: stringResource(R.string.your_pc)+ val context = LocalContext.current+ Surface(+ shape = MaterialTheme.shapes.extraLarge,+ color = MaterialTheme.colorScheme.secondaryContainer,+ ) {+ Column(Modifier.fillMaxWidth().padding(20.dp)) {+ Text(+ stringResource(R.string.mic_request_title, pcName),+ style = MaterialTheme.typography.titleMedium,+ color = MaterialTheme.colorScheme.onSecondaryContainer,+ )+ Spacer(Modifier.height(4.dp))+ Text(+ stringResource(R.string.mic_request_card_text),+ style = MaterialTheme.typography.bodyMedium,+ color = MaterialTheme.colorScheme.onSecondaryContainer,+ )+ Spacer(Modifier.height(12.dp))+ Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {+ Button(onClick = {+ // Asks for the microphone permission if needed, then starts.+ context.startActivity(+ android.content.Intent(context, app.nectarlink.android.mic.MicStartActivity::class.java)+ .putExtra(app.nectarlink.android.mic.MicStartActivity.EXTRA_PC, pcId),+ )+ }) { Text(stringResource(R.string.mic_request_start)) }+ OutlinedButton(onClick = { onDeclineMicRequest(pcId) }) {+ Text(stringResource(R.string.action_not_now))+ }+ }+ }+ }+ }+ }state.storageRequestedFrom?.let { pcId ->item(key = "storage_request", contentType = "request") {val pcName = state.nameOf(pcId) ?: stringResource(R.string.your_pc)diff --git a/android/app/src/main/kotlin/app/nectarlink/android/ui/settings/SettingsScreen.kt b/android/app/src/main/kotlin/app/nectarlink/android/ui/settings/SettingsScreen.ktindex 484e8b4..aa5c822 100644--- a/android/app/src/main/kotlin/app/nectarlink/android/ui/settings/SettingsScreen.kt+++ b/android/app/src/main/kotlin/app/nectarlink/android/ui/settings/SettingsScreen.kt@@ -104,6 +104,7 @@ fun SettingsScreen(onAccessChanged: () -> Unit,updater: AppUpdater,onSetStorageEnabled: (pcId: String, enabled: Boolean) -> Unit = { _, _ -> },+ onSetMicEnabled: (pcId: String, enabled: Boolean) -> Unit = { _, _ -> },onAddSafFolder: (Uri) -> Unit = {},onRemoveSafFolder: (String) -> Unit = {},onSetClipboardHistoryEnabled: (Boolean) -> Unit = {},@@ -500,6 +501,25 @@ fun SettingsScreen(modifier = Modifier.semantics { contentDescription = storageToggleTitle },)}+ if (!device.isAndroid) {+ val micToggleTitle = stringResource(R.string.mic_pc_toggle)+ Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth()) {+ Column(Modifier.weight(1f).padding(end = 12.dp)) {+ Text(micToggleTitle, style = MaterialTheme.typography.bodyMedium)+ Text(+ stringResource(R.string.mic_pc_toggle_hint),+ style = MaterialTheme.typography.bodySmall,+ color = MaterialTheme.colorScheme.onSurfaceVariant,+ )+ }+ Switch(+ checked = device.micEnabled,+ onCheckedChange = { enabled -> onSetMicEnabled(device.id, enabled) },+ colors = app.nectarlink.android.ui.theme.nectarSwitchColors(),+ modifier = Modifier.semantics { contentDescription = micToggleTitle },+ )+ }+ }}}FilledTonalButton(onClick = onPairNew) { Text(stringResource(R.string.action_pair_new)) }diff --git a/android/app/src/main/res/values-zh-rCN/strings.xml b/android/app/src/main/res/values-zh-rCN/strings.xmlindex 4dee79d..992ab96 100644--- a/android/app/src/main/res/values-zh-rCN/strings.xml+++ b/android/app/src/main/res/values-zh-rCN/strings.xml@@ -366,6 +366,9 @@<string name="mic_request_title">%1$s 想使用此手机的麦克风</string><string name="mic_request_text">轻触即可开始。在你或电脑停止之前会一直开启。</string><string name="mic_request_start">开始</string>+ <string name="mic_request_card_text">在你或电脑停止之前会一直开启。</string>+ <string name="mic_pc_toggle">将此手机用作麦克风</string>+ <string name="mic_pc_toggle_hint">默认开启。此电脑可以请求使用麦克风,只有在你轻触“开始”后才会开启。</string><string name="recorder_notification_recording">正在为 %1$s 录音</string><string name="recorder_notification_paused">录音已暂停(%1$s)</string><string name="recorder_permission_title">允许使用麦克风</string>diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xmlindex 94c6399..88a7559 100644--- a/android/app/src/main/res/values/strings.xml+++ b/android/app/src/main/res/values/strings.xml@@ -382,6 +382,9 @@<string name="mic_request_title">%1$s wants this phone\'s microphone</string><string name="mic_request_text">Tap to start. It stays on until you or the PC stop it.</string><string name="mic_request_start">Start</string>+ <string name="mic_request_card_text">It stays on until you or the PC stop it.</string>+ <string name="mic_pc_toggle">Use this phone as a microphone</string>+ <string name="mic_pc_toggle_hint">On by default. This PC can ask for the microphone. It only turns on when you tap Start.</string><string name="recorder_notification_recording">Recording for %1$s</string><string name="recorder_notification_paused">Recording paused (%1$s)</string><string name="recorder_permission_title">Allow microphone access</string>