diff --git a/lib/l10n/intl_cy.arb b/lib/l10n/intl_cy.arb index 787654f7..f20a1f70 100644 --- a/lib/l10n/intl_cy.arb +++ b/lib/l10n/intl_cy.arb @@ -1,6 +1,10 @@ { "@@locale": "cy", - "@@last_modified": "2022-03-11T01:06:46+01:00", + "@@last_modified": "2022-03-21T17:12:38+01:00", + "clickableLinkError": "Error encountered while attempting to open URL", + "clickableLinksCopy": "Copy URL", + "clickableLinkOpen": "Open URL", + "clickableLinksWarning": "Opening this URL will launch an application outside of Cwtch and may reveal metadata or otherwise compromise the security of Cwtch. Only open URLs from people you trust. Are you sure you want to continue?", "shuttingDownApp": "Shutting down...", "successfullyImportedProfile": "Successfully Imported Profile: %profile", "failedToImportProfile": "Error Importing Profile", diff --git a/lib/l10n/intl_da.arb b/lib/l10n/intl_da.arb index 83c5aac6..ec8aabf3 100644 --- a/lib/l10n/intl_da.arb +++ b/lib/l10n/intl_da.arb @@ -1,6 +1,10 @@ { "@@locale": "da", - "@@last_modified": "2022-03-11T01:06:46+01:00", + "@@last_modified": "2022-03-21T17:12:38+01:00", + "clickableLinkError": "Error encountered while attempting to open URL", + "clickableLinksCopy": "Copy URL", + "clickableLinkOpen": "Open URL", + "clickableLinksWarning": "Opening this URL will launch an application outside of Cwtch and may reveal metadata or otherwise compromise the security of Cwtch. Only open URLs from people you trust. Are you sure you want to continue?", "shuttingDownApp": "Shutting down...", "successfullyImportedProfile": "Successfully Imported Profile: %profile", "failedToImportProfile": "Error Importing Profile", diff --git a/lib/l10n/intl_de.arb b/lib/l10n/intl_de.arb index 001ced72..10ca9df0 100644 --- a/lib/l10n/intl_de.arb +++ b/lib/l10n/intl_de.arb @@ -1,6 +1,10 @@ { "@@locale": "de", - "@@last_modified": "2022-03-11T01:06:46+01:00", + "@@last_modified": "2022-03-21T17:12:38+01:00", + "clickableLinkError": "Error encountered while attempting to open URL", + "clickableLinksCopy": "Copy URL", + "clickableLinkOpen": "Open URL", + "clickableLinksWarning": "Opening this URL will launch an application outside of Cwtch and may reveal metadata or otherwise compromise the security of Cwtch. Only open URLs from people you trust. Are you sure you want to continue?", "shuttingDownApp": "Shutting down...", "successfullyImportedProfile": "Successfully Imported Profile: %profile", "failedToImportProfile": "Error Importing Profile", diff --git a/lib/l10n/intl_el.arb b/lib/l10n/intl_el.arb index 7c8f3f6b..51ee2c2c 100644 --- a/lib/l10n/intl_el.arb +++ b/lib/l10n/intl_el.arb @@ -1,6 +1,10 @@ { "@@locale": "el", - "@@last_modified": "2022-03-11T01:06:46+01:00", + "@@last_modified": "2022-03-21T17:12:38+01:00", + "clickableLinkError": "Error encountered while attempting to open URL", + "clickableLinksCopy": "Copy URL", + "clickableLinkOpen": "Open URL", + "clickableLinksWarning": "Opening this URL will launch an application outside of Cwtch and may reveal metadata or otherwise compromise the security of Cwtch. Only open URLs from people you trust. Are you sure you want to continue?", "shuttingDownApp": "Shutting down...", "successfullyImportedProfile": "Successfully Imported Profile: %profile", "failedToImportProfile": "Error Importing Profile", diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 2fc132df..ab9ba40f 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -1,6 +1,10 @@ { "@@locale": "en", - "@@last_modified": "2022-03-11T01:06:46+01:00", + "@@last_modified": "2022-03-21T17:12:38+01:00", + "clickableLinkError": "Error encountered while attempting to open URL", + "clickableLinksWarning": "Opening this URL will launch an application outside of Cwtch and may reveal metadata or otherwise compromise the security of Cwtch. Only open URLs from people you trust. Are you sure you want to continue?", + "clickableLinksCopy": "Copy URL", + "clickableLinkOpen": "Open URL", "shuttingDownApp": "Shutting down...", "successfullyImportedProfile": "Successfully Imported Profile: %profile", "failedToImportProfile": "Error Importing Profile", diff --git a/lib/l10n/intl_es.arb b/lib/l10n/intl_es.arb index 0bc2cc72..d152034e 100644 --- a/lib/l10n/intl_es.arb +++ b/lib/l10n/intl_es.arb @@ -1,6 +1,10 @@ { "@@locale": "es", - "@@last_modified": "2022-03-11T01:06:46+01:00", + "@@last_modified": "2022-03-21T17:12:38+01:00", + "clickableLinkError": "Error encountered while attempting to open URL", + "clickableLinksCopy": "Copy URL", + "clickableLinkOpen": "Open URL", + "clickableLinksWarning": "Opening this URL will launch an application outside of Cwtch and may reveal metadata or otherwise compromise the security of Cwtch. Only open URLs from people you trust. Are you sure you want to continue?", "shuttingDownApp": "Shutting down...", "successfullyImportedProfile": "Successfully Imported Profile: %profile", "failedToImportProfile": "Error Importing Profile", diff --git a/lib/l10n/intl_fr.arb b/lib/l10n/intl_fr.arb index be859fa4..ff335af2 100644 --- a/lib/l10n/intl_fr.arb +++ b/lib/l10n/intl_fr.arb @@ -1,16 +1,20 @@ { "@@locale": "fr", - "@@last_modified": "2022-03-11T01:06:46+01:00", - "shuttingDownApp": "Shutting down...", - "successfullyImportedProfile": "Successfully Imported Profile: %profile", - "failedToImportProfile": "Error Importing Profile", - "importProfileTooltip": "Use an encrypted Cwtch backup to bring in a profile created in another instance of Cwtch.", - "importProfile": "Import Profile", - "exportProfileTooltip": "Backup this profile to an encrypted file. The encrypted file can be imported into another Cwtch app.", - "exportProfile": "Export Profile", + "@@last_modified": "2022-03-21T17:12:38+01:00", + "clickableLinkError": "Error encountered while attempting to open URL", + "clickableLinksCopy": "Copy URL", + "clickableLinkOpen": "Open URL", + "clickableLinksWarning": "Opening this URL will launch an application outside of Cwtch and may reveal metadata or otherwise compromise the security of Cwtch. Only open URLs from people you trust. Are you sure you want to continue?", + "acceptGroupBtn": "Accepter", + "successfullyImportedProfile": "Profil importé avec succès : %profile", + "shuttingDownApp": "Fermeture...", + "importProfileTooltip": "Utilisez une sauvegarde Cwtch chiffrée pour importer un profil créé dans une autre instance de Cwtch.", + "exportProfile": "Exporter un profile", + "importProfile": "Importer un profil", + "failedToImportProfile": "Erreur lors de l'importation du profil", + "exportProfileTooltip": "Sauvegardez ce profil dans un fichier chiffré. Le fichier crypté peut être importé dans une autre application Cwtch.", "contactSuggestion": "Il s'agit d'une suggestion de contact pour:", "contactGoto": "Aller à la conversation avec %1", - "acceptGroupBtn": "Accepter", "yourDisplayName": "Votre nom d'usage", "profileName": "Nom d'usage", "displayNameLabel": "Nom d'usage", diff --git a/lib/l10n/intl_it.arb b/lib/l10n/intl_it.arb index f8ba429b..eba5a9ed 100644 --- a/lib/l10n/intl_it.arb +++ b/lib/l10n/intl_it.arb @@ -1,6 +1,10 @@ { "@@locale": "it", - "@@last_modified": "2022-03-11T01:06:46+01:00", + "@@last_modified": "2022-03-21T17:12:38+01:00", + "clickableLinkError": "Error encountered while attempting to open URL", + "clickableLinksCopy": "Copy URL", + "clickableLinkOpen": "Open URL", + "clickableLinksWarning": "Opening this URL will launch an application outside of Cwtch and may reveal metadata or otherwise compromise the security of Cwtch. Only open URLs from people you trust. Are you sure you want to continue?", "shuttingDownApp": "Shutting down...", "successfullyImportedProfile": "Successfully Imported Profile: %profile", "failedToImportProfile": "Error Importing Profile", diff --git a/lib/l10n/intl_lb.arb b/lib/l10n/intl_lb.arb index 1f570db0..24775d1c 100644 --- a/lib/l10n/intl_lb.arb +++ b/lib/l10n/intl_lb.arb @@ -1,6 +1,10 @@ { "@@locale": "lb", - "@@last_modified": "2022-03-11T01:06:46+01:00", + "@@last_modified": "2022-03-21T17:12:38+01:00", + "clickableLinkError": "Error encountered while attempting to open URL", + "clickableLinksCopy": "Copy URL", + "clickableLinkOpen": "Open URL", + "clickableLinksWarning": "Opening this URL will launch an application outside of Cwtch and may reveal metadata or otherwise compromise the security of Cwtch. Only open URLs from people you trust. Are you sure you want to continue?", "shuttingDownApp": "Shutting down...", "successfullyImportedProfile": "Successfully Imported Profile: %profile", "failedToImportProfile": "Error Importing Profile", diff --git a/lib/l10n/intl_no.arb b/lib/l10n/intl_no.arb index b30ed5ee..757ef74c 100644 --- a/lib/l10n/intl_no.arb +++ b/lib/l10n/intl_no.arb @@ -1,6 +1,10 @@ { "@@locale": "no", - "@@last_modified": "2022-03-11T01:06:46+01:00", + "@@last_modified": "2022-03-21T17:12:38+01:00", + "clickableLinkError": "Error encountered while attempting to open URL", + "clickableLinksCopy": "Copy URL", + "clickableLinkOpen": "Open URL", + "clickableLinksWarning": "Opening this URL will launch an application outside of Cwtch and may reveal metadata or otherwise compromise the security of Cwtch. Only open URLs from people you trust. Are you sure you want to continue?", "shuttingDownApp": "Shutting down...", "successfullyImportedProfile": "Successfully Imported Profile: %profile", "failedToImportProfile": "Error Importing Profile", diff --git a/lib/l10n/intl_pl.arb b/lib/l10n/intl_pl.arb index a8608aa8..3112a927 100644 --- a/lib/l10n/intl_pl.arb +++ b/lib/l10n/intl_pl.arb @@ -1,6 +1,10 @@ { "@@locale": "pl", - "@@last_modified": "2022-03-11T01:06:46+01:00", + "@@last_modified": "2022-03-21T17:12:38+01:00", + "clickableLinkError": "Error encountered while attempting to open URL", + "clickableLinksCopy": "Copy URL", + "clickableLinkOpen": "Open URL", + "clickableLinksWarning": "Opening this URL will launch an application outside of Cwtch and may reveal metadata or otherwise compromise the security of Cwtch. Only open URLs from people you trust. Are you sure you want to continue?", "shuttingDownApp": "Shutting down...", "successfullyImportedProfile": "Successfully Imported Profile: %profile", "failedToImportProfile": "Error Importing Profile", diff --git a/lib/l10n/intl_pt.arb b/lib/l10n/intl_pt.arb index 580fe3aa..3c06aa20 100644 --- a/lib/l10n/intl_pt.arb +++ b/lib/l10n/intl_pt.arb @@ -1,6 +1,10 @@ { "@@locale": "pt", - "@@last_modified": "2022-03-11T01:06:46+01:00", + "@@last_modified": "2022-03-21T17:12:38+01:00", + "clickableLinkError": "Error encountered while attempting to open URL", + "clickableLinksCopy": "Copy URL", + "clickableLinkOpen": "Open URL", + "clickableLinksWarning": "Opening this URL will launch an application outside of Cwtch and may reveal metadata or otherwise compromise the security of Cwtch. Only open URLs from people you trust. Are you sure you want to continue?", "shuttingDownApp": "Shutting down...", "successfullyImportedProfile": "Successfully Imported Profile: %profile", "failedToImportProfile": "Error Importing Profile", diff --git a/lib/l10n/intl_ro.arb b/lib/l10n/intl_ro.arb index 142462ed..bba77430 100644 --- a/lib/l10n/intl_ro.arb +++ b/lib/l10n/intl_ro.arb @@ -1,6 +1,10 @@ { "@@locale": "ro", - "@@last_modified": "2022-03-11T01:06:46+01:00", + "@@last_modified": "2022-03-21T17:12:38+01:00", + "clickableLinkError": "Error encountered while attempting to open URL", + "clickableLinksCopy": "Copy URL", + "clickableLinkOpen": "Open URL", + "clickableLinksWarning": "Opening this URL will launch an application outside of Cwtch and may reveal metadata or otherwise compromise the security of Cwtch. Only open URLs from people you trust. Are you sure you want to continue?", "shuttingDownApp": "Shutting down...", "successfullyImportedProfile": "Successfully Imported Profile: %profile", "failedToImportProfile": "Error Importing Profile", diff --git a/lib/l10n/intl_ru.arb b/lib/l10n/intl_ru.arb index aa62972d..f85e4c26 100644 --- a/lib/l10n/intl_ru.arb +++ b/lib/l10n/intl_ru.arb @@ -1,6 +1,10 @@ { "@@locale": "ru", - "@@last_modified": "2022-03-11T01:06:46+01:00", + "@@last_modified": "2022-03-21T17:12:38+01:00", + "clickableLinkError": "Error encountered while attempting to open URL", + "clickableLinksCopy": "Copy URL", + "clickableLinkOpen": "Open URL", + "clickableLinksWarning": "Opening this URL will launch an application outside of Cwtch and may reveal metadata or otherwise compromise the security of Cwtch. Only open URLs from people you trust. Are you sure you want to continue?", "shuttingDownApp": "Shutting down...", "successfullyImportedProfile": "Successfully Imported Profile: %profile", "failedToImportProfile": "Error Importing Profile", diff --git a/lib/views/messageview.dart b/lib/views/messageview.dart index ecdc6527..204a455f 100644 --- a/lib/views/messageview.dart +++ b/lib/views/messageview.dart @@ -199,7 +199,13 @@ class _MessageViewState extends State { void _sendMessage([String? ignoredParam]) { // Trim message final messageWithoutNewLine = ctrlrCompose.value.text.trimRight(); - ctrlrCompose.value = TextEditingValue(text: messageWithoutNewLine); + ctrlrCompose.value = TextEditingValue(text: messageWithoutNewLine, selection: TextSelection.fromPosition(TextPosition(offset: messageWithoutNewLine.length))); + + // Do this after we trim to preserve enter-behaviour... + bool isOffline = Provider.of(context).isOnline() == false; + if (isOffline) { + return; + } var isGroup = Provider.of(context, listen: false).contactList.getContact(Provider.of(context, listen: false).selectedConversation!)!.isGroup; @@ -302,7 +308,7 @@ class _MessageViewState extends State { maxLengthEnforcement: MaxLengthEnforcement.enforced, maxLines: null, onFieldSubmitted: _sendMessage, - enabled: !isOffline, + enabled: true, // always allow editing... onChanged: (String x) { setState(() { // we need to force a rerender here to update the max length count diff --git a/lib/views/splashView.dart b/lib/views/splashView.dart index d74d5285..ffdc2df0 100644 --- a/lib/views/splashView.dart +++ b/lib/views/splashView.dart @@ -49,8 +49,9 @@ class _SplashViewState extends State { ? appState.appError : appState.modalState == ModalState.none ? AppLocalizations.of(context)!.loadingCwtch - : appState.modalState == ModalState.storageMigration ? AppLocalizations.of(context)!.storageMigrationModalMessage - : AppLocalizations.of(context)!.shuttingDownApp, // Todo l10n AppLocalizations.of(context)!.storageMigrationModalMessage + : appState.modalState == ModalState.storageMigration + ? AppLocalizations.of(context)!.storageMigrationModalMessage + : AppLocalizations.of(context)!.shuttingDownApp, // Todo l10n AppLocalizations.of(context)!.storageMigrationModalMessage style: TextStyle( fontSize: 16.0, color: appState.appError == "" ? Provider.of(context).theme.mainTextColor : Provider.of(context).theme.textfieldErrorColor))), Visibility( diff --git a/lib/widgets/messagebubble.dart b/lib/widgets/messagebubble.dart index 3860e6a4..08312af6 100644 --- a/lib/widgets/messagebubble.dart +++ b/lib/widgets/messagebubble.dart @@ -129,13 +129,12 @@ class MessageBubbleState extends State { mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: [ - Text( - "Opening this link will launch an application outside of Cwtch and may reveal metadata or otherwise compromise the security of Cwtch. Only open links from people you trust. Are you sure you want to continue?"), + Text(AppLocalizations.of(context)!.clickableLinksWarning), Flex(direction: Axis.horizontal, mainAxisAlignment: MainAxisAlignment.center, children: [ Container( margin: EdgeInsets.symmetric(vertical: 20, horizontal: 10), child: ElevatedButton( - child: Text("Copy link", semanticsLabel: "Copy link"), + child: Text(AppLocalizations.of(context)!.clickableLinksCopy, semanticsLabel: AppLocalizations.of(context)!.clickableLinksCopy), onPressed: () { Clipboard.setData(new ClipboardData(text: link.url)); @@ -151,13 +150,16 @@ class MessageBubbleState extends State { Container( margin: EdgeInsets.symmetric(vertical: 20, horizontal: 10), child: ElevatedButton( - child: Text("Open link", semanticsLabel: "Open link"), + child: Text(AppLocalizations.of(context)!.clickableLinkOpen, semanticsLabel: AppLocalizations.of(context)!.clickableLinkOpen), onPressed: () async { if (await canLaunch(link.url)) { await launch(link.url); Navigator.pop(bcontext); } else { - throw 'Could not launch $link'; + final snackBar = SnackBar( + content: Text(AppLocalizations.of(context)!.clickableLinkError), + ); + ScaffoldMessenger.of(context).showSnackBar(snackBar); } }, ),