Skip to content

Commit bc34228

Browse files
committed
wip; compose: Support save snippets
TODO: look for a better way to arrange the new compose box We sort the saved snippets by title to be consistent with the web implementation. A subtle nuance of having a compose box in a modal bottom sheet is that the message list page behind will shift when the keyboard is expanded, even though its compose box is not visible anyway. An UX improvement would be preserving the inputs on the saved snippet compose box after the user has navigated away. Fixes: zulip#863
1 parent 4f7dd0d commit bc34228

14 files changed

+1112
-0
lines changed

assets/l10n/app_en.arb

+44
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,50 @@
341341
"@composeBoxAttachFromCameraTooltip": {
342342
"description": "Tooltip for compose box icon to attach an image from the camera to the message."
343343
},
344+
"composeBoxShowSavedSnippetsTooltip": "Show saved snippets",
345+
"@composeBoxShowSavedSnippetsTooltip": {
346+
"description": "Tooltip for compose box icon to show a list of saved snippets."
347+
},
348+
"noSavedSnippets": "No saved snippets",
349+
"@noSavedSnippets": {
350+
"description": "Text to show on the saved snippets bottom sheet when there are no saved snippets."
351+
},
352+
"newSavedSnippetButton": "New",
353+
"@newSavedSnippetButton": {
354+
"description": "Label for adding a new saved snippet."
355+
},
356+
"newSavedSnippetTitle": "New snippet",
357+
"@newSavedSnippetTitle": {
358+
"description": "Title for the bottom sheet to add a new saved snippet."
359+
},
360+
"newSavedSnippetTitleHint": "Title",
361+
"@newSavedSnippetTitleHint": {
362+
"description": "Hint text for the title input when adding a new saved snippet."
363+
},
364+
"newSavedSnippetContentHint": "Content",
365+
"@newSavedSnippetContentHint": {
366+
"description": "Hint text for the content input when adding a new saved snippet."
367+
},
368+
"errorFailedToCreateSavedSnippet": "Failed to create saved snippet",
369+
"@errorFailedToCreateSavedSnippet": {
370+
"description": "Error message when the saved snippet failed to be created."
371+
},
372+
"savedSnippetTitleValidationErrorEmpty": "Title cannot be empty.",
373+
"@savedSnippetTitleValidationErrorEmpty": {
374+
"description": "Validation error message when the title of the saved snippet is empty."
375+
},
376+
"savedSnippetTitleValidationErrorTooLong": "Title length shouldn't be greater than 60 characters.",
377+
"@savedSnippetTitleValidationErrorTooLong": {
378+
"description": "Validation error message when the title of the saved snippet is too long."
379+
},
380+
"savedSnippetContentValidationErrorEmpty": "Content cannot be empty.",
381+
"@savedSnippetContentValidationErrorEmpty": {
382+
"description": "Validation error message when the content of the saved snippet is empty."
383+
},
384+
"savedSnippetContentValidationErrorTooLong": "Content length shouldn't be greater than 10000 characters.",
385+
"@savedSnippetContentValidationErrorTooLong": {
386+
"description": "Validation error message when the content of the saved snippet is too long."
387+
},
344388
"composeBoxGenericContentHint": "Type a message",
345389
"@composeBoxGenericContentHint": {
346390
"description": "Hint text for content input when sending a message."

lib/generated/l10n/zulip_localizations.dart

+66
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,72 @@ abstract class ZulipLocalizations {
561561
/// **'Take a photo'**
562562
String get composeBoxAttachFromCameraTooltip;
563563

564+
/// Tooltip for compose box icon to show a list of saved snippets.
565+
///
566+
/// In en, this message translates to:
567+
/// **'Show saved snippets'**
568+
String get composeBoxShowSavedSnippetsTooltip;
569+
570+
/// Text to show on the saved snippets bottom sheet when there are no saved snippets.
571+
///
572+
/// In en, this message translates to:
573+
/// **'No saved snippets'**
574+
String get noSavedSnippets;
575+
576+
/// Label for adding a new saved snippet.
577+
///
578+
/// In en, this message translates to:
579+
/// **'New'**
580+
String get newSavedSnippetButton;
581+
582+
/// Title for the bottom sheet to add a new saved snippet.
583+
///
584+
/// In en, this message translates to:
585+
/// **'New snippet'**
586+
String get newSavedSnippetTitle;
587+
588+
/// Hint text for the title input when adding a new saved snippet.
589+
///
590+
/// In en, this message translates to:
591+
/// **'Title'**
592+
String get newSavedSnippetTitleHint;
593+
594+
/// Hint text for the content input when adding a new saved snippet.
595+
///
596+
/// In en, this message translates to:
597+
/// **'Content'**
598+
String get newSavedSnippetContentHint;
599+
600+
/// Error message when the saved snippet failed to be created.
601+
///
602+
/// In en, this message translates to:
603+
/// **'Failed to create saved snippet'**
604+
String get errorFailedToCreateSavedSnippet;
605+
606+
/// Validation error message when the title of the saved snippet is empty.
607+
///
608+
/// In en, this message translates to:
609+
/// **'Title cannot be empty.'**
610+
String get savedSnippetTitleValidationErrorEmpty;
611+
612+
/// Validation error message when the title of the saved snippet is too long.
613+
///
614+
/// In en, this message translates to:
615+
/// **'Title length shouldn\'t be greater than 60 characters.'**
616+
String get savedSnippetTitleValidationErrorTooLong;
617+
618+
/// Validation error message when the content of the saved snippet is empty.
619+
///
620+
/// In en, this message translates to:
621+
/// **'Content cannot be empty.'**
622+
String get savedSnippetContentValidationErrorEmpty;
623+
624+
/// Validation error message when the content of the saved snippet is too long.
625+
///
626+
/// In en, this message translates to:
627+
/// **'Content length shouldn\'t be greater than 10000 characters.'**
628+
String get savedSnippetContentValidationErrorTooLong;
629+
564630
/// Hint text for content input when sending a message.
565631
///
566632
/// In en, this message translates to:

lib/generated/l10n/zulip_localizations_ar.dart

+33
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,39 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
270270
@override
271271
String get composeBoxAttachFromCameraTooltip => 'Take a photo';
272272

273+
@override
274+
String get composeBoxShowSavedSnippetsTooltip => 'Show saved snippets';
275+
276+
@override
277+
String get noSavedSnippets => 'No saved snippets';
278+
279+
@override
280+
String get newSavedSnippetButton => 'New';
281+
282+
@override
283+
String get newSavedSnippetTitle => 'New snippet';
284+
285+
@override
286+
String get newSavedSnippetTitleHint => 'Title';
287+
288+
@override
289+
String get newSavedSnippetContentHint => 'Content';
290+
291+
@override
292+
String get errorFailedToCreateSavedSnippet => 'Failed to create saved snippet';
293+
294+
@override
295+
String get savedSnippetTitleValidationErrorEmpty => 'Title cannot be empty.';
296+
297+
@override
298+
String get savedSnippetTitleValidationErrorTooLong => 'Title length shouldn\'t be greater than 60 characters.';
299+
300+
@override
301+
String get savedSnippetContentValidationErrorEmpty => 'Content cannot be empty.';
302+
303+
@override
304+
String get savedSnippetContentValidationErrorTooLong => 'Content length shouldn\'t be greater than 10000 characters.';
305+
273306
@override
274307
String get composeBoxGenericContentHint => 'Type a message';
275308

lib/generated/l10n/zulip_localizations_en.dart

+33
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,39 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
270270
@override
271271
String get composeBoxAttachFromCameraTooltip => 'Take a photo';
272272

273+
@override
274+
String get composeBoxShowSavedSnippetsTooltip => 'Show saved snippets';
275+
276+
@override
277+
String get noSavedSnippets => 'No saved snippets';
278+
279+
@override
280+
String get newSavedSnippetButton => 'New';
281+
282+
@override
283+
String get newSavedSnippetTitle => 'New snippet';
284+
285+
@override
286+
String get newSavedSnippetTitleHint => 'Title';
287+
288+
@override
289+
String get newSavedSnippetContentHint => 'Content';
290+
291+
@override
292+
String get errorFailedToCreateSavedSnippet => 'Failed to create saved snippet';
293+
294+
@override
295+
String get savedSnippetTitleValidationErrorEmpty => 'Title cannot be empty.';
296+
297+
@override
298+
String get savedSnippetTitleValidationErrorTooLong => 'Title length shouldn\'t be greater than 60 characters.';
299+
300+
@override
301+
String get savedSnippetContentValidationErrorEmpty => 'Content cannot be empty.';
302+
303+
@override
304+
String get savedSnippetContentValidationErrorTooLong => 'Content length shouldn\'t be greater than 10000 characters.';
305+
273306
@override
274307
String get composeBoxGenericContentHint => 'Type a message';
275308

lib/generated/l10n/zulip_localizations_ja.dart

+33
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,39 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
270270
@override
271271
String get composeBoxAttachFromCameraTooltip => 'Take a photo';
272272

273+
@override
274+
String get composeBoxShowSavedSnippetsTooltip => 'Show saved snippets';
275+
276+
@override
277+
String get noSavedSnippets => 'No saved snippets';
278+
279+
@override
280+
String get newSavedSnippetButton => 'New';
281+
282+
@override
283+
String get newSavedSnippetTitle => 'New snippet';
284+
285+
@override
286+
String get newSavedSnippetTitleHint => 'Title';
287+
288+
@override
289+
String get newSavedSnippetContentHint => 'Content';
290+
291+
@override
292+
String get errorFailedToCreateSavedSnippet => 'Failed to create saved snippet';
293+
294+
@override
295+
String get savedSnippetTitleValidationErrorEmpty => 'Title cannot be empty.';
296+
297+
@override
298+
String get savedSnippetTitleValidationErrorTooLong => 'Title length shouldn\'t be greater than 60 characters.';
299+
300+
@override
301+
String get savedSnippetContentValidationErrorEmpty => 'Content cannot be empty.';
302+
303+
@override
304+
String get savedSnippetContentValidationErrorTooLong => 'Content length shouldn\'t be greater than 10000 characters.';
305+
273306
@override
274307
String get composeBoxGenericContentHint => 'Type a message';
275308

lib/generated/l10n/zulip_localizations_nb.dart

+33
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,39 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
270270
@override
271271
String get composeBoxAttachFromCameraTooltip => 'Take a photo';
272272

273+
@override
274+
String get composeBoxShowSavedSnippetsTooltip => 'Show saved snippets';
275+
276+
@override
277+
String get noSavedSnippets => 'No saved snippets';
278+
279+
@override
280+
String get newSavedSnippetButton => 'New';
281+
282+
@override
283+
String get newSavedSnippetTitle => 'New snippet';
284+
285+
@override
286+
String get newSavedSnippetTitleHint => 'Title';
287+
288+
@override
289+
String get newSavedSnippetContentHint => 'Content';
290+
291+
@override
292+
String get errorFailedToCreateSavedSnippet => 'Failed to create saved snippet';
293+
294+
@override
295+
String get savedSnippetTitleValidationErrorEmpty => 'Title cannot be empty.';
296+
297+
@override
298+
String get savedSnippetTitleValidationErrorTooLong => 'Title length shouldn\'t be greater than 60 characters.';
299+
300+
@override
301+
String get savedSnippetContentValidationErrorEmpty => 'Content cannot be empty.';
302+
303+
@override
304+
String get savedSnippetContentValidationErrorTooLong => 'Content length shouldn\'t be greater than 10000 characters.';
305+
273306
@override
274307
String get composeBoxGenericContentHint => 'Type a message';
275308

lib/generated/l10n/zulip_localizations_pl.dart

+33
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,39 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
270270
@override
271271
String get composeBoxAttachFromCameraTooltip => 'Zrób zdjęcie';
272272

273+
@override
274+
String get composeBoxShowSavedSnippetsTooltip => 'Show saved snippets';
275+
276+
@override
277+
String get noSavedSnippets => 'No saved snippets';
278+
279+
@override
280+
String get newSavedSnippetButton => 'New';
281+
282+
@override
283+
String get newSavedSnippetTitle => 'New snippet';
284+
285+
@override
286+
String get newSavedSnippetTitleHint => 'Title';
287+
288+
@override
289+
String get newSavedSnippetContentHint => 'Content';
290+
291+
@override
292+
String get errorFailedToCreateSavedSnippet => 'Failed to create saved snippet';
293+
294+
@override
295+
String get savedSnippetTitleValidationErrorEmpty => 'Title cannot be empty.';
296+
297+
@override
298+
String get savedSnippetTitleValidationErrorTooLong => 'Title length shouldn\'t be greater than 60 characters.';
299+
300+
@override
301+
String get savedSnippetContentValidationErrorEmpty => 'Content cannot be empty.';
302+
303+
@override
304+
String get savedSnippetContentValidationErrorTooLong => 'Content length shouldn\'t be greater than 10000 characters.';
305+
273306
@override
274307
String get composeBoxGenericContentHint => 'Wpisz wiadomość';
275308

lib/generated/l10n/zulip_localizations_ru.dart

+33
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,39 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
270270
@override
271271
String get composeBoxAttachFromCameraTooltip => 'Сделать снимок';
272272

273+
@override
274+
String get composeBoxShowSavedSnippetsTooltip => 'Show saved snippets';
275+
276+
@override
277+
String get noSavedSnippets => 'No saved snippets';
278+
279+
@override
280+
String get newSavedSnippetButton => 'New';
281+
282+
@override
283+
String get newSavedSnippetTitle => 'New snippet';
284+
285+
@override
286+
String get newSavedSnippetTitleHint => 'Title';
287+
288+
@override
289+
String get newSavedSnippetContentHint => 'Content';
290+
291+
@override
292+
String get errorFailedToCreateSavedSnippet => 'Failed to create saved snippet';
293+
294+
@override
295+
String get savedSnippetTitleValidationErrorEmpty => 'Title cannot be empty.';
296+
297+
@override
298+
String get savedSnippetTitleValidationErrorTooLong => 'Title length shouldn\'t be greater than 60 characters.';
299+
300+
@override
301+
String get savedSnippetContentValidationErrorEmpty => 'Content cannot be empty.';
302+
303+
@override
304+
String get savedSnippetContentValidationErrorTooLong => 'Content length shouldn\'t be greater than 10000 characters.';
305+
273306
@override
274307
String get composeBoxGenericContentHint => 'Ввести сообщение';
275308

0 commit comments

Comments
 (0)