feat(app): redesigned interface, polls, drafts, forwarding and mentions
A new look across the app and a set of everyday messaging features. Interface - Home screen with Chats, Contacts and Settings tabs, a large title, search across chats and message text (diacritics-insensitive), filters and pinned chats. - Conversation view with a translucent header and composer, grouped bubbles, author avatars and colours in groups, swipe to reply, an "N new messages" marker, a jump-to-latest button and in-chat search. - Contact and group profiles: verification, shared photos, groups in common, disappearing messages, mute, block; members, admin badges, adding people, rename and leave for groups. - Full-screen photo viewer that pages through the whole conversation. - A stable avatar colour per person and a clearly visible read state. Messaging - Polls in chats and groups, single or multiple choice, with votes that can be changed or withdrawn; older clients see them as text. - Drafts survive leaving a chat and show in the chat list. - Forwarding of messages, photos, files and voice messages. - Notes to self: a local-only, encrypted chat that never reaches the relay. - @mentions in groups that notify even when the group is muted. - Typing indicators sent as ephemeral messages, opt-in and mutual like read receipts. - Delivery and read times per message and per group member. - Profile photos, cropped, resized and stripped of metadata, delivered encrypted to contacts. - Voice message playback at 1.5x and 2x. - Call buttons in 1:1 chats and call log entries. Fixes - Muted groups no longer notify: muting was checked against the author's chat instead of the group. - A blocked contact could unblock itself by changing its delivery address. - Read receipts no longer regress to delivered when a late delivery receipt arrives. - A message marked as failed corrects itself once it is delivered. - Double ticks in groups now mean delivered to every member.
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:sepot/models/message.dart';
|
||||
import 'package:sepot/models/poll.dart';
|
||||
|
||||
/// Anketa přichází od protistrany — vadná data nesmí nic rozbít a hlas
|
||||
/// nesmí jít mimo nabídnuté možnosti.
|
||||
void main() {
|
||||
const poll = Poll(
|
||||
question: 'Kdy vyrazíme?',
|
||||
options: ['Pátek', 'Sobota', 'Neděle'],
|
||||
);
|
||||
|
||||
test('drát tam a zpět zachová otázku i možnosti', () {
|
||||
final back = Poll.fromWire(poll.toWire())!;
|
||||
expect(back.question, poll.question);
|
||||
expect(back.options, poll.options);
|
||||
expect(back.multi, isFalse);
|
||||
});
|
||||
|
||||
test('vadná anketa z drátu = null (ukáže se záložní text)', () {
|
||||
expect(Poll.fromWire(null), isNull);
|
||||
expect(Poll.fromWire({'q': 'Jen jedna?', 'o': ['a']}), isNull);
|
||||
expect(Poll.fromWire({'q': '', 'o': ['a', 'b']}), isNull);
|
||||
expect(Poll.fromWire({'q': 'x', 'o': ['a', 42]}), isNull);
|
||||
expect(
|
||||
Poll.fromWire({'q': 'x', 'o': List.filled(Poll.maxOptions + 1, 'a')}),
|
||||
isNull);
|
||||
expect(
|
||||
Poll.fromWire({'q': 'x' * (Poll.maxQuestionLength + 1), 'o': ['a', 'b']}),
|
||||
isNull);
|
||||
});
|
||||
|
||||
test('hlas mimo nabídku se zahodí', () {
|
||||
final p = poll.withVote('bob', [7, -1]);
|
||||
expect(p.votes, isEmpty);
|
||||
});
|
||||
|
||||
test('jedna volba: platí jen první index', () {
|
||||
final p = poll.withVote('bob', [2, 0]);
|
||||
expect(p.votes['bob'], [0]);
|
||||
});
|
||||
|
||||
test('více voleb: duplicity se sloučí', () {
|
||||
const multi = Poll(question: 'Co vezmeme?', options: ['a', 'b', 'c'], multi: true);
|
||||
final p = multi.withVote('bob', [2, 0, 2]);
|
||||
expect(p.votes['bob'], [0, 2]);
|
||||
expect(p.countFor(2), 1);
|
||||
});
|
||||
|
||||
test('nový hlas přepíše starý, prázdný ho zruší', () {
|
||||
var p = poll.withVote('bob', [0]).withVote('cyril', [0]);
|
||||
expect(p.countFor(0), 2);
|
||||
p = p.withVote('bob', [1]);
|
||||
expect(p.countFor(0), 1);
|
||||
expect(p.countFor(1), 1);
|
||||
p = p.withVote('bob', const []);
|
||||
expect(p.voterCount, 1);
|
||||
});
|
||||
|
||||
test('hlasy přežijí uložení zprávy', () {
|
||||
final msg = Message.text(
|
||||
senderId: 'ja',
|
||||
recipientId: 'chata',
|
||||
content: 'Anketa: Kdy vyrazíme?',
|
||||
poll: poll.withVote('bob', [1]),
|
||||
);
|
||||
final back = Message.fromJson(msg.toJson());
|
||||
expect(back.poll?.question, poll.question);
|
||||
expect(back.poll?.votes['bob'], [1]);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user