forked from cwtch.im/cwtch-ui
Autohide messages from blocked contacts
This commit is contained in:
parent
7a7b3f22b0
commit
d126cc6ebb
|
@ -1,6 +1,8 @@
|
||||||
{
|
{
|
||||||
"@@locale": "de",
|
"@@locale": "de",
|
||||||
"@@last_modified": "2021-07-14T21:46:10+02:00",
|
"@@last_modified": "2021-07-14T22:29:25+02:00",
|
||||||
|
"showMessageButton": "Show Message",
|
||||||
|
"blockedMessageMessage": "This message is from a profile you have blocked.",
|
||||||
"placeholderEnterMessage": "Type a message...",
|
"placeholderEnterMessage": "Type a message...",
|
||||||
"plainProfileDescription": "We recommend that you protect your Cwtch profiles with a password. If you do not set a password on this profile then anyone who has access to this device may be able to access information about this profile, including contacts, messages and sensitive cryptographic keys.",
|
"plainProfileDescription": "We recommend that you protect your Cwtch profiles with a password. If you do not set a password on this profile then anyone who has access to this device may be able to access information about this profile, including contacts, messages and sensitive cryptographic keys.",
|
||||||
"encryptedProfileDescription": "Encrypting a profile with a password protects it from other people who may also use this device. Encrypted profiles cannot be decrypted, displayed or accessed until the correct password is entered to unlock them.",
|
"encryptedProfileDescription": "Encrypting a profile with a password protects it from other people who may also use this device. Encrypted profiles cannot be decrypted, displayed or accessed until the correct password is entered to unlock them.",
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
{
|
{
|
||||||
"@@locale": "en",
|
"@@locale": "en",
|
||||||
"@@last_modified": "2021-07-14T21:46:10+02:00",
|
"@@last_modified": "2021-07-14T22:29:25+02:00",
|
||||||
|
"showMessageButton": "Show Message",
|
||||||
|
"blockedMessageMessage": "This message is from a profile you have blocked.",
|
||||||
"placeholderEnterMessage": "Type a message...",
|
"placeholderEnterMessage": "Type a message...",
|
||||||
"plainProfileDescription": "We recommend that you protect your Cwtch profiles with a password. If you do not set a password on this profile then anyone who has access to this device may be able to access information about this profile, including contacts, messages and sensitive cryptographic keys.",
|
"plainProfileDescription": "We recommend that you protect your Cwtch profiles with a password. If you do not set a password on this profile then anyone who has access to this device may be able to access information about this profile, including contacts, messages and sensitive cryptographic keys.",
|
||||||
"encryptedProfileDescription": "Encrypting a profile with a password protects it from other people who may also use this device. Encrypted profiles cannot be decrypted, displayed or accessed until the correct password is entered to unlock them.",
|
"encryptedProfileDescription": "Encrypting a profile with a password protects it from other people who may also use this device. Encrypted profiles cannot be decrypted, displayed or accessed until the correct password is entered to unlock them.",
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
{
|
{
|
||||||
"@@locale": "es",
|
"@@locale": "es",
|
||||||
"@@last_modified": "2021-07-14T21:46:10+02:00",
|
"@@last_modified": "2021-07-14T22:29:25+02:00",
|
||||||
|
"showMessageButton": "Show Message",
|
||||||
|
"blockedMessageMessage": "This message is from a profile you have blocked.",
|
||||||
"placeholderEnterMessage": "Type a message...",
|
"placeholderEnterMessage": "Type a message...",
|
||||||
"plainProfileDescription": "We recommend that you protect your Cwtch profiles with a password. If you do not set a password on this profile then anyone who has access to this device may be able to access information about this profile, including contacts, messages and sensitive cryptographic keys.",
|
"plainProfileDescription": "We recommend that you protect your Cwtch profiles with a password. If you do not set a password on this profile then anyone who has access to this device may be able to access information about this profile, including contacts, messages and sensitive cryptographic keys.",
|
||||||
"encryptedProfileDescription": "Encrypting a profile with a password protects it from other people who may also use this device. Encrypted profiles cannot be decrypted, displayed or accessed until the correct password is entered to unlock them.",
|
"encryptedProfileDescription": "Encrypting a profile with a password protects it from other people who may also use this device. Encrypted profiles cannot be decrypted, displayed or accessed until the correct password is entered to unlock them.",
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
{
|
{
|
||||||
"@@locale": "fr",
|
"@@locale": "fr",
|
||||||
"@@last_modified": "2021-07-14T21:46:10+02:00",
|
"@@last_modified": "2021-07-14T22:29:25+02:00",
|
||||||
"placeholderEnterMessage": "Type a message...",
|
"showMessageButton": "Show Message",
|
||||||
|
"blockedMessageMessage": "This message is from a profile you have blocked.",
|
||||||
|
"placeholderEnterMessage": "saisissez un message",
|
||||||
"plainProfileDescription": "Nous vous recommandons de protéger vos profils Cwtch par un mot de passe. Si vous ne définissez pas de mot de passe sur ce profil, toute personne ayant accès à cet appareil peut être en mesure d'accéder aux informations relatives à ce profil, y compris les contacts, les messages et les clés de chiffrement sensibles.",
|
"plainProfileDescription": "Nous vous recommandons de protéger vos profils Cwtch par un mot de passe. Si vous ne définissez pas de mot de passe sur ce profil, toute personne ayant accès à cet appareil peut être en mesure d'accéder aux informations relatives à ce profil, y compris les contacts, les messages et les clés de chiffrement sensibles.",
|
||||||
"encryptedProfileDescription": "Le chiffrement d'un profil à l'aide d'un mot de passe le protège des autres personnes susceptibles d'utiliser également cet appareil. Les profils chiffrés ne peuvent pas être déchiffrés , affichés ou accessibles tant que le mot de passe correct n'a pas été saisi pour les déverrouiller.",
|
"encryptedProfileDescription": "Le chiffrement d'un profil à l'aide d'un mot de passe le protège des autres personnes susceptibles d'utiliser également cet appareil. Les profils chiffrés ne peuvent pas être déchiffrés , affichés ou accessibles tant que le mot de passe correct n'a pas été saisi pour les déverrouiller.",
|
||||||
"addContactConfirm": "Ajouter le contact %1",
|
"addContactConfirm": "Ajouter le contact %1",
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
{
|
{
|
||||||
"@@locale": "it",
|
"@@locale": "it",
|
||||||
"@@last_modified": "2021-07-14T21:46:10+02:00",
|
"@@last_modified": "2021-07-14T22:29:25+02:00",
|
||||||
|
"showMessageButton": "Show Message",
|
||||||
|
"blockedMessageMessage": "This message is from a profile you have blocked.",
|
||||||
"placeholderEnterMessage": "Type a message...",
|
"placeholderEnterMessage": "Type a message...",
|
||||||
"plainProfileDescription": "We recommend that you protect your Cwtch profiles with a password. If you do not set a password on this profile then anyone who has access to this device may be able to access information about this profile, including contacts, messages and sensitive cryptographic keys.",
|
"plainProfileDescription": "We recommend that you protect your Cwtch profiles with a password. If you do not set a password on this profile then anyone who has access to this device may be able to access information about this profile, including contacts, messages and sensitive cryptographic keys.",
|
||||||
"encryptedProfileDescription": "Encrypting a profile with a password protects it from other people who may also use this device. Encrypted profiles cannot be decrypted, displayed or accessed until the correct password is entered to unlock them.",
|
"encryptedProfileDescription": "Encrypting a profile with a password protects it from other people who may also use this device. Encrypted profiles cannot be decrypted, displayed or accessed until the correct password is entered to unlock them.",
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
{
|
{
|
||||||
"@@locale": "pl",
|
"@@locale": "pl",
|
||||||
"@@last_modified": "2021-07-14T21:46:10+02:00",
|
"@@last_modified": "2021-07-14T22:29:25+02:00",
|
||||||
|
"showMessageButton": "Show Message",
|
||||||
|
"blockedMessageMessage": "This message is from a profile you have blocked.",
|
||||||
"placeholderEnterMessage": "Type a message...",
|
"placeholderEnterMessage": "Type a message...",
|
||||||
"plainProfileDescription": "We recommend that you protect your Cwtch profiles with a password. If you do not set a password on this profile then anyone who has access to this device may be able to access information about this profile, including contacts, messages and sensitive cryptographic keys.",
|
"plainProfileDescription": "We recommend that you protect your Cwtch profiles with a password. If you do not set a password on this profile then anyone who has access to this device may be able to access information about this profile, including contacts, messages and sensitive cryptographic keys.",
|
||||||
"encryptedProfileDescription": "Encrypting a profile with a password protects it from other people who may also use this device. Encrypted profiles cannot be decrypted, displayed or accessed until the correct password is entered to unlock them.",
|
"encryptedProfileDescription": "Encrypting a profile with a password protects it from other people who may also use this device. Encrypted profiles cannot be decrypted, displayed or accessed until the correct password is entered to unlock them.",
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
{
|
{
|
||||||
"@@locale": "pt",
|
"@@locale": "pt",
|
||||||
"@@last_modified": "2021-07-14T21:46:10+02:00",
|
"@@last_modified": "2021-07-14T22:29:25+02:00",
|
||||||
|
"showMessageButton": "Show Message",
|
||||||
|
"blockedMessageMessage": "This message is from a profile you have blocked.",
|
||||||
"placeholderEnterMessage": "Type a message...",
|
"placeholderEnterMessage": "Type a message...",
|
||||||
"plainProfileDescription": "We recommend that you protect your Cwtch profiles with a password. If you do not set a password on this profile then anyone who has access to this device may be able to access information about this profile, including contacts, messages and sensitive cryptographic keys.",
|
"plainProfileDescription": "We recommend that you protect your Cwtch profiles with a password. If you do not set a password on this profile then anyone who has access to this device may be able to access information about this profile, including contacts, messages and sensitive cryptographic keys.",
|
||||||
"encryptedProfileDescription": "Encrypting a profile with a password protects it from other people who may also use this device. Encrypted profiles cannot be decrypted, displayed or accessed until the correct password is entered to unlock them.",
|
"encryptedProfileDescription": "Encrypting a profile with a password protects it from other people who may also use this device. Encrypted profiles cannot be decrypted, displayed or accessed until the correct password is entered to unlock them.",
|
||||||
|
|
|
@ -25,6 +25,7 @@ class InviteMessage extends Message {
|
||||||
|
|
||||||
String inviteTarget;
|
String inviteTarget;
|
||||||
String inviteNick;
|
String inviteNick;
|
||||||
|
String invite = this.content;
|
||||||
|
|
||||||
if (this.content.length == TorV3ContactHandleLength) {
|
if (this.content.length == TorV3ContactHandleLength) {
|
||||||
inviteTarget = this.content;
|
inviteTarget = this.content;
|
||||||
|
@ -40,7 +41,7 @@ class InviteMessage extends Message {
|
||||||
return MessageRow(MalformedBubble());
|
return MessageRow(MalformedBubble());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return MessageRow(InvitationBubble(overlay, inviteTarget, inviteNick), key: Provider.of<ContactInfoState>(bcontext).getMessageKey(idx));
|
return MessageRow(InvitationBubble(overlay, inviteTarget, inviteNick, invite), key: Provider.of<ContactInfoState>(bcontext).getMessageKey(idx));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +52,7 @@ class InviteMessage extends Message {
|
||||||
builder: (bcontext, child) {
|
builder: (bcontext, child) {
|
||||||
String inviteTarget;
|
String inviteTarget;
|
||||||
String inviteNick;
|
String inviteNick;
|
||||||
|
String invite = this.content;
|
||||||
if (this.content.length == TorV3ContactHandleLength) {
|
if (this.content.length == TorV3ContactHandleLength) {
|
||||||
inviteTarget = this.content;
|
inviteTarget = this.content;
|
||||||
var targetContact = Provider.of<ProfileInfoState>(context).contactList.getContact(inviteTarget);
|
var targetContact = Provider.of<ProfileInfoState>(context).contactList.getContact(inviteTarget);
|
||||||
|
@ -66,7 +67,7 @@ class InviteMessage extends Message {
|
||||||
return MalformedBubble();
|
return MalformedBubble();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return InvitationBubble(overlay, inviteTarget, inviteNick);
|
return InvitationBubble(overlay, inviteTarget, inviteNick, invite);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,9 @@ class InvitationBubble extends StatefulWidget {
|
||||||
final int overlay;
|
final int overlay;
|
||||||
final String inviteTarget;
|
final String inviteTarget;
|
||||||
final String inviteNick;
|
final String inviteNick;
|
||||||
|
final String invite;
|
||||||
|
|
||||||
InvitationBubble(this.overlay, this.inviteTarget, this.inviteNick);
|
InvitationBubble(this.overlay, this.inviteTarget, this.inviteNick, this.invite);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
InvitationBubbleState createState() => InvitationBubbleState();
|
InvitationBubbleState createState() => InvitationBubbleState();
|
||||||
|
@ -136,7 +137,7 @@ class InvitationBubbleState extends State<InvitationBubble> {
|
||||||
void _btnAccept() {
|
void _btnAccept() {
|
||||||
setState(() {
|
setState(() {
|
||||||
var profileOnion = Provider.of<ProfileInfoState>(context, listen: false).onion;
|
var profileOnion = Provider.of<ProfileInfoState>(context, listen: false).onion;
|
||||||
Provider.of<FlwtchState>(context, listen: false).cwtch.ImportBundle(profileOnion, widget.inviteTarget);
|
Provider.of<FlwtchState>(context, listen: false).cwtch.ImportBundle(profileOnion, widget.invite);
|
||||||
isAccepted = true;
|
isAccepted = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:cwtch/cwtch_icons_icons.dart';
|
||||||
import 'package:cwtch/models/message.dart';
|
import 'package:cwtch/models/message.dart';
|
||||||
import 'package:cwtch/views/contactsview.dart';
|
import 'package:cwtch/views/contactsview.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -21,11 +22,13 @@ class MessageRow extends StatefulWidget {
|
||||||
|
|
||||||
class MessageRowState extends State<MessageRow> {
|
class MessageRowState extends State<MessageRow> {
|
||||||
bool showMenu = false;
|
bool showMenu = false;
|
||||||
|
bool showBlockedMessage = false;
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var fromMe = Provider.of<MessageMetadata>(context).senderHandle == Provider.of<ProfileInfoState>(context).onion;
|
var fromMe = Provider.of<MessageMetadata>(context).senderHandle == Provider.of<ProfileInfoState>(context).onion;
|
||||||
var isContact = Provider.of<ProfileInfoState>(context).contactList.getContact(Provider.of<MessageMetadata>(context).senderHandle) != null;
|
var isContact = Provider.of<ProfileInfoState>(context).contactList.getContact(Provider.of<MessageMetadata>(context).senderHandle) != null;
|
||||||
|
var isBlocked = isContact ? Provider.of<ProfileInfoState>(context).contactList.getContact(Provider.of<MessageMetadata>(context).senderHandle)!.isBlocked : false;
|
||||||
|
var actualMessage = Flexible(flex: 3, fit: FlexFit.loose, child: widget.child);
|
||||||
|
|
||||||
var senderDisplayStr = "";
|
var senderDisplayStr = "";
|
||||||
if (!fromMe) {
|
if (!fromMe) {
|
||||||
|
@ -53,7 +56,55 @@ class MessageRowState extends State<MessageRow> {
|
||||||
widgetRow = <Widget>[
|
widgetRow = <Widget>[
|
||||||
wdgSpacer,
|
wdgSpacer,
|
||||||
wdgIcons,
|
wdgIcons,
|
||||||
Flexible(flex: 3, fit: FlexFit.loose, child: widget.child),
|
actualMessage,
|
||||||
|
];
|
||||||
|
} else if (isBlocked && !showBlockedMessage) {
|
||||||
|
Color blockedMessageBackground = Provider.of<Settings>(context).theme.messageFromOtherBackgroundColor();
|
||||||
|
Widget wdgPortrait = Padding(padding: EdgeInsets.all(4.0), child: Icon(CwtchIcons.account_blocked));
|
||||||
|
widgetRow = <Widget>[
|
||||||
|
wdgPortrait,
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(2.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: blockedMessageBackground,
|
||||||
|
border: Border.all(color: blockedMessageBackground, width: 2),
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(15.0),
|
||||||
|
topRight: Radius.circular(15.0),
|
||||||
|
bottomLeft: Radius.circular(15.0),
|
||||||
|
bottomRight: Radius.circular(15.0),
|
||||||
|
)),
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(9.0),
|
||||||
|
child: Column(crossAxisAlignment: CrossAxisAlignment.center, children: [
|
||||||
|
SelectableText(
|
||||||
|
AppLocalizations.of(context)!.blockedMessageMessage,
|
||||||
|
//key: Key(myKey),
|
||||||
|
style: TextStyle(
|
||||||
|
color: Provider.of<Settings>(context).theme.messageFromOtherTextColor(),
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
textWidthBasis: TextWidthBasis.longestLine,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.all(1.0),
|
||||||
|
child: TextButton(
|
||||||
|
style: ButtonStyle(
|
||||||
|
backgroundColor: MaterialStateProperty.all(blockedMessageBackground),
|
||||||
|
overlayColor: MaterialStateProperty.all(blockedMessageBackground),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
AppLocalizations.of(context)!.showMessageButton + '\u202F',
|
||||||
|
style: TextStyle(decoration: TextDecoration.underline),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
setState(() {
|
||||||
|
this.showBlockedMessage = true;
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
]))),
|
||||||
|
wdgIcons,
|
||||||
|
wdgSpacer,
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
var contact = Provider.of<ContactInfoState>(context);
|
var contact = Provider.of<ContactInfoState>(context);
|
||||||
|
@ -72,7 +123,7 @@ class MessageRowState extends State<MessageRow> {
|
||||||
|
|
||||||
widgetRow = <Widget>[
|
widgetRow = <Widget>[
|
||||||
wdgPortrait,
|
wdgPortrait,
|
||||||
Flexible(flex: 3, fit: FlexFit.loose, child: widget.child),
|
actualMessage,
|
||||||
wdgIcons,
|
wdgIcons,
|
||||||
wdgSpacer,
|
wdgSpacer,
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in New Issue