Merge pull request 'cwtch1.6.1-fixes' (#373) from cwtch1.6.1-fixes into trunk
continuous-integration/drone/push Build is passing Details

Reviewed-on: #373
This commit is contained in:
Dan Ballard 2022-02-16 18:34:44 +00:00
commit 6859780873
7 changed files with 54 additions and 44 deletions

View File

@ -196,7 +196,7 @@ class CwtchGomobile implements Cwtch {
@override @override
// ignore: non_constant_identifier_names // ignore: non_constant_identifier_names
void DeleteContact(String profileOnion, int conversation) { void DeleteContact(String profileOnion, int conversation) {
cwtchPlatform.invokeMethod("DeleteContact", {"ProfileOnion": profileOnion, "conversation": conversation}); cwtchPlatform.invokeMethod("DeleteConversation", {"ProfileOnion": profileOnion, "conversation": conversation});
} }
@override @override

View File

@ -2,7 +2,6 @@ import 'package:cwtch/widgets/messagerow.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'message.dart'; import 'message.dart';
import 'messagecache.dart'; import 'messagecache.dart';

View File

@ -296,16 +296,21 @@ class Settings extends ChangeNotifier {
static String notificationPolicyToString(NotificationPolicy np, BuildContext context) { static String notificationPolicyToString(NotificationPolicy np, BuildContext context) {
switch (np) { switch (np) {
case NotificationPolicy.Mute: return AppLocalizations.of(context)!.notificationPolicyMute; case NotificationPolicy.Mute:
case NotificationPolicy.OptIn: return AppLocalizations.of(context)!.notificationPolicyOptIn; return AppLocalizations.of(context)!.notificationPolicyMute;
case NotificationPolicy.DefaultAll: return AppLocalizations.of(context)!.notificationPolicyDefaultAll; case NotificationPolicy.OptIn:
return AppLocalizations.of(context)!.notificationPolicyOptIn;
case NotificationPolicy.DefaultAll:
return AppLocalizations.of(context)!.notificationPolicyDefaultAll;
} }
} }
static String notificationContentToString(NotificationContent nc, BuildContext context) { static String notificationContentToString(NotificationContent nc, BuildContext context) {
switch (nc) { switch (nc) {
case NotificationContent.SimpleEvent: return AppLocalizations.of(context)!.notificationContentSimpleEvent; case NotificationContent.SimpleEvent:
case NotificationContent.ContactInfo: return AppLocalizations.of(context)!.notificationContentContactInfo; return AppLocalizations.of(context)!.notificationContentSimpleEvent;
case NotificationContent.ContactInfo:
return AppLocalizations.of(context)!.notificationContentContactInfo;
} }
} }

View File

@ -137,21 +137,23 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
style: TextStyle(color: settings.current().mainTextColor), style: TextStyle(color: settings.current().mainTextColor),
), ),
leading: Icon(Icons.table_chart, color: settings.current().mainTextColor), leading: Icon(Icons.table_chart, color: settings.current().mainTextColor),
trailing: DropdownButton( trailing: Container(
value: settings.uiColumnModeLandscape.toString(), width: MediaQuery.of(context).size.width / 4,
onChanged: (String? newValue) { child: DropdownButton(
settings.uiColumnModeLandscape = Settings.uiColumnModeFromString(newValue!); value: settings.uiColumnModeLandscape.toString(),
saveSettings(context); onChanged: (String? newValue) {
}, settings.uiColumnModeLandscape = Settings.uiColumnModeFromString(newValue!);
items: Settings.uiColumnModeOptions(true).map<DropdownMenuItem<String>>((DualpaneMode value) { saveSettings(context);
return DropdownMenuItem<String>( },
value: value.toString(), items: Settings.uiColumnModeOptions(true).map<DropdownMenuItem<String>>((DualpaneMode value) {
child: Text( return DropdownMenuItem<String>(
Settings.uiColumnModeToString(value, context), value: value.toString(),
overflow: TextOverflow.ellipsis, child: Text(
), Settings.uiColumnModeToString(value, context),
); overflow: TextOverflow.ellipsis,
}).toList())), ),
);
}).toList()))),
SwitchListTile( SwitchListTile(
title: Text(AppLocalizations.of(context)!.streamerModeLabel, style: TextStyle(color: settings.current().mainTextColor)), title: Text(AppLocalizations.of(context)!.streamerModeLabel, style: TextStyle(color: settings.current().mainTextColor)),
subtitle: Text(AppLocalizations.of(context)!.descriptionStreamerMode), subtitle: Text(AppLocalizations.of(context)!.descriptionStreamerMode),
@ -192,21 +194,23 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
ListTile( ListTile(
title: Text(AppLocalizations.of(context)!.notificationContentSettingLabel), title: Text(AppLocalizations.of(context)!.notificationContentSettingLabel),
subtitle: Text(AppLocalizations.of(context)!.notificationContentSettingDescription), subtitle: Text(AppLocalizations.of(context)!.notificationContentSettingDescription),
trailing: DropdownButton( trailing: Container(
value: settings.notificationContent, width: MediaQuery.of(context).size.width / 4,
onChanged: (NotificationContent? newValue) { child: DropdownButton(
settings.notificationContent = newValue!; value: settings.notificationContent,
saveSettings(context); onChanged: (NotificationContent? newValue) {
}, settings.notificationContent = newValue!;
items: NotificationContent.values.map<DropdownMenuItem<NotificationContent>>((NotificationContent value) { saveSettings(context);
return DropdownMenuItem<NotificationContent>( },
value: value, items: NotificationContent.values.map<DropdownMenuItem<NotificationContent>>((NotificationContent value) {
child: Text( return DropdownMenuItem<NotificationContent>(
Settings.notificationContentToString(value, context), value: value,
overflow: TextOverflow.ellipsis, child: Text(
), Settings.notificationContentToString(value, context),
); overflow: TextOverflow.ellipsis,
}).toList()), ),
);
}).toList())),
leading: Icon(CwtchIcons.chat_bubble_empty_24px, color: settings.current().mainTextColor), leading: Icon(CwtchIcons.chat_bubble_empty_24px, color: settings.current().mainTextColor),
), ),
SwitchListTile( SwitchListTile(

View File

@ -197,6 +197,10 @@ class _MessageViewState extends State<MessageView> {
static const GroupMessageLengthMax = 1600; static const GroupMessageLengthMax = 1600;
void _sendMessage([String? ignoredParam]) { void _sendMessage([String? ignoredParam]) {
// Trim message
final messageWithoutNewLine = ctrlrCompose.value.text.trimRight();
ctrlrCompose.value = TextEditingValue(text: messageWithoutNewLine);
var isGroup = Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(Provider.of<AppState>(context, listen: false).selectedConversation!)!.isGroup; var isGroup = Provider.of<ProfileInfoState>(context, listen: false).contactList.getContact(Provider.of<AppState>(context, listen: false).selectedConversation!)!.isGroup;
// peers and groups currently have different length constraints (servers can store less)... // peers and groups currently have different length constraints (servers can store less)...
@ -372,11 +376,9 @@ class _MessageViewState extends State<MessageView> {
} }
// Send the message if enter is pressed without the shift key... // Send the message if enter is pressed without the shift key...
void handleKeyPress(event) { void handleKeyPress(RawKeyEvent event) {
var data = event.data as RawKeyEventData; var data = event.data;
if (data.logicalKey == LogicalKeyboardKey.enter && !event.isShiftPressed) { if ((data.logicalKey == LogicalKeyboardKey.enter && !event.isShiftPressed) || data.logicalKey == LogicalKeyboardKey.numpadEnter && !event.isShiftPressed) {
final messageWithoutNewLine = ctrlrCompose.value.text.trimRight();
ctrlrCompose.value = TextEditingValue(text: messageWithoutNewLine);
_sendMessage(); _sendMessage();
} }
} }

View File

@ -17,7 +17,7 @@ class _SplashViewState extends State<SplashView> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
var cwtch = Provider.of<FlwtchState>(context, listen: false).cwtch; var cwtch = Provider.of<FlwtchState>(context, listen: false).cwtch;
if (!cwtch.isL10nInit()) { if (!cwtch.isL10nInit()) {
if (AppLocalizations.of(context) != null && AppLocalizations.of(context)!.newMessageNotificationSimple.isNotEmpty ) { if (AppLocalizations.of(context) != null && AppLocalizations.of(context)!.newMessageNotificationSimple.isNotEmpty) {
cwtch.l10nInit(AppLocalizations.of(context)!.newMessageNotificationSimple, AppLocalizations.of(context)!.newMessageNotificationConversationInfo); cwtch.l10nInit(AppLocalizations.of(context)!.newMessageNotificationSimple, AppLocalizations.of(context)!.newMessageNotificationConversationInfo);
} }
} }

View File

@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at # Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.6.0+25 version: 1.6.1+26
environment: environment:
sdk: ">=2.15.0 <3.0.0" sdk: ">=2.15.0 <3.0.0"