v0.9.9: bubble for Android 0.7.9 — Not sent texts get an Edit button; the desktop's alert no longer breaks through Do Not Disturb; the Rabbit catches sends a killed process left behind, tells the desktop about them, and shows failures loudly too
This commit is contained in:
@@ -46,6 +46,7 @@ public final class ChatActivity extends BaseActivity {
|
||||
private ListView list;
|
||||
private TextView titleView, subView, counter, attach, send;
|
||||
private EditText input;
|
||||
private TextView unsentBanner;
|
||||
private LinearLayout header, composerBox, tray, fromRow;
|
||||
// The keyboard is up: the composer shrinks so what's being typed and the
|
||||
// last few messages both fit above it (see setCompact).
|
||||
@@ -106,6 +107,21 @@ public final class ChatActivity extends BaseActivity {
|
||||
list.setAdapter(adapter);
|
||||
root.addView(list, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1));
|
||||
|
||||
// Texts here that didn't go out: never just a quiet line on a bubble.
|
||||
unsentBanner = Ui.bold(Ui.text(this, "", Ui.T_SMALL, 0xFFFFFFFF));
|
||||
unsentBanner.setBackgroundColor(Ui.DANGER);
|
||||
unsentBanner.setPadding(Ui.dp(this, 32), Ui.dp(this, 16), Ui.dp(this, 32), Ui.dp(this, 16));
|
||||
unsentBanner.setVisibility(View.GONE);
|
||||
unsentBanner.setOnClickListener(v -> {
|
||||
for (int i = 0; i < rows.size(); i++)
|
||||
if (rows.get(i) instanceof Store.Msg && "failed".equals(((Store.Msg) rows.get(i)).status)) {
|
||||
list.setSelection(i);
|
||||
failedMenu((Store.Msg) rows.get(i));
|
||||
return;
|
||||
}
|
||||
});
|
||||
root.addView(unsentBanner);
|
||||
|
||||
root.addView(composer());
|
||||
setContentView(root);
|
||||
root.getViewTreeObserver().addOnGlobalLayoutListener(() -> {
|
||||
@@ -246,6 +262,7 @@ public final class ChatActivity extends BaseActivity {
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
Notifier.clear(this, did, contact);
|
||||
Notifier.clearUnsent(this, did, contact);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -310,6 +327,11 @@ public final class ChatActivity extends BaseActivity {
|
||||
View firstView = list.getChildAt(0);
|
||||
Object anchor = !atBottom && firstPos < rows.size() ? rows.get(firstPos) : null;
|
||||
int anchorTop = firstView == null ? 0 : firstView.getTop();
|
||||
int unsent = 0;
|
||||
for (Store.Msg m : msgs) if ("failed".equals(m.status)) unsent++;
|
||||
unsentBanner.setVisibility(unsent > 0 ? View.VISIBLE : View.GONE);
|
||||
unsentBanner.setText("⚠ " + (unsent > 1 ? unsent + " of your texts weren't sent." : "Your text wasn't sent.")
|
||||
+ " Tap to retry, edit or delete.");
|
||||
rows.clear();
|
||||
for (int i = 0; i < msgs.size(); i++) {
|
||||
Store.Msg m = msgs.get(i);
|
||||
@@ -644,7 +666,8 @@ public final class ChatActivity extends BaseActivity {
|
||||
bubble.addView(media);
|
||||
bubble.addView(body);
|
||||
bubble.addView(meta);
|
||||
failed = Ui.text(c, "", Ui.T_TINY, Ui.DANGER);
|
||||
failed = Ui.bold(Ui.text(c, "", Ui.T_SMALL, Ui.DANGER));
|
||||
failed.setPadding(Ui.dp(c, 14), Ui.dp(c, 6), Ui.dp(c, 14), Ui.dp(c, 6));
|
||||
reacts = Ui.text(c, "", Ui.T_SMALL, Ui.TEXT);
|
||||
reacts.setBackground(Ui.round(Ui.BUBBLE_IN, Ui.dp(c, 30)));
|
||||
reacts.setPadding(Ui.dp(c, 14), Ui.dp(c, 4), Ui.dp(c, 14), Ui.dp(c, 4));
|
||||
@@ -680,7 +703,11 @@ public final class ChatActivity extends BaseActivity {
|
||||
setGravity(out ? Gravity.END : Gravity.START);
|
||||
((LayoutParams) bubble.getLayoutParams()).gravity = out ? Gravity.END : Gravity.START;
|
||||
bubble.setBackground(Ui.round(out ? Ui.ACCENT : Ui.BUBBLE_IN, Ui.dp(c, 30)));
|
||||
bubble.setAlpha("failed".equals(msg.status) ? 0.6f : 1f);
|
||||
if ("failed".equals(msg.status)) {
|
||||
android.graphics.drawable.GradientDrawable g = Ui.round(Ui.ACCENT, Ui.dp(c, 30));
|
||||
g.setStroke(Ui.dp(c, 4), Ui.DANGER);
|
||||
bubble.setBackground(g);
|
||||
}
|
||||
bubble.setMinimumWidth(0);
|
||||
// Keep bubbles to ~80% of the width.
|
||||
body.setMaxWidth(Math.round(getResources().getDisplayMetrics().widthPixels * 0.72f));
|
||||
@@ -693,7 +720,8 @@ public final class ChatActivity extends BaseActivity {
|
||||
meta.setTextColor(out ? 0xB3FFFFFF : Ui.MUTED);
|
||||
Ui.glyph(meta, "pending".equals(msg.status) ? Glyph.Kind.CLOCK : null, true);
|
||||
failed.setVisibility("failed".equals(msg.status) ? VISIBLE : GONE);
|
||||
failed.setText("⚠ Not sent" + (msg.error != null ? ": " + msg.error : "") + " · tap to retry");
|
||||
failed.setText("⚠ Not sent. " + (msg.error != null ? msg.error + " " : "") + "Tap to retry, edit or delete.");
|
||||
failed.setGravity(out ? Gravity.END : Gravity.START);
|
||||
List<Reactions.Reaction> rs = reactions.get(msg.id);
|
||||
reacts.setVisibility(rs == null ? GONE : VISIBLE);
|
||||
if (rs != null) {
|
||||
@@ -861,7 +889,33 @@ public final class ChatActivity extends BaseActivity {
|
||||
Store.get(this).deleteMessage(m.id);
|
||||
changed();
|
||||
})
|
||||
.setNeutralButton("Cancel", null)
|
||||
.setNeutralButton("Edit", (d, w) -> editFailed(m))
|
||||
.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Back into the box to change before sending again: its words (and
|
||||
* photos) go into the composer and the failed copy goes. A voice note
|
||||
* can't be edited, so it just goes back to Retry.
|
||||
*/
|
||||
private void editFailed(Store.Msg m) {
|
||||
List<Sender.Photo> back = new ArrayList<>();
|
||||
for (JSONObject ref : m.media()) {
|
||||
String mime = ref.optString("mime");
|
||||
if (!mime.startsWith("image/")) {
|
||||
Toast.makeText(this, "A voice note can't be edited: retry or delete it.", Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
back.add(new Sender.Photo(ref.optString("file"), mime, ref.optInt("width"), ref.optInt("height")));
|
||||
}
|
||||
String cur = input.getText().toString();
|
||||
input.setText(cur.trim().isEmpty() ? m.body : m.body + "\n" + cur);
|
||||
input.setSelection(input.getText().length());
|
||||
for (Sender.Photo p : back) addToTray(p);
|
||||
input.requestFocus();
|
||||
MainActivity.bg.execute(() -> {
|
||||
Store.get(this).deleteMessage(m.id);
|
||||
changed();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -430,11 +430,21 @@ public final class MainActivity extends BaseActivity {
|
||||
String body = reaction != null ? reaction : c.lastBody == null ? "" : c.lastBody.replaceAll("\\s+", " ").trim();
|
||||
if (body.isEmpty() && c.lastMediaJson != null) body = "Photo";
|
||||
String who = "out".equals(c.lastDirection) ? "You: " : group && c.lastSender != null ? Contacts.firstName(ctx, c.lastSender) + ": " : "";
|
||||
preview.setText(who + body);
|
||||
boolean unread = c.unread > 0 || c.markedUnread;
|
||||
preview.setTextColor(unread ? Ui.TEXT : Ui.MUTED);
|
||||
badge.setVisibility(unread ? VISIBLE : GONE);
|
||||
badge.setText(c.unread > 99 ? "99+" : c.unread > 0 ? String.valueOf(c.unread) : "•");
|
||||
if (c.failed > 0) {
|
||||
// A text here didn't go out: red, ahead of everything else.
|
||||
preview.setText("Not sent · " + who + body);
|
||||
preview.setTextColor(Ui.DANGER);
|
||||
badge.setVisibility(VISIBLE);
|
||||
badge.setText("!");
|
||||
badge.setBackground(Ui.round(Ui.DANGER, Ui.dp(ctx, 20)));
|
||||
} else {
|
||||
preview.setText(who + body);
|
||||
preview.setTextColor(unread ? Ui.TEXT : Ui.MUTED);
|
||||
badge.setVisibility(unread ? VISIBLE : GONE);
|
||||
badge.setText(c.unread > 99 ? "99+" : c.unread > 0 ? String.valueOf(c.unread) : "•");
|
||||
badge.setBackground(Ui.round(Ui.ACCENT, Ui.dp(ctx, 20)));
|
||||
}
|
||||
via.setText(Config.get(ctx).dids.size() > 1 ? Ui.via(ctx, c.did) : "");
|
||||
via.setVisibility(Config.get(ctx).dids.size() > 1 ? VISIBLE : GONE);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ final class Notifier {
|
||||
private Notifier() {}
|
||||
|
||||
private static final String CHANNEL = "messages";
|
||||
private static final String UNSENT = "unsent";
|
||||
// Only messages this recent notify (not a big catch-up after being offline).
|
||||
private static final long RECENT = 6 * 60 * 60_000L;
|
||||
|
||||
@@ -65,6 +66,44 @@ final class Notifier {
|
||||
c.getSystemService(NotificationManager.class).cancel((did + contact).hashCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* Your text didn't go out. Its own channel, whatever the notification
|
||||
* setting and even with a screen in front: a send that fails quietly is
|
||||
* the worst thing a phone can do. Do Not Disturb still applies.
|
||||
*/
|
||||
static void notifyUnsent(Context c, List<Store.Msg> msgs) {
|
||||
NotificationManager nm = c.getSystemService(NotificationManager.class);
|
||||
nm.createNotificationChannel(new NotificationChannel(UNSENT, "Texts that didn't send", NotificationManager.IMPORTANCE_HIGH));
|
||||
Map<String, List<Store.Msg>> byConv = new LinkedHashMap<>();
|
||||
for (Store.Msg m : msgs) byConv.computeIfAbsent(m.did + "\n" + m.contact, k -> new ArrayList<>()).add(m);
|
||||
Store store = Store.get(c);
|
||||
for (List<Store.Msg> list : byConv.values()) {
|
||||
Store.Msg first = list.get(0);
|
||||
String who = Contacts.title(c, first.contact, store.getName(first.did, first.contact));
|
||||
String title = list.size() > 1 ? list.size() + " texts to " + who + " weren't sent" : "Text to " + who + " wasn't sent";
|
||||
String preview = first.body.trim().isEmpty() ? "Your message" : "“" + first.body.trim() + "”";
|
||||
String body = list.size() > 1 ? "Open the chat to retry, edit or delete them."
|
||||
: preview + " · " + (first.error != null ? first.error : "Open the chat to retry it.");
|
||||
int id = ("unsent" + first.did + first.contact).hashCode();
|
||||
PendingIntent pi = PendingIntent.getActivity(c, id, ChatActivity.intent(c, first.did, first.contact),
|
||||
PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
nm.notify(id, new Notification.Builder(c, UNSENT)
|
||||
.setSmallIcon(R.drawable.ic_launcher)
|
||||
.setContentTitle(title)
|
||||
.setContentText(body)
|
||||
.setStyle(new Notification.BigTextStyle().bigText(body))
|
||||
.setShowWhen(true)
|
||||
.setAutoCancel(true)
|
||||
.setContentIntent(pi)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
/** The chat's open, and its banner says the same. */
|
||||
static void clearUnsent(Context c, String did, String contact) {
|
||||
c.getSystemService(NotificationManager.class).cancel(("unsent" + did + contact).hashCode());
|
||||
}
|
||||
|
||||
private static Bundle conversation(String did, String contact) {
|
||||
Bundle b = new Bundle();
|
||||
b.putString("did", did);
|
||||
|
||||
@@ -346,6 +346,7 @@ final class Relay {
|
||||
}
|
||||
|
||||
private static void result(Context c, String id, long msgId, String error) {
|
||||
inflight(c, id, 0);
|
||||
try {
|
||||
JSONObject o = new JSONObject().put("t", "sent").put("id", id);
|
||||
o.put("msgId", msgId != 0 ? msgId : JSONObject.NULL);
|
||||
@@ -394,6 +395,44 @@ final class Relay {
|
||||
result(c, id, 0, "It was empty.");
|
||||
return;
|
||||
}
|
||||
Sender.send(c, Sim.DID, contact, text, photos, (msgId, error) -> result(c, id, msgId, error));
|
||||
long temp = Sender.send(c, Sim.DID, contact, text, photos, (msgId, error) -> result(c, id, msgId, error));
|
||||
// Until its result is posted: if this process dies first, the next one
|
||||
// still answers the desktop (orphaned), so it never waits forever.
|
||||
if (temp < 0) inflight(c, id, temp);
|
||||
}
|
||||
|
||||
/** Remember (tempId < 0) or forget (0) the local message a desktop send became. */
|
||||
private static synchronized void inflight(Context c, String id, long tempId) {
|
||||
SharedPreferences p = prefs(c);
|
||||
Set<String> s = new HashSet<>(p.getStringSet("inflight", new HashSet<>()));
|
||||
s.removeIf(e -> e.startsWith(id + "\t"));
|
||||
if (tempId < 0) s.add(id + "\t" + tempId);
|
||||
p.edit().putStringSet("inflight", s).commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends an earlier process left unfinished: those the desktop asked for are
|
||||
* reported back to it as failed (it alerts there). Returns the others.
|
||||
*/
|
||||
static List<Store.Msg> orphaned(Context c, List<Store.Msg> orphans) {
|
||||
Map<Long, String> byTemp = new HashMap<>();
|
||||
synchronized (Relay.class) {
|
||||
for (String e : prefs(c).getStringSet("inflight", new HashSet<>())) {
|
||||
int tab = e.indexOf('\t');
|
||||
try {
|
||||
byTemp.put(Long.parseLong(e.substring(tab + 1)), e.substring(0, tab));
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
// Whatever isn't an orphan finished (or will be answered by this process).
|
||||
prefs(c).edit().remove("inflight").commit();
|
||||
}
|
||||
List<Store.Msg> mine = new ArrayList<>();
|
||||
for (Store.Msg m : orphans) {
|
||||
String id = byTemp.get(m.id);
|
||||
if (id == null) mine.add(m);
|
||||
else result(c, id, 0, m.error);
|
||||
}
|
||||
return mine;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,12 @@ final class Sender {
|
||||
send(ctx, did, contact, text, photos, null);
|
||||
}
|
||||
|
||||
static void send(Context ctx, String did, String contact, String text, List<Photo> photos, Done done) {
|
||||
/**
|
||||
* Returns the local id of the (first) pending message. With `done` (the
|
||||
* desktop's sends over the relay) the outcome goes back to whoever asked,
|
||||
* who alerts on failure; without, a failure notifies here.
|
||||
*/
|
||||
static long send(Context ctx, String did, String contact, String text, List<Photo> photos, Done done) {
|
||||
Context c = ctx.getApplicationContext();
|
||||
Config cfg = Config.get(c);
|
||||
if (cfg.sandbox) {
|
||||
@@ -81,12 +86,13 @@ final class Sender {
|
||||
store.confirmPending(id, real);
|
||||
Sync.changed();
|
||||
if (done != null) done.done(real, null);
|
||||
return;
|
||||
return real;
|
||||
}
|
||||
if (cfg.isGv(did)) {
|
||||
if (photos.isEmpty()) {
|
||||
enqueue(c, pending(did, contact, text, null), () -> gvSend(c, did, contact, text, null), true, done);
|
||||
return enqueue(c, pending(did, contact, text, null), () -> gvSend(c, did, contact, text, null), true, done);
|
||||
} else {
|
||||
long first = 0;
|
||||
// Google Voice carries one photo per message: the text rides with the first.
|
||||
for (int i = 0; i < photos.size(); i++) {
|
||||
String body = i == 0 ? text : "";
|
||||
@@ -95,26 +101,27 @@ final class Sender {
|
||||
one.add(p);
|
||||
Store.Msg m = pending(did, contact, body, one);
|
||||
m.ts += i;
|
||||
enqueue(c, m, () -> gvSend(c, did, contact, body, p), true, i == 0 ? done : null);
|
||||
long id = enqueue(c, m, () -> gvSend(c, did, contact, body, p), true, i == 0 ? done : null);
|
||||
if (i == 0) first = id;
|
||||
}
|
||||
return first;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (Sim.isSim(did)) {
|
||||
// A long text goes as several SMS parts; photos, voice notes and groups as one MMS.
|
||||
boolean mms = !photos.isEmpty() || Phone.isGroup(contact);
|
||||
Store.Msg m = pending(did, contact, text, photos);
|
||||
if (mms) m.kind = "mms";
|
||||
enqueue(c, m, () -> mms ? Sim.sendMms(c, contact, text, photos) : Sim.sendSms(c, contact, text), false, (id, err) -> {
|
||||
Done told = (id, err) -> {
|
||||
if (done != null) done.done(id, err);
|
||||
Relay.soon(c); // the desktop hears about it on the next round
|
||||
});
|
||||
return;
|
||||
};
|
||||
return enqueue(c, m, () -> mms ? Sim.sendMms(c, contact, text, photos) : Sim.sendSms(c, contact, text), false, told, done == null);
|
||||
}
|
||||
boolean mms = !photos.isEmpty() || Phone.charCount(text) > Phone.SMS_TEXT_LIMIT;
|
||||
Store.Msg m = pending(did, contact, text, photos);
|
||||
if (mms) m.kind = "mms";
|
||||
enqueue(c, m, () -> {
|
||||
return enqueue(c, m, () -> {
|
||||
VoipMs api = new VoipMs(cfg.voipUser, cfg.voipPass);
|
||||
if (!mms) return api.sendSms(did, contact, text);
|
||||
List<String> media = new ArrayList<>();
|
||||
@@ -140,7 +147,11 @@ final class Sender {
|
||||
return m;
|
||||
}
|
||||
|
||||
private static void enqueue(Context c, Store.Msg m, Attempt attempt, boolean gv, Done done) {
|
||||
private static long enqueue(Context c, Store.Msg m, Attempt attempt, boolean gv, Done done) {
|
||||
return enqueue(c, m, attempt, gv, done, done == null);
|
||||
}
|
||||
|
||||
private static long enqueue(Context c, Store.Msg m, Attempt attempt, boolean gv, Done done, boolean alert) {
|
||||
Store store = Store.get(c);
|
||||
long tempId = store.insertPending(m);
|
||||
Sync.changed();
|
||||
@@ -149,7 +160,28 @@ final class Sender {
|
||||
String error = deliver(c, store, tempId, attempt, gv, id);
|
||||
Sync.changed();
|
||||
if (done != null) done.done(id[0], error);
|
||||
Store.Msg after = store.getMessage(tempId);
|
||||
if (alert && after != null && "failed".equals(after.status)) {
|
||||
List<Store.Msg> one = new ArrayList<>();
|
||||
one.add(after);
|
||||
Notifier.notifyUnsent(c, one);
|
||||
}
|
||||
});
|
||||
return tempId;
|
||||
}
|
||||
|
||||
/**
|
||||
* At startup, the sends an earlier process left unfinished (already marked
|
||||
* failed): the desktop's go back to it as failed, the rest notify here.
|
||||
*/
|
||||
static void recover(Context c, List<Store.Msg> orphans) {
|
||||
if (orphans.isEmpty()) return;
|
||||
// Now, before this process's own sends add to the relay's in-flight list.
|
||||
List<Store.Msg> mine = Relay.orphaned(c, orphans);
|
||||
new Thread(() -> {
|
||||
if (!mine.isEmpty()) Notifier.notifyUnsent(c, mine);
|
||||
Sync.changed();
|
||||
}, "recover-sends").start();
|
||||
}
|
||||
|
||||
/** Null when it went out (its id in id[0]), else why not. */
|
||||
|
||||
@@ -29,7 +29,11 @@ final class Store {
|
||||
private static final long MATCH_AFTER = 15 * 60_000L;
|
||||
|
||||
static synchronized Store get(Context c) {
|
||||
if (instance == null) instance = new Store(c.getApplicationContext());
|
||||
if (instance == null) {
|
||||
instance = new Store(c.getApplicationContext());
|
||||
// A new process: any send still 'pending' belonged to one that died.
|
||||
Sender.recover(c.getApplicationContext(), instance.failOrphanedSends());
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
@@ -222,6 +226,32 @@ final class Store {
|
||||
db.execSQL("UPDATE messages SET status = 'failed', error = ? WHERE id = ?", new Object[] {error, tempId});
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends left 'pending' by an earlier process (Android killed it, or it
|
||||
* crashed, mid-send): their send loop died with it, so nothing will ever
|
||||
* finish them. They become failed, shown as Not sent with Retry, never
|
||||
* resent on their own (by now they may be stale). If one did go out, the
|
||||
* next check still replaces it (reconcileSent matches failed rows too).
|
||||
*/
|
||||
List<Msg> failOrphanedSends() {
|
||||
List<Long> ids = new ArrayList<>();
|
||||
try (Cursor c = db.rawQuery("SELECT id FROM messages WHERE id < 0 AND status = 'pending' AND direction = 'out'", null)) {
|
||||
while (c.moveToNext()) ids.add(c.getLong(0));
|
||||
}
|
||||
List<Msg> out = new ArrayList<>();
|
||||
for (long id : ids) {
|
||||
Msg m = getMessage(id);
|
||||
if (m == null) continue;
|
||||
// A SIM text may already be with the radio, which sends it whether or not we're alive.
|
||||
markFailed(id, Sim.isSim(m.did) ? ORPHAN_SIM : ORPHAN);
|
||||
out.add(getMessage(id));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
static final String ORPHAN = "bubble stopped before this finished sending, so it most likely didn't go out.";
|
||||
static final String ORPHAN_SIM = "bubble stopped before the SIM said whether this went out. Check before retrying.";
|
||||
|
||||
/** Sent messages that turned up in a poll replace our pending/failed copies. */
|
||||
void reconcileSent(List<Msg> added) {
|
||||
List<Msg> sorted = new ArrayList<>(added);
|
||||
@@ -308,6 +338,7 @@ final class Store {
|
||||
String did, contact, lastBody, lastDirection, lastSender, lastMediaJson, name;
|
||||
long lastTs;
|
||||
int unread;
|
||||
int failed; // your texts here that didn't send
|
||||
boolean archived, markedUnread;
|
||||
}
|
||||
|
||||
@@ -319,7 +350,8 @@ final class Store {
|
||||
+ " SELECT l.did, l.contact, l.mts, last.body, last.direction, last.sender, last.media_json,"
|
||||
+ " (SELECT COUNT(*) FROM messages m WHERE m.did = l.did AND m.contact = l.contact AND m.direction = 'in'"
|
||||
+ " AND m.ts > MAX(COALESCE(r.last_read_ts, 0), CAST(? AS INTEGER))),"
|
||||
+ " r.archived_at IS NOT NULL, COALESCE(r.marked_unread, 0), r.name"
|
||||
+ " r.archived_at IS NOT NULL, COALESCE(r.marked_unread, 0), r.name,"
|
||||
+ " (SELECT COUNT(*) FROM messages m WHERE m.did = l.did AND m.contact = l.contact AND m.id < 0 AND m.status = 'failed')"
|
||||
+ " FROM latest l JOIN messages last ON last.id ="
|
||||
+ " (SELECT id FROM messages m WHERE m.did = l.did AND m.contact = l.contact ORDER BY ts DESC, id DESC LIMIT 1)"
|
||||
+ " LEFT JOIN read_state r ON r.did = l.did AND r.contact = l.contact"
|
||||
@@ -338,6 +370,7 @@ final class Store {
|
||||
v.archived = c.getInt(8) != 0;
|
||||
v.markedUnread = c.getInt(9) != 0;
|
||||
v.name = c.getString(10);
|
||||
v.failed = c.getInt(11);
|
||||
if (archived == null || v.archived == archived) out.add(v);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -26,8 +26,8 @@ import sys
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
|
||||
VERSION_NAME = "0.7.8"
|
||||
VERSION_CODE = 16
|
||||
VERSION_NAME = "0.7.9"
|
||||
VERSION_CODE = 17
|
||||
|
||||
PACKAGE = "me.teafry.voipmessages"
|
||||
DEV_PACKAGE = PACKAGE + ".dev"
|
||||
|
||||
Reference in New Issue
Block a user