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
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:
@@ -636,11 +636,68 @@ impl From<core_client::Member> for Member {
|
||||
}
|
||||
}
|
||||
|
||||
/// One person a note is shared with, at "view" or "edit".
|
||||
/// A group the admin made, which a note can be shared with (#5177).
|
||||
#[derive(Debug, Clone, uniffi::Record)]
|
||||
pub struct ShareGroup {
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
pub member_count: u32,
|
||||
}
|
||||
|
||||
impl From<core_client::ShareGroup> for ShareGroup {
|
||||
fn from(value: core_client::ShareGroup) -> Self {
|
||||
let core_client::ShareGroup {
|
||||
id,
|
||||
name,
|
||||
member_count,
|
||||
} = value;
|
||||
ShareGroup {
|
||||
id,
|
||||
name,
|
||||
member_count,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Everyone a note can be shared with: the other people, and every group.
|
||||
#[derive(Debug, Clone, uniffi::Record)]
|
||||
pub struct Directory {
|
||||
pub members: Vec<Member>,
|
||||
pub groups: Vec<ShareGroup>,
|
||||
}
|
||||
|
||||
impl From<core_client::Directory> for Directory {
|
||||
fn from(value: core_client::Directory) -> Self {
|
||||
let core_client::Directory { members, groups } = value;
|
||||
Directory {
|
||||
members: members.into_iter().map(Member::from).collect(),
|
||||
groups: groups.into_iter().map(ShareGroup::from).collect(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Who a new share goes to: one person, or a group.
|
||||
#[derive(Debug, Clone, uniffi::Enum)]
|
||||
pub enum ShareTarget {
|
||||
Member { id: String },
|
||||
Group { id: String },
|
||||
}
|
||||
|
||||
impl From<ShareTarget> for core_client::ShareTarget {
|
||||
fn from(value: ShareTarget) -> Self {
|
||||
match value {
|
||||
ShareTarget::Member { id } => core_client::ShareTarget::Member(id),
|
||||
ShareTarget::Group { id } => core_client::ShareTarget::Group(id),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// One share of a note, at "view" or "edit": to a person or to a group, never both.
|
||||
#[derive(Debug, Clone, uniffi::Record)]
|
||||
pub struct NoteShare {
|
||||
pub id: String,
|
||||
pub member: Member,
|
||||
pub member: Option<Member>,
|
||||
pub group: Option<ShareGroup>,
|
||||
pub permission: String,
|
||||
}
|
||||
|
||||
@@ -650,12 +707,14 @@ impl From<core_client::NoteShare> for NoteShare {
|
||||
let core_client::NoteShare {
|
||||
id,
|
||||
member,
|
||||
group,
|
||||
permission,
|
||||
created_at: _,
|
||||
} = value;
|
||||
NoteShare {
|
||||
id,
|
||||
member: member.into(),
|
||||
member: member.map(Member::from),
|
||||
group: group.map(ShareGroup::from),
|
||||
permission,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user