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:
@@ -754,6 +754,14 @@ public final class ChatActivity extends BaseActivity {
|
|||||||
ImageView iv = new ImageView(c);
|
ImageView iv = new ImageView(c);
|
||||||
iv.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
iv.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||||
iv.setBackgroundColor(0x22FFFFFF);
|
iv.setBackgroundColor(0x22FFFFFF);
|
||||||
|
// The picture's corners match the bubble's (30 dp).
|
||||||
|
float corner = Ui.dp(c, 30);
|
||||||
|
iv.setOutlineProvider(new android.view.ViewOutlineProvider() {
|
||||||
|
@Override public void getOutline(View v, android.graphics.Outline o) {
|
||||||
|
o.setRoundRect(0, 0, v.getWidth(), v.getHeight(), corner);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
iv.setClipToOutline(true);
|
||||||
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(bw, bh);
|
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(bw, bh);
|
||||||
iv.setLayoutParams(new LinearLayout.LayoutParams(bw, bh));
|
iv.setLayoutParams(new LinearLayout.LayoutParams(bw, bh));
|
||||||
String tag = id + "/" + index;
|
String tag = id + "/" + index;
|
||||||
|
|||||||
@@ -96,6 +96,11 @@ final class Store {
|
|||||||
db.execSQL("UPDATE messages SET body = '' WHERE media_json IS NOT NULL AND lower(trim(body)) = 'mms received'");
|
db.execSQL("UPDATE messages SET body = '' WHERE media_json IS NOT NULL AND lower(trim(body)) = 'mms received'");
|
||||||
set("mms_received_stripped", "1");
|
set("mms_received_stripped", "1");
|
||||||
}
|
}
|
||||||
|
// ...and one we sent with no words "MMS Sent".
|
||||||
|
if (get("mms_sent_stripped") == null) {
|
||||||
|
db.execSQL("UPDATE messages SET body = '' WHERE media_json IS NOT NULL AND lower(trim(body)) = 'mms sent'");
|
||||||
|
set("mms_sent_stripped", "1");
|
||||||
|
}
|
||||||
if (get("unread_floor") == null) set("unread_floor", String.valueOf(System.currentTimeMillis()));
|
if (get("unread_floor") == null) set("unread_floor", String.valueOf(System.currentTimeMillis()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ final class VoipMs {
|
|||||||
for (String u : urls) refs.put(new JSONObject().put("url", u));
|
for (String u : urls) refs.put(new JSONObject().put("url", u));
|
||||||
m.mediaJson = refs.toString();
|
m.mediaJson = refs.toString();
|
||||||
// voip.ms's own stand-in text for a picture with no words, not the sender's.
|
// voip.ms's own stand-in text for a picture with no words, not the sender's.
|
||||||
if (m.body.trim().equalsIgnoreCase("MMS Received")) m.body = "";
|
if (m.body.trim().equalsIgnoreCase("MMS Received") || m.body.trim().equalsIgnoreCase("MMS Sent")) m.body = "";
|
||||||
} else if (Phone.charCount(m.body) > Phone.SMS_TEXT_LIMIT) {
|
} else if (Phone.charCount(m.body) > Phone.SMS_TEXT_LIMIT) {
|
||||||
m.kind = "mms";
|
m.kind = "mms";
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -26,8 +26,8 @@ import sys
|
|||||||
import zipfile
|
import zipfile
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
VERSION_NAME = "0.7.5"
|
VERSION_NAME = "0.7.6"
|
||||||
VERSION_CODE = 13
|
VERSION_CODE = 14
|
||||||
|
|
||||||
PACKAGE = "me.teafry.voipmessages"
|
PACKAGE = "me.teafry.voipmessages"
|
||||||
DEV_PACKAGE = PACKAGE + ".dev"
|
DEV_PACKAGE = PACKAGE + ".dev"
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ import json
|
|||||||
import os
|
import os
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import struct
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import zlib
|
||||||
import time
|
import time
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
@@ -26,6 +28,12 @@ VOIP, GV = "5415550100", "5415550177"
|
|||||||
GROUP = "5415550101,5415550102,5415550103"
|
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):
|
def push(local: Path, name: str):
|
||||||
with open(local, "rb") as f:
|
with open(local, "rb") as f:
|
||||||
subprocess.run(["adb", "shell", f"run-as {PKG} sh -c 'cat > files/{name}'"], stdin=f, check=True)
|
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 + 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))
|
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)
|
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 kv VALUES ('unread_floor', '0')")
|
||||||
con.execute("INSERT INTO gv_threads VALUES (?, ?, 'g.demo')", (GV, GROUP))
|
con.execute("INSERT INTO gv_threads VALUES (?, ?, 'g.demo')", (GV, GROUP))
|
||||||
con.commit()
|
con.commit()
|
||||||
@@ -99,6 +113,8 @@ def main():
|
|||||||
}))
|
}))
|
||||||
push(db, "messages.db")
|
push(db, "messages.db")
|
||||||
push(cfg, "config.json")
|
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)
|
subprocess.run(["adb", "shell", "am", "start", "-n", f"{PKG}/me.teafry.voipmessages.MainActivity"], check=True)
|
||||||
print("sandbox data pushed to", PKG)
|
print("sandbox data pushed to", PKG)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "voipms-desktop",
|
"name": "voipms-desktop",
|
||||||
"productName": "bubble",
|
"productName": "bubble",
|
||||||
"version": "0.9.0",
|
"version": "0.9.1",
|
||||||
"description": "Signal-style desktop SMS client for voip.ms",
|
"description": "Signal-style desktop SMS client for voip.ms",
|
||||||
"author": "trav <trav@teafry.me>",
|
"author": "trav <trav@teafry.me>",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
|||||||
Binary file not shown.
@@ -1 +1 @@
|
|||||||
{"version_name": "0.7.5", "version_code": 13, "package": "me.teafry.voipmessages"}
|
{"version_name": "0.7.6", "version_code": 14, "package": "me.teafry.voipmessages"}
|
||||||
|
|||||||
+4
-1
@@ -6,7 +6,7 @@ import type { Conversation, Direction, MediaRef, Message, MessageKind, MessageSt
|
|||||||
import { SNIPPET_END, SNIPPET_START } from '@shared/types'
|
import { SNIPPET_END, SNIPPET_START } from '@shared/types'
|
||||||
import { fixVoipDst } from './voipms'
|
import { fixVoipDst } from './voipms'
|
||||||
|
|
||||||
const SCHEMA_VERSION = 11
|
const SCHEMA_VERSION = 12
|
||||||
|
|
||||||
export interface ReadState {
|
export interface ReadState {
|
||||||
did: string
|
did: string
|
||||||
@@ -170,6 +170,9 @@ export class MessageDb {
|
|||||||
// Received"; nobody wrote it, so it goes.
|
// Received"; nobody wrote it, so it goes.
|
||||||
if (version >= 1 && version < 11)
|
if (version >= 1 && version < 11)
|
||||||
this.db.exec(`UPDATE messages SET body = '' WHERE media_json IS NOT NULL AND lower(trim(body)) = 'mms received'`)
|
this.db.exec(`UPDATE messages SET body = '' WHERE media_json IS NOT NULL AND lower(trim(body)) = 'mms received'`)
|
||||||
|
// v12: and one we sent with no words "MMS Sent".
|
||||||
|
if (version >= 1 && version < 12)
|
||||||
|
this.db.exec(`UPDATE messages SET body = '' WHERE media_json IS NOT NULL AND lower(trim(body)) = 'mms sent'`)
|
||||||
this.db.pragma(`user_version = ${SCHEMA_VERSION}`)
|
this.db.pragma(`user_version = ${SCHEMA_VERSION}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@ function parseYmd(s: string): number {
|
|||||||
return Date.parse(s + 'T00:00:00Z')
|
return Date.parse(s + 'T00:00:00Z')
|
||||||
}
|
}
|
||||||
|
|
||||||
export const isMmsPlaceholder = (body: string): boolean => body.trim().toLowerCase() === 'mms received'
|
export const isMmsPlaceholder = (body: string): boolean => /^mms (received|sent)$/.test(body.trim().toLowerCase())
|
||||||
|
|
||||||
export function toNewMessage(r: RawSms): NewMessage {
|
export function toNewMessage(r: RawSms): NewMessage {
|
||||||
const m: NewMessage = {
|
const m: NewMessage = {
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ describe('toNewMessage (MMS)', () => {
|
|||||||
expect(toNewMessage({ ...mms, message: 'MMS Received', col_media1: url }).body).toBe('')
|
expect(toNewMessage({ ...mms, message: 'MMS Received', col_media1: url }).body).toBe('')
|
||||||
expect(toNewMessage({ ...mms, message: ' mms received\n', col_media1: url }).body).toBe('')
|
expect(toNewMessage({ ...mms, message: ' mms received\n', col_media1: url }).body).toBe('')
|
||||||
expect(toNewMessage({ ...mms, message: 'MMS Received, thanks', col_media1: url }).body).toBe('MMS Received, thanks')
|
expect(toNewMessage({ ...mms, message: 'MMS Received, thanks', col_media1: url }).body).toBe('MMS Received, thanks')
|
||||||
|
expect(toNewMessage({ ...mms, message: 'MMS Sent', col_media1: url }).body).toBe('')
|
||||||
// Typed by a person, with no picture: kept.
|
// Typed by a person, with no picture: kept.
|
||||||
expect(toNewMessage({ ...mms, message: 'MMS received', col_media1: '' }).body).toBe('MMS received')
|
expect(toNewMessage({ ...mms, message: 'MMS received', col_media1: '' }).body).toBe('MMS received')
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user