Add chat select mode
This commit is contained in:
parent
3dc3f218f1
commit
757b46a6b7
|
@ -1,3 +1,8 @@
|
||||||
|
# Version 0.7.0 - 2020-02-??
|
||||||
|
### New features
|
||||||
|
- Select mode in chat
|
||||||
|
- Implement replies
|
||||||
|
|
||||||
# Version 0.6.0 - 2020-02-09
|
# Version 0.6.0 - 2020-02-09
|
||||||
### New features
|
### New features
|
||||||
- Add e2ee settings
|
- Add e2ee settings
|
||||||
|
|
|
@ -17,8 +17,12 @@ import 'state_message.dart';
|
||||||
class Message extends StatelessWidget {
|
class Message extends StatelessWidget {
|
||||||
final Event event;
|
final Event event;
|
||||||
final Event nextEvent;
|
final Event nextEvent;
|
||||||
|
final Function(Event) onSelect;
|
||||||
|
final bool longPressSelect;
|
||||||
|
final bool selected;
|
||||||
|
|
||||||
const Message(this.event, {this.nextEvent});
|
const Message(this.event,
|
||||||
|
{this.nextEvent, this.longPressSelect, this.onSelect, this.selected});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -100,40 +104,12 @@ class Message extends StatelessWidget {
|
||||||
|
|
||||||
List<Widget> rowChildren = [
|
List<Widget> rowChildren = [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: PopupMenuButton(
|
child: InkWell(
|
||||||
tooltip: I18n.of(context).tapToShowMenu,
|
onTap: longPressSelect ? null : () => onSelect(event),
|
||||||
onSelected: (String choice) async {
|
onLongPress: !longPressSelect ? null : () => onSelect(event),
|
||||||
switch (choice) {
|
|
||||||
case "remove":
|
|
||||||
await showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (BuildContext context) => ConfirmDialog(
|
|
||||||
I18n.of(context).messageWillBeRemovedWarning,
|
|
||||||
I18n.of(context).remove, (context) {
|
|
||||||
Matrix.of(context)
|
|
||||||
.tryRequestWithLoadingDialog(event.redact());
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case "resend":
|
|
||||||
await event.sendAgain();
|
|
||||||
break;
|
|
||||||
case "delete":
|
|
||||||
await event.remove();
|
|
||||||
break;
|
|
||||||
case "copy":
|
|
||||||
await Clipboard.setData(ClipboardData(text: event.body));
|
|
||||||
break;
|
|
||||||
case "forward":
|
|
||||||
Matrix.of(context).shareContent = event.content;
|
|
||||||
Navigator.of(context).popUntil((r) => r.isFirst);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
itemBuilder: (BuildContext context) => popupMenuList,
|
|
||||||
child: AnimatedOpacity(
|
child: AnimatedOpacity(
|
||||||
duration: Duration(milliseconds: 500),
|
duration: Duration(milliseconds: 500),
|
||||||
opacity: event.status == 0 ? 0.5 : 1,
|
opacity: (event.status == 0 || event.redacted) ? 0.5 : 1,
|
||||||
child: Bubble(
|
child: Bubble(
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
radius: Radius.circular(8),
|
radius: Radius.circular(8),
|
||||||
|
@ -197,7 +173,12 @@ class Message extends StatelessWidget {
|
||||||
rowChildren.insert(0, avatarOrSizedBox);
|
rowChildren.insert(0, avatarOrSizedBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Padding(
|
return AnimatedContainer(
|
||||||
|
duration: Duration(milliseconds: 300),
|
||||||
|
curve: Curves.fastOutSlowIn,
|
||||||
|
color: selected
|
||||||
|
? Theme.of(context).primaryColor.withAlpha(100)
|
||||||
|
: Theme.of(context).backgroundColor,
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
left: 8.0, right: 8.0, bottom: sameSender ? 4.0 : 8.0),
|
left: 8.0, right: 8.0, bottom: sameSender ? 4.0 : 8.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
|
|
|
@ -413,6 +413,9 @@ class I18n {
|
||||||
|
|
||||||
String get notSupportedInWeb => Intl.message("Not supported in web");
|
String get notSupportedInWeb => Intl.message("Not supported in web");
|
||||||
|
|
||||||
|
String numberSelected(String number) =>
|
||||||
|
Intl.message("$number selected", name: "numberSelected", args: [number]);
|
||||||
|
|
||||||
String get oopsSomethingWentWrong =>
|
String get oopsSomethingWentWrong =>
|
||||||
Intl.message("Oops something went wrong...");
|
Intl.message("Oops something went wrong...");
|
||||||
|
|
||||||
|
@ -470,6 +473,8 @@ class I18n {
|
||||||
|
|
||||||
String get removeMessage => Intl.message('Remove message');
|
String get removeMessage => Intl.message('Remove message');
|
||||||
|
|
||||||
|
String get reply => Intl.message('Reply');
|
||||||
|
|
||||||
String get saturday => Intl.message("Saturday");
|
String get saturday => Intl.message("Saturday");
|
||||||
|
|
||||||
String get share => Intl.message("Share");
|
String get share => Intl.message("Share");
|
||||||
|
|
|
@ -629,6 +629,13 @@
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
},
|
},
|
||||||
|
"numberSelected": "{number} ausgewählt",
|
||||||
|
"@numberSelected": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {
|
||||||
|
"number": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
"Oops something went wrong...": "Hoppla! Da ist etwas schief gelaufen ...",
|
"Oops something went wrong...": "Hoppla! Da ist etwas schief gelaufen ...",
|
||||||
"@Oops something went wrong...": {
|
"@Oops something went wrong...": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -727,6 +734,11 @@
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
},
|
},
|
||||||
|
"Reply": "Antworten",
|
||||||
|
"@Reply": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
"Saturday": "Samstag",
|
"Saturday": "Samstag",
|
||||||
"@Saturday": {
|
"@Saturday": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"@@last_modified": "2020-02-04T14:02:33.828211",
|
"@@last_modified": "2020-02-09T15:11:56.012667",
|
||||||
"About": "About",
|
"About": "About",
|
||||||
"@About": {
|
"@About": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -629,6 +629,13 @@
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
},
|
},
|
||||||
|
"numberSelected": "{number} selected",
|
||||||
|
"@numberSelected": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {
|
||||||
|
"number": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
"Oops something went wrong...": "Oops something went wrong...",
|
"Oops something went wrong...": "Oops something went wrong...",
|
||||||
"@Oops something went wrong...": {
|
"@Oops something went wrong...": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -727,6 +734,11 @@
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
},
|
},
|
||||||
|
"Reply": "Reply",
|
||||||
|
"@Reply": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
"Saturday": "Saturday",
|
"Saturday": "Saturday",
|
||||||
"@Saturday": {
|
"@Saturday": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
|
|
@ -81,51 +81,53 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||||
|
|
||||||
static m30(count) => "${count} weitere Teilnehmer laden";
|
static m30(count) => "${count} weitere Teilnehmer laden";
|
||||||
|
|
||||||
static m31(fileName) => "Play ${fileName}";
|
static m31(number) => "${number} ausgewählt";
|
||||||
|
|
||||||
static m32(username) => "${username} hat ein Event enternt";
|
static m32(fileName) => "Play ${fileName}";
|
||||||
|
|
||||||
static m33(username) => "${username} hat die Einladung abgelehnt";
|
static m33(username) => "${username} hat ein Event enternt";
|
||||||
|
|
||||||
static m34(username) => "Entfernt von ${username}";
|
static m34(username) => "${username} hat die Einladung abgelehnt";
|
||||||
|
|
||||||
static m35(username) => "Gelesen von ${username}";
|
static m35(username) => "Entfernt von ${username}";
|
||||||
|
|
||||||
static m36(username, count) => "Gelesen von ${username} und ${count} anderen";
|
static m36(username) => "Gelesen von ${username}";
|
||||||
|
|
||||||
static m37(username, username2) => "Gelesen von ${username} und ${username2}";
|
static m37(username, count) => "Gelesen von ${username} und ${count} anderen";
|
||||||
|
|
||||||
static m38(username) => "${username} hat eine Datei gesendet";
|
static m38(username, username2) => "Gelesen von ${username} und ${username2}";
|
||||||
|
|
||||||
static m39(username) => "${username} hat ein Bild gesendet";
|
static m39(username) => "${username} hat eine Datei gesendet";
|
||||||
|
|
||||||
static m40(username) => "${username} hat einen Sticker gesendet";
|
static m40(username) => "${username} hat ein Bild gesendet";
|
||||||
|
|
||||||
static m41(username) => "${username} hat ein Video gesendet";
|
static m41(username) => "${username} hat einen Sticker gesendet";
|
||||||
|
|
||||||
static m42(username) => "${username} hat eine Audio-Datei gesendet";
|
static m42(username) => "${username} hat ein Video gesendet";
|
||||||
|
|
||||||
static m43(username) => "${username} hat den Standort geteilt";
|
static m43(username) => "${username} hat eine Audio-Datei gesendet";
|
||||||
|
|
||||||
static m44(hours12, hours24, minutes, suffix) => "${hours24}:${minutes}";
|
static m44(username) => "${username} hat den Standort geteilt";
|
||||||
|
|
||||||
static m45(username, targetName) => "${username} hat die Verbannung von ${targetName} aufgehoben";
|
static m45(hours12, hours24, minutes, suffix) => "${hours24}:${minutes}";
|
||||||
|
|
||||||
static m46(type) => "Unbekanntes Event \'${type}\'";
|
static m46(username, targetName) => "${username} hat die Verbannung von ${targetName} aufgehoben";
|
||||||
|
|
||||||
static m47(unreadEvents) => "${unreadEvents} ungelesene Nachrichten";
|
static m47(type) => "Unbekanntes Event \'${type}\'";
|
||||||
|
|
||||||
static m48(unreadEvents, unreadChats) => "${unreadEvents} ungelesene Nachrichten in ${unreadChats} Chats";
|
static m48(unreadEvents) => "${unreadEvents} ungelesene Nachrichten";
|
||||||
|
|
||||||
static m49(username, count) => "${username} und ${count} andere schreiben ...";
|
static m49(unreadEvents, unreadChats) => "${unreadEvents} ungelesene Nachrichten in ${unreadChats} Chats";
|
||||||
|
|
||||||
static m50(username, username2) => "${username} und ${username2} schreiben ...";
|
static m50(username, count) => "${username} und ${count} andere schreiben ...";
|
||||||
|
|
||||||
static m51(username) => "${username} schreibt ...";
|
static m51(username, username2) => "${username} und ${username2} schreiben ...";
|
||||||
|
|
||||||
static m52(username) => "${username} hat den Chat verlassen";
|
static m52(username) => "${username} schreibt ...";
|
||||||
|
|
||||||
static m53(username, type) => "${username} hat ${type} Event gesendet";
|
static m53(username) => "${username} hat den Chat verlassen";
|
||||||
|
|
||||||
|
static m54(username, type) => "${username} hat ${type} Event gesendet";
|
||||||
|
|
||||||
final messages = _notInlinedMessages(_notInlinedMessages);
|
final messages = _notInlinedMessages(_notInlinedMessages);
|
||||||
static _notInlinedMessages(_) => <String, Function> {
|
static _notInlinedMessages(_) => <String, Function> {
|
||||||
|
@ -218,6 +220,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||||
"Remove" : MessageLookupByLibrary.simpleMessage("Entfernen"),
|
"Remove" : MessageLookupByLibrary.simpleMessage("Entfernen"),
|
||||||
"Remove exile" : MessageLookupByLibrary.simpleMessage("Verbannung aufheben"),
|
"Remove exile" : MessageLookupByLibrary.simpleMessage("Verbannung aufheben"),
|
||||||
"Remove message" : MessageLookupByLibrary.simpleMessage("Nachricht entfernen"),
|
"Remove message" : MessageLookupByLibrary.simpleMessage("Nachricht entfernen"),
|
||||||
|
"Reply" : MessageLookupByLibrary.simpleMessage("Antworten"),
|
||||||
"Revoke all permissions" : MessageLookupByLibrary.simpleMessage("Alle Berechtigungen zurücknehmen"),
|
"Revoke all permissions" : MessageLookupByLibrary.simpleMessage("Alle Berechtigungen zurücknehmen"),
|
||||||
"Saturday" : MessageLookupByLibrary.simpleMessage("Samstag"),
|
"Saturday" : MessageLookupByLibrary.simpleMessage("Samstag"),
|
||||||
"Search for a chat" : MessageLookupByLibrary.simpleMessage("Durchsuche die Chats"),
|
"Search for a chat" : MessageLookupByLibrary.simpleMessage("Durchsuche die Chats"),
|
||||||
|
@ -288,29 +291,30 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||||
"kicked" : m28,
|
"kicked" : m28,
|
||||||
"kickedAndBanned" : m29,
|
"kickedAndBanned" : m29,
|
||||||
"loadCountMoreParticipants" : m30,
|
"loadCountMoreParticipants" : m30,
|
||||||
"play" : m31,
|
"numberSelected" : m31,
|
||||||
"redactedAnEvent" : m32,
|
"play" : m32,
|
||||||
"rejectedTheInvitation" : m33,
|
"redactedAnEvent" : m33,
|
||||||
"removedBy" : m34,
|
"rejectedTheInvitation" : m34,
|
||||||
"seenByUser" : m35,
|
"removedBy" : m35,
|
||||||
"seenByUserAndCountOthers" : m36,
|
"seenByUser" : m36,
|
||||||
"seenByUserAndUser" : m37,
|
"seenByUserAndCountOthers" : m37,
|
||||||
"sentAFile" : m38,
|
"seenByUserAndUser" : m38,
|
||||||
"sentAPicture" : m39,
|
"sentAFile" : m39,
|
||||||
"sentASticker" : m40,
|
"sentAPicture" : m40,
|
||||||
"sentAVideo" : m41,
|
"sentASticker" : m41,
|
||||||
"sentAnAudio" : m42,
|
"sentAVideo" : m42,
|
||||||
"sharedTheLocation" : m43,
|
"sentAnAudio" : m43,
|
||||||
"timeOfDay" : m44,
|
"sharedTheLocation" : m44,
|
||||||
|
"timeOfDay" : m45,
|
||||||
"title" : MessageLookupByLibrary.simpleMessage("FluffyChat"),
|
"title" : MessageLookupByLibrary.simpleMessage("FluffyChat"),
|
||||||
"unbannedUser" : m45,
|
"unbannedUser" : m46,
|
||||||
"unknownEvent" : m46,
|
"unknownEvent" : m47,
|
||||||
"unreadMessages" : m47,
|
"unreadMessages" : m48,
|
||||||
"unreadMessagesInChats" : m48,
|
"unreadMessagesInChats" : m49,
|
||||||
"userAndOthersAreTyping" : m49,
|
"userAndOthersAreTyping" : m50,
|
||||||
"userAndUserAreTyping" : m50,
|
"userAndUserAreTyping" : m51,
|
||||||
"userIsTyping" : m51,
|
"userIsTyping" : m52,
|
||||||
"userLeftTheChat" : m52,
|
"userLeftTheChat" : m53,
|
||||||
"userSentUnknownEvent" : m53
|
"userSentUnknownEvent" : m54
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,51 +81,53 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||||
|
|
||||||
static m30(count) => "Load ${count} more participants";
|
static m30(count) => "Load ${count} more participants";
|
||||||
|
|
||||||
static m31(fileName) => "Play ${fileName}";
|
static m31(number) => "${number} selected";
|
||||||
|
|
||||||
static m32(username) => "${username} redacted an event";
|
static m32(fileName) => "Play ${fileName}";
|
||||||
|
|
||||||
static m33(username) => "${username} rejected the invitation";
|
static m33(username) => "${username} redacted an event";
|
||||||
|
|
||||||
static m34(username) => "Removed by ${username}";
|
static m34(username) => "${username} rejected the invitation";
|
||||||
|
|
||||||
static m35(username) => "Seen by ${username}";
|
static m35(username) => "Removed by ${username}";
|
||||||
|
|
||||||
static m36(username, count) => "Seen by ${username} and ${count} others";
|
static m36(username) => "Seen by ${username}";
|
||||||
|
|
||||||
static m37(username, username2) => "Seen by ${username} and ${username2}";
|
static m37(username, count) => "Seen by ${username} and ${count} others";
|
||||||
|
|
||||||
static m38(username) => "${username} sent a file";
|
static m38(username, username2) => "Seen by ${username} and ${username2}";
|
||||||
|
|
||||||
static m39(username) => "${username} sent a picture";
|
static m39(username) => "${username} sent a file";
|
||||||
|
|
||||||
static m40(username) => "${username} sent a sticker";
|
static m40(username) => "${username} sent a picture";
|
||||||
|
|
||||||
static m41(username) => "${username} sent a video";
|
static m41(username) => "${username} sent a sticker";
|
||||||
|
|
||||||
static m42(username) => "${username} sent an audio";
|
static m42(username) => "${username} sent a video";
|
||||||
|
|
||||||
static m43(username) => "${username} shared the location";
|
static m43(username) => "${username} sent an audio";
|
||||||
|
|
||||||
static m44(hours12, hours24, minutes, suffix) => "${hours12}:${minutes} ${suffix}";
|
static m44(username) => "${username} shared the location";
|
||||||
|
|
||||||
static m45(username, targetName) => "${username} unbanned ${targetName}";
|
static m45(hours12, hours24, minutes, suffix) => "${hours12}:${minutes} ${suffix}";
|
||||||
|
|
||||||
static m46(type) => "Unknown event \'${type}\'";
|
static m46(username, targetName) => "${username} unbanned ${targetName}";
|
||||||
|
|
||||||
static m47(unreadEvents) => "${unreadEvents} unread messages";
|
static m47(type) => "Unknown event \'${type}\'";
|
||||||
|
|
||||||
static m48(unreadEvents, unreadChats) => "${unreadEvents} unread messages in ${unreadChats} chats";
|
static m48(unreadEvents) => "${unreadEvents} unread messages";
|
||||||
|
|
||||||
static m49(username, count) => "${username} and ${count} others are typing...";
|
static m49(unreadEvents, unreadChats) => "${unreadEvents} unread messages in ${unreadChats} chats";
|
||||||
|
|
||||||
static m50(username, username2) => "${username} and ${username2} are typing...";
|
static m50(username, count) => "${username} and ${count} others are typing...";
|
||||||
|
|
||||||
static m51(username) => "${username} is typing...";
|
static m51(username, username2) => "${username} and ${username2} are typing...";
|
||||||
|
|
||||||
static m52(username) => "${username} left the chat";
|
static m52(username) => "${username} is typing...";
|
||||||
|
|
||||||
static m53(username, type) => "${username} sent a ${type} event";
|
static m53(username) => "${username} left the chat";
|
||||||
|
|
||||||
|
static m54(username, type) => "${username} sent a ${type} event";
|
||||||
|
|
||||||
final messages = _notInlinedMessages(_notInlinedMessages);
|
final messages = _notInlinedMessages(_notInlinedMessages);
|
||||||
static _notInlinedMessages(_) => <String, Function> {
|
static _notInlinedMessages(_) => <String, Function> {
|
||||||
|
@ -218,6 +220,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||||
"Remove" : MessageLookupByLibrary.simpleMessage("Remove"),
|
"Remove" : MessageLookupByLibrary.simpleMessage("Remove"),
|
||||||
"Remove exile" : MessageLookupByLibrary.simpleMessage("Remove exile"),
|
"Remove exile" : MessageLookupByLibrary.simpleMessage("Remove exile"),
|
||||||
"Remove message" : MessageLookupByLibrary.simpleMessage("Remove message"),
|
"Remove message" : MessageLookupByLibrary.simpleMessage("Remove message"),
|
||||||
|
"Reply" : MessageLookupByLibrary.simpleMessage("Reply"),
|
||||||
"Revoke all permissions" : MessageLookupByLibrary.simpleMessage("Revoke all permissions"),
|
"Revoke all permissions" : MessageLookupByLibrary.simpleMessage("Revoke all permissions"),
|
||||||
"Saturday" : MessageLookupByLibrary.simpleMessage("Saturday"),
|
"Saturday" : MessageLookupByLibrary.simpleMessage("Saturday"),
|
||||||
"Search for a chat" : MessageLookupByLibrary.simpleMessage("Search for a chat"),
|
"Search for a chat" : MessageLookupByLibrary.simpleMessage("Search for a chat"),
|
||||||
|
@ -288,29 +291,30 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||||
"kicked" : m28,
|
"kicked" : m28,
|
||||||
"kickedAndBanned" : m29,
|
"kickedAndBanned" : m29,
|
||||||
"loadCountMoreParticipants" : m30,
|
"loadCountMoreParticipants" : m30,
|
||||||
"play" : m31,
|
"numberSelected" : m31,
|
||||||
"redactedAnEvent" : m32,
|
"play" : m32,
|
||||||
"rejectedTheInvitation" : m33,
|
"redactedAnEvent" : m33,
|
||||||
"removedBy" : m34,
|
"rejectedTheInvitation" : m34,
|
||||||
"seenByUser" : m35,
|
"removedBy" : m35,
|
||||||
"seenByUserAndCountOthers" : m36,
|
"seenByUser" : m36,
|
||||||
"seenByUserAndUser" : m37,
|
"seenByUserAndCountOthers" : m37,
|
||||||
"sentAFile" : m38,
|
"seenByUserAndUser" : m38,
|
||||||
"sentAPicture" : m39,
|
"sentAFile" : m39,
|
||||||
"sentASticker" : m40,
|
"sentAPicture" : m40,
|
||||||
"sentAVideo" : m41,
|
"sentASticker" : m41,
|
||||||
"sentAnAudio" : m42,
|
"sentAVideo" : m42,
|
||||||
"sharedTheLocation" : m43,
|
"sentAnAudio" : m43,
|
||||||
"timeOfDay" : m44,
|
"sharedTheLocation" : m44,
|
||||||
|
"timeOfDay" : m45,
|
||||||
"title" : MessageLookupByLibrary.simpleMessage("FluffyChat"),
|
"title" : MessageLookupByLibrary.simpleMessage("FluffyChat"),
|
||||||
"unbannedUser" : m45,
|
"unbannedUser" : m46,
|
||||||
"unknownEvent" : m46,
|
"unknownEvent" : m47,
|
||||||
"unreadMessages" : m47,
|
"unreadMessages" : m48,
|
||||||
"unreadMessagesInChats" : m48,
|
"unreadMessagesInChats" : m49,
|
||||||
"userAndOthersAreTyping" : m49,
|
"userAndOthersAreTyping" : m50,
|
||||||
"userAndUserAreTyping" : m50,
|
"userAndUserAreTyping" : m51,
|
||||||
"userIsTyping" : m51,
|
"userIsTyping" : m52,
|
||||||
"userLeftTheChat" : m52,
|
"userLeftTheChat" : m53,
|
||||||
"userSentUnknownEvent" : m53
|
"userSentUnknownEvent" : m54
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ class App extends StatelessWidget {
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
elevation: 1,
|
elevation: 1,
|
||||||
textTheme: TextTheme(
|
textTheme: TextTheme(
|
||||||
title: TextStyle(
|
headline6: TextStyle(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -13,7 +13,7 @@ extension LocalizedBody on Event {
|
||||||
};
|
};
|
||||||
|
|
||||||
getLocalizedBody(BuildContext context,
|
getLocalizedBody(BuildContext context,
|
||||||
{bool withSenderNamePrefix = false, hideQuotes = false}) {
|
{bool withSenderNamePrefix = false, bool hideQuotes = false}) {
|
||||||
if (this.redacted) {
|
if (this.redacted) {
|
||||||
return I18n.of(context)
|
return I18n.of(context)
|
||||||
.removedBy(redactedBecause.sender.calcDisplayname());
|
.removedBy(redactedBecause.sender.calcDisplayname());
|
||||||
|
|
|
@ -5,14 +5,17 @@ import 'package:famedlysdk/famedlysdk.dart';
|
||||||
import 'package:file_picker/file_picker.dart';
|
import 'package:file_picker/file_picker.dart';
|
||||||
import 'package:fluffychat/components/adaptive_page_layout.dart';
|
import 'package:fluffychat/components/adaptive_page_layout.dart';
|
||||||
import 'package:fluffychat/components/chat_settings_popup_menu.dart';
|
import 'package:fluffychat/components/chat_settings_popup_menu.dart';
|
||||||
|
import 'package:fluffychat/components/dialogs/confirm_dialog.dart';
|
||||||
import 'package:fluffychat/components/list_items/message.dart';
|
import 'package:fluffychat/components/list_items/message.dart';
|
||||||
import 'package:fluffychat/components/matrix.dart';
|
import 'package:fluffychat/components/matrix.dart';
|
||||||
import 'package:fluffychat/i18n/i18n.dart';
|
import 'package:fluffychat/i18n/i18n.dart';
|
||||||
import 'package:fluffychat/utils/app_route.dart';
|
import 'package:fluffychat/utils/app_route.dart';
|
||||||
|
import 'package:fluffychat/utils/event_extension.dart';
|
||||||
import 'package:fluffychat/utils/room_extension.dart';
|
import 'package:fluffychat/utils/room_extension.dart';
|
||||||
import 'package:fluffychat/views/chat_encryption_settings.dart';
|
import 'package:fluffychat/views/chat_encryption_settings.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
import 'package:toast/toast.dart';
|
import 'package:toast/toast.dart';
|
||||||
import 'package:pedantic/pedantic.dart';
|
import 'package:pedantic/pedantic.dart';
|
||||||
|
@ -63,6 +66,12 @@ class _ChatState extends State<_Chat> {
|
||||||
Timer typingTimeout;
|
Timer typingTimeout;
|
||||||
bool currentlyTyping = false;
|
bool currentlyTyping = false;
|
||||||
|
|
||||||
|
Set<Event> selectedEvents = {};
|
||||||
|
|
||||||
|
Event replyEvent;
|
||||||
|
|
||||||
|
bool get selectMode => selectedEvents.isNotEmpty;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
_scrollController.addListener(() async {
|
_scrollController.addListener(() async {
|
||||||
|
@ -130,7 +139,26 @@ class _ChatState extends State<_Chat> {
|
||||||
|
|
||||||
void send() {
|
void send() {
|
||||||
if (sendController.text.isEmpty) return;
|
if (sendController.text.isEmpty) return;
|
||||||
room.sendTextEvent(sendController.text);
|
Map<String, dynamic> textContent = {
|
||||||
|
"msgtype": "m.text",
|
||||||
|
"body": sendController.text,
|
||||||
|
};
|
||||||
|
if (replyEvent != null) {
|
||||||
|
String replyText = ("<${room.client.userID}> " + replyEvent.body);
|
||||||
|
List<String> replyTextLines = replyText.split("\n");
|
||||||
|
for (int i = 0; i < replyTextLines.length; i++) {
|
||||||
|
replyTextLines[i] = "> " + replyTextLines[i];
|
||||||
|
}
|
||||||
|
replyText = replyTextLines.join("\n");
|
||||||
|
textContent["body"] = replyText + "\n\n${sendController.text}";
|
||||||
|
textContent["m.relates_to"] = {
|
||||||
|
"m.in_reply_to": {
|
||||||
|
"event_id": replyEvent.eventId,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
setState(() => replyEvent = null);
|
||||||
|
}
|
||||||
|
room.sendEvent(textContent);
|
||||||
sendController.text = "";
|
sendController.text = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,6 +209,69 @@ class _ChatState extends State<_Chat> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String _getSelectedEventString(BuildContext context) {
|
||||||
|
String copyString = "";
|
||||||
|
for (Event event in selectedEvents) {
|
||||||
|
if (copyString.isNotEmpty) copyString += "\n\n";
|
||||||
|
copyString += event.getLocalizedBody(context, withSenderNamePrefix: true);
|
||||||
|
}
|
||||||
|
return copyString;
|
||||||
|
}
|
||||||
|
|
||||||
|
void copyEventsAction(BuildContext context) {
|
||||||
|
Clipboard.setData(ClipboardData(text: _getSelectedEventString(context)));
|
||||||
|
setState(() => selectedEvents.clear());
|
||||||
|
}
|
||||||
|
|
||||||
|
void redactEventsAction(BuildContext context) async {
|
||||||
|
bool confirmed = false;
|
||||||
|
await showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => ConfirmDialog(
|
||||||
|
I18n.of(context).messageWillBeRemovedWarning,
|
||||||
|
I18n.of(context).remove,
|
||||||
|
(c) => confirmed = true),
|
||||||
|
);
|
||||||
|
if (!confirmed) return;
|
||||||
|
for (Event event in selectedEvents) {
|
||||||
|
await Matrix.of(context).tryRequestWithLoadingDialog(
|
||||||
|
event.status > 0 ? event.redact() : event.remove());
|
||||||
|
}
|
||||||
|
setState(() => selectedEvents.clear());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool get canRedactSelectedEvents {
|
||||||
|
for (Event event in selectedEvents) {
|
||||||
|
if (event.canRedact == false) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void forwardEventsAction(BuildContext context) async {
|
||||||
|
if (selectedEvents.length == 1) {
|
||||||
|
Matrix.of(context).shareContent = selectedEvents.first.content;
|
||||||
|
} else {
|
||||||
|
Matrix.of(context).shareContent = {
|
||||||
|
"msgtype": "m.text",
|
||||||
|
"body": _getSelectedEventString(context),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
setState(() => selectedEvents.clear());
|
||||||
|
Navigator.of(context).popUntil((r) => r.isFirst);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sendAgainAction() {
|
||||||
|
selectedEvents.first.sendAgain();
|
||||||
|
setState(() => selectedEvents.clear());
|
||||||
|
}
|
||||||
|
|
||||||
|
void replyAction() {
|
||||||
|
setState(() {
|
||||||
|
replyEvent = selectedEvents.first;
|
||||||
|
selectedEvents.clear();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
matrix = Matrix.of(context);
|
matrix = Matrix.of(context);
|
||||||
|
@ -224,7 +315,14 @@ class _ChatState extends State<_Chat> {
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Column(
|
leading: selectMode
|
||||||
|
? IconButton(
|
||||||
|
icon: Icon(Icons.close),
|
||||||
|
onPressed: () => setState(() => selectedEvents.clear()),
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
title: selectedEvents.isEmpty
|
||||||
|
? Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
@ -237,7 +335,8 @@ class _ChatState extends State<_Chat> {
|
||||||
typingText.isEmpty
|
typingText.isEmpty
|
||||||
? Container()
|
? Container()
|
||||||
: Icon(Icons.edit,
|
: Icon(Icons.edit,
|
||||||
color: Theme.of(context).primaryColor, size: 10),
|
color: Theme.of(context).primaryColor,
|
||||||
|
size: 10),
|
||||||
SizedBox(width: 4),
|
SizedBox(width: 4),
|
||||||
Text(
|
Text(
|
||||||
typingText,
|
typingText,
|
||||||
|
@ -250,8 +349,22 @@ class _ChatState extends State<_Chat> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
)
|
||||||
|
: Text(I18n.of(context)
|
||||||
|
.numberSelected(selectedEvents.length.toString())),
|
||||||
|
actions: selectMode
|
||||||
|
? <Widget>[
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(Icons.content_copy),
|
||||||
|
onPressed: () => copyEventsAction(context),
|
||||||
),
|
),
|
||||||
actions: <Widget>[ChatSettingsPopupMenu(room, !room.isDirectChat)],
|
if (canRedactSelectedEvents)
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(Icons.delete),
|
||||||
|
onPressed: () => redactEventsAction(context),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
: <Widget>[ChatSettingsPopupMenu(room, !room.isDirectChat)],
|
||||||
),
|
),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Column(
|
child: Column(
|
||||||
|
@ -305,16 +418,71 @@ class _ChatState extends State<_Chat> {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Message(timeline.events[i - 1],
|
: Message(timeline.events[i - 1],
|
||||||
|
onSelect: (Event event) => event.redacted
|
||||||
|
? null
|
||||||
|
: selectedEvents.contains(event)
|
||||||
|
? setState(
|
||||||
|
() => selectedEvents.remove(event))
|
||||||
|
: setState(
|
||||||
|
() => selectedEvents.add(event)),
|
||||||
|
longPressSelect: selectedEvents.isEmpty,
|
||||||
|
selected: selectedEvents
|
||||||
|
.contains(timeline.events[i - 1]),
|
||||||
nextEvent:
|
nextEvent:
|
||||||
i >= 2 ? timeline.events[i - 2] : null);
|
i >= 2 ? timeline.events[i - 2] : null);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
AnimatedContainer(
|
||||||
|
duration: Duration(milliseconds: 300),
|
||||||
|
height: replyEvent != null ? 56 : 0,
|
||||||
|
child: Material(
|
||||||
|
color: Theme.of(context).secondaryHeaderColor,
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(Icons.close),
|
||||||
|
onPressed: () => setState(() => replyEvent = null),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 2,
|
||||||
|
height: 36,
|
||||||
|
color: Theme.of(context).primaryColor,
|
||||||
|
),
|
||||||
|
SizedBox(width: 6),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
(replyEvent?.sender?.calcDisplayname() ?? "") + ":",
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Theme.of(context).primaryColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
replyEvent?.getLocalizedBody(context,
|
||||||
|
withSenderNamePrefix: false) ??
|
||||||
|
"",
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
maxLines: 1,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
room.canSendDefaultMessages && room.membership == Membership.join
|
room.canSendDefaultMessages && room.membership == Membership.join
|
||||||
? Container(
|
? Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Theme.of(context).backgroundColor,
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.grey.withOpacity(0.2),
|
color: Colors.grey.withOpacity(0.2),
|
||||||
|
@ -326,7 +494,53 @@ class _ChatState extends State<_Chat> {
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: selectMode
|
||||||
|
? <Widget>[
|
||||||
|
Container(
|
||||||
|
height: 56,
|
||||||
|
child: FlatButton(
|
||||||
|
onPressed: () => forwardEventsAction(context),
|
||||||
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
Icon(Icons.keyboard_arrow_left),
|
||||||
|
Text(I18n.of(context).forward),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
selectedEvents.length == 1
|
||||||
|
? selectedEvents.first.status > 0
|
||||||
|
? Container(
|
||||||
|
height: 56,
|
||||||
|
child: FlatButton(
|
||||||
|
onPressed: () => replyAction(),
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Text(I18n.of(context).reply),
|
||||||
|
Icon(
|
||||||
|
Icons.keyboard_arrow_right),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Container(
|
||||||
|
height: 56,
|
||||||
|
child: FlatButton(
|
||||||
|
onPressed: () => sendAgainAction(),
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Text(I18n.of(context)
|
||||||
|
.tryToSendAgain),
|
||||||
|
SizedBox(width: 4),
|
||||||
|
Icon(Icons.send, size: 16),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
]
|
||||||
|
: <Widget>[
|
||||||
kIsWeb
|
kIsWeb
|
||||||
? Container()
|
? Container()
|
||||||
: PopupMenuButton<String>(
|
: PopupMenuButton<String>(
|
||||||
|
@ -351,7 +565,8 @@ class _ChatState extends State<_Chat> {
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
child: Icon(Icons.attachment),
|
child: Icon(Icons.attachment),
|
||||||
),
|
),
|
||||||
title: Text(I18n.of(context).sendFile),
|
title:
|
||||||
|
Text(I18n.of(context).sendFile),
|
||||||
contentPadding: EdgeInsets.all(0),
|
contentPadding: EdgeInsets.all(0),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -363,7 +578,8 @@ class _ChatState extends State<_Chat> {
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
child: Icon(Icons.image),
|
child: Icon(Icons.image),
|
||||||
),
|
),
|
||||||
title: Text(I18n.of(context).sendImage),
|
title: Text(
|
||||||
|
I18n.of(context).sendImage),
|
||||||
contentPadding: EdgeInsets.all(0),
|
contentPadding: EdgeInsets.all(0),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -375,7 +591,8 @@ class _ChatState extends State<_Chat> {
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
child: Icon(Icons.camera),
|
child: Icon(Icons.camera),
|
||||||
),
|
),
|
||||||
title: Text(I18n.of(context).openCamera),
|
title: Text(
|
||||||
|
I18n.of(context).openCamera),
|
||||||
contentPadding: EdgeInsets.all(0),
|
contentPadding: EdgeInsets.all(0),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -384,7 +601,8 @@ class _ChatState extends State<_Chat> {
|
||||||
SizedBox(width: 8),
|
SizedBox(width: 8),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
padding:
|
||||||
|
const EdgeInsets.symmetric(vertical: 4.0),
|
||||||
child: TextField(
|
child: TextField(
|
||||||
minLines: 1,
|
minLines: 1,
|
||||||
maxLines: kIsWeb ? 1 : 8,
|
maxLines: kIsWeb ? 1 : 8,
|
||||||
|
@ -393,7 +611,8 @@ class _ChatState extends State<_Chat> {
|
||||||
: TextInputType.multiline,
|
: TextInputType.multiline,
|
||||||
onSubmitted: (String text) {
|
onSubmitted: (String text) {
|
||||||
send();
|
send();
|
||||||
FocusScope.of(context).requestFocus(inputFocus);
|
FocusScope.of(context)
|
||||||
|
.requestFocus(inputFocus);
|
||||||
},
|
},
|
||||||
focusNode: inputFocus,
|
focusNode: inputFocus,
|
||||||
controller: sendController,
|
controller: sendController,
|
||||||
|
@ -405,7 +624,8 @@ class _ChatState extends State<_Chat> {
|
||||||
child: Icon(room.encrypted
|
child: Icon(room.encrypted
|
||||||
? Icons.lock
|
? Icons.lock
|
||||||
: Icons.lock_open),
|
: Icons.lock_open),
|
||||||
onTap: () => Navigator.of(context).push(
|
onTap: () =>
|
||||||
|
Navigator.of(context).push(
|
||||||
AppRoute.defaultRoute(
|
AppRoute.defaultRoute(
|
||||||
context,
|
context,
|
||||||
ChatEncryptionSettingsView(
|
ChatEncryptionSettingsView(
|
||||||
|
@ -431,8 +651,8 @@ class _ChatState extends State<_Chat> {
|
||||||
if (!this.currentlyTyping) {
|
if (!this.currentlyTyping) {
|
||||||
this.currentlyTyping = true;
|
this.currentlyTyping = true;
|
||||||
room.sendTypingInfo(true,
|
room.sendTypingInfo(true,
|
||||||
timeout:
|
timeout: Duration(seconds: 30)
|
||||||
Duration(seconds: 30).inMilliseconds);
|
.inMilliseconds);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
@ -239,7 +239,7 @@ packages:
|
||||||
name: intl
|
name: intl
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.16.0"
|
version: "0.16.1"
|
||||||
intl_translation:
|
intl_translation:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
Loading…
Reference in a new issue