android: share a note with a group
CI & Build / Python lint (push) Successful in 2s
CI & Build / Build now, or wait for Android? (push) Successful in 3s
Android / Build, or is the channel already serving this? (push) Successful in 3s
Desktop (Tauri) / Build, or is the channel already serving this? (push) Successful in 2s
CI & Build / Web typecheck and unit tests (push) Successful in 9s
CI & Build / Python tests (push) Successful in 11s
CI & Build / integration (push) Successful in 1m22s
CI & Build / Build & push image (push) Skipped
Desktop (Tauri) / Web tests, clippy, Rust tests and rustfmt (push) Successful in 2m39s
Desktop (Tauri) / Windows installer (cross-compiled) (push) Successful in 2m37s
Desktop (Tauri) / Tauri desktop (Linux) (push) Successful in 3m26s
Desktop (Tauri) / Update manifest (push) Successful in 3s
Android / Kotlin + Rust (APK) (push) Successful in 8m16s

The Share sheet lists groups after people, shows a group share as its name and
how many are in it, and shares through the FFI's ShareTarget.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-07 18:25:16 -04:00
co-authored by Claude Opus 5.5
parent 442cca4398
commit fd1d50662f
5 changed files with 153 additions and 44 deletions
+10 -9
View File
@@ -43,8 +43,9 @@ use inkwell_core::sync::blobs::BlobStore;
use inkwell_core::sync::{client, compat, engine, push, sharing, state};
use models::{
patch_from, BodyItem, BodyTag, ClientUpdate, Identity, Label, Member, Note, NoteDraft,
NoteEdit, NoteQuery, NoteShare, ProbeResult, RevokeOutcome, SyncOutcome, SyncStatus,
patch_from, BodyItem, BodyTag, ClientUpdate, Directory, Identity, Label, Note, NoteDraft,
NoteEdit, NoteQuery, NoteShare, ProbeResult, RevokeOutcome, ShareTarget, SyncOutcome,
SyncStatus,
};
uniffi::setup_scaffolding!();
@@ -612,13 +613,13 @@ impl Inkwell {
// The Share dialog asks the server directly (#5175). Unlinked, each answers
// `NotLinked`, which the dialog turns into "sharing needs a server".
/// Everyone on the instance a note can be shared with.
pub async fn share_directory(&self) -> Result<Vec<Member>, CoreError> {
/// Everyone on the instance a note can be shared with, and every group.
pub async fn share_directory(&self) -> Result<Directory, CoreError> {
self.credentials()?;
let members = sharing::directory(&self.db)
let directory = sharing::directory(&self.db)
.await
.map_err(CoreError::network)?;
Ok(members.into_iter().map(Member::from).collect())
Ok(directory.into())
}
/// Who this note is shared with.
@@ -630,15 +631,15 @@ impl Inkwell {
Ok(shares.into_iter().map(NoteShare::from).collect())
}
/// Share with one member at "view" or "edit", or change their permission.
/// Share with a person or a group at "view" or "edit", or change their permission.
pub async fn share_note(
&self,
note_id: String,
user_id: String,
target: ShareTarget,
permission: String,
) -> Result<Vec<NoteShare>, CoreError> {
self.credentials()?;
let shares = sharing::share(&self.db, &note_id, &user_id, &permission)
let shares = sharing::share(&self.db, &note_id, &target.into(), &permission)
.await
.map_err(CoreError::network)?;
Ok(shares.into_iter().map(NoteShare::from).collect())