Skip to content

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

0.1.1: instant sends from the phone, restricted settings help, Graphite on the phone

Bee8271460d5da1
diff --git a/.github/scripts/unwrap-notes.awk b/.github/scripts/unwrap-notes.awk
new file mode 100644
index 0000000..f7b76ef
--- /dev/null
+++ b/.github/scripts/unwrap-notes.awk
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: GPL-3.0-or-later
+# Joins hard-wrapped Markdown lines: GitHub shows every line break in
+# release notes. Headings, tables, list items, blank lines and code blocks
+# keep their own lines.
+/^```/ { fence = !fence; out[++n] = $0; next }
+fence { out[++n] = $0; next }
+{
+ line = $0
+ start = line ~ /^$/ || line ~ /^#/ || line ~ /^\|/ || line ~ /^ *([-*]|[0-9]+\.) /
+ prev = out[n]
+ if (!start && n > 0 && prev != "" && prev !~ /^#/ && prev !~ /^\|/ && prev !~ /^```/) {
+ sub(/^ +/, "", line); out[n] = prev " " line
+ } else {
+ out[++n] = line
+ }
+}
+END { for (i = 1; i <= n; i++) print out[i] }
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index f2e7513..da1df60 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -126,6 +126,7 @@ jobs:
sparse-checkout: |
Cargo.toml
CHANGELOG.md
+ .github/scripts
- name: Draft it
env:
GH_TOKEN: ${{ github.token }}
@@ -137,9 +138,10 @@ jobs:
sha256sum *.exe *.apk > SHA256SUMS.txt
cat SHA256SUMS.txt
# The notes: this version's section of CHANGELOG.md ("## <version> ..."),
- # or GitHub's generated notes when there isn't one.
+ # with its wrapped lines joined, or GitHub's generated notes when
+ # there isn't one.
awk -v v="${GITHUB_REF_NAME#v}" '$1=="##" && $2==v {f=1; next} f && /^## / {exit} f' \
- ../source/CHANGELOG.md > notes.md || true
+ ../source/CHANGELOG.md | awk -f ../source/.github/scripts/unwrap-notes.awk > notes.md || true
if [ -s notes.md ]; then notes=(--notes-file notes.md); else notes=(--generate-notes); fi
gh release create "${{ github.ref_name }}" *.exe *.apk SHA256SUMS.txt \
--repo "${{ github.repository }}" --draft "${notes[@]}" --title "$title"
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8a71beb..ae992e0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,41 @@ All notable changes to Nectarlink. Versions follow
[semantic versioning](https://semver.org); before 1.0, a minor version may
change things that need a step from you, and its notes say so.
+## 0.1.1 (2026-10-15)
+
+Fewer steps when sharing from the phone, clearer setup on phones that hold
+back permissions, and Graphite as the phone's default look.
+
+### Changed
+
+- **Sharing from the phone sends right away.** Choosing Nectarlink in the
+ Android share sheet starts the transfer immediately, with no Flick to send
+ card or Undo countdown. With more than one PC connected, you pick one first.
+ Progress shows in a notification with a **Cancel** button, followed by a
+ **Sent to** confirmation that clears itself.
+- **Files shared from the phone no longer open on the PC by themselves.** A
+ shared photo or document is saved to `Downloads\Nectarlink` and announced in
+ a notification. To have it open in its default app as it arrives, turn on
+ **Settings › Files & Sync › Open files shared from the phone** (off by
+ default).
+- **Graphite is the phone app's default theme**, in light or dark to match the
+ phone. Bloom and Glass remain in **Settings › Appearance**, and a theme you
+ already picked stays as it is. The Windows app is unchanged.
+
+### Fixed
+
+- **Restricted settings during phone setup.** On Android 13 and newer, an app
+ installed from a file can't get notification access or the accessibility
+ service, and on Android 15 and newer the SMS permission, until the user
+ allows restricted settings. When that happens, setup now explains it and
+ offers **Open app info**: tap ⋮, then **Allow restricted settings**, and
+ come back to grant.
+- **Manage buttons in phone setup.** For a permission that's already granted,
+ **Manage** now opens the screen where it can be changed: notification access,
+ App info, All files access or Accessibility. Before, it did nothing.
+- Release notes on GitHub keep their paragraphs instead of breaking at every
+ line of the changelog.
+
## 0.1.0 "Pollen" (2026-10-14)
The first public release of Nectarlink: the Windows app, the Android app and
diff --git a/Cargo.lock b/Cargo.lock
index 5268a79..dc70ea2 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2318,7 +2318,7 @@ dependencies = [
[[package]]
name = "nectarlink-adb"
-version = "0.1.0"
+version = "0.1.1"
dependencies = [
"thiserror 2.0.21",
"tokio",
@@ -2328,7 +2328,7 @@ dependencies = [
[[package]]
name = "nectarlink-cli"
-version = "0.1.0"
+version = "0.1.1"
dependencies = [
"anyhow",
"clap",
@@ -2347,7 +2347,7 @@ dependencies = [
[[package]]
name = "nectarlink-core"
-version = "0.1.0"
+version = "0.1.1"
dependencies = [
"blake3",
"bytes",
@@ -2380,7 +2380,7 @@ dependencies = [
[[package]]
name = "nectarlink-desktop"
-version = "0.1.0"
+version = "0.1.1"
dependencies = [
"anyhow",
"blake3",
@@ -2409,7 +2409,7 @@ dependencies = [
[[package]]
name = "nectarlink-ffi"
-version = "0.1.0"
+version = "0.1.1"
dependencies = [
"nectarlink-core",
"paranoid-android",
@@ -2422,7 +2422,7 @@ dependencies = [
[[package]]
name = "nectarlink-protocol"
-version = "0.1.0"
+version = "0.1.1"
dependencies = [
"ciborium",
"data-encoding",
@@ -2437,7 +2437,7 @@ dependencies = [
[[package]]
name = "nectarlink-vcam"
-version = "0.1.0"
+version = "0.1.1"
dependencies = [
"ab_glyph",
"embed-resource",
@@ -5064,7 +5064,7 @@ dependencies = [
[[package]]
name = "xtask"
-version = "0.1.0"
+version = "0.1.1"
dependencies = [
"anyhow",
"serde_json",
diff --git a/Cargo.toml b/Cargo.toml
index 99c9128..d169a53 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@ members = [
]
[workspace.package]
-version = "0.1.0"
+version = "0.1.1"
edition = "2024"
rust-version = "1.97"
authors = ["The Nectarlink contributors"]
@@ -25,10 +25,10 @@ repository = "https://github.com/thtbee/nectarlink"
name = "Pollen"
[workspace.dependencies]
-nectarlink-adb = { path = "core/nectarlink-adb", version = "0.1.0" }
-nectarlink-protocol = { path = "core/nectarlink-protocol", version = "0.1.0" }
-nectarlink-core = { path = "core/nectarlink-core", version = "0.1.0" }
-nectarlink-vcam = { path = "desktop/vcam", version = "0.1.0" }
+nectarlink-adb = { path = "core/nectarlink-adb", version = "0.1.1" }
+nectarlink-protocol = { path = "core/nectarlink-protocol", version = "0.1.1" }
+nectarlink-core = { path = "core/nectarlink-core", version = "0.1.1" }
+nectarlink-vcam = { path = "desktop/vcam", version = "0.1.1" }
anyhow = "1"
ciborium = "0.2"
diff --git a/android/app/src/main/kotlin/app/nectarlink/android/clipboard/SendActivity.kt b/android/app/src/main/kotlin/app/nectarlink/android/clipboard/SendActivity.kt
index 6f53416..aabc294 100644
--- a/android/app/src/main/kotlin/app/nectarlink/android/clipboard/SendActivity.kt
+++ b/android/app/src/main/kotlin/app/nectarlink/android/clipboard/SendActivity.kt
@@ -9,77 +9,21 @@ import android.os.Build
import android.os.Bundle
import android.widget.Toast
import androidx.activity.ComponentActivity
-import androidx.activity.compose.setContent
-import androidx.compose.animation.core.Animatable
-import androidx.compose.animation.core.Spring
-import androidx.compose.animation.core.spring
-import androidx.compose.foundation.background
-import androidx.compose.foundation.clickable
-import androidx.compose.foundation.gestures.detectVerticalDragGestures
-import androidx.compose.foundation.interaction.MutableInteractionSource
-import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.Box
-import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.ExperimentalLayoutApi
-import androidx.compose.foundation.layout.FlowRow
-import androidx.compose.foundation.layout.Row
-import androidx.compose.foundation.layout.Spacer
-import androidx.compose.foundation.layout.fillMaxSize
-import androidx.compose.foundation.layout.fillMaxWidth
-import androidx.compose.foundation.layout.height
-import androidx.compose.foundation.layout.navigationBarsPadding
-import androidx.compose.foundation.layout.offset
-import androidx.compose.foundation.layout.padding
-import androidx.compose.foundation.shape.RoundedCornerShape
-import androidx.compose.material3.Button
-import androidx.compose.material3.CardDefaults
-import androidx.compose.material3.ElevatedCard
-import androidx.compose.material3.FilterChip
-import androidx.compose.material3.LinearProgressIndicator
-import androidx.compose.material3.MaterialTheme
-import androidx.compose.material3.OutlinedButton
-import androidx.compose.material3.Surface
-import androidx.compose.material3.Text
-import androidx.compose.material3.TextButton
-import androidx.compose.runtime.Composable
-import androidx.compose.runtime.LaunchedEffect
-import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableFloatStateOf
-import androidx.compose.runtime.mutableStateOf
-import androidx.compose.runtime.remember
-import androidx.compose.runtime.rememberCoroutineScope
-import androidx.compose.runtime.setValue
-import androidx.compose.ui.Alignment
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.input.pointer.pointerInput
-import androidx.compose.ui.input.pointer.util.VelocityTracker
-import androidx.compose.ui.platform.LocalDensity
-import androidx.compose.ui.res.stringResource
-import androidx.compose.ui.text.style.TextOverflow
-import androidx.compose.ui.unit.IntOffset
-import androidx.compose.ui.unit.dp
import androidx.core.content.IntentCompat
-import androidx.lifecycle.compose.collectAsStateWithLifecycle
import app.nectarlink.android.NectarlinkApplication
import app.nectarlink.android.R
import app.nectarlink.android.core.Device
-import app.nectarlink.android.ui.Preferences
-import app.nectarlink.android.ui.theme.NectarlinkTheme
-import kotlin.math.roundToInt
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.cancel
-import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
/**
* Sends to the connected PCs: files or text shared from another app, or the
* clipboard (from the Quick Settings tile or the connection notification).
- * Direct Share targets and clipboard sends dispatch immediately; choosing the
- * main Nectarlink target in the Android share sheet opens the interactive
- * [FlickSendSheet] with upward flick-to-send and a 3-second Undo window.
+ * Everything goes the moment it's shared; with several PCs online, the user
+ * picks one first. File progress and the confirmation are notifications.
*/
class SendActivity : ComponentActivity() {
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Main)
@@ -95,29 +39,11 @@ class SendActivity : ComponentActivity() {
}
private sealed interface SharePayload {
- val previewTitle: String
- val previewSubtitle: String?
+ data class Files(val uris: List<Uri>, val handoff: Boolean) : SharePayload
- data class Files(
- val uris: List<Uri>,
- val handoff: Boolean,
- override val previewTitle: String,
- override val previewSubtitle: String?,
- ) : SharePayload
+ data class Link(val url: String, val text: String) : SharePayload
- data class Link(
- val url: String,
- val text: String,
- override val previewTitle: String = url,
- override val previewSubtitle: String? = text.takeIf { it != url },
- ) : SharePayload
-
- data class Text(
- val text: String,
- val html: String?,
- override val previewTitle: String = text,
- override val previewSubtitle: String? = null,
- ) : SharePayload
+ data class Text(val text: String, val html: String?) : SharePayload
}
override fun onCreate(savedInstanceState: Bundle?) {
@@ -144,33 +70,7 @@ class SendActivity : ComponentActivity() {
return
}
- val core = (application as NectarlinkApplication).core
- val allPcs = core.state.value.devices.sortedByDescending { it.online }
- val immediate = intent.getBooleanExtra("immediate", false) ||
- targetPcId() != null ||
- (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && intent.getStringExtra(Intent.EXTRA_SHORTCUT_ID) != null)
-
- if (immediate || allPcs.isEmpty()) {
- dispatchImmediate(payload)
- return
- }
-
- val preferences = Preferences(this)
- setContent {
- val appearance by preferences.appearance.collectAsStateWithLifecycle()
- val state by core.state.collectAsStateWithLifecycle()
- val pcs = state.devices.sortedByDescending { it.online }.ifEmpty { allPcs }
- NectarlinkTheme(appearance) {
- FlickSendSheet(
- pcs = pcs,
- payload = payload,
- onCommitSend = { pcId ->
- dispatchToPc(payload, pcId)
- },
- onDismiss = { finish() },
- )
- }
- }
+ dispatchImmediate(payload)
}
private fun parseSharePayload(intent: Intent): SharePayload? = when (intent.action) {
@@ -189,12 +89,7 @@ class SendActivity : ComponentActivity() {
val html = intent.getStringExtra(Intent.EXTRA_HTML_TEXT)?.takeIf(String::isNotBlank)
val link = text?.let(::handoffUrl)
when {
- stream != null -> SharePayload.Files(
- uris = listOf(stream),
- handoff = true,
- previewTitle = stream.lastPathSegment ?: getString(R.string.flick_send_single_file),
- previewSubtitle = intent.type,
- )
+ stream != null -> SharePayload.Files(uris = listOf(stream), handoff = true)
!text.isNullOrBlank() && link != null -> SharePayload.Link(url = link, text = text)
!text.isNullOrBlank() -> SharePayload.Text(text = text, html = html)
else -> null
@@ -205,16 +100,7 @@ class SendActivity : ComponentActivity() {
if (streams.isNullOrEmpty()) {
null
} else {
- SharePayload.Files(
- uris = streams,
- handoff = false,
- previewTitle = if (streams.size == 1) {
- getString(R.string.flick_send_single_file)
- } else {
- getString(R.string.flick_send_files_count, streams.size)
- },
- previewSubtitle = intent.type,
- )
+ SharePayload.Files(uris = streams, handoff = false)
}
}
else -> null
@@ -228,35 +114,6 @@ class SendActivity : ComponentActivity() {
}
}
- private fun dispatchToPc(payload: SharePayload, pcId: String) {
- if (sent) return
- sent = true
- val core = (application as NectarlinkApplication).core
- val pc = core.state.value.device(pcId)
- when (payload) {
- is SharePayload.Files -> {
- core.sendFiles(pcId, payload.uris, payload.handoff)
- val name = pc?.name ?: pcId
- val msg = if (pc != null && !pc.online) {
- getString(R.string.send_queue_offline_toast, name)
- } else {
- getString(R.string.transfer_sending, name)
- }
- finishWith(msg)
- }
- is SharePayload.Link -> {
- if (pc != null && (pc.has("device.links_to_pc") || !pc.online)) {
- scope.launch { finishWith(core.openLinkOnPc(pcId, payload.url)) }
- } else {
- scope.launch { finishWith(core.sendClipboard(payload.text, pcId)) }
- }
- }
- is SharePayload.Text -> {
- scope.launch { finishWith(core.sendClipboard(payload.text, pcId, payload.html)) }
- }
- }
- }
-
private fun targetPcId(): String? {
val explicit = intent?.getStringExtra(EXTRA_PC_ID)?.takeIf { it.isNotBlank() }
if (explicit != null) return explicit
@@ -271,51 +128,33 @@ class SendActivity : ComponentActivity() {
private fun sendFiles(uris: List<Uri>, handoff: Boolean = false) {
sent = true
val core = (application as NectarlinkApplication).core
- val chosenPcId = targetPcId()
- if (chosenPcId != null) {
- val pc = core.state.value.device(chosenPcId)
- if (pc != null) {
- core.sendFiles(pc.id, uris, handoff)
- val msg = if (pc.online) {
- getString(R.string.transfer_sending, pc.name)
- } else {
- getString(R.string.send_queue_offline_toast, pc.name)
- }
- finishWith(msg)
- return
- }
+ val chosen = targetPcId()?.let { core.state.value.device(it) }
+ if (chosen != null) {
+ sendFilesTo(chosen, uris, handoff)
+ return
}
val allPcs = core.state.value.devices
val pcs = allPcs.filter { it.online }.ifEmpty { allPcs }
when (pcs.size) {
0 -> finishWith(getString(R.string.clip_no_pc))
- 1 -> {
- val target = pcs[0]
- core.sendFiles(target.id, uris, handoff)
- val msg = if (target.online) {
- getString(R.string.transfer_sending, target.name)
- } else {
- getString(R.string.send_queue_offline_toast, target.name)
- }
- finishWith(msg)
- }
+ 1 -> sendFilesTo(pcs[0], uris, handoff)
else -> AlertDialog.Builder(this)
.setTitle(R.string.transfer_pick_pc)
- .setItems(pcs.map { it.name }.toTypedArray()) { _, which ->
- val target = pcs[which]
- core.sendFiles(target.id, uris, handoff)
- val msg = if (target.online) {
- getString(R.string.transfer_sending, target.name)
- } else {
- getString(R.string.send_queue_offline_toast, target.name)
- }
- finishWith(msg)
- }
+ .setItems(pcs.map { it.name }.toTypedArray()) { _, which -> sendFilesTo(pcs[which], uris, handoff) }
.setOnCancelListener { finish() }
.show()
}
}
+ /**
+ * Starts the transfer and closes. A connected PC's progress and the
+ * confirmation show as notifications; an offline one queues, and says so.
+ */
+ private fun sendFilesTo(pc: Device, uris: List<Uri>, handoff: Boolean) {
+ (application as NectarlinkApplication).core.sendFiles(pc.id, uris, handoff)
+ if (pc.online) finish() else finishWith(getString(R.string.send_queue_offline_toast, pc.name))
+ }
+
override fun onWindowFocusChanged(hasFocus: Boolean) {
super.onWindowFocusChanged(hasFocus)
if (!hasFocus || sent || intent?.action != ACTION_SEND_CLIPBOARD) return
@@ -389,235 +228,7 @@ class SendActivity : ComponentActivity() {
super.onDestroy()
}
- @OptIn(ExperimentalLayoutApi::class)
- @Composable
- private fun FlickSendSheet(
- pcs: List<Device>,
- payload: SharePayload,
- onCommitSend: (String) -> Unit,
- onDismiss: () -> Unit,
- ) {
- var selectedPcId by remember(pcs) { mutableStateOf(pcs.firstOrNull()?.id.orEmpty()) }
- val selectedPc = pcs.firstOrNull { it.id == selectedPcId } ?: pcs.firstOrNull()
- val pcName = selectedPc?.name ?: "PC"
-
- var countdownActive by remember { mutableStateOf(false) }
- var countdownProgress by remember { mutableFloatStateOf(1f) }
- val dragOffset = remember { Animatable(0f) }
- val uiScope = rememberCoroutineScope()
- val density = LocalDensity.current.density
-
- LaunchedEffect(countdownActive, selectedPc?.id) {
- val targetId = selectedPc?.id ?: return@LaunchedEffect
- if (!countdownActive) return@LaunchedEffect
- val durationMs = 3_000L
- val stepMs = 50L
- var elapsed = 0L
- while (elapsed < durationMs && countdownActive) {
- countdownProgress = 1f - (elapsed.toFloat() / durationMs.toFloat())
- delay(stepMs)
- elapsed += stepMs
- }
- if (countdownActive) {
- onCommitSend(targetId)
- }
- }
-
- val triggerSendWithUndo = {
- uiScope.launch {
- dragOffset.animateTo(
- targetValue = -1200f,
- animationSpec = spring(
- dampingRatio = Spring.DampingRatioLowBouncy,
- stiffness = Spring.StiffnessMediumLow,
- ),
- )
- countdownProgress = 1f
- countdownActive = true
- }
- }
-
- Box(
- modifier = Modifier
- .fillMaxSize()
- .background(Color.Black.copy(alpha = 0.45f))
- .clickable(
- interactionSource = remember { MutableInteractionSource() },
- indication = null,
- onClick = { if (!countdownActive) onDismiss() },
- ),
- contentAlignment = Alignment.BottomCenter,
- ) {
- Surface(
- shape = RoundedCornerShape(topStart = 28.dp, topEnd = 28.dp),
- color = MaterialTheme.colorScheme.surface,
- tonalElevation = 6.dp,
- modifier = Modifier
- .fillMaxWidth()
- .clickable(
- interactionSource = remember { MutableInteractionSource() },
- indication = null,
- onClick = {},
- ),
- ) {
- Column(
- modifier = Modifier
- .fillMaxWidth()
- .navigationBarsPadding()
- .padding(horizontal = 20.dp, vertical = 18.dp),
- verticalArrangement = Arrangement.spacedBy(14.dp),
- ) {
- Text(
- text = stringResource(R.string.flick_send_title, pcName),
- style = MaterialTheme.typography.titleLarge,
- )
-
- if (pcs.size > 1) {
- FlowRow(
- horizontalArrangement = Arrangement.spacedBy(8.dp),
- verticalArrangement = Arrangement.spacedBy(6.dp),
- ) {
- pcs.forEach { pc ->
- FilterChip(
- selected = pc.id == selectedPc?.id,
- onClick = { selectedPcId = pc.id },
- label = { Text(pc.name) },
- )
- }
- }
- }
-
- if (!countdownActive) {
- Text(
- text = stringResource(R.string.flick_send_hint, pcName),
- style = MaterialTheme.typography.labelLarge,
- color = MaterialTheme.colorScheme.primary,
- )
-
- ElevatedCard(
- colors = CardDefaults.elevatedCardColors(
- containerColor = MaterialTheme.colorScheme.surfaceContainerHigh,
- ),
- modifier = Modifier
- .fillMaxWidth()
- .offset { IntOffset(0, dragOffset.value.roundToInt()) }
- .pointerInput(selectedPc?.id) {
- val velocityTracker = VelocityTracker()
- detectVerticalDragGestures(
- onDragStart = { velocityTracker.resetTracking() },
- onVerticalDrag = { change, dragAmount ->
- change.consume()
- velocityTracker.addPosition(change.uptimeMillis, change.position)
- val next = (dragOffset.value + dragAmount).coerceAtMost(36f)
- uiScope.launch { dragOffset.snapTo(next) }
- },
- onDragCancel = {
- uiScope.launch {
- dragOffset.animateTo(0f, spring(stiffness = Spring.StiffnessMedium))
- }
- },
- onDragEnd = {
- val velocityY = velocityTracker.calculateVelocity().y
- if (shouldTriggerFlickSend(velocityY, dragOffset.value, density)) {
- triggerSendWithUndo()
- } else {
- uiScope.launch {
- dragOffset.animateTo(0f, spring(stiffness = Spring.StiffnessMedium))
- }
- }
- },
- )
- },
- ) {
- Column(
- modifier = Modifier
- .fillMaxWidth()
- .padding(16.dp),
- verticalArrangement = Arrangement.spacedBy(6.dp),
- ) {
- Text(
- text = payload.previewTitle,
- style = MaterialTheme.typography.bodyLarge,
- maxLines = 4,
- overflow = TextOverflow.Ellipsis,
- )
- payload.previewSubtitle?.takeIf { it.isNotBlank() }?.let { sub ->
- Text(
- text = sub,
- style = MaterialTheme.typography.bodySmall,
- color = MaterialTheme.colorScheme.onSurfaceVariant,
- maxLines = 2,
- overflow = TextOverflow.Ellipsis,
- )
- }
- }
- }
-
- Row(
- modifier = Modifier.fillMaxWidth(),
- horizontalArrangement = Arrangement.spacedBy(12.dp, Alignment.End),
- ) {
- TextButton(onClick = onDismiss) {
- Text(stringResource(R.string.action_cancel))
- }
- Button(onClick = { triggerSendWithUndo() }) {
- Text(stringResource(R.string.flick_send_now))
- }
- }
- } else {
- Column(
- modifier = Modifier.fillMaxWidth(),
- verticalArrangement = Arrangement.spacedBy(10.dp),
- ) {
- Row(
- modifier = Modifier.fillMaxWidth(),
- verticalAlignment = Alignment.CenterVertically,
- horizontalArrangement = Arrangement.SpaceBetween,
- ) {
- Text(
- text = stringResource(R.string.flick_send_sending, pcName),
- style = MaterialTheme.typography.titleMedium,
- )
- OutlinedButton(
- onClick = {
- countdownActive = false
- uiScope.launch {
- dragOffset.animateTo(0f, spring(stiffness = Spring.StiffnessMedium))
- }
- },
- ) {
- Text(stringResource(R.string.flick_send_undo))
- }
- }
- LinearProgressIndicator(
- progress = { countdownProgress },
- modifier = Modifier.fillMaxWidth(),
- )
- Spacer(Modifier.height(4.dp))
- }
- }
- }
- }
- }
- }
-
companion object {
- const val FLICK_VELOCITY_THRESHOLD_PX_PER_SEC: Float = -1000f
- const val FLICK_DISPLACEMENT_THRESHOLD_DP: Float = 110f
-
- /**
- * Returns true when an upward flick gesture exceeds either the velocity
- * threshold (`< -1000 px/s`) or the upward displacement threshold (`> 110 dp`).
- */
- fun shouldTriggerFlickSend(
- velocityYPxPerSec: Float,
- dragOffsetYPx: Float,
- density: Float = 1f,
- ): Boolean {
- val minDragPx = -FLICK_DISPLACEMENT_THRESHOLD_DP * density
- return velocityYPxPerSec < FLICK_VELOCITY_THRESHOLD_PX_PER_SEC || dragOffsetYPx < minDragPx
- }
-
/** The text as a web link, if it's one (apps often share "Title https://…"). */
fun webLink(text: String): String? {
val words = text.trim().split(Regex("\\s+"))
diff --git a/android/app/src/main/kotlin/app/nectarlink/android/core/BackgroundAccess.kt b/android/app/src/main/kotlin/app/nectarlink/android/core/BackgroundAccess.kt
index a343251..159b971 100644
--- a/android/app/src/main/kotlin/app/nectarlink/android/core/BackgroundAccess.kt
+++ b/android/app/src/main/kotlin/app/nectarlink/android/core/BackgroundAccess.kt
@@ -5,6 +5,7 @@ import android.annotation.SuppressLint
import android.content.ComponentName
import android.content.Context
import android.content.Intent
+import android.content.pm.PackageInstaller
import android.content.pm.PackageManager
import android.os.Build
import android.os.PowerManager
@@ -186,5 +187,20 @@ object BackgroundAccess {
fun appDetailsIntent(context: Context): Intent =
Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, "package:${context.packageName}".toUri())
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+
+ /**
+ * Whether Nectarlink was installed other than by an app store (from a
+ * file, a browser download, or another installer). Android 13 and newer
+ * may then hold back some settings ("restricted settings") until the user
+ * allows them from App info. There is no public way to read that state
+ * itself, so callers show help only after a grant didn't go through.
+ */
+ fun isSideloaded(context: Context): Boolean {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) return false
+ val source = runCatching {
+ context.packageManager.getInstallSourceInfo(context.packageName).packageSource
+ }.getOrNull() ?: return true
+ return source != PackageInstaller.PACKAGE_SOURCE_STORE
+ }
}
diff --git a/android/app/src/main/kotlin/app/nectarlink/android/files/TransferNotifications.kt b/android/app/src/main/kotlin/app/nectarlink/android/files/TransferNotifications.kt
index caee0d8..5904e34 100644
--- a/android/app/src/main/kotlin/app/nectarlink/android/files/TransferNotifications.kt
+++ b/android/app/src/main/kotlin/app/nectarlink/android/files/TransferNotifications.kt
@@ -26,6 +26,7 @@ import app.nectarlink.core.TransferStatus
internal object TransferNotifications {
private const val CHANNEL_PROGRESS = "transfers"
private const val CHANNEL_RECEIVED = "received"
+ private const val SENT_TIMEOUT_MS = 8_000L
const val ACTION_CANCEL = "app.nectarlink.action.CANCEL_TRANSFER"
const val EXTRA_ID = "transfer"
@@ -54,6 +55,9 @@ internal object TransferNotifications {
lastPosted.remove(transfer.id)
manager.cancel(idOf(transfer))
if (status is TransferStatus.Failed) failed(context, transfer, pcName)
+ if (status is TransferStatus.Done && transfer.direction == TransferDirection.OUTGOING && !transfer.recording) {
+ sent(context, transfer, pcName)
+ }
return
}
val percent = if (transfer.total == 0uL) {
@@ -167,6 +171,20 @@ internal object TransferNotifications {
post(context, idOf(transfer), builder.build())
}
+ /** A send from the phone arrived: a quiet confirmation that clears itself. */
+ private fun sent(context: Context, transfer: Transfer, pcName: String) {
+ val to = pcName.ifEmpty { context.getString(R.string.your_pc) }
+ val notification = NotificationCompat.Builder(context, CHANNEL_PROGRESS)
+ .setSmallIcon(R.drawable.ic_notification)
+ .setContentTitle(title(context, transfer))
+ .setContentText(context.getString(R.string.transfer_sent_to, to))
+ .setSilent(true)
+ .setAutoCancel(true)
+ .setTimeoutAfter(SENT_TIMEOUT_MS)
+ .build()
+ post(context, idOf(transfer), notification)
+ }
+
private fun failed(context: Context, transfer: Transfer, pcName: String) {
val reason = (transfer.status as? TransferStatus.Failed)?.reason
val text = when (reason) {
diff --git a/android/app/src/main/kotlin/app/nectarlink/android/ui/theme/Theme.kt b/android/app/src/main/kotlin/app/nectarlink/android/ui/theme/Theme.kt
index 02c57d2..e9b57b2 100644
--- a/android/app/src/main/kotlin/app/nectarlink/android/ui/theme/Theme.kt
+++ b/android/app/src/main/kotlin/app/nectarlink/android/ui/theme/Theme.kt
@@ -63,7 +63,7 @@ fun rememberReducedMotion(): Boolean {
/** The user's look choices (see Preferences). */
@androidx.compose.runtime.Immutable
data class Appearance(
- val theme: String = "bloom",
+ val theme: String = "graphite",
val mode: String = "system",
val seed: String = Tokens.DEFAULT_SEED,
/** Bloom/Glass takes its colors from the wallpaper (Android 12+). */
diff --git a/android/app/src/main/kotlin/app/nectarlink/android/ui/walkthrough/WalkthroughScreen.kt b/android/app/src/main/kotlin/app/nectarlink/android/ui/walkthrough/WalkthroughScreen.kt
index 726190c..20c6991 100644
--- a/android/app/src/main/kotlin/app/nectarlink/android/ui/walkthrough/WalkthroughScreen.kt
+++ b/android/app/src/main/kotlin/app/nectarlink/android/ui/walkthrough/WalkthroughScreen.kt
@@ -43,6 +43,7 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape
+import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Button
import androidx.compose.material3.CircularProgressIndicator
@@ -982,6 +983,10 @@ private data class WalkthroughPermissionSpec(
val optional: Boolean,
val granted: Boolean,
val onGrant: () -> Unit,
+ /** Opens where the permission can be changed once it's granted. */
+ val onManage: () -> Unit,
+ /** Android may hold it back as a restricted setting for a sideloaded app. */
+ val restrictable: Boolean = false,
)
@Composable
@@ -993,6 +998,11 @@ private fun PermissionsStepContent(
) {
val context = LocalContext.current
var activeCardIndex by rememberSaveable { mutableIntStateOf(0) }
+ // Cards whose Grant was tapped, so restricted-settings help shows only
+ // after Android has had its chance (its menu item appears only then).
+ var attempted by rememberSaveable { mutableStateOf("") }
+ val sideloaded = remember { BackgroundAccess.isSideloaded(context) }
+ val appInfo = { runCatching { context.startActivity(BackgroundAccess.appDetailsIntent(context)) } }
val notifRuntimeLauncher = rememberLauncherForActivityResult(
ActivityResultContracts.RequestPermission(),
@@ -1038,6 +1048,8 @@ private fun PermissionsStepContent(
runCatching { context.startActivity(NotificationListener.settingsIntent(context)) }
}
},
+ onManage = { runCatching { context.startActivity(NotificationListener.settingsIntent(context)) } },
+ restrictable = Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU,
),
WalkthroughPermissionSpec(
id = "battery",
@@ -1049,6 +1061,7 @@ private fun PermissionsStepContent(
onGrant = {
runCatching { context.startActivity(BackgroundAccess.requestIntent(context)) }
},
+ onManage = { appInfo() },
),
WalkthroughPermissionSpec(
id = "calls",
@@ -1060,6 +1073,7 @@ private fun PermissionsStepContent(
onGrant = {
callsLauncher.launch(PhoneCalls.permissions)
},
+ onManage = { appInfo() },
),
WalkthroughPermissionSpec(
id = "sms_contacts",
@@ -1071,6 +1085,8 @@ private fun PermissionsStepContent(
onGrant = {
smsContactsLauncher.launch(PhoneSms.permissions + PhoneContacts.permissions)
},
+ onManage = { appInfo() },
+ restrictable = Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM,
),
WalkthroughPermissionSpec(
id = "photos",
@@ -1082,6 +1098,7 @@ private fun PermissionsStepContent(
onGrant = {
photosLauncher.launch(RecentPhotos.permissions)
},
+ onManage = { appInfo() },
),
WalkthroughPermissionSpec(
id = "storage",
@@ -1093,6 +1110,7 @@ private fun PermissionsStepContent(
onGrant = {
runCatching { context.startActivity(PhoneStorage.allFilesAccessIntent(context)) }
},
+ onManage = { runCatching { context.startActivity(PhoneStorage.allFilesAccessIntent(context)) } },
),
WalkthroughPermissionSpec(
id = "accessibility",
@@ -1104,6 +1122,8 @@ private fun PermissionsStepContent(
onGrant = {
runCatching { context.startActivity(InputService.settingsIntent()) }
},
+ onManage = { runCatching { context.startActivity(InputService.settingsIntent()) } },
+ restrictable = Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU,
),
)
@@ -1253,15 +1273,12 @@ private fun PermissionsStepContent(
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
- if (currentSpec.id == "notifications" &&
+ if (currentSpec.restrictable &&
+ sideloaded &&
!currentSpec.granted &&
- Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU
+ currentSpec.id in attempted.split(',')
) {
- Text(
- text = stringResource(R.string.walkthrough_perm_notif_restricted),
- style = MaterialTheme.typography.bodySmall,
- color = MaterialTheme.colorScheme.onSurfaceVariant,
- )
+ RestrictedSettingsHelp(onOpenAppInfo = { appInfo() })
}
Row(
@@ -1269,7 +1286,14 @@ private fun PermissionsStepContent(
horizontalArrangement = Arrangement.spacedBy(8.dp),
) {
Button(
- onClick = currentSpec.onGrant,
+ onClick = {
+ if (currentSpec.granted) {
+ currentSpec.onManage()
+ } else {
+ if (currentSpec.id !in attempted.split(',')) attempted += ",${currentSpec.id}"
+ currentSpec.onGrant()
+ }
+ },
modifier = Modifier.weight(1f),
) {
Text(
@@ -1291,6 +1315,51 @@ private fun PermissionsStepContent(
}
}
+/**
+ * Android holds some settings back for apps installed from a file. Steps to
+ * allow them from App info (the menu item appears once a grant was tried).
+ */
+@Composable
+private fun RestrictedSettingsHelp(onOpenAppInfo: () -> Unit) {
+ Column(
+ modifier = Modifier
+ .fillMaxWidth()
+ .background(MaterialTheme.colorScheme.secondaryContainer, RoundedCornerShape(16.dp))
+ .padding(14.dp),
+ verticalArrangement = Arrangement.spacedBy(6.dp),
+ ) {
+ Text(
+ text = stringResource(R.string.walkthrough_restricted_title),
+ style = MaterialTheme.typography.titleSmall,
+ color = MaterialTheme.colorScheme.onSecondaryContainer,
+ )
+ Text(
+ text = stringResource(R.string.walkthrough_restricted_body),
+ style = MaterialTheme.typography.bodySmall,
+ color = MaterialTheme.colorScheme.onSecondaryContainer,
+ )
+ listOf(
+ R.string.walkthrough_restricted_step1,
+ R.string.walkthrough_restricted_step2,
+ R.string.walkthrough_restricted_step3,
+ ).forEachIndexed { i, step ->
+ Text(
+ text = "${i + 1}. " + stringResource(step),
+ style = MaterialTheme.typography.bodySmall,
+ color = MaterialTheme.colorScheme.onSecondaryContainer,
+ )
+ }
+ Text(
+ text = stringResource(R.string.walkthrough_restricted_note),
+ style = MaterialTheme.typography.labelSmall,
+ color = MaterialTheme.colorScheme.onSecondaryContainer.copy(alpha = 0.8f),
+ )
+ OutlinedButton(onClick = onOpenAppInfo) {
+ Text(stringResource(R.string.walkthrough_restricted_open))
+ }
+ }
+}
+
@Composable
private fun PairStepContent(
state: CoreState,
diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml
index a6c4ba1..e213592 100644
--- a/android/app/src/main/res/values/strings.xml
+++ b/android/app/src/main/res/values/strings.xml
@@ -639,13 +639,6 @@
<string name="companion_wake_associate">Associate</string>
<!-- Flick to Send sheet -->
- <string name="flick_send_title">Send to %1$s</string>
- <string name="flick_send_hint">Flick up to send to %1$s</string>
- <string name="flick_send_sending">Sending to %1$s…</string>
- <string name="flick_send_now">Send now</string>
- <string name="flick_send_undo">Undo</string>
- <string name="flick_send_files_count">%1$d files ready to send</string>
- <string name="flick_send_single_file">1 file ready to send</string>
<!-- PC notifications & Browse PC files -->
<string name="channel_pc_notifications">PC notifications</string>
@@ -730,7 +723,13 @@
<string name="walkthrough_perm_notif_title">Notifications</string>
<string name="walkthrough_perm_notif_does">See, dismiss, and reply to phone notifications and control media on your PC.</string>
<string name="walkthrough_perm_notif_requires">Android requires Notification Access and notification permission.</string>
- <string name="walkthrough_perm_notif_restricted">On Android 13+, if Notification Access is grayed out, open App info › menu › Allow restricted settings.</string>
+ <string name="walkthrough_restricted_title">Android blocked this setting</string>
+ <string name="walkthrough_restricted_body">Android holds back some permissions for apps installed from a file instead of an app store. To allow this one:</string>
+ <string name="walkthrough_restricted_step1">Tap Open app info.</string>
+ <string name="walkthrough_restricted_step2">Tap ⋮ at the top right, then Allow restricted settings, and confirm.</string>
+ <string name="walkthrough_restricted_step3">Come back here and tap Grant again.</string>
+ <string name="walkthrough_restricted_note">The menu shows this option only after you have tried to grant the permission once. Some phones word it differently.</string>
+ <string name="walkthrough_restricted_open">Open app info</string>
<string name="walkthrough_perm_battery_title">Unrestricted battery</string>
<string name="walkthrough_perm_battery_does">Keep your phone reachable when the screen is off.</string>
diff --git a/android/app/src/test/kotlin/app/nectarlink/android/CompanionAndMigrationTest.kt b/android/app/src/test/kotlin/app/nectarlink/android/CompanionAndMigrationTest.kt
index 29f9b3f..3f9c33c 100644
--- a/android/app/src/test/kotlin/app/nectarlink/android/CompanionAndMigrationTest.kt
+++ b/android/app/src/test/kotlin/app/nectarlink/android/CompanionAndMigrationTest.kt
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-or-later
package app.nectarlink.android
-import app.nectarlink.android.clipboard.SendActivity
import app.nectarlink.android.companion.PcCompanion
import app.nectarlink.android.ui.Preferences
import app.nectarlink.android.ui.theme.Appearance
@@ -59,7 +58,7 @@ class CompanionAndMigrationTest {
seed = "cyberpunk",
dynamicColor = false,
)
- assertEquals("bloom", legacy.theme)
+ assertEquals("graphite", legacy.theme)
assertEquals("system", legacy.mode)
assertEquals(Tokens.DEFAULT_SEED, legacy.seed)
assertFalse(legacy.dynamicColor)
@@ -67,7 +66,7 @@ class CompanionAndMigrationTest {
val empty = Preferences.sanitizeAppearance(
Appearance(theme = "", mode = "", seed = "", dynamicColor = true),
)
- assertEquals("bloom", empty.theme)
+ assertEquals("graphite", empty.theme)
assertEquals("system", empty.mode)
assertEquals(Tokens.DEFAULT_SEED, empty.seed)
assertTrue(empty.dynamicColor)
@@ -83,40 +82,4 @@ class CompanionAndMigrationTest {
assertEquals("ocean", valid.seed)
assertFalse(valid.dynamicColor)
}
-
- @Test
- fun `SendActivity shouldTriggerFlickSend triggers on fast upward flick or deep upward drag`() {
- // Fast upward flick (< -1000 px/s) triggers even with minimal displacement
- assertTrue(
- SendActivity.shouldTriggerFlickSend(
- velocityYPxPerSec = -1250f,
- dragOffsetYPx = -24f,
- density = 2f,
- ),
- )
- // Deep upward drag (> 110 dp = 220 px at density 2.0) triggers even with slow release velocity
- assertTrue(
- SendActivity.shouldTriggerFlickSend(
- velocityYPxPerSec = -150f,
- dragOffsetYPx = -230f,
- density = 2f,
- ),
- )
- // Small drag and slow velocity does not trigger send
- assertFalse(
- SendActivity.shouldTriggerFlickSend(
- velocityYPxPerSec = -400f,
- dragOffsetYPx = -120f,
- density = 2f,
- ),
- )
- // Downward flick never triggers send
- assertFalse(
- SendActivity.shouldTriggerFlickSend(
- velocityYPxPerSec = 1800f,
- dragOffsetYPx = 30f,
- density = 2f,
- ),
- )
- }
}
diff --git a/desktop/app/qml/pages/SettingsPage.qml b/desktop/app/qml/pages/SettingsPage.qml
index 9f217b9..ccd2ff8 100644
--- a/desktop/app/qml/pages/SettingsPage.qml
+++ b/desktop/app/qml/pages/SettingsPage.qml
@@ -1957,6 +1957,19 @@ Item {
}
}
+ Divider { width: parent.width }
+ ListRow {
+ width: parent.width
+ iconPath: Icons.openExternal
+ title: qsTr("Open files shared from the phone")
+ description: qsTr("Opens a shared photo or document as soon as it arrives.")
+ Toggle {
+ label: qsTr("Open files shared from the phone")
+ checked: Preferences.openSharedFiles
+ onToggled: (on) => Preferences.openSharedFiles = on
+ }
+ }
+
Divider { width: parent.width }
ListRow {
width: parent.width
diff --git a/desktop/app/src/bridge/prefs.rs b/desktop/app/src/bridge/prefs.rs
index 42c99db..cf561a1 100644
--- a/desktop/app/src/bridge/prefs.rs
+++ b/desktop/app/src/bridge/prefs.rs
@@ -92,6 +92,8 @@ pub mod qobject {
#[qproperty(QString, local_api_token_path)]
/// Copy received files (<= 10) to the Windows clipboard as CF_HDROP.
#[qproperty(bool, clipboard_auto_copy_received_files)]
+ /// Open a single file shared from the phone when it arrives.
+ #[qproperty(bool, open_shared_files)]
/// Send the clipboard to the phone when control moves to it.
#[qproperty(bool, flow_follow_clipboard)]
/// Floating Nectar Island pill at the top center of the screen.
@@ -270,6 +272,7 @@ pub struct PreferencesRust {
local_api_port: i32,
local_api_token_path: QString,
clipboard_auto_copy_received_files: bool,
+ open_shared_files: bool,
flow_follow_clipboard: bool,
nectar_island: bool,
nectar_island_calls: bool,
@@ -345,6 +348,7 @@ impl cxx_qt::Initialize for qobject::Preferences {
let token_path = crate::local_api::token_file_path();
self.as_mut().set_local_api_token_path(QString::from(&token_path.to_string_lossy().into_owned()));
self.as_mut().set_clipboard_auto_copy_received_files(settings.clipboard_auto_copy_received_files);
+ self.as_mut().set_open_shared_files(settings.open_shared_files);
self.as_mut().set_flow_follow_clipboard(settings.flow_follow_clipboard);
self.as_mut().set_nectar_island(settings.nectar_island);
self.as_mut().set_nectar_island_calls(settings.nectar_island_calls);
@@ -550,6 +554,12 @@ impl cxx_qt::Initialize for qobject::Preferences {
p.save();
})
.release();
+ self.as_mut()
+ .on_open_shared_files_changed(|p| {
+ crate::settings::set_open_shared_files(p.open_shared_files);
+ p.save();
+ })
+ .release();
self.as_mut()
.on_flow_follow_clipboard_changed(|p| {
crate::settings::set_flow_follow_clipboard(p.flow_follow_clipboard);
@@ -864,6 +874,7 @@ impl qobject::Preferences {
.filter(|&port| port > 0)
.unwrap_or(crate::settings::DEFAULT_LOCAL_API_PORT),
clipboard_auto_copy_received_files: p.clipboard_auto_copy_received_files,
+ open_shared_files: p.open_shared_files,
flow_follow_clipboard: p.flow_follow_clipboard,
folder_sync_rules: crate::settings::folder_sync_rules(),
nectar_island: p.nectar_island,
diff --git a/desktop/app/src/settings.rs b/desktop/app/src/settings.rs
index 0de777a..7aa322f 100644
--- a/desktop/app/src/settings.rs
+++ b/desktop/app/src/settings.rs
@@ -114,6 +114,7 @@ static SHARE_PC_STORAGE: std::sync::atomic::AtomicBool = std::sync::atomic::Atom
static FORWARD_PC_NOTIFICATIONS: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false);
static AWAY_MODE: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false);
static FLOW_FOLLOW_CLIPBOARD: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(true);
+static OPEN_SHARED_FILES: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false);
static FOLDER_SYNC_RULES: std::sync::OnceLock<std::sync::Mutex<Vec<crate::folder_sync::FolderSyncRule>>> =
std::sync::OnceLock::new();
@@ -128,6 +129,15 @@ pub fn set_clipboard_auto_copy_received_files(on: bool) {
CLIPBOARD_AUTO_COPY_FILES.store(on, std::sync::atomic::Ordering::Relaxed);
}
+/// Whether a single file shared from the phone opens in its default app on arrival.
+pub fn open_shared_files() -> bool {
+ OPEN_SHARED_FILES.load(std::sync::atomic::Ordering::Relaxed)
+}
+
+pub fn set_open_shared_files(on: bool) {
+ OPEN_SHARED_FILES.store(on, std::sync::atomic::Ordering::Relaxed);
+}
+
#[allow(dead_code)]
pub fn nectar_island() -> bool {
NECTAR_ISLAND.load(std::sync::atomic::Ordering::Relaxed)
@@ -335,6 +345,10 @@ pub struct Settings {
/// Automatically place small incoming received files onto the Windows clipboard (`CF_HDROP`).
#[serde(default = "default_true", alias = "clipboard_auto_copy_received_files")]
pub clipboard_auto_copy_received_files: bool,
+ /// Open a single photo or document shared from the phone as soon as it
+ /// arrives. Off by default: it's saved in Downloads\Nectarlink either way.
+ #[serde(default, alias = "open_shared_files")]
+ pub open_shared_files: bool,
/// Send the PC's clipboard to the phone when control moves to it: the mouse
/// enters the phone's window, or a remote control session starts.
#[serde(default = "default_true", alias = "flow_follow_clipboard")]
@@ -421,6 +435,7 @@ impl Default for Settings {
local_api_enabled: false,
local_api_port: default_local_api_port(),
clipboard_auto_copy_received_files: true,
+ open_shared_files: false,
flow_follow_clipboard: true,
folder_sync_rules: Vec::new(),
nectar_island: false,
@@ -467,6 +482,7 @@ impl Settings {
pub fn apply_runtime(&self) {
set_clipboard_auto_copy_received_files(self.clipboard_auto_copy_received_files);
+ set_open_shared_files(self.open_shared_files);
set_flow_follow_clipboard(self.flow_follow_clipboard);
set_folder_sync_rules(self.folder_sync_rules.clone());
set_obs_settings(
@@ -566,6 +582,7 @@ mod tests {
local_api_enabled: true,
local_api_port: 54321,
clipboard_auto_copy_received_files: false,
+ open_shared_files: true,
flow_follow_clipboard: false,
folder_sync_rules: Vec::new(),
nectar_island: true,
diff --git a/desktop/app/src/transfers.rs b/desktop/app/src/transfers.rs
index adc21ed..7e15d0f 100644
--- a/desktop/app/src/transfers.rs
+++ b/desktop/app/src/transfers.rs
@@ -273,6 +273,7 @@ pub fn on_event(event: &NodeEvent) {
let _ = crate::clipboard::copy_received_files_to_clipboard(saved);
}
let auto_open = t.open_on_arrival
+ && crate::settings::open_shared_files()
&& saved.len() == 1
&& first.is_file()
&& first.file_name().and_then(|n| n.to_str()).is_some_and(nectarlink_core::is_safe_handoff_document);
diff --git a/docs/guide/files-and-transfers.md b/docs/guide/files-and-transfers.md
index ab705c0..19ab2fb 100644
--- a/docs/guide/files-and-transfers.md
+++ b/docs/guide/files-and-transfers.md
@@ -32,7 +32,7 @@ Received files on your phone are saved to `Download/Nectarlink` (preserving subf
### Sending Files and Folders from Phone to PC
-1. **From any Android app**: Tap **Share**, then tap your PC's Direct Share target at the top of the Android share sheet (or tap **Nectarlink**). You can also flick the preview card upward on the share screen to trigger **Flick to send** with a 3-second **Undo** button.
+1. **From any Android app**: Tap **Share**, then tap your PC's Direct Share target at the top of the Android share sheet (or tap **Nectarlink**). The transfer starts right away; with more than one PC connected, you pick one first. Its progress shows in a notification with a **Cancel** button, followed by a **Sent to** confirmation.
2. **From the Nectarlink app**: Open Nectarlink on your phone and tap **Send files** or **Send a folder** under **Quick Transfer & Clipboard**.
Received files on your PC are saved to `Downloads\Nectarlink` (avoiding overwrites by adding a numeric suffix if a file with the same name already exists). If **Copy received files** is enabled in **Settings › General**, small received files are also placed on your Windows clipboard so you can paste them anywhere with `Ctrl+V`.
diff --git a/docs/guide/settings.md b/docs/guide/settings.md
index cf63dbc..f0d7e67 100644
--- a/docs/guide/settings.md
+++ b/docs/guide/settings.md
@@ -127,6 +127,7 @@ Configures File Explorer integration, PC folder sharing, LocalSend, voice record
| **File Explorer Send to** | **On** (default) | Adds your paired phones to the right-click **Send to** menu in Windows File Explorer. |
| **Your PC in your pocket** | **Off** (default) | Shares your PC's `Downloads`, `Documents`, `Desktop`, `Pictures`, and `Nectarlink Shared` folders with paired phones that have **File Explorer integration** enabled. |
| **LocalSend on local network** | **Off** (default) | Enables the built-in LocalSend v2.1 client and server (UDP/TCP port `53317`) to send and receive files with nearby LocalSend devices on your Wi-Fi network without pairing. |
+| **Open files shared from the phone** | **Off** (default) | When you share a single photo or document from the phone, opens it in its default Windows app as soon as it arrives. When off, the file is saved to `Downloads\Nectarlink` without opening anything. |
| **Voice recordings** | Format: `M4A` (default), `MP3`, `WAV`, `FLAC`; Folder: **Choose folder** / **Reset** | Sets where incoming voice notes from your phone are saved (`Documents\Nectarlink Recordings` or `Downloads\Nectarlink` by default) and automatically converts them to MP3, WAV, or FLAC if selected. |
| **Synced folders** | **Sync now**, **Add DCIM to Pictures**, per-rule toggle & **Remove** | Configures one-way (**One-way (phone to PC)**) or two-way (**Two-way sync**, keeping conflict copies) automatic folder synchronization rules with BLAKE3 integrity verification. |
@@ -204,7 +205,7 @@ On Android, tap **Settings** in the floating bottom dock. You can view all setti
| Setting | Options / Default | What It Does |
| :--- | :--- | :--- |
-| **Theme** | `Bloom` (default), `Glass`, `Graphite` | Selects the visual style on Android, matching the Windows themes. In **Glass** on Android 13 and newer, the floating Home and Settings dock is Liquid Glass: content scrolling beneath it bends at the rim. |
+| **Theme** | `Graphite` (default), `Bloom`, `Glass` | Selects the visual style on Android, matching the Windows themes. In **Glass** on Android 13 and newer, the floating Home and Settings dock is Liquid Glass: content scrolling beneath it bends at the rim. |
| **Mode** | `System` (default), `Light`, `Dark` | Follows Android's system dark theme or locks the app to Light or Dark. |
| **Pure black (AMOLED)** | **Off** (default) | Shown in Graphite Dark or as an inline **AMOLED** pill when the **Black** seed swatch is selected. Uses true `#000000` black surfaces for OLED phone screens. |
| **Media artwork color** *(Bloom and Glass)* | **Off** (default) | Tints the app to match the artwork of what is playing on the phone or a paired PC. Applies only while this is on. With nothing playing, the app uses the wallpaper or preset colors. |