Merge pull request 'Upgrade Cwtch and Display Message Limits' (#339) from fastercwtch into trunk
continuous-integration/drone/push Build is passing Details

Reviewed-on: #339
Reviewed-by: Dan Ballard <dan@openprivacy.ca>
This commit is contained in:
Sarah Jamie Lewis 2022-01-26 20:48:22 +00:00
commit 6276b022dc
4 changed files with 18 additions and 5 deletions

View File

@ -1 +1 @@
2022-01-20-17-22-v1.5.4-16-ge0e1a4b 2022-01-26-15-10-v1.5.4-18-gd77d7bb

View File

@ -1 +1 @@
2022-01-20-22-22-v1.5.4-16-ge0e1a4b 2022-01-26-20-10-v1.5.4-18-gd77d7bb

View File

@ -63,8 +63,7 @@ NotificationsManager newDesktopNotificationsManager() {
client.getCapabilities(); client.getCapabilities();
return LinuxNotificationsManager(client); return LinuxNotificationsManager(client);
} catch (e) { } catch (e) {
EnvironmentConfig.debugLog( EnvironmentConfig.debugLog("Attempted to access DBUS for notifications but failed. Switching off notifications.");
"Attempted to access DBUS for notifications but failed. Switching off notifications.");
} }
} else if (Platform.isWindows) { } else if (Platform.isWindows) {
try { try {

View File

@ -175,8 +175,19 @@ class _MessageViewState extends State<MessageView> {
)); ));
} }
// todo: legacy groups currently have restricted message
// size because of the additional wrapping end encoding
// hybrid groups should allow these numbers to be the same.
static const P2PMessageLengthMax = 7000;
static const GroupMessageLengthMax = 1800;
void _sendMessage([String? ignoredParam]) { void _sendMessage([String? ignoredParam]) {
if (ctrlrCompose.value.text.isNotEmpty) { var isGroup = Provider.of<ProfileInfoState>(context).contactList.getContact(Provider.of<AppState>(context, listen: false).selectedConversation!)!.isGroup;
// peers and groups currently have different length constraints (servers can store less)...
var lengthOk = (isGroup && ctrlrCompose.value.text.length < GroupMessageLengthMax) || ctrlrCompose.value.text.length <= P2PMessageLengthMax;
if (ctrlrCompose.value.text.isNotEmpty && lengthOk) {
if (Provider.of<AppState>(context, listen: false).selectedConversation != null && Provider.of<AppState>(context, listen: false).selectedIndex != null) { if (Provider.of<AppState>(context, listen: false).selectedConversation != null && Provider.of<AppState>(context, listen: false).selectedIndex != null) {
Provider.of<FlwtchState>(context, listen: false) Provider.of<FlwtchState>(context, listen: false)
.cwtch .cwtch
@ -237,6 +248,7 @@ class _MessageViewState extends State<MessageView> {
Widget _buildComposeBox() { Widget _buildComposeBox() {
bool isOffline = Provider.of<ContactInfoState>(context).isOnline() == false; bool isOffline = Provider.of<ContactInfoState>(context).isOnline() == false;
bool isGroup = Provider.of<ContactInfoState>(context).isGroup;
var composeBox = Container( var composeBox = Container(
color: Provider.of<Settings>(context).theme.backgroundMainColor, color: Provider.of<Settings>(context).theme.backgroundMainColor,
@ -262,6 +274,8 @@ class _MessageViewState extends State<MessageView> {
keyboardType: TextInputType.multiline, keyboardType: TextInputType.multiline,
enableIMEPersonalizedLearning: false, enableIMEPersonalizedLearning: false,
minLines: 1, minLines: 1,
maxLength: isGroup ? GroupMessageLengthMax : P2PMessageLengthMax,
maxLengthEnforcement: MaxLengthEnforcement.enforced,
maxLines: null, maxLines: null,
onFieldSubmitted: _sendMessage, onFieldSubmitted: _sendMessage,
enabled: !isOffline, enabled: !isOffline,