v0.9.1: bubble for Android 0.7.6 — pictures have the bubble's round corners; no "MMS Sent"
Android: a picture in a chat is clipped to the bubble's 30 dp corner, sent and received. Checked on the Rabbit with the dev app (the sandbox now has a made-up picture each way). Both: voip.ms gives a picture we sent with no words the text "MMS Sent", like the "MMS Received" already dropped; that goes too, from new messages and (once) from ones already stored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,7 +17,9 @@ import json
|
||||
import os
|
||||
import sqlite3
|
||||
import subprocess
|
||||
import struct
|
||||
import tempfile
|
||||
import zlib
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
@@ -26,6 +28,12 @@ VOIP, GV = "5415550100", "5415550177"
|
||||
GROUP = "5415550101,5415550102,5415550103"
|
||||
|
||||
|
||||
def gradient_png(w: int, h: int) -> bytes:
|
||||
raw = b"".join(b"\0" + bytes(c for x in range(w) for c in (x * 255 // w, y * 255 // h, 160)) for y in range(h))
|
||||
chunk = lambda t, b: struct.pack(">I", len(b)) + t + b + struct.pack(">I", zlib.crc32(t + b))
|
||||
return b"\x89PNG\r\n\x1a\n" + chunk(b"IHDR", struct.pack(">IIBBBBB", w, h, 8, 2, 0, 0, 0)) + chunk(b"IDAT", zlib.compress(raw)) + chunk(b"IEND", b"")
|
||||
|
||||
|
||||
def push(local: Path, name: str):
|
||||
with open(local, "rb") as f:
|
||||
subprocess.run(["adb", "shell", f"run-as {PKG} sh -c 'cat > files/{name}'"], stdin=f, check=True)
|
||||
@@ -84,6 +92,12 @@ def main():
|
||||
rows.append((SIM_BASE + 1, "sim", "5415550150", "in", "Texting your SIM number now", now - 20 * m, None))
|
||||
rows.append((SIM_BASE + 2, "sim", "5415550150", "out", "Got it, this is the SIM", now - 19 * m, None))
|
||||
con.executemany("INSERT INTO messages (id, did, contact, direction, body, ts, sender) VALUES (?,?,?,?,?,?,?)", rows)
|
||||
# Pictures both ways (a made-up gradient), to see their corners.
|
||||
pic = Path(d) / "sandbox-pic.png"
|
||||
pic.write_bytes(gradient_png(400, 300))
|
||||
ref = json.dumps([{"file": "sandbox-pic.png", "mime": "image/png", "width": 400, "height": 300}])
|
||||
con.execute("INSERT INTO messages (id, did, contact, direction, body, ts, kind, media_json) VALUES (1007, ?, '5415550110', 'in', 'Look at this', ?, 'mms', ?)", (VOIP, now - 280 * m, ref))
|
||||
con.execute("INSERT INTO messages (id, did, contact, direction, body, ts, kind, media_json) VALUES (1008, ?, '5415550110', 'out', '', ?, 'mms', ?)", (VOIP, now - 279 * m, ref))
|
||||
con.execute("INSERT INTO kv VALUES ('unread_floor', '0')")
|
||||
con.execute("INSERT INTO gv_threads VALUES (?, ?, 'g.demo')", (GV, GROUP))
|
||||
con.commit()
|
||||
@@ -99,6 +113,8 @@ def main():
|
||||
}))
|
||||
push(db, "messages.db")
|
||||
push(cfg, "config.json")
|
||||
subprocess.run(["adb", "shell", f"run-as {PKG} mkdir -p files/media"], check=True)
|
||||
push(pic, "media/sandbox-pic.png")
|
||||
subprocess.run(["adb", "shell", "am", "start", "-n", f"{PKG}/me.teafry.voipmessages.MainActivity"], check=True)
|
||||
print("sandbox data pushed to", PKG)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user