Skip to content

Your Android phone and your Windows PC, working as one. Local-first, end-to-end encrypted, no account.

Phone and tablet pairing on Android

Beef18fa705006a
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index f9d7cfe..c3f1bbb 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -193,6 +193,10 @@
android:name=".files.TransferNotifications$CancelReceiver"
android:exported="false" />
+ <receiver
+ android:name=".notifications.PcNotificationPoster$DismissReceiver"
+ android:exported="false" />
+
<!-- Android's answers while installing an update. -->
<receiver
android:name=".update.AppUpdater$InstallResult"
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.kt
index 404cf3f..84ecbf2 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
@@ -654,13 +654,15 @@ class Core(context: Context, private val scope: CoroutineScope) : EventListener
}
}
is Event.NotificationPosted -> scope.launch(Dispatchers.Default) {
- pcNotificationPoster.post(event.id, event.notification)
+ val (peer, name) = peerOf(event.id)
+ pcNotificationPoster.post(event.id, event.notification, peer, name)
}
is Event.NotificationRemoved -> scope.launch(Dispatchers.Default) {
pcNotificationPoster.cancel(event.id, event.key)
}
is Event.NotificationsReset -> scope.launch(Dispatchers.Default) {
- pcNotificationPoster.reset(event.id, event.items)
+ val (peer, name) = peerOf(event.id)
+ pcNotificationPoster.reset(event.id, event.items, peer, name)
}
is Event.PcAudioFrame -> pcSpeakerPlayer.playFrame(
event.sampleRate.toInt(),
@@ -948,6 +950,17 @@ class Core(context: Context, private val scope: CoroutineScope) : EventListener
}
}
+ /** Whether [id] is a paired phone or tablet (not a PC), and its name. */
+ private fun peerOf(id: String): Pair<Boolean, String> {
+ val device = _state.value.devices.firstOrNull { it.id == id }
+ return (device?.isAndroid == true) to device?.name.orEmpty()
+ }
+
+ /** Dismisses a paired phone's or tablet's notification there (dismissed here). */
+ fun dismissPeerNotification(id: String, key: String) {
+ command { it.dismissPeerNotification(id, key) }
+ }
+
/** Stops this phone's microphone stream to [pcId] and tells the PC. */
fun micStop(pcId: String) {
command { it.micStop(pcId) }
@@ -1623,6 +1636,8 @@ class Core(context: Context, private val scope: CoroutineScope) : EventListener
CLIPBOARD_CAPABILITIES +
// Play on phone: shows a PC's playback, streamed from the PC.
listOf("media.watch") +
+ // Shows a paired phone's or tablet's notifications.
+ listOf("notify.show") +
// Phone as microphone: asks for the permission when a PC first wants it.
(if (context.packageManager.hasSystemFeature(PackageManager.FEATURE_MICROPHONE)) listOf("mic.stream") else emptyList()) +
toggles.capabilities() +
@@ -1697,6 +1712,21 @@ class Core(context: Context, private val scope: CoroutineScope) : EventListener
}
}
+ /**
+ * A pairing link for another phone or tablet to scan (this device hosts the pairing,
+ * as a PC does); null if the core can't make one now.
+ */
+ suspend fun pairingLink(): String? {
+ startJob?.join()
+ val node = node ?: return null
+ return try {
+ node.pairingStartQr()
+ } catch (e: NectarlinkException) {
+ _messages.tryEmit(describe(e))
+ null
+ }
+ }
+
/** Pairs with a nearby PC that shows its pairing screen. */
fun pairNearby(peer: String) = command {
_state.update { it.copy(pairing = PairingState.Connecting(peer)) }
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.kt
index 46d5752..c82576b 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
@@ -144,6 +144,10 @@ data class Device(
/** Whether this PC is allowed to browse this phone's storage in File Explorer (off by default). */
val storageEnabled: Boolean = false,
) {
+ /** A paired phone or tablet rather than a PC. */
+ val isAndroid: Boolean
+ get() = kind == app.nectarlink.core.DeviceKind.PHONE || kind == app.nectarlink.core.DeviceKind.TABLET
+
val online: Boolean get() = link is Link.Online
/** Whether a feature works with this device now (the capability matrix). */
diff --git a/android/app/src/main/kotlin/app/nectarlink/android/notifications/PcNotificationPoster.kt b/android/app/src/main/kotlin/app/nectarlink/android/notifications/PcNotificationPoster.kt
index 32d7d93..573c048 100644
--- a/android/app/src/main/kotlin/app/nectarlink/android/notifications/PcNotificationPoster.kt
+++ b/android/app/src/main/kotlin/app/nectarlink/android/notifications/PcNotificationPoster.kt
@@ -5,6 +5,7 @@ import android.Manifest
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
+import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
@@ -12,6 +13,7 @@ import android.graphics.BitmapFactory
import android.os.Build
import androidx.core.app.NotificationCompat
import androidx.core.content.ContextCompat
+import app.nectarlink.android.NectarlinkApplication
import app.nectarlink.android.R
import app.nectarlink.android.ui.MainActivity
import java.util.concurrent.ConcurrentHashMap
@@ -20,7 +22,9 @@ typealias MirroredNotification = app.nectarlink.core.Notification
/**
* Posts notifications mirrored from a paired PC (`notify.push` / `notify.list` / `notify.dismiss`)
- * into Android's system notification shade.
+ * into Android's system notification shade, and those of a paired phone or tablet
+ * (`notify.posted`), on a channel of their own: dismissing one of those here dismisses it on
+ * that device too.
*/
class PcNotificationPoster(context: Context) {
private val context = context.applicationContext
@@ -35,9 +39,21 @@ class PcNotificationPoster(context: Context) {
NotificationManager.IMPORTANCE_DEFAULT,
)
manager?.createNotificationChannel(channel)
+ manager?.createNotificationChannel(
+ NotificationChannel(
+ PEER_CHANNEL_ID,
+ this.context.getString(R.string.channel_peer_notifications),
+ NotificationManager.IMPORTANCE_DEFAULT,
+ ),
+ )
}
- fun post(deviceId: String, n: MirroredNotification) {
+ /**
+ * Posts [n] from [deviceId]. For a paired phone or tablet ([fromPeer]), it goes on the
+ * peer channel, says which device it came from ([deviceName]), and dismissing it here
+ * dismisses it there.
+ */
+ fun post(deviceId: String, n: MirroredNotification, fromPeer: Boolean = false, deviceName: String = "") {
val nm = manager ?: return
if (!canPostNotifications()) return
val keys = activeKeysByDevice.getOrPut(deviceId) { ConcurrentHashMap.newKeySet() }
@@ -50,16 +66,34 @@ class PcNotificationPoster(context: Context) {
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE,
)
- val title = n.title?.takeIf(String::isNotBlank) ?: n.appName.ifBlank { context.getString(R.string.your_pc) }
+ val fallback = if (fromPeer) deviceName else context.getString(R.string.your_pc)
+ val title = n.title?.takeIf(String::isNotBlank) ?: n.appName.ifBlank { fallback }
val body = n.text.orEmpty()
- val builder = NotificationCompat.Builder(context, CHANNEL_ID)
+ val sub = if (fromPeer && deviceName.isNotBlank()) {
+ listOf(n.appName, deviceName).filter(String::isNotBlank).joinToString(" · ")
+ } else {
+ n.appName
+ }
+ val builder = NotificationCompat.Builder(context, if (fromPeer) PEER_CHANNEL_ID else CHANNEL_ID)
.setSmallIcon(R.drawable.ic_notification)
.setContentTitle(title)
.setContentText(body)
- .setSubText(n.appName.takeIf(String::isNotBlank))
+ .setSubText(sub.takeIf(String::isNotBlank))
.setAutoCancel(true)
.setSilent(n.silent)
.setContentIntent(tapIntent)
+ if (fromPeer) {
+ builder.setDeleteIntent(
+ PendingIntent.getBroadcast(
+ context,
+ notificationId(deviceId, n.key),
+ Intent(context, DismissReceiver::class.java)
+ .putExtra(DismissReceiver.EXTRA_DEVICE, deviceId)
+ .putExtra(DismissReceiver.EXTRA_KEY, n.key),
+ PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE,
+ ),
+ )
+ }
if (body.length > 48) {
builder.setStyle(NotificationCompat.BigTextStyle().bigText(body))
@@ -81,14 +115,14 @@ class PcNotificationPoster(context: Context) {
manager?.cancel(notificationId(deviceId, key))
}
- fun reset(deviceId: String, items: List<MirroredNotification>) {
+ fun reset(deviceId: String, items: List<MirroredNotification>, fromPeer: Boolean = false, deviceName: String = "") {
val newKeys = items.map { it.key }.toSet()
val previous = activeKeysByDevice[deviceId]?.toSet().orEmpty()
for (removedKey in previous - newKeys) {
manager?.cancel(notificationId(deviceId, removedKey))
}
for (item in items) {
- post(deviceId, item)
+ post(deviceId, item, fromPeer, deviceName)
}
}
@@ -112,5 +146,20 @@ class PcNotificationPoster(context: Context) {
companion object {
const val CHANNEL_ID = "pc_notifications"
+ const val PEER_CHANNEL_ID = "peer_notifications"
+ }
+
+ /** The user dismissed a paired phone's or tablet's notification here: dismiss it there. */
+ class DismissReceiver : BroadcastReceiver() {
+ override fun onReceive(context: Context, intent: Intent) {
+ val device = intent.getStringExtra(EXTRA_DEVICE) ?: return
+ val key = intent.getStringExtra(EXTRA_KEY) ?: return
+ (context.applicationContext as NectarlinkApplication).core.dismissPeerNotification(device, key)
+ }
+
+ companion object {
+ const val EXTRA_DEVICE = "device"
+ const val EXTRA_KEY = "key"
+ }
}
}
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.kt
index 42c4749..0196bc5 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
@@ -483,6 +483,7 @@ private fun App(
override fun pairNearby(id: String) = core.pairNearby(id)
override fun confirm(matches: Boolean) = core.confirmCode(matches)
override fun reset() = core.resetPairing()
+ override suspend fun showCode(): String? = core.pairingLink()
}
}
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.kt
index 2d1ab10..d0f3e5b 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
@@ -533,7 +533,7 @@ fun HomeScreen(
}
}
}
- if (state.devices.isEmpty()) {
+ if (state.devices.none { !it.isAndroid }) {
item(key = "no_paired_pc_card", contentType = "empty_pc") {
NoPairedPcCard(
onPairNew = onPairNew,
@@ -544,7 +544,7 @@ fun HomeScreen(
)
}
}
- items(state.devices, key = { it.id }, contentType = { "pc_card" }) { device ->
+ items(state.devices.filter { !it.isAndroid }, key = { it.id }, contentType = { "pc_card" }) { device ->
Box(
modifier = Modifier.guideHighlightRing(
highlighted = pulsingTarget == GuideHighlightTarget.HOME_PC_CARD ||
@@ -568,6 +568,10 @@ fun HomeScreen(
)
}
}
+ // Another phone or tablet paired with this one.
+ items(state.devices.filter { it.isAndroid }, key = { it.id }, contentType = { "peer_card" }) { device ->
+ PeerCard(device = device, onRing = onRing, onSendFiles = onSendFiles)
+ }
if (state.sendQueue.isNotEmpty()) {
item(key = "send_queue", contentType = "send_queue") {
Box(
@@ -1193,6 +1197,88 @@ private fun KeyboardBanner(from: String, onStop: () -> Unit) {
}
}
+@Composable
+private fun PeerCard(
+ device: Device,
+ onRing: (String, Boolean) -> Unit,
+ onSendFiles: (String, List<Uri>) -> Unit,
+) {
+ val context = LocalContext.current
+ val pickFiles = rememberLauncherForActivityResult(ActivityResultContracts.OpenMultipleDocuments()) { uris ->
+ if (uris.isNotEmpty()) onSendFiles(device.id, uris)
+ }
+ var ringing by remember(device.id) { mutableStateOf(false) }
+ val isGlass = LocalGlassTheme.current
+ Column(
+ modifier = Modifier
+ .fillMaxWidth()
+ .liquidGlassCard(
+ cornerRadius = 28.dp,
+ isGlass = isGlass,
+ baseColor = MaterialTheme.colorScheme.surfaceContainerHigh,
+ tintColor = MaterialTheme.colorScheme.primary,
+ outlineColor = if (isGlass) MaterialTheme.colorScheme.outlineVariant else Color.Transparent,
+ )
+ .padding(22.dp),
+ verticalArrangement = Arrangement.spacedBy(12.dp),
+ ) {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Column(Modifier.weight(1f)) {
+ Text(device.name, style = MaterialTheme.typography.titleLarge)
+ Text(
+ text = stringResource(
+ if (device.kind == app.nectarlink.core.DeviceKind.TABLET) R.string.peer_kind_tablet else R.string.peer_kind_phone,
+ ) + " · " + linkText(device.link),
+ style = MaterialTheme.typography.bodyMedium,
+ color = MaterialTheme.colorScheme.onSurfaceVariant,
+ )
+ }
+ device.battery?.let { battery ->
+ Text(
+ text = if (battery.charging) stringResource(R.string.battery_charging, battery.level.toInt())
+ else stringResource(R.string.battery_level, battery.level.toInt()),
+ style = MaterialTheme.typography.labelMedium,
+ )
+ }
+ }
+ Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
+ FilledTonalButton(
+ contentPadding = CardButtonPadding,
+ enabled = device.online && device.has("pair.ring"),
+ onClick = {
+ ringing = !ringing
+ onRing(device.id, ringing)
+ },
+ modifier = Modifier.weight(1f),
+ ) {
+ Icon(imageVector = BellIcon, contentDescription = null, modifier = Modifier.size(15.dp))
+ Spacer(Modifier.width(6.dp))
+ ButtonLabel(stringResource(if (ringing) R.string.action_stop_ringing else R.string.action_ring_device))
+ }
+ FilledTonalButton(
+ contentPadding = CardButtonPadding,
+ enabled = !device.online || device.has("pair.files"),
+ onClick = { pickFiles.launch(arrayOf("*/*")) },
+ modifier = Modifier.weight(1f),
+ ) {
+ Icon(imageVector = SendArrowIcon, contentDescription = null, modifier = Modifier.size(15.dp))
+ Spacer(Modifier.width(6.dp))
+ ButtonLabel(stringResource(R.string.action_send_files))
+ }
+ }
+ FilledTonalButton(
+ contentPadding = CardButtonPadding,
+ enabled = !device.online || device.has("pair.clipboard"),
+ onClick = { context.startActivity(SendActivity.sendClipboardIntent(context, device.id)) },
+ modifier = Modifier.fillMaxWidth(),
+ ) {
+ Icon(imageVector = ClipboardIcon, contentDescription = null, modifier = Modifier.size(15.dp))
+ Spacer(Modifier.width(6.dp))
+ ButtonLabel(stringResource(R.string.action_send_clipboard))
+ }
+ }
+}
+
@Composable
private fun PcCard(
device: Device,
diff --git a/android/app/src/main/kotlin/app/nectarlink/android/ui/pairing/PairingScreen.kt b/android/app/src/main/kotlin/app/nectarlink/android/ui/pairing/PairingScreen.kt
index 239feae..f684f43 100644
--- a/android/app/src/main/kotlin/app/nectarlink/android/ui/pairing/PairingScreen.kt
+++ b/android/app/src/main/kotlin/app/nectarlink/android/ui/pairing/PairingScreen.kt
@@ -64,12 +64,16 @@ interface PairingActions {
fun pairNearby(id: String)
fun confirm(matches: Boolean)
fun reset()
+
+ /** A pairing link for another phone or tablet to scan, or null. */
+ suspend fun showCode(): String?
}
/**
* Pairing with a PC: scan the QR code it shows, or pick it from the PCs
- * nearby and compare a 6-digit code. `onDone` runs after success (or when
- * the user backs out, if `cancellable`).
+ * nearby and compare a 6-digit code. Pairing with another phone or tablet:
+ * one shows a code ("Show a code") and the other scans it. `onDone` runs
+ * after success (or when the user backs out, if `cancellable`).
*/
@Composable
fun PairingScreen(
@@ -79,6 +83,7 @@ fun PairingScreen(
onDone: () -> Unit,
) {
var nearby by rememberSaveable { mutableStateOf(false) }
+ var showing by rememberSaveable { mutableStateOf(false) }
val pairing = state.pairing
val reducedMotion = LocalReducedMotion.current
DisposableEffect(Unit) {
@@ -104,7 +109,11 @@ fun PairingScreen(
is PairingState.Comparing, is PairingState.Confirmed -> stringResource(R.string.pair_check_code)
is PairingState.Paired -> stringResource(R.string.pair_done_title)
is PairingState.Failed -> stringResource(R.string.pair_failed_title)
- else -> if (nearby) stringResource(R.string.pair_nearby_title) else stringResource(R.string.pair_title)
+ else -> when {
+ showing -> stringResource(R.string.pair_show_title)
+ nearby -> stringResource(R.string.pair_nearby_title)
+ else -> stringResource(R.string.pair_title)
+ }
},
style = MaterialTheme.typography.headlineMedium,
textAlign = TextAlign.Center,
@@ -112,7 +121,7 @@ fun PairingScreen(
Spacer(Modifier.height(20.dp))
AnimatedContent(
- targetState = pairing to nearby,
+ targetState = Triple(pairing, nearby, showing),
transitionSpec = {
if (reducedMotion) {
EnterTransition.None togetherWith ExitTransition.None
@@ -122,12 +131,12 @@ fun PairingScreen(
},
modifier = Modifier.weight(1f),
label = "pairing",
- ) { (current, showNearby) ->
+ ) { (current, showNearby, showCode) ->
when (current) {
- PairingState.Idle -> if (showNearby) {
- NearbyList(state.discovered, actions::pairNearby)
- } else {
- Scan(actions::join)
+ PairingState.Idle -> when {
+ showCode -> ShowCode(actions)
+ showNearby -> NearbyList(state.discovered, actions::pairNearby)
+ else -> Scan(actions::join)
}
PairingState.Joining -> Working(stringResource(R.string.pair_joining))
is PairingState.Connecting ->
@@ -148,8 +157,16 @@ fun PairingScreen(
}
if (pairing == PairingState.Idle) {
- FilledTonalButton(onClick = { nearby = !nearby }) {
- Text(stringResource(if (nearby) R.string.action_scan_instead else R.string.action_pair_nearby))
+ if (!showing) {
+ FilledTonalButton(onClick = { nearby = !nearby }) {
+ Text(stringResource(if (nearby) R.string.action_scan_instead else R.string.action_pair_nearby))
+ }
+ }
+ TextButton(onClick = {
+ showing = !showing
+ nearby = false
+ }) {
+ Text(stringResource(if (showing) R.string.action_scan_instead else R.string.action_show_code))
}
}
if (cancellable && pairing !is PairingState.Paired) {
@@ -158,6 +175,69 @@ fun PairingScreen(
}
}
+/** This device's pairing code, for another phone or tablet to scan. */
+@Composable
+private fun ShowCode(actions: PairingActions) {
+ var link by androidx.compose.runtime.remember { mutableStateOf<String?>(null) }
+ LaunchedEffect(Unit) { link = actions.showCode() }
+ Column(horizontalAlignment = Alignment.CenterHorizontally) {
+ Text(
+ stringResource(R.string.pair_show_hint),
+ style = MaterialTheme.typography.bodyLarge,
+ textAlign = TextAlign.Center,
+ )
+ Spacer(Modifier.height(20.dp))
+ val current = link
+ val label = stringResource(R.string.pair_show_qr_desc)
+ Box(
+ modifier = Modifier
+ .fillMaxWidth(0.8f)
+ .aspectRatio(1f)
+ .clip(androidx.compose.foundation.shape.RoundedCornerShape(20.dp))
+ .background(androidx.compose.ui.graphics.Color.White)
+ .padding(16.dp)
+ .semantics { contentDescription = label },
+ contentAlignment = Alignment.Center,
+ ) {
+ if (current == null) {
+ CircularProgressIndicator()
+ } else {
+ QrCode(current)
+ }
+ }
+ }
+}
+
+/** [text] as a QR code, black on the white it sits on. */
+@Composable
+private fun QrCode(text: String) {
+ val matrix = androidx.compose.runtime.remember(text) {
+ runCatching {
+ com.google.zxing.qrcode.QRCodeWriter().encode(
+ text,
+ com.google.zxing.BarcodeFormat.QR_CODE,
+ 0,
+ 0,
+ mapOf(com.google.zxing.EncodeHintType.MARGIN to 0),
+ )
+ }.getOrNull()
+ } ?: return
+ androidx.compose.foundation.Canvas(Modifier.fillMaxSize()) {
+ val cell = size.minDimension / matrix.width
+ for (y in 0 until matrix.height) {
+ for (x in 0 until matrix.width) {
+ if (matrix.get(x, y)) {
+ drawRect(
+ androidx.compose.ui.graphics.Color.Black,
+ topLeft = androidx.compose.ui.geometry.Offset(x * cell, y * cell),
+ size = androidx.compose.ui.geometry.Size(cell, cell),
+ )
+ }
+ }
+ }
+ }
+}
+
@Composable
private fun Scan(onLink: (String) -> Unit) {
Column(
diff --git a/android/app/src/main/res/values-zh-rCN/strings.xml b/android/app/src/main/res/values-zh-rCN/strings.xml
index 0d5ce07..9d1c3d8 100644
--- a/android/app/src/main/res/values-zh-rCN/strings.xml
+++ b/android/app/src/main/res/values-zh-rCN/strings.xml
@@ -3,7 +3,11 @@
<resources>
<string name="app_name">NectarLink</string>
<string name="pair_title">与电脑配对</string>
- <string name="pair_scan_hint">在电脑上打开NectarLink,将摄像头对准它显示的二维码。</string>
+ <string name="pair_show_title">配对手机或平板</string>
+ <string name="pair_show_hint">在你的另一部手机或平板上打开 NectarLink,轻触“配对”,然后扫描此代码。</string>
+ <string name="pair_show_qr_desc">供另一部手机或平板使用的配对代码</string>
+ <string name="action_show_code">改为配对手机或平板</string>
+ <string name="pair_scan_hint">在电脑上打开NectarLink,将摄像头对准它显示的二维码。另一部手机或平板会在“配对手机或平板”中显示它的二维码。</string>
<string name="pair_nearby_title">就近配对</string>
<string name="pair_nearby_hint">在电脑上打开NectarLink并停留在配对界面,它就会出现在这里。</string>
<string name="pair_looking">正在查找电脑…</string>
@@ -229,6 +233,9 @@
<string name="action_allow_camera">允许使用相机</string>
<string name="action_ring_pc">让电脑响铃</string>
<string name="action_stop_ringing">停止响铃</string>
+ <string name="action_ring_device">响铃</string>
+ <string name="peer_kind_phone">手机</string>
+ <string name="peer_kind_tablet">平板</string>
<string name="action_unpair">取消配对</string>
<string name="action_pair_new">配对另一台电脑</string>
<string name="action_refresh">刷新</string>
@@ -615,6 +622,7 @@
<string name="companion_wake_off">关联你的电脑,让 Android 在其 BLE 信标进入范围时唤醒 NectarLink</string>
<string name="companion_wake_associate">关联</string>
<string name="channel_pc_notifications">电脑通知</string>
+ <string name="channel_peer_notifications">来自你另一部手机或平板的通知</string>
<string name="action_browse_pc_files">浏览电脑文件</string>
<string name="pc_files_title">%1$s 上的文件</string>
<string name="pc_files_root">首页</string>
@@ -1131,10 +1139,10 @@
<string name="guide_doctor_privacy">诊断在手机与已配对电脑之间本地运行。</string>
<string name="guide_doctor_limits">部分手机厂商的省电模式必须设为不受限制。</string>
<string name="pair_link_title">要与 %1$s 配对吗?</string>
- <string name="pair_link_body">已打开一个配对链接。仅当您刚刚亲自扫描或打开此电脑的配对码时才进行配对。已配对的电脑可以接收此手机的通知和消息。</string>
+ <string name="pair_link_body">已打开一个配对链接。仅当您刚刚亲自扫描或打开此设备的配对码时才进行配对。已配对的设备可以接收此手机的通知和消息。</string>
<string name="pair_link_confirm">配对</string>
<string name="pair_link_cancel">取消</string>
- <string name="pair_link_unknown_pc">此电脑</string>
+ <string name="pair_link_unknown_pc">此设备</string>
<string name="data_clear_failed">部分历史记录无法清除。请重试。</string>
<string name="channel_updates">更新</string>
<string name="update_ready_title">NectarLink %1$s 已就绪</string>
diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml
index 194c5aa..14febd5 100644
--- a/android/app/src/main/res/values/strings.xml
+++ b/android/app/src/main/res/values/strings.xml
@@ -5,7 +5,11 @@
<!-- Pairing -->
<string name="pair_title">Pair with your PC</string>
- <string name="pair_scan_hint">On your PC, open NectarLink. Point the camera at the code it shows.</string>
+ <string name="pair_show_title">Pair a phone or tablet</string>
+ <string name="pair_show_hint">On your other phone or tablet, open NectarLink, tap Pair, and scan this code.</string>
+ <string name="pair_show_qr_desc">Pairing code for another phone or tablet</string>
+ <string name="action_show_code">Pair a phone or tablet instead</string>
+ <string name="pair_scan_hint">On your PC, open NectarLink. Point the camera at the code it shows. Another phone or tablet shows its code under Pair a phone or tablet.</string>
<string name="pair_nearby_title">Pair nearby</string>
<string name="pair_nearby_hint">On your PC, open NectarLink and keep its pairing screen open. It shows up here.</string>
<string name="pair_looking">Looking for PCs…</string>
@@ -237,6 +241,9 @@
<string name="action_allow_camera">Allow camera</string>
<string name="action_ring_pc">Ring PC</string>
<string name="action_stop_ringing">Stop ringing</string>
+ <string name="action_ring_device">Ring</string>
+ <string name="peer_kind_phone">Phone</string>
+ <string name="peer_kind_tablet">Tablet</string>
<string name="action_unpair">Unpair</string>
<string name="action_pair_new">Pair another PC</string>
<string name="action_refresh">Refresh</string>
@@ -671,6 +678,7 @@
<!-- PC notifications & Browse PC files -->
<string name="channel_pc_notifications">PC notifications</string>
+ <string name="channel_peer_notifications">Notifications from your other phone or tablet</string>
<string name="action_browse_pc_files">Browse PC files</string>
<string name="pc_files_title">Files on %1$s</string>
<string name="pc_files_root">Home</string>
@@ -1269,10 +1277,10 @@
<string name="guide_doctor_privacy">Diagnostics run locally between your phone and paired PC.</string>
<string name="guide_doctor_limits">Some phone makers\' battery savers must be set to Unrestricted.</string>
<string name="pair_link_title">Pair with %1$s?</string>
- <string name="pair_link_body">A pairing link was opened. Pair only if you just scanned or opened this PC\'s code yourself. A paired PC can receive this phone\'s notifications and messages.</string>
+ <string name="pair_link_body">A pairing link was opened. Pair only if you just scanned or opened this device\'s code yourself. A paired device can receive this phone\'s notifications and messages.</string>
<string name="pair_link_confirm">Pair</string>
<string name="pair_link_cancel">Cancel</string>
- <string name="pair_link_unknown_pc">this PC</string>
+ <string name="pair_link_unknown_pc">this device</string>
<string name="data_clear_failed">Some history couldn\'t be cleared. Try again.</string>
<string name="channel_updates">Updates</string>
<string name="update_ready_title">NectarLink %1$s is ready</string>