Browse Source

Merge pull request 'Upgrade Cwtch and Display Message Limits' (#339) from fastercwtch into trunk

Reviewed-on: https://git.openprivacy.ca/cwtch.im/cwtch-ui/pulls/339
Reviewed-by: Dan Ballard <dan@openprivacy.ca>
pull/346/head
Sarah Jamie Lewis 4 months ago
parent
commit
6276b022dc
  1. 2
      LIBCWTCH-GO-MACOS.version
  2. 2
      LIBCWTCH-GO.version
  3. 3
      lib/notification_manager.dart
  4. 16
      lib/views/messageview.dart

2
LIBCWTCH-GO-MACOS.version

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

2
LIBCWTCH-GO.version

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

3
lib/notification_manager.dart

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

16
lib/views/messageview.dart

@ -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]) {
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) {
Provider.of<FlwtchState>(context, listen: false)
.cwtch
@ -237,6 +248,7 @@ class _MessageViewState extends State<MessageView> {
Widget _buildComposeBox() {
bool isOffline = Provider.of<ContactInfoState>(context).isOnline() == false;
bool isGroup = Provider.of<ContactInfoState>(context).isGroup;
var composeBox = Container(
color: Provider.of<Settings>(context).theme.backgroundMainColor,
@ -262,6 +274,8 @@ class _MessageViewState extends State<MessageView> {
keyboardType: TextInputType.multiline,
enableIMEPersonalizedLearning: false,
minLines: 1,
maxLength: isGroup ? GroupMessageLengthMax : P2PMessageLengthMax,
maxLengthEnforcement: MaxLengthEnforcement.enforced,
maxLines: null,
onFieldSubmitted: _sendMessage,
enabled: !isOffline,

Loading…
Cancel
Save