Share lists with full ownership, read-only access and name suggestions

This commit is contained in:
waozi committed 2026-10-21 22:49:36 -03:00
1 parent 51a6fb7e63
commit c0e0509f11
36 files changed
+978 -212

No files matched your search

+3 -1
View File
@@ -4,7 +4,9 @@
- Android account-key backups use the system Save dialog and confirm that the chosen file was written.
- Shared lists preserve every task when edited, show who already has access, and let members edit and share them.
- Share lists with name suggestions and an automatically updated list of everyone with access.
- Give collaborators full owner rights, editing access, or read-only access, and remove access from the same dialog.
- Shared-list edits preserve every task.
- Undo restores a deleted task with its comment and completion state.
- The Habits shop scrolls through all recent activity and offers a soda reward symbol.
- Games hide the surrounding navigation and keep a clear return path to Arcade.
+3 -1
View File
@@ -2,7 +2,9 @@
## [1.1.5] - 2026-10-21
- Maintenance release for Inner Breeze 2.1.38.
- Show everyone with access and suggest friends as you type an invitation.
- Let owners grant full ownership, editing, or read-only access and remove collaborators.
- Update sharing automatically without a Refresh button.
## [1.1.4] - 2026-10-21
+281 -127
View File
@@ -4,6 +4,12 @@
#import "geometry"
#import "text"
#import "vec"
#import "c_string"
#import "text_buffer"
#import "layout"
#import "dropdown_props"
#import "dropdown_widget"
#import "context_menu_widget"
#import "text_props"
#import "text_align"
#import "text_widget"
@@ -44,6 +50,13 @@ frame: ListsUiFrame;
state: ListsMessage;
// The open Share or Invitations dialog's scroll offset.
sharing_scroll: s32;
invite_text: string;
invite_target: [65]u8;
invite_cursor: s32;
invite_anchor: s32;
invite_scroll: s32;
invite_focused: bool;
invite_suggestions: bool;
// Delete lives inside Edit and asks first; this is true once it has asked.
delete_confirm: bool;
// The last deleted item, kept briefly so Undo can bring it back.
@@ -127,13 +140,13 @@ Mutation :: (action: s32, index: s32) {
}
}
Field :: (bounds: Rectangle, placeholder: string) -> bool {
Field :: (bounds: Rectangle, placeholder: string, read_only: bool = false) -> bool {
edited := TextField(frame.session, TextFieldProps.{.key = cast(u64)6501,
.bounds = bounds, .value = frame.value, .placeholder = placeholder, .cursor = frame.cursor,
.anchor = frame.anchor, .scroll_x = frame.scroll_x,
.focused = frame.focused, .focus_id = 6501,
.max_bytes = 127, .max_codepoints = 127, .input = frame.input,
.disabled = frame.sharing_busy || frame.sharing_pending})
.disabled = frame.sharing_busy || frame.sharing_pending || read_only})
if edited.edit.changed {
start := edited.edit.start
end := edited.edit.end
@@ -158,7 +171,7 @@ Field :: (bounds: Rectangle, placeholder: string) -> bool {
}
Remote :: (action: s32, target: string = "", invitation: string = "",
invitation_list: string = "") {
invitation_list: string = "", access: string = "") {
state.action = action
state.remote = true
list: ListsUiRow
@@ -174,7 +187,7 @@ Remote :: (action: s32, target: string = "", invitation: string = "",
.selected_list = state.selected_list, .done = state.done,
.value = ifx action == LISTS_RESTORE_ITEM then state.title else frame.value,
.next_id = frame.next_id, .item_id = state.id, .comment = state.comment,
.target = target, .invitation = invitation, .list_id = list.id})
.target = target, .invitation = invitation, .list_id = list.id, .access = access})
}
// Cells cannot measure text, so a paragraph's height allows a generous
@@ -200,66 +213,221 @@ ParagraphHeight :: (text: string, width: s32) -> s32 {
return lines * Scale(22)
}
// Whether a sharing row belongs in the open dialog: every friend for Share,
// invitations still waiting for this account for Invitations.
SharingRowShown :: (row: ListsUiPerson) -> bool {
if frame.panel == 1 {
// The person who owns the list already has it; never offer an invite.
if state.selected_list >= 0 && state.selected_list < state.list_count {
owner := ReadListsRowHost(state.selected_list, false).owner_id
if owner.count > 0 && owner == row.id {
// Active and pending collaborators, independent of this account's friends.
SharingMemberShown :: (row: ListsUiPerson, list_id: string) -> bool {
return row.list_id == list_id && (row.status == "accepted" || row.status == "pending")
}
InvitationAvailable :: (friend: string, list_id: string, owner: string) -> bool {
if friend == frame.public_id || friend == owner {
return false
}
for index: cast(s32)0..frame.invitation_count - 1 {
if SharingMemberShown(ReadListsSharingRowHost(index, true), list_id) {
if ReadListsSharingRowHost(index, true).target == friend {
return false
}
}
return true
}
return row.target == frame.public_id && row.status == "pending"
return true
}
// Share and Invitations open in a dialog over the list.
ResetInvite :: () {
invite_text = ""
invite_target[0] = cast(u8)0
invite_cursor = 0
invite_anchor = 0
invite_scroll = 0
invite_focused = false
invite_suggestions = false
}
// An explicit invitation follows selection from the name suggestions.
InviteField :: (x: s32, y: s32, width: s32, disabled: bool) -> bool {
button_width := Scale(96)
previous_bytes: [128]u8
unused CopyCString(invite_text, previous_bytes[:])
previous := TextUntilNul(previous_bytes[:])
edited := TextField(frame.session, TextFieldProps.{.key = cast(u64)6540,
.bounds = Bounds(x, y, width - button_width - Scale(8), Scale(44)),
.value = previous, .placeholder = ListsLocaleHost("elist_invite_by_name"),
.cursor = invite_cursor, .anchor = invite_anchor, .scroll_x = invite_scroll,
.focused = invite_focused, .focus_id = 6540, .scale = frame.scale,
.max_bytes = 127, .max_codepoints = 127, .input = frame.input, .disabled = disabled})
if edited.edit.changed {
value := previous
if edited.edit.start >= 0 && edited.edit.end >= edited.edit.start && edited.edit.end <= value.count {
text: Vec(u8)
BuilderPrint(*text, "%", value[:edited.edit.start])
BuilderPrint(*text, "%", edited.edit.replacement)
BuilderPrint(*text, "%", value[edited.edit.end:])
invite_text = BuilderFinish(text)
invite_target[0] = cast(u8)0
invite_suggestions = true
}
}
invite_cursor = edited.cursor
invite_anchor = edited.anchor
invite_scroll = edited.scroll_x
invite_focused = edited.focused
frame.focused = invite_focused
if edited.clipboard_write {
frame.clipboard_write = true
frame.clipboard_text = edited.clipboard_text
}
if edited.escaped {
invite_suggestions = false
}
if Button(frame.session, ButtonProps.{.key = cast(u64)6541,
.bounds = Bounds(x + width - button_width, y, button_width, Scale(44)),
.label = ListsLocaleHost("elist_invite"),
.tone = cast(ButtonTone)ButtonToneAccent,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled,
.disabled = disabled || invite_target[0] == cast(u8)0}) != 0 {
Remote(LISTS_INVITE, TextUntilNul(invite_target[:]))
ResetInvite()
return true
}
return false
}
// Suggestions float below the input while typing and only select a person.
InviteSuggestions :: (x: s32, y: s32, list_id: string, owner: string) {
if !invite_suggestions || invite_text.count == 0 {
return
}
options: [8]ContextMenuItem
names: [8][128]u8
targets: [8][65]u8
count: s32 = 0
for index: cast(s32)0..frame.friend_count - 1 {
friend := ReadListsSharingRowHost(index, false)
id: [65]u8
alias: [128]u8
unused CopyCString(friend.id, id[:])
unused CopyCString(friend.alias, alias[:])
if !ContainsFoldASCII(TextUntilNul(alias[:]), invite_text) ||
!InvitationAvailable(TextUntilNul(id[:]), list_id, owner) {
continue
}
names[count] = alias
targets[count] = id
options[count] = ContextMenuItem.{.id = count + 1, .label = TextUntilNul(names[count][:])}
count += 1
if count == 8 {
break
}
}
if count == 0 {
options[0] = ContextMenuItem.{.id = 1, .label = ListsLocaleHost("elist_no_matches"), .disabled = true}
count = 1
}
result := ContextMenu(frame.session, ContextMenuProps.{.key = cast(u64)6542,
.open = true, .x = cast(float32)x, .y = cast(float32)y,
.escape = frame.input.escape, .scale = frame.scale}, options[:count])
if result.activated_id > 0 && result.activated_id <= count && !options[result.activated_id - 1].disabled {
selected := result.activated_id - 1
invite_text = Copied(TextUntilNul(names[selected][:]))
invite_target = targets[selected]
invite_cursor = cast(s32)invite_text.count
invite_anchor = invite_cursor
invite_suggestions = false
} else if result.closed {
invite_suggestions = false
}
}
// Each owner has the same edit, deletion, invitation and permission controls.
MemberRow :: (row: ListsUiPerson, x: s32, y: s32, width: s32, manages: bool,
original_owner: bool, disabled: bool) -> bool {
target: [65]u8
unused CopyCString(row.target, target[:])
name := row.target_alias
if name.count == 0 {
name = row.target[:ifx row.target.count > 8 then 8 else row.target.count]
}
if row.target == frame.public_id {
name = ListsLocaleHost("elist_you")
}
narrow := width < Scale(360)
role_width := ifx narrow then width else Scale(168)
name_width := ifx narrow then width else width - role_width - Scale(12)
Text(frame.session, TextProps.{.bounds = Bounds(x, y, name_width, Scale(28)),
.text = name, .wrap = cast(TextWrap)TextWrapEllipsis})
if row.status == "pending" {
Text(frame.session, TextProps.{.bounds = Bounds(x, y + Scale(28), name_width, Scale(24)),
.text = ListsLocaleHost("elist_invited"), .font = Scale(13)})
}
role: s32 = ifx original_owner || row.access == "owner" then 0 else ifx row.access == "viewer" then 2 else 1
role_y := y + ifx narrow then Scale(52) else 0
role_x := ifx narrow then x else x + width - role_width
labels: [3]string = .[ListsLocaleHost("elist_owner"), ListsLocaleHost("elist_can_edit"), ListsLocaleHost("elist_read_only")]
if manages && !original_owner {
options: [4]DropdownOption
for index: cast(s32)0..2 {
options[index] = DropdownOption.{.key = cast(u64)(index + 1), .label = labels[index]}
}
options[3] = DropdownOption.{.key = cast(u64)4, .label = ListsLocaleHost("elist_remove_access"), .separator_before = true}
changed := Dropdown(frame.session, DropdownProps.{.key = KeyHash(TextUntilNul(target[:])),
.bounds = Bounds(role_x, role_y, role_width, Scale(44)), .selected_index = role,
.disabled = disabled, .scale = frame.scale}, options[:4])
if changed.changed {
if changed.selected_index == 3 {
Remote(LISTS_REMOVE_ACCESS, TextUntilNul(target[:]))
} else {
access: [3]string = .["owner", "editor", "viewer"]
Remote(LISTS_SET_ACCESS, TextUntilNul(target[:]), "", "", access[changed.selected_index])
}
return true
}
} else {
Text(frame.session, TextProps.{.bounds = Bounds(role_x, role_y, role_width, Scale(44)),
.text = labels[role], .vertical_align = cast(TextAlign)TextAlignCenter})
}
return false
}
// Share and Invitations update automatically while the dialog is open.
SharingDialog :: () {
share := frame.panel == 1
list: ListsUiRow
if share && state.selected_list >= 0 && state.selected_list < state.list_count {
list = ReadListsRowHost(state.selected_list, false)
}
width := frame.width - Scale(32)
if width > Scale(520) {
width = Scale(520)
}
detail := ""
if !frame.connected {
detail = ListsLocaleHost("elist_connect")
} else if share {
detail = ListsLocaleHost("elist_share_detail")
} else {
detail = ListsLocaleHost("elist_invitations_detail")
detail := ListsLocaleHost("elist_connect")
if frame.connected {
detail = ListsLocaleHost(ifx share then "elist_people_with_access" else "elist_invitations_detail")
}
detail_height := ParagraphHeight(detail, width - Scale(36))
source_count := ifx share then frame.friend_count else frame.invitation_count
count: s32 = 0
for index: cast(s32)0..source_count - 1 {
if SharingRowShown(ReadListsSharingRowHost(index, !share)) {
count: s32 = ifx share then 1 else 0
for index: cast(s32)0..frame.invitation_count - 1 {
row := ReadListsSharingRowHost(index, true)
if (share && SharingMemberShown(row, list.id)) ||
(!share && row.target == frame.public_id && row.status == "pending") {
count += 1
}
}
row_height := Scale(ifx share then 64 else 160)
content_height := detail_height
if frame.connected {
if detail_height > 0 {
content_height += Scale(12)
}
shown := ifx count > 4 then 4 else count
if count == 0 {
content_height += Scale(48)
} else {
content_height += shown * row_height
}
content_height += Scale(12) + Scale(44)
row_height := Scale(ifx !share then 160 else ifx width - Scale(36) < Scale(360) then 104 else 64)
shown := ifx count > 4 then 4 else count
height := Scale(120) + shown * row_height
if share && frame.connected {
height += Scale(64)
}
if height > frame.height - frame.bottom - Scale(32) {
height = frame.height - frame.bottom - Scale(32)
}
dialog := ModalFrame(frame.session, ModalFrameProps.{.key = cast(u64)6520,
.title = ListsLocaleHost(ifx share then "elist_share" else "elist_invitations"),
.width = width, .height = content_height + Scale(74), .scale = frame.scale,
.width = width, .height = height, .scale = frame.scale,
.has_right_action = true, .right_label = ListsLocaleHost("close_button")})
if dialog.dismissed || dialog.right_clicked {
frame.panel = 0
frame.focused = false
sharing_scroll = 0
ResetInvite()
return
}
if !dialog.opened {
@@ -269,100 +437,76 @@ SharingDialog :: () {
y := cast(s32)dialog.layout.content.y
content_width := cast(s32)dialog.layout.content.width
bottom := cast(s32)(dialog.layout.content.y + dialog.layout.content.height)
if detail_height > 0 {
Text(frame.session, TextProps.{.bounds = Bounds(x, y, content_width, detail_height),
.text = detail, .wrap = cast(TextWrap)TextWrapAuto})
y += detail_height + Scale(12)
disabled := frame.sharing_busy || frame.sharing_pending
suggestions_y := y + Scale(48)
if share && frame.connected && !list.read_only {
if InviteField(x, y, content_width, disabled || list.incomplete) {
End(frame.session)
return
}
y += Scale(60)
} else if share && frame.connected {
Text(frame.session, TextProps.{.bounds = Bounds(x, y, content_width, Scale(44)),
.text = ListsLocaleHost("elist_read_only"), .vertical_align = cast(TextAlign)TextAlignCenter})
y += Scale(52)
}
Text(frame.session, TextProps.{.bounds = Bounds(x, y, content_width, Scale(32)),
.text = detail, .wrap = cast(TextWrap)TextWrapAuto})
y += Scale(40)
if !frame.connected {
End(frame.session)
return
}
refresh_width := ifx content_width < Scale(140) then content_width else Scale(140)
if Button(frame.session, ButtonProps.{.key = cast(u64)6511,
.bounds = Bounds(x + content_width - refresh_width, bottom - Scale(44), refresh_width, Scale(44)),
.label = ListsLocaleHost("elist_refresh"), .disabled = frame.sharing_busy}) != 0 {
state.action = LISTS_REFRESH
state.remote = true
}
if count == 0 {
Text(frame.session, TextProps.{.bounds = Bounds(x, y, content_width, Scale(48)),
.text = ListsLocaleHost(ifx share then "elist_no_friends" else "elist_no_invitations"),
.wrap = cast(TextWrap)TextWrapAuto})
End(frame.session)
return
}
scroll := Scroll(frame.session, ScrollProps.{.key = cast(u64)6512,
.bounds = Bounds(x, y, content_width, bottom - Scale(56) - y),
.content_height = count * row_height, .scroll_offset = sharing_scroll})
sharing_scroll = scroll.scroll_offset
if !scroll.opened {
End(frame.session)
return
}
row_y := cast(s32)scroll.content.y
disabled := frame.sharing_busy || frame.sharing_pending
for index: cast(s32)0..source_count - 1 {
row := ReadListsSharingRowHost(index, !share)
if !SharingRowShown(row) {
continue
}
if row_y + row_height <= cast(s32)scroll.viewport.y ||
row_y >= cast(s32)(scroll.viewport.y + scroll.viewport.height) {
row_y += row_height
continue
}
if share {
if InviteRow(row, index, x, row_y, content_width, disabled) {
End(frame.session)
Text(frame.session, TextProps.{.bounds = Bounds(x, y, content_width, Scale(44)),
.text = ListsLocaleHost("elist_no_invitations"), .wrap = cast(TextWrap)TextWrapAuto})
} else {
scroll := Scroll(frame.session, ScrollProps.{.key = cast(u64)6512,
.bounds = Bounds(x, y, content_width, bottom - y),
.content_height = count * row_height, .scroll_offset = sharing_scroll})
sharing_scroll = scroll.scroll_offset
if scroll.opened {
row_y := cast(s32)scroll.content.y
changed: bool
if share {
name := ifx list.owner_alias.count > 0 then list.owner_alias else list.owner_id
if !list.shared || list.owner_id == frame.public_id {
name = ListsLocaleHost("elist_you")
}
unused MemberRow(ListsUiPerson.{.target = list.owner_id, .target_alias = name, .access = "owner"},
x, row_y, content_width - Scale(14), false, true, disabled)
row_y += row_height
}
for index: cast(s32)0..frame.invitation_count - 1 {
row := ReadListsSharingRowHost(index, true)
if (share && !SharingMemberShown(row, list.id)) ||
(!share && (row.target != frame.public_id || row.status != "pending")) {
continue
}
if row_y + row_height > cast(s32)scroll.viewport.y && row_y < cast(s32)(scroll.viewport.y + scroll.viewport.height) {
if share {
changed = MemberRow(row, x, row_y, content_width - Scale(14), list.owner, false, disabled)
} else {
changed = InvitationRow(row, index, x, row_y, content_width - Scale(14), disabled)
}
if changed {
break
}
}
row_y += row_height
}
End(frame.session)
if changed {
End(frame.session)
return
}
} else if InvitationRow(row, index, x, row_y, content_width, disabled) {
End(frame.session)
End(frame.session)
return
}
row_y += row_height
}
End(frame.session)
End(frame.session)
}
// A friend and the Invite button for the selected list. True once an
// invitation is sent.
InviteRow :: (row: ListsUiPerson, index: s32, x: s32, y: s32, width: s32, disabled: bool) -> bool {
// Copied first: reading the invitations below reuses the row's buffer.
friend := Copied(row.id)
alias := Copied(row.alias)
if alias.count == 0 {
alias = friend
}
status := ""
selected := ReadListsRowHost(state.selected_list, false)
for invitation_index: cast(s32)0..frame.invitation_count - 1 {
invite := ReadListsSharingRowHost(invitation_index, true)
if invite.list_id == selected.id && invite.target == friend {
status = Copied(invite.status)
}
}
button_width := Scale(112)
Text(frame.session, TextProps.{.bounds = Bounds(x, y, width - button_width - Scale(12), Scale(44)),
.text = alias, .vertical_align = cast(TextAlign)TextAlignCenter})
key := "elist_invite"
if status == "accepted" {
key = "elist_accepted"
} else if status == "pending" {
key = "elist_invited"
// Emit the floating menu last so it sits above all collaborator rows.
if share && !list.read_only && !disabled {
InviteSuggestions(x, suggestions_y, list.id, list.owner_id)
}
if Button(frame.session, ButtonProps.{.key = cast(u64)(7400 + index),
.bounds = Bounds(x + width - button_width, y, button_width, Scale(44)),
.label = ListsLocaleHost(key), .disabled = disabled || status == "pending" || status == "accepted",
.tone = cast(ButtonTone)ButtonToneAccent}) != 0 {
Remote(LISTS_INVITE, friend)
return true
}
return false
End(frame.session)
}
// An invitation to a list, who sent it, and Accept and Decline. True once
@@ -404,7 +548,13 @@ InvitationRow :: (row: ListsUiPerson, index: s32, x: s32, y: s32, width: s32, di
ListsView :: (message: ListsMessage) -> ListsMessage {
frame = ReadListsUiHost()
state = message
input := frame.input
if frame.panel != 0 {
frame.input = TextFieldInput.{}
frame.focused = false
}
ListsPage()
frame.input = input
if frame.panel != 0 {
SharingDialog()
}
@@ -457,10 +607,11 @@ ListsPage :: () {
.label = ListsLocaleHost("elist_share"), .icon_shape = SHARE_ICON, .icon_only = true,
.tone = cast(ButtonTone)ButtonToneAccent,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled,
.disabled = current.id.count == 0 || current.incomplete || blocked || editing_list}) != 0 {
.disabled = current.id.count == 0 || editing_list}) != 0 {
frame.panel = 1
frame.focused = false
sharing_scroll = 0
ResetInvite()
}
// Edit opens the name; Delete is inside it, behind a question.
if Button(frame.session, ButtonProps.{.key = cast(u64)6503,
@@ -468,7 +619,7 @@ ListsPage :: () {
.label = ListsLocaleHost("elist_rename"), .icon_only = true,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost,
.icon_type = cast(s32)IconEdit,
.disabled = current.id.count == 0 || blocked || editing_list}) != 0 {
.disabled = current.id.count == 0 || current.read_only || blocked || editing_list}) != 0 {
delete_confirm = false
BeginInput(-3, current.title)
return
@@ -513,6 +664,9 @@ ListsPage :: () {
.text = ListsLocaleHost("elist_capacity"), .wrap = cast(TextWrap)TextWrapAuto})
y += Scale(72)
}
if current.read_only && state.editing_item != -2 {
blocked = true
}
if !editing_list {
// Invitations to other people's lists appear only while some wait.
if frame.pending_count_text != "0" && frame.pending_count_text != "" {
@@ -537,7 +691,7 @@ ListsPage :: () {
if state.editing_item == -2 || state.editing_item == -3 {
owner := !current.shared || current.owner
committed := Field(Bounds(x, y, width, Scale(44)),
ListsLocaleHost(ifx state.editing_item == -3 then "elist_list_name_placeholder" else "elist_new_list_placeholder"))
ListsLocaleHost(ifx state.editing_item == -3 then "elist_list_name_placeholder" else "elist_new_list_placeholder"), blocked)
button_width := (width - Scale(8)) / 2
if Button(frame.session, ButtonProps.{.key = cast(u64)6506,
.label = ListsLocaleHost(ifx state.editing_item == -3 then "done_button" else "elist_create_list"),
@@ -581,7 +735,7 @@ ListsPage :: () {
return
}
committed := Field(Bounds(x, y, width - Scale(96), Scale(44)),
ListsLocaleHost(ifx state.editing_item >= 0 then "elist_item_name_placeholder" else "elist_add_item_placeholder"))
ListsLocaleHost(ifx state.editing_item >= 0 then "elist_item_name_placeholder" else "elist_add_item_placeholder"), blocked)
if Button(frame.session, ButtonProps.{.key = cast(u64)6507,
.label = ListsLocaleHost(ifx state.editing_item >= 0 then "done_button" else "elist_add_item"),
.bounds = Bounds(x + width - Scale(88), y, Scale(88), Scale(44)),
+15 -2
View File
@@ -32,8 +32,9 @@ ListsJsonString :: (out: *Vec(u8), value: string) {
ListsBuildCommand :: (message: ListsMessage, frame: ListsUiFrame,
list: ListsUiRow, rows: []ListsUiRow, target: string = "",
invitation: string = "") -> string {
if list.incomplete {
invitation: string = "", access: string = "") -> string {
permissions := message.action == LISTS_SET_ACCESS || message.action == LISTS_REMOVE_ACCESS
if list.incomplete && !permissions {
return ""
}
action := "save"
@@ -43,6 +44,10 @@ ListsBuildCommand :: (message: ListsMessage, frame: ListsUiFrame,
action = "accept"
} else if message.action == LISTS_DECLINE {
action = "decline"
} else if message.action == LISTS_SET_ACCESS {
action = "access"
} else if message.action == LISTS_REMOVE_ACCESS {
action = "remove"
} else if message.action == LISTS_DELETE_LIST {
action = "delete"
}
@@ -53,10 +58,18 @@ ListsBuildCommand :: (message: ListsMessage, frame: ListsUiFrame,
ListsJsonString(*out, action)
BuilderPrint(*out, ",\"target\":")
ListsJsonString(*out, target)
if access.count > 0 {
BuilderPrint(*out, ",\"access\":")
ListsJsonString(*out, access)
}
BuilderPrint(*out, ",\"invitation_id\":")
ListsJsonString(*out, invitation)
BuilderPrint(*out, ",\"list\":{\"id\":")
ListsJsonString(*out, list.id)
if permissions {
BuilderPrint(*out, "}}")
return BuilderFinish(out)
}
BuilderPrint(*out, ",\"title\":")
title := list.title
if message.action == LISTS_COMMIT && message.editing_item == -3 {
+3 -3
View File
@@ -1,5 +1,5 @@
{
"host_api": 26,
"host_api": 27,
"oldest_host_api": 12,
"module_api": 2,
"apps": {
@@ -8,7 +8,7 @@
"version": "2.1.38",
"sequence": 35,
"bundled": true,
"host_api": 26,
"host_api": 27,
"release": "2.1.38"
},
"habits": {
@@ -32,7 +32,7 @@
"version": "1.1.5",
"sequence": 13,
"bundled": true,
"host_api": 26,
"host_api": 27,
"release": "2.1.38"
},
"diary": {
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,7 @@
- Android account-key backups use the system Save dialog and confirm that the chosen file was written.
- Shared lists preserve every task when edited, show who already has access, and let members edit and share them.
- Share lists with name suggestions and an automatically updated list of everyone with access.
- Give collaborators full owner rights, editing access, or read-only access, and remove access from the same dialog.
- Shared-list edits preserve every task.
- Undo restores a deleted task with its comment and completion state.
- The Habits shop scrolls through all recent activity and offers a soda reward symbol.
- Games hide the surrounding navigation and keep a clear return path to Arcade.
+32
View File
@@ -7454,3 +7454,35 @@ Pojmenujte nový seznam
[elist_list_name_placeholder]
Název seznamu
---
[elist_invite_by_name]
Pozvat podle jména
---
[elist_owner]
Vlastník
---
[elist_can_edit]
Může upravovat
---
[elist_read_only]
Pouze čtení
---
[elist_remove_access]
Odebrat přístup
---
[elist_you]
Vy
---
[elist_no_matches]
Žádní odpovídající přátelé
---
[elist_people_with_access]
Lidé s přístupem
---
+32
View File
@@ -7448,3 +7448,35 @@ Neue Liste benennen
[elist_list_name_placeholder]
Name der Liste
---
[elist_invite_by_name]
Nach Namen einladen
---
[elist_owner]
Eigentümer
---
[elist_can_edit]
Darf bearbeiten
---
[elist_read_only]
Nur lesen
---
[elist_remove_access]
Zugriff entfernen
---
[elist_you]
Du
---
[elist_no_matches]
Keine passenden Freunde
---
[elist_people_with_access]
Personen mit Zugriff
---
+32
View File
@@ -7472,3 +7472,35 @@ Name your new list
[elist_list_name_placeholder]
List name
---
[elist_invite_by_name]
Invite by name
---
[elist_owner]
Owner
---
[elist_can_edit]
Can edit
---
[elist_read_only]
Read only
---
[elist_remove_access]
Remove access
---
[elist_you]
You
---
[elist_no_matches]
No matching friends
---
[elist_people_with_access]
People with access
---
+32
View File
@@ -7448,3 +7448,35 @@ Pon nombre a tu lista nueva
[elist_list_name_placeholder]
Nombre de la lista
---
[elist_invite_by_name]
Invitar por nombre
---
[elist_owner]
Propietario
---
[elist_can_edit]
Puede editar
---
[elist_read_only]
Solo lectura
---
[elist_remove_access]
Quitar acceso
---
[elist_you]
Tú
---
[elist_no_matches]
No hay amigos que coincidan
---
[elist_people_with_access]
Personas con acceso
---
+32
View File
@@ -7436,3 +7436,35 @@ Nommez votre nouvelle liste
[elist_list_name_placeholder]
Nom de la liste
---
[elist_invite_by_name]
Inviter par nom
---
[elist_owner]
Propriétaire
---
[elist_can_edit]
Peut modifier
---
[elist_read_only]
Lecture seule
---
[elist_remove_access]
Retirer l’accès
---
[elist_you]
Vous
---
[elist_no_matches]
Aucun ami correspondant
---
[elist_people_with_access]
Personnes ayant accès
---
+32
View File
@@ -7437,3 +7437,35 @@ Beri nama daftar baru
[elist_list_name_placeholder]
Nama daftar
---
[elist_invite_by_name]
Undang berdasarkan nama
---
[elist_owner]
Pemilik
---
[elist_can_edit]
Dapat mengedit
---
[elist_read_only]
Hanya baca
---
[elist_remove_access]
Hapus akses
---
[elist_you]
Anda
---
[elist_no_matches]
Tidak ada teman yang cocok
---
[elist_people_with_access]
Orang yang memiliki akses
---
+32
View File
@@ -7437,3 +7437,35 @@ Dai un nome al nuovo elenco
[elist_list_name_placeholder]
Nome dell’elenco
---
[elist_invite_by_name]
Invita per nome
---
[elist_owner]
Proprietario
---
[elist_can_edit]
Può modificare
---
[elist_read_only]
Sola lettura
---
[elist_remove_access]
Rimuovi accesso
---
[elist_you]
Tu
---
[elist_no_matches]
Nessun amico corrispondente
---
[elist_people_with_access]
Persone con accesso
---
+32
View File
@@ -7433,3 +7433,35 @@ Inner Breeze がバージョン %s に更新されました。
[elist_list_name_placeholder]
リスト名
---
[elist_invite_by_name]
名前で招待
---
[elist_owner]
オーナー
---
[elist_can_edit]
編集可能
---
[elist_read_only]
閲覧のみ
---
[elist_remove_access]
アクセス権を削除
---
[elist_you]
あなた
---
[elist_no_matches]
該当する友達はいません
---
[elist_people_with_access]
アクセスできるユーザー
---
+32
View File
@@ -7443,3 +7443,35 @@ Inner Breeze가 %s 버전으로 업데이트되었어요.
[elist_list_name_placeholder]
목록 이름
---
[elist_invite_by_name]
이름으로 초대
---
[elist_owner]
소유자
---
[elist_can_edit]
수정 가능
---
[elist_read_only]
읽기 전용
---
[elist_remove_access]
액세스 삭제
---
[elist_you]
나
---
[elist_no_matches]
일치하는 친구가 없습니다
---
[elist_people_with_access]
액세스 권한이 있는 사용자
---
+32
View File
@@ -7446,3 +7446,35 @@ Dê um nome à nova lista
[elist_list_name_placeholder]
Nome da lista
---
[elist_invite_by_name]
Convidar pelo nome
---
[elist_owner]
Proprietário
---
[elist_can_edit]
Pode editar
---
[elist_read_only]
Somente leitura
---
[elist_remove_access]
Remover acesso
---
[elist_you]
Você
---
[elist_no_matches]
Nenhum amigo encontrado
---
[elist_people_with_access]
Pessoas com acesso
---
+32
View File
@@ -7442,3 +7442,35 @@ Inner Breeze обновлён до версии %s.
[elist_list_name_placeholder]
Название списка
---
[elist_invite_by_name]
Пригласить по имени
---
[elist_owner]
Владелец
---
[elist_can_edit]
Может изменять
---
[elist_read_only]
Только чтение
---
[elist_remove_access]
Закрыть доступ
---
[elist_you]
Вы
---
[elist_no_matches]
Подходящие друзья не найдены
---
[elist_people_with_access]
Пользователи с доступом
---
+32
View File
@@ -7448,3 +7448,35 @@ Inner Breeze 已更新至 %s 版本。
[elist_list_name_placeholder]
列表名称
---
[elist_invite_by_name]
按姓名邀请
---
[elist_owner]
所有者
---
[elist_can_edit]
可编辑
---
[elist_read_only]
只读
---
[elist_remove_access]
移除访问权限
---
[elist_you]
你
---
[elist_no_matches]
没有匹配的好友
---
[elist_people_with_access]
有权访问的用户
---
+3 -1
View File
@@ -7,7 +7,9 @@ This review continues the 21 October Inbe session. It records the requested fixe
- Android account-key backups use a system-picked document URI, stage bytes in private storage, and report success only after writing and closing the destination. Cancellation and failed writes remain distinct from success.
- Lists prepares shared edits from the complete account-scoped saved document in `src/cells/lists_command.zi`. The screen's bounded item buffer is a view, not a replacement document. Local sharing reads all saved items from SQLite; shared edits read the complete confirmed cache.
- The Share dialog uses the list's owner and accepted/pending invitations. It copies strings that must survive another host read. Daochi supplies the same collaborator states to authorized members and the owner.
- The Share dialog shows the original owner and every active or pending collaborator, including people outside the viewer's friends cache. Name suggestions select an invitee before the explicit Invite action. Sharing refreshes silently.
- Owners can give others the same full list rights: editing, deletion, invitations and permission management. Editors can change content and invite; viewers can read. Permission changes and removal are enforced by Daochi. The original owner retains the list's storage identity.
- Released sharing translations remain available to older app packages while the new interface uses the new role labels.
- Undo restores a private item's existing row, retaining its ID, comment, completion and order. Shared undo retains the item ID, comment and completion in the next revision.
- Games inside Arcade use the existing nested Back path. Host navigation hides during a game and the return bar remains available, including when Arcade is pinned.
- Library uses the existing Kryon horizontal swipe decision for chapter turns. Vertical movement remains chapter scrolling. Reading hides host navigation and uses a paper background. The current catalog contains one book; no additional books have been selected or added.
+11 -2
View File
@@ -14,6 +14,7 @@ from datetime import datetime, timezone
import fnmatch
import hashlib
import io
import ipaddress
import json
import os
from pathlib import Path
@@ -71,8 +72,16 @@ class Phone:
def __init__(self, host, serial):
if not re.fullmatch(r"[A-Za-z0-9_.@-]+", host) or host.startswith("-"):
raise ValueError("invalid ADB host")
if not re.fullmatch(r"[A-Za-z0-9]+", serial):
raise ValueError("invalid phone serial")
valid_serial = re.fullmatch(r"[A-Za-z0-9]+", serial) is not None
if not valid_serial:
address, separator, port = serial.rpartition(":")
try:
ipaddress.IPv4Address(address)
valid_serial = bool(separator and port.isdecimal() and 1 <= int(port) <= 65535)
except ipaddress.AddressValueError:
valid_serial = False
if not valid_serial:
raise ValueError("invalid phone serial or wireless ADB address")
self.host = host
self.serial = serial
+118 -48
View File
@@ -1163,7 +1163,7 @@ WidgetValidListsUiFrame :: (value: HostValue) -> bool {
}
WidgetListsUiRowCodec :: struct {
fields: [13]HostField
fields: [15]HostField
}
WidgetEncodeListsUiRow :: (data: ListsUiRow, codec: *WidgetListsUiRowCodec) -> HostValue {
@@ -1171,7 +1171,7 @@ WidgetEncodeListsUiRow :: (data: ListsUiRow, codec: *WidgetListsUiRowCodec) -> H
value.kind = cast(s32)HostRecord
value.type_name = HostTextData("ListsUiRow")
value.fields = *codec.fields[0]
value.field_count = 13
value.field_count = 15
codec.fields[0].name = HostTextData("id")
codec.fields[0].value = HostValue.{.kind = cast(s32)HostString, .type_name = HostTextData("string"), .data = HostTextData(data.id), .length = cast(usize)data.id.count}
codec.fields[1].name = HostTextData("parent_id")
@@ -1190,14 +1190,18 @@ WidgetEncodeListsUiRow :: (data: ListsUiRow, codec: *WidgetListsUiRowCodec) -> H
codec.fields[7].value = HostScalar("bool", ifx data.owner then 1 else 0)
codec.fields[8].name = HostTextData("owner_id")
codec.fields[8].value = HostValue.{.kind = cast(s32)HostString, .type_name = HostTextData("string"), .data = HostTextData(data.owner_id), .length = cast(usize)data.owner_id.count}
codec.fields[9].name = HostTextData("revision")
codec.fields[9].value = HostScalar("s64", cast(s64)data.revision)
codec.fields[10].name = HostTextData("incomplete")
codec.fields[10].value = HostScalar("bool", ifx data.incomplete then 1 else 0)
codec.fields[11].name = HostTextData("people")
codec.fields[11].value = HostValue.{.kind = cast(s32)HostString, .type_name = HostTextData("string"), .data = HostTextData(data.people), .length = cast(usize)data.people.count}
codec.fields[12].name = HostTextData("invited")
codec.fields[12].value = HostValue.{.kind = cast(s32)HostString, .type_name = HostTextData("string"), .data = HostTextData(data.invited), .length = cast(usize)data.invited.count}
codec.fields[9].name = HostTextData("owner_alias")
codec.fields[9].value = HostValue.{.kind = cast(s32)HostString, .type_name = HostTextData("string"), .data = HostTextData(data.owner_alias), .length = cast(usize)data.owner_alias.count}
codec.fields[10].name = HostTextData("read_only")
codec.fields[10].value = HostScalar("bool", ifx data.read_only then 1 else 0)
codec.fields[11].name = HostTextData("revision")
codec.fields[11].value = HostScalar("s64", cast(s64)data.revision)
codec.fields[12].name = HostTextData("incomplete")
codec.fields[12].value = HostScalar("bool", ifx data.incomplete then 1 else 0)
codec.fields[13].name = HostTextData("people")
codec.fields[13].value = HostValue.{.kind = cast(s32)HostString, .type_name = HostTextData("string"), .data = HostTextData(data.people), .length = cast(usize)data.people.count}
codec.fields[14].name = HostTextData("invited")
codec.fields[14].value = HostValue.{.kind = cast(s32)HostString, .type_name = HostTextData("string"), .data = HostTextData(data.invited), .length = cast(usize)data.invited.count}
return value
}
@@ -1259,25 +1263,37 @@ WidgetDecodeListsUiRow :: (value: HostValue, codec: *WidgetListsUiRowCodec) -> L
}
}
{
field_at := HostFieldAt(value, 9, "revision")
field_at := HostFieldAt(value, 9, "owner_alias")
if field_at >= 0 {
data.owner_alias = TextFromBytes(BytesFromPointer(value.fields[field_at].value.data, cast(u64)value.fields[field_at].value.length))
}
}
{
field_at := HostFieldAt(value, 10, "read_only")
if field_at >= 0 {
data.read_only = value.fields[field_at].value.integer != 0
}
}
{
field_at := HostFieldAt(value, 11, "revision")
if field_at >= 0 {
data.revision = cast(s64)value.fields[field_at].value.integer
}
}
{
field_at := HostFieldAt(value, 10, "incomplete")
field_at := HostFieldAt(value, 12, "incomplete")
if field_at >= 0 {
data.incomplete = value.fields[field_at].value.integer != 0
}
}
{
field_at := HostFieldAt(value, 11, "people")
field_at := HostFieldAt(value, 13, "people")
if field_at >= 0 {
data.people = TextFromBytes(BytesFromPointer(value.fields[field_at].value.data, cast(u64)value.fields[field_at].value.length))
}
}
{
field_at := HostFieldAt(value, 12, "invited")
field_at := HostFieldAt(value, 14, "invited")
if field_at >= 0 {
data.invited = TextFromBytes(BytesFromPointer(value.fields[field_at].value.data, cast(u64)value.fields[field_at].value.length))
}
@@ -1344,25 +1360,37 @@ WidgetValidListsUiRow :: (value: HostValue) -> bool {
}
}
{
field_at := HostFieldAt(value, 9, "revision")
if field_at >= 0 {
if !HostScalarValid(value.fields[field_at].value, "s64", cast(s32)HostInteger) { return false }
}
}
{
field_at := HostFieldAt(value, 10, "incomplete")
if field_at >= 0 {
if !HostScalarValid(value.fields[field_at].value, "bool", cast(s32)HostInteger) { return false }
}
}
{
field_at := HostFieldAt(value, 11, "people")
field_at := HostFieldAt(value, 9, "owner_alias")
if field_at >= 0 {
if !HostScalarValid(value.fields[field_at].value, "string", cast(s32)HostString) { return false }
}
}
{
field_at := HostFieldAt(value, 12, "invited")
field_at := HostFieldAt(value, 10, "read_only")
if field_at >= 0 {
if !HostScalarValid(value.fields[field_at].value, "bool", cast(s32)HostInteger) { return false }
}
}
{
field_at := HostFieldAt(value, 11, "revision")
if field_at >= 0 {
if !HostScalarValid(value.fields[field_at].value, "s64", cast(s32)HostInteger) { return false }
}
}
{
field_at := HostFieldAt(value, 12, "incomplete")
if field_at >= 0 {
if !HostScalarValid(value.fields[field_at].value, "bool", cast(s32)HostInteger) { return false }
}
}
{
field_at := HostFieldAt(value, 13, "people")
if field_at >= 0 {
if !HostScalarValid(value.fields[field_at].value, "string", cast(s32)HostString) { return false }
}
}
{
field_at := HostFieldAt(value, 14, "invited")
if field_at >= 0 {
if !HostScalarValid(value.fields[field_at].value, "string", cast(s32)HostString) { return false }
}
@@ -1371,7 +1399,7 @@ WidgetValidListsUiRow :: (value: HostValue) -> bool {
}
WidgetListsUiPersonCodec :: struct {
fields: [7]HostField
fields: [9]HostField
}
WidgetEncodeListsUiPerson :: (data: ListsUiPerson, codec: *WidgetListsUiPersonCodec) -> HostValue {
@@ -1379,7 +1407,7 @@ WidgetEncodeListsUiPerson :: (data: ListsUiPerson, codec: *WidgetListsUiPersonCo
value.kind = cast(s32)HostRecord
value.type_name = HostTextData("ListsUiPerson")
value.fields = *codec.fields[0]
value.field_count = 7
value.field_count = 9
codec.fields[0].name = HostTextData("id")
codec.fields[0].value = HostValue.{.kind = cast(s32)HostString, .type_name = HostTextData("string"), .data = HostTextData(data.id), .length = cast(usize)data.id.count}
codec.fields[1].name = HostTextData("alias")
@@ -1394,6 +1422,10 @@ WidgetEncodeListsUiPerson :: (data: ListsUiPerson, codec: *WidgetListsUiPersonCo
codec.fields[5].value = HostValue.{.kind = cast(s32)HostString, .type_name = HostTextData("string"), .data = HostTextData(data.title), .length = cast(usize)data.title.count}
codec.fields[6].name = HostTextData("status")
codec.fields[6].value = HostValue.{.kind = cast(s32)HostString, .type_name = HostTextData("string"), .data = HostTextData(data.status), .length = cast(usize)data.status.count}
codec.fields[7].name = HostTextData("target_alias")
codec.fields[7].value = HostValue.{.kind = cast(s32)HostString, .type_name = HostTextData("string"), .data = HostTextData(data.target_alias), .length = cast(usize)data.target_alias.count}
codec.fields[8].name = HostTextData("access")
codec.fields[8].value = HostValue.{.kind = cast(s32)HostString, .type_name = HostTextData("string"), .data = HostTextData(data.access), .length = cast(usize)data.access.count}
return value
}
@@ -1442,6 +1474,18 @@ WidgetDecodeListsUiPerson :: (value: HostValue, codec: *WidgetListsUiPersonCodec
data.status = TextFromBytes(BytesFromPointer(value.fields[field_at].value.data, cast(u64)value.fields[field_at].value.length))
}
}
{
field_at := HostFieldAt(value, 7, "target_alias")
if field_at >= 0 {
data.target_alias = TextFromBytes(BytesFromPointer(value.fields[field_at].value.data, cast(u64)value.fields[field_at].value.length))
}
}
{
field_at := HostFieldAt(value, 8, "access")
if field_at >= 0 {
data.access = TextFromBytes(BytesFromPointer(value.fields[field_at].value.data, cast(u64)value.fields[field_at].value.length))
}
}
return data
}
@@ -1491,11 +1535,23 @@ WidgetValidListsUiPerson :: (value: HostValue) -> bool {
if !HostScalarValid(value.fields[field_at].value, "string", cast(s32)HostString) { return false }
}
}
{
field_at := HostFieldAt(value, 7, "target_alias")
if field_at >= 0 {
if !HostScalarValid(value.fields[field_at].value, "string", cast(s32)HostString) { return false }
}
}
{
field_at := HostFieldAt(value, 8, "access")
if field_at >= 0 {
if !HostScalarValid(value.fields[field_at].value, "string", cast(s32)HostString) { return false }
}
}
return true
}
WidgetListsUiRequestCodec :: struct {
fields: [12]HostField
fields: [13]HostField
}
WidgetEncodeListsUiRequest :: (data: ListsUiRequest, codec: *WidgetListsUiRequestCodec) -> HostValue {
@@ -1503,7 +1559,7 @@ WidgetEncodeListsUiRequest :: (data: ListsUiRequest, codec: *WidgetListsUiReques
value.kind = cast(s32)HostRecord
value.type_name = HostTextData("ListsUiRequest")
value.fields = *codec.fields[0]
value.field_count = 12
value.field_count = 13
codec.fields[0].name = HostTextData("action")
codec.fields[0].value = HostScalar("s32", cast(s64)data.action)
codec.fields[1].name = HostTextData("index")
@@ -1520,14 +1576,16 @@ WidgetEncodeListsUiRequest :: (data: ListsUiRequest, codec: *WidgetListsUiReques
codec.fields[6].value = HostValue.{.kind = cast(s32)HostString, .type_name = HostTextData("string"), .data = HostTextData(data.next_id), .length = cast(usize)data.next_id.count}
codec.fields[7].name = HostTextData("target")
codec.fields[7].value = HostValue.{.kind = cast(s32)HostString, .type_name = HostTextData("string"), .data = HostTextData(data.target), .length = cast(usize)data.target.count}
codec.fields[8].name = HostTextData("invitation")
codec.fields[8].value = HostValue.{.kind = cast(s32)HostString, .type_name = HostTextData("string"), .data = HostTextData(data.invitation), .length = cast(usize)data.invitation.count}
codec.fields[9].name = HostTextData("list_id")
codec.fields[9].value = HostValue.{.kind = cast(s32)HostString, .type_name = HostTextData("string"), .data = HostTextData(data.list_id), .length = cast(usize)data.list_id.count}
codec.fields[10].name = HostTextData("item_id")
codec.fields[10].value = HostValue.{.kind = cast(s32)HostString, .type_name = HostTextData("string"), .data = HostTextData(data.item_id), .length = cast(usize)data.item_id.count}
codec.fields[11].name = HostTextData("comment")
codec.fields[11].value = HostValue.{.kind = cast(s32)HostString, .type_name = HostTextData("string"), .data = HostTextData(data.comment), .length = cast(usize)data.comment.count}
codec.fields[8].name = HostTextData("access")
codec.fields[8].value = HostValue.{.kind = cast(s32)HostString, .type_name = HostTextData("string"), .data = HostTextData(data.access), .length = cast(usize)data.access.count}
codec.fields[9].name = HostTextData("invitation")
codec.fields[9].value = HostValue.{.kind = cast(s32)HostString, .type_name = HostTextData("string"), .data = HostTextData(data.invitation), .length = cast(usize)data.invitation.count}
codec.fields[10].name = HostTextData("list_id")
codec.fields[10].value = HostValue.{.kind = cast(s32)HostString, .type_name = HostTextData("string"), .data = HostTextData(data.list_id), .length = cast(usize)data.list_id.count}
codec.fields[11].name = HostTextData("item_id")
codec.fields[11].value = HostValue.{.kind = cast(s32)HostString, .type_name = HostTextData("string"), .data = HostTextData(data.item_id), .length = cast(usize)data.item_id.count}
codec.fields[12].name = HostTextData("comment")
codec.fields[12].value = HostValue.{.kind = cast(s32)HostString, .type_name = HostTextData("string"), .data = HostTextData(data.comment), .length = cast(usize)data.comment.count}
return value
}
@@ -1583,25 +1641,31 @@ WidgetDecodeListsUiRequest :: (value: HostValue, codec: *WidgetListsUiRequestCod
}
}
{
field_at := HostFieldAt(value, 8, "invitation")
field_at := HostFieldAt(value, 8, "access")
if field_at >= 0 {
data.access = TextFromBytes(BytesFromPointer(value.fields[field_at].value.data, cast(u64)value.fields[field_at].value.length))
}
}
{
field_at := HostFieldAt(value, 9, "invitation")
if field_at >= 0 {
data.invitation = TextFromBytes(BytesFromPointer(value.fields[field_at].value.data, cast(u64)value.fields[field_at].value.length))
}
}
{
field_at := HostFieldAt(value, 9, "list_id")
field_at := HostFieldAt(value, 10, "list_id")
if field_at >= 0 {
data.list_id = TextFromBytes(BytesFromPointer(value.fields[field_at].value.data, cast(u64)value.fields[field_at].value.length))
}
}
{
field_at := HostFieldAt(value, 10, "item_id")
field_at := HostFieldAt(value, 11, "item_id")
if field_at >= 0 {
data.item_id = TextFromBytes(BytesFromPointer(value.fields[field_at].value.data, cast(u64)value.fields[field_at].value.length))
}
}
{
field_at := HostFieldAt(value, 11, "comment")
field_at := HostFieldAt(value, 12, "comment")
if field_at >= 0 {
data.comment = TextFromBytes(BytesFromPointer(value.fields[field_at].value.data, cast(u64)value.fields[field_at].value.length))
}
@@ -1662,25 +1726,31 @@ WidgetValidListsUiRequest :: (value: HostValue) -> bool {
}
}
{
field_at := HostFieldAt(value, 8, "invitation")
field_at := HostFieldAt(value, 8, "access")
if field_at >= 0 {
if !HostScalarValid(value.fields[field_at].value, "string", cast(s32)HostString) { return false }
}
}
{
field_at := HostFieldAt(value, 9, "list_id")
field_at := HostFieldAt(value, 9, "invitation")
if field_at >= 0 {
if !HostScalarValid(value.fields[field_at].value, "string", cast(s32)HostString) { return false }
}
}
{
field_at := HostFieldAt(value, 10, "item_id")
field_at := HostFieldAt(value, 10, "list_id")
if field_at >= 0 {
if !HostScalarValid(value.fields[field_at].value, "string", cast(s32)HostString) { return false }
}
}
{
field_at := HostFieldAt(value, 11, "comment")
field_at := HostFieldAt(value, 11, "item_id")
if field_at >= 0 {
if !HostScalarValid(value.fields[field_at].value, "string", cast(s32)HostString) { return false }
}
}
{
field_at := HostFieldAt(value, 12, "comment")
if field_at >= 0 {
if !HostScalarValid(value.fields[field_at].value, "string", cast(s32)HostString) { return false }
}
+1 -1
View File
@@ -1,5 +1,5 @@
// Generated from apps/versions.json. This host runs packages built for host
// interfaces from the oldest to the current one; module interfaces must match.
PackageHostAPI :: 26
PackageHostAPI :: 27
PackageHostAPIOldest :: 12
PackageModuleAPI :: 2
+12 -1
View File
@@ -48,6 +48,17 @@ ListsPrepareCommand :: (state: *EListState, request: ListsUiRequest) -> string {
if TextUntilNul(source.id[:]) != request.list_id {
return ""
}
permissions := request.action == LISTS_SET_ACCESS || request.action == LISTS_REMOVE_ACCESS
if permissions {
if !source.shared || !source.owner {
return ""
}
return ListsBuildCommand(message, ListsUiFrame.{.next_id = request.next_id},
list, VecSlice(rows, 0, rows.count), request.target, request.invitation, request.access)
}
if source.shared && source.read_only {
return ""
}
list.title = TextUntilNul(source.title[:])
list.revision = source.revision
if source.shared {
@@ -132,5 +143,5 @@ ListsPrepareCommand :: (state: *EListState, request: ListsUiRequest) -> string {
}
}
return ListsBuildCommand(message, ListsUiFrame.{.value = request.value,
.next_id = request.next_id}, list, VecSlice(rows, 0, rows.count), request.target, request.invitation)
.next_id = request.next_id}, list, VecSlice(rows, 0, rows.count), request.target, request.invitation, request.access)
}
+3 -1
View File
@@ -233,7 +233,9 @@ ListsNetworkTick :: (app: *InnerBreeze, now: float64, visible: bool) {
}
// A failed refresh keeps the last confirmed lists and says nothing.
}
lists_refresh_at = now + ifx lists_operation.result == cast(s32)AuthResult.AUTH_OK then 10.0 else 30.0
refused := lists_writing && (lists_operation.request.status == 403 ||
lists_operation.request.status == 404 || lists_operation.request.status == 409)
lists_refresh_at = ifx refused then now else now + ifx lists_operation.result == cast(s32)AuthResult.AUTH_OK then 10.0 else 30.0
}
if ListsNetworkPending() && !lists_operation.active && ListsNetworkReady() && now >= lists_retry_at {
message: ListsMessage
+2
View File
@@ -13,6 +13,8 @@ LISTS_DECLINE :: 11
LISTS_REFRESH :: 12
LISTS_RETRY :: 13
LISTS_RESTORE_ITEM :: 14
LISTS_SET_ACCESS :: 15
LISTS_REMOVE_ACCESS :: 16
LISTS_CREATE_LIST :: 1
LISTS_UPDATE_LIST :: 2
LISTS_CREATE_ITEM :: 3
+5
View File
@@ -40,6 +40,8 @@ ListsUiRow :: struct {
owner: bool
// The account that owns the list, so a friend who owns it is never offered an invitation.
owner_id: string
owner_alias: string
read_only: bool
revision: s64
incomplete: bool
// Names, comma separated: who shared a list this account does not own,
@@ -57,6 +59,8 @@ ListsUiPerson :: struct {
list_id: string
title: string
status: string
target_alias: string
access: string
}
ListsUiRequest :: struct {
@@ -68,6 +72,7 @@ ListsUiRequest :: struct {
value: string
next_id: string
target: string
access: string
invitation: string
list_id: string
item_id: string
+12 -7
View File
@@ -1,3 +1,4 @@
#import "vec"
#import, file "../cells/module_host.zi";
#import, file "../cells/lists_types.zi";
#import, file "../cells/lists_visibility.zi";
@@ -265,10 +266,10 @@ lists_friends: [8192]u8;
lists_sharing_source: string;
// The invitations to lists, as indexes into the shared cache's invitations:
// other apps' invitations, such as to a Chess game, are left out.
lists_invitation_rows: [64]s32;
lists_invitation_rows: Vec(s32);
lists_invitation_count: s32;
lists_person_codec: WidgetListsUiPersonCodec;
lists_person_text: [7][512]u8;
lists_person_text: [9][512]u8;
lists_pending_number: [24]u8;
lists_prepared_body: string;
lists_request_codec: WidgetListsUiRequestCodec;
@@ -323,6 +324,8 @@ ListsUiCall :: (context: *void, module: *u8, function: *u8,
row.shared = source.shared
row.owner = source.owner
row.owner_id = AppTextFromCString(*source.owner_id[0], 65)
row.owner_alias = AppTextFromCString(*source.owner_alias[0], 128)
row.read_only = source.read_only
row.people = AppTextFromCString(*source.people[0], 256)
row.invited = AppTextFromCString(*source.invited[0], 256)
row.revision = source.revision
@@ -352,8 +355,8 @@ ListsUiCall :: (context: *void, module: *u8, function: *u8,
row: ListsUiPerson
if index >= 0 && index < ArrayCount(source, array) {
object := ElementAt(source, array, index)
fields: [7]string = .[ifx invitation then "id" else "user_id_hash", "alias", "owner", "target", "list_id", "title", "status"]
for field: cast(s32)0..6 {
fields: [9]string = .[ifx invitation then "id" else "user_id_hash", "alias", "owner", "target", "list_id", "title", "status", "target_alias", "access"]
for field: cast(s32)0..8 {
ListsCopyJson(source, object, fields[field], lists_person_text[field][:])
}
row.id = AppTextFromCString(*lists_person_text[0][0], 512)
@@ -363,6 +366,8 @@ ListsUiCall :: (context: *void, module: *u8, function: *u8,
row.list_id = AppTextFromCString(*lists_person_text[4][0], 512)
row.title = AppTextFromCString(*lists_person_text[5][0], 512)
row.status = AppTextFromCString(*lists_person_text[6][0], 512)
row.target_alias = AppTextFromCString(*lists_person_text[7][0], 512)
row.access = AppTextFromCString(*lists_person_text[8][0], 512)
}
result.* = WidgetEncodeListsUiPerson(row, *lists_person_codec)
return 1
@@ -391,15 +396,15 @@ draw_elist_screen :: (app: *InnerBreeze) {
invitations := FieldAt(lists_sharing_source, 0, "invitations")
incoming: s32 = 0
lists_invitation_count = 0
VecClear(lists_invitation_rows)
for index: cast(s32)0..ArrayCount(lists_sharing_source, invitations) - 1 {
row := ElementAt(lists_sharing_source, invitations, index)
list_id: [64]u8
ListsCopyJson(lists_sharing_source, row, "list_id", list_id[:])
if !SharedIdLooksLikeList(AppTextFromCString(*list_id[0], 64)) ||
lists_invitation_count >= cast(s32)lists_invitation_rows.count {
if !SharedIdLooksLikeList(AppTextFromCString(*list_id[0], 64)) {
continue
}
lists_invitation_rows[lists_invitation_count] = index
unused VecPush(lists_invitation_rows, index)
lists_invitation_count += 1
target := ReadString(lists_sharing_source, FieldAt(lists_sharing_source, row, "target"))
status := ReadString(lists_sharing_source, FieldAt(lists_sharing_source, row, "status"))
+2
View File
@@ -13,6 +13,8 @@ EListList :: struct {
shared: bool
owner: bool
owner_id: [65]u8
owner_alias: [128]u8
read_only: bool
revision: s64
item_total: s32
incomplete: bool
+6 -1
View File
@@ -155,9 +155,14 @@ ListsMergeShared :: (state: *EListState) {
ListsCopyJson(json, row, "id", list.id[:])
ListsCopyJson(json, row, "title", list.title[:])
list.shared = true
access: [16]u8
ListsCopyJson(json, row, "access", access[:])
list.read_only = AppTextFromCString(*access[0], 16) == "viewer"
ListsCopyJson(json, row, "alias", list.owner_alias[:])
owner: [65]u8
ListsCopyJson(json, row, "owner", owner[:])
list.owner = AppTextFromCString(*owner[0], 65) == storage_get_setting_text("sync_public_id")
list.owner = AppTextFromCString(*owner[0], 65) == storage_get_setting_text("sync_public_id") ||
AppTextFromCString(*access[0], 16) == "owner"
unused AppCopyText(AppTextFromCString(*owner[0], 65), list.owner_id[:])
if list.owner {
ListsSharedPeople(json, AppTextFromCString(*list.id[0], 37), list.people[:], list.invited[:])
+37
View File
@@ -317,6 +317,43 @@ Check :: () -> s32 {
check_int("shared undo keeps existing tasks", ArrayCount(complete, FieldAt(complete, FieldAt(complete, 0, "list"), "items")), 301)
check_true("shared undo preserves identity, comment and completion", ContainsFoldASCII(complete, "deleted-task") && ContainsFoldASCII(complete, "Restored comment") && ContainsFoldASCII(complete, "\"done\":1"))
PackageFree(complete)
// Cached roles govern all outgoing edits, including stale editor input.
app.elist.lists[selected].read_only = true
request.action = LISTS_COMMIT
check_true("a viewer cannot submit task changes", ListsPrepareCommand(*app.elist, request).count == 0)
request.action = LISTS_INVITE
check_true("a viewer cannot invite", ListsPrepareCommand(*app.elist, request).count == 0)
request.action = LISTS_SET_ACCESS
request.target = sender
request.access = "owner"
check_true("an editor cannot grant ownership", ListsPrepareCommand(*app.elist, request).count == 0)
app.elist.lists[selected].read_only = false
app.elist.lists[selected].owner = true
complete = ListsPrepareCommand(*app.elist, request)
check_true("an owner can grant full ownership", ContainsFoldASCII(complete, "\"access\":\"owner\""))
check_true("permission changes never replace the list's tasks", FieldAt(complete, FieldAt(complete, 0, "list"), "items") < 0)
PackageFree(complete)
request.action = LISTS_REMOVE_ACCESS
complete = ListsPrepareCommand(*app.elist, request)
check_true("an owner can remove access", ContainsFoldASCII(complete, "\"action\":\"remove\""))
PackageFree(complete)
check_true("viewer snapshot saved", ListsCacheWrite("lists.shared",
"{\"lists\":[{\"id\":\"5ad0e7f2-3b1c-4d6e-9f80-a1b2c3d4e5f6\",\"owner\":\"another-account\",\"alias\":\"Alice\",\"title\":\"Read me\",\"access\":\"viewer\",\"items\":[]}],\"invitations\":[]}") != 0)
check_int("viewer snapshot loads", storage_elist_load(cast(*void)*app.elist), 1)
for index: cast(s32)0..app.elist.list_count - 1 {
if app.elist.lists[index].shared {
check_true("viewer role disables writes", app.elist.lists[index].read_only && !app.elist.lists[index].owner)
check_true("the original owner's name is retained", TextUntilNul(app.elist.lists[index].owner_alias[:]) == "Alice")
}
}
check_true("coowner snapshot saved", ListsCacheWrite("lists.shared",
"{\"lists\":[{\"id\":\"5ad0e7f2-3b1c-4d6e-9f80-a1b2c3d4e5f6\",\"owner\":\"another-account\",\"title\":\"Manage me\",\"access\":\"owner\",\"items\":[]}],\"invitations\":[]}") != 0)
check_int("coowner snapshot loads", storage_elist_load(cast(*void)*app.elist), 1)
for index: cast(s32)0..app.elist.list_count - 1 {
if app.elist.lists[index].shared {
check_true("coowner receives full local controls", app.elist.lists[index].owner && !app.elist.lists[index].read_only)
}
}
private_id: [37]u8
task_id: [37]u8
check_int("undo list fixture", storage_elist_create_list("Undo fixture", *private_id[0]), 1)
+70 -15
View File
@@ -206,7 +206,14 @@ with contextlib.ExitStack() as stack:
driver.wait_idle(frames=3)
calm("a failed refresh shows a notice")
driver.press(label="Share", role="button")
wait_for(lambda: "Alice" in dialog(), lambda: f"Alice is not offered: {dialog()}")
driver.wait(label="People with access")
assert "Refresh" not in dialog() and "Alice" not in dialog(), dialog()
driver.press(key=6540)
driver.type("ali")
driver.wait(label="Alice")
assert not sql("SELECT json FROM social_snapshots WHERE kind LIKE 'lists.attempt/%'"), "typing sent an invitation"
driver.press(label="Alice")
driver.wait(key=6540, value="Alice")
subprocess.run(["import", "-window", find_window(), str(TEST_DIR / "share-dialog.png")], check=True)
driver.press(label="Invite", role="button")
# The first failed delivery is retried quietly; nothing alarming is shown.
@@ -225,16 +232,16 @@ with contextlib.ExitStack() as stack:
# A list this account shared with Alice, who joined, and Cedar, still
# invited; and one Alice shared with this account.
owned = {"id": OWNED_LIST, "owner": "b" * 64, "alias": "me", "title": "Garden",
"revision": 1, "deleted": 0, "items": []}
"revision": 1, "deleted": 0, "access": "owner", "items": []}
given = {"id": GIVEN_LIST, "owner": "a" * 64, "alias": "Alice", "title": "Groceries",
"revision": 1, "deleted": 0, "items": []}
"revision": 1, "deleted": 0, "access": "viewer", "items": []}
incoming = {"lists": [owned, given], "invitations": [
{"id": "invitation-fixture", "list_id": SHARED_LIST, "title": "Weekend trip", "owner": "a" * 64,
"target": "b" * 64, "alias": "Alice", "status": "pending"},
{"id": "invitation-alice", "list_id": OWNED_LIST, "title": "Garden", "owner": "b" * 64,
"alias": "me", "target": "a" * 64, "target_alias": "Alice", "status": "accepted"},
"alias": "me", "target": "a" * 64, "target_alias": "Alice", "status": "accepted", "access": "owner"},
{"id": "invitation-cedar", "list_id": OWNED_LIST, "title": "Garden", "owner": "b" * 64,
"alias": "me", "target": "c" * 64, "target_alias": "Cedar", "status": "pending"}]}
"alias": "me", "target": "c" * 64, "target_alias": "Cedar", "status": "pending", "access": "viewer"}]}
db.execute("INSERT OR REPLACE INTO social_snapshots VALUES(?,?,?,1)",
(user, "lists.shared/" + "b" * 64 + "/http://127.0.0.1:10", json.dumps(incoming)))
driver.wait(label="Invitations (1)", role="button")
@@ -259,21 +266,69 @@ with contextlib.ExitStack() as stack:
subprocess.run(["import", "-window", find_window(), str(TEST_DIR / "share-owned.png")], check=True)
wait_for(lambda: "Cedar" in dialog(), lambda: f"friends are not listed: {dialog()}")
names = dialog()
assert all(name in names for name in ("Alice", "Cedar", "Dana", "Emerald")), f"friend names missing: {names}"
assert "Accepted" in names and "Invited" in names, f"who has access is not shown: {names}"
# A list someone else owns never offers its owner an invitation.
assert all(name in names for name in ("Alice", "Cedar", "You")), names
assert "Dana" not in names and "Emerald" not in names, names
assert "Owner" in names and "Invited" in names and "Read only" in names, names
assert "Refresh" not in names, names
# The same open dialog remains readable on a phone-sized viewport.
subprocess.run(["xdotool", "windowsize", find_window(), "390", "844"], check=True)
wait_for(lambda: driver.wait(role="modal")["width"] <= 390,
"the sharing dialog did not fit the phone viewport")
driver.wait_idle(frames=3)
phone_roles = driver.find(role="dropdown", visible=True)
assert len(phone_roles) == 2, "collaborator controls do not fit the phone dialog"
cedar = driver.wait(label="Cedar")
cedar_role = driver.wait(label="Read only", role="dropdown")
assert cedar_role["y"] >= cedar["y"] + cedar["height"], "phone name overlaps access controls"
subprocess.run(["import", "-window", find_window(), str(TEST_DIR / "share-owned-phone.png")], check=True)
subprocess.run(["xdotool", "windowsize", find_window(), "900", "720"], check=True)
driver.wait_idle(frames=3)
# A collaborator outside the friend cache is still shown by name.
with writable() as db, db:
db.execute("INSERT OR REPLACE INTO social_snapshots VALUES(?,?,?,1)",
(user, "friends.list", json.dumps({"friends": [
{"user_id_hash": "d" * 64, "alias": "Dana"}, {"user_id_hash": "e" * 64, "alias": "Emerald"}]})))
driver.wait_idle(frames=3)
assert "Alice" in dialog() and "Cedar" in dialog(), dialog()
driver.press(key=6540)
driver.type("da")
driver.wait(label="Dana")
assert not driver.find(label="Emerald", visible=True), "suggestions did not filter by typed name"
driver.press(label="Dana")
driver.wait(key=6540, value="Dana")
# Viewers can inspect all access but cannot edit, invite or manage roles.
close_beside()
driver.press(contains="Groceries", role="tab")
driver.press(label="Share", role="button")
wait_for(lambda: "Cedar" in dialog(), lambda: f"friends are not listed: {dialog()}")
assert "Alice" not in dialog(), f"the owner is offered an invitation: {dialog()}"
driver.wait(label="People with access")
assert "Alice" in dialog() and "Owner" in dialog(), dialog()
assert not driver.find(key=6540, visible=True), "viewer can invite"
assert not driver.find(role="dropdown", visible=True), "viewer can manage permissions"
close_beside()
assert not driver.wait(key=6507)["enabled"], "viewer can add tasks"
assert not driver.wait(key=6503)["enabled"], "viewer can rename a list"
# Owners change a collaborator's role without sending its document again.
driver.press(contains="Garden", role="tab")
driver.press(label="Share", role="button")
wait_for(lambda: "Cedar" in dialog(), lambda: f"friends are not listed: {dialog()}")
driver.wait_idle(frames=3)
subprocess.run(["import", "-window", find_window(), str(TEST_DIR / "share-owned.png")], check=True)
driver.wait(label="Cedar")
driver.press(label="Read only")
driver.wait(label="Can edit", role="option")
driver.wait(label="Owner", role="option")
driver.wait(label="Remove access", role="option")
driver.press(label="Can edit", role="option")
wait_for(lambda: sql("SELECT json FROM social_snapshots WHERE kind LIKE 'lists.attempt/%/http://127.0.0.1:10'"),
"the permission change was not stored")
permission = json.loads(sql("SELECT json FROM social_snapshots WHERE kind LIKE 'lists.attempt/%/http://127.0.0.1:10'"))
assert permission["action"] == "access" and permission["access"] == "editor" and permission["target"] == "c" * 64, permission
assert permission["list"] == {"id": OWNED_LIST}, permission
close_beside()
# Move the receipt out of this fixture's scope before testing the inbox.
with writable() as db, db:
db.execute("DELETE FROM social_snapshots WHERE kind LIKE 'lists.attempt/%/http://127.0.0.1:10'")
db.execute("UPDATE settings SET value='http://127.0.0.1:11' WHERE key='sync_server_url'")
db.execute("INSERT OR REPLACE INTO social_snapshots VALUES(?,?,?,1)",
(user, "lists.shared/" + "b" * 64 + "/http://127.0.0.1:11", json.dumps(incoming)))
driver.wait(label="Groceries", role="tab")
driver.press(contains="Groceries", role="tab")
assert not any("Shared by" in label for label in driver.labels()), driver.labels()
window = find_window()
@@ -290,9 +345,9 @@ with contextlib.ExitStack() as stack:
subprocess.run(["import", "-window", window, str(TEST_DIR / "invitations.png")], check=True)
calm("a failed refresh shows a notice")
driver.press(label="Accept", role="button")
wait_for(lambda: sql("SELECT json FROM social_snapshots WHERE kind LIKE 'lists.attempt/%/http://127.0.0.1:10'"),
wait_for(lambda: sql("SELECT json FROM social_snapshots WHERE kind LIKE 'lists.attempt/%/http://127.0.0.1:11'"),
"the acceptance was not stored for delivery")
command = json.loads(sql("SELECT json FROM social_snapshots WHERE kind LIKE 'lists.attempt/%/http://127.0.0.1:10'"))
command = json.loads(sql("SELECT json FROM social_snapshots WHERE kind LIKE 'lists.attempt/%/http://127.0.0.1:11'"))
assert command["action"] == "accept" and command["invitation_id"] == "invitation-fixture", command
assert sql(f"SELECT COUNT(*) FROM elist_lists WHERE id='{SHARED_LIST}'") == 0
print(f"PASS item deletion and identity-preserving undo, list tabs, private task destination, friend invitation, inbox acceptance and durable delivery ({TEST_DIR})")
+4
View File
@@ -75,3 +75,7 @@ chess_you_lost
chess_you_resigned
chess_you_won
chess_your_move
elist_refresh
elist_share_detail
elist_no_friends
elist_accepted