v0.2.0: bubble for Android 0.2.0 — chat search, swipe for unread, faster chat opening

Desktop:
- Search lists chats whose own name matches first, so a named group
  isn't pushed out of the top 8 by chats that merely include a member.

Android (Rabbit R1) app, 0.2.0:
- Pull the chat list past its top for a search box (name, person,
  number, then group members; archived chats too; Back clears it).
- Swipe right to left marks a chat unread / read over a magenta band;
  left to right still archives (SwipeActions replaces SwipeArchive).
- Google Voice chats don't offer voice notes in the paperclip bubble.
- Chats open with their newest 60 messages, then the full history;
  marking read (and the Google Voice network call) waits until they're
  on screen. Cached pictures show at once, and one slow download no
  longer blocks the other images. Fixed a contacts reload race.
- Sandbox data gains filler chats, a named group and a 4,000-message chat.

Also: the Android app, Google Voice support, media, export, emoji and
the other work since the first commit, and a CLAUDE.md carrying the
privacy rule.
This commit is contained in:
2026-11-06 02:19:56 -08:00
parent a2b8f764db
commit 8c84feaa91
114 changed files with 12987 additions and 379 deletions
+91
View File
@@ -0,0 +1,91 @@
#!/usr/bin/env python3
"""Add a contact to an Evolution Data Server address book (which syncs it on,
e.g. to Nextcloud via CardDAV).
eds-add-contact.py books -> JSON {"books": [...], "default": uid or null}
eds-add-contact.py add -> reads JSON {first, last, org, number, book?}
on stdin, prints JSON {"uid": ...}
The default book is the one GNOME Contacts uses for new contacts (folks'
primary store), else EDS's own default address book.
"""
import json
import sys
import gi
gi.require_version("EDataServer", "1.2")
gi.require_version("EBookContacts", "1.2")
gi.require_version("EBook", "1.2")
from gi.repository import EBook, EBookContacts, EDataServer as EDS, Gio # noqa: E402
# Server-generated or automatic books nobody adds contacts to by hand.
SKIP_NAMES = {"accounts", "recently contacted", "recent"}
def esc(v):
return v.replace("\\", "\\\\").replace(";", "\\;").replace(",", "\\,").replace("\n", "\\n")
def default_uid(reg):
try:
if "org.freedesktop.folks" in Gio.Settings.list_schemas():
store = Gio.Settings.new("org.freedesktop.folks").get_string("primary-store")
if store.startswith("eds:"):
return store[4:]
except Exception:
pass
src = reg.ref_default_address_book()
return src.get_uid() if src else None
def books(reg):
out = []
for s in reg.list_enabled(EDS.SOURCE_EXTENSION_ADDRESS_BOOK):
if s.get_display_name().lower() in SKIP_NAMES:
continue
ext = s.get_extension(EDS.SOURCE_EXTENSION_ADDRESS_BOOK)
if ext.get_backend_name() == "ldap":
continue
parent = reg.ref_source(s.get_parent()) if s.get_parent() else None
out.append({
"uid": s.get_uid(),
"name": s.get_display_name(),
"account": parent.get_display_name() if parent else "",
})
return out
def add(reg, req):
uid = req.get("book") or default_uid(reg)
source = reg.ref_source(uid) if uid else None
if source is None:
raise SystemExit("No address book to add the contact to.")
client = EBook.BookClient.connect_sync(source, 30, None)
if client.is_readonly():
raise SystemExit(f"The address book \"{source.get_display_name()}\" is read-only.")
first, last, org = (req.get(k, "").strip() for k in ("first", "last", "org"))
full = " ".join(p for p in (first, last) if p) or org or req["number"]
lines = ["BEGIN:VCARD", "VERSION:3.0", f"N:{esc(last)};{esc(first)};;;", f"FN:{esc(full)}"]
if org:
lines.append(f"ORG:{esc(org)}")
lines += [f"TEL;TYPE=CELL:{req['number']}", "END:VCARD"]
contact = EBookContacts.Contact.new_from_vcard("\r\n".join(lines))
ok, new_uid = client.add_contact_sync(contact, EBookContacts.BookOperationFlags.NONE, None)
json.dump({"uid": new_uid, "book": source.get_display_name()}, sys.stdout)
def main():
reg = EDS.SourceRegistry.new_sync(None)
cmd = sys.argv[1] if len(sys.argv) > 1 else "books"
if cmd == "books":
json.dump({"books": books(reg), "default": default_uid(reg)}, sys.stdout)
elif cmd == "add":
add(reg, json.load(sys.stdin))
else:
raise SystemExit(f"unknown command {cmd}")
main()