diff --git a/assets/themes/christmas/background.jxl b/assets/themes/christmas/background.jxl new file mode 100644 index 00000000..9e018072 Binary files /dev/null and b/assets/themes/christmas/background.jxl differ diff --git a/assets/themes/christmas/channels.jxl b/assets/themes/christmas/channels.jxl new file mode 100644 index 00000000..b4fd771f Binary files /dev/null and b/assets/themes/christmas/channels.jxl differ diff --git a/assets/themes/christmas/contacts.jxl b/assets/themes/christmas/contacts.jxl new file mode 100644 index 00000000..605e6b7f Binary files /dev/null and b/assets/themes/christmas/contacts.jxl differ diff --git a/assets/themes/christmas/map.jxl b/assets/themes/christmas/map.jxl new file mode 100644 index 00000000..a1d040a8 Binary files /dev/null and b/assets/themes/christmas/map.jxl differ diff --git a/assets/themes/christmas/map_chat.jxl b/assets/themes/christmas/map_chat.jxl new file mode 100644 index 00000000..6254dd62 Binary files /dev/null and b/assets/themes/christmas/map_chat.jxl differ diff --git a/assets/themes/christmas/map_repeater.jxl b/assets/themes/christmas/map_repeater.jxl new file mode 100644 index 00000000..5aa3f9fd Binary files /dev/null and b/assets/themes/christmas/map_repeater.jxl differ diff --git a/assets/themes/christmas/map_room.jxl b/assets/themes/christmas/map_room.jxl new file mode 100644 index 00000000..a3d34896 Binary files /dev/null and b/assets/themes/christmas/map_room.jxl differ diff --git a/assets/themes/christmas/map_self.jxl b/assets/themes/christmas/map_self.jxl new file mode 100644 index 00000000..5c5ac7de Binary files /dev/null and b/assets/themes/christmas/map_self.jxl differ diff --git a/assets/themes/christmas/map_sensor.jxl b/assets/themes/christmas/map_sensor.jxl new file mode 100644 index 00000000..c3410bf2 Binary files /dev/null and b/assets/themes/christmas/map_sensor.jxl differ diff --git a/assets/themes/christmas/send.jxl b/assets/themes/christmas/send.jxl new file mode 100644 index 00000000..8b9b8a4d Binary files /dev/null and b/assets/themes/christmas/send.jxl differ diff --git a/assets/themes/halloween/background.jxl b/assets/themes/halloween/background.jxl new file mode 100644 index 00000000..dabb6e2c Binary files /dev/null and b/assets/themes/halloween/background.jxl differ diff --git a/assets/themes/halloween/channels.jxl b/assets/themes/halloween/channels.jxl new file mode 100644 index 00000000..fa827b0a Binary files /dev/null and b/assets/themes/halloween/channels.jxl differ diff --git a/assets/themes/halloween/contacts.jxl b/assets/themes/halloween/contacts.jxl new file mode 100644 index 00000000..d5d8f7ce Binary files /dev/null and b/assets/themes/halloween/contacts.jxl differ diff --git a/assets/themes/halloween/map.jxl b/assets/themes/halloween/map.jxl new file mode 100644 index 00000000..357f2be6 Binary files /dev/null and b/assets/themes/halloween/map.jxl differ diff --git a/assets/themes/halloween/map_chat.jxl b/assets/themes/halloween/map_chat.jxl new file mode 100644 index 00000000..7c743afe Binary files /dev/null and b/assets/themes/halloween/map_chat.jxl differ diff --git a/assets/themes/halloween/map_repeater.jxl b/assets/themes/halloween/map_repeater.jxl new file mode 100644 index 00000000..6a1b21fa Binary files /dev/null and b/assets/themes/halloween/map_repeater.jxl differ diff --git a/assets/themes/halloween/map_room.jxl b/assets/themes/halloween/map_room.jxl new file mode 100644 index 00000000..d455975d Binary files /dev/null and b/assets/themes/halloween/map_room.jxl differ diff --git a/assets/themes/halloween/map_self.jxl b/assets/themes/halloween/map_self.jxl new file mode 100644 index 00000000..2621bb9a Binary files /dev/null and b/assets/themes/halloween/map_self.jxl differ diff --git a/assets/themes/halloween/map_sensor.jxl b/assets/themes/halloween/map_sensor.jxl new file mode 100644 index 00000000..bfbfef4a Binary files /dev/null and b/assets/themes/halloween/map_sensor.jxl differ diff --git a/assets/themes/halloween/send.jxl b/assets/themes/halloween/send.jxl new file mode 100644 index 00000000..fad8f060 Binary files /dev/null and b/assets/themes/halloween/send.jxl differ diff --git a/assets/themes/new_year/background.jxl b/assets/themes/new_year/background.jxl new file mode 100644 index 00000000..46af88bb Binary files /dev/null and b/assets/themes/new_year/background.jxl differ diff --git a/assets/themes/new_year/channels.jxl b/assets/themes/new_year/channels.jxl new file mode 100644 index 00000000..0c76c917 Binary files /dev/null and b/assets/themes/new_year/channels.jxl differ diff --git a/assets/themes/new_year/contacts.jxl b/assets/themes/new_year/contacts.jxl new file mode 100644 index 00000000..d1297298 Binary files /dev/null and b/assets/themes/new_year/contacts.jxl differ diff --git a/assets/themes/new_year/map.jxl b/assets/themes/new_year/map.jxl new file mode 100644 index 00000000..0a10bef5 Binary files /dev/null and b/assets/themes/new_year/map.jxl differ diff --git a/assets/themes/new_year/map_chat.jxl b/assets/themes/new_year/map_chat.jxl new file mode 100644 index 00000000..19184dbb Binary files /dev/null and b/assets/themes/new_year/map_chat.jxl differ diff --git a/assets/themes/new_year/map_repeater.jxl b/assets/themes/new_year/map_repeater.jxl new file mode 100644 index 00000000..3e30ea93 Binary files /dev/null and b/assets/themes/new_year/map_repeater.jxl differ diff --git a/assets/themes/new_year/map_room.jxl b/assets/themes/new_year/map_room.jxl new file mode 100644 index 00000000..d36a40be Binary files /dev/null and b/assets/themes/new_year/map_room.jxl differ diff --git a/assets/themes/new_year/map_self.jxl b/assets/themes/new_year/map_self.jxl new file mode 100644 index 00000000..ff97a95a Binary files /dev/null and b/assets/themes/new_year/map_self.jxl differ diff --git a/assets/themes/new_year/map_sensor.jxl b/assets/themes/new_year/map_sensor.jxl new file mode 100644 index 00000000..d791f226 Binary files /dev/null and b/assets/themes/new_year/map_sensor.jxl differ diff --git a/assets/themes/new_year/send.jxl b/assets/themes/new_year/send.jxl new file mode 100644 index 00000000..fae76828 Binary files /dev/null and b/assets/themes/new_year/send.jxl differ diff --git a/assets/themes/thanksgiving/background.jxl b/assets/themes/thanksgiving/background.jxl new file mode 100644 index 00000000..0a580b11 Binary files /dev/null and b/assets/themes/thanksgiving/background.jxl differ diff --git a/assets/themes/thanksgiving/channels.jxl b/assets/themes/thanksgiving/channels.jxl new file mode 100644 index 00000000..05d055ff Binary files /dev/null and b/assets/themes/thanksgiving/channels.jxl differ diff --git a/assets/themes/thanksgiving/contacts.jxl b/assets/themes/thanksgiving/contacts.jxl new file mode 100644 index 00000000..d6328c84 Binary files /dev/null and b/assets/themes/thanksgiving/contacts.jxl differ diff --git a/assets/themes/thanksgiving/map.jxl b/assets/themes/thanksgiving/map.jxl new file mode 100644 index 00000000..b675c967 Binary files /dev/null and b/assets/themes/thanksgiving/map.jxl differ diff --git a/assets/themes/thanksgiving/map_chat.jxl b/assets/themes/thanksgiving/map_chat.jxl new file mode 100644 index 00000000..be0a2946 Binary files /dev/null and b/assets/themes/thanksgiving/map_chat.jxl differ diff --git a/assets/themes/thanksgiving/map_repeater.jxl b/assets/themes/thanksgiving/map_repeater.jxl new file mode 100644 index 00000000..cb5cf604 Binary files /dev/null and b/assets/themes/thanksgiving/map_repeater.jxl differ diff --git a/assets/themes/thanksgiving/map_room.jxl b/assets/themes/thanksgiving/map_room.jxl new file mode 100644 index 00000000..bfd80b37 Binary files /dev/null and b/assets/themes/thanksgiving/map_room.jxl differ diff --git a/assets/themes/thanksgiving/map_self.jxl b/assets/themes/thanksgiving/map_self.jxl new file mode 100644 index 00000000..57399243 Binary files /dev/null and b/assets/themes/thanksgiving/map_self.jxl differ diff --git a/assets/themes/thanksgiving/map_sensor.jxl b/assets/themes/thanksgiving/map_sensor.jxl new file mode 100644 index 00000000..eb81cb4b Binary files /dev/null and b/assets/themes/thanksgiving/map_sensor.jxl differ diff --git a/assets/themes/thanksgiving/send.jxl b/assets/themes/thanksgiving/send.jxl new file mode 100644 index 00000000..f7bd58f3 Binary files /dev/null and b/assets/themes/thanksgiving/send.jxl differ diff --git a/lib/helpers/holiday_triggers.dart b/lib/helpers/holiday_triggers.dart new file mode 100644 index 00000000..a046ade8 --- /dev/null +++ b/lib/helpers/holiday_triggers.dart @@ -0,0 +1,96 @@ +/// Animation trigger messages: holiday greetings that play a short +/// full-screen animation when they arrive in (or are sent to) an open chat. +/// +/// The greetings are translation strings (`holidayGreeting_*` in the ARB +/// files, alternatives separated by `|`). A message is checked against the +/// greetings of *every* app language, since the sender may write in any of +/// them, and matching ignores case and punctuation. +library; + +import 'dart:ui' show Locale; + +import '../l10n/app_localizations.dart'; + +enum HolidayAnimation { halloween, thanksgiving, christmas, newYear } + +/// The greeting string for [animation] in one language. +String holidayGreetingsIn(AppLocalizations l10n, HolidayAnimation animation) => + switch (animation) { + HolidayAnimation.halloween => l10n.holidayGreeting_halloween, + HolidayAnimation.thanksgiving => l10n.holidayGreeting_thanksgiving, + HolidayAnimation.christmas => l10n.holidayGreeting_christmas, + HolidayAnimation.newYear => l10n.holidayGreeting_newYear, + }; + +final RegExp _apostrophes = RegExp("['’‘`´]"); +final RegExp _nonWord = RegExp(r'[^\p{L}\p{N}]+', unicode: true); + +/// Scripts written without spaces between words; their greetings are +/// matched anywhere in the text. +final RegExp _unspacedScript = RegExp(r'[぀-ヿ㐀-鿿豈-﫿]'); + +/// Lowercase, without apostrophes, with every run of punctuation or spaces +/// turned into a single space. +String _normalize(String text) => text + .toLowerCase() + .replaceAll(_apostrophes, '') + .replaceAll(_nonWord, ' ') + .trim(); + +class _Matcher { + final HolidayAnimation animation; + + /// Whole-word phrase with surrounding spaces, e.g. " happy new year ". + final String spaced; + + /// The phrase with spaces removed, for hashtags and unspaced scripts. + final String joined; + final bool unspaced; + + _Matcher(this.animation, String normalized) + : spaced = ' $normalized ', + joined = normalized.replaceAll(' ', ''), + unspaced = _unspacedScript.hasMatch(normalized); +} + +/// Matchers for every greeting in every supported language. +List<_Matcher> _buildMatchers() { + final seen = <(HolidayAnimation, String)>{}; + final matchers = <_Matcher>[]; + for (final locale in AppLocalizations.supportedLocales) { + final l10n = lookupAppLocalizations(Locale(locale.languageCode)); + for (final animation in HolidayAnimation.values) { + for (final phrase in holidayGreetingsIn(l10n, animation).split('|')) { + final normalized = _normalize(phrase); + // Skip blanks and greetings too short to be meaningful on their own. + if (normalized.replaceAll(' ', '').length < 3) continue; + if (seen.add((animation, normalized))) { + matchers.add(_Matcher(animation, normalized)); + } + } + } + } + return matchers; +} + +final List<_Matcher> _matchers = _buildMatchers(); + +/// The animation [text] triggers, or null. Greetings must be whole words +/// ("feliz natalia" is not "feliz natal"), except in scripts written +/// without spaces. A greeting run together as one word ("#HappyNewYear") +/// also counts. +HolidayAnimation? holidayAnimationFor(String text) { + if (text.isEmpty) return null; + final normalized = _normalize(text); + if (normalized.isEmpty) return null; + final spaced = ' $normalized '; + final joined = normalized.replaceAll(' ', ''); + for (final m in _matchers) { + if (m.unspaced) { + if (joined.contains(m.joined)) return m.animation; + } else if (spaced.contains(m.spaced) || spaced.contains(' ${m.joined} ')) { + return m.animation; + } + } + return null; +} diff --git a/lib/l10n/app_bg.arb b/lib/l10n/app_bg.arb index fc2c1495..6dae2312 100644 --- a/lib/l10n/app_bg.arb +++ b/lib/l10n/app_bg.arb @@ -3455,5 +3455,9 @@ "networkMap_manage": "Управление", "networkMap_addedToContacts": "Добавено към контактите", "networkMap_addFailed": "Неуспешно добавяне към контактите", - "networkMap_unnamed": "Неназован повторител" + "networkMap_unnamed": "Неназован повторител", + "holidayGreeting_halloween": "Честит Хелоуин|Весел Хелоуин", + "holidayGreeting_thanksgiving": "Честит Ден на благодарността", + "holidayGreeting_christmas": "Весела Коледа|Честито Рождество", + "holidayGreeting_newYear": "Честита Нова година|Щастлива Нова година" } diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index 9bc45f09..4f05fb61 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -3590,5 +3590,9 @@ "networkMap_manage": "Verwalten", "networkMap_addedToContacts": "Zu Kontakten hinzugefügt", "networkMap_addFailed": "Hinzufügen zu Kontakten fehlgeschlagen", - "networkMap_unnamed": "Unbenannter Repeater" + "networkMap_unnamed": "Unbenannter Repeater", + "holidayGreeting_halloween": "Frohes Halloween|Fröhliches Halloween", + "holidayGreeting_thanksgiving": "Frohes Thanksgiving|Schönes Thanksgiving|Frohes Erntedankfest", + "holidayGreeting_christmas": "Frohe Weihnachten|Fröhliche Weihnachten", + "holidayGreeting_newYear": "Frohes neues Jahr|Gutes neues Jahr|Guten Rutsch|Prosit Neujahr" } diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index f5ec0a9a..28d7e89a 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -360,6 +360,118 @@ "appSettings_themeSystem": "System default", "appSettings_themeLight": "Light", "appSettings_themeDark": "Dark", + "appSettings_colorTheme": "Color theme", + "appSettings_holidayAnimations": "Holiday message animations", + "appSettings_holidayAnimationsSubtitle": "Bats, a turkey, Santa or fireworks when someone sends a holiday greeting", + "themes_title": "Themes", + "themes_default": "MeshCore", + "themes_defaultSubtitle": "Standard colors, follows the Light / Dark setting", + "themes_builtIn": "Built-in", + "themes_holidays": "Holidays", + "themes_holidayAutoSwitch": "Switch automatically", + "themes_holidayAutoSwitchSubtitle": "Uses each holiday's theme from 17 days before until the day itself", + "themes_holidayAutoApplied": "{holiday} theme is on automatically. Your own theme comes back after the holiday.", + "@themes_holidayAutoApplied": { + "placeholders": { + "holiday": { + "type": "String" + } + } + }, + "themes_holidayAutoAppliedTag": "On automatically", + "themes_myThemes": "My themes", + "themes_myThemesEmpty": "Make your own theme by picking a background and an accent color.", + "themes_create": "Create theme", + "themes_import": "Import theme", + "themes_importHint": "Paste a theme code", + "themes_importInvalid": "That is not a valid theme code", + "themes_imported": "Added theme \"{name}\"", + "@themes_imported": { + "placeholders": { + "name": { + "type": "String" + } + } + }, + "themes_customize": "Customize a copy", + "themes_copyCode": "Copy theme code", + "themes_codeCopied": "Theme code copied", + "themes_deleteConfirm": "Delete theme \"{name}\"?", + "@themes_deleteConfirm": { + "placeholders": { + "name": { + "type": "String" + } + } + }, + "themes_copyName": "{name} copy", + "@themes_copyName": { + "placeholders": { + "name": { + "type": "String" + } + } + }, + "themes_newTitle": "New theme", + "themes_editTitle": "Edit theme", + "themes_name": "Name", + "themes_nameRequired": "Give your theme a name", + "themes_background": "Background", + "themes_backgroundHelp": "A dark background makes a dark theme", + "themes_accent": "Accent", + "themes_accentHelp": "Buttons, highlights and your chat bubbles", + "themes_hexColor": "Hex color", + "themes_preview": "Preview", + "themes_previewIncoming": "Anyone on the mesh tonight?", + "themes_previewOutgoing": "Loud and clear!", + "themes_previewSwitch": "Notifications", + "themes_lowContrast": "The accent is hard to see on this background", + "themes_saveAndUse": "Save and use", + "themes_icons": "Icons", + "themes_iconsHelp": "Tap an icon to swap it for another icon or your own picture", + "themes_iconChanged": "Changed", + "themes_iconSend": "Send button", + "themes_iconRepeater": "Repeaters", + "themes_iconRoom": "Rooms", + "themes_iconSensor": "Sensors", + "themes_mapMarkers": "Map markers", + "themes_mapMarkersHelp": "Swap the markers for nodes and for you on the map", + "themes_iconUsePicture": "Use a picture", + "themes_iconReset": "Use the default icon", + "themes_iconPictureFailed": "Could not use that picture", + "themes_exportFile": "Export to file", + "themes_exportAll": "Export my themes", + "themes_importFile": "Import from file", + "themes_pasteCode": "Paste theme code", + "themes_exportFailed": "Could not export themes", + "themes_importFileResult": "Imported {count} themes", + "@themes_importFileResult": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "themes_importFileNone": "No themes found in that file", + "chatBackground_title": "Chat background", + "chatBackground_thisChatOnly": "Only for this chat", + "chatBackground_themeOverrides": "Your theme \"{name}\" sets the background in every chat. Turn that off in the theme to use this one.", + "@chatBackground_themeOverrides": { + "placeholders": { + "name": { + "type": "String" + } + } + }, + "chatBackground_none": "None", + "chatBackground_picture": "Picture", + "chatBackground_choosePicture": "Choose a picture", + "chatBackground_pictureFailed": "Could not use that picture", + "chatBackground_fade": "Fade", + "themes_chatBackground": "Chat background", + "themes_chatBackgroundHelp": "Shown in chats that do not have their own background", + "themes_chatBackgroundEverywhere": "Use in every chat", + "themes_chatBackgroundEverywhereHelp": "Also replaces backgrounds set on individual chats", "appSettings_language": "Language", "appSettings_languageSystem": "System default", "appSettings_languageEn": "English", @@ -3624,5 +3736,21 @@ "networkMap_manage": "Manage", "networkMap_addedToContacts": "Added to contacts", "networkMap_addFailed": "Couldn't add to contacts", - "networkMap_unnamed": "Unnamed repeater" + "networkMap_unnamed": "Unnamed repeater", + "holidayGreeting_halloween": "Happy Halloween", + "@holidayGreeting_halloween": { + "description": "Holiday greeting that plays the Halloween bats animation when it appears in a chat message. Matched in every app language and ignoring case and punctuation, so translate it as people actually write the greeting. Separate alternative phrasings with |." + }, + "holidayGreeting_thanksgiving": "Happy Thanksgiving", + "@holidayGreeting_thanksgiving": { + "description": "Holiday greeting that plays the Thanksgiving turkey animation when it appears in a chat message. Matched in every app language and ignoring case and punctuation, so translate it as people actually write the greeting. Separate alternative phrasings with |." + }, + "holidayGreeting_christmas": "Merry Christmas|Merry Xmas|Happy Christmas", + "@holidayGreeting_christmas": { + "description": "Holiday greeting that plays the Christmas Santa animation when it appears in a chat message. Matched in every app language and ignoring case and punctuation, so translate it as people actually write the greeting. Separate alternative phrasings with |." + }, + "holidayGreeting_newYear": "Happy New Year|Happy New Year's", + "@holidayGreeting_newYear": { + "description": "Holiday greeting that plays the New Year's fireworks animation when it appears in a chat message. Matched in every app language and ignoring case and punctuation, so translate it as people actually write the greeting. Separate alternative phrasings with |." + } } diff --git a/lib/l10n/app_es.arb b/lib/l10n/app_es.arb index 52b0b456..a6b5a89a 100644 --- a/lib/l10n/app_es.arb +++ b/lib/l10n/app_es.arb @@ -3589,5 +3589,9 @@ }, "networkMap_sourceLocalHint": "Nodos que tu radio ha escuchado", "networkMap_sourceOnlineHint": "Repetidores del mapa de red en línea", - "networkMap_sourceBothHint": "Los nodos de tu radio más el mapa de red en línea" + "networkMap_sourceBothHint": "Los nodos de tu radio más el mapa de red en línea", + "holidayGreeting_halloween": "Feliz Halloween|Feliz Noche de Brujas", + "holidayGreeting_thanksgiving": "Feliz Día de Acción de Gracias|Feliz Thanksgiving", + "holidayGreeting_christmas": "Feliz Navidad", + "holidayGreeting_newYear": "Feliz Año Nuevo|Próspero Año Nuevo" } diff --git a/lib/l10n/app_fr.arb b/lib/l10n/app_fr.arb index 26bb07e6..83ea0db1 100644 --- a/lib/l10n/app_fr.arb +++ b/lib/l10n/app_fr.arb @@ -3589,5 +3589,9 @@ }, "networkMap_sourceLocalHint": "Nœuds entendus par votre radio", "networkMap_sourceOnlineHint": "Répéteurs de la carte du réseau en ligne", - "networkMap_sourceBothHint": "Les nœuds de votre radio plus la carte du réseau en ligne" + "networkMap_sourceBothHint": "Les nœuds de votre radio plus la carte du réseau en ligne", + "holidayGreeting_halloween": "Joyeux Halloween|Joyeuse Halloween", + "holidayGreeting_thanksgiving": "Joyeux Thanksgiving|Joyeuse Action de grâce", + "holidayGreeting_christmas": "Joyeux Noël", + "holidayGreeting_newYear": "Bonne année" } diff --git a/lib/l10n/app_hu.arb b/lib/l10n/app_hu.arb index d19ab864..5a4ebfeb 100644 --- a/lib/l10n/app_hu.arb +++ b/lib/l10n/app_hu.arb @@ -3494,5 +3494,9 @@ "networkMap_manage": "Kezelés", "networkMap_addedToContacts": "Hozzáadva a kapcsolatokhoz", "networkMap_addFailed": "Nem sikerült hozzáadni a kapcsolatokhoz", - "networkMap_unnamed": "Névtelen repeater" + "networkMap_unnamed": "Névtelen repeater", + "holidayGreeting_halloween": "Boldog Halloweent|Boldog Halloween", + "holidayGreeting_thanksgiving": "Boldog hálaadást", + "holidayGreeting_christmas": "Boldog karácsonyt", + "holidayGreeting_newYear": "Boldog új évet" } diff --git a/lib/l10n/app_it.arb b/lib/l10n/app_it.arb index fb4e4309..4be47632 100644 --- a/lib/l10n/app_it.arb +++ b/lib/l10n/app_it.arb @@ -3589,5 +3589,9 @@ }, "networkMap_sourceLocalHint": "Nodi sentiti dalla tua radio", "networkMap_sourceOnlineHint": "Ripetitori dalla mappa di rete online", - "networkMap_sourceBothHint": "I nodi della tua radio più la mappa di rete online" + "networkMap_sourceBothHint": "I nodi della tua radio più la mappa di rete online", + "holidayGreeting_halloween": "Buon Halloween|Felice Halloween", + "holidayGreeting_thanksgiving": "Buon Ringraziamento|Buon Thanksgiving", + "holidayGreeting_christmas": "Buon Natale", + "holidayGreeting_newYear": "Felice Anno Nuovo|Buon Anno Nuovo|Buon Capodanno" } diff --git a/lib/l10n/app_ja.arb b/lib/l10n/app_ja.arb index a65dbf4b..85a41898 100644 --- a/lib/l10n/app_ja.arb +++ b/lib/l10n/app_ja.arb @@ -3589,5 +3589,9 @@ }, "networkMap_sourceLocalHint": "ラジオが受信したノード", "networkMap_sourceOnlineHint": "オンラインネットワークマップのリピータ", - "networkMap_sourceBothHint": "ラジオのノードとオンラインネットワークマップ" + "networkMap_sourceBothHint": "ラジオのノードとオンラインネットワークマップ", + "holidayGreeting_halloween": "ハッピーハロウィン|ハッピーハロウィーン", + "holidayGreeting_thanksgiving": "ハッピーサンクスギビング|感謝祭おめでとう", + "holidayGreeting_christmas": "メリークリスマス", + "holidayGreeting_newYear": "あけましておめでとう|明けましておめでとう|ハッピーニューイヤー" } diff --git a/lib/l10n/app_ko.arb b/lib/l10n/app_ko.arb index 28dc2eed..ef1ca5e0 100644 --- a/lib/l10n/app_ko.arb +++ b/lib/l10n/app_ko.arb @@ -3589,5 +3589,9 @@ }, "networkMap_sourceLocalHint": "내 라디오가 수신한 노드", "networkMap_sourceOnlineHint": "온라인 네트워크 지도의 리피터", - "networkMap_sourceBothHint": "내 라디오의 노드와 온라인 네트워크 지도" + "networkMap_sourceBothHint": "내 라디오의 노드와 온라인 네트워크 지도", + "holidayGreeting_halloween": "해피 할로윈|즐거운 할로윈", + "holidayGreeting_thanksgiving": "해피 땡스기빙|즐거운 추수감사절|행복한 추수감사절", + "holidayGreeting_christmas": "메리 크리스마스|즐거운 성탄절", + "holidayGreeting_newYear": "새해 복 많이 받으세요|새해 복 많이 받아|해피 뉴 이어" } diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 027aae4b..e1a1cc11 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -1564,6 +1564,426 @@ abstract class AppLocalizations { /// **'Dark'** String get appSettings_themeDark; + /// No description provided for @appSettings_colorTheme. + /// + /// In en, this message translates to: + /// **'Color theme'** + String get appSettings_colorTheme; + + /// No description provided for @appSettings_holidayAnimations. + /// + /// In en, this message translates to: + /// **'Holiday message animations'** + String get appSettings_holidayAnimations; + + /// No description provided for @appSettings_holidayAnimationsSubtitle. + /// + /// In en, this message translates to: + /// **'Bats, a turkey, Santa or fireworks when someone sends a holiday greeting'** + String get appSettings_holidayAnimationsSubtitle; + + /// No description provided for @themes_title. + /// + /// In en, this message translates to: + /// **'Themes'** + String get themes_title; + + /// No description provided for @themes_default. + /// + /// In en, this message translates to: + /// **'MeshCore'** + String get themes_default; + + /// No description provided for @themes_defaultSubtitle. + /// + /// In en, this message translates to: + /// **'Standard colors, follows the Light / Dark setting'** + String get themes_defaultSubtitle; + + /// No description provided for @themes_builtIn. + /// + /// In en, this message translates to: + /// **'Built-in'** + String get themes_builtIn; + + /// No description provided for @themes_holidays. + /// + /// In en, this message translates to: + /// **'Holidays'** + String get themes_holidays; + + /// No description provided for @themes_holidayAutoSwitch. + /// + /// In en, this message translates to: + /// **'Switch automatically'** + String get themes_holidayAutoSwitch; + + /// No description provided for @themes_holidayAutoSwitchSubtitle. + /// + /// In en, this message translates to: + /// **'Uses each holiday\'s theme from 17 days before until the day itself'** + String get themes_holidayAutoSwitchSubtitle; + + /// No description provided for @themes_holidayAutoApplied. + /// + /// In en, this message translates to: + /// **'{holiday} theme is on automatically. Your own theme comes back after the holiday.'** + String themes_holidayAutoApplied(String holiday); + + /// No description provided for @themes_holidayAutoAppliedTag. + /// + /// In en, this message translates to: + /// **'On automatically'** + String get themes_holidayAutoAppliedTag; + + /// No description provided for @themes_myThemes. + /// + /// In en, this message translates to: + /// **'My themes'** + String get themes_myThemes; + + /// No description provided for @themes_myThemesEmpty. + /// + /// In en, this message translates to: + /// **'Make your own theme by picking a background and an accent color.'** + String get themes_myThemesEmpty; + + /// No description provided for @themes_create. + /// + /// In en, this message translates to: + /// **'Create theme'** + String get themes_create; + + /// No description provided for @themes_import. + /// + /// In en, this message translates to: + /// **'Import theme'** + String get themes_import; + + /// No description provided for @themes_importHint. + /// + /// In en, this message translates to: + /// **'Paste a theme code'** + String get themes_importHint; + + /// No description provided for @themes_importInvalid. + /// + /// In en, this message translates to: + /// **'That is not a valid theme code'** + String get themes_importInvalid; + + /// No description provided for @themes_imported. + /// + /// In en, this message translates to: + /// **'Added theme \"{name}\"'** + String themes_imported(String name); + + /// No description provided for @themes_customize. + /// + /// In en, this message translates to: + /// **'Customize a copy'** + String get themes_customize; + + /// No description provided for @themes_copyCode. + /// + /// In en, this message translates to: + /// **'Copy theme code'** + String get themes_copyCode; + + /// No description provided for @themes_codeCopied. + /// + /// In en, this message translates to: + /// **'Theme code copied'** + String get themes_codeCopied; + + /// No description provided for @themes_deleteConfirm. + /// + /// In en, this message translates to: + /// **'Delete theme \"{name}\"?'** + String themes_deleteConfirm(String name); + + /// No description provided for @themes_copyName. + /// + /// In en, this message translates to: + /// **'{name} copy'** + String themes_copyName(String name); + + /// No description provided for @themes_newTitle. + /// + /// In en, this message translates to: + /// **'New theme'** + String get themes_newTitle; + + /// No description provided for @themes_editTitle. + /// + /// In en, this message translates to: + /// **'Edit theme'** + String get themes_editTitle; + + /// No description provided for @themes_name. + /// + /// In en, this message translates to: + /// **'Name'** + String get themes_name; + + /// No description provided for @themes_nameRequired. + /// + /// In en, this message translates to: + /// **'Give your theme a name'** + String get themes_nameRequired; + + /// No description provided for @themes_background. + /// + /// In en, this message translates to: + /// **'Background'** + String get themes_background; + + /// No description provided for @themes_backgroundHelp. + /// + /// In en, this message translates to: + /// **'A dark background makes a dark theme'** + String get themes_backgroundHelp; + + /// No description provided for @themes_accent. + /// + /// In en, this message translates to: + /// **'Accent'** + String get themes_accent; + + /// No description provided for @themes_accentHelp. + /// + /// In en, this message translates to: + /// **'Buttons, highlights and your chat bubbles'** + String get themes_accentHelp; + + /// No description provided for @themes_hexColor. + /// + /// In en, this message translates to: + /// **'Hex color'** + String get themes_hexColor; + + /// No description provided for @themes_preview. + /// + /// In en, this message translates to: + /// **'Preview'** + String get themes_preview; + + /// No description provided for @themes_previewIncoming. + /// + /// In en, this message translates to: + /// **'Anyone on the mesh tonight?'** + String get themes_previewIncoming; + + /// No description provided for @themes_previewOutgoing. + /// + /// In en, this message translates to: + /// **'Loud and clear!'** + String get themes_previewOutgoing; + + /// No description provided for @themes_previewSwitch. + /// + /// In en, this message translates to: + /// **'Notifications'** + String get themes_previewSwitch; + + /// No description provided for @themes_lowContrast. + /// + /// In en, this message translates to: + /// **'The accent is hard to see on this background'** + String get themes_lowContrast; + + /// No description provided for @themes_saveAndUse. + /// + /// In en, this message translates to: + /// **'Save and use'** + String get themes_saveAndUse; + + /// No description provided for @themes_icons. + /// + /// In en, this message translates to: + /// **'Icons'** + String get themes_icons; + + /// No description provided for @themes_iconsHelp. + /// + /// In en, this message translates to: + /// **'Tap an icon to swap it for another icon or your own picture'** + String get themes_iconsHelp; + + /// No description provided for @themes_iconChanged. + /// + /// In en, this message translates to: + /// **'Changed'** + String get themes_iconChanged; + + /// No description provided for @themes_iconSend. + /// + /// In en, this message translates to: + /// **'Send button'** + String get themes_iconSend; + + /// No description provided for @themes_iconRepeater. + /// + /// In en, this message translates to: + /// **'Repeaters'** + String get themes_iconRepeater; + + /// No description provided for @themes_iconRoom. + /// + /// In en, this message translates to: + /// **'Rooms'** + String get themes_iconRoom; + + /// No description provided for @themes_iconSensor. + /// + /// In en, this message translates to: + /// **'Sensors'** + String get themes_iconSensor; + + /// No description provided for @themes_mapMarkers. + /// + /// In en, this message translates to: + /// **'Map markers'** + String get themes_mapMarkers; + + /// No description provided for @themes_mapMarkersHelp. + /// + /// In en, this message translates to: + /// **'Swap the markers for nodes and for you on the map'** + String get themes_mapMarkersHelp; + + /// No description provided for @themes_iconUsePicture. + /// + /// In en, this message translates to: + /// **'Use a picture'** + String get themes_iconUsePicture; + + /// No description provided for @themes_iconReset. + /// + /// In en, this message translates to: + /// **'Use the default icon'** + String get themes_iconReset; + + /// No description provided for @themes_iconPictureFailed. + /// + /// In en, this message translates to: + /// **'Could not use that picture'** + String get themes_iconPictureFailed; + + /// No description provided for @themes_exportFile. + /// + /// In en, this message translates to: + /// **'Export to file'** + String get themes_exportFile; + + /// No description provided for @themes_exportAll. + /// + /// In en, this message translates to: + /// **'Export my themes'** + String get themes_exportAll; + + /// No description provided for @themes_importFile. + /// + /// In en, this message translates to: + /// **'Import from file'** + String get themes_importFile; + + /// No description provided for @themes_pasteCode. + /// + /// In en, this message translates to: + /// **'Paste theme code'** + String get themes_pasteCode; + + /// No description provided for @themes_exportFailed. + /// + /// In en, this message translates to: + /// **'Could not export themes'** + String get themes_exportFailed; + + /// No description provided for @themes_importFileResult. + /// + /// In en, this message translates to: + /// **'Imported {count} themes'** + String themes_importFileResult(int count); + + /// No description provided for @themes_importFileNone. + /// + /// In en, this message translates to: + /// **'No themes found in that file'** + String get themes_importFileNone; + + /// No description provided for @chatBackground_title. + /// + /// In en, this message translates to: + /// **'Chat background'** + String get chatBackground_title; + + /// No description provided for @chatBackground_thisChatOnly. + /// + /// In en, this message translates to: + /// **'Only for this chat'** + String get chatBackground_thisChatOnly; + + /// No description provided for @chatBackground_themeOverrides. + /// + /// In en, this message translates to: + /// **'Your theme \"{name}\" sets the background in every chat. Turn that off in the theme to use this one.'** + String chatBackground_themeOverrides(String name); + + /// No description provided for @chatBackground_none. + /// + /// In en, this message translates to: + /// **'None'** + String get chatBackground_none; + + /// No description provided for @chatBackground_picture. + /// + /// In en, this message translates to: + /// **'Picture'** + String get chatBackground_picture; + + /// No description provided for @chatBackground_choosePicture. + /// + /// In en, this message translates to: + /// **'Choose a picture'** + String get chatBackground_choosePicture; + + /// No description provided for @chatBackground_pictureFailed. + /// + /// In en, this message translates to: + /// **'Could not use that picture'** + String get chatBackground_pictureFailed; + + /// No description provided for @chatBackground_fade. + /// + /// In en, this message translates to: + /// **'Fade'** + String get chatBackground_fade; + + /// No description provided for @themes_chatBackground. + /// + /// In en, this message translates to: + /// **'Chat background'** + String get themes_chatBackground; + + /// No description provided for @themes_chatBackgroundHelp. + /// + /// In en, this message translates to: + /// **'Shown in chats that do not have their own background'** + String get themes_chatBackgroundHelp; + + /// No description provided for @themes_chatBackgroundEverywhere. + /// + /// In en, this message translates to: + /// **'Use in every chat'** + String get themes_chatBackgroundEverywhere; + + /// No description provided for @themes_chatBackgroundEverywhereHelp. + /// + /// In en, this message translates to: + /// **'Also replaces backgrounds set on individual chats'** + String get themes_chatBackgroundEverywhereHelp; + /// No description provided for @appSettings_language. /// /// In en, this message translates to: @@ -11046,6 +11466,30 @@ abstract class AppLocalizations { /// In en, this message translates to: /// **'Unnamed repeater'** String get networkMap_unnamed; + + /// Holiday greeting that plays the Halloween bats animation when it appears in a chat message. Matched in every app language and ignoring case and punctuation, so translate it as people actually write the greeting. Separate alternative phrasings with |. + /// + /// In en, this message translates to: + /// **'Happy Halloween'** + String get holidayGreeting_halloween; + + /// Holiday greeting that plays the Thanksgiving turkey animation when it appears in a chat message. Matched in every app language and ignoring case and punctuation, so translate it as people actually write the greeting. Separate alternative phrasings with |. + /// + /// In en, this message translates to: + /// **'Happy Thanksgiving'** + String get holidayGreeting_thanksgiving; + + /// Holiday greeting that plays the Christmas Santa animation when it appears in a chat message. Matched in every app language and ignoring case and punctuation, so translate it as people actually write the greeting. Separate alternative phrasings with |. + /// + /// In en, this message translates to: + /// **'Merry Christmas|Merry Xmas|Happy Christmas'** + String get holidayGreeting_christmas; + + /// Holiday greeting that plays the New Year's fireworks animation when it appears in a chat message. Matched in every app language and ignoring case and punctuation, so translate it as people actually write the greeting. Separate alternative phrasings with |. + /// + /// In en, this message translates to: + /// **'Happy New Year|Happy New Year\'s'** + String get holidayGreeting_newYear; } class _AppLocalizationsDelegate diff --git a/lib/l10n/app_localizations_bg.dart b/lib/l10n/app_localizations_bg.dart index 061917a7..89f9ac21 100644 --- a/lib/l10n/app_localizations_bg.dart +++ b/lib/l10n/app_localizations_bg.dart @@ -830,6 +830,237 @@ class AppLocalizationsBg extends AppLocalizations { @override String get appSettings_themeDark => 'Тъмна'; + @override + String get appSettings_colorTheme => 'Color theme'; + + @override + String get appSettings_holidayAnimations => 'Holiday message animations'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Bats, a turkey, Santa or fireworks when someone sends a holiday greeting'; + + @override + String get themes_title => 'Themes'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Standard colors, follows the Light / Dark setting'; + + @override + String get themes_builtIn => 'Built-in'; + + @override + String get themes_holidays => 'Holidays'; + + @override + String get themes_holidayAutoSwitch => 'Switch automatically'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Uses each holiday\'s theme from 17 days before until the day itself'; + + @override + String themes_holidayAutoApplied(String holiday) { + return '$holiday theme is on automatically. Your own theme comes back after the holiday.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'On automatically'; + + @override + String get themes_myThemes => 'My themes'; + + @override + String get themes_myThemesEmpty => + 'Make your own theme by picking a background and an accent color.'; + + @override + String get themes_create => 'Create theme'; + + @override + String get themes_import => 'Import theme'; + + @override + String get themes_importHint => 'Paste a theme code'; + + @override + String get themes_importInvalid => 'That is not a valid theme code'; + + @override + String themes_imported(String name) { + return 'Added theme \"$name\"'; + } + + @override + String get themes_customize => 'Customize a copy'; + + @override + String get themes_copyCode => 'Copy theme code'; + + @override + String get themes_codeCopied => 'Theme code copied'; + + @override + String themes_deleteConfirm(String name) { + return 'Delete theme \"$name\"?'; + } + + @override + String themes_copyName(String name) { + return '$name copy'; + } + + @override + String get themes_newTitle => 'New theme'; + + @override + String get themes_editTitle => 'Edit theme'; + + @override + String get themes_name => 'Name'; + + @override + String get themes_nameRequired => 'Give your theme a name'; + + @override + String get themes_background => 'Background'; + + @override + String get themes_backgroundHelp => 'A dark background makes a dark theme'; + + @override + String get themes_accent => 'Accent'; + + @override + String get themes_accentHelp => 'Buttons, highlights and your chat bubbles'; + + @override + String get themes_hexColor => 'Hex color'; + + @override + String get themes_preview => 'Preview'; + + @override + String get themes_previewIncoming => 'Anyone on the mesh tonight?'; + + @override + String get themes_previewOutgoing => 'Loud and clear!'; + + @override + String get themes_previewSwitch => 'Notifications'; + + @override + String get themes_lowContrast => + 'The accent is hard to see on this background'; + + @override + String get themes_saveAndUse => 'Save and use'; + + @override + String get themes_icons => 'Icons'; + + @override + String get themes_iconsHelp => + 'Tap an icon to swap it for another icon or your own picture'; + + @override + String get themes_iconChanged => 'Changed'; + + @override + String get themes_iconSend => 'Send button'; + + @override + String get themes_iconRepeater => 'Repeaters'; + + @override + String get themes_iconRoom => 'Rooms'; + + @override + String get themes_iconSensor => 'Sensors'; + + @override + String get themes_mapMarkers => 'Map markers'; + + @override + String get themes_mapMarkersHelp => + 'Swap the markers for nodes and for you on the map'; + + @override + String get themes_iconUsePicture => 'Use a picture'; + + @override + String get themes_iconReset => 'Use the default icon'; + + @override + String get themes_iconPictureFailed => 'Could not use that picture'; + + @override + String get themes_exportFile => 'Export to file'; + + @override + String get themes_exportAll => 'Export my themes'; + + @override + String get themes_importFile => 'Import from file'; + + @override + String get themes_pasteCode => 'Paste theme code'; + + @override + String get themes_exportFailed => 'Could not export themes'; + + @override + String themes_importFileResult(int count) { + return 'Imported $count themes'; + } + + @override + String get themes_importFileNone => 'No themes found in that file'; + + @override + String get chatBackground_title => 'Chat background'; + + @override + String get chatBackground_thisChatOnly => 'Only for this chat'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Your theme \"$name\" sets the background in every chat. Turn that off in the theme to use this one.'; + } + + @override + String get chatBackground_none => 'None'; + + @override + String get chatBackground_picture => 'Picture'; + + @override + String get chatBackground_choosePicture => 'Choose a picture'; + + @override + String get chatBackground_pictureFailed => 'Could not use that picture'; + + @override + String get chatBackground_fade => 'Fade'; + + @override + String get themes_chatBackground => 'Chat background'; + + @override + String get themes_chatBackgroundHelp => + 'Shown in chats that do not have their own background'; + + @override + String get themes_chatBackgroundEverywhere => 'Use in every chat'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Also replaces backgrounds set on individual chats'; + @override String get appSettings_language => 'Език'; @@ -6602,4 +6833,17 @@ class AppLocalizationsBg extends AppLocalizations { @override String get networkMap_unnamed => 'Неназован повторител'; + + @override + String get holidayGreeting_halloween => 'Честит Хелоуин|Весел Хелоуин'; + + @override + String get holidayGreeting_thanksgiving => 'Честит Ден на благодарността'; + + @override + String get holidayGreeting_christmas => 'Весела Коледа|Честито Рождество'; + + @override + String get holidayGreeting_newYear => + 'Честита Нова година|Щастлива Нова година'; } diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart index f04180e4..c7346cd4 100644 --- a/lib/l10n/app_localizations_de.dart +++ b/lib/l10n/app_localizations_de.dart @@ -825,6 +825,237 @@ class AppLocalizationsDe extends AppLocalizations { @override String get appSettings_themeDark => 'Dunkel'; + @override + String get appSettings_colorTheme => 'Color theme'; + + @override + String get appSettings_holidayAnimations => 'Holiday message animations'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Bats, a turkey, Santa or fireworks when someone sends a holiday greeting'; + + @override + String get themes_title => 'Themes'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Standard colors, follows the Light / Dark setting'; + + @override + String get themes_builtIn => 'Built-in'; + + @override + String get themes_holidays => 'Holidays'; + + @override + String get themes_holidayAutoSwitch => 'Switch automatically'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Uses each holiday\'s theme from 17 days before until the day itself'; + + @override + String themes_holidayAutoApplied(String holiday) { + return '$holiday theme is on automatically. Your own theme comes back after the holiday.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'On automatically'; + + @override + String get themes_myThemes => 'My themes'; + + @override + String get themes_myThemesEmpty => + 'Make your own theme by picking a background and an accent color.'; + + @override + String get themes_create => 'Create theme'; + + @override + String get themes_import => 'Import theme'; + + @override + String get themes_importHint => 'Paste a theme code'; + + @override + String get themes_importInvalid => 'That is not a valid theme code'; + + @override + String themes_imported(String name) { + return 'Added theme \"$name\"'; + } + + @override + String get themes_customize => 'Customize a copy'; + + @override + String get themes_copyCode => 'Copy theme code'; + + @override + String get themes_codeCopied => 'Theme code copied'; + + @override + String themes_deleteConfirm(String name) { + return 'Delete theme \"$name\"?'; + } + + @override + String themes_copyName(String name) { + return '$name copy'; + } + + @override + String get themes_newTitle => 'New theme'; + + @override + String get themes_editTitle => 'Edit theme'; + + @override + String get themes_name => 'Name'; + + @override + String get themes_nameRequired => 'Give your theme a name'; + + @override + String get themes_background => 'Background'; + + @override + String get themes_backgroundHelp => 'A dark background makes a dark theme'; + + @override + String get themes_accent => 'Accent'; + + @override + String get themes_accentHelp => 'Buttons, highlights and your chat bubbles'; + + @override + String get themes_hexColor => 'Hex color'; + + @override + String get themes_preview => 'Preview'; + + @override + String get themes_previewIncoming => 'Anyone on the mesh tonight?'; + + @override + String get themes_previewOutgoing => 'Loud and clear!'; + + @override + String get themes_previewSwitch => 'Notifications'; + + @override + String get themes_lowContrast => + 'The accent is hard to see on this background'; + + @override + String get themes_saveAndUse => 'Save and use'; + + @override + String get themes_icons => 'Icons'; + + @override + String get themes_iconsHelp => + 'Tap an icon to swap it for another icon or your own picture'; + + @override + String get themes_iconChanged => 'Changed'; + + @override + String get themes_iconSend => 'Send button'; + + @override + String get themes_iconRepeater => 'Repeaters'; + + @override + String get themes_iconRoom => 'Rooms'; + + @override + String get themes_iconSensor => 'Sensors'; + + @override + String get themes_mapMarkers => 'Map markers'; + + @override + String get themes_mapMarkersHelp => + 'Swap the markers for nodes and for you on the map'; + + @override + String get themes_iconUsePicture => 'Use a picture'; + + @override + String get themes_iconReset => 'Use the default icon'; + + @override + String get themes_iconPictureFailed => 'Could not use that picture'; + + @override + String get themes_exportFile => 'Export to file'; + + @override + String get themes_exportAll => 'Export my themes'; + + @override + String get themes_importFile => 'Import from file'; + + @override + String get themes_pasteCode => 'Paste theme code'; + + @override + String get themes_exportFailed => 'Could not export themes'; + + @override + String themes_importFileResult(int count) { + return 'Imported $count themes'; + } + + @override + String get themes_importFileNone => 'No themes found in that file'; + + @override + String get chatBackground_title => 'Chat background'; + + @override + String get chatBackground_thisChatOnly => 'Only for this chat'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Your theme \"$name\" sets the background in every chat. Turn that off in the theme to use this one.'; + } + + @override + String get chatBackground_none => 'None'; + + @override + String get chatBackground_picture => 'Picture'; + + @override + String get chatBackground_choosePicture => 'Choose a picture'; + + @override + String get chatBackground_pictureFailed => 'Could not use that picture'; + + @override + String get chatBackground_fade => 'Fade'; + + @override + String get themes_chatBackground => 'Chat background'; + + @override + String get themes_chatBackgroundHelp => + 'Shown in chats that do not have their own background'; + + @override + String get themes_chatBackgroundEverywhere => 'Use in every chat'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Also replaces backgrounds set on individual chats'; + @override String get appSettings_language => 'Sprache'; @@ -6610,4 +6841,20 @@ class AppLocalizationsDe extends AppLocalizations { @override String get networkMap_unnamed => 'Unbenannter Repeater'; + + @override + String get holidayGreeting_halloween => + 'Frohes Halloween|Fröhliches Halloween'; + + @override + String get holidayGreeting_thanksgiving => + 'Frohes Thanksgiving|Schönes Thanksgiving|Frohes Erntedankfest'; + + @override + String get holidayGreeting_christmas => + 'Frohe Weihnachten|Fröhliche Weihnachten'; + + @override + String get holidayGreeting_newYear => + 'Frohes neues Jahr|Gutes neues Jahr|Guten Rutsch|Prosit Neujahr'; } diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 9e9ce589..50b4e445 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -812,6 +812,237 @@ class AppLocalizationsEn extends AppLocalizations { @override String get appSettings_themeDark => 'Dark'; + @override + String get appSettings_colorTheme => 'Color theme'; + + @override + String get appSettings_holidayAnimations => 'Holiday message animations'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Bats, a turkey, Santa or fireworks when someone sends a holiday greeting'; + + @override + String get themes_title => 'Themes'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Standard colors, follows the Light / Dark setting'; + + @override + String get themes_builtIn => 'Built-in'; + + @override + String get themes_holidays => 'Holidays'; + + @override + String get themes_holidayAutoSwitch => 'Switch automatically'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Uses each holiday\'s theme from 17 days before until the day itself'; + + @override + String themes_holidayAutoApplied(String holiday) { + return '$holiday theme is on automatically. Your own theme comes back after the holiday.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'On automatically'; + + @override + String get themes_myThemes => 'My themes'; + + @override + String get themes_myThemesEmpty => + 'Make your own theme by picking a background and an accent color.'; + + @override + String get themes_create => 'Create theme'; + + @override + String get themes_import => 'Import theme'; + + @override + String get themes_importHint => 'Paste a theme code'; + + @override + String get themes_importInvalid => 'That is not a valid theme code'; + + @override + String themes_imported(String name) { + return 'Added theme \"$name\"'; + } + + @override + String get themes_customize => 'Customize a copy'; + + @override + String get themes_copyCode => 'Copy theme code'; + + @override + String get themes_codeCopied => 'Theme code copied'; + + @override + String themes_deleteConfirm(String name) { + return 'Delete theme \"$name\"?'; + } + + @override + String themes_copyName(String name) { + return '$name copy'; + } + + @override + String get themes_newTitle => 'New theme'; + + @override + String get themes_editTitle => 'Edit theme'; + + @override + String get themes_name => 'Name'; + + @override + String get themes_nameRequired => 'Give your theme a name'; + + @override + String get themes_background => 'Background'; + + @override + String get themes_backgroundHelp => 'A dark background makes a dark theme'; + + @override + String get themes_accent => 'Accent'; + + @override + String get themes_accentHelp => 'Buttons, highlights and your chat bubbles'; + + @override + String get themes_hexColor => 'Hex color'; + + @override + String get themes_preview => 'Preview'; + + @override + String get themes_previewIncoming => 'Anyone on the mesh tonight?'; + + @override + String get themes_previewOutgoing => 'Loud and clear!'; + + @override + String get themes_previewSwitch => 'Notifications'; + + @override + String get themes_lowContrast => + 'The accent is hard to see on this background'; + + @override + String get themes_saveAndUse => 'Save and use'; + + @override + String get themes_icons => 'Icons'; + + @override + String get themes_iconsHelp => + 'Tap an icon to swap it for another icon or your own picture'; + + @override + String get themes_iconChanged => 'Changed'; + + @override + String get themes_iconSend => 'Send button'; + + @override + String get themes_iconRepeater => 'Repeaters'; + + @override + String get themes_iconRoom => 'Rooms'; + + @override + String get themes_iconSensor => 'Sensors'; + + @override + String get themes_mapMarkers => 'Map markers'; + + @override + String get themes_mapMarkersHelp => + 'Swap the markers for nodes and for you on the map'; + + @override + String get themes_iconUsePicture => 'Use a picture'; + + @override + String get themes_iconReset => 'Use the default icon'; + + @override + String get themes_iconPictureFailed => 'Could not use that picture'; + + @override + String get themes_exportFile => 'Export to file'; + + @override + String get themes_exportAll => 'Export my themes'; + + @override + String get themes_importFile => 'Import from file'; + + @override + String get themes_pasteCode => 'Paste theme code'; + + @override + String get themes_exportFailed => 'Could not export themes'; + + @override + String themes_importFileResult(int count) { + return 'Imported $count themes'; + } + + @override + String get themes_importFileNone => 'No themes found in that file'; + + @override + String get chatBackground_title => 'Chat background'; + + @override + String get chatBackground_thisChatOnly => 'Only for this chat'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Your theme \"$name\" sets the background in every chat. Turn that off in the theme to use this one.'; + } + + @override + String get chatBackground_none => 'None'; + + @override + String get chatBackground_picture => 'Picture'; + + @override + String get chatBackground_choosePicture => 'Choose a picture'; + + @override + String get chatBackground_pictureFailed => 'Could not use that picture'; + + @override + String get chatBackground_fade => 'Fade'; + + @override + String get themes_chatBackground => 'Chat background'; + + @override + String get themes_chatBackgroundHelp => + 'Shown in chats that do not have their own background'; + + @override + String get themes_chatBackgroundEverywhere => 'Use in every chat'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Also replaces backgrounds set on individual chats'; + @override String get appSettings_language => 'Language'; @@ -6505,4 +6736,17 @@ class AppLocalizationsEn extends AppLocalizations { @override String get networkMap_unnamed => 'Unnamed repeater'; + + @override + String get holidayGreeting_halloween => 'Happy Halloween'; + + @override + String get holidayGreeting_thanksgiving => 'Happy Thanksgiving'; + + @override + String get holidayGreeting_christmas => + 'Merry Christmas|Merry Xmas|Happy Christmas'; + + @override + String get holidayGreeting_newYear => 'Happy New Year|Happy New Year\'s'; } diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart index 713b7d25..a8f30220 100644 --- a/lib/l10n/app_localizations_es.dart +++ b/lib/l10n/app_localizations_es.dart @@ -824,6 +824,237 @@ class AppLocalizationsEs extends AppLocalizations { @override String get appSettings_themeDark => 'Oscuro'; + @override + String get appSettings_colorTheme => 'Color theme'; + + @override + String get appSettings_holidayAnimations => 'Holiday message animations'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Bats, a turkey, Santa or fireworks when someone sends a holiday greeting'; + + @override + String get themes_title => 'Themes'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Standard colors, follows the Light / Dark setting'; + + @override + String get themes_builtIn => 'Built-in'; + + @override + String get themes_holidays => 'Holidays'; + + @override + String get themes_holidayAutoSwitch => 'Switch automatically'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Uses each holiday\'s theme from 17 days before until the day itself'; + + @override + String themes_holidayAutoApplied(String holiday) { + return '$holiday theme is on automatically. Your own theme comes back after the holiday.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'On automatically'; + + @override + String get themes_myThemes => 'My themes'; + + @override + String get themes_myThemesEmpty => + 'Make your own theme by picking a background and an accent color.'; + + @override + String get themes_create => 'Create theme'; + + @override + String get themes_import => 'Import theme'; + + @override + String get themes_importHint => 'Paste a theme code'; + + @override + String get themes_importInvalid => 'That is not a valid theme code'; + + @override + String themes_imported(String name) { + return 'Added theme \"$name\"'; + } + + @override + String get themes_customize => 'Customize a copy'; + + @override + String get themes_copyCode => 'Copy theme code'; + + @override + String get themes_codeCopied => 'Theme code copied'; + + @override + String themes_deleteConfirm(String name) { + return 'Delete theme \"$name\"?'; + } + + @override + String themes_copyName(String name) { + return '$name copy'; + } + + @override + String get themes_newTitle => 'New theme'; + + @override + String get themes_editTitle => 'Edit theme'; + + @override + String get themes_name => 'Name'; + + @override + String get themes_nameRequired => 'Give your theme a name'; + + @override + String get themes_background => 'Background'; + + @override + String get themes_backgroundHelp => 'A dark background makes a dark theme'; + + @override + String get themes_accent => 'Accent'; + + @override + String get themes_accentHelp => 'Buttons, highlights and your chat bubbles'; + + @override + String get themes_hexColor => 'Hex color'; + + @override + String get themes_preview => 'Preview'; + + @override + String get themes_previewIncoming => 'Anyone on the mesh tonight?'; + + @override + String get themes_previewOutgoing => 'Loud and clear!'; + + @override + String get themes_previewSwitch => 'Notifications'; + + @override + String get themes_lowContrast => + 'The accent is hard to see on this background'; + + @override + String get themes_saveAndUse => 'Save and use'; + + @override + String get themes_icons => 'Icons'; + + @override + String get themes_iconsHelp => + 'Tap an icon to swap it for another icon or your own picture'; + + @override + String get themes_iconChanged => 'Changed'; + + @override + String get themes_iconSend => 'Send button'; + + @override + String get themes_iconRepeater => 'Repeaters'; + + @override + String get themes_iconRoom => 'Rooms'; + + @override + String get themes_iconSensor => 'Sensors'; + + @override + String get themes_mapMarkers => 'Map markers'; + + @override + String get themes_mapMarkersHelp => + 'Swap the markers for nodes and for you on the map'; + + @override + String get themes_iconUsePicture => 'Use a picture'; + + @override + String get themes_iconReset => 'Use the default icon'; + + @override + String get themes_iconPictureFailed => 'Could not use that picture'; + + @override + String get themes_exportFile => 'Export to file'; + + @override + String get themes_exportAll => 'Export my themes'; + + @override + String get themes_importFile => 'Import from file'; + + @override + String get themes_pasteCode => 'Paste theme code'; + + @override + String get themes_exportFailed => 'Could not export themes'; + + @override + String themes_importFileResult(int count) { + return 'Imported $count themes'; + } + + @override + String get themes_importFileNone => 'No themes found in that file'; + + @override + String get chatBackground_title => 'Chat background'; + + @override + String get chatBackground_thisChatOnly => 'Only for this chat'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Your theme \"$name\" sets the background in every chat. Turn that off in the theme to use this one.'; + } + + @override + String get chatBackground_none => 'None'; + + @override + String get chatBackground_picture => 'Picture'; + + @override + String get chatBackground_choosePicture => 'Choose a picture'; + + @override + String get chatBackground_pictureFailed => 'Could not use that picture'; + + @override + String get chatBackground_fade => 'Fade'; + + @override + String get themes_chatBackground => 'Chat background'; + + @override + String get themes_chatBackgroundHelp => + 'Shown in chats that do not have their own background'; + + @override + String get themes_chatBackgroundEverywhere => 'Use in every chat'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Also replaces backgrounds set on individual chats'; + @override String get appSettings_language => 'Idioma'; @@ -6601,4 +6832,18 @@ class AppLocalizationsEs extends AppLocalizations { @override String get networkMap_unnamed => 'Repetidor sin nombre'; + + @override + String get holidayGreeting_halloween => + 'Feliz Halloween|Feliz Noche de Brujas'; + + @override + String get holidayGreeting_thanksgiving => + 'Feliz Día de Acción de Gracias|Feliz Thanksgiving'; + + @override + String get holidayGreeting_christmas => 'Feliz Navidad'; + + @override + String get holidayGreeting_newYear => 'Feliz Año Nuevo|Próspero Año Nuevo'; } diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart index 75311bad..ba001a4a 100644 --- a/lib/l10n/app_localizations_fr.dart +++ b/lib/l10n/app_localizations_fr.dart @@ -830,6 +830,237 @@ class AppLocalizationsFr extends AppLocalizations { @override String get appSettings_themeDark => 'Sombre'; + @override + String get appSettings_colorTheme => 'Color theme'; + + @override + String get appSettings_holidayAnimations => 'Holiday message animations'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Bats, a turkey, Santa or fireworks when someone sends a holiday greeting'; + + @override + String get themes_title => 'Themes'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Standard colors, follows the Light / Dark setting'; + + @override + String get themes_builtIn => 'Built-in'; + + @override + String get themes_holidays => 'Holidays'; + + @override + String get themes_holidayAutoSwitch => 'Switch automatically'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Uses each holiday\'s theme from 17 days before until the day itself'; + + @override + String themes_holidayAutoApplied(String holiday) { + return '$holiday theme is on automatically. Your own theme comes back after the holiday.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'On automatically'; + + @override + String get themes_myThemes => 'My themes'; + + @override + String get themes_myThemesEmpty => + 'Make your own theme by picking a background and an accent color.'; + + @override + String get themes_create => 'Create theme'; + + @override + String get themes_import => 'Import theme'; + + @override + String get themes_importHint => 'Paste a theme code'; + + @override + String get themes_importInvalid => 'That is not a valid theme code'; + + @override + String themes_imported(String name) { + return 'Added theme \"$name\"'; + } + + @override + String get themes_customize => 'Customize a copy'; + + @override + String get themes_copyCode => 'Copy theme code'; + + @override + String get themes_codeCopied => 'Theme code copied'; + + @override + String themes_deleteConfirm(String name) { + return 'Delete theme \"$name\"?'; + } + + @override + String themes_copyName(String name) { + return '$name copy'; + } + + @override + String get themes_newTitle => 'New theme'; + + @override + String get themes_editTitle => 'Edit theme'; + + @override + String get themes_name => 'Name'; + + @override + String get themes_nameRequired => 'Give your theme a name'; + + @override + String get themes_background => 'Background'; + + @override + String get themes_backgroundHelp => 'A dark background makes a dark theme'; + + @override + String get themes_accent => 'Accent'; + + @override + String get themes_accentHelp => 'Buttons, highlights and your chat bubbles'; + + @override + String get themes_hexColor => 'Hex color'; + + @override + String get themes_preview => 'Preview'; + + @override + String get themes_previewIncoming => 'Anyone on the mesh tonight?'; + + @override + String get themes_previewOutgoing => 'Loud and clear!'; + + @override + String get themes_previewSwitch => 'Notifications'; + + @override + String get themes_lowContrast => + 'The accent is hard to see on this background'; + + @override + String get themes_saveAndUse => 'Save and use'; + + @override + String get themes_icons => 'Icons'; + + @override + String get themes_iconsHelp => + 'Tap an icon to swap it for another icon or your own picture'; + + @override + String get themes_iconChanged => 'Changed'; + + @override + String get themes_iconSend => 'Send button'; + + @override + String get themes_iconRepeater => 'Repeaters'; + + @override + String get themes_iconRoom => 'Rooms'; + + @override + String get themes_iconSensor => 'Sensors'; + + @override + String get themes_mapMarkers => 'Map markers'; + + @override + String get themes_mapMarkersHelp => + 'Swap the markers for nodes and for you on the map'; + + @override + String get themes_iconUsePicture => 'Use a picture'; + + @override + String get themes_iconReset => 'Use the default icon'; + + @override + String get themes_iconPictureFailed => 'Could not use that picture'; + + @override + String get themes_exportFile => 'Export to file'; + + @override + String get themes_exportAll => 'Export my themes'; + + @override + String get themes_importFile => 'Import from file'; + + @override + String get themes_pasteCode => 'Paste theme code'; + + @override + String get themes_exportFailed => 'Could not export themes'; + + @override + String themes_importFileResult(int count) { + return 'Imported $count themes'; + } + + @override + String get themes_importFileNone => 'No themes found in that file'; + + @override + String get chatBackground_title => 'Chat background'; + + @override + String get chatBackground_thisChatOnly => 'Only for this chat'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Your theme \"$name\" sets the background in every chat. Turn that off in the theme to use this one.'; + } + + @override + String get chatBackground_none => 'None'; + + @override + String get chatBackground_picture => 'Picture'; + + @override + String get chatBackground_choosePicture => 'Choose a picture'; + + @override + String get chatBackground_pictureFailed => 'Could not use that picture'; + + @override + String get chatBackground_fade => 'Fade'; + + @override + String get themes_chatBackground => 'Chat background'; + + @override + String get themes_chatBackgroundHelp => + 'Shown in chats that do not have their own background'; + + @override + String get themes_chatBackgroundEverywhere => 'Use in every chat'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Also replaces backgrounds set on individual chats'; + @override String get appSettings_language => 'Langue'; @@ -6623,4 +6854,17 @@ class AppLocalizationsFr extends AppLocalizations { @override String get networkMap_unnamed => 'Répéteur sans nom'; + + @override + String get holidayGreeting_halloween => 'Joyeux Halloween|Joyeuse Halloween'; + + @override + String get holidayGreeting_thanksgiving => + 'Joyeux Thanksgiving|Joyeuse Action de grâce'; + + @override + String get holidayGreeting_christmas => 'Joyeux Noël'; + + @override + String get holidayGreeting_newYear => 'Bonne année'; } diff --git a/lib/l10n/app_localizations_hu.dart b/lib/l10n/app_localizations_hu.dart index a2338980..377778ab 100644 --- a/lib/l10n/app_localizations_hu.dart +++ b/lib/l10n/app_localizations_hu.dart @@ -823,6 +823,237 @@ class AppLocalizationsHu extends AppLocalizations { @override String get appSettings_themeDark => 'Sötét'; + @override + String get appSettings_colorTheme => 'Color theme'; + + @override + String get appSettings_holidayAnimations => 'Holiday message animations'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Bats, a turkey, Santa or fireworks when someone sends a holiday greeting'; + + @override + String get themes_title => 'Themes'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Standard colors, follows the Light / Dark setting'; + + @override + String get themes_builtIn => 'Built-in'; + + @override + String get themes_holidays => 'Holidays'; + + @override + String get themes_holidayAutoSwitch => 'Switch automatically'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Uses each holiday\'s theme from 17 days before until the day itself'; + + @override + String themes_holidayAutoApplied(String holiday) { + return '$holiday theme is on automatically. Your own theme comes back after the holiday.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'On automatically'; + + @override + String get themes_myThemes => 'My themes'; + + @override + String get themes_myThemesEmpty => + 'Make your own theme by picking a background and an accent color.'; + + @override + String get themes_create => 'Create theme'; + + @override + String get themes_import => 'Import theme'; + + @override + String get themes_importHint => 'Paste a theme code'; + + @override + String get themes_importInvalid => 'That is not a valid theme code'; + + @override + String themes_imported(String name) { + return 'Added theme \"$name\"'; + } + + @override + String get themes_customize => 'Customize a copy'; + + @override + String get themes_copyCode => 'Copy theme code'; + + @override + String get themes_codeCopied => 'Theme code copied'; + + @override + String themes_deleteConfirm(String name) { + return 'Delete theme \"$name\"?'; + } + + @override + String themes_copyName(String name) { + return '$name copy'; + } + + @override + String get themes_newTitle => 'New theme'; + + @override + String get themes_editTitle => 'Edit theme'; + + @override + String get themes_name => 'Name'; + + @override + String get themes_nameRequired => 'Give your theme a name'; + + @override + String get themes_background => 'Background'; + + @override + String get themes_backgroundHelp => 'A dark background makes a dark theme'; + + @override + String get themes_accent => 'Accent'; + + @override + String get themes_accentHelp => 'Buttons, highlights and your chat bubbles'; + + @override + String get themes_hexColor => 'Hex color'; + + @override + String get themes_preview => 'Preview'; + + @override + String get themes_previewIncoming => 'Anyone on the mesh tonight?'; + + @override + String get themes_previewOutgoing => 'Loud and clear!'; + + @override + String get themes_previewSwitch => 'Notifications'; + + @override + String get themes_lowContrast => + 'The accent is hard to see on this background'; + + @override + String get themes_saveAndUse => 'Save and use'; + + @override + String get themes_icons => 'Icons'; + + @override + String get themes_iconsHelp => + 'Tap an icon to swap it for another icon or your own picture'; + + @override + String get themes_iconChanged => 'Changed'; + + @override + String get themes_iconSend => 'Send button'; + + @override + String get themes_iconRepeater => 'Repeaters'; + + @override + String get themes_iconRoom => 'Rooms'; + + @override + String get themes_iconSensor => 'Sensors'; + + @override + String get themes_mapMarkers => 'Map markers'; + + @override + String get themes_mapMarkersHelp => + 'Swap the markers for nodes and for you on the map'; + + @override + String get themes_iconUsePicture => 'Use a picture'; + + @override + String get themes_iconReset => 'Use the default icon'; + + @override + String get themes_iconPictureFailed => 'Could not use that picture'; + + @override + String get themes_exportFile => 'Export to file'; + + @override + String get themes_exportAll => 'Export my themes'; + + @override + String get themes_importFile => 'Import from file'; + + @override + String get themes_pasteCode => 'Paste theme code'; + + @override + String get themes_exportFailed => 'Could not export themes'; + + @override + String themes_importFileResult(int count) { + return 'Imported $count themes'; + } + + @override + String get themes_importFileNone => 'No themes found in that file'; + + @override + String get chatBackground_title => 'Chat background'; + + @override + String get chatBackground_thisChatOnly => 'Only for this chat'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Your theme \"$name\" sets the background in every chat. Turn that off in the theme to use this one.'; + } + + @override + String get chatBackground_none => 'None'; + + @override + String get chatBackground_picture => 'Picture'; + + @override + String get chatBackground_choosePicture => 'Choose a picture'; + + @override + String get chatBackground_pictureFailed => 'Could not use that picture'; + + @override + String get chatBackground_fade => 'Fade'; + + @override + String get themes_chatBackground => 'Chat background'; + + @override + String get themes_chatBackgroundHelp => + 'Shown in chats that do not have their own background'; + + @override + String get themes_chatBackgroundEverywhere => 'Use in every chat'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Also replaces backgrounds set on individual chats'; + @override String get appSettings_language => 'Nyelv'; @@ -6588,4 +6819,16 @@ class AppLocalizationsHu extends AppLocalizations { @override String get networkMap_unnamed => 'Névtelen repeater'; + + @override + String get holidayGreeting_halloween => 'Boldog Halloweent|Boldog Halloween'; + + @override + String get holidayGreeting_thanksgiving => 'Boldog hálaadást'; + + @override + String get holidayGreeting_christmas => 'Boldog karácsonyt'; + + @override + String get holidayGreeting_newYear => 'Boldog új évet'; } diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart index 3fc024af..f13b0154 100644 --- a/lib/l10n/app_localizations_it.dart +++ b/lib/l10n/app_localizations_it.dart @@ -828,6 +828,237 @@ class AppLocalizationsIt extends AppLocalizations { @override String get appSettings_themeDark => 'Scuro'; + @override + String get appSettings_colorTheme => 'Color theme'; + + @override + String get appSettings_holidayAnimations => 'Holiday message animations'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Bats, a turkey, Santa or fireworks when someone sends a holiday greeting'; + + @override + String get themes_title => 'Themes'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Standard colors, follows the Light / Dark setting'; + + @override + String get themes_builtIn => 'Built-in'; + + @override + String get themes_holidays => 'Holidays'; + + @override + String get themes_holidayAutoSwitch => 'Switch automatically'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Uses each holiday\'s theme from 17 days before until the day itself'; + + @override + String themes_holidayAutoApplied(String holiday) { + return '$holiday theme is on automatically. Your own theme comes back after the holiday.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'On automatically'; + + @override + String get themes_myThemes => 'My themes'; + + @override + String get themes_myThemesEmpty => + 'Make your own theme by picking a background and an accent color.'; + + @override + String get themes_create => 'Create theme'; + + @override + String get themes_import => 'Import theme'; + + @override + String get themes_importHint => 'Paste a theme code'; + + @override + String get themes_importInvalid => 'That is not a valid theme code'; + + @override + String themes_imported(String name) { + return 'Added theme \"$name\"'; + } + + @override + String get themes_customize => 'Customize a copy'; + + @override + String get themes_copyCode => 'Copy theme code'; + + @override + String get themes_codeCopied => 'Theme code copied'; + + @override + String themes_deleteConfirm(String name) { + return 'Delete theme \"$name\"?'; + } + + @override + String themes_copyName(String name) { + return '$name copy'; + } + + @override + String get themes_newTitle => 'New theme'; + + @override + String get themes_editTitle => 'Edit theme'; + + @override + String get themes_name => 'Name'; + + @override + String get themes_nameRequired => 'Give your theme a name'; + + @override + String get themes_background => 'Background'; + + @override + String get themes_backgroundHelp => 'A dark background makes a dark theme'; + + @override + String get themes_accent => 'Accent'; + + @override + String get themes_accentHelp => 'Buttons, highlights and your chat bubbles'; + + @override + String get themes_hexColor => 'Hex color'; + + @override + String get themes_preview => 'Preview'; + + @override + String get themes_previewIncoming => 'Anyone on the mesh tonight?'; + + @override + String get themes_previewOutgoing => 'Loud and clear!'; + + @override + String get themes_previewSwitch => 'Notifications'; + + @override + String get themes_lowContrast => + 'The accent is hard to see on this background'; + + @override + String get themes_saveAndUse => 'Save and use'; + + @override + String get themes_icons => 'Icons'; + + @override + String get themes_iconsHelp => + 'Tap an icon to swap it for another icon or your own picture'; + + @override + String get themes_iconChanged => 'Changed'; + + @override + String get themes_iconSend => 'Send button'; + + @override + String get themes_iconRepeater => 'Repeaters'; + + @override + String get themes_iconRoom => 'Rooms'; + + @override + String get themes_iconSensor => 'Sensors'; + + @override + String get themes_mapMarkers => 'Map markers'; + + @override + String get themes_mapMarkersHelp => + 'Swap the markers for nodes and for you on the map'; + + @override + String get themes_iconUsePicture => 'Use a picture'; + + @override + String get themes_iconReset => 'Use the default icon'; + + @override + String get themes_iconPictureFailed => 'Could not use that picture'; + + @override + String get themes_exportFile => 'Export to file'; + + @override + String get themes_exportAll => 'Export my themes'; + + @override + String get themes_importFile => 'Import from file'; + + @override + String get themes_pasteCode => 'Paste theme code'; + + @override + String get themes_exportFailed => 'Could not export themes'; + + @override + String themes_importFileResult(int count) { + return 'Imported $count themes'; + } + + @override + String get themes_importFileNone => 'No themes found in that file'; + + @override + String get chatBackground_title => 'Chat background'; + + @override + String get chatBackground_thisChatOnly => 'Only for this chat'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Your theme \"$name\" sets the background in every chat. Turn that off in the theme to use this one.'; + } + + @override + String get chatBackground_none => 'None'; + + @override + String get chatBackground_picture => 'Picture'; + + @override + String get chatBackground_choosePicture => 'Choose a picture'; + + @override + String get chatBackground_pictureFailed => 'Could not use that picture'; + + @override + String get chatBackground_fade => 'Fade'; + + @override + String get themes_chatBackground => 'Chat background'; + + @override + String get themes_chatBackgroundHelp => + 'Shown in chats that do not have their own background'; + + @override + String get themes_chatBackgroundEverywhere => 'Use in every chat'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Also replaces backgrounds set on individual chats'; + @override String get appSettings_language => 'Lingua'; @@ -6608,4 +6839,18 @@ class AppLocalizationsIt extends AppLocalizations { @override String get networkMap_unnamed => 'Ripetitore senza nome'; + + @override + String get holidayGreeting_halloween => 'Buon Halloween|Felice Halloween'; + + @override + String get holidayGreeting_thanksgiving => + 'Buon Ringraziamento|Buon Thanksgiving'; + + @override + String get holidayGreeting_christmas => 'Buon Natale'; + + @override + String get holidayGreeting_newYear => + 'Felice Anno Nuovo|Buon Anno Nuovo|Buon Capodanno'; } diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart index df81353a..e068914d 100644 --- a/lib/l10n/app_localizations_ja.dart +++ b/lib/l10n/app_localizations_ja.dart @@ -785,6 +785,237 @@ class AppLocalizationsJa extends AppLocalizations { @override String get appSettings_themeDark => 'ダーク'; + @override + String get appSettings_colorTheme => 'Color theme'; + + @override + String get appSettings_holidayAnimations => 'Holiday message animations'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Bats, a turkey, Santa or fireworks when someone sends a holiday greeting'; + + @override + String get themes_title => 'Themes'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Standard colors, follows the Light / Dark setting'; + + @override + String get themes_builtIn => 'Built-in'; + + @override + String get themes_holidays => 'Holidays'; + + @override + String get themes_holidayAutoSwitch => 'Switch automatically'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Uses each holiday\'s theme from 17 days before until the day itself'; + + @override + String themes_holidayAutoApplied(String holiday) { + return '$holiday theme is on automatically. Your own theme comes back after the holiday.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'On automatically'; + + @override + String get themes_myThemes => 'My themes'; + + @override + String get themes_myThemesEmpty => + 'Make your own theme by picking a background and an accent color.'; + + @override + String get themes_create => 'Create theme'; + + @override + String get themes_import => 'Import theme'; + + @override + String get themes_importHint => 'Paste a theme code'; + + @override + String get themes_importInvalid => 'That is not a valid theme code'; + + @override + String themes_imported(String name) { + return 'Added theme \"$name\"'; + } + + @override + String get themes_customize => 'Customize a copy'; + + @override + String get themes_copyCode => 'Copy theme code'; + + @override + String get themes_codeCopied => 'Theme code copied'; + + @override + String themes_deleteConfirm(String name) { + return 'Delete theme \"$name\"?'; + } + + @override + String themes_copyName(String name) { + return '$name copy'; + } + + @override + String get themes_newTitle => 'New theme'; + + @override + String get themes_editTitle => 'Edit theme'; + + @override + String get themes_name => 'Name'; + + @override + String get themes_nameRequired => 'Give your theme a name'; + + @override + String get themes_background => 'Background'; + + @override + String get themes_backgroundHelp => 'A dark background makes a dark theme'; + + @override + String get themes_accent => 'Accent'; + + @override + String get themes_accentHelp => 'Buttons, highlights and your chat bubbles'; + + @override + String get themes_hexColor => 'Hex color'; + + @override + String get themes_preview => 'Preview'; + + @override + String get themes_previewIncoming => 'Anyone on the mesh tonight?'; + + @override + String get themes_previewOutgoing => 'Loud and clear!'; + + @override + String get themes_previewSwitch => 'Notifications'; + + @override + String get themes_lowContrast => + 'The accent is hard to see on this background'; + + @override + String get themes_saveAndUse => 'Save and use'; + + @override + String get themes_icons => 'Icons'; + + @override + String get themes_iconsHelp => + 'Tap an icon to swap it for another icon or your own picture'; + + @override + String get themes_iconChanged => 'Changed'; + + @override + String get themes_iconSend => 'Send button'; + + @override + String get themes_iconRepeater => 'Repeaters'; + + @override + String get themes_iconRoom => 'Rooms'; + + @override + String get themes_iconSensor => 'Sensors'; + + @override + String get themes_mapMarkers => 'Map markers'; + + @override + String get themes_mapMarkersHelp => + 'Swap the markers for nodes and for you on the map'; + + @override + String get themes_iconUsePicture => 'Use a picture'; + + @override + String get themes_iconReset => 'Use the default icon'; + + @override + String get themes_iconPictureFailed => 'Could not use that picture'; + + @override + String get themes_exportFile => 'Export to file'; + + @override + String get themes_exportAll => 'Export my themes'; + + @override + String get themes_importFile => 'Import from file'; + + @override + String get themes_pasteCode => 'Paste theme code'; + + @override + String get themes_exportFailed => 'Could not export themes'; + + @override + String themes_importFileResult(int count) { + return 'Imported $count themes'; + } + + @override + String get themes_importFileNone => 'No themes found in that file'; + + @override + String get chatBackground_title => 'Chat background'; + + @override + String get chatBackground_thisChatOnly => 'Only for this chat'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Your theme \"$name\" sets the background in every chat. Turn that off in the theme to use this one.'; + } + + @override + String get chatBackground_none => 'None'; + + @override + String get chatBackground_picture => 'Picture'; + + @override + String get chatBackground_choosePicture => 'Choose a picture'; + + @override + String get chatBackground_pictureFailed => 'Could not use that picture'; + + @override + String get chatBackground_fade => 'Fade'; + + @override + String get themes_chatBackground => 'Chat background'; + + @override + String get themes_chatBackgroundHelp => + 'Shown in chats that do not have their own background'; + + @override + String get themes_chatBackgroundEverywhere => 'Use in every chat'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Also replaces backgrounds set on individual chats'; + @override String get appSettings_language => '言語'; @@ -6293,4 +6524,16 @@ class AppLocalizationsJa extends AppLocalizations { @override String get networkMap_unnamed => '名前のないリピータ'; + + @override + String get holidayGreeting_halloween => 'ハッピーハロウィン|ハッピーハロウィーン'; + + @override + String get holidayGreeting_thanksgiving => 'ハッピーサンクスギビング|感謝祭おめでとう'; + + @override + String get holidayGreeting_christmas => 'メリークリスマス'; + + @override + String get holidayGreeting_newYear => 'あけましておめでとう|明けましておめでとう|ハッピーニューイヤー'; } diff --git a/lib/l10n/app_localizations_ko.dart b/lib/l10n/app_localizations_ko.dart index 1f3fb43c..bf617d03 100644 --- a/lib/l10n/app_localizations_ko.dart +++ b/lib/l10n/app_localizations_ko.dart @@ -787,6 +787,237 @@ class AppLocalizationsKo extends AppLocalizations { @override String get appSettings_themeDark => '어두움'; + @override + String get appSettings_colorTheme => 'Color theme'; + + @override + String get appSettings_holidayAnimations => 'Holiday message animations'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Bats, a turkey, Santa or fireworks when someone sends a holiday greeting'; + + @override + String get themes_title => 'Themes'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Standard colors, follows the Light / Dark setting'; + + @override + String get themes_builtIn => 'Built-in'; + + @override + String get themes_holidays => 'Holidays'; + + @override + String get themes_holidayAutoSwitch => 'Switch automatically'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Uses each holiday\'s theme from 17 days before until the day itself'; + + @override + String themes_holidayAutoApplied(String holiday) { + return '$holiday theme is on automatically. Your own theme comes back after the holiday.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'On automatically'; + + @override + String get themes_myThemes => 'My themes'; + + @override + String get themes_myThemesEmpty => + 'Make your own theme by picking a background and an accent color.'; + + @override + String get themes_create => 'Create theme'; + + @override + String get themes_import => 'Import theme'; + + @override + String get themes_importHint => 'Paste a theme code'; + + @override + String get themes_importInvalid => 'That is not a valid theme code'; + + @override + String themes_imported(String name) { + return 'Added theme \"$name\"'; + } + + @override + String get themes_customize => 'Customize a copy'; + + @override + String get themes_copyCode => 'Copy theme code'; + + @override + String get themes_codeCopied => 'Theme code copied'; + + @override + String themes_deleteConfirm(String name) { + return 'Delete theme \"$name\"?'; + } + + @override + String themes_copyName(String name) { + return '$name copy'; + } + + @override + String get themes_newTitle => 'New theme'; + + @override + String get themes_editTitle => 'Edit theme'; + + @override + String get themes_name => 'Name'; + + @override + String get themes_nameRequired => 'Give your theme a name'; + + @override + String get themes_background => 'Background'; + + @override + String get themes_backgroundHelp => 'A dark background makes a dark theme'; + + @override + String get themes_accent => 'Accent'; + + @override + String get themes_accentHelp => 'Buttons, highlights and your chat bubbles'; + + @override + String get themes_hexColor => 'Hex color'; + + @override + String get themes_preview => 'Preview'; + + @override + String get themes_previewIncoming => 'Anyone on the mesh tonight?'; + + @override + String get themes_previewOutgoing => 'Loud and clear!'; + + @override + String get themes_previewSwitch => 'Notifications'; + + @override + String get themes_lowContrast => + 'The accent is hard to see on this background'; + + @override + String get themes_saveAndUse => 'Save and use'; + + @override + String get themes_icons => 'Icons'; + + @override + String get themes_iconsHelp => + 'Tap an icon to swap it for another icon or your own picture'; + + @override + String get themes_iconChanged => 'Changed'; + + @override + String get themes_iconSend => 'Send button'; + + @override + String get themes_iconRepeater => 'Repeaters'; + + @override + String get themes_iconRoom => 'Rooms'; + + @override + String get themes_iconSensor => 'Sensors'; + + @override + String get themes_mapMarkers => 'Map markers'; + + @override + String get themes_mapMarkersHelp => + 'Swap the markers for nodes and for you on the map'; + + @override + String get themes_iconUsePicture => 'Use a picture'; + + @override + String get themes_iconReset => 'Use the default icon'; + + @override + String get themes_iconPictureFailed => 'Could not use that picture'; + + @override + String get themes_exportFile => 'Export to file'; + + @override + String get themes_exportAll => 'Export my themes'; + + @override + String get themes_importFile => 'Import from file'; + + @override + String get themes_pasteCode => 'Paste theme code'; + + @override + String get themes_exportFailed => 'Could not export themes'; + + @override + String themes_importFileResult(int count) { + return 'Imported $count themes'; + } + + @override + String get themes_importFileNone => 'No themes found in that file'; + + @override + String get chatBackground_title => 'Chat background'; + + @override + String get chatBackground_thisChatOnly => 'Only for this chat'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Your theme \"$name\" sets the background in every chat. Turn that off in the theme to use this one.'; + } + + @override + String get chatBackground_none => 'None'; + + @override + String get chatBackground_picture => 'Picture'; + + @override + String get chatBackground_choosePicture => 'Choose a picture'; + + @override + String get chatBackground_pictureFailed => 'Could not use that picture'; + + @override + String get chatBackground_fade => 'Fade'; + + @override + String get themes_chatBackground => 'Chat background'; + + @override + String get themes_chatBackgroundHelp => + 'Shown in chats that do not have their own background'; + + @override + String get themes_chatBackgroundEverywhere => 'Use in every chat'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Also replaces backgrounds set on individual chats'; + @override String get appSettings_language => '언어'; @@ -6303,4 +6534,16 @@ class AppLocalizationsKo extends AppLocalizations { @override String get networkMap_unnamed => '이름 없는 리피터'; + + @override + String get holidayGreeting_halloween => '해피 할로윈|즐거운 할로윈'; + + @override + String get holidayGreeting_thanksgiving => '해피 땡스기빙|즐거운 추수감사절|행복한 추수감사절'; + + @override + String get holidayGreeting_christmas => '메리 크리스마스|즐거운 성탄절'; + + @override + String get holidayGreeting_newYear => '새해 복 많이 받으세요|새해 복 많이 받아|해피 뉴 이어'; } diff --git a/lib/l10n/app_localizations_nl.dart b/lib/l10n/app_localizations_nl.dart index 84befb06..dd65ae54 100644 --- a/lib/l10n/app_localizations_nl.dart +++ b/lib/l10n/app_localizations_nl.dart @@ -821,6 +821,237 @@ class AppLocalizationsNl extends AppLocalizations { @override String get appSettings_themeDark => 'Donker'; + @override + String get appSettings_colorTheme => 'Color theme'; + + @override + String get appSettings_holidayAnimations => 'Holiday message animations'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Bats, a turkey, Santa or fireworks when someone sends a holiday greeting'; + + @override + String get themes_title => 'Themes'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Standard colors, follows the Light / Dark setting'; + + @override + String get themes_builtIn => 'Built-in'; + + @override + String get themes_holidays => 'Holidays'; + + @override + String get themes_holidayAutoSwitch => 'Switch automatically'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Uses each holiday\'s theme from 17 days before until the day itself'; + + @override + String themes_holidayAutoApplied(String holiday) { + return '$holiday theme is on automatically. Your own theme comes back after the holiday.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'On automatically'; + + @override + String get themes_myThemes => 'My themes'; + + @override + String get themes_myThemesEmpty => + 'Make your own theme by picking a background and an accent color.'; + + @override + String get themes_create => 'Create theme'; + + @override + String get themes_import => 'Import theme'; + + @override + String get themes_importHint => 'Paste a theme code'; + + @override + String get themes_importInvalid => 'That is not a valid theme code'; + + @override + String themes_imported(String name) { + return 'Added theme \"$name\"'; + } + + @override + String get themes_customize => 'Customize a copy'; + + @override + String get themes_copyCode => 'Copy theme code'; + + @override + String get themes_codeCopied => 'Theme code copied'; + + @override + String themes_deleteConfirm(String name) { + return 'Delete theme \"$name\"?'; + } + + @override + String themes_copyName(String name) { + return '$name copy'; + } + + @override + String get themes_newTitle => 'New theme'; + + @override + String get themes_editTitle => 'Edit theme'; + + @override + String get themes_name => 'Name'; + + @override + String get themes_nameRequired => 'Give your theme a name'; + + @override + String get themes_background => 'Background'; + + @override + String get themes_backgroundHelp => 'A dark background makes a dark theme'; + + @override + String get themes_accent => 'Accent'; + + @override + String get themes_accentHelp => 'Buttons, highlights and your chat bubbles'; + + @override + String get themes_hexColor => 'Hex color'; + + @override + String get themes_preview => 'Preview'; + + @override + String get themes_previewIncoming => 'Anyone on the mesh tonight?'; + + @override + String get themes_previewOutgoing => 'Loud and clear!'; + + @override + String get themes_previewSwitch => 'Notifications'; + + @override + String get themes_lowContrast => + 'The accent is hard to see on this background'; + + @override + String get themes_saveAndUse => 'Save and use'; + + @override + String get themes_icons => 'Icons'; + + @override + String get themes_iconsHelp => + 'Tap an icon to swap it for another icon or your own picture'; + + @override + String get themes_iconChanged => 'Changed'; + + @override + String get themes_iconSend => 'Send button'; + + @override + String get themes_iconRepeater => 'Repeaters'; + + @override + String get themes_iconRoom => 'Rooms'; + + @override + String get themes_iconSensor => 'Sensors'; + + @override + String get themes_mapMarkers => 'Map markers'; + + @override + String get themes_mapMarkersHelp => + 'Swap the markers for nodes and for you on the map'; + + @override + String get themes_iconUsePicture => 'Use a picture'; + + @override + String get themes_iconReset => 'Use the default icon'; + + @override + String get themes_iconPictureFailed => 'Could not use that picture'; + + @override + String get themes_exportFile => 'Export to file'; + + @override + String get themes_exportAll => 'Export my themes'; + + @override + String get themes_importFile => 'Import from file'; + + @override + String get themes_pasteCode => 'Paste theme code'; + + @override + String get themes_exportFailed => 'Could not export themes'; + + @override + String themes_importFileResult(int count) { + return 'Imported $count themes'; + } + + @override + String get themes_importFileNone => 'No themes found in that file'; + + @override + String get chatBackground_title => 'Chat background'; + + @override + String get chatBackground_thisChatOnly => 'Only for this chat'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Your theme \"$name\" sets the background in every chat. Turn that off in the theme to use this one.'; + } + + @override + String get chatBackground_none => 'None'; + + @override + String get chatBackground_picture => 'Picture'; + + @override + String get chatBackground_choosePicture => 'Choose a picture'; + + @override + String get chatBackground_pictureFailed => 'Could not use that picture'; + + @override + String get chatBackground_fade => 'Fade'; + + @override + String get themes_chatBackground => 'Chat background'; + + @override + String get themes_chatBackgroundHelp => + 'Shown in chats that do not have their own background'; + + @override + String get themes_chatBackgroundEverywhere => 'Use in every chat'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Also replaces backgrounds set on individual chats'; + @override String get appSettings_language => 'Taal'; @@ -6562,4 +6793,19 @@ class AppLocalizationsNl extends AppLocalizations { @override String get networkMap_unnamed => 'Naamloze repeater'; + + @override + String get holidayGreeting_halloween => 'Fijne Halloween|Gelukkige Halloween'; + + @override + String get holidayGreeting_thanksgiving => + 'Fijne Thanksgiving|Gelukkige Thanksgiving'; + + @override + String get holidayGreeting_christmas => + 'Vrolijk kerstfeest|Fijne kerst|Prettige kerstdagen|Zalig kerstfeest'; + + @override + String get holidayGreeting_newYear => + 'Gelukkig Nieuwjaar|Gelukkig nieuw jaar'; } diff --git a/lib/l10n/app_localizations_pl.dart b/lib/l10n/app_localizations_pl.dart index 3cdad677..d3477e30 100644 --- a/lib/l10n/app_localizations_pl.dart +++ b/lib/l10n/app_localizations_pl.dart @@ -832,6 +832,237 @@ class AppLocalizationsPl extends AppLocalizations { @override String get appSettings_themeDark => 'Ciemny'; + @override + String get appSettings_colorTheme => 'Color theme'; + + @override + String get appSettings_holidayAnimations => 'Holiday message animations'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Bats, a turkey, Santa or fireworks when someone sends a holiday greeting'; + + @override + String get themes_title => 'Themes'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Standard colors, follows the Light / Dark setting'; + + @override + String get themes_builtIn => 'Built-in'; + + @override + String get themes_holidays => 'Holidays'; + + @override + String get themes_holidayAutoSwitch => 'Switch automatically'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Uses each holiday\'s theme from 17 days before until the day itself'; + + @override + String themes_holidayAutoApplied(String holiday) { + return '$holiday theme is on automatically. Your own theme comes back after the holiday.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'On automatically'; + + @override + String get themes_myThemes => 'My themes'; + + @override + String get themes_myThemesEmpty => + 'Make your own theme by picking a background and an accent color.'; + + @override + String get themes_create => 'Create theme'; + + @override + String get themes_import => 'Import theme'; + + @override + String get themes_importHint => 'Paste a theme code'; + + @override + String get themes_importInvalid => 'That is not a valid theme code'; + + @override + String themes_imported(String name) { + return 'Added theme \"$name\"'; + } + + @override + String get themes_customize => 'Customize a copy'; + + @override + String get themes_copyCode => 'Copy theme code'; + + @override + String get themes_codeCopied => 'Theme code copied'; + + @override + String themes_deleteConfirm(String name) { + return 'Delete theme \"$name\"?'; + } + + @override + String themes_copyName(String name) { + return '$name copy'; + } + + @override + String get themes_newTitle => 'New theme'; + + @override + String get themes_editTitle => 'Edit theme'; + + @override + String get themes_name => 'Name'; + + @override + String get themes_nameRequired => 'Give your theme a name'; + + @override + String get themes_background => 'Background'; + + @override + String get themes_backgroundHelp => 'A dark background makes a dark theme'; + + @override + String get themes_accent => 'Accent'; + + @override + String get themes_accentHelp => 'Buttons, highlights and your chat bubbles'; + + @override + String get themes_hexColor => 'Hex color'; + + @override + String get themes_preview => 'Preview'; + + @override + String get themes_previewIncoming => 'Anyone on the mesh tonight?'; + + @override + String get themes_previewOutgoing => 'Loud and clear!'; + + @override + String get themes_previewSwitch => 'Notifications'; + + @override + String get themes_lowContrast => + 'The accent is hard to see on this background'; + + @override + String get themes_saveAndUse => 'Save and use'; + + @override + String get themes_icons => 'Icons'; + + @override + String get themes_iconsHelp => + 'Tap an icon to swap it for another icon or your own picture'; + + @override + String get themes_iconChanged => 'Changed'; + + @override + String get themes_iconSend => 'Send button'; + + @override + String get themes_iconRepeater => 'Repeaters'; + + @override + String get themes_iconRoom => 'Rooms'; + + @override + String get themes_iconSensor => 'Sensors'; + + @override + String get themes_mapMarkers => 'Map markers'; + + @override + String get themes_mapMarkersHelp => + 'Swap the markers for nodes and for you on the map'; + + @override + String get themes_iconUsePicture => 'Use a picture'; + + @override + String get themes_iconReset => 'Use the default icon'; + + @override + String get themes_iconPictureFailed => 'Could not use that picture'; + + @override + String get themes_exportFile => 'Export to file'; + + @override + String get themes_exportAll => 'Export my themes'; + + @override + String get themes_importFile => 'Import from file'; + + @override + String get themes_pasteCode => 'Paste theme code'; + + @override + String get themes_exportFailed => 'Could not export themes'; + + @override + String themes_importFileResult(int count) { + return 'Imported $count themes'; + } + + @override + String get themes_importFileNone => 'No themes found in that file'; + + @override + String get chatBackground_title => 'Chat background'; + + @override + String get chatBackground_thisChatOnly => 'Only for this chat'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Your theme \"$name\" sets the background in every chat. Turn that off in the theme to use this one.'; + } + + @override + String get chatBackground_none => 'None'; + + @override + String get chatBackground_picture => 'Picture'; + + @override + String get chatBackground_choosePicture => 'Choose a picture'; + + @override + String get chatBackground_pictureFailed => 'Could not use that picture'; + + @override + String get chatBackground_fade => 'Fade'; + + @override + String get themes_chatBackground => 'Chat background'; + + @override + String get themes_chatBackgroundHelp => + 'Shown in chats that do not have their own background'; + + @override + String get themes_chatBackgroundEverywhere => 'Use in every chat'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Also replaces backgrounds set on individual chats'; + @override String get appSettings_language => 'Język'; @@ -6628,4 +6859,18 @@ class AppLocalizationsPl extends AppLocalizations { @override String get networkMap_unnamed => 'Repeater bez nazwy'; + + @override + String get holidayGreeting_halloween => + 'Wesołego Halloween|Szczęśliwego Halloween'; + + @override + String get holidayGreeting_thanksgiving => + 'Szczęśliwego Święta Dziękczynienia|Wesołego Święta Dziękczynienia'; + + @override + String get holidayGreeting_christmas => 'Wesołych Świąt'; + + @override + String get holidayGreeting_newYear => 'Szczęśliwego Nowego Roku'; } diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart index 8e6adca9..64c9c26a 100644 --- a/lib/l10n/app_localizations_pt.dart +++ b/lib/l10n/app_localizations_pt.dart @@ -827,6 +827,237 @@ class AppLocalizationsPt extends AppLocalizations { @override String get appSettings_themeDark => 'Escuro'; + @override + String get appSettings_colorTheme => 'Color theme'; + + @override + String get appSettings_holidayAnimations => 'Holiday message animations'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Bats, a turkey, Santa or fireworks when someone sends a holiday greeting'; + + @override + String get themes_title => 'Themes'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Standard colors, follows the Light / Dark setting'; + + @override + String get themes_builtIn => 'Built-in'; + + @override + String get themes_holidays => 'Holidays'; + + @override + String get themes_holidayAutoSwitch => 'Switch automatically'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Uses each holiday\'s theme from 17 days before until the day itself'; + + @override + String themes_holidayAutoApplied(String holiday) { + return '$holiday theme is on automatically. Your own theme comes back after the holiday.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'On automatically'; + + @override + String get themes_myThemes => 'My themes'; + + @override + String get themes_myThemesEmpty => + 'Make your own theme by picking a background and an accent color.'; + + @override + String get themes_create => 'Create theme'; + + @override + String get themes_import => 'Import theme'; + + @override + String get themes_importHint => 'Paste a theme code'; + + @override + String get themes_importInvalid => 'That is not a valid theme code'; + + @override + String themes_imported(String name) { + return 'Added theme \"$name\"'; + } + + @override + String get themes_customize => 'Customize a copy'; + + @override + String get themes_copyCode => 'Copy theme code'; + + @override + String get themes_codeCopied => 'Theme code copied'; + + @override + String themes_deleteConfirm(String name) { + return 'Delete theme \"$name\"?'; + } + + @override + String themes_copyName(String name) { + return '$name copy'; + } + + @override + String get themes_newTitle => 'New theme'; + + @override + String get themes_editTitle => 'Edit theme'; + + @override + String get themes_name => 'Name'; + + @override + String get themes_nameRequired => 'Give your theme a name'; + + @override + String get themes_background => 'Background'; + + @override + String get themes_backgroundHelp => 'A dark background makes a dark theme'; + + @override + String get themes_accent => 'Accent'; + + @override + String get themes_accentHelp => 'Buttons, highlights and your chat bubbles'; + + @override + String get themes_hexColor => 'Hex color'; + + @override + String get themes_preview => 'Preview'; + + @override + String get themes_previewIncoming => 'Anyone on the mesh tonight?'; + + @override + String get themes_previewOutgoing => 'Loud and clear!'; + + @override + String get themes_previewSwitch => 'Notifications'; + + @override + String get themes_lowContrast => + 'The accent is hard to see on this background'; + + @override + String get themes_saveAndUse => 'Save and use'; + + @override + String get themes_icons => 'Icons'; + + @override + String get themes_iconsHelp => + 'Tap an icon to swap it for another icon or your own picture'; + + @override + String get themes_iconChanged => 'Changed'; + + @override + String get themes_iconSend => 'Send button'; + + @override + String get themes_iconRepeater => 'Repeaters'; + + @override + String get themes_iconRoom => 'Rooms'; + + @override + String get themes_iconSensor => 'Sensors'; + + @override + String get themes_mapMarkers => 'Map markers'; + + @override + String get themes_mapMarkersHelp => + 'Swap the markers for nodes and for you on the map'; + + @override + String get themes_iconUsePicture => 'Use a picture'; + + @override + String get themes_iconReset => 'Use the default icon'; + + @override + String get themes_iconPictureFailed => 'Could not use that picture'; + + @override + String get themes_exportFile => 'Export to file'; + + @override + String get themes_exportAll => 'Export my themes'; + + @override + String get themes_importFile => 'Import from file'; + + @override + String get themes_pasteCode => 'Paste theme code'; + + @override + String get themes_exportFailed => 'Could not export themes'; + + @override + String themes_importFileResult(int count) { + return 'Imported $count themes'; + } + + @override + String get themes_importFileNone => 'No themes found in that file'; + + @override + String get chatBackground_title => 'Chat background'; + + @override + String get chatBackground_thisChatOnly => 'Only for this chat'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Your theme \"$name\" sets the background in every chat. Turn that off in the theme to use this one.'; + } + + @override + String get chatBackground_none => 'None'; + + @override + String get chatBackground_picture => 'Picture'; + + @override + String get chatBackground_choosePicture => 'Choose a picture'; + + @override + String get chatBackground_pictureFailed => 'Could not use that picture'; + + @override + String get chatBackground_fade => 'Fade'; + + @override + String get themes_chatBackground => 'Chat background'; + + @override + String get themes_chatBackgroundHelp => + 'Shown in chats that do not have their own background'; + + @override + String get themes_chatBackgroundEverywhere => 'Use in every chat'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Also replaces backgrounds set on individual chats'; + @override String get appSettings_language => 'Idioma'; @@ -6595,4 +6826,18 @@ class AppLocalizationsPt extends AppLocalizations { @override String get networkMap_unnamed => 'Repetidor sem nome'; + + @override + String get holidayGreeting_halloween => + 'Feliz Halloween|Feliz Dia das Bruxas'; + + @override + String get holidayGreeting_thanksgiving => + 'Feliz Dia de Ação de Graças|Feliz Thanksgiving'; + + @override + String get holidayGreeting_christmas => 'Feliz Natal|Boas Festas'; + + @override + String get holidayGreeting_newYear => 'Feliz Ano Novo'; } diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart index f0554631..215a1687 100644 --- a/lib/l10n/app_localizations_ru.dart +++ b/lib/l10n/app_localizations_ru.dart @@ -829,6 +829,237 @@ class AppLocalizationsRu extends AppLocalizations { @override String get appSettings_themeDark => 'Тёмная'; + @override + String get appSettings_colorTheme => 'Color theme'; + + @override + String get appSettings_holidayAnimations => 'Holiday message animations'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Bats, a turkey, Santa or fireworks when someone sends a holiday greeting'; + + @override + String get themes_title => 'Themes'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Standard colors, follows the Light / Dark setting'; + + @override + String get themes_builtIn => 'Built-in'; + + @override + String get themes_holidays => 'Holidays'; + + @override + String get themes_holidayAutoSwitch => 'Switch automatically'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Uses each holiday\'s theme from 17 days before until the day itself'; + + @override + String themes_holidayAutoApplied(String holiday) { + return '$holiday theme is on automatically. Your own theme comes back after the holiday.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'On automatically'; + + @override + String get themes_myThemes => 'My themes'; + + @override + String get themes_myThemesEmpty => + 'Make your own theme by picking a background and an accent color.'; + + @override + String get themes_create => 'Create theme'; + + @override + String get themes_import => 'Import theme'; + + @override + String get themes_importHint => 'Paste a theme code'; + + @override + String get themes_importInvalid => 'That is not a valid theme code'; + + @override + String themes_imported(String name) { + return 'Added theme \"$name\"'; + } + + @override + String get themes_customize => 'Customize a copy'; + + @override + String get themes_copyCode => 'Copy theme code'; + + @override + String get themes_codeCopied => 'Theme code copied'; + + @override + String themes_deleteConfirm(String name) { + return 'Delete theme \"$name\"?'; + } + + @override + String themes_copyName(String name) { + return '$name copy'; + } + + @override + String get themes_newTitle => 'New theme'; + + @override + String get themes_editTitle => 'Edit theme'; + + @override + String get themes_name => 'Name'; + + @override + String get themes_nameRequired => 'Give your theme a name'; + + @override + String get themes_background => 'Background'; + + @override + String get themes_backgroundHelp => 'A dark background makes a dark theme'; + + @override + String get themes_accent => 'Accent'; + + @override + String get themes_accentHelp => 'Buttons, highlights and your chat bubbles'; + + @override + String get themes_hexColor => 'Hex color'; + + @override + String get themes_preview => 'Preview'; + + @override + String get themes_previewIncoming => 'Anyone on the mesh tonight?'; + + @override + String get themes_previewOutgoing => 'Loud and clear!'; + + @override + String get themes_previewSwitch => 'Notifications'; + + @override + String get themes_lowContrast => + 'The accent is hard to see on this background'; + + @override + String get themes_saveAndUse => 'Save and use'; + + @override + String get themes_icons => 'Icons'; + + @override + String get themes_iconsHelp => + 'Tap an icon to swap it for another icon or your own picture'; + + @override + String get themes_iconChanged => 'Changed'; + + @override + String get themes_iconSend => 'Send button'; + + @override + String get themes_iconRepeater => 'Repeaters'; + + @override + String get themes_iconRoom => 'Rooms'; + + @override + String get themes_iconSensor => 'Sensors'; + + @override + String get themes_mapMarkers => 'Map markers'; + + @override + String get themes_mapMarkersHelp => + 'Swap the markers for nodes and for you on the map'; + + @override + String get themes_iconUsePicture => 'Use a picture'; + + @override + String get themes_iconReset => 'Use the default icon'; + + @override + String get themes_iconPictureFailed => 'Could not use that picture'; + + @override + String get themes_exportFile => 'Export to file'; + + @override + String get themes_exportAll => 'Export my themes'; + + @override + String get themes_importFile => 'Import from file'; + + @override + String get themes_pasteCode => 'Paste theme code'; + + @override + String get themes_exportFailed => 'Could not export themes'; + + @override + String themes_importFileResult(int count) { + return 'Imported $count themes'; + } + + @override + String get themes_importFileNone => 'No themes found in that file'; + + @override + String get chatBackground_title => 'Chat background'; + + @override + String get chatBackground_thisChatOnly => 'Only for this chat'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Your theme \"$name\" sets the background in every chat. Turn that off in the theme to use this one.'; + } + + @override + String get chatBackground_none => 'None'; + + @override + String get chatBackground_picture => 'Picture'; + + @override + String get chatBackground_choosePicture => 'Choose a picture'; + + @override + String get chatBackground_pictureFailed => 'Could not use that picture'; + + @override + String get chatBackground_fade => 'Fade'; + + @override + String get themes_chatBackground => 'Chat background'; + + @override + String get themes_chatBackgroundHelp => + 'Shown in chats that do not have their own background'; + + @override + String get themes_chatBackgroundEverywhere => 'Use in every chat'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Also replaces backgrounds set on individual chats'; + @override String get appSettings_language => 'Язык'; @@ -6615,4 +6846,18 @@ class AppLocalizationsRu extends AppLocalizations { @override String get networkMap_unnamed => 'Репитер без имени'; + + @override + String get holidayGreeting_halloween => + 'С Хэллоуином|С Хеллоуином|Счастливого Хэллоуина'; + + @override + String get holidayGreeting_thanksgiving => + 'С Днём благодарения|С Днем благодарения'; + + @override + String get holidayGreeting_christmas => 'С Рождеством|Счастливого Рождества'; + + @override + String get holidayGreeting_newYear => 'С Новым годом'; } diff --git a/lib/l10n/app_localizations_sk.dart b/lib/l10n/app_localizations_sk.dart index 7d79791d..4555570c 100644 --- a/lib/l10n/app_localizations_sk.dart +++ b/lib/l10n/app_localizations_sk.dart @@ -820,6 +820,237 @@ class AppLocalizationsSk extends AppLocalizations { @override String get appSettings_themeDark => 'Tmavé'; + @override + String get appSettings_colorTheme => 'Color theme'; + + @override + String get appSettings_holidayAnimations => 'Holiday message animations'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Bats, a turkey, Santa or fireworks when someone sends a holiday greeting'; + + @override + String get themes_title => 'Themes'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Standard colors, follows the Light / Dark setting'; + + @override + String get themes_builtIn => 'Built-in'; + + @override + String get themes_holidays => 'Holidays'; + + @override + String get themes_holidayAutoSwitch => 'Switch automatically'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Uses each holiday\'s theme from 17 days before until the day itself'; + + @override + String themes_holidayAutoApplied(String holiday) { + return '$holiday theme is on automatically. Your own theme comes back after the holiday.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'On automatically'; + + @override + String get themes_myThemes => 'My themes'; + + @override + String get themes_myThemesEmpty => + 'Make your own theme by picking a background and an accent color.'; + + @override + String get themes_create => 'Create theme'; + + @override + String get themes_import => 'Import theme'; + + @override + String get themes_importHint => 'Paste a theme code'; + + @override + String get themes_importInvalid => 'That is not a valid theme code'; + + @override + String themes_imported(String name) { + return 'Added theme \"$name\"'; + } + + @override + String get themes_customize => 'Customize a copy'; + + @override + String get themes_copyCode => 'Copy theme code'; + + @override + String get themes_codeCopied => 'Theme code copied'; + + @override + String themes_deleteConfirm(String name) { + return 'Delete theme \"$name\"?'; + } + + @override + String themes_copyName(String name) { + return '$name copy'; + } + + @override + String get themes_newTitle => 'New theme'; + + @override + String get themes_editTitle => 'Edit theme'; + + @override + String get themes_name => 'Name'; + + @override + String get themes_nameRequired => 'Give your theme a name'; + + @override + String get themes_background => 'Background'; + + @override + String get themes_backgroundHelp => 'A dark background makes a dark theme'; + + @override + String get themes_accent => 'Accent'; + + @override + String get themes_accentHelp => 'Buttons, highlights and your chat bubbles'; + + @override + String get themes_hexColor => 'Hex color'; + + @override + String get themes_preview => 'Preview'; + + @override + String get themes_previewIncoming => 'Anyone on the mesh tonight?'; + + @override + String get themes_previewOutgoing => 'Loud and clear!'; + + @override + String get themes_previewSwitch => 'Notifications'; + + @override + String get themes_lowContrast => + 'The accent is hard to see on this background'; + + @override + String get themes_saveAndUse => 'Save and use'; + + @override + String get themes_icons => 'Icons'; + + @override + String get themes_iconsHelp => + 'Tap an icon to swap it for another icon or your own picture'; + + @override + String get themes_iconChanged => 'Changed'; + + @override + String get themes_iconSend => 'Send button'; + + @override + String get themes_iconRepeater => 'Repeaters'; + + @override + String get themes_iconRoom => 'Rooms'; + + @override + String get themes_iconSensor => 'Sensors'; + + @override + String get themes_mapMarkers => 'Map markers'; + + @override + String get themes_mapMarkersHelp => + 'Swap the markers for nodes and for you on the map'; + + @override + String get themes_iconUsePicture => 'Use a picture'; + + @override + String get themes_iconReset => 'Use the default icon'; + + @override + String get themes_iconPictureFailed => 'Could not use that picture'; + + @override + String get themes_exportFile => 'Export to file'; + + @override + String get themes_exportAll => 'Export my themes'; + + @override + String get themes_importFile => 'Import from file'; + + @override + String get themes_pasteCode => 'Paste theme code'; + + @override + String get themes_exportFailed => 'Could not export themes'; + + @override + String themes_importFileResult(int count) { + return 'Imported $count themes'; + } + + @override + String get themes_importFileNone => 'No themes found in that file'; + + @override + String get chatBackground_title => 'Chat background'; + + @override + String get chatBackground_thisChatOnly => 'Only for this chat'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Your theme \"$name\" sets the background in every chat. Turn that off in the theme to use this one.'; + } + + @override + String get chatBackground_none => 'None'; + + @override + String get chatBackground_picture => 'Picture'; + + @override + String get chatBackground_choosePicture => 'Choose a picture'; + + @override + String get chatBackground_pictureFailed => 'Could not use that picture'; + + @override + String get chatBackground_fade => 'Fade'; + + @override + String get themes_chatBackground => 'Chat background'; + + @override + String get themes_chatBackgroundHelp => + 'Shown in chats that do not have their own background'; + + @override + String get themes_chatBackgroundEverywhere => 'Use in every chat'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Also replaces backgrounds set on individual chats'; + @override String get appSettings_language => 'Jazyk'; @@ -6582,4 +6813,16 @@ class AppLocalizationsSk extends AppLocalizations { @override String get networkMap_unnamed => 'Nepomenovaný opakovač'; + + @override + String get holidayGreeting_halloween => 'Veselý Halloween|Šťastný Halloween'; + + @override + String get holidayGreeting_thanksgiving => 'Šťastný Deň vďakyvzdania'; + + @override + String get holidayGreeting_christmas => 'Veselé Vianoce'; + + @override + String get holidayGreeting_newYear => 'Šťastný Nový rok'; } diff --git a/lib/l10n/app_localizations_sl.dart b/lib/l10n/app_localizations_sl.dart index a1597978..8caf607f 100644 --- a/lib/l10n/app_localizations_sl.dart +++ b/lib/l10n/app_localizations_sl.dart @@ -819,6 +819,237 @@ class AppLocalizationsSl extends AppLocalizations { @override String get appSettings_themeDark => 'Temno'; + @override + String get appSettings_colorTheme => 'Color theme'; + + @override + String get appSettings_holidayAnimations => 'Holiday message animations'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Bats, a turkey, Santa or fireworks when someone sends a holiday greeting'; + + @override + String get themes_title => 'Themes'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Standard colors, follows the Light / Dark setting'; + + @override + String get themes_builtIn => 'Built-in'; + + @override + String get themes_holidays => 'Holidays'; + + @override + String get themes_holidayAutoSwitch => 'Switch automatically'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Uses each holiday\'s theme from 17 days before until the day itself'; + + @override + String themes_holidayAutoApplied(String holiday) { + return '$holiday theme is on automatically. Your own theme comes back after the holiday.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'On automatically'; + + @override + String get themes_myThemes => 'My themes'; + + @override + String get themes_myThemesEmpty => + 'Make your own theme by picking a background and an accent color.'; + + @override + String get themes_create => 'Create theme'; + + @override + String get themes_import => 'Import theme'; + + @override + String get themes_importHint => 'Paste a theme code'; + + @override + String get themes_importInvalid => 'That is not a valid theme code'; + + @override + String themes_imported(String name) { + return 'Added theme \"$name\"'; + } + + @override + String get themes_customize => 'Customize a copy'; + + @override + String get themes_copyCode => 'Copy theme code'; + + @override + String get themes_codeCopied => 'Theme code copied'; + + @override + String themes_deleteConfirm(String name) { + return 'Delete theme \"$name\"?'; + } + + @override + String themes_copyName(String name) { + return '$name copy'; + } + + @override + String get themes_newTitle => 'New theme'; + + @override + String get themes_editTitle => 'Edit theme'; + + @override + String get themes_name => 'Name'; + + @override + String get themes_nameRequired => 'Give your theme a name'; + + @override + String get themes_background => 'Background'; + + @override + String get themes_backgroundHelp => 'A dark background makes a dark theme'; + + @override + String get themes_accent => 'Accent'; + + @override + String get themes_accentHelp => 'Buttons, highlights and your chat bubbles'; + + @override + String get themes_hexColor => 'Hex color'; + + @override + String get themes_preview => 'Preview'; + + @override + String get themes_previewIncoming => 'Anyone on the mesh tonight?'; + + @override + String get themes_previewOutgoing => 'Loud and clear!'; + + @override + String get themes_previewSwitch => 'Notifications'; + + @override + String get themes_lowContrast => + 'The accent is hard to see on this background'; + + @override + String get themes_saveAndUse => 'Save and use'; + + @override + String get themes_icons => 'Icons'; + + @override + String get themes_iconsHelp => + 'Tap an icon to swap it for another icon or your own picture'; + + @override + String get themes_iconChanged => 'Changed'; + + @override + String get themes_iconSend => 'Send button'; + + @override + String get themes_iconRepeater => 'Repeaters'; + + @override + String get themes_iconRoom => 'Rooms'; + + @override + String get themes_iconSensor => 'Sensors'; + + @override + String get themes_mapMarkers => 'Map markers'; + + @override + String get themes_mapMarkersHelp => + 'Swap the markers for nodes and for you on the map'; + + @override + String get themes_iconUsePicture => 'Use a picture'; + + @override + String get themes_iconReset => 'Use the default icon'; + + @override + String get themes_iconPictureFailed => 'Could not use that picture'; + + @override + String get themes_exportFile => 'Export to file'; + + @override + String get themes_exportAll => 'Export my themes'; + + @override + String get themes_importFile => 'Import from file'; + + @override + String get themes_pasteCode => 'Paste theme code'; + + @override + String get themes_exportFailed => 'Could not export themes'; + + @override + String themes_importFileResult(int count) { + return 'Imported $count themes'; + } + + @override + String get themes_importFileNone => 'No themes found in that file'; + + @override + String get chatBackground_title => 'Chat background'; + + @override + String get chatBackground_thisChatOnly => 'Only for this chat'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Your theme \"$name\" sets the background in every chat. Turn that off in the theme to use this one.'; + } + + @override + String get chatBackground_none => 'None'; + + @override + String get chatBackground_picture => 'Picture'; + + @override + String get chatBackground_choosePicture => 'Choose a picture'; + + @override + String get chatBackground_pictureFailed => 'Could not use that picture'; + + @override + String get chatBackground_fade => 'Fade'; + + @override + String get themes_chatBackground => 'Chat background'; + + @override + String get themes_chatBackgroundHelp => + 'Shown in chats that do not have their own background'; + + @override + String get themes_chatBackgroundEverywhere => 'Use in every chat'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Also replaces backgrounds set on individual chats'; + @override String get appSettings_language => 'Jezik'; @@ -6568,4 +6799,16 @@ class AppLocalizationsSl extends AppLocalizations { @override String get networkMap_unnamed => 'Repeater brez imena'; + + @override + String get holidayGreeting_halloween => 'Vesel Halloween|Srečen Halloween'; + + @override + String get holidayGreeting_thanksgiving => 'Vesel dan zahvalnosti'; + + @override + String get holidayGreeting_christmas => 'Vesel božič'; + + @override + String get holidayGreeting_newYear => 'Srečno novo leto'; } diff --git a/lib/l10n/app_localizations_sv.dart b/lib/l10n/app_localizations_sv.dart index 91e7f48d..4df9c4d1 100644 --- a/lib/l10n/app_localizations_sv.dart +++ b/lib/l10n/app_localizations_sv.dart @@ -813,6 +813,237 @@ class AppLocalizationsSv extends AppLocalizations { @override String get appSettings_themeDark => 'Mörkt'; + @override + String get appSettings_colorTheme => 'Color theme'; + + @override + String get appSettings_holidayAnimations => 'Holiday message animations'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Bats, a turkey, Santa or fireworks when someone sends a holiday greeting'; + + @override + String get themes_title => 'Themes'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Standard colors, follows the Light / Dark setting'; + + @override + String get themes_builtIn => 'Built-in'; + + @override + String get themes_holidays => 'Holidays'; + + @override + String get themes_holidayAutoSwitch => 'Switch automatically'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Uses each holiday\'s theme from 17 days before until the day itself'; + + @override + String themes_holidayAutoApplied(String holiday) { + return '$holiday theme is on automatically. Your own theme comes back after the holiday.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'On automatically'; + + @override + String get themes_myThemes => 'My themes'; + + @override + String get themes_myThemesEmpty => + 'Make your own theme by picking a background and an accent color.'; + + @override + String get themes_create => 'Create theme'; + + @override + String get themes_import => 'Import theme'; + + @override + String get themes_importHint => 'Paste a theme code'; + + @override + String get themes_importInvalid => 'That is not a valid theme code'; + + @override + String themes_imported(String name) { + return 'Added theme \"$name\"'; + } + + @override + String get themes_customize => 'Customize a copy'; + + @override + String get themes_copyCode => 'Copy theme code'; + + @override + String get themes_codeCopied => 'Theme code copied'; + + @override + String themes_deleteConfirm(String name) { + return 'Delete theme \"$name\"?'; + } + + @override + String themes_copyName(String name) { + return '$name copy'; + } + + @override + String get themes_newTitle => 'New theme'; + + @override + String get themes_editTitle => 'Edit theme'; + + @override + String get themes_name => 'Name'; + + @override + String get themes_nameRequired => 'Give your theme a name'; + + @override + String get themes_background => 'Background'; + + @override + String get themes_backgroundHelp => 'A dark background makes a dark theme'; + + @override + String get themes_accent => 'Accent'; + + @override + String get themes_accentHelp => 'Buttons, highlights and your chat bubbles'; + + @override + String get themes_hexColor => 'Hex color'; + + @override + String get themes_preview => 'Preview'; + + @override + String get themes_previewIncoming => 'Anyone on the mesh tonight?'; + + @override + String get themes_previewOutgoing => 'Loud and clear!'; + + @override + String get themes_previewSwitch => 'Notifications'; + + @override + String get themes_lowContrast => + 'The accent is hard to see on this background'; + + @override + String get themes_saveAndUse => 'Save and use'; + + @override + String get themes_icons => 'Icons'; + + @override + String get themes_iconsHelp => + 'Tap an icon to swap it for another icon or your own picture'; + + @override + String get themes_iconChanged => 'Changed'; + + @override + String get themes_iconSend => 'Send button'; + + @override + String get themes_iconRepeater => 'Repeaters'; + + @override + String get themes_iconRoom => 'Rooms'; + + @override + String get themes_iconSensor => 'Sensors'; + + @override + String get themes_mapMarkers => 'Map markers'; + + @override + String get themes_mapMarkersHelp => + 'Swap the markers for nodes and for you on the map'; + + @override + String get themes_iconUsePicture => 'Use a picture'; + + @override + String get themes_iconReset => 'Use the default icon'; + + @override + String get themes_iconPictureFailed => 'Could not use that picture'; + + @override + String get themes_exportFile => 'Export to file'; + + @override + String get themes_exportAll => 'Export my themes'; + + @override + String get themes_importFile => 'Import from file'; + + @override + String get themes_pasteCode => 'Paste theme code'; + + @override + String get themes_exportFailed => 'Could not export themes'; + + @override + String themes_importFileResult(int count) { + return 'Imported $count themes'; + } + + @override + String get themes_importFileNone => 'No themes found in that file'; + + @override + String get chatBackground_title => 'Chat background'; + + @override + String get chatBackground_thisChatOnly => 'Only for this chat'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Your theme \"$name\" sets the background in every chat. Turn that off in the theme to use this one.'; + } + + @override + String get chatBackground_none => 'None'; + + @override + String get chatBackground_picture => 'Picture'; + + @override + String get chatBackground_choosePicture => 'Choose a picture'; + + @override + String get chatBackground_pictureFailed => 'Could not use that picture'; + + @override + String get chatBackground_fade => 'Fade'; + + @override + String get themes_chatBackground => 'Chat background'; + + @override + String get themes_chatBackgroundHelp => + 'Shown in chats that do not have their own background'; + + @override + String get themes_chatBackgroundEverywhere => 'Use in every chat'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Also replaces backgrounds set on individual chats'; + @override String get appSettings_language => 'Språk'; @@ -6542,4 +6773,17 @@ class AppLocalizationsSv extends AppLocalizations { @override String get networkMap_unnamed => 'Namnlös repeater'; + + @override + String get holidayGreeting_halloween => 'Glad Halloween'; + + @override + String get holidayGreeting_thanksgiving => + 'Glad Thanksgiving|Trevlig Thanksgiving'; + + @override + String get holidayGreeting_christmas => 'God jul'; + + @override + String get holidayGreeting_newYear => 'Gott nytt år'; } diff --git a/lib/l10n/app_localizations_uk.dart b/lib/l10n/app_localizations_uk.dart index b4f9eccf..d2f5c721 100644 --- a/lib/l10n/app_localizations_uk.dart +++ b/lib/l10n/app_localizations_uk.dart @@ -822,6 +822,237 @@ class AppLocalizationsUk extends AppLocalizations { @override String get appSettings_themeDark => 'Темна'; + @override + String get appSettings_colorTheme => 'Color theme'; + + @override + String get appSettings_holidayAnimations => 'Holiday message animations'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Bats, a turkey, Santa or fireworks when someone sends a holiday greeting'; + + @override + String get themes_title => 'Themes'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Standard colors, follows the Light / Dark setting'; + + @override + String get themes_builtIn => 'Built-in'; + + @override + String get themes_holidays => 'Holidays'; + + @override + String get themes_holidayAutoSwitch => 'Switch automatically'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Uses each holiday\'s theme from 17 days before until the day itself'; + + @override + String themes_holidayAutoApplied(String holiday) { + return '$holiday theme is on automatically. Your own theme comes back after the holiday.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'On automatically'; + + @override + String get themes_myThemes => 'My themes'; + + @override + String get themes_myThemesEmpty => + 'Make your own theme by picking a background and an accent color.'; + + @override + String get themes_create => 'Create theme'; + + @override + String get themes_import => 'Import theme'; + + @override + String get themes_importHint => 'Paste a theme code'; + + @override + String get themes_importInvalid => 'That is not a valid theme code'; + + @override + String themes_imported(String name) { + return 'Added theme \"$name\"'; + } + + @override + String get themes_customize => 'Customize a copy'; + + @override + String get themes_copyCode => 'Copy theme code'; + + @override + String get themes_codeCopied => 'Theme code copied'; + + @override + String themes_deleteConfirm(String name) { + return 'Delete theme \"$name\"?'; + } + + @override + String themes_copyName(String name) { + return '$name copy'; + } + + @override + String get themes_newTitle => 'New theme'; + + @override + String get themes_editTitle => 'Edit theme'; + + @override + String get themes_name => 'Name'; + + @override + String get themes_nameRequired => 'Give your theme a name'; + + @override + String get themes_background => 'Background'; + + @override + String get themes_backgroundHelp => 'A dark background makes a dark theme'; + + @override + String get themes_accent => 'Accent'; + + @override + String get themes_accentHelp => 'Buttons, highlights and your chat bubbles'; + + @override + String get themes_hexColor => 'Hex color'; + + @override + String get themes_preview => 'Preview'; + + @override + String get themes_previewIncoming => 'Anyone on the mesh tonight?'; + + @override + String get themes_previewOutgoing => 'Loud and clear!'; + + @override + String get themes_previewSwitch => 'Notifications'; + + @override + String get themes_lowContrast => + 'The accent is hard to see on this background'; + + @override + String get themes_saveAndUse => 'Save and use'; + + @override + String get themes_icons => 'Icons'; + + @override + String get themes_iconsHelp => + 'Tap an icon to swap it for another icon or your own picture'; + + @override + String get themes_iconChanged => 'Changed'; + + @override + String get themes_iconSend => 'Send button'; + + @override + String get themes_iconRepeater => 'Repeaters'; + + @override + String get themes_iconRoom => 'Rooms'; + + @override + String get themes_iconSensor => 'Sensors'; + + @override + String get themes_mapMarkers => 'Map markers'; + + @override + String get themes_mapMarkersHelp => + 'Swap the markers for nodes and for you on the map'; + + @override + String get themes_iconUsePicture => 'Use a picture'; + + @override + String get themes_iconReset => 'Use the default icon'; + + @override + String get themes_iconPictureFailed => 'Could not use that picture'; + + @override + String get themes_exportFile => 'Export to file'; + + @override + String get themes_exportAll => 'Export my themes'; + + @override + String get themes_importFile => 'Import from file'; + + @override + String get themes_pasteCode => 'Paste theme code'; + + @override + String get themes_exportFailed => 'Could not export themes'; + + @override + String themes_importFileResult(int count) { + return 'Imported $count themes'; + } + + @override + String get themes_importFileNone => 'No themes found in that file'; + + @override + String get chatBackground_title => 'Chat background'; + + @override + String get chatBackground_thisChatOnly => 'Only for this chat'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Your theme \"$name\" sets the background in every chat. Turn that off in the theme to use this one.'; + } + + @override + String get chatBackground_none => 'None'; + + @override + String get chatBackground_picture => 'Picture'; + + @override + String get chatBackground_choosePicture => 'Choose a picture'; + + @override + String get chatBackground_pictureFailed => 'Could not use that picture'; + + @override + String get chatBackground_fade => 'Fade'; + + @override + String get themes_chatBackground => 'Chat background'; + + @override + String get themes_chatBackgroundHelp => + 'Shown in chats that do not have their own background'; + + @override + String get themes_chatBackgroundEverywhere => 'Use in every chat'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Also replaces backgrounds set on individual chats'; + @override String get appSettings_language => 'Мова'; @@ -6621,4 +6852,18 @@ class AppLocalizationsUk extends AppLocalizations { @override String get networkMap_unnamed => 'Ретранслятор без назви'; + + @override + String get holidayGreeting_halloween => + 'З Гелловіном|З Хелловіном|Щасливого Гелловіну'; + + @override + String get holidayGreeting_thanksgiving => 'З Днем подяки'; + + @override + String get holidayGreeting_christmas => + 'З Різдвом|Веселого Різдва|Щасливого Різдва'; + + @override + String get holidayGreeting_newYear => 'З Новим роком'; } diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index cf25b49e..c62d8d9b 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -773,6 +773,237 @@ class AppLocalizationsZh extends AppLocalizations { @override String get appSettings_themeDark => '深色'; + @override + String get appSettings_colorTheme => 'Color theme'; + + @override + String get appSettings_holidayAnimations => 'Holiday message animations'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Bats, a turkey, Santa or fireworks when someone sends a holiday greeting'; + + @override + String get themes_title => 'Themes'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Standard colors, follows the Light / Dark setting'; + + @override + String get themes_builtIn => 'Built-in'; + + @override + String get themes_holidays => 'Holidays'; + + @override + String get themes_holidayAutoSwitch => 'Switch automatically'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Uses each holiday\'s theme from 17 days before until the day itself'; + + @override + String themes_holidayAutoApplied(String holiday) { + return '$holiday theme is on automatically. Your own theme comes back after the holiday.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'On automatically'; + + @override + String get themes_myThemes => 'My themes'; + + @override + String get themes_myThemesEmpty => + 'Make your own theme by picking a background and an accent color.'; + + @override + String get themes_create => 'Create theme'; + + @override + String get themes_import => 'Import theme'; + + @override + String get themes_importHint => 'Paste a theme code'; + + @override + String get themes_importInvalid => 'That is not a valid theme code'; + + @override + String themes_imported(String name) { + return 'Added theme \"$name\"'; + } + + @override + String get themes_customize => 'Customize a copy'; + + @override + String get themes_copyCode => 'Copy theme code'; + + @override + String get themes_codeCopied => 'Theme code copied'; + + @override + String themes_deleteConfirm(String name) { + return 'Delete theme \"$name\"?'; + } + + @override + String themes_copyName(String name) { + return '$name copy'; + } + + @override + String get themes_newTitle => 'New theme'; + + @override + String get themes_editTitle => 'Edit theme'; + + @override + String get themes_name => 'Name'; + + @override + String get themes_nameRequired => 'Give your theme a name'; + + @override + String get themes_background => 'Background'; + + @override + String get themes_backgroundHelp => 'A dark background makes a dark theme'; + + @override + String get themes_accent => 'Accent'; + + @override + String get themes_accentHelp => 'Buttons, highlights and your chat bubbles'; + + @override + String get themes_hexColor => 'Hex color'; + + @override + String get themes_preview => 'Preview'; + + @override + String get themes_previewIncoming => 'Anyone on the mesh tonight?'; + + @override + String get themes_previewOutgoing => 'Loud and clear!'; + + @override + String get themes_previewSwitch => 'Notifications'; + + @override + String get themes_lowContrast => + 'The accent is hard to see on this background'; + + @override + String get themes_saveAndUse => 'Save and use'; + + @override + String get themes_icons => 'Icons'; + + @override + String get themes_iconsHelp => + 'Tap an icon to swap it for another icon or your own picture'; + + @override + String get themes_iconChanged => 'Changed'; + + @override + String get themes_iconSend => 'Send button'; + + @override + String get themes_iconRepeater => 'Repeaters'; + + @override + String get themes_iconRoom => 'Rooms'; + + @override + String get themes_iconSensor => 'Sensors'; + + @override + String get themes_mapMarkers => 'Map markers'; + + @override + String get themes_mapMarkersHelp => + 'Swap the markers for nodes and for you on the map'; + + @override + String get themes_iconUsePicture => 'Use a picture'; + + @override + String get themes_iconReset => 'Use the default icon'; + + @override + String get themes_iconPictureFailed => 'Could not use that picture'; + + @override + String get themes_exportFile => 'Export to file'; + + @override + String get themes_exportAll => 'Export my themes'; + + @override + String get themes_importFile => 'Import from file'; + + @override + String get themes_pasteCode => 'Paste theme code'; + + @override + String get themes_exportFailed => 'Could not export themes'; + + @override + String themes_importFileResult(int count) { + return 'Imported $count themes'; + } + + @override + String get themes_importFileNone => 'No themes found in that file'; + + @override + String get chatBackground_title => 'Chat background'; + + @override + String get chatBackground_thisChatOnly => 'Only for this chat'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Your theme \"$name\" sets the background in every chat. Turn that off in the theme to use this one.'; + } + + @override + String get chatBackground_none => 'None'; + + @override + String get chatBackground_picture => 'Picture'; + + @override + String get chatBackground_choosePicture => 'Choose a picture'; + + @override + String get chatBackground_pictureFailed => 'Could not use that picture'; + + @override + String get chatBackground_fade => 'Fade'; + + @override + String get themes_chatBackground => 'Chat background'; + + @override + String get themes_chatBackgroundHelp => + 'Shown in chats that do not have their own background'; + + @override + String get themes_chatBackgroundEverywhere => 'Use in every chat'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Also replaces backgrounds set on individual chats'; + @override String get appSettings_language => '语言'; @@ -6145,4 +6376,16 @@ class AppLocalizationsZh extends AppLocalizations { @override String get networkMap_unnamed => '未命名转发节点'; + + @override + String get holidayGreeting_halloween => '万圣节快乐|萬聖節快樂'; + + @override + String get holidayGreeting_thanksgiving => '感恩节快乐|感恩節快樂'; + + @override + String get holidayGreeting_christmas => '圣诞快乐|聖誕快樂'; + + @override + String get holidayGreeting_newYear => '新年快乐|新年快樂'; } diff --git a/lib/l10n/app_nl.arb b/lib/l10n/app_nl.arb index de918315..d586cb02 100644 --- a/lib/l10n/app_nl.arb +++ b/lib/l10n/app_nl.arb @@ -3356,5 +3356,9 @@ "networkMap_manage": "Beheren", "networkMap_addedToContacts": "Toegevoegd aan contacten", "networkMap_addFailed": "Kan niet aan contacten toevoegen", - "networkMap_unnamed": "Naamloze repeater" + "networkMap_unnamed": "Naamloze repeater", + "holidayGreeting_halloween": "Fijne Halloween|Gelukkige Halloween", + "holidayGreeting_thanksgiving": "Fijne Thanksgiving|Gelukkige Thanksgiving", + "holidayGreeting_christmas": "Vrolijk kerstfeest|Fijne kerst|Prettige kerstdagen|Zalig kerstfeest", + "holidayGreeting_newYear": "Gelukkig Nieuwjaar|Gelukkig nieuw jaar" } diff --git a/lib/l10n/app_pl.arb b/lib/l10n/app_pl.arb index 99895cdc..233d78be 100644 --- a/lib/l10n/app_pl.arb +++ b/lib/l10n/app_pl.arb @@ -3488,5 +3488,9 @@ "networkMap_manage": "Zarządzaj", "networkMap_addedToContacts": "Dodano do kontaktów", "networkMap_addFailed": "Nie udało się dodać do kontaktów", - "networkMap_unnamed": "Repeater bez nazwy" + "networkMap_unnamed": "Repeater bez nazwy", + "holidayGreeting_halloween": "Wesołego Halloween|Szczęśliwego Halloween", + "holidayGreeting_thanksgiving": "Szczęśliwego Święta Dziękczynienia|Wesołego Święta Dziękczynienia", + "holidayGreeting_christmas": "Wesołych Świąt", + "holidayGreeting_newYear": "Szczęśliwego Nowego Roku" } diff --git a/lib/l10n/app_pt.arb b/lib/l10n/app_pt.arb index 16d65258..f1256396 100644 --- a/lib/l10n/app_pt.arb +++ b/lib/l10n/app_pt.arb @@ -3455,5 +3455,9 @@ }, "networkMap_sourceLocalHint": "Nós que o seu rádio ouviu", "networkMap_sourceOnlineHint": "Repetidores do mapa de rede online", - "networkMap_sourceBothHint": "Os nós do seu rádio mais o mapa de rede online" + "networkMap_sourceBothHint": "Os nós do seu rádio mais o mapa de rede online", + "holidayGreeting_halloween": "Feliz Halloween|Feliz Dia das Bruxas", + "holidayGreeting_thanksgiving": "Feliz Dia de Ação de Graças|Feliz Thanksgiving", + "holidayGreeting_christmas": "Feliz Natal|Boas Festas", + "holidayGreeting_newYear": "Feliz Ano Novo" } diff --git a/lib/l10n/app_ru.arb b/lib/l10n/app_ru.arb index cbaee7cd..bf544d85 100644 --- a/lib/l10n/app_ru.arb +++ b/lib/l10n/app_ru.arb @@ -2752,5 +2752,9 @@ "networkMap_manage": "Управлять", "networkMap_addedToContacts": "Добавлено в контакты", "networkMap_addFailed": "Не удалось добавить в контакты", - "networkMap_unnamed": "Репитер без имени" + "networkMap_unnamed": "Репитер без имени", + "holidayGreeting_halloween": "С Хэллоуином|С Хеллоуином|Счастливого Хэллоуина", + "holidayGreeting_thanksgiving": "С Днём благодарения|С Днем благодарения", + "holidayGreeting_christmas": "С Рождеством|Счастливого Рождества", + "holidayGreeting_newYear": "С Новым годом" } diff --git a/lib/l10n/app_sk.arb b/lib/l10n/app_sk.arb index 83314b01..70d5334d 100644 --- a/lib/l10n/app_sk.arb +++ b/lib/l10n/app_sk.arb @@ -3456,5 +3456,9 @@ "networkMap_manage": "Spravovať", "networkMap_addedToContacts": "Pridané do kontaktov", "networkMap_addFailed": "Nepodarilo sa pridať do kontaktov", - "networkMap_unnamed": "Nepomenovaný opakovač" + "networkMap_unnamed": "Nepomenovaný opakovač", + "holidayGreeting_halloween": "Veselý Halloween|Šťastný Halloween", + "holidayGreeting_thanksgiving": "Šťastný Deň vďakyvzdania", + "holidayGreeting_christmas": "Veselé Vianoce", + "holidayGreeting_newYear": "Šťastný Nový rok" } diff --git a/lib/l10n/app_sl.arb b/lib/l10n/app_sl.arb index 9d2f646a..6296e861 100644 --- a/lib/l10n/app_sl.arb +++ b/lib/l10n/app_sl.arb @@ -3456,5 +3456,9 @@ }, "networkMap_sourceLocalHint": "Vozlišča, ki jih je slišal vaš radio", "networkMap_sourceOnlineHint": "Ponovitelji z spletnega zemljevida omrežja", - "networkMap_sourceBothHint": "Vozlišča vašega radia in spletni zemljevid omrežja" + "networkMap_sourceBothHint": "Vozlišča vašega radia in spletni zemljevid omrežja", + "holidayGreeting_halloween": "Vesel Halloween|Srečen Halloween", + "holidayGreeting_thanksgiving": "Vesel dan zahvalnosti", + "holidayGreeting_christmas": "Vesel božič", + "holidayGreeting_newYear": "Srečno novo leto" } diff --git a/lib/l10n/app_sv.arb b/lib/l10n/app_sv.arb index 597c7032..18fff3e6 100644 --- a/lib/l10n/app_sv.arb +++ b/lib/l10n/app_sv.arb @@ -3450,5 +3450,9 @@ }, "networkMap_sourceLocalHint": "Noder som din radio har hört", "networkMap_sourceOnlineHint": "Repeatrar från den online-baserade nätverkskartan", - "networkMap_sourceBothHint": "Din radios noder plus den online-baserade nätverkskartan" + "networkMap_sourceBothHint": "Din radios noder plus den online-baserade nätverkskartan", + "holidayGreeting_halloween": "Glad Halloween", + "holidayGreeting_thanksgiving": "Glad Thanksgiving|Trevlig Thanksgiving", + "holidayGreeting_christmas": "God jul", + "holidayGreeting_newYear": "Gott nytt år" } diff --git a/lib/l10n/app_uk.arb b/lib/l10n/app_uk.arb index 238447fb..0d50b730 100644 --- a/lib/l10n/app_uk.arb +++ b/lib/l10n/app_uk.arb @@ -3435,5 +3435,9 @@ "networkMap_manage": "Керувати", "networkMap_addedToContacts": "Додано до контактів", "networkMap_addFailed": "Не вдалося додати до контактів", - "networkMap_unnamed": "Ретранслятор без назви" + "networkMap_unnamed": "Ретранслятор без назви", + "holidayGreeting_halloween": "З Гелловіном|З Хелловіном|Щасливого Гелловіну", + "holidayGreeting_thanksgiving": "З Днем подяки", + "holidayGreeting_christmas": "З Різдвом|Веселого Різдва|Щасливого Різдва", + "holidayGreeting_newYear": "З Новим роком" } diff --git a/lib/l10n/app_zh.arb b/lib/l10n/app_zh.arb index 1849fe73..65d07569 100644 --- a/lib/l10n/app_zh.arb +++ b/lib/l10n/app_zh.arb @@ -3460,5 +3460,9 @@ }, "networkMap_sourceLocalHint": "你的无线电听到的节点", "networkMap_sourceOnlineHint": "来自在线网络地图的中继器", - "networkMap_sourceBothHint": "你的无线电节点加上在线网络地图" + "networkMap_sourceBothHint": "你的无线电节点加上在线网络地图", + "holidayGreeting_halloween": "万圣节快乐|萬聖節快樂", + "holidayGreeting_thanksgiving": "感恩节快乐|感恩節快樂", + "holidayGreeting_christmas": "圣诞快乐|聖誕快樂", + "holidayGreeting_newYear": "新年快乐|新年快樂" } diff --git a/lib/main.dart b/lib/main.dart index 136adad1..40756719 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -33,6 +33,7 @@ import 'services/map_tile_cache_service.dart'; import 'services/chat_text_scale_service.dart'; import 'services/translation_service.dart'; import 'services/ui_view_state_service.dart'; +import 'services/chat_background_service.dart'; import 'services/timeout_prediction_service.dart'; import 'storage/prefs_manager.dart'; import 'theme/mesh_theme.dart'; @@ -83,8 +84,13 @@ void main() async { // `appSettingsService.settings`, so this cannot stay where it used to be // (after the constructions) without those two starting out wrong. await appSettingsService.loadSettings(); + // Re-check the automatic holiday theme when the date changes. + appSettingsService.startDateWatch(); // Undo a review-mode session the app was killed in before it could exit. await endReviewModeSession(appSettingsService); + final chatBackgroundService = ChatBackgroundService(appSettingsService); + // Drop pictures left behind by removed backgrounds or abandoned edits. + unawaited(chatBackgroundService.collectGarbage()); // ---- image messages (AEIC over GRP_DATA) -------------------------------- // The codec owns the ONNX decoder; the store owns received-image state and @@ -209,6 +215,7 @@ void main() async { receivedImageStore: receivedImageStore, imageReassembler: imageReassembler, networkMapUploadService: networkMapUploadService, + chatBackgroundService: chatBackgroundService, ), ); } @@ -354,6 +361,7 @@ class MeshCoreApp extends StatefulWidget { final ReceivedImageStore receivedImageStore; final ImageStreamReassembler imageReassembler; final NetworkMapUploadService networkMapUploadService; + final ChatBackgroundService chatBackgroundService; const MeshCoreApp({ super.key, @@ -373,6 +381,7 @@ class MeshCoreApp extends StatefulWidget { required this.receivedImageStore, required this.imageReassembler, required this.networkMapUploadService, + required this.chatBackgroundService, }); @override @@ -465,9 +474,11 @@ class _MeshCoreAppState extends State with WidgetsBindingObserver { ChangeNotifierProvider.value(value: widget.imageCodecService), ChangeNotifierProvider.value(value: widget.receivedImageStore), ChangeNotifierProvider.value(value: widget.networkMapUploadService), + ChangeNotifierProvider.value(value: widget.chatBackgroundService), ], child: Consumer( builder: (context, settingsService, child) { + final customTheme = settingsService.activeCustomTheme; return MaterialApp( title: 'MeshCore Open', debugShowCheckedModeBanner: false, @@ -481,11 +492,15 @@ class _MeshCoreAppState extends State with WidgetsBindingObserver { locale: _localeFromSetting( settingsService.settings.languageOverride, ), - theme: MeshTheme.light(), - darkTheme: MeshTheme.dark(), - themeMode: _themeModeFromSetting( - settingsService.settings.themeMode, - ), + theme: customTheme != null + ? MeshTheme.fromCustom(customTheme) + : MeshTheme.light(), + darkTheme: customTheme != null + ? MeshTheme.fromCustom(customTheme) + : MeshTheme.dark(), + themeMode: customTheme != null + ? (customTheme.isDark ? ThemeMode.dark : ThemeMode.light) + : _themeModeFromSetting(settingsService.settings.themeMode), builder: (context, child) { // Update notification service with resolved locale final locale = Localizations.localeOf(context); diff --git a/lib/models/app_settings.dart b/lib/models/app_settings.dart index b51c155e..6d0877a1 100644 --- a/lib/models/app_settings.dart +++ b/lib/models/app_settings.dart @@ -1,3 +1,4 @@ +import 'custom_theme.dart'; import 'image_codec_support.dart'; import 'translation_support.dart'; @@ -135,6 +136,25 @@ class AppSettings { /// different first-hop repeaters also satisfies the channel resend. final bool channelMinHopsCountRepeaters; final String themeMode; + + /// Themes the user made. Built-in presets live in [CustomTheme.presets]. + final List customThemes; + + /// ID of the active custom or preset theme; null uses the stock theme with + /// [themeMode]. + final String? activeThemeId; + + /// Play a short animation for holiday greetings ("Happy Halloween", ...). + final bool holidayAnimationsEnabled; + + /// Show each holiday's theme automatically in the days before it (see + /// `activeHolidayFor`), without changing [activeThemeId]. + final bool holidayAutoSwitch; + + /// Occurrence key (`ActiveHoliday.occurrenceKey`) of the holiday whose + /// automatic theme the user overrode by picking a theme themselves. Only + /// that occurrence is skipped; the next holiday switches again. + final String? holidayThemeDismissed; final String? languageOverride; // null = system default final bool appDebugLogEnabled; final Map batteryChemistryByDeviceId; @@ -265,6 +285,11 @@ class AppSettings { this.channelMinHopsRetries = 1, this.channelMinHopsCountRepeaters = false, this.themeMode = 'system', + this.customThemes = const [], + this.activeThemeId, + this.holidayAnimationsEnabled = true, + this.holidayAutoSwitch = true, + this.holidayThemeDismissed, this.languageOverride, this.appDebugLogEnabled = false, Map? batteryChemistryByDeviceId, @@ -356,6 +381,11 @@ class AppSettings { 'channel_min_hops_retries': channelMinHopsRetries, 'channel_min_hops_count_repeaters': channelMinHopsCountRepeaters, 'theme_mode': themeMode, + 'custom_themes': customThemes.map((t) => t.toJson()).toList(), + 'active_theme_id': activeThemeId, + 'holiday_animations_enabled': holidayAnimationsEnabled, + 'holiday_auto_switch': holidayAutoSwitch, + 'holiday_theme_dismissed': holidayThemeDismissed, 'language_override': languageOverride, 'app_debug_log_enabled': appDebugLogEnabled, 'battery_chemistry_by_device_id': batteryChemistryByDeviceId, @@ -494,6 +524,18 @@ class AppSettings { channelMinHopsCountRepeaters: json['channel_min_hops_count_repeaters'] as bool? ?? false, themeMode: json['theme_mode'] as String? ?? 'system', + customThemes: + (json['custom_themes'] as List?) + ?.whereType() + .map((e) => CustomTheme.fromJson(Map.from(e))) + .where((t) => t.id.isNotEmpty) + .toList() ?? + const [], + activeThemeId: json['active_theme_id'] as String?, + holidayAnimationsEnabled: + json['holiday_animations_enabled'] as bool? ?? true, + holidayAutoSwitch: json['holiday_auto_switch'] as bool? ?? true, + holidayThemeDismissed: json['holiday_theme_dismissed'] as String?, languageOverride: json['language_override'] as String?, appDebugLogEnabled: json['app_debug_log_enabled'] as bool? ?? false, batteryChemistryByDeviceId: @@ -637,6 +679,11 @@ class AppSettings { int? channelMinHopsRetries, bool? channelMinHopsCountRepeaters, String? themeMode, + List? customThemes, + Object? activeThemeId = _unset, + bool? holidayAnimationsEnabled, + bool? holidayAutoSwitch, + Object? holidayThemeDismissed = _unset, Object? languageOverride = _unset, bool? appDebugLogEnabled, Map? batteryChemistryByDeviceId, @@ -725,6 +772,16 @@ class AppSettings { channelMinHopsCountRepeaters: channelMinHopsCountRepeaters ?? this.channelMinHopsCountRepeaters, themeMode: themeMode ?? this.themeMode, + customThemes: customThemes ?? this.customThemes, + activeThemeId: activeThemeId == _unset + ? this.activeThemeId + : activeThemeId as String?, + holidayAnimationsEnabled: + holidayAnimationsEnabled ?? this.holidayAnimationsEnabled, + holidayAutoSwitch: holidayAutoSwitch ?? this.holidayAutoSwitch, + holidayThemeDismissed: holidayThemeDismissed == _unset + ? this.holidayThemeDismissed + : holidayThemeDismissed as String?, languageOverride: languageOverride == _unset ? this.languageOverride : languageOverride as String?, diff --git a/lib/models/chat_background.dart b/lib/models/chat_background.dart new file mode 100644 index 00000000..c70858d9 --- /dev/null +++ b/lib/models/chat_background.dart @@ -0,0 +1,132 @@ +import 'dart:convert'; +import 'dart:ui'; + +import 'package:flutter/foundation.dart'; + +import '../theme/theme_icons.dart' show isThemeAssetPath; +import 'custom_theme.dart'; + +/// Background drawn behind a chat's messages: a color or a picture. +/// +/// [fade] blends the theme's normal background over it (0 = full strength, +/// 1 = invisible) so text drawn outside bubbles stays readable. +@immutable +class ChatBackground { + static const double defaultFade = 0.4; + static const double minFade = 0.1; + static const double maxFade = 0.9; + + final Color? color; + + /// ID of a picture in the chat background image store. + final String? imageId; + + /// Picture bytes carried inside a share code or `.jsonl` file, before it + /// has been written to the image store. Never persisted in settings. + final Uint8List? inlineImage; + + /// A JPEG XL picture bundled with the app (built-in themes). + final String? asset; + + final double fade; + + const ChatBackground.color(Color this.color, {this.fade = defaultFade}) + : imageId = null, + inlineImage = null, + asset = null; + + const ChatBackground.image(String this.imageId, {this.fade = defaultFade}) + : color = null, + inlineImage = null, + asset = null; + + const ChatBackground.asset(String this.asset, {this.fade = defaultFade}) + : color = null, + imageId = null, + inlineImage = null; + + const ChatBackground._({ + this.color, + this.imageId, + this.inlineImage, + this.asset, + required this.fade, + }); + + bool get isImage => imageId != null || inlineImage != null || asset != null; + + ChatBackground withFade(double value) => ChatBackground._( + color: color, + imageId: imageId, + inlineImage: inlineImage, + asset: asset, + fade: value.clamp(minFade, maxFade).toDouble(), + ); + + /// A copy whose picture lives in the image store under [id]. + ChatBackground withStoredImage(String id) => + ChatBackground._(imageId: id, fade: fade); + + /// A copy carrying the picture bytes for sharing. + ChatBackground withInlineImage(Uint8List bytes) => + ChatBackground._(imageId: imageId, inlineImage: bytes, fade: fade); + + /// Storage form: a color or an image-store ID. + Map toJson() => { + if (color != null) 'color': colorToHex(color!), + if (imageId != null) 'image': imageId, + if (asset != null) 'asset': asset, + 'fade': fade, + }; + + /// Sharing form: a color or the picture itself. Null when this is a + /// picture whose bytes were not attached. + Map? toShareJson() { + if (color != null) return {'color': colorToHex(color!), 'fade': fade}; + // Bundled pictures exist in every install, so the path is enough. + if (asset != null) return {'asset': asset, 'fade': fade}; + if (inlineImage != null) { + return {'imageData': base64Encode(inlineImage!), 'fade': fade}; + } + return null; + } + + static ChatBackground? fromJson(Object? json) { + if (json is! Map) return null; + final rawFade = json['fade']; + final fade = (rawFade is num ? rawFade.toDouble() : defaultFade) + .clamp(minFade, maxFade) + .toDouble(); + final color = parseHexColor(json['color']); + if (color != null) return ChatBackground.color(color, fade: fade); + final asset = json['asset']; + if (isThemeAssetPath(asset)) { + return ChatBackground.asset(asset as String, fade: fade); + } + final imageId = json['image']; + if (imageId is String && imageId.isNotEmpty) { + return ChatBackground.image(imageId, fade: fade); + } + final data = json['imageData']; + if (data is String && data.isNotEmpty) { + try { + return ChatBackground._(inlineImage: base64Decode(data), fade: fade); + } on FormatException { + return null; + } + } + return null; + } + + @override + bool operator ==(Object other) => + other is ChatBackground && + other.color == color && + other.imageId == imageId && + other.asset == asset && + other.fade == fade && + identical(other.inlineImage, inlineImage); + + @override + int get hashCode => Object.hash(color, imageId, asset, fade, inlineImage); +} diff --git a/lib/models/custom_theme.dart b/lib/models/custom_theme.dart new file mode 100644 index 00000000..0ff4772d --- /dev/null +++ b/lib/models/custom_theme.dart @@ -0,0 +1,394 @@ +import 'dart:convert'; +import 'dart:ui'; + +import 'package:flutter/foundation.dart'; + +import '../theme/theme_icons.dart'; +import 'chat_background.dart'; + +/// A user-made theme. +/// +/// Kept deliberately small: a theme is a name plus two colors. Everything +/// else (surfaces, text, borders, chat bubbles, light vs dark) is derived +/// from those two, so anyone can make a readable theme in a few taps. +/// Optionally it swaps some app icons for other icons or small pictures. +/// +/// The share code is plain JSON, so a theme can also be written by hand: +/// +/// ```json +/// {"name": "Forest", "background": "#0E1A13", "accent": "#4ADE80", +/// "icons": {"map": {"icon": "park"}}} +/// ``` +class CustomTheme { + static const Object _unset = Object(); + + /// Prefix for the IDs of the built-in [presets]. + static const presetIdPrefix = 'preset:'; + + final String id; + final String name; + + /// Main screen color. Its brightness decides whether the theme is light or + /// dark. + final Color background; + + /// Buttons, switches, links, highlights and your own chat bubbles. + final Color accent; + + /// Replacement icons keyed by [ThemeIconSlot.key]; empty keeps defaults. + final Map icons; + + /// Background for chats that have none of their own. + final ChatBackground? chatBackground; + + /// When true, [chatBackground] also replaces chats' own backgrounds. + final bool chatBackgroundEverywhere; + + const CustomTheme({ + required this.id, + required this.name, + required this.background, + required this.accent, + this.icons = const {}, + this.chatBackground, + this.chatBackgroundEverywhere = false, + }); + + bool get isPreset => id.startsWith(presetIdPrefix); + + /// True when [background] is dark enough to need light text. + bool get isDark => isDarkColor(background); + + CustomTheme copyWith({ + String? id, + String? name, + Color? background, + Color? accent, + Map? icons, + Object? chatBackground = _unset, + bool? chatBackgroundEverywhere, + }) { + return CustomTheme( + id: id ?? this.id, + name: name ?? this.name, + background: background ?? this.background, + accent: accent ?? this.accent, + icons: icons ?? this.icons, + chatBackground: identical(chatBackground, _unset) + ? this.chatBackground + : chatBackground as ChatBackground?, + chatBackgroundEverywhere: + chatBackgroundEverywhere ?? this.chatBackgroundEverywhere, + ); + } + + /// Storage form: chat background pictures are referenced by image-store ID. + Map toJson() => { + 'id': id, + ..._contentJson(), + if (chatBackground != null) 'chat_background': chatBackground!.toJson(), + if (chatBackgroundEverywhere) 'chat_background_everywhere': true, + }; + + Map _contentJson() => { + 'name': name, + 'background': colorToHex(background), + 'accent': colorToHex(accent), + if (icons.isNotEmpty) + 'icons': icons.map((key, value) => MapEntry(key, value.toJson())), + }; + + factory CustomTheme.fromJson(Map json) { + return CustomTheme( + id: json['id'] as String? ?? '', + name: (json['name'] as String? ?? '').trim(), + background: parseHexColor(json['background']) ?? const Color(0xFF0B1220), + accent: parseHexColor(json['accent']) ?? const Color(0xFF0EA5E9), + icons: parseThemeIcons(json['icons']), + chatBackground: ChatBackground.fromJson(json['chat_background']), + chatBackgroundEverywhere: json['chat_background_everywhere'] == true, + ); + } + + /// Human-readable JSON for sharing (no ID). Pictures are embedded, so a + /// theme with pictures makes a longer code. A chat background picture is + /// only included once its bytes are attached (see + /// `ChatBackgroundService.embedThemeImages`). + String toShareCode() { + final chat = chatBackground?.toShareJson(); + return jsonEncode({ + ..._contentJson(), + 'chatBackground': ?chat, + if (chat != null && chatBackgroundEverywhere) + 'chatBackgroundEverywhere': true, + }); + } + + /// Parses a share code. Returns null when [code] is not a valid theme. + /// The returned theme carries [newId]. + static CustomTheme? fromShareCode(String code, {required String newId}) { + try { + final decoded = jsonDecode(code.trim()); + if (decoded is! Map) return null; + final name = decoded['name']; + final background = parseHexColor(decoded['background']); + final accent = parseHexColor(decoded['accent']); + if (name is! String || name.trim().isEmpty) return null; + if (background == null || accent == null) return null; + return CustomTheme( + id: newId, + name: name.trim(), + background: background, + accent: accent, + icons: parseThemeIcons(decoded['icons']), + // Only colors and inline pictures: an image-store ID from another + // device would point at nothing here. + chatBackground: _sharedChatBackground(decoded['chatBackground']), + chatBackgroundEverywhere: decoded['chatBackgroundEverywhere'] == true, + ); + } on FormatException { + return null; + } + } + + @override + bool operator ==(Object other) => + other is CustomTheme && + other.id == id && + other.name == name && + other.background == background && + other.accent == accent && + mapEquals(other.icons, icons) && + other.chatBackground == chatBackground && + other.chatBackgroundEverywhere == chatBackgroundEverywhere; + + @override + int get hashCode => Object.hash( + id, + name, + background, + accent, + Object.hashAllUnordered( + icons.entries.map((e) => Object.hash(e.key, e.value)), + ), + chatBackground, + chatBackgroundEverywhere, + ); + + static ChatBackground? _sharedChatBackground(Object? json) { + final background = ChatBackground.fromJson(json); + if (background == null || background.imageId != null) return null; + return background; + } + + /// Ready-made themes. They also serve as starting points for new ones. + static const List presets = [ + CustomTheme( + id: '${presetIdPrefix}forest', + name: 'Forest', + background: Color(0xFF0E1A13), + accent: Color(0xFF4ADE80), + ), + CustomTheme( + id: '${presetIdPrefix}ocean', + name: 'Ocean', + background: Color(0xFF071A2B), + accent: Color(0xFF22D3EE), + ), + CustomTheme( + id: '${presetIdPrefix}ember', + name: 'Ember', + background: Color(0xFF1C1210), + accent: Color(0xFFFB923C), + ), + CustomTheme( + id: '${presetIdPrefix}grape', + name: 'Grape', + background: Color(0xFF17112A), + accent: Color(0xFFC084FC), + ), + CustomTheme( + id: '${presetIdPrefix}high_contrast', + name: 'High Contrast', + background: Color(0xFF000000), + accent: Color(0xFFFACC15), + ), + CustomTheme( + id: '${presetIdPrefix}paper', + name: 'Paper', + background: Color(0xFFFAF7F0), + accent: Color(0xFF9A3412), + ), + CustomTheme( + id: '${presetIdPrefix}mint', + name: 'Mint', + background: Color(0xFFEFFAF4), + accent: Color(0xFF047857), + ), + CustomTheme( + id: '${presetIdPrefix}sky', + name: 'Sky', + background: Color(0xFFF0F6FC), + accent: Color(0xFF1D4ED8), + ), + ]; + + /// Holiday themes: colors, a chat background and festive icons, all + /// bundled under `assets/themes//`. + static const List holidayPresets = [ + CustomTheme( + id: '${presetIdPrefix}halloween', + name: 'Halloween', + background: Color(0xFF160F22), + accent: Color(0xFFFF7A1A), + icons: _HolidayIcons.halloween, + chatBackground: ChatBackground.asset( + 'assets/themes/halloween/background.jxl', + fade: 0.35, + ), + ), + CustomTheme( + id: '${presetIdPrefix}thanksgiving', + name: 'Thanksgiving', + background: Color(0xFF1C120B), + accent: Color(0xFFF2A93B), + icons: _HolidayIcons.thanksgiving, + chatBackground: ChatBackground.asset( + 'assets/themes/thanksgiving/background.jxl', + fade: 0.3, + ), + ), + CustomTheme( + id: '${presetIdPrefix}christmas', + name: 'Christmas', + background: Color(0xFF0B1F14), + accent: Color(0xFFE5484D), + icons: _HolidayIcons.christmas, + chatBackground: ChatBackground.asset( + 'assets/themes/christmas/background.jxl', + fade: 0.35, + ), + ), + CustomTheme( + id: '${presetIdPrefix}new_year', + name: "New Year's", + background: Color(0xFF0A1024), + accent: Color(0xFFF5C542), + icons: _HolidayIcons.newYear, + chatBackground: ChatBackground.asset( + 'assets/themes/new_year/background.jxl', + fade: 0.35, + ), + ), + ]; + + static CustomTheme? presetById(String id) { + for (final preset in [...presets, ...holidayPresets]) { + if (preset.id == id) return preset; + } + return null; + } +} + +/// `#RRGGBB` (alpha dropped — themes are always opaque). +String colorToHex(Color color) { + final rgb = color.toARGB32() & 0xFFFFFF; + return '#${rgb.toRadixString(16).padLeft(6, '0').toUpperCase()}'; +} + +/// Accepts `#RRGGBB`, `RRGGBB`, `#RGB` or `RGB`. Returns an opaque color, or +/// null when [value] is not a hex color. +Color? parseHexColor(Object? value) { + if (value is! String) return null; + var hex = value.trim(); + if (hex.startsWith('#')) hex = hex.substring(1); + if (hex.length == 3) { + hex = hex.split('').map((c) => '$c$c').join(); + } + if (hex.length != 6) return null; + final rgb = int.tryParse(hex, radix: 16); + if (rgb == null) return null; + return Color(0xFF000000 | rgb); +} + +/// Same threshold Flutter's `ThemeData.estimateBrightnessForColor` uses, so +/// "dark" here agrees with Material's text-color choices. +bool isDarkColor(Color color) { + final luminance = color.computeLuminance(); + const kThreshold = 0.15; + return (luminance + 0.05) * (luminance + 0.05) <= kThreshold; +} + +/// Icon sets for [CustomTheme.holidayPresets]: the three tabs and Send. +abstract final class _HolidayIcons { + static const halloween = { + 'contacts': ThemeIconOverride.asset('assets/themes/halloween/contacts.jxl'), + 'channels': ThemeIconOverride.asset('assets/themes/halloween/channels.jxl'), + 'map': ThemeIconOverride.asset('assets/themes/halloween/map.jxl'), + 'send': ThemeIconOverride.asset('assets/themes/halloween/send.jxl'), + 'map_chat': ThemeIconOverride.asset('assets/themes/halloween/map_chat.jxl'), + 'map_repeater': ThemeIconOverride.asset( + 'assets/themes/halloween/map_repeater.jxl', + ), + 'map_room': ThemeIconOverride.asset('assets/themes/halloween/map_room.jxl'), + 'map_sensor': ThemeIconOverride.asset( + 'assets/themes/halloween/map_sensor.jxl', + ), + 'map_self': ThemeIconOverride.asset('assets/themes/halloween/map_self.jxl'), + }; + static const thanksgiving = { + 'contacts': ThemeIconOverride.asset( + 'assets/themes/thanksgiving/contacts.jxl', + ), + 'channels': ThemeIconOverride.asset( + 'assets/themes/thanksgiving/channels.jxl', + ), + 'map': ThemeIconOverride.asset('assets/themes/thanksgiving/map.jxl'), + 'send': ThemeIconOverride.asset('assets/themes/thanksgiving/send.jxl'), + 'map_chat': ThemeIconOverride.asset( + 'assets/themes/thanksgiving/map_chat.jxl', + ), + 'map_repeater': ThemeIconOverride.asset( + 'assets/themes/thanksgiving/map_repeater.jxl', + ), + 'map_room': ThemeIconOverride.asset( + 'assets/themes/thanksgiving/map_room.jxl', + ), + 'map_sensor': ThemeIconOverride.asset( + 'assets/themes/thanksgiving/map_sensor.jxl', + ), + 'map_self': ThemeIconOverride.asset( + 'assets/themes/thanksgiving/map_self.jxl', + ), + }; + static const christmas = { + 'contacts': ThemeIconOverride.asset('assets/themes/christmas/contacts.jxl'), + 'channels': ThemeIconOverride.asset('assets/themes/christmas/channels.jxl'), + 'map': ThemeIconOverride.asset('assets/themes/christmas/map.jxl'), + 'send': ThemeIconOverride.asset('assets/themes/christmas/send.jxl'), + 'map_chat': ThemeIconOverride.asset('assets/themes/christmas/map_chat.jxl'), + 'map_repeater': ThemeIconOverride.asset( + 'assets/themes/christmas/map_repeater.jxl', + ), + 'map_room': ThemeIconOverride.asset('assets/themes/christmas/map_room.jxl'), + 'map_sensor': ThemeIconOverride.asset( + 'assets/themes/christmas/map_sensor.jxl', + ), + 'map_self': ThemeIconOverride.asset('assets/themes/christmas/map_self.jxl'), + }; + static const newYear = { + 'contacts': ThemeIconOverride.asset('assets/themes/new_year/contacts.jxl'), + 'channels': ThemeIconOverride.asset('assets/themes/new_year/channels.jxl'), + 'map': ThemeIconOverride.asset('assets/themes/new_year/map.jxl'), + 'send': ThemeIconOverride.asset('assets/themes/new_year/send.jxl'), + 'map_chat': ThemeIconOverride.asset('assets/themes/new_year/map_chat.jxl'), + 'map_repeater': ThemeIconOverride.asset( + 'assets/themes/new_year/map_repeater.jxl', + ), + 'map_room': ThemeIconOverride.asset('assets/themes/new_year/map_room.jxl'), + 'map_sensor': ThemeIconOverride.asset( + 'assets/themes/new_year/map_sensor.jxl', + ), + 'map_self': ThemeIconOverride.asset('assets/themes/new_year/map_self.jxl'), + }; +} diff --git a/lib/models/holiday_schedule.dart b/lib/models/holiday_schedule.dart new file mode 100644 index 00000000..0f635ec0 --- /dev/null +++ b/lib/models/holiday_schedule.dart @@ -0,0 +1,101 @@ +import 'custom_theme.dart'; + +/// How many days before a holiday its theme starts being applied +/// automatically. The holiday day itself is distance 0. +const int holidayThemeLeadDays = 17; + +/// The holidays that have an automatic theme, in calendar order. +enum ThemeHoliday { + halloween('${CustomTheme.presetIdPrefix}halloween'), + thanksgiving('${CustomTheme.presetIdPrefix}thanksgiving'), + christmas('${CustomTheme.presetIdPrefix}christmas'), + newYear('${CustomTheme.presetIdPrefix}new_year'); + + const ThemeHoliday(this.themeId); + + /// ID of the matching preset in [CustomTheme.holidayPresets]. + final String themeId; + + /// The holiday's date in [year]: Halloween Oct 31, US Thanksgiving (the + /// fourth Thursday of November), Christmas Dec 25, New Year's Day Jan 1. + DateTime dateIn(int year) { + switch (this) { + case ThemeHoliday.halloween: + return DateTime(year, 10, 31); + case ThemeHoliday.thanksgiving: + final nov1 = DateTime(year, 11, 1); + final toThursday = (DateTime.thursday - nov1.weekday + 7) % 7; + return DateTime(year, 11, 1 + toThursday + 21); + case ThemeHoliday.christmas: + return DateTime(year, 12, 25); + case ThemeHoliday.newYear: + return DateTime(year, 1, 1); + } + } +} + +/// One occurrence of a [ThemeHoliday] that is currently within its window. +class ActiveHoliday { + final ThemeHoliday holiday; + + /// Local date (midnight) of this occurrence of the holiday. + final DateTime date; + + /// Whole days from today until [date]; 0 on the holiday itself. + final int daysAway; + + const ActiveHoliday(this.holiday, this.date, this.daysAway); + + String get themeId => holiday.themeId; + + /// Identifies this occurrence, e.g. `preset:christmas@2026-12-25`, so a + /// dismissal applies to one year's holiday only. + String get occurrenceKey { + String two(int v) => v.toString().padLeft(2, '0'); + return '$themeId@${date.year}-${two(date.month)}-${two(date.day)}'; + } + + @override + bool operator ==(Object other) => + other is ActiveHoliday && + other.holiday == holiday && + other.date == date && + other.daysAway == daysAway; + + @override + int get hashCode => Object.hash(holiday, date, daysAway); + + @override + String toString() => 'ActiveHoliday($occurrenceKey, $daysAway days away)'; +} + +/// The holiday whose theme should be showing on [today] (local date; the +/// time of day is ignored), or null when none is close enough. +/// +/// For each holiday the next occurrence on or after today is taken (today +/// counts, and the year wraps, so on Dec 20 New Year's is the coming Jan 1). +/// Holidays 0..[holidayThemeLeadDays] days away are candidates and the +/// nearest one wins. That means a holiday keeps its theme up to and including +/// its own day even if a later holiday's window has opened (Thanksgiving +/// before Christmas, Christmas before New Year's), and the next holiday takes +/// over the day after. Once a holiday has passed and no other is within the +/// window, null is returned and the user's own theme applies again. +ActiveHoliday? activeHolidayFor(DateTime today) { + // Day arithmetic in UTC so daylight-saving shifts never skew the count. + final day = DateTime.utc(today.year, today.month, today.day); + ActiveHoliday? best; + for (final holiday in ThemeHoliday.values) { + var date = holiday.dateIn(today.year); + var target = DateTime.utc(date.year, date.month, date.day); + if (target.isBefore(day)) { + date = holiday.dateIn(today.year + 1); + target = DateTime.utc(date.year, date.month, date.day); + } + final daysAway = target.difference(day).inDays; + if (daysAway > holidayThemeLeadDays) continue; + if (best == null || daysAway < best.daysAway) { + best = ActiveHoliday(holiday, date, daysAway); + } + } + return best; +} diff --git a/lib/screens/app_settings_screen.dart b/lib/screens/app_settings_screen.dart index 51e2e5dd..67c6ffce 100644 --- a/lib/screens/app_settings_screen.dart +++ b/lib/screens/app_settings_screen.dart @@ -23,6 +23,7 @@ import '../widgets/sync_progress_overlay.dart'; import '../widgets/translation_settings_section.dart'; import '../helpers/snack_bar_builder.dart'; import 'map_cache_screen.dart'; +import 'themes_screen.dart'; class AppSettingsScreen extends StatelessWidget { /// Scrolls the image-message settings into view once, on first build. @@ -192,8 +193,15 @@ class AppSettingsScreen extends StatelessWidget { label: Text(context.l10n.appSettings_themeDark), ), ], - selected: {settingsService.settings.themeMode}, + // A custom theme sets its own brightness, so no stock mode + // is selected while one is active; picking a mode returns + // to the stock theme. + emptySelectionAllowed: true, + selected: settingsService.activeCustomTheme == null + ? {settingsService.settings.themeMode} + : const {}, onSelectionChanged: (selection) { + if (selection.isEmpty) return; settingsService.setThemeMode(selection.first); }, ), @@ -201,6 +209,36 @@ class AppSettingsScreen extends StatelessWidget { ), ), const Divider(height: 1, indent: 16), + MeshNavTile( + icon: Icons.palette_outlined, + title: context.l10n.appSettings_colorTheme, + subtitle: + settingsService.activeCustomTheme?.name ?? + context.l10n.themes_default, + trailing: settingsService.activeCustomTheme == null + ? null + : ThemeSwatch( + background: settingsService.activeCustomTheme!.background, + accent: settingsService.activeCustomTheme!.accent, + size: 32, + ), + onTap: () => Navigator.of( + context, + ).push(MaterialPageRoute(builder: (_) => const ThemesScreen())), + ), + const Divider(height: 1, indent: 16), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: const Icon(Icons.celebration_outlined, size: 24), + title: Text(context.l10n.appSettings_holidayAnimations), + subtitle: Text(context.l10n.appSettings_holidayAnimationsSubtitle), + value: settingsService.settings.holidayAnimationsEnabled, + onChanged: settingsService.setHolidayAnimationsEnabled, + ), + const Divider(height: 1, indent: 16), MeshNavTile( icon: Icons.language_outlined, title: context.l10n.appSettings_language, diff --git a/lib/screens/channel_chat_screen.dart b/lib/screens/channel_chat_screen.dart index dc737b95..097d0e16 100644 --- a/lib/screens/channel_chat_screen.dart +++ b/lib/screens/channel_chat_screen.dart @@ -66,6 +66,9 @@ import 'map_screen.dart'; import 'region_management_screen.dart'; import '../storage/region_store.dart'; import '../utils/share_origin.dart'; +import '../services/chat_background_service.dart'; +import '../widgets/chat_background.dart'; +import '../widgets/holiday_animations.dart'; class ChannelChatScreen extends StatefulWidget { final Channel channel; @@ -82,6 +85,8 @@ class ChannelChatScreen extends StatefulWidget { } class _ChannelChatScreenState extends State { + final _holidayWatcher = HolidayTriggerWatcher(); + final _messageAreaKey = GlobalKey(); final TextEditingController _textController = TextEditingController(); final ChatScrollController _scrollController = ChatScrollController(); final FocusNode _textFieldFocusNode = FocusNode(); @@ -435,6 +440,11 @@ class _ChannelChatScreenState extends State { onSelected: (value) { if (value == 'region') { openRegionSelectDialog(widget.channel); + } else if (value == 'background') { + showChatBackgroundSheet( + context, + ChatBackgroundService.channelKey(widget.channel), + ); } else if (value == 'clearChat') { _confirmClearChat(); } @@ -452,6 +462,16 @@ class _ChannelChatScreenState extends State { ], ), ), + PopupMenuItem( + value: 'background', + child: Row( + children: [ + const Icon(Icons.wallpaper, size: 20), + const SizedBox(width: 12), + Text(context.l10n.chatBackground_title), + ], + ), + ), PopupMenuItem( value: 'clearChat', child: Row( @@ -480,130 +500,148 @@ class _ChannelChatScreenState extends State { child: Column( children: [ Expanded( - child: Consumer( - builder: (context, connector, child) { - final messages = connector.getChannelMessages(widget.channel); - final layout = _transcriptLayoutFor(context, messages); - - if (layout.length == 0) { - return EmptyState( - icon: widget.channel.isPublicChannel - ? Icons.public - : Icons.tag, - title: context.l10n.chat_noMessages, - subtitle: context.l10n.chat_sendMessageTo( - widget.channel.name.isEmpty - ? context.l10n.channels_channelIndex( - widget.channel.index, - ) - : widget.channel.name, + child: ChatBackdrop( + key: _messageAreaKey, + chatKey: ChatBackgroundService.channelKey(widget.channel), + child: Consumer( + builder: (context, connector, child) { + final messages = connector.getChannelMessages( + widget.channel, + ); + final newest = messages.isEmpty ? null : messages.last; + _holidayWatcher.onNewest( + context, + id: newest?.messageId, + texts: [newest?.text, newest?.translatedText], + receivedAt: newest?.receivedAt, + originOf: () => newestMessageOrigin( + _messageAreaKey, + isOutgoing: newest?.isOutgoing ?? false, ), ); - } + final layout = _transcriptLayoutFor(context, messages); - final urlImagesEnabled = connector.isChannelUrlImagesEnabled( - widget.channel.index, - ); - final rowCount = layout.length; - final itemCount = rowCount + (_isLoadingOlder ? 1 : 0); - - // Auto-scroll to bottom if user is already at bottom - WidgetsBinding.instance.addPostFrameCallback((_) { - if (!mounted) return; - if (_channelSkipNextBottomSnap) { - _channelSkipNextBottomSnap = false; - return; + if (layout.length == 0) { + return EmptyState( + icon: widget.channel.isPublicChannel + ? Icons.public + : Icons.tag, + title: context.l10n.chat_noMessages, + subtitle: context.l10n.chat_sendMessageTo( + widget.channel.name.isEmpty + ? context.l10n.channels_channelIndex( + widget.channel.index, + ) + : widget.channel.name, + ), + ); } - _scrollController.scrollToBottomIfAtBottom(); - }); - return Stack( - children: [ - ChatZoomWrapper( - child: ListView.builder( - reverse: true, // List grows from bottom up - controller: _scrollController, - padding: const EdgeInsets.all(8), - itemCount: itemCount, - itemBuilder: (context, index) { - // Loading indicator now appears at end (bottom) of reversed list - if (_isLoadingOlder && index == itemCount - 1) { - return const Padding( - padding: EdgeInsets.symmetric(vertical: 16), - child: Center( - child: SizedBox( - width: 20, - height: 20, - child: CircularProgressIndicator( - strokeWidth: 2, + final urlImagesEnabled = connector + .isChannelUrlImagesEnabled(widget.channel.index); + final rowCount = layout.length; + final itemCount = rowCount + (_isLoadingOlder ? 1 : 0); + + // Auto-scroll to bottom if user is already at bottom + WidgetsBinding.instance.addPostFrameCallback((_) { + if (!mounted) return; + if (_channelSkipNextBottomSnap) { + _channelSkipNextBottomSnap = false; + return; + } + _scrollController.scrollToBottomIfAtBottom(); + }); + + return Stack( + children: [ + ChatZoomWrapper( + child: ListView.builder( + reverse: true, // List grows from bottom up + controller: _scrollController, + padding: const EdgeInsets.all(8), + itemCount: itemCount, + itemBuilder: (context, index) { + // Loading indicator now appears at end (bottom) of reversed list + if (_isLoadingOlder && index == itemCount - 1) { + return const Padding( + padding: EdgeInsets.symmetric(vertical: 16), + child: Center( + child: SizedBox( + width: 20, + height: 20, + child: CircularProgressIndicator( + strokeWidth: 2, + ), ), ), + ); + } + final row = layout.rowAt(index, messages); + final GlobalKey messageKey; + if (layout.keyedIndices.contains(index)) { + messageKey = _messageKeys.putIfAbsent( + row.id, + GlobalKey.new, + ); + } else { + messageKey = GlobalKey(); + } + final isUnreadAnchor = + _unreadDividerMessageId != null && + row.id == _unreadDividerMessageId; + return Container( + key: messageKey, + child: Builder( + builder: (context) { + final textScale = context + .select( + (service) => service.scale, + ); + final message = row.message; + final bubble = message != null + ? _buildMessageBubble( + message, + textScale, + urlImagesEnabled, + ) + : _buildImageBubble( + row.image!, + textScale, + ); + final startsDay = + index == rowCount - 1 || + !isSameChatDay( + layout + .rowAt(index + 1, messages) + .receivedAt, + row.receivedAt, + ); + if (isUnreadAnchor || startsDay) { + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + if (startsDay) + ChatDaySeparator( + day: row.receivedAt, + ), + if (isUnreadAnchor) + const UnreadDivider(), + bubble, + ], + ); + } + return bubble; + }, ), ); - } - final row = layout.rowAt(index, messages); - final GlobalKey messageKey; - if (layout.keyedIndices.contains(index)) { - messageKey = _messageKeys.putIfAbsent( - row.id, - GlobalKey.new, - ); - } else { - messageKey = GlobalKey(); - } - final isUnreadAnchor = - _unreadDividerMessageId != null && - row.id == _unreadDividerMessageId; - return Container( - key: messageKey, - child: Builder( - builder: (context) { - final textScale = context - .select( - (service) => service.scale, - ); - final message = row.message; - final bubble = message != null - ? _buildMessageBubble( - message, - textScale, - urlImagesEnabled, - ) - : _buildImageBubble( - row.image!, - textScale, - ); - final startsDay = - index == rowCount - 1 || - !isSameChatDay( - layout - .rowAt(index + 1, messages) - .receivedAt, - row.receivedAt, - ); - if (isUnreadAnchor || startsDay) { - return Column( - mainAxisSize: MainAxisSize.min, - children: [ - if (startsDay) - ChatDaySeparator(day: row.receivedAt), - if (isUnreadAnchor) - const UnreadDivider(), - bubble, - ], - ); - } - return bubble; - }, - ), - ); - }, + }, + ), ), - ), - JumpToBottomButton(scrollController: _scrollController), - ], - ); - }, + JumpToBottomButton(scrollController: _scrollController), + ], + ); + }, + ), ), ), _buildInputBar(), @@ -660,7 +698,7 @@ class _ChannelChatScreenState extends State { message.pathLength, ); - final colors = MessageBubbleColors.of(scheme, isOutgoing: isOutgoing); + final colors = MessageBubbleColors.of(context, isOutgoing: isOutgoing); final textColor = colors.text; final metaColor = colors.meta; const bodyFontSize = 14.0; @@ -1224,7 +1262,8 @@ class _ChannelChatScreenState extends State { Widget? trailing, }) { final scheme = Theme.of(context).colorScheme; - final textColor = isOutgoing ? MeshPalette.meInk : scheme.onSurface; + final bubble = MeshBubbleTheme.of(context); + final textColor = isOutgoing ? bubble.meInk : scheme.onSurface; final metaColor = textColor.withValues(alpha: 0.7); return Row( @@ -1691,7 +1730,8 @@ class _ChannelChatScreenState extends State { Widget _buildImageBubble(ReceivedImageEntry entry, double textScale) { final scheme = Theme.of(context).colorScheme; final isOutgoing = entry.isOutgoing; - final textColor = isOutgoing ? MeshPalette.meInk : scheme.onSurface; + final bubbleTheme = MeshBubbleTheme.of(context); + final textColor = isOutgoing ? bubbleTheme.meInk : scheme.onSurface; final metaColor = textColor.withValues(alpha: 0.65); final bubble = Padding( @@ -1710,11 +1750,11 @@ class _ChannelChatScreenState extends State { child: Container( padding: const EdgeInsets.all(4), decoration: BoxDecoration( - color: isOutgoing ? MeshPalette.me : scheme.surfaceContainerLow, + color: isOutgoing ? bubbleTheme.me : scheme.surfaceContainerLow, borderRadius: BorderRadius.circular(MeshRadii.lg), border: Border.all( color: isOutgoing - ? MeshPalette.meBorder + ? bubbleTheme.meBorder : scheme.outlineVariant, width: 1, ), @@ -2490,16 +2530,12 @@ class _RegionSelectDialogState extends State<_RegionSelectDialog> { final selected = connector.isChannelExplicitlyUnscoped( widget.channel.index, ); + final primary = Theme.of(context).colorScheme.primary; return ListTile( - leading: Icon( - Icons.public_off, - color: selected ? MeshPalette.blue : null, - ), + leading: Icon(Icons.public_off, color: selected ? primary : null), title: Text(context.l10n.settings_regionNoRegion), - trailing: selected - ? const Icon(Icons.check, color: MeshPalette.blue) - : null, - tileColor: selected ? MeshPalette.blueBg : null, + trailing: selected ? Icon(Icons.check, color: primary) : null, + tileColor: selected ? primary.withValues(alpha: 0.16) : null, onTap: () { // Tapping the already-selected option clears it back to the default. connector.setChannelRegion( @@ -2565,16 +2601,19 @@ class _RegionSelectDialogState extends State<_RegionSelectDialog> { itemCount: regions.length, itemBuilder: (context, index) { final selected = selectedIndex == index; + final primary = Theme.of(context).colorScheme.primary; return ListTile( leading: Icon( Icons.landscape, - color: selected ? MeshPalette.blue : null, + color: selected ? primary : null, ), title: Text(regions[index]), trailing: selected - ? const Icon(Icons.check, color: MeshPalette.blue) + ? Icon(Icons.check, color: primary) + : null, + tileColor: selected + ? primary.withValues(alpha: 0.16) : null, - tileColor: selected ? MeshPalette.blueBg : null, onTap: () { // Tapping the already-selected region clears it. context.read().setChannelRegion( diff --git a/lib/screens/channels_screen.dart b/lib/screens/channels_screen.dart index 01e8cd47..df298299 100644 --- a/lib/screens/channels_screen.dart +++ b/lib/screens/channels_screen.dart @@ -38,6 +38,7 @@ import 'contacts_screen.dart'; import 'map_screen.dart'; import 'settings_screen.dart'; import '../review_mode/review_mode_banner.dart'; +import '../theme/theme_icons.dart'; class ChannelsScreen extends StatefulWidget { final bool hideBackButton; @@ -149,7 +150,7 @@ class _ChannelsScreenState extends State PopupMenuItem( child: Row( children: [ - const Icon(Icons.settings), + const ThemedIcon(ThemeIconSlot.settings), const SizedBox(width: 8), Text(menuContext.l10n.settings_title), ], @@ -857,9 +858,11 @@ class _ChannelsScreenState extends State vertical: 10, ), borderColor: isSelected && enabled - ? MeshPalette.blueLine + ? cardScheme.primary.withValues(alpha: 0.5) + : null, + color: isSelected && enabled + ? cardScheme.primary.withValues(alpha: 0.16) : null, - color: isSelected && enabled ? MeshPalette.blueBg : null, onTap: enabled ? () { setSheetState(() { @@ -877,7 +880,7 @@ class _ChannelsScreenState extends State size: 38, color: enabled ? (isSelected - ? MeshPalette.blue + ? cardScheme.primary : cardScheme.onSurfaceVariant) : cardScheme.outline, icon: icon, @@ -915,7 +918,7 @@ class _ChannelsScreenState extends State Icon( Icons.chevron_right, color: isSelected - ? MeshPalette.blue + ? cardScheme.primary : cardScheme.onSurfaceVariant, size: 20, ), diff --git a/lib/screens/chat_screen.dart b/lib/screens/chat_screen.dart index 79d2f149..f75bb871 100644 --- a/lib/screens/chat_screen.dart +++ b/lib/screens/chat_screen.dart @@ -52,6 +52,9 @@ import '../theme/mesh_theme.dart'; import '../widgets/future_timestamp_indicator.dart'; import '../widgets/mesh_ui.dart'; import 'telemetry_screen.dart'; +import '../services/chat_background_service.dart'; +import '../widgets/chat_background.dart'; +import '../widgets/holiday_animations.dart'; // Image messages are deliberately absent from this screen, and there is no // flag to flip: the AEIC wire format is `CMD_SEND_CHANNEL_DATA` (62) / @@ -76,6 +79,8 @@ class ChatScreen extends StatefulWidget { } class _ChatScreenState extends State { + final _holidayWatcher = HolidayTriggerWatcher(); + final _messageAreaKey = GlobalKey(); final _textController = TextEditingController(); final _scrollController = ChatScrollController(); final _textFieldFocusNode = FocusNode(); @@ -271,6 +276,11 @@ class _ChatScreenState extends State { _showContactInfo(context); case 'settings': _showContactSettings(context); + case 'background': + showChatBackgroundSheet( + context, + ChatBackgroundService.contactKey(contact), + ); case 'telemetry': Navigator.push( context, @@ -324,6 +334,16 @@ class _ChatScreenState extends State { ], ), ), + PopupMenuItem( + value: 'background', + child: Row( + children: [ + const Icon(Icons.wallpaper, size: 20), + const SizedBox(width: 12), + Text(context.l10n.chatBackground_title), + ], + ), + ), PopupMenuItem( value: 'clearChat', child: Row( @@ -352,16 +372,31 @@ class _ChatScreenState extends State { body: Consumer( builder: (context, connector, child) { final messages = connector.getMessages(widget.contact); + final newest = messages.isEmpty ? null : messages.last; + _holidayWatcher.onNewest( + context, + id: newest?.messageId, + texts: [newest?.text, newest?.translatedText], + receivedAt: newest?.receivedAt, + originOf: () => newestMessageOrigin( + _messageAreaKey, + isOutgoing: newest?.isOutgoing ?? false, + ), + ); return Column( children: [ Expanded( - child: Stack( - children: [ - messages.isEmpty - ? _buildEmptyState() - : _buildMessageList(messages, connector), - JumpToBottomButton(scrollController: _scrollController), - ], + child: ChatBackdrop( + key: _messageAreaKey, + chatKey: ChatBackgroundService.contactKey(widget.contact), + child: Stack( + children: [ + messages.isEmpty + ? _buildEmptyState() + : _buildMessageList(messages, connector), + JumpToBottomButton(scrollController: _scrollController), + ], + ), ), ), _buildInputBar(connector), @@ -1269,7 +1304,7 @@ class _MessageBubble extends StatelessWidget { final publicIpfsGateway = settingsService.settings.publicIpfsGateway; final colors = MessageBubbleColors.of( - scheme, + context, isOutgoing: isOutgoing, isFailed: isFailed, ); diff --git a/lib/screens/contacts_screen.dart b/lib/screens/contacts_screen.dart index e49c59e9..50de0fd1 100644 --- a/lib/screens/contacts_screen.dart +++ b/lib/screens/contacts_screen.dart @@ -42,6 +42,7 @@ import 'map_screen.dart'; import '../review_mode/review_mode_banner.dart'; import 'repeater_hub_screen.dart'; import 'settings_screen.dart'; +import '../theme/theme_icons.dart'; enum RoomLoginDestination { chat, management } @@ -500,7 +501,7 @@ class _ContactsScreenState extends State PopupMenuItem( child: Row( children: [ - const Icon(Icons.settings), + const ThemedIcon(ThemeIconSlot.settings), const SizedBox(width: 8), Text(context.l10n.settings_title), ], @@ -1886,7 +1887,7 @@ class _ContactTile extends StatelessWidget { name: contact.name, size: 42, color: isChat ? null : contactTypeColor(contact.type), - icon: contactTypeIcon(contact.type), + iconSlot: contactTypeIconSlot(contact.type), ), const SizedBox(width: 12), // Main content. The name owns the whole first row (wrapping to @@ -1978,7 +1979,7 @@ class _ContactTile extends StatelessWidget { style: MeshTheme.mono( fontSize: 12.5, color: unreadCount > 0 - ? MeshPalette.blue + ? scheme.primary : scheme.onSurfaceVariant, ), ), diff --git a/lib/screens/discovery_screen.dart b/lib/screens/discovery_screen.dart index d2494282..2d74a180 100644 --- a/lib/screens/discovery_screen.dart +++ b/lib/screens/discovery_screen.dart @@ -195,7 +195,7 @@ class _DiscoveryScreenState extends State { name: contact.name, size: 42, color: isChat ? null : contactTypeColor(contact.type), - icon: contactTypeIcon(contact.type), + iconSlot: contactTypeIconSlot(contact.type), ), const SizedBox(width: 12), Expanded( diff --git a/lib/screens/map_screen.dart b/lib/screens/map_screen.dart index 335bf4d1..d9af753c 100644 --- a/lib/screens/map_screen.dart +++ b/lib/screens/map_screen.dart @@ -51,6 +51,7 @@ import '../helpers/snack_bar_builder.dart'; import '../helpers/utf8_length_limiter.dart'; import 'settings_screen.dart'; import 'line_of_sight_map_screen.dart'; +import '../theme/theme_icons.dart'; class MapScreen extends StatefulWidget { final LatLng? highlightPosition; @@ -176,24 +177,30 @@ class _MapScreenState extends State with DisconnectNavigationMixin { bool get _useDarkOverlay => Theme.of(context).brightness == Brightness.dark; - Color get _overlayPanelColor => _useDarkOverlay + /// The stock dark theme keeps the map's fixed high-contrast panels; custom + /// themes (and light mode) draw panels in the theme's own colors. + bool get _usePaletteOverlay => + _useDarkOverlay && !MeshMapTheme.of(context).followsTheme; + + Color get _overlayPanelColor => _usePaletteOverlay ? MapPalette.panelDark : _overlayScheme.surfaceContainerLow.withValues(alpha: 0.96); Color get _overlayPrimaryTextColor => - _useDarkOverlay ? MapPalette.textPrimary : _overlayScheme.onSurface; + _usePaletteOverlay ? MapPalette.textPrimary : _overlayScheme.onSurface; - Color get _overlaySecondaryTextColor => _useDarkOverlay + Color get _overlaySecondaryTextColor => _usePaletteOverlay ? MapPalette.textSecondary : _overlayScheme.onSurfaceVariant; - Color get _overlayMutedTextColor => - _useDarkOverlay ? MapPalette.textMuted : _overlayScheme.onSurfaceVariant; + Color get _overlayMutedTextColor => _usePaletteOverlay + ? MapPalette.textMuted + : _overlayScheme.onSurfaceVariant; Color get _overlayBorderColor => - _useDarkOverlay ? MapPalette.border : _overlayScheme.outlineVariant; + _usePaletteOverlay ? MapPalette.border : _overlayScheme.outlineVariant; - Color get _overlayShadowColor => _useDarkOverlay + Color get _overlayShadowColor => _usePaletteOverlay ? MapPalette.markerShadow : MapPalette.markerShadow.withValues(alpha: 0.18); @@ -450,7 +457,7 @@ class _MapScreenState extends State with DisconnectNavigationMixin { ), if (hasSelf) IconButton( - color: MapPalette.selected, + color: MeshMapTheme.of(context).accent, icon: const Icon(Icons.my_location), tooltip: context.l10n.map_centerOnMe, onPressed: () => _mapController.move( @@ -636,7 +643,7 @@ class _MapScreenState extends State with DisconnectNavigationMixin { Polyline( points: _points, strokeWidth: 4, - color: MapPalette.selected, + color: MeshMapTheme.of(context).accent, ), ] : [], @@ -783,7 +790,7 @@ class _MapScreenState extends State with DisconnectNavigationMixin { connector.selfLatitude!, connector.selfLongitude!, ), - color: MapPalette.selected, + color: MeshMapTheme.of(context).accent, icon: Icons.person_pin_circle, ), ); @@ -825,7 +832,7 @@ class _MapScreenState extends State with DisconnectNavigationMixin { PopupMenuItem( child: Row( children: [ - const Icon(Icons.settings), + const ThemedIcon(ThemeIconSlot.settings), const SizedBox(width: 8), Text(context.l10n.settings_title), ], @@ -1082,7 +1089,7 @@ class _MapScreenState extends State with DisconnectNavigationMixin { _handleQuickSwitch(index, context), contactsUnreadCount: connector.getTotalContactsUnreadCount(), channelsUnreadCount: connector.getTotalChannelsUnreadCount(), - highContrast: _useDarkOverlay, + highContrast: _usePaletteOverlay, ), ), floatingActionButton: @@ -1591,6 +1598,7 @@ class _MapScreenState extends State with DisconnectNavigationMixin { : _buildNodeMarkerWidget( color: baseColor, icon: mapNodeTypeIcon(contact.type), + slot: mapMarkerSlotForNodeType(contact.type), selected: selected, stale: stale, online: online, @@ -1734,6 +1742,14 @@ class _MapScreenState extends State with DisconnectNavigationMixin { ); } + /// A node type's icon as the theme shows it on the map. + Widget _nodeTypeIcon(int type, {required double size, Color? color}) { + final slot = mapMarkerSlotForNodeType(type); + return slot == null + ? Icon(mapNodeTypeIcon(type), size: size, color: color) + : ThemedIcon(slot, size: size, color: color); + } + Color _markerColor(Contact contact) { switch (contact.type) { case advTypeRepeater: @@ -1760,9 +1776,52 @@ class _MapScreenState extends State with DisconnectNavigationMixin { return estimateBatteryPercentFromMillivolts(millivolts, chemistry) <= 20; } + /// A theme's picture drawn as a whole round marker, with the usual + /// shadow and the accent ring when selected. + Widget _pictureMarker( + ImageProvider picture, { + required double size, + required bool selected, + required IconData fallback, + }) { + final accent = MeshMapTheme.of(context).accent; + return Container( + width: size, + height: size, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: selected ? Border.all(color: accent, width: 3) : null, + boxShadow: [ + const BoxShadow( + color: MapPalette.markerShadow, + blurRadius: 8, + offset: Offset(0, 3), + ), + if (selected) + BoxShadow( + color: accent.withValues(alpha: 0.75), + blurRadius: 14, + spreadRadius: 3, + ), + ], + ), + child: ClipOval( + child: Image( + image: picture, + fit: BoxFit.cover, + gaplessPlayback: true, + filterQuality: FilterQuality.medium, + errorBuilder: (_, _, _) => + Icon(fallback, color: accent, size: size * 0.55), + ), + ), + ); + } + Widget _buildNodeMarkerWidget({ required Color color, required IconData icon, + ThemeIconSlot? slot, bool selected = false, bool stale = false, bool online = false, @@ -1775,41 +1834,57 @@ class _MapScreenState extends State with DisconnectNavigationMixin { : stale ? MapPalette.offline : MapPalette.stale; + final override = slot == null ? null : MeshIconTheme.of(context)[slot]; + final picture = themePictureOf(override); + final namedIcon = override?.icon == null + ? null + : kThemeIconCatalog[override!.icon]; return Stack( clipBehavior: Clip.none, alignment: Alignment.center, children: [ - Container( - width: selected ? 44 : 36, - height: selected ? 44 : 36, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: selected ? MapPalette.selected : color, - border: Border.all( - color: MapPalette.markerOutline, - width: selected ? 3 : 2.5, - ), - boxShadow: [ - const BoxShadow( - color: MapPalette.markerShadow, - blurRadius: 8, - offset: Offset(0, 3), + if (picture != null) + // Pictures carry more detail than a glyph, so they get more room. + _pictureMarker( + picture, + size: selected ? 50 : 42, + selected: selected, + fallback: icon, + ) + else + Container( + width: selected ? 44 : 36, + height: selected ? 44 : 36, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: selected ? MeshMapTheme.of(context).accent : color, + border: Border.all( + color: MapPalette.markerOutline, + width: selected ? 3 : 2.5, ), - if (selected) - BoxShadow( - color: MapPalette.selected.withValues(alpha: 0.75), - blurRadius: 14, - spreadRadius: 3, + boxShadow: [ + const BoxShadow( + color: MapPalette.markerShadow, + blurRadius: 8, + offset: Offset(0, 3), ), - ], + if (selected) + BoxShadow( + color: MeshMapTheme.of( + context, + ).accent.withValues(alpha: 0.75), + blurRadius: 14, + spreadRadius: 3, + ), + ], + ), + alignment: Alignment.center, + child: Icon( + namedIcon ?? icon, + color: MapPalette.markerOutline, + size: selected ? 22 : 19, + ), ), - alignment: Alignment.center, - child: Icon( - icon, - color: MapPalette.markerOutline, - size: selected ? 22 : 19, - ), - ), Positioned( right: selected ? -1 : -2, bottom: selected ? 0 : -2, @@ -1835,13 +1910,21 @@ class _MapScreenState extends State with DisconnectNavigationMixin { ); } - Widget _buildLegendItem(IconData icon, String label, Color color) { + Widget _buildLegendItem( + IconData icon, + String label, + Color color, { + ThemeIconSlot? slot, + }) { return Padding( padding: const EdgeInsets.symmetric(vertical: 1.5), child: Row( mainAxisSize: MainAxisSize.min, children: [ - Icon(icon, size: 18, color: color), + if (slot != null) + ThemedIcon(slot, size: 18, color: color) + else + Icon(icon, size: 18, color: color), const SizedBox(width: 8), Expanded( child: Text( @@ -1952,7 +2035,7 @@ class _MapScreenState extends State with DisconnectNavigationMixin { color: _overlayPrimaryTextColor, fontWeight: FontWeight.w600, ), - cursorColor: MapPalette.selected, + cursorColor: MeshMapTheme.of(context).accent, onChanged: (value) { setState(() => _searchQuery = value); }, @@ -1974,10 +2057,10 @@ class _MapScreenState extends State with DisconnectNavigationMixin { child: Row( mainAxisSize: MainAxisSize.min, children: [ - const Icon( + Icon( Icons.hub, size: 18, - color: MapPalette.selected, + color: MeshMapTheme.of(context).accent, ), const SizedBox(width: 6), Text( @@ -2049,7 +2132,9 @@ class _MapScreenState extends State with DisconnectNavigationMixin { side: BorderSide.none, foregroundColor: _overlaySecondaryTextColor, selectedForegroundColor: _overlayPrimaryTextColor, - selectedBackgroundColor: MapPalette.selected.withValues(alpha: 0.34), + selectedBackgroundColor: MeshMapTheme.of( + context, + ).accent.withValues(alpha: 0.34), textStyle: const TextStyle(fontSize: 15, fontWeight: FontWeight.w700), ), segments: [ @@ -2168,7 +2253,7 @@ class _MapScreenState extends State with DisconnectNavigationMixin { ), child: Row( children: [ - Icon(mapNodeTypeIcon(c.type), size: 18, color: color), + _nodeTypeIcon(c.type, size: 18, color: color), const SizedBox(width: 10), Expanded( child: Column( @@ -2278,7 +2363,11 @@ class _MapScreenState extends State with DisconnectNavigationMixin { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - _statRow(context.l10n.map_visible, visibleCount, MapPalette.selected), + _statRow( + context.l10n.map_visible, + visibleCount, + MeshMapTheme.of(context).accent, + ), _statRow(context.l10n.map_online, onlineCount, MapPalette.online), _statRow( context.l10n.map_repeaters, @@ -2291,22 +2380,26 @@ class _MapScreenState extends State with DisconnectNavigationMixin { _buildLegendItem( Icons.person, context.l10n.map_chat, - MapPalette.selected, + MeshMapTheme.of(context).accent, + slot: ThemeIconSlot.mapChat, ), _buildLegendItem( Icons.router, context.l10n.map_repeater, MapPalette.repeater, + slot: ThemeIconSlot.mapRepeater, ), _buildLegendItem( Icons.meeting_room, context.l10n.map_room, MapPalette.router, + slot: ThemeIconSlot.mapRoom, ), _buildLegendItem( Icons.sensors, context.l10n.map_sensor, MapPalette.sensor, + slot: ThemeIconSlot.mapSensor, ), _buildLegendItem( Icons.flag, @@ -2393,6 +2486,7 @@ class _MapScreenState extends State with DisconnectNavigationMixin { size: 38, color: color, icon: mapNodeTypeIcon(contact.type), + iconSlot: mapMarkerSlotForNodeType(contact.type), ), const SizedBox(width: 10), Expanded( @@ -2525,7 +2619,7 @@ class _MapScreenState extends State with DisconnectNavigationMixin { ), TextButton( style: TextButton.styleFrom( - foregroundColor: MapPalette.selected, + foregroundColor: MeshMapTheme.of(context).accent, ), onPressed: () => showNodeInfoSheet( context, @@ -2819,35 +2913,50 @@ class _MapScreenState extends State with DisconnectNavigationMixin { } Marker _buildSelfMarker(LatLng position) { + final override = MeshIconTheme.of(context)[ThemeIconSlot.mapSelf]; + final picture = themePictureOf(override); + final namedIcon = override?.icon == null + ? null + : kThemeIconCatalog[override!.icon]; return Marker( point: position, - width: 40, - height: 40, + width: picture != null ? 48 : 40, + height: picture != null ? 48 : 40, child: IgnorePointer( child: Semantics( label: context.l10n.pathTrace_you, - child: Container( - width: 36, - height: 36, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: MapPalette.panelDark, - border: Border.all(color: MapPalette.markerOutline, width: 2.5), - boxShadow: const [ - BoxShadow( - color: MapPalette.markerShadow, - blurRadius: 8, - offset: Offset(0, 2), + child: picture != null + ? _pictureMarker( + picture, + size: 46, + selected: false, + fallback: Icons.person_pin_circle, + ) + : Container( + width: 36, + height: 36, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: MapPalette.panelDark, + border: Border.all( + color: MapPalette.markerOutline, + width: 2.5, + ), + boxShadow: const [ + BoxShadow( + color: MapPalette.markerShadow, + blurRadius: 8, + offset: Offset(0, 2), + ), + ], + ), + alignment: Alignment.center, + child: Icon( + namedIcon ?? Icons.person_pin_circle, + color: MeshMapTheme.of(context).accent, + size: 22, + ), ), - ], - ), - alignment: Alignment.center, - child: const Icon( - Icons.person_pin_circle, - color: MapPalette.selected, - size: 22, - ), - ), ), ), ); @@ -2959,9 +3068,9 @@ class _MapScreenState extends State with DisconnectNavigationMixin { children: [ if (selfPosition != null) ListTile( - leading: const Icon( + leading: Icon( Icons.person_pin_circle, - color: MapPalette.selected, + color: MeshMapTheme.of(context).accent, ), title: Text(l10n.pathTrace_you), subtitle: Text( @@ -3467,7 +3576,7 @@ class _MapScreenState extends State with DisconnectNavigationMixin { Widget freshnessChip(_Freshness value, String label) { final selected = _freshness == value; final accent = switch (value) { - _Freshness.all => MapPalette.selected, + _Freshness.all => MeshMapTheme.of(context).accent, _Freshness.online => MapPalette.online, _Freshness.recent => MapPalette.stale, _Freshness.stale => MapPalette.offline, @@ -3940,7 +4049,7 @@ class _MapScreenState extends State with DisconnectNavigationMixin { style: MeshTheme.mono( fontSize: 18, fontWeight: FontWeight.w700, - color: MapPalette.selected, + color: MeshMapTheme.of(context).accent, ), ), Text( diff --git a/lib/screens/repeater_hub_screen.dart b/lib/screens/repeater_hub_screen.dart index bac25d48..ba38d716 100644 --- a/lib/screens/repeater_hub_screen.dart +++ b/lib/screens/repeater_hub_screen.dart @@ -127,9 +127,7 @@ class RepeaterHubScreen extends StatelessWidget { label: isAdmin ? l10n.repeater_roleAdmin : l10n.repeater_roleGuest, - color: isAdmin - ? MeshPalette.blue - : scheme.onSurfaceVariant, + color: isAdmin ? scheme.primary : scheme.onSurfaceVariant, ), ], ), diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart index 6ec9dc84..07e8e68e 100644 --- a/lib/screens/settings_screen.dart +++ b/lib/screens/settings_screen.dart @@ -246,7 +246,7 @@ class _SettingsScreenState extends State { ? l10n.common_connected : l10n.common_disconnected, color: connector.isConnected - ? MeshPalette.blue + ? scheme.primary : scheme.onSurfaceVariant, pulse: connector.isConnected, ), diff --git a/lib/screens/theme_editor_screen.dart b/lib/screens/theme_editor_screen.dart new file mode 100644 index 00000000..f4352c86 --- /dev/null +++ b/lib/screens/theme_editor_screen.dart @@ -0,0 +1,784 @@ +import 'package:flutter/material.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:provider/provider.dart'; + +import '../helpers/snack_bar_builder.dart'; +import '../l10n/l10n.dart'; +import '../models/custom_theme.dart'; +import '../services/app_settings_service.dart'; +import '../theme/mesh_theme.dart'; +import '../theme/theme_icons.dart'; +import '../models/chat_background.dart'; +import '../widgets/adaptive_app_bar_title.dart'; +import '../widgets/chat_background.dart'; +import '../widgets/message_bubble_frame.dart'; +import '../widgets/mesh_ui.dart'; + +/// Background choices offered as one-tap swatches: dark first, then light. +const List kThemeBackgroundSwatches = [ + Color(0xFF0B1220), + Color(0xFF000000), + Color(0xFF161616), + Color(0xFF0E1A13), + Color(0xFF071A2B), + Color(0xFF1C1210), + Color(0xFF17112A), + Color(0xFF2A1520), + Color(0xFFFFFFFF), + Color(0xFFF4F6F8), + Color(0xFFFAF7F0), + Color(0xFFEFFAF4), + Color(0xFFF0F6FC), + Color(0xFFFBF0F5), + Color(0xFFF5F3FF), + Color(0xFFFFF8E1), +]; + +/// Accent choices offered as one-tap swatches. +const List kThemeAccentSwatches = [ + Color(0xFF0EA5E9), + Color(0xFF3B82F6), + Color(0xFF1D4ED8), + Color(0xFF6366F1), + Color(0xFFA855F7), + Color(0xFFEC4899), + Color(0xFFEF4444), + Color(0xFF9A3412), + Color(0xFFF97316), + Color(0xFFF59E0B), + Color(0xFFFACC15), + Color(0xFF84CC16), + Color(0xFF22C55E), + Color(0xFF047857), + Color(0xFF14B8A6), + Color(0xFF06B6D4), +]; + +/// Creates or edits a [CustomTheme]: a name, a background and an accent, +/// with a live preview of the result. +class ThemeEditorScreen extends StatefulWidget { + /// The saved theme being edited; null creates a new one. + final CustomTheme? existing; + + /// Colors to start a new theme from (e.g. a preset being customized). + final CustomTheme? startFrom; + final String? initialName; + + const ThemeEditorScreen({ + super.key, + this.existing, + this.startFrom, + this.initialName, + }); + + @override + State createState() => _ThemeEditorScreenState(); +} + +class _ThemeEditorScreenState extends State { + late final TextEditingController _nameController; + final _nameFocus = FocusNode(); + final _scrollController = ScrollController(); + late Color _background; + late Color _accent; + late Map _icons; + ChatBackground? _chatBackground; + bool _chatBackgroundEverywhere = false; + bool _showNameError = false; + + @override + void initState() { + super.initState(); + final source = widget.existing ?? widget.startFrom; + _background = source?.background ?? kThemeBackgroundSwatches.first; + _accent = source?.accent ?? kThemeAccentSwatches.first; + _icons = Map.of(source?.icons ?? const {}); + _chatBackground = source?.chatBackground; + _chatBackgroundEverywhere = source?.chatBackgroundEverywhere ?? false; + _nameController = TextEditingController( + text: widget.existing?.name ?? widget.initialName ?? '', + ); + } + + @override + void dispose() { + _nameController.dispose(); + _nameFocus.dispose(); + _scrollController.dispose(); + super.dispose(); + } + + CustomTheme get _draft => CustomTheme( + id: widget.existing?.id ?? '', + name: _nameController.text.trim(), + background: _background, + accent: _accent, + icons: Map.unmodifiable(_icons), + chatBackground: _chatBackground, + chatBackgroundEverywhere: _chatBackgroundEverywhere, + ); + + Widget _iconTile(ThemeIconSlot slot) { + return ListTile( + leading: SizedBox.square( + dimension: 48, + child: Center( + // Shows the shared icon when only the partner slot (list avatar + // or map marker for the same node type) is set, as the app does. + child: ThemedIcon.preview( + slot, + _icons[slot.key] ?? _icons[slot.partner?.key], + size: 28, + ), + ), + ), + title: Text( + themeIconSlotLabel(context, slot), + style: Theme.of(context).textTheme.bodyLarge, + ), + subtitle: _icons.containsKey(slot.key) + ? Text(context.l10n.themes_iconChanged) + : null, + trailing: const Icon(Icons.edit_outlined), + onTap: () => _pickIcon(slot), + ); + } + + Future _pickIcon(ThemeIconSlot slot) async { + final choice = await showModalBottomSheet<_IconChoice>( + context: context, + isScrollControlled: true, + showDragHandle: true, + builder: (_) => _IconPickerSheet( + slot: slot, + current: _icons[slot.key], + label: themeIconSlotLabel(context, slot), + ), + ); + if (choice == null || !mounted) return; + if (choice.pickPicture) { + await _pickPicture(slot); + return; + } + setState(() { + final value = choice.value; + if (value == null) { + _icons.remove(slot.key); + } else { + _icons[slot.key] = value; + } + }); + } + + Future _pickPicture(ThemeIconSlot slot) async { + final XFile? file; + try { + file = await ImagePicker().pickImage(source: ImageSource.gallery); + } catch (_) { + if (mounted) _showPictureError(); + return; + } + if (file == null) return; + final shrunk = await shrinkThemeIconImage(await file.readAsBytes()); + if (!mounted) return; + if (shrunk == null) { + _showPictureError(); + return; + } + setState(() => _icons[slot.key] = ThemeIconOverride.image(shrunk)); + } + + void _showPictureError() { + showDismissibleSnackBar( + context, + content: Text(context.l10n.themes_iconPictureFailed), + ); + } + + Future _save() async { + final name = _nameController.text.trim(); + if (name.isEmpty) { + // The name field sits at the top; bring it back into view so the + // error is seen rather than a button that seems to do nothing. + setState(() => _showNameError = true); + _nameFocus.requestFocus(); + if (_scrollController.hasClients) { + await _scrollController.animateTo( + 0, + duration: const Duration(milliseconds: 250), + curve: Curves.easeOut, + ); + } + return; + } + final settingsService = context.read(); + final theme = _draft.copyWith( + id: widget.existing?.id ?? settingsService.newCustomThemeId(), + name: name, + ); + await settingsService.saveCustomTheme(theme, apply: true); + if (mounted) Navigator.of(context).pop(); + } + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; + final lowContrast = _contrastRatio(_accent, _background) < 3; + + return Scaffold( + appBar: AppBar( + title: AdaptiveAppBarTitle( + widget.existing == null + ? l10n.themes_newTitle + : l10n.themes_editTitle, + ), + centerTitle: true, + ), + body: SafeArea( + top: false, + child: ListView( + controller: _scrollController, + padding: const EdgeInsets.fromLTRB(0, 8, 0, 24), + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(16, 12, 16, 0), + child: TextField( + controller: _nameController, + focusNode: _nameFocus, + textCapitalization: TextCapitalization.words, + maxLength: 32, + style: Theme.of(context).textTheme.bodyLarge, + decoration: InputDecoration( + labelText: l10n.themes_name, + errorText: _showNameError ? l10n.themes_nameRequired : null, + ), + onChanged: (_) { + if (_showNameError) setState(() => _showNameError = false); + }, + ), + ), + SectionHeader(l10n.themes_preview), + _ThemePreview(theme: _draft), + if (lowContrast) + Padding( + padding: const EdgeInsets.fromLTRB(16, 8, 16, 0), + child: Row( + children: [ + Icon(Icons.warning_amber_rounded, color: scheme.tertiary), + const SizedBox(width: 8), + Expanded( + child: Text( + l10n.themes_lowContrast, + style: Theme.of(context).textTheme.bodyMedium, + ), + ), + ], + ), + ), + SectionHeader(l10n.themes_background), + _ColorPicker( + help: l10n.themes_backgroundHelp, + swatches: kThemeBackgroundSwatches, + value: _background, + onChanged: (c) => setState(() => _background = c), + ), + SectionHeader(l10n.themes_accent), + _ColorPicker( + help: l10n.themes_accentHelp, + swatches: kThemeAccentSwatches, + value: _accent, + onChanged: (c) => setState(() => _accent = c), + ), + SectionHeader(l10n.themes_chatBackground), + MeshCard( + padding: const EdgeInsets.all(14), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Text( + l10n.themes_chatBackgroundHelp, + style: Theme.of(context).textTheme.bodyMedium?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + const SizedBox(height: 12), + ChatBackgroundPicker( + value: _chatBackground, + onChanged: (value) => + setState(() => _chatBackground = value), + ), + if (_chatBackground != null) + SwitchListTile( + contentPadding: EdgeInsets.zero, + title: Text(l10n.themes_chatBackgroundEverywhere), + subtitle: Text(l10n.themes_chatBackgroundEverywhereHelp), + value: _chatBackgroundEverywhere, + onChanged: (value) => + setState(() => _chatBackgroundEverywhere = value), + ), + ], + ), + ), + SectionHeader(l10n.themes_icons), + MeshCard( + padding: const EdgeInsets.symmetric(vertical: 6), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(14, 8, 14, 4), + child: Text( + l10n.themes_iconsHelp, + style: Theme.of(context).textTheme.bodyMedium?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ), + for (final slot in ThemeIconSlot.values) + if (!slot.isMapMarker) _iconTile(slot), + ], + ), + ), + SectionHeader(l10n.themes_mapMarkers), + MeshCard( + padding: const EdgeInsets.symmetric(vertical: 6), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(14, 8, 14, 4), + child: Text( + l10n.themes_mapMarkersHelp, + style: Theme.of(context).textTheme.bodyMedium?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ), + for (final slot in ThemeIconSlot.values) + if (slot.isMapMarker) _iconTile(slot), + ], + ), + ), + Padding( + padding: const EdgeInsets.fromLTRB(16, 24, 16, 0), + child: FilledButton.icon( + onPressed: _save, + icon: const Icon(Icons.check), + label: Text(l10n.themes_saveAndUse), + ), + ), + ], + ), + ), + ); + } +} + +/// WCAG contrast ratio between two colors (1–21). +double _contrastRatio(Color a, Color b) { + final la = a.computeLuminance(); + final lb = b.computeLuminance(); + final hi = la > lb ? la : lb; + final lo = la > lb ? lb : la; + return (hi + 0.05) / (lo + 0.05); +} + +class _ColorPicker extends StatefulWidget { + final String help; + final List swatches; + final Color value; + final ValueChanged onChanged; + + const _ColorPicker({ + required this.help, + required this.swatches, + required this.value, + required this.onChanged, + }); + + @override + State<_ColorPicker> createState() => _ColorPickerState(); +} + +class _ColorPickerState extends State<_ColorPicker> { + late final TextEditingController _hexController; + + @override + void initState() { + super.initState(); + _hexController = TextEditingController(text: colorToHex(widget.value)); + } + + @override + void didUpdateWidget(covariant _ColorPicker oldWidget) { + super.didUpdateWidget(oldWidget); + // Keep the text in step with swatch taps, but don't fight the user while + // they are mid-way through typing a hex value. + if (oldWidget.value != widget.value && + parseHexColor(_hexController.text) != widget.value) { + _hexController.text = colorToHex(widget.value); + } + } + + @override + void dispose() { + _hexController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + return MeshCard( + padding: const EdgeInsets.all(14), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.help, + style: Theme.of( + context, + ).textTheme.bodyMedium?.copyWith(color: scheme.onSurfaceVariant), + ), + const SizedBox(height: 12), + Wrap( + spacing: 10, + runSpacing: 10, + children: [ + for (final color in widget.swatches) + _SwatchButton( + color: color, + selected: color == widget.value, + onTap: () => widget.onChanged(color), + ), + ], + ), + const SizedBox(height: 14), + TextField( + controller: _hexController, + style: MeshTheme.mono(fontSize: 16), + decoration: InputDecoration( + labelText: context.l10n.themes_hexColor, + hintText: '#RRGGBB', + prefixIcon: Padding( + padding: const EdgeInsets.all(10), + child: Container( + width: 24, + height: 24, + decoration: BoxDecoration( + color: widget.value, + shape: BoxShape.circle, + border: Border.all(color: scheme.outline), + ), + ), + ), + ), + onChanged: (text) { + final color = parseHexColor(text); + if (color != null) widget.onChanged(color); + }, + ), + ], + ), + ); + } +} + +class _SwatchButton extends StatelessWidget { + final Color color; + final bool selected; + final VoidCallback onTap; + + const _SwatchButton({ + required this.color, + required this.selected, + required this.onTap, + }); + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + return Semantics( + button: true, + selected: selected, + label: colorToHex(color), + child: InkWell( + onTap: onTap, + customBorder: const CircleBorder(), + child: Container( + width: 44, + height: 44, + decoration: BoxDecoration( + color: color, + shape: BoxShape.circle, + border: Border.all( + color: selected ? scheme.primary : scheme.outline, + width: selected ? 3 : 1, + ), + ), + child: selected + ? Icon( + Icons.check, + color: isDarkColor(color) ? Colors.white : Colors.black, + ) + : null, + ), + ), + ); + } +} + +/// A miniature screen rendered with the draft theme. +class _ThemePreview extends StatelessWidget { + final CustomTheme theme; + + const _ThemePreview({required this.theme}); + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + final data = MeshTheme.fromCustom(theme); + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Theme( + data: data, + child: Builder( + builder: (context) { + final scheme = Theme.of(context).colorScheme; + final textTheme = Theme.of(context).textTheme; + return Container( + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + color: scheme.surface, + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: scheme.outline), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Container( + padding: const EdgeInsets.symmetric( + horizontal: 14, + vertical: 12, + ), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide(color: scheme.outlineVariant), + ), + ), + child: Text( + theme.name.isEmpty ? l10n.themes_newTitle : theme.name, + style: textTheme.titleMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + ), + _PreviewChatArea( + background: theme.chatBackground, + child: Padding( + padding: const EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + _bubble(context, l10n.themes_previewIncoming, false), + const SizedBox(height: 8), + _bubble(context, l10n.themes_previewOutgoing, true), + const SizedBox(height: 8), + Row( + children: [ + Expanded( + child: Text( + l10n.themes_previewSwitch, + style: textTheme.bodyLarge, + ), + ), + Switch(value: true, onChanged: (_) {}), + ], + ), + Align( + alignment: Alignment.centerRight, + child: FilledButton( + onPressed: () {}, + child: Text(l10n.common_save), + ), + ), + ], + ), + ), + ), + ], + ), + ); + }, + ), + ), + ); + } + + Widget _bubble(BuildContext context, String text, bool isOutgoing) { + final colors = MessageBubbleColors.of(context, isOutgoing: isOutgoing); + return Align( + alignment: isOutgoing ? Alignment.centerRight : Alignment.centerLeft, + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), + decoration: BoxDecoration( + color: colors.background, + borderRadius: messageBubbleRadius(isOutgoing: isOutgoing), + border: Border.all(color: colors.border), + ), + child: Text( + text, + style: Theme.of( + context, + ).textTheme.bodyLarge?.copyWith(color: colors.text), + ), + ), + ); + } +} + +/// Readable name for an icon slot in the editor. +String themeIconSlotLabel(BuildContext context, ThemeIconSlot slot) { + final l10n = context.l10n; + switch (slot) { + case ThemeIconSlot.contacts: + return l10n.nav_contacts; + case ThemeIconSlot.channels: + return l10n.nav_channels; + case ThemeIconSlot.map: + return l10n.nav_map; + case ThemeIconSlot.send: + return l10n.themes_iconSend; + case ThemeIconSlot.settings: + return l10n.settings_title; + case ThemeIconSlot.repeater: + return l10n.themes_iconRepeater; + case ThemeIconSlot.room: + return l10n.themes_iconRoom; + case ThemeIconSlot.sensor: + return l10n.themes_iconSensor; + case ThemeIconSlot.mapChat: + return l10n.map_chat; + case ThemeIconSlot.mapRepeater: + return l10n.map_repeater; + case ThemeIconSlot.mapRoom: + return l10n.map_room; + case ThemeIconSlot.mapSensor: + return l10n.map_sensor; + case ThemeIconSlot.mapSelf: + return l10n.pathTrace_you; + } +} + +/// Result of the icon picker: a new value (null = default) or a request to +/// pick a picture from the gallery. +class _IconChoice { + final ThemeIconOverride? value; + final bool pickPicture; + + const _IconChoice(this.value) : pickPicture = false; + const _IconChoice.picture() : value = null, pickPicture = true; +} + +class _IconPickerSheet extends StatelessWidget { + final ThemeIconSlot slot; + final ThemeIconOverride? current; + final String label; + + const _IconPickerSheet({ + required this.slot, + required this.current, + required this.label, + }); + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; + return DraggableScrollableSheet( + expand: false, + initialChildSize: 0.7, + maxChildSize: 0.95, + builder: (context, scrollController) => ListView( + controller: scrollController, + padding: const EdgeInsets.fromLTRB(16, 0, 16, 24), + children: [ + Text(label, style: Theme.of(context).textTheme.titleLarge), + const SizedBox(height: 16), + FilledButton.icon( + onPressed: () => + Navigator.pop(context, const _IconChoice.picture()), + icon: const Icon(Icons.image_outlined), + label: Text(l10n.themes_iconUsePicture), + ), + const SizedBox(height: 8), + OutlinedButton.icon( + onPressed: current == null + ? null + : () => Navigator.pop(context, const _IconChoice(null)), + icon: Icon(slot.icon), + label: Text(l10n.themes_iconReset), + ), + const SizedBox(height: 16), + GridView.count( + crossAxisCount: 5, + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + mainAxisSpacing: 8, + crossAxisSpacing: 8, + children: [ + for (final entry in kThemeIconCatalog.entries) + Semantics( + button: true, + selected: current?.icon == entry.key, + label: entry.key.replaceAll('_', ' '), + child: InkWell( + borderRadius: BorderRadius.circular(MeshRadii.sm), + onTap: () => Navigator.pop( + context, + _IconChoice(ThemeIconOverride.icon(entry.key)), + ), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(MeshRadii.sm), + color: current?.icon == entry.key + ? scheme.primary.withValues(alpha: 0.16) + : scheme.surfaceContainerHigh, + border: Border.all( + color: current?.icon == entry.key + ? scheme.primary + : scheme.outlineVariant, + ), + ), + child: Icon(entry.value, size: 30), + ), + ), + ), + ], + ), + ], + ), + ); + } +} + +/// The preview's message area, drawn over the draft chat background. +class _PreviewChatArea extends StatelessWidget { + final ChatBackground? background; + final Widget child; + + const _PreviewChatArea({required this.background, required this.child}); + + @override + Widget build(BuildContext context) { + final bg = background; + if (bg == null) return child; + return Stack( + children: [ + Positioned.fill(child: ChatBackgroundLayer(background: bg)), + child, + ], + ); + } +} diff --git a/lib/screens/themes_screen.dart b/lib/screens/themes_screen.dart new file mode 100644 index 00000000..1a81d734 --- /dev/null +++ b/lib/screens/themes_screen.dart @@ -0,0 +1,568 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:provider/provider.dart'; + +import '../helpers/snack_bar_builder.dart'; +import '../l10n/l10n.dart'; +import '../models/custom_theme.dart'; +import '../services/app_settings_service.dart'; +import '../services/chat_background_service.dart'; +import '../theme/mesh_theme.dart'; +import '../theme/theme_icons.dart'; +import '../utils/theme_file.dart'; +import '../widgets/adaptive_app_bar_title.dart'; +import '../widgets/mesh_ui.dart'; +import 'theme_editor_screen.dart'; + +/// Lists the stock theme, the built-in presets and the user's own themes. +/// Tapping a theme applies it immediately. +class ThemesScreen extends StatelessWidget { + const ThemesScreen({super.key}); + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + final settingsService = context.watch(); + // The theme actually showing, which may be an automatic holiday theme. + final activeId = settingsService.activeCustomTheme?.id; + final autoHoliday = settingsService.autoHolidayTheme; + final myThemes = settingsService.settings.customThemes; + + return Scaffold( + appBar: AppBar( + title: AdaptiveAppBarTitle(l10n.themes_title), + centerTitle: true, + actions: [ + PopupMenuButton( + icon: const Icon(Icons.more_vert), + itemBuilder: (_) => [ + PopupMenuItem( + onTap: () => _importFile(context, settingsService), + child: _MenuRow( + Icons.file_open_outlined, + l10n.themes_importFile, + ), + ), + PopupMenuItem( + onTap: () => _showImportDialog(context, settingsService), + child: _MenuRow( + Icons.content_paste_go_outlined, + l10n.themes_pasteCode, + ), + ), + PopupMenuItem( + enabled: myThemes.isNotEmpty, + onTap: () => _exportFile(context, myThemes, 'meshcore-themes'), + child: _MenuRow(Icons.ios_share, l10n.themes_exportAll), + ), + ], + ), + ], + ), + floatingActionButton: FloatingActionButton.extended( + onPressed: () => _openEditor(context), + icon: const Icon(Icons.add), + label: Text(l10n.themes_create), + ), + body: SafeArea( + top: false, + child: ListView( + padding: const EdgeInsets.fromLTRB(0, 8, 0, 96), + children: [ + SectionHeader(l10n.themes_myThemes), + if (myThemes.isEmpty) + Padding( + padding: const EdgeInsets.fromLTRB(16, 0, 16, 8), + child: Text( + l10n.themes_myThemesEmpty, + style: Theme.of(context).textTheme.bodyMedium?.copyWith( + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), + ), + ) + else + for (final theme in myThemes) + _ThemeTile( + name: theme.name, + background: theme.background, + accent: theme.accent, + selected: theme.id == activeId, + onTap: () => settingsService.setActiveTheme(theme.id), + menu: _myThemeMenu(context, settingsService, theme), + ), + SectionHeader(l10n.themes_builtIn), + _ThemeTile( + name: l10n.themes_default, + subtitle: l10n.themes_defaultSubtitle, + background: MeshPalette.bg, + accent: MeshPalette.blue, + selected: activeId == null, + onTap: () => settingsService.setActiveTheme(null), + ), + for (final preset in CustomTheme.presets) + _presetTile(context, settingsService, preset, activeId), + SectionHeader(l10n.themes_holidays), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: const Icon(Icons.event_available_outlined, size: 24), + title: Text(l10n.themes_holidayAutoSwitch), + subtitle: Text(l10n.themes_holidayAutoSwitchSubtitle), + value: settingsService.settings.holidayAutoSwitch, + onChanged: settingsService.setHolidayAutoSwitch, + ), + if (autoHoliday != null) + _AutoHolidayNote( + l10n.themes_holidayAutoApplied(autoHoliday.name), + ), + for (final preset in CustomTheme.holidayPresets) + _presetTile( + context, + settingsService, + preset, + activeId, + subtitle: preset.id == autoHoliday?.id + ? l10n.themes_holidayAutoAppliedTag + : null, + ), + ], + ), + ), + ); + } + + Widget _presetTile( + BuildContext context, + AppSettingsService settingsService, + CustomTheme preset, + String? activeId, { + String? subtitle, + }) { + final l10n = context.l10n; + return _ThemeTile( + name: preset.name, + subtitle: subtitle, + background: preset.background, + accent: preset.accent, + preview: preset.icons.isEmpty + ? null + : ThemedIcon.preview( + ThemeIconSlot.channels, + preset.icons[ThemeIconSlot.channels.key], + size: 48, + ), + selected: preset.id == activeId, + onTap: () => settingsService.setActiveTheme(preset.id), + menu: PopupMenuButton( + icon: const Icon(Icons.more_vert), + itemBuilder: (_) => [ + PopupMenuItem( + onTap: () => _openEditor( + context, + startFrom: preset, + copyName: l10n.themes_copyName(preset.name), + ), + child: _MenuRow(Icons.tune, l10n.themes_customize), + ), + PopupMenuItem( + onTap: () => _copyCode(context, preset), + child: _MenuRow(Icons.copy, l10n.themes_copyCode), + ), + ], + ), + ); + } + + Widget _myThemeMenu( + BuildContext context, + AppSettingsService settingsService, + CustomTheme theme, + ) { + final l10n = context.l10n; + return PopupMenuButton( + icon: const Icon(Icons.more_vert), + itemBuilder: (_) => [ + PopupMenuItem( + onTap: () => _openEditor(context, existing: theme), + child: _MenuRow(Icons.edit_outlined, l10n.common_edit), + ), + PopupMenuItem( + onTap: () => _copyCode(context, theme), + child: _MenuRow(Icons.copy, l10n.themes_copyCode), + ), + PopupMenuItem( + onTap: () => _exportFile(context, [theme], themeFileStem(theme.name)), + child: _MenuRow(Icons.ios_share, l10n.themes_exportFile), + ), + PopupMenuItem( + onTap: () => _confirmDelete(context, settingsService, theme), + child: _MenuRow(Icons.delete_outline, l10n.common_delete), + ), + ], + ); + } + + void _openEditor( + BuildContext context, { + CustomTheme? existing, + CustomTheme? startFrom, + String? copyName, + }) { + Navigator.of(context).push( + MaterialPageRoute( + builder: (_) => ThemeEditorScreen( + existing: existing, + startFrom: startFrom, + initialName: copyName, + ), + ), + ); + } + + Future _exportFile( + BuildContext context, + List themes, + String fileStem, + ) async { + final box = context.findRenderObject() as RenderBox?; + final origin = box == null + ? null + : box.localToGlobal(Offset.zero) & box.size; + final backgrounds = context.read(); + final embedded = [ + for (final theme in themes) await backgrounds.embedThemeImages(theme), + ]; + final result = await exportThemesFile( + embedded, + fileStem: fileStem, + sharePositionOrigin: origin, + ); + if (result != ThemeFileResult.failed || !context.mounted) return; + showDismissibleSnackBar( + context, + content: Text(context.l10n.themes_exportFailed), + ); + } + + Future _importFile( + BuildContext context, + AppSettingsService settingsService, + ) async { + final String? text; + try { + text = await pickThemesFile(); + } catch (_) { + if (context.mounted) { + showDismissibleSnackBar( + context, + content: Text(context.l10n.themes_importFileNone), + ); + } + return; + } + if (text == null || !context.mounted) return; + final backgrounds = context.read(); + final themes = [ + for (final theme in decodeThemesJsonl( + text, + newId: settingsService.newCustomThemeId, + )) + await backgrounds.storeThemeImages(theme), + ]; + final added = themes.isEmpty + ? 0 + : await settingsService.importCustomThemes(themes); + if (!context.mounted) return; + showDismissibleSnackBar( + context, + content: Text( + themes.isEmpty + ? context.l10n.themes_importFileNone + : context.l10n.themes_importFileResult(added), + ), + ); + } + + Future _copyCode(BuildContext context, CustomTheme theme) async { + final embedded = await context + .read() + .embedThemeImages(theme); + await Clipboard.setData(ClipboardData(text: embedded.toShareCode())); + if (!context.mounted) return; + showDismissibleSnackBar( + context, + content: Text(context.l10n.themes_codeCopied), + ); + } + + void _confirmDelete( + BuildContext context, + AppSettingsService settingsService, + CustomTheme theme, + ) { + showDialog( + context: context, + builder: (dialogContext) => AlertDialog( + title: Text(dialogContext.l10n.themes_deleteConfirm(theme.name)), + actions: [ + TextButton( + onPressed: () => Navigator.pop(dialogContext), + child: Text(dialogContext.l10n.common_cancel), + ), + TextButton( + onPressed: () { + Navigator.pop(dialogContext); + settingsService.deleteCustomTheme(theme.id); + }, + child: Text(dialogContext.l10n.common_delete), + ), + ], + ), + ); + } + + Future _showImportDialog( + BuildContext context, + AppSettingsService settingsService, + ) async { + final clipboard = await Clipboard.getData(Clipboard.kTextPlain); + if (!context.mounted) return; + final controller = TextEditingController( + text: CustomTheme.fromShareCode(clipboard?.text ?? '', newId: '') != null + ? clipboard!.text!.trim() + : '', + ); + final imported = await showDialog( + context: context, + builder: (dialogContext) { + String? error; + return StatefulBuilder( + builder: (dialogContext, setState) => AlertDialog( + title: Text(dialogContext.l10n.themes_import), + content: TextField( + controller: controller, + autofocus: true, + minLines: 2, + maxLines: 5, + decoration: InputDecoration( + hintText: dialogContext.l10n.themes_importHint, + errorText: error, + ), + ), + actions: [ + TextButton( + onPressed: () => Navigator.pop(dialogContext), + child: Text(dialogContext.l10n.common_cancel), + ), + FilledButton( + onPressed: () { + final theme = CustomTheme.fromShareCode( + controller.text, + newId: settingsService.newCustomThemeId(), + ); + if (theme == null) { + setState( + () => error = dialogContext.l10n.themes_importInvalid, + ); + return; + } + Navigator.pop(dialogContext, theme); + }, + child: Text(dialogContext.l10n.themes_import), + ), + ], + ), + ); + }, + ); + controller.dispose(); + if (imported == null || !context.mounted) return; + final stored = await context.read().storeThemeImages( + imported, + ); + await settingsService.saveCustomTheme(stored, apply: true); + if (!context.mounted) return; + showDismissibleSnackBar( + context, + content: Text(context.l10n.themes_imported(stored.name)), + ); + } +} + +/// Explains that a holiday theme was switched on automatically and that the +/// user's own theme returns afterwards. +class _AutoHolidayNote extends StatelessWidget { + final String text; + + const _AutoHolidayNote(this.text); + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + return Padding( + padding: const EdgeInsets.fromLTRB(16, 4, 16, 8), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Icon(Icons.info_outline, size: 24, color: scheme.primary), + const SizedBox(width: 12), + Expanded( + child: Text( + text, + style: Theme.of( + context, + ).textTheme.bodyMedium?.copyWith(color: scheme.onSurface), + ), + ), + ], + ), + ); + } +} + +class _MenuRow extends StatelessWidget { + final IconData icon; + final String label; + + const _MenuRow(this.icon, this.label); + + @override + Widget build(BuildContext context) { + return Row( + children: [ + Icon(icon, size: 22), + const SizedBox(width: 12), + Flexible(child: Text(label)), + ], + ); + } +} + +class _ThemeTile extends StatelessWidget { + final String name; + final String? subtitle; + final Color background; + final Color accent; + final bool selected; + final VoidCallback onTap; + final Widget? menu; + + /// Shown instead of the color swatch (holiday themes show an icon). + final Widget? preview; + + const _ThemeTile({ + required this.name, + this.subtitle, + required this.background, + required this.accent, + required this.selected, + required this.onTap, + this.menu, + this.preview, + }); + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + final textTheme = Theme.of(context).textTheme; + return Semantics( + selected: selected, + button: true, + child: MeshCard( + onTap: onTap, + padding: const EdgeInsets.fromLTRB(14, 10, 4, 10), + borderColor: selected ? scheme.primary : null, + child: Row( + children: [ + preview ?? ThemeSwatch(background: background, accent: accent), + const SizedBox(width: 14), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + name, + style: textTheme.bodyLarge?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + if (subtitle != null) ...[ + const SizedBox(height: 2), + Text( + subtitle!, + style: textTheme.bodyMedium?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ], + ], + ), + ), + if (selected) + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: Icon(Icons.check_circle, color: scheme.primary), + ), + if (menu != null) menu! else const SizedBox(width: 12), + ], + ), + ), + ); + } +} + +/// A small rounded square showing a theme's background with an accent dot +/// and a sample text bar, so themes can be told apart at a glance. +class ThemeSwatch extends StatelessWidget { + final Color background; + final Color accent; + final double size; + + const ThemeSwatch({ + super.key, + required this.background, + required this.accent, + this.size = 48, + }); + + @override + Widget build(BuildContext context) { + final ink = isDarkColor(background) + ? MeshPalette.ink + : MeshPalette.lightInk; + return Container( + width: size, + height: size, + decoration: BoxDecoration( + color: background, + borderRadius: BorderRadius.circular(MeshRadii.sm), + border: Border.all(color: Theme.of(context).colorScheme.outline), + ), + padding: EdgeInsets.all(size * 0.18), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + height: size * 0.1, + width: size * 0.5, + decoration: BoxDecoration( + color: ink.withValues(alpha: 0.8), + borderRadius: BorderRadius.circular(size), + ), + ), + Align( + alignment: Alignment.bottomRight, + child: Container( + width: size * 0.32, + height: size * 0.32, + decoration: BoxDecoration(color: accent, shape: BoxShape.circle), + ), + ), + ], + ), + ); + } +} diff --git a/lib/services/app_settings_service.dart b/lib/services/app_settings_service.dart index 6be73659..5e9f1d73 100644 --- a/lib/services/app_settings_service.dart +++ b/lib/services/app_settings_service.dart @@ -1,6 +1,9 @@ +import 'dart:async'; import 'dart:convert'; import 'package:flutter/foundation.dart'; import '../models/app_settings.dart'; +import '../models/custom_theme.dart'; +import '../models/holiday_schedule.dart'; import '../models/image_codec_support.dart'; import '../models/translation_support.dart'; @@ -12,6 +15,12 @@ import '../helpers/cyr2lat.dart'; class AppSettingsService extends ChangeNotifier { static const String _settingsKey = 'app_settings'; + /// [clock] supplies "now" for the holiday theme schedule; tests inject one. + AppSettingsService({DateTime Function()? clock}) + : _clock = clock ?? DateTime.now; + + final DateTime Function() _clock; + AppSettings _settings = AppSettings(); AppSettings get settings => _settings; @@ -55,11 +64,14 @@ class AppSettingsService extends ChangeNotifier { _settings = AppSettings(); Cyr2Lat.setCharMap(_settings.cyr2latCharMap); } + _syncDateTimer(); } Future updateSettings(AppSettings newSettings) async { _settings = newSettings; Cyr2Lat.setCharMap(_settings.cyr2latCharMap); + _lastAutoHolidayKey = autoHoliday?.occurrenceKey; + _syncDateTimer(); notifyListeners(); final prefs = PrefsManager.instance; @@ -234,8 +246,206 @@ class AppSettingsService extends ChangeNotifier { ); } + /// Picks a stock light/dark/system mode and leaves any custom theme. + /// + /// Counts as a manual choice: an automatically applied holiday theme is + /// skipped for the rest of that holiday. Future setThemeMode(String value) async { - await updateSettings(_settings.copyWith(themeMode: value)); + await updateSettings( + _dismissAutoHoliday( + _settings.copyWith(themeMode: value, activeThemeId: null), + ), + ); + } + + Future setHolidayAnimationsEnabled(bool value) async { + await updateSettings(_settings.copyWith(holidayAnimationsEnabled: value)); + } + + /// The theme in use, or null for the stock theme: the automatic holiday + /// theme while one applies ([autoHolidayTheme]), otherwise the user's own + /// choice ([AppSettings.activeThemeId]). + CustomTheme? get activeCustomTheme => + autoHolidayTheme ?? _themeById(_settings.activeThemeId); + + /// The user's own chosen theme, ignoring any automatic holiday theme. + CustomTheme? get chosenCustomTheme => _themeById(_settings.activeThemeId); + + CustomTheme? _themeById(String? id) { + if (id == null) return null; + return CustomTheme.presetById(id) ?? + _settings.customThemes.where((t) => t.id == id).firstOrNull; + } + + /// The holiday within its window today, if auto-switching is on and the + /// user has not overridden this occurrence. Null otherwise. + ActiveHoliday? get autoHoliday { + if (!_settings.holidayAutoSwitch) return null; + final holiday = activeHolidayFor(_clock()); + if (holiday == null) return null; + if (_settings.holidayThemeDismissed == holiday.occurrenceKey) return null; + // The user picked this holiday's theme themselves: nothing to override. + if (_settings.activeThemeId == holiday.themeId) return null; + return holiday; + } + + /// The holiday preset being applied automatically in place of the user's + /// own theme, or null when none is. + CustomTheme? get autoHolidayTheme { + final holiday = autoHoliday; + return holiday == null ? null : CustomTheme.presetById(holiday.themeId); + } + + /// Marks the automatically applied holiday (if any) as overridden for this + /// occurrence, so a manual theme choice sticks until the holiday is over. + AppSettings _dismissAutoHoliday(AppSettings next) { + final holiday = autoHoliday; + if (holiday == null) return next; + return next.copyWith(holidayThemeDismissed: holiday.occurrenceKey); + } + + /// Applies a custom or preset theme; null returns to the stock theme. + /// + /// Picking a theme while a holiday theme is applied automatically keeps + /// the pick for the rest of that holiday. Picking the automatic holiday + /// theme itself changes nothing, so the user's own theme still returns + /// after the holiday. + Future setActiveTheme(String? themeId) async { + final holiday = autoHoliday; + if (holiday != null && themeId == holiday.themeId) return; + await updateSettings( + _dismissAutoHoliday(_settings.copyWith(activeThemeId: themeId)), + ); + } + + /// Turns automatic holiday themes on or off. Turning it on also forgets an + /// earlier override, so the current holiday's theme shows again. + Future setHolidayAutoSwitch(bool value) async { + await updateSettings( + _settings.copyWith( + holidayAutoSwitch: value, + holidayThemeDismissed: value ? null : _settings.holidayThemeDismissed, + ), + ); + } + + // ---- date-change refresh -------------------------------------------------- + // The automatic holiday theme depends on the date. Once [startDateWatch] has + // been called (the app does so at startup; tests normally don't), a timer + // wakes at the next local midnight, or after an hour at most in case the + // device slept through it, and tells listeners if the holiday theme + // changed. It only runs while auto-switching is on. + + static const Duration _maxDateCheckInterval = Duration(hours: 1); + + Timer? _dateTimer; + bool _dateWatchStarted = false; + String? _lastAutoHolidayKey; + + /// Starts re-checking the automatic holiday theme when the date changes. + void startDateWatch() { + _dateWatchStarted = true; + _lastAutoHolidayKey = autoHoliday?.occurrenceKey; + _syncDateTimer(); + } + + void _syncDateTimer() { + final wanted = _dateWatchStarted && _settings.holidayAutoSwitch; + if (!wanted) { + _dateTimer?.cancel(); + _dateTimer = null; + } else if (_dateTimer == null) { + _scheduleDateTimer(); + } + } + + void _scheduleDateTimer() { + final now = _clock(); + // A second past midnight so a slightly early wake-up still sees the new + // day. + final nextMidnight = DateTime(now.year, now.month, now.day + 1, 0, 0, 1); + var delay = nextMidnight.difference(now); + if (delay > _maxDateCheckInterval) delay = _maxDateCheckInterval; + _dateTimer = Timer(delay, () { + _dateTimer = null; + checkDateChange(); + _syncDateTimer(); + }); + } + + /// Notifies listeners if the automatic holiday theme differs from the one + /// last seen. Called by the date timer; public so tests can drive it. + @visibleForTesting + void checkDateChange() { + final key = autoHoliday?.occurrenceKey; + if (key == _lastAutoHolidayKey) return; + _lastAutoHolidayKey = key; + notifyListeners(); + } + + @visibleForTesting + bool get hasDateTimer => _dateTimer != null; + + @override + void dispose() { + _dateTimer?.cancel(); + _dateTimer = null; + super.dispose(); + } + + /// Adds [theme] or replaces the saved theme with the same ID. + Future saveCustomTheme(CustomTheme theme, {bool apply = false}) async { + final themes = List.from(_settings.customThemes); + final index = themes.indexWhere((t) => t.id == theme.id); + if (index >= 0) { + themes[index] = theme; + } else { + themes.add(theme); + } + final next = _settings.copyWith( + customThemes: themes, + activeThemeId: apply ? theme.id : _settings.activeThemeId, + ); + // Applying a theme is a manual choice, like [setActiveTheme]. + await updateSettings(apply ? _dismissAutoHoliday(next) : next); + } + + Future deleteCustomTheme(String themeId) async { + final themes = _settings.customThemes + .where((t) => t.id != themeId) + .toList(); + await updateSettings( + _settings.copyWith( + customThemes: themes, + activeThemeId: _settings.activeThemeId == themeId + ? null + : _settings.activeThemeId, + ), + ); + } + + /// A fresh ID for a new custom theme. + /// The counter keeps IDs unique when several are made in the same tick + /// (bulk imports; web clocks only tick in milliseconds). + String newCustomThemeId() => + 'custom:${DateTime.now().microsecondsSinceEpoch}-${_themeIdCounter++}'; + int _themeIdCounter = 0; + + /// Adds [themes], skipping any identical (apart from ID) to a saved one. + /// Returns how many were added. + Future importCustomThemes(List themes) async { + final existing = List.from(_settings.customThemes); + var added = 0; + for (final theme in themes) { + final duplicate = existing.any((t) => t == theme.copyWith(id: t.id)); + if (duplicate) continue; + existing.add(theme); + added++; + } + if (added > 0) { + await updateSettings(_settings.copyWith(customThemes: existing)); + } + return added; } Future setLanguageOverride(String? value) async { diff --git a/lib/services/chat_background_image_store.dart b/lib/services/chat_background_image_store.dart new file mode 100644 index 00000000..2de9864d --- /dev/null +++ b/lib/services/chat_background_image_store.dart @@ -0,0 +1,7 @@ +/// Platform-appropriate [ChatBackgroundImageStore], chosen at compile time +/// (`dart:io` files natively, preferences on web). +library; + +export 'chat_background_image_store_base.dart'; +export 'chat_background_image_store_stub.dart' + if (dart.library.io) 'chat_background_image_store_io.dart'; diff --git a/lib/services/chat_background_image_store_base.dart b/lib/services/chat_background_image_store_base.dart new file mode 100644 index 00000000..7bcca893 --- /dev/null +++ b/lib/services/chat_background_image_store_base.dart @@ -0,0 +1,26 @@ +import 'dart:typed_data'; + +/// Stores chat background pictures by content ID. +abstract class ChatBackgroundImageStore { + Future write(String id, Uint8List bytes); + Future read(String id); + Future delete(String id); + Future> listIds(); +} + +/// For tests. +class InMemoryChatBackgroundImageStore implements ChatBackgroundImageStore { + final Map images = {}; + + @override + Future write(String id, Uint8List bytes) async => images[id] = bytes; + + @override + Future read(String id) async => images[id]; + + @override + Future delete(String id) async => images.remove(id); + + @override + Future> listIds() async => images.keys.toSet(); +} diff --git a/lib/services/chat_background_image_store_io.dart b/lib/services/chat_background_image_store_io.dart new file mode 100644 index 00000000..74dee129 --- /dev/null +++ b/lib/services/chat_background_image_store_io.dart @@ -0,0 +1,59 @@ +import 'dart:io'; +import 'dart:typed_data'; + +import 'package:path_provider/path_provider.dart'; + +import 'chat_background_image_store_base.dart'; + +ChatBackgroundImageStore createChatBackgroundImageStore() => + _FileChatBackgroundImageStore(); + +/// One JPEG XL file per picture under `/chat_backgrounds/`. +class _FileChatBackgroundImageStore implements ChatBackgroundImageStore { + Directory? _dir; + + Future _directory() async { + final existing = _dir; + if (existing != null) return existing; + final base = await getApplicationSupportDirectory(); + final dir = Directory('${base.path}/chat_backgrounds'); + await dir.create(recursive: true); + return _dir = dir; + } + + Future _file(String id) async => + File('${(await _directory()).path}/$id.jxl'); + + @override + Future write(String id, Uint8List bytes) async { + final file = await _file(id); + final temp = File('${file.path}.tmp'); + await temp.writeAsBytes(bytes, flush: true); + await temp.rename(file.path); + } + + @override + Future read(String id) async { + final file = await _file(id); + if (!await file.exists()) return null; + return file.readAsBytes(); + } + + @override + Future delete(String id) async { + final file = await _file(id); + if (await file.exists()) await file.delete(); + } + + @override + Future> listIds() async { + final dir = await _directory(); + return dir + .listSync() + .whereType() + .map((f) => f.uri.pathSegments.last) + .where((name) => name.endsWith('.jxl')) + .map((name) => name.substring(0, name.length - 4)) + .toSet(); + } +} diff --git a/lib/services/chat_background_image_store_stub.dart b/lib/services/chat_background_image_store_stub.dart new file mode 100644 index 00000000..2436c788 --- /dev/null +++ b/lib/services/chat_background_image_store_stub.dart @@ -0,0 +1,42 @@ +import 'dart:convert'; +import 'dart:typed_data'; + +import '../storage/prefs_manager.dart'; +import 'chat_background_image_store_base.dart'; + +ChatBackgroundImageStore createChatBackgroundImageStore() => + _PrefsChatBackgroundImageStore(); + +/// Web: pictures are base64 in preferences (browser local storage). They are +/// small JPEG XL files, so a handful fit comfortably in the storage quota. +class _PrefsChatBackgroundImageStore implements ChatBackgroundImageStore { + static const _prefix = 'chat_bg_image_'; + + @override + Future write(String id, Uint8List bytes) async { + await PrefsManager.instance.setString('$_prefix$id', base64Encode(bytes)); + } + + @override + Future read(String id) async { + final value = PrefsManager.instance.getString('$_prefix$id'); + if (value == null) return null; + try { + return base64Decode(value); + } on FormatException { + return null; + } + } + + @override + Future delete(String id) async { + await PrefsManager.instance.remove('$_prefix$id'); + } + + @override + Future> listIds() async => PrefsManager.instance + .getKeys() + .where((k) => k.startsWith(_prefix)) + .map((k) => k.substring(_prefix.length)) + .toSet(); +} diff --git a/lib/services/chat_background_service.dart b/lib/services/chat_background_service.dart new file mode 100644 index 00000000..0cbfc235 --- /dev/null +++ b/lib/services/chat_background_service.dart @@ -0,0 +1,237 @@ +import 'dart:async'; +import 'dart:convert'; +import 'dart:ui' as ui; + +import 'package:crypto/crypto.dart' as crypto; +import 'package:flutter/foundation.dart'; +import 'package:koni_jxl_flutter/koni_jxl_flutter.dart'; + +import '../models/channel.dart'; +import '../models/chat_background.dart'; +import '../models/contact.dart'; +import '../models/custom_theme.dart'; +import '../storage/prefs_manager.dart'; +import '../utils/app_logger.dart'; +import 'app_settings_service.dart'; +import 'chat_background_image_store.dart'; + +/// Chat backgrounds: one per channel or DM, plus the active theme's. +/// +/// A chat's own background wins over the theme's, unless the theme turns on +/// [CustomTheme.chatBackgroundEverywhere]. Settings are global (not per +/// radio): channels are keyed by their PSK-derived storage ID and DMs by the +/// contact's public key, both of which identify the chat on any radio. +class ChatBackgroundService extends ChangeNotifier { + static const _prefsKey = 'chat_backgrounds_v1'; + + /// Longest side of a stored picture, in pixels. + static const int maxImageSide = 1080; + + /// JPEG XL lossy "distance" (cjxl-style; 1 is visually lossless). A chat + /// background is shown faded behind messages, so 2 keeps it sharp at a + /// fraction of the size. + static const double jxlDistance = 2.0; + + final AppSettingsService _settings; + final ChatBackgroundImageStore _images; + final Map _byChat = {}; + final Map _imageCache = {}; + final Set _loading = {}; + + ChatBackgroundService(this._settings, {ChatBackgroundImageStore? imageStore}) + : _images = imageStore ?? createChatBackgroundImageStore() { + _load(); + _settings.addListener(notifyListeners); + } + + static String channelKey(Channel channel) => + 'channel:${channel.storageId ?? 'slot${channel.index}'}'; + + static String contactKey(Contact contact) => + 'contact:${contact.publicKeyHex}'; + + void _load() { + final raw = PrefsManager.instance.getString(_prefsKey); + if (raw == null) return; + try { + final decoded = jsonDecode(raw); + if (decoded is! Map) return; + decoded.forEach((key, value) { + final background = ChatBackground.fromJson(value); + if (key is! String || background == null) return; + if (background.color != null || background.imageId != null) { + _byChat[key] = background; + } + }); + } catch (e) { + appLogger.warn('Could not read chat backgrounds: $e'); + } + } + + Future _save() async { + await PrefsManager.instance.setString( + _prefsKey, + jsonEncode(_byChat.map((key, value) => MapEntry(key, value.toJson()))), + ); + } + + /// The background this chat has been given itself (ignoring the theme). + ChatBackground? chatBackground(String chatKey) => _byChat[chatKey]; + + /// The theme background that will override [chatKey]'s own, if any. + CustomTheme? get overridingTheme { + final theme = _settings.activeCustomTheme; + if (theme?.chatBackground == null || !theme!.chatBackgroundEverywhere) { + return null; + } + return theme; + } + + /// What to draw behind [chatKey]'s messages, or null for none. + ChatBackground? resolve(String chatKey) { + final theme = _settings.activeCustomTheme; + final themed = theme?.chatBackground; + if (themed != null && theme!.chatBackgroundEverywhere) return themed; + return _byChat[chatKey] ?? themed; + } + + Future setChatBackground( + String chatKey, + ChatBackground? background, + ) async { + if (background == null) { + _byChat.remove(chatKey); + } else { + _byChat[chatKey] = background; + } + notifyListeners(); + await _save(); + } + + /// Cached picture bytes, or null while they load (listeners are notified + /// once they arrive). + Uint8List? imageBytes(String imageId) { + final cached = _imageCache[imageId]; + if (cached != null) return cached; + if (_loading.add(imageId)) { + unawaited( + _images.read(imageId).then((bytes) { + _loading.remove(imageId); + if (bytes == null) return; + _imageCache[imageId] = bytes; + notifyListeners(); + }), + ); + } + return null; + } + + /// Shrinks a picture (any format Flutter or JPEG XL decodes), re-encodes + /// it as JPEG XL and stores it. Returns its ID, or null when [bytes] is not + /// a readable image. + Future addImage(Uint8List bytes) async { + final jxl = await encodeChatBackgroundJxl(bytes); + if (jxl == null) return null; + final id = crypto.sha256.convert(jxl).toString().substring(0, 20); + _imageCache[id] = jxl; + await _images.write(id, jxl); + return id; + } + + /// Writes any picture carried inline by [theme] (from a share code or + /// file) to the image store, so the theme can be saved in settings. + Future storeThemeImages(CustomTheme theme) async { + final background = theme.chatBackground; + final inline = background?.inlineImage; + if (background == null || inline == null) return theme; + // Re-encode untrusted input rather than storing it verbatim. + final id = await addImage(inline); + return id == null + ? theme.copyWith(chatBackground: null) + : theme.copyWith(chatBackground: background.withStoredImage(id)); + } + + /// Attaches the picture bytes to [theme] so its share code or file + /// carries the picture. + Future embedThemeImages(CustomTheme theme) async { + final background = theme.chatBackground; + final id = background?.imageId; + if (background == null || id == null) return theme; + final bytes = _imageCache[id] ?? await _images.read(id); + if (bytes == null) return theme; + return theme.copyWith(chatBackground: background.withInlineImage(bytes)); + } + + /// Deletes stored pictures no chat or saved theme uses any more. + Future collectGarbage() async { + final inUse = { + for (final background in _byChat.values) + if (background.imageId != null) background.imageId!, + for (final theme in _settings.settings.customThemes) + if (theme.chatBackground?.imageId != null) + theme.chatBackground!.imageId!, + }; + try { + for (final id in await _images.listIds()) { + if (inUse.contains(id)) continue; + await _images.delete(id); + _imageCache.remove(id); + } + } catch (e) { + appLogger.warn('Chat background cleanup failed: $e'); + } + } + + @override + void dispose() { + _settings.removeListener(notifyListeners); + super.dispose(); + } +} + +/// Decodes [bytes], shrinks the picture to fit +/// [ChatBackgroundService.maxImageSide] and encodes it as lossy JPEG XL. +/// Returns null for unreadable input. +/// +/// Non-JXL input goes through Flutter's decoder, which also applies a +/// photo's EXIF rotation. +Future encodeChatBackgroundJxl(Uint8List bytes) async { + const maxSide = ChatBackgroundService.maxImageSide; + ui.Image? image; + try { + if (looksLikeJxl(bytes)) { + image = await decodeJxlToUiImage( + bytes, + cacheWidth: maxSide, + cacheHeight: maxSide, + ); + } else { + final buffer = await ui.ImmutableBuffer.fromUint8List(bytes); + final codec = await ui.instantiateImageCodecWithSize( + buffer, + getTargetSize: (width, height) { + final longest = width > height ? width : height; + if (longest <= maxSide) { + return ui.TargetImageSize(width: width, height: height); + } + final scale = maxSide / longest; + return ui.TargetImageSize( + width: (width * scale).round().clamp(1, maxSide), + height: (height * scale).round().clamp(1, maxSide), + ); + }, + ); + image = (await codec.getNextFrame()).image; + codec.dispose(); + } + return await encodeJxlLossyFromUiImage( + image, + distance: ChatBackgroundService.jxlDistance, + ); + } catch (e) { + appLogger.warn('Could not encode chat background: $e'); + return null; + } finally { + image?.dispose(); + } +} diff --git a/lib/services/map_tile_cache_service.dart b/lib/services/map_tile_cache_service.dart index 5538d91d..dbe2da8b 100644 --- a/lib/services/map_tile_cache_service.dart +++ b/lib/services/map_tile_cache_service.dart @@ -6,6 +6,7 @@ import 'package:flutter_cache_manager/flutter_cache_manager.dart'; import 'package:flutter_map/flutter_map.dart'; import '../models/app_settings.dart'; +import '../theme/mesh_theme.dart'; import 'app_settings_service.dart'; enum MapRasterSourcePreset { @@ -506,6 +507,19 @@ class MapTileCacheService extends ChangeNotifier { layer = ColorFiltered(colorFilter: filter, child: layer); } + // Custom themes wash their background color over the tiles so the map + // matches the rest of the app. Kept light so roads and labels stay clear. + final tint = MeshMapTheme.of(context).tileTint; + if (tint != null) { + layer = ColorFiltered( + colorFilter: ColorFilter.mode( + tint.withValues(alpha: MeshMapTheme.tileTintStrength), + BlendMode.srcATop, + ), + child: layer, + ); + } + if (opacity < 1) { layer = Opacity(opacity: opacity, child: layer); } diff --git a/lib/theme/mesh_theme.dart b/lib/theme/mesh_theme.dart index 281b1145..f8d8ee62 100644 --- a/lib/theme/mesh_theme.dart +++ b/lib/theme/mesh_theme.dart @@ -1,5 +1,8 @@ import 'package:flutter/material.dart'; +import '../models/custom_theme.dart'; +import 'theme_icons.dart'; + /// MeshCore palette — high-contrast slate surfaces with sky-blue accents. class MeshPalette { MeshPalette._(); @@ -157,6 +160,98 @@ class MeshRadii { static const pill = 999.0; } +/// Map colors. The stock themes keep the map's own high-contrast palette; +/// custom themes tint the tiles and use their accent and surfaces. +@immutable +class MeshMapTheme extends ThemeExtension { + /// Selection, own-position and route color. + final Color accent; + + /// Washed over map tiles; null leaves tiles untouched. + final Color? tileTint; + + /// True for custom themes: map overlays use the theme's colors instead of + /// [MapPalette]'s fixed dark panels. + final bool followsTheme; + + const MeshMapTheme({ + required this.accent, + this.tileTint, + this.followsTheme = false, + }); + + static const standard = MeshMapTheme(accent: MapPalette.selected); + + /// How strongly [tileTint] colors the tiles. + static const double tileTintStrength = 0.22; + + static MeshMapTheme of(BuildContext context) => + Theme.of(context).extension() ?? standard; + + @override + MeshMapTheme copyWith({Color? accent, Color? tileTint, bool? followsTheme}) { + return MeshMapTheme( + accent: accent ?? this.accent, + tileTint: tileTint ?? this.tileTint, + followsTheme: followsTheme ?? this.followsTheme, + ); + } + + @override + MeshMapTheme lerp(MeshMapTheme? other, double t) { + if (other == null) return this; + return MeshMapTheme( + accent: Color.lerp(accent, other.accent, t)!, + tileTint: Color.lerp(tileTint, other.tileTint, t), + followsTheme: t < 0.5 ? followsTheme : other.followsTheme, + ); + } +} + +/// Colors for your own (outgoing) chat bubbles. Part of the theme so custom +/// themes can tint them with their accent. +@immutable +class MeshBubbleTheme extends ThemeExtension { + final Color me; + final Color meBorder; + final Color meInk; + + const MeshBubbleTheme({ + required this.me, + required this.meBorder, + required this.meInk, + }); + + /// The stock dusk-blue bubble used by the built-in light and dark themes. + static const standard = MeshBubbleTheme( + me: MeshPalette.me, + meBorder: MeshPalette.meBorder, + meInk: MeshPalette.meInk, + ); + + static MeshBubbleTheme of(BuildContext context) => + Theme.of(context).extension() ?? standard; + + @override + MeshBubbleTheme copyWith({Color? me, Color? meBorder, Color? meInk}) { + return MeshBubbleTheme( + me: me ?? this.me, + meBorder: meBorder ?? this.meBorder, + meInk: meInk ?? this.meInk, + ); + } + + @override + MeshBubbleTheme lerp(MeshBubbleTheme? other, double t) { + if (other == null) return this; + return MeshBubbleTheme( + me: Color.lerp(me, other.me, t)!, + meBorder: Color.lerp(meBorder, other.meBorder, t)!, + meInk: Color.lerp(meInk, other.meInk, t)!, + ); + } +} + /// Shared helpers exposed via [MeshTheme.of]. class MeshTheme { MeshTheme._(); @@ -195,7 +290,13 @@ class MeshTheme { onInverseSurface: MeshPalette.bg, inversePrimary: MeshPalette.blueDim, ); - return _build(scheme, Brightness.dark); + return _build( + scheme, + Brightness.dark, + MeshBubbleTheme.standard, + MeshIconTheme.none, + MeshMapTheme.standard, + ); } static ThemeData light() { @@ -227,10 +328,70 @@ class MeshTheme { outline: MeshPalette.lightLine, outlineVariant: Color(0xFFD8DEE5), ); - return _build(scheme, Brightness.light); + return _build( + scheme, + Brightness.light, + MeshBubbleTheme.standard, + MeshIconTheme.none, + MeshMapTheme.standard, + ); } - static ThemeData _build(ColorScheme scheme, Brightness brightness) { + /// Builds a full theme from a user's two-color [CustomTheme]. + /// + /// Surfaces are stepped from the background toward the text color, so any + /// background yields evenly separated cards, inputs and borders. Text is + /// near-white on dark backgrounds and near-black on light ones. Status + /// colors (warning, error, secondary) come from the stock theme of the + /// same brightness so they keep their meaning. + static ThemeData fromCustom(CustomTheme custom) { + final dark = custom.isDark; + final bg = custom.background; + final accent = custom.accent; + final ink = dark ? MeshPalette.ink : MeshPalette.lightInk; + Color step(double t) => Color.lerp(bg, ink, t)!; + Color onColor(Color c) => + isDarkColor(c) ? Colors.white : MeshPalette.lightInk; + + final base = (dark ? MeshTheme.dark() : MeshTheme.light()).colorScheme; + final primaryContainer = Color.lerp(bg, accent, 0.4)!; + final scheme = base.copyWith( + primary: accent, + onPrimary: onColor(accent), + primaryContainer: primaryContainer, + onPrimaryContainer: onColor(primaryContainer), + surface: bg, + onSurface: ink, + surfaceContainerLowest: bg, + surfaceContainerLow: step(dark ? 0.04 : 0.035), + surfaceContainer: step(dark ? 0.04 : 0.035), + surfaceContainerHigh: step(dark ? 0.08 : 0.07), + surfaceContainerHighest: step(dark ? 0.13 : 0.11), + onSurfaceVariant: step(dark ? 0.8 : 0.75), + outline: step(dark ? 0.28 : 0.24), + outlineVariant: step(dark ? 0.15 : 0.13), + inverseSurface: ink, + onInverseSurface: bg, + inversePrimary: Color.lerp(accent, bg, 0.3), + ); + + final me = Color.lerp(bg, accent, dark ? 0.35 : 0.22)!; + return _build( + scheme, + dark ? Brightness.dark : Brightness.light, + MeshBubbleTheme(me: me, meBorder: accent, meInk: onColor(me)), + MeshIconTheme(custom.icons), + MeshMapTheme(accent: accent, tileTint: bg, followsTheme: true), + ); + } + + static ThemeData _build( + ColorScheme scheme, + Brightness brightness, + MeshBubbleTheme bubble, + MeshIconTheme icons, + MeshMapTheme map, + ) { final baseText = Typography.material2021( platform: TargetPlatform.android, @@ -244,6 +405,7 @@ class MeshTheme { return ThemeData( useMaterial3: true, + extensions: [bubble, icons, map], brightness: brightness, colorScheme: scheme, scaffoldBackgroundColor: scheme.surface, diff --git a/lib/theme/theme_icons.dart b/lib/theme/theme_icons.dart new file mode 100644 index 00000000..197bc882 --- /dev/null +++ b/lib/theme/theme_icons.dart @@ -0,0 +1,379 @@ +import 'dart:convert'; +import 'dart:ui' as ui; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:koni_jxl_flutter/koni_jxl_flutter.dart'; + +import '../connector/meshcore_protocol.dart'; + +/// The app icons a theme can replace. [key] is what themes store, so it must +/// never change once released. +enum ThemeIconSlot { + contacts('contacts', Icons.people_outline, Icons.people), + channels('channels', Icons.tag, Icons.tag), + map('map', Icons.map_outlined, Icons.map), + send('send', Icons.send, Icons.send), + settings('settings', Icons.settings, Icons.settings), + repeater('repeater', Icons.cell_tower, Icons.cell_tower), + room('room', Icons.meeting_room, Icons.meeting_room), + sensor('sensor', Icons.sensors, Icons.sensors), + + // Map markers. + mapChat('map_chat', Icons.person, Icons.person), + mapRepeater('map_repeater', Icons.router, Icons.router), + mapRoom('map_room', Icons.meeting_room, Icons.meeting_room), + mapSensor('map_sensor', Icons.sensors, Icons.sensors), + mapSelf('map_self', Icons.person_pin_circle, Icons.person_pin_circle); + + /// Whether this slot is a marker on the map (grouped apart in the editor). + bool get isMapMarker => key.startsWith('map_'); + + /// The slot showing the same node type elsewhere: list avatar <-> map + /// marker. Null when there is none. + ThemeIconSlot? get partner => switch (this) { + ThemeIconSlot.repeater => ThemeIconSlot.mapRepeater, + ThemeIconSlot.room => ThemeIconSlot.mapRoom, + ThemeIconSlot.sensor => ThemeIconSlot.mapSensor, + ThemeIconSlot.mapRepeater => ThemeIconSlot.repeater, + ThemeIconSlot.mapRoom => ThemeIconSlot.room, + ThemeIconSlot.mapSensor => ThemeIconSlot.sensor, + _ => null, + }; + + final String key; + final IconData icon; + + /// Variant shown when the slot is selected (e.g. the active nav tab). + final IconData selectedIcon; + + const ThemeIconSlot(this.key, this.icon, this.selectedIcon); +} + +/// A theme's replacement for one [ThemeIconSlot]: either a named icon from +/// [kThemeIconCatalog] or a small picture (PNG, base64 in JSON). +@immutable +class ThemeIconOverride { + /// Key in [kThemeIconCatalog]. + final String? icon; + + /// Base64-encoded picture (JPEG XL; older themes may hold PNG). + final String? image; + + /// Decoded once so the image provider keeps hitting the same cache entry. + final Uint8List? imageBytes; + + /// A JPEG XL picture bundled with the app (see [isThemeAssetPath]). + final String? asset; + + const ThemeIconOverride.icon(String this.icon) + : image = null, + imageBytes = null, + asset = null; + + ThemeIconOverride.image(Uint8List bytes) + : icon = null, + image = base64Encode(bytes), + imageBytes = bytes, + asset = null; + + const ThemeIconOverride.asset(String this.asset) + : icon = null, + image = null, + imageBytes = null; + + const ThemeIconOverride._(this.icon, this.image, this.imageBytes) + : asset = null; + + Map toJson() => image != null + ? {'image': image} + : asset != null + ? {'asset': asset} + : {'icon': icon}; + + /// Returns null for unknown icon names or unreadable pictures, so a bad + /// entry in a shared code falls back to the default icon. + static ThemeIconOverride? fromJson(Object? json) { + if (json is! Map) return null; + final image = json['image']; + if (image is String && image.isNotEmpty) { + try { + return ThemeIconOverride._(null, image, base64Decode(image)); + } on FormatException { + return null; + } + } + final asset = json['asset']; + if (isThemeAssetPath(asset)) { + return ThemeIconOverride.asset(asset as String); + } + final icon = json['icon']; + if (icon is String && kThemeIconCatalog.containsKey(icon)) { + return ThemeIconOverride.icon(icon); + } + return null; + } + + @override + bool operator ==(Object other) => + other is ThemeIconOverride && + other.icon == icon && + other.image == image && + other.asset == asset; + + @override + int get hashCode => Object.hash(icon, image, asset); +} + +/// The map marker slot for a node type, or null for unknown types. +ThemeIconSlot? mapMarkerSlotForNodeType(int type) { + switch (type) { + case advTypeChat: + return ThemeIconSlot.mapChat; + case advTypeRepeater: + return ThemeIconSlot.mapRepeater; + case advTypeRoom: + return ThemeIconSlot.mapRoom; + case advTypeSensor: + return ThemeIconSlot.mapSensor; + default: + return null; + } +} + +/// Image provider for a picture override, or null for a named icon. +ImageProvider? themePictureOf(ThemeIconOverride? override) { + final bytes = override?.imageBytes; + if (bytes != null) return themePictureProvider(bytes); + final asset = override?.asset; + if (asset != null) return JxlImageProvider.asset(asset); + return null; +} + +/// Folder holding the pictures of the built-in themes. +const String kThemeAssetDir = 'assets/themes/'; + +/// Whether [value] names a bundled theme picture. Shared codes may only +/// point inside [kThemeAssetDir], and only at JPEG XL files. +bool isThemeAssetPath(Object? value) => + value is String && + value.startsWith(kThemeAssetDir) && + value.endsWith('.jxl') && + !value.contains('..'); + +/// Image provider for theme picture bytes: JPEG XL, or PNG/JPEG from themes +/// made before pictures were stored as JPEG XL. +ImageProvider themePictureProvider(Uint8List bytes) => + looksLikeJxl(bytes) ? JxlImageProvider.memory(bytes) : MemoryImage(bytes); + +/// Parses a theme's `icons` JSON object, keeping only known slots. +Map parseThemeIcons(Object? json) { + if (json is! Map) return const {}; + final knownKeys = ThemeIconSlot.values.map((s) => s.key).toSet(); + final result = {}; + json.forEach((key, value) { + if (key is! String || !knownKeys.contains(key)) return; + final override = ThemeIconOverride.fromJson(value); + if (override != null) result[key] = override; + }); + return result; +} + +/// Icons offered in the picker, by the name themes store. +const Map kThemeIconCatalog = { + 'people': Icons.people, + 'person': Icons.person, + 'groups': Icons.groups, + 'contacts': Icons.contacts, + 'forum': Icons.forum, + 'chat': Icons.chat, + 'chat_bubble': Icons.chat_bubble, + 'mail': Icons.mail, + 'tag': Icons.tag, + 'campaign': Icons.campaign, + 'podcasts': Icons.podcasts, + 'radio': Icons.radio, + 'map': Icons.map, + 'public': Icons.public, + 'explore': Icons.explore, + 'place': Icons.place, + 'near_me': Icons.near_me, + 'terrain': Icons.terrain, + 'send': Icons.send, + 'rocket_launch': Icons.rocket_launch, + 'arrow_upward': Icons.arrow_upward, + 'north_east': Icons.north_east, + 'flight': Icons.flight, + 'bolt': Icons.bolt, + 'settings': Icons.settings, + 'tune': Icons.tune, + 'build': Icons.build, + 'menu': Icons.menu, + 'cell_tower': Icons.cell_tower, + 'router': Icons.router, + 'wifi_tethering': Icons.wifi_tethering, + 'satellite_alt': Icons.satellite_alt, + 'meeting_room': Icons.meeting_room, + 'home': Icons.home, + 'cabin': Icons.cabin, + 'castle': Icons.castle, + 'sensors': Icons.sensors, + 'thermostat': Icons.thermostat, + 'water_drop': Icons.water_drop, + 'eco': Icons.eco, + 'star': Icons.star, + 'favorite': Icons.favorite, + 'pets': Icons.pets, + 'hiking': Icons.hiking, + 'sailing': Icons.sailing, + 'anchor': Icons.anchor, + 'local_fire_department': Icons.local_fire_department, + 'shield': Icons.shield, + 'emoji_emotions': Icons.emoji_emotions, + 'auto_awesome': Icons.auto_awesome, + 'nightlight': Icons.nightlight, + 'wb_sunny': Icons.wb_sunny, + 'park': Icons.park, + 'diamond': Icons.diamond, +}; + +/// Icon overrides carried by the active theme. +@immutable +class MeshIconTheme extends ThemeExtension { + final Map overrides; + + const MeshIconTheme(this.overrides); + + static const none = MeshIconTheme({}); + + static MeshIconTheme of(BuildContext context) => + Theme.of(context).extension() ?? none; + + /// The replacement for [slot]. A node type's list avatar and its map + /// marker stand for the same thing, so when a theme sets only one of the + /// pair the other uses it too. + ThemeIconOverride? operator [](ThemeIconSlot slot) { + final partner = slot.partner; + return overrides[slot.key] ?? + (partner == null ? null : overrides[partner.key]); + } + + /// Whether any of [slots] is replaced by a picture (drawn larger). + bool hasPictureFor(Iterable slots) => slots.any((slot) { + final o = this[slot]; + return o?.imageBytes != null || o?.asset != null; + }); + + @override + MeshIconTheme copyWith({Map? overrides}) => + MeshIconTheme(overrides ?? this.overrides); + + @override + MeshIconTheme lerp(MeshIconTheme? other, double t) => + t < 0.5 ? this : (other ?? this); +} + +/// Shows the active theme's icon or picture for [slot], or the default icon. +/// +/// Named icons take [color] / the ambient [IconTheme] like a normal [Icon]; +/// pictures are drawn in their own colors at the same size. +class ThemedIcon extends StatelessWidget { + final ThemeIconSlot slot; + final bool selected; + final double? size; + final Color? color; + + /// Explicit replacement, bypassing the theme (used for editor previews). + final ThemeIconOverride? forced; + final bool useForced; + + const ThemedIcon( + this.slot, { + super.key, + this.selected = false, + this.size, + this.color, + }) : forced = null, + useForced = false; + + const ThemedIcon.preview( + this.slot, + this.forced, { + super.key, + this.size, + this.color, + }) : selected = false, + useForced = true; + + @override + Widget build(BuildContext context) { + final effective = useForced ? forced : MeshIconTheme.of(context)[slot]; + final bytes = effective?.imageBytes; + final asset = effective?.asset; + if (bytes != null || asset != null) { + // Pictures are usually round badges with a rim, so at plain icon size + // their detail is too small to make out. Draw them well above it. + final side = + (size ?? IconTheme.of(context).size ?? 24) * kThemePictureIconScale; + return SizedBox.square( + dimension: side, + child: Image( + image: bytes != null + ? themePictureProvider(bytes) + : JxlImageProvider.asset(asset!), + fit: BoxFit.contain, + gaplessPlayback: true, + filterQuality: FilterQuality.medium, + errorBuilder: (_, _, _) => Icon(slot.icon, size: side, color: color), + ), + ); + } + final named = effective?.icon == null + ? null + : kThemeIconCatalog[effective!.icon]; + return Icon( + named ?? (selected ? slot.selectedIcon : slot.icon), + size: size, + color: color, + ); + } +} + +/// How much larger than a plain icon a picture icon is drawn. +const double kThemePictureIconScale = 1.6; + +/// Largest side, in pixels, of a picture stored in a theme. Small enough to +/// keep themes and share codes light, big enough for high-DPI icons. +const int kThemeIconImageMaxSide = 128; + +/// Decodes any common image format and re-encodes it as lossless JPEG XL +/// (which keeps transparency) no larger than [kThemeIconImageMaxSide] on its +/// longest side. Returns null when [bytes] is not a readable image. +Future shrinkThemeIconImage(Uint8List bytes) async { + try { + final buffer = await ui.ImmutableBuffer.fromUint8List(bytes); + final codec = await ui.instantiateImageCodecWithSize( + buffer, + getTargetSize: (width, height) { + final longest = width > height ? width : height; + if (longest <= kThemeIconImageMaxSide) { + return ui.TargetImageSize(width: width, height: height); + } + final scale = kThemeIconImageMaxSide / longest; + return ui.TargetImageSize( + width: (width * scale).round().clamp(1, kThemeIconImageMaxSide), + height: (height * scale).round().clamp(1, kThemeIconImageMaxSide), + ); + }, + ); + final frame = await codec.getNextFrame(); + codec.dispose(); + try { + return await encodeJxlFromUiImage(frame.image); + } finally { + frame.image.dispose(); + } + } catch (_) { + return null; + } +} diff --git a/lib/utils/theme_file.dart b/lib/utils/theme_file.dart new file mode 100644 index 00000000..b4ecf8e9 --- /dev/null +++ b/lib/utils/theme_file.dart @@ -0,0 +1,120 @@ +import 'dart:convert'; +import 'dart:typed_data'; +import 'dart:ui' show Rect; + +import 'package:file_selector/file_selector.dart'; +import 'package:share_plus/share_plus.dart'; + +import '../models/custom_theme.dart'; +import 'platform_info.dart'; + +/// File extension for exported themes: JSON Lines, one theme per line, each +/// line the same JSON as a theme's share code. +const String kThemeFileExtension = 'jsonl'; + +const _typeGroup = XTypeGroup( + label: 'MeshCore themes', + extensions: [kThemeFileExtension, 'json', 'txt'], + mimeTypes: [ + 'application/jsonl', + 'application/x-ndjson', + 'application/json', + 'text/plain', + 'application/octet-stream', + ], + uniformTypeIdentifiers: ['public.json', 'public.plain-text', 'public.data'], +); + +/// One theme per line, newline-terminated. +String encodeThemesJsonl(Iterable themes) { + final buffer = StringBuffer(); + for (final theme in themes) { + buffer.writeln(theme.toShareCode()); + } + return buffer.toString(); +} + +/// Reads every valid theme in [text], giving each a fresh ID from [newId]. +/// +/// Accepts JSON Lines (blank and invalid lines are skipped), and for +/// convenience a single theme object spread over several lines, as a +/// hand-edited or pretty-printed file would be. +List decodeThemesJsonl( + String text, { + required String Function() newId, +}) { + final themes = []; + for (final line in const LineSplitter().convert(text)) { + if (line.trim().isEmpty) continue; + final theme = CustomTheme.fromShareCode(line, newId: newId()); + if (theme != null) themes.add(theme); + } + if (themes.isEmpty) { + final whole = CustomTheme.fromShareCode(text, newId: newId()); + if (whole != null) themes.add(whole); + } + return themes; +} + +/// A safe file name stem for [name] (letters, digits, dashes). +String themeFileStem(String name) { + final stem = name + .trim() + .toLowerCase() + .replaceAll(RegExp(r'[^a-z0-9]+'), '-') + .replaceAll(RegExp(r'^-+|-+$'), ''); + return stem.isEmpty ? 'theme' : stem; +} + +enum ThemeFileResult { saved, cancelled, failed } + +/// Saves [themes] as a `.jsonl` file: a save dialog on desktop, a download +/// on web, and the share sheet on phones (which have no save dialog). +Future exportThemesFile( + List themes, { + required String fileStem, + Rect? sharePositionOrigin, +}) async { + final fileName = '$fileStem.$kThemeFileExtension'; + final bytes = Uint8List.fromList(utf8.encode(encodeThemesJsonl(themes))); + final file = XFile.fromData( + bytes, + name: fileName, + mimeType: 'application/jsonl', + ); + try { + if (PlatformInfo.isWeb) { + await file.saveTo(fileName); + return ThemeFileResult.saved; + } + if (PlatformInfo.isDesktop) { + final location = await getSaveLocation( + suggestedName: fileName, + acceptedTypeGroups: const [_typeGroup], + ); + if (location == null) return ThemeFileResult.cancelled; + await file.saveTo(location.path); + return ThemeFileResult.saved; + } + final result = await SharePlus.instance.share( + ShareParams( + files: [file], + fileNameOverrides: [fileName], + sharePositionOrigin: sharePositionOrigin, + ), + ); + return result.status == ShareResultStatus.dismissed + ? ThemeFileResult.cancelled + : ThemeFileResult.saved; + } catch (_) { + return ThemeFileResult.failed; + } +} + +/// Lets the user pick a theme file and returns its text, or null when they +/// cancel. Throws when the file cannot be read. +Future pickThemesFile() async { + final file = await openFile(acceptedTypeGroups: const [_typeGroup]); + if (file == null) return null; + return utf8.decode(await file.readAsBytes(), allowMalformed: true); +} diff --git a/lib/widgets/chat_background.dart b/lib/widgets/chat_background.dart new file mode 100644 index 00000000..fe56a12e --- /dev/null +++ b/lib/widgets/chat_background.dart @@ -0,0 +1,346 @@ +import 'package:flutter/material.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:koni_jxl_flutter/koni_jxl_flutter.dart'; +import 'package:provider/provider.dart'; + +import '../helpers/snack_bar_builder.dart'; +import '../l10n/l10n.dart'; +import '../models/chat_background.dart'; +import '../services/chat_background_service.dart'; +import '../theme/mesh_theme.dart'; + +/// Colors offered for chat backgrounds. Shown faded toward the theme's +/// background, so they work in light and dark themes alike. +const List kChatBackgroundColors = [ + Color(0xFF0F766E), + Color(0xFF1E3A8A), + Color(0xFF6B21A8), + Color(0xFF9F1239), + Color(0xFF166534), + Color(0xFF78350F), + Color(0xFF334155), + Color(0xFF000000), + Color(0xFFFFFFFF), + Color(0xFFE7D8B8), + Color(0xFFBAE6FD), + Color(0xFFFBCFE8), +]; + +/// Fade new color backgrounds start with: softer than pictures, which need +/// to stay recognizable. +const double kChatBackgroundColorFade = 0.6; + +ChatBackgroundService? _maybeService( + BuildContext context, { + bool listen = true, +}) { + try { + return Provider.of(context, listen: listen); + } on ProviderNotFoundException { + return null; + } +} + +/// Draws [chatKey]'s background (its own, or the theme's) behind [child]. +class ChatBackdrop extends StatelessWidget { + final String chatKey; + final Widget child; + + const ChatBackdrop({super.key, required this.chatKey, required this.child}); + + @override + Widget build(BuildContext context) { + final background = _maybeService(context)?.resolve(chatKey); + if (background == null) return child; + return Stack( + fit: StackFit.expand, + children: [ + Positioned.fill(child: ChatBackgroundLayer(background: background)), + child, + ], + ); + } +} + +/// Paints one [ChatBackground], faded toward the theme's surface color. +class ChatBackgroundLayer extends StatelessWidget { + final ChatBackground background; + + const ChatBackgroundLayer({super.key, required this.background}); + + @override + Widget build(BuildContext context) { + final surface = Theme.of(context).colorScheme.surface; + final color = background.color; + if (color != null) { + return ColoredBox(color: Color.lerp(color, surface, background.fade)!); + } + final id = background.imageId; + final asset = background.asset; + final bytes = + background.inlineImage ?? + (id == null ? null : _maybeService(context)?.imageBytes(id)); + if (bytes == null && asset == null) return ColoredBox(color: surface); + return ExcludeSemantics( + child: Stack( + fit: StackFit.expand, + children: [ + Image( + // The service caches one Uint8List per picture, and the provider + // keys on that instance, so rebuilds reuse the decoded image. + image: bytes != null + ? JxlImageProvider.memory(bytes) + : JxlImageProvider.asset(asset!), + fit: BoxFit.cover, + gaplessPlayback: true, + errorBuilder: (_, _, _) => ColoredBox(color: surface), + ), + ColoredBox(color: surface.withValues(alpha: background.fade)), + ], + ), + ); + } +} + +/// Choose none, a color or a picture, and how faded it is. +class ChatBackgroundPicker extends StatefulWidget { + final ChatBackground? value; + final ValueChanged onChanged; + + const ChatBackgroundPicker({ + super.key, + required this.value, + required this.onChanged, + }); + + @override + State createState() => _ChatBackgroundPickerState(); +} + +class _ChatBackgroundPickerState extends State { + bool _busy = false; + + Future _pickPicture() async { + final service = _maybeService(context, listen: false); + if (service == null) return; + setState(() => _busy = true); + try { + final file = await ImagePicker().pickImage( + source: ImageSource.gallery, + maxWidth: 2000, + maxHeight: 2000, + imageQuality: 92, + ); + if (file == null) return; + final id = await service.addImage(await file.readAsBytes()); + if (!mounted) return; + if (id == null) { + _showError(); + return; + } + widget.onChanged(ChatBackground.image(id)); + } catch (_) { + if (mounted) _showError(); + } finally { + if (mounted) setState(() => _busy = false); + } + } + + void _showError() { + showDismissibleSnackBar( + context, + content: Text(context.l10n.chatBackground_pictureFailed), + ); + } + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; + final value = widget.value; + return Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Wrap( + spacing: 10, + runSpacing: 10, + children: [ + _Choice( + selected: value == null, + label: l10n.chatBackground_none, + onTap: () => widget.onChanged(null), + child: Icon(Icons.block, color: scheme.onSurfaceVariant), + ), + for (final color in kChatBackgroundColors) + _Choice( + selected: value?.color == color, + label: colorLabel(color), + onTap: () => widget.onChanged( + ChatBackground.color( + color, + fade: value?.color != null + ? value!.fade + : kChatBackgroundColorFade, + ), + ), + child: ChatBackgroundLayer( + background: ChatBackground.color( + color, + fade: kChatBackgroundColorFade, + ), + ), + ), + if (value?.isImage ?? false) + _Choice( + selected: true, + label: l10n.chatBackground_picture, + onTap: _pickPicture, + child: ChatBackgroundLayer(background: value!), + ), + ], + ), + const SizedBox(height: 14), + OutlinedButton.icon( + onPressed: _busy ? null : _pickPicture, + icon: _busy + ? const SizedBox.square( + dimension: 18, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : const Icon(Icons.image_outlined), + label: Text(l10n.chatBackground_choosePicture), + ), + if (value != null) ...[ + const SizedBox(height: 14), + Text( + l10n.chatBackground_fade, + style: Theme.of(context).textTheme.bodyLarge, + ), + Slider( + value: value.fade, + min: ChatBackground.minFade, + max: ChatBackground.maxFade, + divisions: 8, + label: '${(value.fade * 100).round()}%', + onChanged: (fade) => widget.onChanged(value.withFade(fade)), + ), + ], + ], + ); + } + + static String colorLabel(Color color) { + final rgb = color.toARGB32() & 0xFFFFFF; + return '#${rgb.toRadixString(16).padLeft(6, '0').toUpperCase()}'; + } +} + +class _Choice extends StatelessWidget { + final bool selected; + final String label; + final VoidCallback onTap; + final Widget child; + + const _Choice({ + required this.selected, + required this.label, + required this.onTap, + required this.child, + }); + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + return Semantics( + button: true, + selected: selected, + label: label, + child: InkWell( + onTap: onTap, + borderRadius: BorderRadius.circular(MeshRadii.sm), + child: Container( + width: 52, + height: 52, + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + color: scheme.surface, + borderRadius: BorderRadius.circular(MeshRadii.sm), + border: Border.all( + color: selected ? scheme.primary : scheme.outline, + width: selected ? 3 : 1, + ), + ), + child: Stack( + fit: StackFit.expand, + children: [ + child, + if (selected) + Center(child: Icon(Icons.check_circle, color: scheme.primary)), + ], + ), + ), + ), + ); + } +} + +/// Bottom sheet for one chat's own background. Changes apply live, so the +/// chat behind the sheet shows the result. +Future showChatBackgroundSheet(BuildContext context, String chatKey) { + return showModalBottomSheet( + context: context, + isScrollControlled: true, + showDragHandle: true, + builder: (sheetContext) => Consumer( + builder: (sheetContext, service, _) { + final l10n = sheetContext.l10n; + final overriding = service.overridingTheme; + return SafeArea( + child: SingleChildScrollView( + padding: const EdgeInsets.fromLTRB(16, 0, 16, 24), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Text( + l10n.chatBackground_title, + style: Theme.of(sheetContext).textTheme.titleLarge, + ), + const SizedBox(height: 4), + Text( + l10n.chatBackground_thisChatOnly, + style: Theme.of(sheetContext).textTheme.bodyMedium?.copyWith( + color: Theme.of(sheetContext).colorScheme.onSurfaceVariant, + ), + ), + if (overriding != null) ...[ + const SizedBox(height: 12), + Row( + children: [ + Icon( + Icons.info_outline, + color: Theme.of(sheetContext).colorScheme.tertiary, + ), + const SizedBox(width: 8), + Expanded( + child: Text( + l10n.chatBackground_themeOverrides(overriding.name), + style: Theme.of(sheetContext).textTheme.bodyMedium, + ), + ), + ], + ), + ], + const SizedBox(height: 16), + ChatBackgroundPicker( + value: service.chatBackground(chatKey), + onChanged: (value) => + service.setChatBackground(chatKey, value), + ), + ], + ), + ), + ); + }, + ), + ); +} diff --git a/lib/widgets/chat_composer.dart b/lib/widgets/chat_composer.dart index 428381aa..f57062f2 100644 --- a/lib/widgets/chat_composer.dart +++ b/lib/widgets/chat_composer.dart @@ -11,6 +11,7 @@ import 'gif_message.dart'; import 'gif_picker.dart'; import 'mesh_ui.dart'; import 'message_translation_button.dart'; +import '../theme/theme_icons.dart'; /// One entry of the composer's "+" menu. @immutable @@ -186,7 +187,7 @@ class ChatComposer extends StatelessWidget { builder: (context, value, _) { final hasText = value.text.trim().isNotEmpty; return IconButton.filled( - icon: const Icon(Icons.send, size: 20), + icon: const ThemedIcon(ThemeIconSlot.send, size: 20), tooltip: sendTooltip, style: IconButton.styleFrom( backgroundColor: hasText diff --git a/lib/widgets/contact_visuals.dart b/lib/widgets/contact_visuals.dart index 64117921..cc9c4319 100644 --- a/lib/widgets/contact_visuals.dart +++ b/lib/widgets/contact_visuals.dart @@ -4,6 +4,7 @@ import '../connector/meshcore_protocol.dart'; import '../l10n/app_localizations.dart'; import '../models/contact.dart'; import '../theme/mesh_theme.dart'; +import '../theme/theme_icons.dart'; /// Shared node-type visuals and last-seen formatting for contact lists /// (contacts, discovery, nearby-node scan). @@ -25,16 +26,16 @@ Color contactTypeColor(int type) { } } -/// Node-type avatar icon. Returns null for chat nodes so [AvatarCircle] -/// shows initials. -IconData? contactTypeIcon(int type) { +/// Node-type avatar icon slot (themes can replace these). Returns null for +/// chat nodes so [AvatarCircle] shows initials. +ThemeIconSlot? contactTypeIconSlot(int type) { switch (type) { case advTypeRepeater: - return Icons.cell_tower; + return ThemeIconSlot.repeater; case advTypeRoom: - return Icons.meeting_room; + return ThemeIconSlot.room; case advTypeSensor: - return Icons.sensors; + return ThemeIconSlot.sensor; default: return null; } diff --git a/lib/widgets/holiday_animations.dart b/lib/widgets/holiday_animations.dart new file mode 100644 index 00000000..5a8c2254 --- /dev/null +++ b/lib/widgets/holiday_animations.dart @@ -0,0 +1,655 @@ +import 'dart:math' as math; + +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import '../helpers/holiday_triggers.dart'; +import '../services/app_settings_service.dart'; +import '../theme/mesh_theme.dart'; + +/// How long each holiday animation runs. +Duration holidayAnimationDuration(HolidayAnimation animation) => + switch (animation) { + HolidayAnimation.halloween => const Duration(milliseconds: 4200), + HolidayAnimation.thanksgiving => const Duration(milliseconds: 4800), + HolidayAnimation.christmas => const Duration(milliseconds: 5200), + HolidayAnimation.newYear => const Duration(milliseconds: 5600), + }; + +/// Plays [animation] over the whole screen, starting from [origin] (global +/// coordinates of the message it came from). Touches pass through, and the +/// overlay removes itself when done. +/// +/// Skipped when the user turned holiday animations off or the platform asks +/// for reduced motion. +void playHolidayAnimation( + BuildContext context, + HolidayAnimation animation, { + required Offset origin, +}) { + final settings = context.read().settings; + if (!settings.holidayAnimationsEnabled) return; + if (MediaQuery.maybeDisableAnimationsOf(context) ?? false) return; + final overlay = Overlay.maybeOf(context, rootOverlay: true); + if (overlay == null) return; + late final OverlayEntry entry; + entry = OverlayEntry( + builder: (_) => HolidayAnimationView( + animation: animation, + origin: origin, + onDone: () => entry.remove(), + ), + ); + overlay.insert(entry); +} + +/// Watches a chat's newest message and plays its holiday animation when a +/// new triggering message arrives. Messages already there when the chat +/// opens never play, and each message plays at most once. +class HolidayTriggerWatcher { + String? _newestId; + bool _primed = false; + + /// Messages older than this when first seen (e.g. synced backlog) stay + /// quiet. + static const freshness = Duration(minutes: 2); + + /// Call on every build with the chat's newest message. [originOf] gives + /// the global point the animation starts from, once the frame is laid + /// out. + void onNewest( + BuildContext context, { + required String? id, + required Iterable texts, + required DateTime? receivedAt, + required Offset? Function() originOf, + }) { + if (!_primed) { + _primed = true; + _newestId = id; + return; + } + if (id == null || id == _newestId) return; + _newestId = id; + if (receivedAt == null || + DateTime.now().difference(receivedAt).abs() > freshness) { + return; + } + HolidayAnimation? animation; + for (final text in texts) { + if (text == null) continue; + animation = holidayAnimationFor(text); + if (animation != null) break; + } + if (animation == null) return; + final found = animation; + WidgetsBinding.instance.addPostFrameCallback((_) { + if (!context.mounted) return; + final origin = originOf(); + if (origin == null) return; + playHolidayAnimation(context, found, origin: origin); + }); + // Normally called mid-build, but make sure a frame follows either way. + WidgetsBinding.instance.ensureVisualUpdate(); + } +} + +/// The global point a chat's newest message sits at: the bottom of the +/// message list, on the sender's side. +Offset? newestMessageOrigin(GlobalKey listKey, {required bool isOutgoing}) { + final box = listKey.currentContext?.findRenderObject() as RenderBox?; + if (box == null || !box.hasSize) return null; + final local = Offset( + isOutgoing ? box.size.width - 72 : 72, + box.size.height - 48, + ); + return box.localToGlobal(local); +} + +class HolidayAnimationView extends StatefulWidget { + final HolidayAnimation animation; + final Offset origin; + final VoidCallback onDone; + + const HolidayAnimationView({ + super.key, + required this.animation, + required this.origin, + required this.onDone, + }); + + @override + State createState() => _HolidayAnimationViewState(); +} + +class _HolidayAnimationViewState extends State + with SingleTickerProviderStateMixin { + late final AnimationController _controller = AnimationController( + vsync: this, + duration: holidayAnimationDuration(widget.animation), + ); + // Fixed seed per play keeps a run smooth; a new seed each play keeps it + // from looking canned. + late final int _seed = DateTime.now().microsecondsSinceEpoch; + + @override + void initState() { + super.initState(); + _controller.forward().whenComplete(widget.onDone); + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + // The overlay sits above the app's Material, so without one of its own + // every emoji Text gets Flutter's yellow "missing Material" underline. + return IgnorePointer( + child: ExcludeSemantics( + child: Material( + type: MaterialType.transparency, + child: LayoutBuilder( + builder: (context, constraints) { + final size = constraints.biggest; + // Played in the root overlay, which covers the whole screen + // from its top-left, so global coordinates are local ones. + // (Converting here would read parents not yet laid out.) + final origin = Offset( + widget.origin.dx.clamp(0, size.width).toDouble(), + widget.origin.dy.clamp(0, size.height).toDouble(), + ); + return AnimatedBuilder( + animation: _controller, + builder: (context, _) { + final t = _controller.value; + return switch (widget.animation) { + HolidayAnimation.halloween => _Bats( + t: t, + size: size, + origin: origin, + seed: _seed, + ), + HolidayAnimation.thanksgiving => _Turkey( + t: t, + size: size, + seed: _seed, + ), + HolidayAnimation.christmas => _Santa( + t: t, + size: size, + seed: _seed, + ), + HolidayAnimation.newYear => CustomPaint( + size: size, + painter: _FireworksPainter(t: t, seed: _seed), + ), + }; + }, + ); + }, + ), + ), + ), + ); + } +} + +/// An emoji glyph placed by its center. +Widget _sprite( + String emoji, { + required Offset at, + required double size, + double opacity = 1, + double rotation = 0, + bool flip = false, + double scaleY = 1, +}) { + return Positioned( + left: at.dx - size / 2, + top: at.dy - size / 2, + child: Opacity( + opacity: opacity.clamp(0, 1).toDouble(), + child: Transform( + alignment: Alignment.center, + transform: Matrix4.identity() + ..rotateZ(rotation) + ..scaleByDouble(flip ? -1.0 : 1.0, scaleY, 1, 1), + child: SizedBox.square( + dimension: size, + child: Center( + child: Text( + emoji, + style: MeshTheme.emoji(fontSize: size * 0.8), + textDirection: TextDirection.ltr, + ), + ), + ), + ), + ), + ); +} + +/// Drops sprites that are invisible or entirely off-screen (e.g. the sleigh +/// before it flies in), and empty placeholders, so each frame only lays out +/// what can be seen. +List _onScreen(Size size, List children) { + const margin = 160.0; + bool hidden(Widget child) { + if (child is! Positioned) return child is SizedBox && child.width == 0; + final left = child.left, top = child.top; + if (left != null && + top != null && + (left > size.width + margin || + top > size.height + margin || + left < -margin * 2 || + top < -margin * 2)) { + return true; + } + final inner = child.child; + return inner is Opacity && inner.opacity <= 0; + } + + return [ + for (final child in children) + if (!hidden(child)) child, + ]; +} + +double _fadeOut(double t, {double from = 0.75}) => + t < from ? 1 : 1 - (t - from) / (1 - from); + +/// 0 → 1 → 0 over the run: in quickly, hold, out slowly. +double _envelope(double t, {double rise = 0.12, double fall = 0.3}) { + if (t < rise) return t / rise; + if (t > 1 - fall) return (1 - t) / fall; + return 1; +} + +/// Full-screen wash of [color], e.g. Halloween dusk or a firework flash. +Widget _wash(Color color, double opacity) => Positioned.fill( + child: ColoredBox(color: color.withValues(alpha: opacity.clamp(0, 1))), +); + +/// Halloween: the screen dims to a purple dusk and a swarm of bats bursts +/// out of the message, flapping off in every direction. +class _Bats extends StatelessWidget { + final double t; + final Size size; + final Offset origin; + final int seed; + + const _Bats({ + required this.t, + required this.size, + required this.origin, + required this.seed, + }); + + @override + Widget build(BuildContext context) { + final rand = math.Random(seed); + final reach = size.longestSide * 1.3; + final dusk = _envelope(t, rise: 0.1, fall: 0.35); + // Expand: the scene must fill the screen whatever its children are + // (a lone zero-size child would otherwise shrink it to nothing). + return Stack( + fit: StackFit.expand, + children: _onScreen(size, [ + _wash(const Color(0xFF14002A), 0.45 * dusk), + // A moon peeks in at the top corner. + _sprite( + '🌕', + at: Offset(size.width - 70, 90 - (1 - dusk) * 60), + size: 110, + opacity: 0.9 * dusk, + ), + for (var i = 0; i < 46; i++) + () { + // Mostly upward, but the swarm fans out wide. + final angle = + -math.pi / 2 + (rand.nextDouble() - 0.5) * math.pi * 1.6; + final speed = 0.5 + rand.nextDouble() * 0.8; + final delay = rand.nextDouble() * 0.35; + final wobble = 20 + rand.nextDouble() * 40; + final phase = rand.nextDouble() * math.pi * 2; + final batSize = 34 + rand.nextDouble() * 46; + final local = ((t - delay) / (1 - delay)).clamp(0.0, 1.0); + final eased = Curves.easeIn.transform(local); + final distance = eased * reach * speed; + final dir = Offset(math.cos(angle), math.sin(angle)); + final side = Offset(-dir.dy, dir.dx); + final at = + origin + + dir * distance + + side * math.sin(local * 14 + phase) * wobble; + return _sprite( + '🦇', + at: at, + size: batSize * (0.4 + 0.6 * math.min(1, local * 5)), + opacity: local == 0 ? 0 : _fadeOut(local, from: 0.75), + // Wing beat. + scaleY: 0.55 + 0.45 * math.sin(local * 46 + phase).abs(), + flip: dir.dx < 0, + ); + }(), + ]), + ); + } +} + +/// Thanksgiving: a stampede of turkeys hops across the screen in a storm of +/// autumn leaves. +class _Turkey extends StatelessWidget { + final double t; + final Size size; + final int seed; + + const _Turkey({required this.t, required this.size, required this.seed}); + + @override + Widget build(BuildContext context) { + final rand = math.Random(seed); + final warm = _envelope(t, rise: 0.1, fall: 0.3); + // (size, lane as a fraction of height, lag behind the leader, hop phase) + const flock = [ + (130.0, 0.70, 0.00, 0.0), + (86.0, 0.56, 0.10, 1.3), + (96.0, 0.84, 0.17, 2.1), + (70.0, 0.46, 0.26, 0.7), + ]; + final span = size.width + 320; + // Expand: the scene must fill the screen whatever its children are + // (a lone zero-size child would otherwise shrink it to nothing). + return Stack( + fit: StackFit.expand, + children: _onScreen(size, [ + _wash(const Color(0xFF5A2A00), 0.22 * warm), + for (var i = 0; i < 44; i++) + () { + final startX = rand.nextDouble() * size.width * 1.2; + final delay = rand.nextDouble() * 0.45; + final fall = 0.5 + rand.nextDouble() * 0.6; + final sway = 24 + rand.nextDouble() * 50; + final leaf = ['🍂', '🍁', '🍂', '🌾'][rand.nextInt(4)]; + final leafSize = 26 + rand.nextDouble() * 26; + final local = ((t - delay) / (1 - delay)).clamp(0.0, 1.0); + return _sprite( + leaf, + at: Offset( + startX + math.sin(local * 9 + i) * sway - local * 120, + -40 + local * size.height * fall * 1.5, + ), + size: leafSize, + rotation: local * 8 + i, + opacity: local == 0 ? 0 : _fadeOut(local), + ); + }(), + for (final (turkeySize, lane, lag, phase) in flock) + ...() { + final p = ((t - lag) / (1 - lag)).clamp(0.0, 1.0); + // Emoji turkeys face left, so they run right to left. + final x = size.width + 160 - p * span; + final ground = size.height * lane; + final stride = math.sin(p * math.pi * 16 + phase).abs(); + return [ + for (var d = 1; d <= 3; d++) + _sprite( + '💨', + at: Offset( + x + turkeySize * 0.55 + d * turkeySize * 0.3, + ground + turkeySize * 0.3, + ), + size: turkeySize * (0.42 - d * 0.08), + opacity: p == 0 ? 0 : (0.8 - d * 0.2) * stride, + ), + _sprite( + '🦃', + at: Offset(x, ground - stride * turkeySize * 0.32), + size: turkeySize, + rotation: math.sin(p * math.pi * 16 + phase) * 0.12, + ), + ]; + }(), + ]), + ); + } +} + +/// Christmas: a blizzard rolls in while Santa's sleigh and a team of +/// reindeer swoop across the sky, trailing sparkles and dropping presents. +class _Santa extends StatelessWidget { + final double t; + final Size size; + final int seed; + + const _Santa({required this.t, required this.size, required this.seed}); + + static const _spacing = 58.0; + static const _team = 4; + + Offset _sleighAt(double p) { + // Right to left (emoji reindeer face left), swooping low then up. + final x = size.width + 360 - p * (size.width + 760); + final y = + size.height * 0.34 - + math.sin(p * math.pi) * size.height * 0.2 + + math.sin(p * math.pi * 3) * 18; + return Offset(x, y); + } + + @override + Widget build(BuildContext context) { + final rand = math.Random(seed); + final p = Curves.easeInOut.transform(t); + final head = _sleighAt(p); + final sleighOffset = Offset((_team + 0.7) * _spacing, 12); + final night = _envelope(t, rise: 0.12, fall: 0.3); + // Expand: the scene must fill the screen whatever its children are + // (a lone zero-size child would otherwise shrink it to nothing). + return Stack( + fit: StackFit.expand, + children: _onScreen(size, [ + _wash(const Color(0xFF02142E), 0.4 * night), + for (var i = 0; i < 60; i++) + () { + final x = rand.nextDouble() * size.width * 1.3; + final delay = rand.nextDouble() * 0.5; + final local = ((t - delay) / (1 - delay)).clamp(0.0, 1.0); + return _sprite( + '❄️', + at: Offset( + x + math.sin(local * 7 + i) * 26 - local * 140, + -30 + local * size.height * 1.1, + ), + size: 14 + rand.nextDouble() * 22, + rotation: local * 4 + i, + opacity: local == 0 ? 0 : 0.95 * _fadeOut(local), + ); + }(), + // Sparkle trail where the sleigh just was. + for (var i = 1; i <= 26; i++) + () { + final back = (p - i * 0.018).clamp(0.0, 1.0); + final at = + _sleighAt(back) + + sleighOffset + + Offset(20, 8 + math.sin(i * 1.7) * 14 + i * 2.5); + return _sprite( + i.isEven ? '✨' : '⭐', + at: at, + size: 30 - i * 0.8, + opacity: (1 - i / 27) * _fadeOut(t, from: 0.85), + rotation: i * 0.6 + t * 6, + ); + }(), + // Presents tumbling out behind the sleigh. + for (var g = 0; g < 5; g++) + () { + final drop = 0.18 + g * 0.13; + final local = ((p - drop) / 0.35).clamp(0.0, 1.0); + if (local == 0) return const SizedBox.shrink(); + final from = _sleighAt(drop) + sleighOffset; + return _sprite( + '🎁', + at: from + Offset(local * 40, local * local * size.height * 0.7), + size: 40, + rotation: local * 5 * (g.isEven ? 1 : -1), + opacity: _fadeOut(local, from: 0.7), + ); + }(), + for (var i = 0; i < _team; i++) + _sprite( + '🦌', + at: head + Offset(i * _spacing, math.sin(t * 36 + i * 0.9) * 6), + size: 62, + ), + _sprite('🛷', at: head + sleighOffset, size: 80), + _sprite('🎅', at: head + sleighOffset + const Offset(4, -30), size: 60), + ]), + ); + } +} + +/// New Year: a barrage of rockets bursts into big double rings of colored +/// sparks that crackle, with the screen flashing on each burst. +class _FireworksPainter extends CustomPainter { + final double t; + final int seed; + + _FireworksPainter({required this.t, required this.seed}); + + static const _colors = [ + Color(0xFFFFD54F), + Color(0xFFFF5252), + Color(0xFF40C4FF), + Color(0xFF69F0AE), + Color(0xFFFF80AB), + Color(0xFFE040FB), + Color(0xFFFFFFFF), + ]; + + @override + void paint(Canvas canvas, Size size) { + final rand = math.Random(seed); + const bursts = 16; + const rise = 0.12; + const life = 0.36; + + // Night sky behind the show. + final sky = _envelope(t, rise: 0.08, fall: 0.25); + canvas.drawRect( + Offset.zero & size, + Paint()..color = const Color(0xFF000814).withValues(alpha: 0.5 * sky), + ); + + var flash = 0.0; + for (var b = 0; b < bursts; b++) { + final start = b * 0.038 + rand.nextDouble() * 0.04; + final target = Offset( + size.width * (0.08 + rand.nextDouble() * 0.84), + size.height * (0.08 + rand.nextDouble() * 0.5), + ); + final launch = Offset( + target.dx + (rand.nextDouble() - 0.5) * 120, + size.height + 10, + ); + final color = _colors[rand.nextInt(_colors.length)]; + final inner = _colors[rand.nextInt(_colors.length)]; + final radius = 110 + rand.nextDouble() * 110; + final sparks = 48 + rand.nextInt(24); + final angles = [ + for (var i = 0; i < sparks; i++) + i / sparks * math.pi * 2 + rand.nextDouble() * 0.15, + ]; + final glitter = [ + for (var i = 0; i < 24; i++) + (rand.nextDouble() * math.pi * 2, rand.nextDouble()), + ]; + final local = t - start; + if (local < 0) continue; + + if (local < rise) { + final p = Curves.easeOut.transform(local / rise); + final at = Offset.lerp(launch, target, p)!; + final tail = Offset.lerp(launch, target, math.max(0, p - 0.18))!; + canvas.drawLine( + tail, + at, + Paint() + ..shader = LinearGradient( + colors: [color.withValues(alpha: 0), color], + ).createShader(Rect.fromPoints(tail, at)) + ..strokeWidth = 4 + ..strokeCap = StrokeCap.round, + ); + canvas.drawCircle(at, 4, Paint()..color = Colors.white); + continue; + } + + final p = ((local - rise) / life).clamp(0.0, 1.0); + if (p >= 1) continue; + if (p < 0.12) flash = math.max(flash, 1 - p / 0.12); + final spread = Curves.easeOutCubic.transform(p) * radius; + final gravity = p * p * 90; + final alpha = 1 - p; + + if (p < 0.2) { + canvas.drawCircle( + target, + radius * 0.5 * (1 - p / 0.2), + Paint() + ..color = Colors.white.withValues(alpha: 0.7 * (1 - p / 0.2)) + ..maskFilter = const MaskFilter.blur(BlurStyle.normal, 26), + ); + } + // Outer ring with streaks, inner ring in a second color. + for (final (ringColor, scale, dot) in [ + (color, 1.0, 3.0), + (inner, 0.55, 2.4), + ]) { + final spark = Paint()..color = ringColor.withValues(alpha: alpha); + final glow = Paint() + ..color = ringColor.withValues(alpha: alpha * 0.45) + ..maskFilter = const MaskFilter.blur(BlurStyle.normal, 6); + final streak = Paint() + ..color = ringColor.withValues(alpha: alpha * 0.6) + ..strokeWidth = dot * 0.8 + ..strokeCap = StrokeCap.round; + for (final a in angles) { + final dir = Offset(math.cos(a), math.sin(a)); + final at = target + dir * spread * scale + Offset(0, gravity); + final behind = + target + dir * spread * scale * 0.82 + Offset(0, gravity * 0.8); + canvas.drawLine(behind, at, streak); + canvas.drawCircle(at, dot * 2.4 * (1 - p * 0.6), glow); + canvas.drawCircle(at, dot * (1 - p * 0.5), spark); + } + } + // Crackling glitter that twinkles as it falls. + if (p > 0.35) { + final twinkle = Paint()..color = Colors.white.withValues(alpha: alpha); + for (final (a, r) in glitter) { + if (math.sin((p * 60) + a * 10) < 0.2) continue; + final at = + target + + Offset(math.cos(a), math.sin(a)) * radius * (0.3 + r * 0.8) + + Offset(0, gravity * 1.3); + canvas.drawCircle(at, 1.8, twinkle); + } + } + } + if (flash > 0) { + canvas.drawRect( + Offset.zero & size, + Paint()..color = Colors.white.withValues(alpha: 0.18 * flash), + ); + } + } + + @override + bool shouldRepaint(_FireworksPainter old) => old.t != t || old.seed != seed; +} diff --git a/lib/widgets/mesh_ui.dart b/lib/widgets/mesh_ui.dart index 0d1aca45..9242278e 100644 --- a/lib/widgets/mesh_ui.dart +++ b/lib/widgets/mesh_ui.dart @@ -5,6 +5,7 @@ import 'package:flutter/services.dart'; import '../l10n/l10n.dart'; import '../theme/mesh_theme.dart'; +import '../theme/theme_icons.dart'; /// MeshCore shared design kit. /// @@ -283,12 +284,14 @@ class StatTile extends StatelessWidget { } /// Initials avatar with a deterministic per-name hue, or a fixed [color] -/// for node-type coloring. Optional [icon] replaces initials. +/// for node-type coloring. Optional [icon] or themeable [iconSlot] replaces +/// initials. class AvatarCircle extends StatelessWidget { final String name; final double size; final Color? color; final IconData? icon; + final ThemeIconSlot? iconSlot; const AvatarCircle({ super.key, @@ -296,6 +299,7 @@ class AvatarCircle extends StatelessWidget { this.size = 40, this.color, this.icon, + this.iconSlot, }); static const _hues = [ @@ -320,6 +324,29 @@ class AvatarCircle extends StatelessWidget { final accent = color ?? _colorFor(name); final initials = _initials(name); final background = _tintedCardBackground(context, accent, 0.14); + // A theme picture (e.g. a holiday marker) fills the whole circle, the + // same as on the map, rather than sitting small inside the tint. + final picture = iconSlot == null + ? null + : themePictureOf(MeshIconTheme.of(context)[iconSlot!]); + if (picture != null) { + return SizedBox.square( + dimension: size, + child: ClipOval( + child: Image( + image: picture, + fit: BoxFit.cover, + gaplessPlayback: true, + filterQuality: FilterQuality.medium, + errorBuilder: (_, _, _) => Icon( + iconSlot!.icon, + size: size * 0.5, + color: readableAccent(accent, background, minContrast: 3), + ), + ), + ), + ); + } return Container( width: size, height: size, @@ -329,7 +356,13 @@ class AvatarCircle extends StatelessWidget { border: Border.all(color: accent.withValues(alpha: 0.4)), ), alignment: Alignment.center, - child: icon != null + child: iconSlot != null + ? ThemedIcon( + iconSlot!, + size: size * 0.55, + color: readableAccent(accent, background, minContrast: 3), + ) + : icon != null ? Icon( icon, size: size * 0.5, diff --git a/lib/widgets/message_bubble_frame.dart b/lib/widgets/message_bubble_frame.dart index 3cd61556..0822ad96 100644 --- a/lib/widgets/message_bubble_frame.dart +++ b/lib/widgets/message_bubble_frame.dart @@ -17,28 +17,30 @@ class MessageBubbleColors { required this.meta, }); - /// Outgoing bubbles use [MeshPalette.me] / [MeshPalette.meBorder] / - /// [MeshPalette.meInk]; a failed send switches to the error container. + /// Outgoing bubbles use the theme's [MeshBubbleTheme]; a failed send + /// switches to the error container. factory MessageBubbleColors.of( - ColorScheme scheme, { + BuildContext context, { required bool isOutgoing, bool isFailed = false, }) { + final scheme = Theme.of(context).colorScheme; + final bubble = MeshBubbleTheme.of(context); final text = isFailed ? scheme.onErrorContainer : isOutgoing - ? MeshPalette.meInk + ? bubble.meInk : scheme.onSurface; return MessageBubbleColors( background: isFailed ? scheme.errorContainer : isOutgoing - ? MeshPalette.me + ? bubble.me : scheme.surfaceContainerLow, border: isFailed ? scheme.error : isOutgoing - ? MeshPalette.meBorder + ? bubble.meBorder : scheme.outlineVariant, text: text, meta: text.withValues(alpha: 0.65), @@ -109,7 +111,7 @@ class MessageBubbleFrame extends StatelessWidget { @override Widget build(BuildContext context) { final colors = MessageBubbleColors.of( - Theme.of(context).colorScheme, + context, isOutgoing: isOutgoing, isFailed: isFailed, ); diff --git a/lib/widgets/node_info_sheet.dart b/lib/widgets/node_info_sheet.dart index 3d10e0ec..7eef7a57 100644 --- a/lib/widgets/node_info_sheet.dart +++ b/lib/widgets/node_info_sheet.dart @@ -14,6 +14,7 @@ import '../theme/mesh_theme.dart'; import 'mesh_ui.dart'; import 'repeater_login_dialog.dart'; import 'room_login_dialog.dart'; +import '../theme/theme_icons.dart'; /// Map accent colour for a node type. Color mapNodeTypeColor(int type) { @@ -230,11 +231,17 @@ void showNodeInfoSheet( BottomSheetHeader( title: contact.name, subtitle: contact.typeLabel(l10n), - trailing: Icon( - mapNodeTypeIcon(contact.type), - color: mapNodeTypeColor(contact.type), - size: 20, - ), + trailing: mapMarkerSlotForNodeType(contact.type) == null + ? Icon( + mapNodeTypeIcon(contact.type), + color: mapNodeTypeColor(contact.type), + size: 20, + ) + : ThemedIcon( + mapMarkerSlotForNodeType(contact.type)!, + color: mapNodeTypeColor(contact.type), + size: 20, + ), ), Padding( padding: const EdgeInsets.fromLTRB(16, 0, 16, 16), diff --git a/lib/widgets/node_scan_sheet.dart b/lib/widgets/node_scan_sheet.dart index 272eaa24..bae462b4 100644 --- a/lib/widgets/node_scan_sheet.dart +++ b/lib/widgets/node_scan_sheet.dart @@ -193,7 +193,7 @@ class _NodeScanSheetState extends State { name: contact.name, size: 42, color: color, - icon: contactTypeIcon(response.nodeType), + iconSlot: contactTypeIconSlot(response.nodeType), ), const SizedBox(width: 12), Expanded( @@ -221,7 +221,7 @@ class _NodeScanSheetState extends State { child: StatusChip( label: contact.typeLabel(l10n).toUpperCase(), color: color, - icon: contactTypeIcon(response.nodeType), + icon: contactTypeIconSlot(response.nodeType)?.icon, ), ), ], diff --git a/lib/widgets/quick_switch_bar.dart b/lib/widgets/quick_switch_bar.dart index 917ceced..4185a5c5 100644 --- a/lib/widgets/quick_switch_bar.dart +++ b/lib/widgets/quick_switch_bar.dart @@ -3,6 +3,7 @@ import 'dart:ui'; import 'package:flutter/material.dart'; import '../l10n/l10n.dart'; import '../theme/mesh_theme.dart'; +import '../theme/theme_icons.dart'; class QuickSwitchBar extends StatelessWidget { final int selectedIndex; @@ -25,6 +26,10 @@ class QuickSwitchBar extends StatelessWidget { final theme = Theme.of(context); final colorScheme = theme.colorScheme; final labelStyle = theme.textTheme.labelMedium ?? const TextStyle(); + // Custom themes style the bar on map screens like everywhere else; only + // the stock theme uses the fixed high-contrast map palette. + final highContrast = + this.highContrast && !MeshMapTheme.of(context).followsTheme; final background = highContrast ? MapPalette.panelDark : Colors.transparent; // The selected icon sits on the primary indicator pill, so it uses // onPrimary. The label sits below on the bar background, so it must use a @@ -77,19 +82,28 @@ class QuickSwitchBar extends StatelessWidget { }), ), child: NavigationBar( - height: 60, + // Picture icons are drawn larger than plain ones; give them + // room above the labels. + height: + MeshIconTheme.of(context).hasPictureFor(const [ + ThemeIconSlot.contacts, + ThemeIconSlot.channels, + ThemeIconSlot.map, + ]) + ? 76 + : 60, selectedIndex: selectedIndex, onDestinationSelected: onDestinationSelected, destinations: [ NavigationDestination( icon: _buildIconWithBadge( context, - const Icon(Icons.people_outline), + const ThemedIcon(ThemeIconSlot.contacts), contactsUnreadCount, ), selectedIcon: _buildIconWithBadge( context, - const Icon(Icons.people), + const ThemedIcon(ThemeIconSlot.contacts, selected: true), contactsUnreadCount, ), label: context.l10n.nav_contacts, @@ -97,19 +111,22 @@ class QuickSwitchBar extends StatelessWidget { NavigationDestination( icon: _buildIconWithBadge( context, - const Icon(Icons.tag), + const ThemedIcon(ThemeIconSlot.channels), channelsUnreadCount, ), selectedIcon: _buildIconWithBadge( context, - const Icon(Icons.tag), + const ThemedIcon(ThemeIconSlot.channels, selected: true), channelsUnreadCount, ), label: context.l10n.nav_channels, ), NavigationDestination( - icon: const Icon(Icons.map_outlined), - selectedIcon: const Icon(Icons.map), + icon: const ThemedIcon(ThemeIconSlot.map), + selectedIcon: const ThemedIcon( + ThemeIconSlot.map, + selected: true, + ), label: context.l10n.nav_map, ), ], @@ -121,7 +138,7 @@ class QuickSwitchBar extends StatelessWidget { ); } - Widget _buildIconWithBadge(BuildContext context, Icon icon, int count) { + Widget _buildIconWithBadge(BuildContext context, Widget icon, int count) { if (count <= 0) return icon; final label = count > 99 ? '99+' : '$count'; return Badge(label: Text(label), child: icon); diff --git a/lib/widgets/radio_stats_entry.dart b/lib/widgets/radio_stats_entry.dart index aab7c4de..dc5bede0 100644 --- a/lib/widgets/radio_stats_entry.dart +++ b/lib/widgets/radio_stats_entry.dart @@ -7,7 +7,6 @@ import 'package:meshcore_open/l10n/l10n.dart'; import 'package:meshcore_open/screens/companion_radio_stats_screen.dart'; import 'package:provider/provider.dart'; -import '../theme/mesh_theme.dart'; import 'mesh_ui.dart'; void pushCompanionRadioStatsScreen(BuildContext context) { @@ -146,7 +145,7 @@ class AirActivityDotState extends State { final on = widget.active && _blink; final scheme = Theme.of(context).colorScheme; return PulseDot( - color: on ? MeshPalette.blue : scheme.outline, + color: on ? scheme.primary : scheme.outline, size: 11, animate: false, ); diff --git a/lib/widgets/snr_indicator.dart b/lib/widgets/snr_indicator.dart index 16cd36f5..e1bb70a6 100644 --- a/lib/widgets/snr_indicator.dart +++ b/lib/widgets/snr_indicator.dart @@ -11,6 +11,7 @@ import '../theme/mesh_theme.dart'; import 'mesh_ui.dart'; import 'node_info_sheet.dart'; import 'signal_ui.dart'; +import '../theme/theme_icons.dart'; Contact? _getRepeaterPrefixMatchNearLocation( List contacts, @@ -386,8 +387,8 @@ class _SNRIndicatorState extends State { BottomSheetHeader( title: prefixLabel, subtitle: l10n.snrIndicator_unknownRepeater, - trailing: Icon( - mapNodeTypeIcon(advTypeRepeater), + trailing: ThemedIcon( + ThemeIconSlot.mapRepeater, color: mapNodeTypeColor(advTypeRepeater), size: 20, ), diff --git a/pubspec.yaml b/pubspec.yaml index a4d83a73..6764320f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -60,6 +60,7 @@ dependencies: package_info_plus: ^10.2.2 mobile_scanner: ^7.4.2 # QR/barcode scanning image_picker: ^1.1.2 # Pick photos to send as compressed mesh images + koni_jxl_flutter: ^0.1.4 # Chat background pictures stored as JPEG XL qr_flutter: ^4.1.0 # QR code generation url_launcher: ^6.3.0 # Launch URLs in system browser flutter_linkify: ^6.0.0 # Auto-detect and linkify URLs in text @@ -124,6 +125,10 @@ flutter: - assets/images/ - assets/icons/ - assets/fonts/ + - assets/themes/halloween/ + - assets/themes/thanksgiving/ + - assets/themes/christmas/ + - assets/themes/new_year/ fonts: - family: Inter diff --git a/test/helpers/holiday_triggers_test.dart b/test/helpers/holiday_triggers_test.dart new file mode 100644 index 00000000..bae8752d --- /dev/null +++ b/test/helpers/holiday_triggers_test.dart @@ -0,0 +1,174 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:meshcore_open/helpers/holiday_triggers.dart'; +import 'package:meshcore_open/l10n/app_localizations.dart'; +import 'package:meshcore_open/services/app_settings_service.dart'; +import 'package:meshcore_open/storage/prefs_manager.dart'; +import 'package:meshcore_open/widgets/holiday_animations.dart'; +import 'package:provider/provider.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +void main() { + group('holidayAnimationFor', () { + test('every greeting in every language triggers its holiday', () { + for (final locale in AppLocalizations.supportedLocales) { + final l10n = lookupAppLocalizations(Locale(locale.languageCode)); + for (final animation in HolidayAnimation.values) { + final greetings = holidayGreetingsIn(l10n, animation); + expect(greetings.trim(), isNotEmpty, reason: '$locale $animation'); + for (final phrase in greetings.split('|')) { + expect( + holidayAnimationFor('$phrase!'), + animation, + reason: '${locale.languageCode}: "$phrase"', + ); + } + } + } + }); + + test('case, punctuation and surrounding words do not matter', () { + expect( + holidayAnimationFor('HAPPY HALLOWEEN!!! 🎃'), + HolidayAnimation.halloween, + ); + expect( + holidayAnimationFor('hey all, happy new year’s from the mesh'), + HolidayAnimation.newYear, + ); + expect(holidayAnimationFor('#HappyNewYear'), HolidayAnimation.newYear); + expect( + holidayAnimationFor('Merry Christmas, everyone'), + HolidayAnimation.christmas, + ); + expect( + holidayAnimationFor('happy thanksgiving y’all'), + HolidayAnimation.thanksgiving, + ); + expect(holidayAnimationFor('FELIZ NAVIDAD'), HolidayAnimation.christmas); + expect(holidayAnimationFor('С НОВЫМ ГОДОМ!'), HolidayAnimation.newYear); + expect(holidayAnimationFor('みんな、メリークリスマス!'), HolidayAnimation.christmas); + expect(holidayAnimationFor('祝大家新年快乐'), HolidayAnimation.newYear); + }); + + test('ordinary messages and near misses do not trigger', () { + for (final text in [ + '', + 'happy', + 'halloween party at 8?', + 'feliz natalia', // a name, not "feliz natal" + 'my christmas tree fell over', + 'new year plans?', + 'unhappy new yearly report', + 'thanksgiving dinner menu', + ]) { + expect(holidayAnimationFor(text), isNull, reason: text); + } + }); + }); + + group('HolidayTriggerWatcher', () { + late AppSettingsService settings; + + setUp(() async { + SharedPreferences.setMockInitialValues({}); + await PrefsManager.initialize(); + settings = AppSettingsService(); + }); + + Future host( + WidgetTester tester, { + bool reduceMotion = false, + }) async { + late BuildContext ctx; + await tester.pumpWidget( + ChangeNotifierProvider.value( + value: settings, + child: MediaQuery( + data: MediaQueryData(disableAnimations: reduceMotion), + child: MaterialApp( + home: Builder( + builder: (c) { + ctx = c; + return const SizedBox.expand(); + }, + ), + ), + ), + ), + ); + return ctx; + } + + void send( + HolidayTriggerWatcher w, + BuildContext ctx, + String id, + String text, { + Duration age = Duration.zero, + }) { + w.onNewest( + ctx, + id: id, + texts: [text], + receivedAt: DateTime.now().subtract(age), + originOf: () => const Offset(100, 400), + ); + } + + testWidgets('plays for new greetings only, once each', (tester) async { + final ctx = await host(tester); + final watcher = HolidayTriggerWatcher(); + + // A greeting already there when the chat opens stays quiet. + send(watcher, ctx, 'a', 'Happy Halloween'); + await tester.pump(); + expect(find.byType(HolidayAnimationView), findsNothing); + + send(watcher, ctx, 'b', 'Happy Halloween everyone'); + // It starts after the frame that showed the message, then builds. + await tester.pump(); + await tester.pump(); + expect(find.byType(HolidayAnimationView), findsOneWidget); + + // Rebuilds with the same newest message do not replay it. + send(watcher, ctx, 'b', 'Happy Halloween everyone'); + await tester.pumpAndSettle(); + expect(find.byType(HolidayAnimationView), findsNothing); + + // Old messages (e.g. a synced backlog) stay quiet. + send(watcher, ctx, 'c', 'Merry Christmas', age: const Duration(hours: 3)); + await tester.pump(); + expect(find.byType(HolidayAnimationView), findsNothing); + }); + + testWidgets('each animation runs and cleans up after itself', ( + tester, + ) async { + final ctx = await host(tester); + for (final animation in HolidayAnimation.values) { + playHolidayAnimation(ctx, animation, origin: const Offset(80, 500)); + await tester.pump(); + expect(find.byType(HolidayAnimationView), findsOneWidget); + await tester.pump(holidayAnimationDuration(animation) ~/ 2); + expect(tester.takeException(), isNull); + await tester.pumpAndSettle(); + expect(find.byType(HolidayAnimationView), findsNothing); + } + }); + + testWidgets('respects the setting and reduced motion', (tester) async { + await settings.setHolidayAnimationsEnabled(false); + var ctx = await host(tester); + playHolidayAnimation(ctx, HolidayAnimation.newYear, origin: Offset.zero); + await tester.pump(); + expect(find.byType(HolidayAnimationView), findsNothing); + + await settings.setHolidayAnimationsEnabled(true); + ctx = await host(tester, reduceMotion: true); + playHolidayAnimation(ctx, HolidayAnimation.newYear, origin: Offset.zero); + await tester.pump(); + expect(find.byType(HolidayAnimationView), findsNothing); + }); + }); +} diff --git a/test/models/custom_theme_test.dart b/test/models/custom_theme_test.dart new file mode 100644 index 00000000..efa6da5e --- /dev/null +++ b/test/models/custom_theme_test.dart @@ -0,0 +1,246 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:meshcore_open/l10n/app_localizations.dart'; +import 'package:meshcore_open/models/app_settings.dart'; +import 'package:meshcore_open/models/custom_theme.dart'; +import 'package:meshcore_open/screens/theme_editor_screen.dart'; +import 'package:meshcore_open/services/app_settings_service.dart'; +import 'package:meshcore_open/storage/prefs_manager.dart'; +import 'package:meshcore_open/theme/mesh_theme.dart'; +import 'package:provider/provider.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +void main() { + group('hex colors', () { + test('parse long, short and bare forms', () { + expect(parseHexColor('#0EA5E9'), const Color(0xFF0EA5E9)); + expect(parseHexColor('0ea5e9'), const Color(0xFF0EA5E9)); + expect(parseHexColor('#fff'), const Color(0xFFFFFFFF)); + expect(parseHexColor(' #000000 '), const Color(0xFF000000)); + }); + + test('reject invalid input', () { + expect(parseHexColor('#12'), isNull); + expect(parseHexColor('#GGGGGG'), isNull); + expect(parseHexColor(42), isNull); + expect(parseHexColor(null), isNull); + }); + + test('format as uppercase #RRGGBB', () { + expect(colorToHex(const Color(0xFF0ea5e9)), '#0EA5E9'); + expect(colorToHex(const Color(0x800000FF)), '#0000FF'); + }); + }); + + group('CustomTheme', () { + const theme = CustomTheme( + id: 'custom:1', + name: 'Forest', + background: Color(0xFF0E1A13), + accent: Color(0xFF4ADE80), + ); + + test('brightness comes from the background', () { + expect(theme.isDark, isTrue); + expect(theme.copyWith(background: Colors.white).isDark, isFalse); + }); + + test('JSON round-trips', () { + expect(CustomTheme.fromJson(theme.toJson()), theme); + }); + + test('share code round-trips under a new ID', () { + final imported = CustomTheme.fromShareCode( + theme.toShareCode(), + newId: 'custom:2', + ); + expect(imported, theme.copyWith(id: 'custom:2')); + }); + + test('hand-written share code is accepted', () { + final imported = CustomTheme.fromShareCode( + '{"name": "Mine", "background": "#fff", "accent": "1d4ed8"}', + newId: 'x', + ); + expect(imported?.name, 'Mine'); + expect(imported?.isDark, isFalse); + }); + + test('bad share codes are rejected', () { + for (final code in [ + '', + 'not json', + '[]', + '{"name": "", "background": "#000", "accent": "#fff"}', + '{"name": "X", "background": "nope", "accent": "#fff"}', + '{"name": "X", "background": "#000"}', + ]) { + expect( + CustomTheme.fromShareCode(code, newId: 'x'), + isNull, + reason: code, + ); + } + }); + + test('preset IDs are unique and resolvable', () { + final ids = CustomTheme.presets.map((p) => p.id).toSet(); + expect(ids.length, CustomTheme.presets.length); + for (final preset in [ + ...CustomTheme.presets, + ...CustomTheme.holidayPresets, + ]) { + expect(preset.isPreset, isTrue); + expect(CustomTheme.presetById(preset.id), preset); + } + }); + }); + + group('MeshTheme.fromCustom', () { + test('every preset yields readable text and buttons', () { + for (final preset in [ + ...CustomTheme.presets, + ...CustomTheme.holidayPresets, + ]) { + final data = MeshTheme.fromCustom(preset); + final scheme = data.colorScheme; + expect( + data.brightness, + preset.isDark ? Brightness.dark : Brightness.light, + ); + expect(scheme.surface, preset.background); + expect(scheme.primary, preset.accent); + expect( + _contrast(scheme.onSurface, scheme.surface), + greaterThan(7), + reason: preset.name, + ); + expect( + _contrast(scheme.onPrimary, scheme.primary), + greaterThan(3), + reason: preset.name, + ); + final bubble = data.extension()!; + expect( + _contrast(bubble.meInk, bubble.me), + greaterThan(4.5), + reason: preset.name, + ); + } + }); + + test('stock themes keep the standard bubble', () { + expect( + MeshTheme.dark().extension(), + MeshBubbleTheme.standard, + ); + }); + }); + + group('settings', () { + setUp(() async { + SharedPreferences.setMockInitialValues({}); + await PrefsManager.initialize(); + }); + + test('custom themes and the active ID persist', () { + const theme = CustomTheme( + id: 'custom:1', + name: 'Mine', + background: Color(0xFF000000), + accent: Color(0xFFFACC15), + ); + final settings = AppSettings( + customThemes: const [theme], + activeThemeId: theme.id, + ); + final restored = AppSettings.fromJson(settings.toJson()); + expect(restored.customThemes, [theme]); + expect(restored.activeThemeId, theme.id); + expect(AppSettings.fromJson(const {}).customThemes, isEmpty); + }); + + test('service saves, applies, resolves and deletes themes', () async { + final service = AppSettingsService(); + const theme = CustomTheme( + id: 'custom:1', + name: 'Mine', + background: Color(0xFF000000), + accent: Color(0xFFFACC15), + ); + await service.saveCustomTheme(theme, apply: true); + expect(service.activeCustomTheme, theme); + + await service.saveCustomTheme(theme.copyWith(name: 'Renamed')); + expect(service.settings.customThemes.single.name, 'Renamed'); + + await service.setActiveTheme(CustomTheme.presets.first.id); + expect(service.activeCustomTheme, CustomTheme.presets.first); + + await service.setThemeMode('light'); + expect(service.activeCustomTheme, isNull); + + await service.setActiveTheme(theme.id); + await service.deleteCustomTheme(theme.id); + expect(service.settings.customThemes, isEmpty); + expect(service.activeCustomTheme, isNull); + }); + }); + + testWidgets('editor saves and applies a new theme', (tester) async { + SharedPreferences.setMockInitialValues({}); + await PrefsManager.initialize(); + final service = AppSettingsService(); + await tester.pumpWidget( + ChangeNotifierProvider.value( + value: service, + child: const MaterialApp( + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + home: ThemeEditorScreen(), + ), + ), + ); + + final list = find.byType(Scrollable).first; + final save = find.text('Save and use'); + Future tapSave() async { + await tester.scrollUntilVisible(save, 200, scrollable: list); + await tester.ensureVisible(save); + await tester.pumpAndSettle(); + await tester.tap(save); + } + + // Saving without a name is refused. + await tapSave(); + await tester.pumpAndSettle(); + expect(find.text('Give your theme a name'), findsOneWidget); + expect(service.settings.customThemes, isEmpty); + + await tester.scrollUntilVisible( + find.byType(TextField).first, + -200, + scrollable: list, + ); + await tester.enterText(find.byType(TextField).first, 'Night Owl'); + final accentHex = find.widgetWithText(TextField, '#0EA5E9'); + await tester.scrollUntilVisible(accentHex, 200, scrollable: list); + await tester.enterText(accentHex, '#FACC15'); + await tester.pump(); + await tapSave(); + await tester.pumpAndSettle(); + + final saved = service.settings.customThemes.single; + expect(saved.name, 'Night Owl'); + expect(saved.accent, const Color(0xFFFACC15)); + expect(service.activeCustomTheme, saved); + }); +} + +double _contrast(Color a, Color b) { + final la = a.computeLuminance(); + final lb = b.computeLuminance(); + final hi = la > lb ? la : lb; + final lo = la > lb ? lb : la; + return (hi + 0.05) / (lo + 0.05); +} diff --git a/test/models/holiday_themes_test.dart b/test/models/holiday_themes_test.dart new file mode 100644 index 00000000..dfd9808a --- /dev/null +++ b/test/models/holiday_themes_test.dart @@ -0,0 +1,180 @@ +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:koni_jxl_flutter/koni_jxl_flutter.dart'; +import 'package:meshcore_open/connector/meshcore_protocol.dart'; +import 'package:meshcore_open/models/chat_background.dart'; +import 'package:meshcore_open/models/custom_theme.dart'; +import 'package:meshcore_open/theme/mesh_theme.dart'; +import 'package:meshcore_open/theme/theme_icons.dart'; +import 'package:meshcore_open/widgets/mesh_ui.dart'; + +/// Every bundled picture a holiday theme points at. +List _assetsOf(CustomTheme theme) => [ + for (final icon in theme.icons.values) ?icon.asset, + ?theme.chatBackground?.asset, +]; + +void main() { + test('map marker slots cover every node type', () { + expect(mapMarkerSlotForNodeType(advTypeChat), ThemeIconSlot.mapChat); + expect( + mapMarkerSlotForNodeType(advTypeRepeater), + ThemeIconSlot.mapRepeater, + ); + expect(mapMarkerSlotForNodeType(advTypeRoom), ThemeIconSlot.mapRoom); + expect(mapMarkerSlotForNodeType(advTypeSensor), ThemeIconSlot.mapSensor); + expect(mapMarkerSlotForNodeType(99), isNull); + expect(ThemeIconSlot.values.where((s) => s.isMapMarker).map((s) => s.key), [ + 'map_chat', + 'map_repeater', + 'map_room', + 'map_sensor', + 'map_self', + ]); + }); + + test('list avatars and map markers share a node type icon', () { + const marker = ThemeIconOverride.icon('castle'); + const theme = MeshIconTheme({'map_repeater': marker}); + expect(theme[ThemeIconSlot.repeater], marker); + expect(theme[ThemeIconSlot.mapRepeater], marker); + expect(theme[ThemeIconSlot.room], isNull); + + // A slot's own setting wins over its partner's. + const own = ThemeIconOverride.icon('home'); + const both = MeshIconTheme({'map_room': marker, 'room': own}); + expect(both[ThemeIconSlot.room], own); + expect(both[ThemeIconSlot.mapRoom], marker); + + for (final slot in ThemeIconSlot.values) { + expect(slot.partner?.partner ?? slot, slot, reason: slot.key); + } + }); + + testWidgets('holiday list avatars show the map marker picture', ( + tester, + ) async { + final theme = CustomTheme.holidayPresets.first; + await tester.pumpWidget( + MaterialApp( + theme: MeshTheme.fromCustom(theme), + home: const Column( + children: [ + AvatarCircle(name: 'Tower', iconSlot: ThemeIconSlot.repeater), + AvatarCircle(name: 'Zed'), + ], + ), + ), + ); + final image = tester.widget(find.byType(Image)); + expect( + image.image, + JxlImageProvider.asset(theme.icons['map_repeater']!.asset!), + ); + // Chat contacts keep their initials. + expect(find.text('ZE'), findsOneWidget); + }); + + test('pictures and named icons resolve to the right provider', () { + expect(themePictureOf(null), isNull); + expect(themePictureOf(const ThemeIconOverride.icon('park')), isNull); + expect( + themePictureOf( + const ThemeIconOverride.asset('assets/themes/halloween/map_chat.jxl'), + ), + isA(), + ); + }); + + test('holiday themes have unique IDs that resolve', () { + final all = [...CustomTheme.presets, ...CustomTheme.holidayPresets]; + expect(all.map((t) => t.id).toSet(), hasLength(all.length)); + for (final theme in CustomTheme.holidayPresets) { + expect(CustomTheme.presetById(theme.id), theme); + expect(theme.isPreset, isTrue); + expect(theme.chatBackground?.asset, isNotNull); + expect(theme.icons.keys, containsAll(['contacts', 'channels', 'map'])); + expect( + theme.icons.keys, + containsAll([ + for (final slot in ThemeIconSlot.values) + if (slot.isMapMarker) slot.key, + ]), + reason: '${theme.name} has every map marker', + ); + } + }); + + test('every holiday picture is a bundled, declared JPEG XL file', () { + final pubspec = File('pubspec.yaml').readAsStringSync(); + for (final theme in CustomTheme.holidayPresets) { + for (final path in _assetsOf(theme)) { + expect(isThemeAssetPath(path), isTrue, reason: path); + final file = File(path); + expect(file.existsSync(), isTrue, reason: path); + expect(looksLikeJxl(file.readAsBytesSync()), isTrue, reason: path); + final dir = path.substring(0, path.lastIndexOf('/') + 1); + expect(pubspec, contains('- $dir'), reason: 'pubspec lists $dir'); + } + } + }); + + testWidgets('holiday pictures decode, icons keep transparency', ( + tester, + ) async { + await tester.runAsync(() async { + for (final theme in CustomTheme.holidayPresets) { + final background = await decodeJxlToUiImage( + File(theme.chatBackground!.asset!).readAsBytesSync(), + ); + expect(background.height, greaterThan(background.width)); + background.dispose(); + + final icon = await decodeJxlToUiImage( + File(theme.icons['contacts']!.asset!).readAsBytesSync(), + ); + final pixels = (await icon.toByteData())!; + // Top-left corner lies outside the round badge. + expect(pixels.getUint8(3), 0, reason: theme.name); + icon.dispose(); + } + }); + }); + + test('asset references survive JSON and share codes', () { + final theme = CustomTheme.holidayPresets.first; + expect(CustomTheme.fromJson(theme.toJson()), theme); + final copy = CustomTheme.fromShareCode(theme.toShareCode(), newId: 'x')!; + expect(copy.chatBackground, theme.chatBackground); + expect(copy.icons, theme.icons); + }); + + test('shared codes cannot point outside the theme assets', () { + for (final bad in [ + 'assets/images/logo.png', + 'assets/themes/../fonts/Inter.ttf', + 'assets/themes/halloween/background.png', + '/etc/passwd', + ]) { + expect(isThemeAssetPath(bad), isFalse, reason: bad); + expect(ThemeIconOverride.fromJson({'asset': bad}), isNull); + expect(ChatBackground.fromJson({'asset': bad}), isNull); + } + }); + + testWidgets('a holiday theme shows its icon in place of the default', ( + tester, + ) async { + final theme = CustomTheme.holidayPresets.first; + await tester.pumpWidget( + MaterialApp( + theme: MeshTheme.fromCustom(theme), + home: const ThemedIcon(ThemeIconSlot.map), + ), + ); + expect(find.byType(Image), findsOneWidget); + expect(find.byIcon(Icons.map_outlined), findsNothing); + }); +} diff --git a/test/models/theme_icons_and_files_test.dart b/test/models/theme_icons_and_files_test.dart new file mode 100644 index 00000000..f3e72e28 --- /dev/null +++ b/test/models/theme_icons_and_files_test.dart @@ -0,0 +1,161 @@ +import 'dart:typed_data'; +import 'dart:ui' as ui; + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:koni_jxl_flutter/koni_jxl_flutter.dart'; +import 'package:meshcore_open/models/custom_theme.dart'; +import 'package:meshcore_open/services/app_settings_service.dart'; +import 'package:meshcore_open/storage/prefs_manager.dart'; +import 'package:meshcore_open/theme/mesh_theme.dart'; +import 'package:meshcore_open/theme/theme_icons.dart'; +import 'package:meshcore_open/utils/theme_file.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +void main() { + final png = Uint8List.fromList([137, 80, 78, 71, 1, 2, 3]); + final theme = CustomTheme( + id: 'custom:1', + name: 'Iconic', + background: const Color(0xFF000000), + accent: const Color(0xFFFACC15), + icons: { + 'map': const ThemeIconOverride.icon('park'), + 'send': ThemeIconOverride.image(png), + }, + ); + + group('theme icons', () { + test('icons survive JSON and share codes', () { + expect(CustomTheme.fromJson(theme.toJson()), theme); + final imported = CustomTheme.fromShareCode( + theme.toShareCode(), + newId: 'x', + )!; + expect(imported.icons['send']!.imageBytes, png); + expect(imported.icons['map']!.icon, 'park'); + }); + + test('unknown slots, unknown icons and bad pictures are dropped', () { + final icons = parseThemeIcons({ + 'map': {'icon': 'not_an_icon'}, + 'nope': {'icon': 'park'}, + 'send': {'image': '%%%'}, + 'contacts': {'icon': 'rocket_launch'}, + }); + expect(icons.keys, ['contacts']); + }); + + test('slot keys are unique and catalog names resolve', () { + final keys = ThemeIconSlot.values.map((s) => s.key).toSet(); + expect(keys.length, ThemeIconSlot.values.length); + }); + + test('custom theme carries its icons into ThemeData', () { + final data = MeshTheme.fromCustom(theme); + expect(data.extension()![ThemeIconSlot.map]!.icon, 'park'); + expect(MeshTheme.dark().extension()!.overrides, isEmpty); + }); + + testWidgets('ThemedIcon shows the override or the default', (tester) async { + Widget host(ThemeData data) => MaterialApp( + theme: data, + home: const Row( + children: [ + ThemedIcon(ThemeIconSlot.map), + ThemedIcon(ThemeIconSlot.channels), + ], + ), + ); + await tester.pumpWidget(host(MeshTheme.fromCustom(theme))); + expect(find.byIcon(Icons.park), findsOneWidget); + expect(find.byIcon(Icons.tag), findsOneWidget); + + await tester.pumpWidget(host(MeshTheme.dark())); + await tester.pumpAndSettle(); // theme change animates + expect(find.byIcon(Icons.map_outlined), findsOneWidget); + }); + + testWidgets('pictures are shrunk to a lossless JPEG XL', (tester) async { + final big = await tester.runAsync(() async { + final recorder = ui.PictureRecorder(); + Canvas(recorder).drawRect( + const Rect.fromLTWH(0, 0, 400, 200), + Paint()..color = const Color(0xFFFF0000), + ); + final image = await recorder.endRecording().toImage(400, 200); + final data = await image.toByteData(format: ui.ImageByteFormat.png); + return data!.buffer.asUint8List(); + }); + final shrunk = await tester.runAsync(() => shrinkThemeIconImage(big!)); + expect(looksLikeJxl(shrunk!), isTrue); + final size = await tester.runAsync(() async { + final image = await decodeJxlToUiImage(shrunk); + return Size(image.width.toDouble(), image.height.toDouble()); + }); + expect(size, const Size(128, 64)); + expect( + await tester.runAsync( + () => shrinkThemeIconImage(Uint8List.fromList([1, 2, 3])), + ), + isNull, + ); + }); + }); + + group('jsonl files', () { + var n = 0; + String newId() => 'id${n++}'; + + test('one theme per line round-trips', () { + final second = CustomTheme.presets.first; + final text = encodeThemesJsonl([theme, second]); + expect(text.trim().split('\n'), hasLength(2)); + final decoded = decodeThemesJsonl(text, newId: newId); + expect(decoded, hasLength(2)); + expect(decoded[0], theme.copyWith(id: decoded[0].id)); + expect(decoded[1].name, second.name); + expect(decoded[0].id, isNot(decoded[1].id)); + }); + + test('bad and blank lines are skipped', () { + final text = + '\n{"name":"A","background":"#000","accent":"#fff"}\n' + 'garbage\n\r\n{"name":"B","background":"#fff","accent":"#000"}\r\n'; + expect(decodeThemesJsonl(text, newId: newId).map((t) => t.name), [ + 'A', + 'B', + ]); + }); + + test('a pretty-printed single theme is accepted', () { + const text = + '{\n "name": "Pretty",\n "background": "#000",\n' + ' "accent": "#fff"\n}\n'; + expect(decodeThemesJsonl(text, newId: newId).single.name, 'Pretty'); + }); + + test('file stems are safe', () { + expect(themeFileStem('My Cool Theme!'), 'my-cool-theme'); + expect(themeFileStem(' '), 'theme'); + }); + + test('import skips duplicates and assigns unique IDs', () async { + SharedPreferences.setMockInitialValues({}); + await PrefsManager.initialize(); + final service = AppSettingsService(); + final themes = decodeThemesJsonl( + encodeThemesJsonl([theme, CustomTheme.presets.first]), + newId: service.newCustomThemeId, + ); + expect(await service.importCustomThemes(themes), 2); + final again = decodeThemesJsonl( + encodeThemesJsonl([theme]), + newId: service.newCustomThemeId, + ); + expect(await service.importCustomThemes(again), 0); + final ids = service.settings.customThemes.map((t) => t.id).toSet(); + expect(ids, hasLength(2)); + }); + }); +} diff --git a/test/services/chat_background_service_test.dart b/test/services/chat_background_service_test.dart new file mode 100644 index 00000000..20f0e439 --- /dev/null +++ b/test/services/chat_background_service_test.dart @@ -0,0 +1,260 @@ +import 'dart:typed_data'; +import 'dart:ui' as ui; + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:koni_jxl_flutter/koni_jxl_flutter.dart'; +import 'package:meshcore_open/models/chat_background.dart'; +import 'package:meshcore_open/models/custom_theme.dart'; +import 'package:meshcore_open/services/app_settings_service.dart'; +import 'package:meshcore_open/services/chat_background_image_store.dart'; +import 'package:meshcore_open/services/chat_background_service.dart'; +import 'package:meshcore_open/storage/prefs_manager.dart'; +import 'package:meshcore_open/widgets/chat_background.dart'; +import 'package:provider/provider.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +const _green = Color(0xFF166534); +const _navy = Color(0xFF1E3A8A); + +CustomTheme _theme({ChatBackground? background, bool everywhere = false}) => + CustomTheme( + id: 'custom:bg', + name: 'Bg', + background: const Color(0xFF000000), + accent: const Color(0xFFFACC15), + chatBackground: background, + chatBackgroundEverywhere: everywhere, + ); + +Future _pngBytes(int width, int height) async { + final recorder = ui.PictureRecorder(); + ui.Canvas(recorder).drawRect( + ui.Rect.fromLTWH(0, 0, width.toDouble(), height.toDouble()), + ui.Paint()..color = const Color(0xFF3366CC), + ); + final image = await recorder.endRecording().toImage(width, height); + final data = await image.toByteData(format: ui.ImageByteFormat.png); + image.dispose(); + return data!.buffer.asUint8List(); +} + +void main() { + late AppSettingsService settings; + late InMemoryChatBackgroundImageStore images; + late ChatBackgroundService service; + + setUp(() async { + SharedPreferences.setMockInitialValues({}); + await PrefsManager.initialize(); + // A date with no holiday nearby, so no automatic holiday theme (and its + // chat background) gets in the way. + settings = AppSettingsService(clock: () => DateTime(2026, 7, 1)); + images = InMemoryChatBackgroundImageStore(); + service = ChatBackgroundService(settings, imageStore: images); + }); + + group('ChatBackground', () { + test('storage JSON round-trips and fade is clamped', () { + const color = ChatBackground.color(_green, fade: 0.5); + expect(ChatBackground.fromJson(color.toJson()), color); + const image = ChatBackground.image('abc', fade: 0.3); + expect(ChatBackground.fromJson(image.toJson()), image); + expect( + ChatBackground.fromJson({'color': '#000000', 'fade': 5})!.fade, + ChatBackground.maxFade, + ); + expect(ChatBackground.fromJson({'fade': 0.5}), isNull); + }); + + test('share JSON carries colors and attached pictures only', () { + expect(const ChatBackground.image('abc').toShareJson(), isNull); + final withBytes = const ChatBackground.image( + 'abc', + ).withInlineImage(Uint8List.fromList([1, 2, 3])); + final shared = ChatBackground.fromJson(withBytes.toShareJson())!; + expect(shared.inlineImage, [1, 2, 3]); + expect(shared.imageId, isNull); + }); + }); + + group('themes', () { + test('chat background persists with the theme', () { + final theme = _theme( + background: const ChatBackground.image('pic'), + everywhere: true, + ); + expect(CustomTheme.fromJson(theme.toJson()), theme); + }); + + test('share codes keep colors but never a local image ID', () { + final colored = _theme( + background: const ChatBackground.color(_navy), + everywhere: true, + ); + final shared = CustomTheme.fromShareCode( + colored.toShareCode(), + newId: 'x', + )!; + expect(shared.chatBackground, colored.chatBackground); + expect(shared.chatBackgroundEverywhere, isTrue); + + final pictured = _theme(background: const ChatBackground.image('pic')); + final noBytes = CustomTheme.fromShareCode( + pictured.toShareCode(), + newId: 'x', + )!; + expect(noBytes.chatBackground, isNull); + + // A hand-written code pointing at a local ID is ignored too. + final forged = CustomTheme.fromShareCode( + '{"name":"F","background":"#000","accent":"#fff",' + '"chatBackground":{"image":"pic"}}', + newId: 'x', + )!; + expect(forged.chatBackground, isNull); + }); + }); + + group('resolve', () { + const key = 'channel:abc'; + + test('chat background beats the theme by default', () async { + expect(service.resolve(key), isNull); + + await settings.saveCustomTheme( + _theme(background: const ChatBackground.color(_navy)), + apply: true, + ); + expect(service.resolve(key)?.color, _navy); + expect(service.overridingTheme, isNull); + + await service.setChatBackground(key, const ChatBackground.color(_green)); + expect(service.resolve(key)?.color, _green); + expect(service.resolve('channel:other')?.color, _navy); + }); + + test('"use in every chat" lets the theme win', () async { + await service.setChatBackground(key, const ChatBackground.color(_green)); + await settings.saveCustomTheme( + _theme(background: const ChatBackground.color(_navy), everywhere: true), + apply: true, + ); + expect(service.resolve(key)?.color, _navy); + expect(service.overridingTheme?.name, 'Bg'); + // The chat keeps its own choice for when the theme changes. + expect(service.chatBackground(key)?.color, _green); + + await settings.setActiveTheme(null); + expect(service.resolve(key)?.color, _green); + }); + + test('per-chat backgrounds survive a restart', () async { + await service.setChatBackground( + key, + const ChatBackground.color(_green, fade: 0.7), + ); + final reloaded = ChatBackgroundService(settings, imageStore: images); + expect(reloaded.chatBackground(key), service.chatBackground(key)); + await service.setChatBackground(key, null); + expect( + ChatBackgroundService(settings, imageStore: images).chatBackground(key), + isNull, + ); + }); + }); + + group('pictures', () { + testWidgets('are shrunk and stored as JPEG XL', (tester) async { + final id = await tester.runAsync(() async { + return service.addImage(await _pngBytes(1600, 800)); + }); + expect(id, isNotNull); + final stored = images.images[id]!; + expect(looksLikeJxl(stored), isTrue); + final size = await tester.runAsync(() async { + final image = await decodeJxlToUiImage(stored); + final s = Size(image.width.toDouble(), image.height.toDouble()); + image.dispose(); + return s; + }); + expect(size, const Size(1080, 540)); + + expect( + await tester.runAsync( + () => service.addImage(Uint8List.fromList([1, 2, 3])), + ), + isNull, + ); + }); + + testWidgets('travel with themes and come back as stored pictures', ( + tester, + ) async { + final id = (await tester.runAsync( + () async => service.addImage(await _pngBytes(40, 30)), + ))!; + final theme = _theme(background: ChatBackground.image(id, fade: 0.5)); + + final embedded = (await tester.runAsync( + () => service.embedThemeImages(theme), + ))!; + final code = embedded.toShareCode(); + final received = CustomTheme.fromShareCode(code, newId: 'new')!; + expect(received.chatBackground!.inlineImage, isNotNull); + + final stored = (await tester.runAsync( + () => service.storeThemeImages(received), + ))!; + final storedId = stored.chatBackground!.imageId!; + expect(images.images[storedId], isNotNull); + expect(stored.chatBackground!.inlineImage, isNull); + expect(stored.chatBackground!.fade, 0.5); + }); + + testWidgets('unused pictures are cleaned up', (tester) async { + await tester.runAsync(() async { + final kept = (await service.addImage(await _pngBytes(20, 20)))!; + final themed = (await service.addImage(await _pngBytes(21, 20)))!; + final orphan = (await service.addImage(await _pngBytes(22, 20)))!; + await service.setChatBackground( + 'contact:a', + ChatBackground.image(kept), + ); + await settings.saveCustomTheme( + _theme(background: ChatBackground.image(themed)), + ); + await service.collectGarbage(); + expect(images.images.keys, unorderedEquals([kept, themed])); + expect(images.images.containsKey(orphan), isFalse); + }); + }); + }); + + testWidgets('ChatBackdrop paints the resolved background', (tester) async { + await service.setChatBackground( + 'contact:a', + const ChatBackground.color(_green), + ); + Widget host(String key) => ChangeNotifierProvider.value( + value: service, + child: MaterialApp( + home: ChatBackdrop(chatKey: key, child: const Text('hi')), + ), + ); + await tester.pumpWidget(host('contact:a')); + expect(find.byType(ChatBackgroundLayer), findsOneWidget); + expect(find.text('hi'), findsOneWidget); + + await tester.pumpWidget(host('contact:b')); + expect(find.byType(ChatBackgroundLayer), findsNothing); + + // Works (and draws nothing) without the service, e.g. in older tests. + await tester.pumpWidget( + const MaterialApp( + home: ChatBackdrop(chatKey: 'x', child: Text('hi')), + ), + ); + expect(find.text('hi'), findsOneWidget); + }); +} diff --git a/test/services/holiday_auto_switch_test.dart b/test/services/holiday_auto_switch_test.dart new file mode 100644 index 00000000..392a7753 --- /dev/null +++ b/test/services/holiday_auto_switch_test.dart @@ -0,0 +1,278 @@ +import 'dart:convert'; + +import 'package:flutter_test/flutter_test.dart'; +import 'package:meshcore_open/models/app_settings.dart'; +import 'package:meshcore_open/models/custom_theme.dart'; +import 'package:meshcore_open/models/holiday_schedule.dart'; +import 'package:meshcore_open/services/app_settings_service.dart'; +import 'package:meshcore_open/storage/prefs_manager.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +const halloween = 'preset:halloween'; +const thanksgiving = 'preset:thanksgiving'; +const christmas = 'preset:christmas'; +const newYear = 'preset:new_year'; + +String? holidayOn(int year, int month, int day) => + activeHolidayFor(DateTime(year, month, day, 13, 30))?.themeId; + +void main() { + group('holiday dates', () { + test('Thanksgiving is the fourth Thursday of November', () { + expect(ThemeHoliday.thanksgiving.dateIn(2024), DateTime(2024, 11, 28)); + expect(ThemeHoliday.thanksgiving.dateIn(2025), DateTime(2025, 11, 27)); + expect(ThemeHoliday.thanksgiving.dateIn(2026), DateTime(2026, 11, 26)); + expect(ThemeHoliday.thanksgiving.dateIn(2029), DateTime(2029, 11, 22)); + expect(ThemeHoliday.thanksgiving.dateIn(2018), DateTime(2018, 11, 22)); + }); + + test('preset ids exist', () { + for (final holiday in ThemeHoliday.values) { + expect(CustomTheme.presetById(holiday.themeId), isNotNull); + } + }); + }); + + group('activeHolidayFor', () { + test('Halloween window', () { + expect(holidayOn(2026, 10, 13), isNull); + expect(holidayOn(2026, 10, 14), halloween); + expect(holidayOn(2026, 10, 31), halloween); + }); + + test('Thanksgiving 2026 (Nov 26) window', () { + expect(holidayOn(2026, 11, 1), isNull); + expect(holidayOn(2026, 11, 8), isNull); + expect(holidayOn(2026, 11, 9), thanksgiving); + expect(holidayOn(2026, 11, 26), thanksgiving); + }); + + test('Nov 1 is Thanksgiving when it falls within 17 days', () { + // Thanksgiving 2029 is Nov 22, 21 days after Nov 1: none. + expect(holidayOn(2029, 11, 1), isNull); + // Thanksgiving 2018 was Nov 22 too; Nov 5 is exactly 17 days out. + expect(holidayOn(2018, 11, 5), thanksgiving); + expect(holidayOn(2018, 11, 4), isNull); + }); + + test('Thanksgiving holds until its day, then Christmas waits its turn', () { + // Thanksgiving is at the latest Nov 28 and Christmas' window opens + // Dec 8, so those two never compete; the days between have no theme. + expect(holidayOn(2024, 11, 28), thanksgiving); + expect(holidayOn(2024, 11, 29), isNull); + expect(holidayOn(2024, 12, 7), isNull); + expect(holidayOn(2024, 12, 8), christmas); + }); + + test('Christmas and New Year windows', () { + expect(holidayOn(2026, 12, 7), isNull); + expect(holidayOn(2026, 12, 8), christmas); + // Dec 15 is within 17 days of New Year's too; Christmas is nearer. + expect(holidayOn(2026, 12, 15), christmas); + expect(holidayOn(2026, 12, 25), christmas); + expect(holidayOn(2026, 12, 26), newYear); + expect(holidayOn(2026, 12, 31), newYear); + expect(holidayOn(2027, 1, 1), newYear); + expect(holidayOn(2027, 1, 2), isNull); + }); + + test('year wrap gives the coming New Year occurrence', () { + final active = activeHolidayFor(DateTime(2026, 12, 26))!; + expect(active.date, DateTime(2027, 1, 1)); + expect(active.daysAway, 6); + expect(active.occurrenceKey, 'preset:new_year@2027-01-01'); + }); + + test('no holiday in spring or summer', () { + expect(holidayOn(2026, 3, 15), isNull); + expect(holidayOn(2026, 7, 4), isNull); + }); + }); + + group('settings JSON', () { + test('auto switch defaults to true', () { + expect(AppSettings().holidayAutoSwitch, isTrue); + expect(AppSettings.fromJson({}).holidayAutoSwitch, isTrue); + expect(AppSettings().holidayThemeDismissed, isNull); + }); + + test('round-trips', () { + final settings = AppSettings( + holidayAutoSwitch: false, + holidayThemeDismissed: 'preset:christmas@2026-12-25', + ); + final decoded = AppSettings.fromJson( + jsonDecode(jsonEncode(settings.toJson())) as Map, + ); + expect(decoded.holidayAutoSwitch, isFalse); + expect(decoded.holidayThemeDismissed, 'preset:christmas@2026-12-25'); + expect(settings.toJson()['holiday_auto_switch'], isFalse); + }); + + test('copyWith can clear the dismissal', () { + final settings = AppSettings(holidayThemeDismissed: 'x'); + expect(settings.copyWith().holidayThemeDismissed, 'x'); + expect( + settings.copyWith(holidayThemeDismissed: null).holidayThemeDismissed, + isNull, + ); + }); + }); + + group('AppSettingsService', () { + late DateTime now; + late AppSettingsService service; + + setUp(() async { + SharedPreferences.setMockInitialValues({}); + PrefsManager.reset(); + await PrefsManager.initialize(); + now = DateTime(2026, 7, 1, 12); + service = AppSettingsService(clock: () => now); + await service.loadSettings(); + }); + + tearDown(() => service.dispose()); + + test('holiday theme overrides without touching activeThemeId', () async { + await service.setActiveTheme('preset:forest'); + final ownId = service.settings.activeThemeId; + expect(service.activeCustomTheme?.id, ownId); + + now = DateTime(2026, 12, 10, 9); + expect(service.activeCustomTheme?.id, christmas); + expect(service.autoHolidayTheme?.id, christmas); + expect(service.settings.activeThemeId, ownId); + expect(service.chosenCustomTheme?.id, ownId); + + now = DateTime(2027, 1, 2, 9); + expect(service.activeCustomTheme?.id, ownId); + expect(service.autoHolidayTheme, isNull); + }); + + test('stock theme users get the holiday theme too', () { + now = DateTime(2026, 10, 31, 20); + expect(service.settings.activeThemeId, isNull); + expect(service.activeCustomTheme?.id, halloween); + }); + + test('manual pick dismisses only the current occurrence', () async { + now = DateTime(2026, 10, 20); + expect(service.activeCustomTheme?.id, halloween); + + await service.setActiveTheme(null); + expect(service.activeCustomTheme, isNull); + expect( + service.settings.holidayThemeDismissed, + 'preset:halloween@2026-10-31', + ); + + now = DateTime(2026, 10, 31, 23); + expect(service.activeCustomTheme, isNull); + + // Next holiday switches again. + now = DateTime(2026, 11, 20); + expect(service.activeCustomTheme?.id, thanksgiving); + + // Next year's Halloween too. + now = DateTime(2027, 10, 20); + expect(service.activeCustomTheme?.id, halloween); + }); + + test('picking a stock mode dismisses too', () async { + now = DateTime(2026, 12, 20); + expect(service.activeCustomTheme?.id, christmas); + await service.setThemeMode('dark'); + expect(service.activeCustomTheme, isNull); + expect(service.settings.themeMode, 'dark'); + + now = DateTime(2026, 12, 26); + expect(service.activeCustomTheme?.id, newYear); + }); + + test( + 'picking the auto-applied holiday preset is not a dismissal', + () async { + await service.setActiveTheme('preset:forest'); + final ownId = service.settings.activeThemeId; + now = DateTime(2026, 12, 20); + + await service.setActiveTheme(christmas); + expect(service.settings.holidayThemeDismissed, isNull); + expect(service.settings.activeThemeId, ownId); + expect(service.activeCustomTheme?.id, christmas); + + now = DateTime(2027, 1, 5); + expect(service.activeCustomTheme?.id, ownId); + }, + ); + + test('a user who picked the holiday preset keeps it', () async { + await service.setActiveTheme(halloween); + now = DateTime(2026, 10, 20); + expect(service.autoHolidayTheme, isNull); + expect(service.activeCustomTheme?.id, halloween); + now = DateTime(2026, 11, 1); + expect(service.activeCustomTheme?.id, halloween); + }); + + test('auto switch off keeps the user theme', () async { + await service.setHolidayAutoSwitch(false); + now = DateTime(2026, 12, 25); + expect(service.activeCustomTheme, isNull); + expect(service.autoHolidayTheme, isNull); + + await service.setHolidayAutoSwitch(true); + expect(service.activeCustomTheme?.id, christmas); + }); + + test('turning auto switch back on forgets the dismissal', () async { + now = DateTime(2026, 12, 20); + await service.setThemeMode('light'); + expect(service.activeCustomTheme, isNull); + await service.setHolidayAutoSwitch(false); + await service.setHolidayAutoSwitch(true); + expect(service.settings.holidayThemeDismissed, isNull); + expect(service.activeCustomTheme?.id, christmas); + }); + + test('date timer runs only once started and while enabled', () async { + expect(service.hasDateTimer, isFalse); + service.startDateWatch(); + expect(service.hasDateTimer, isTrue); + await service.setHolidayAutoSwitch(false); + expect(service.hasDateTimer, isFalse); + await service.setHolidayAutoSwitch(true); + expect(service.hasDateTimer, isTrue); + service.dispose(); + expect(service.hasDateTimer, isFalse); + // tearDown disposes again; use a fresh service there. + service = AppSettingsService(clock: () => now); + }); + + test('date change notifies only when the holiday theme changes', () { + now = DateTime(2026, 12, 6, 23); + service.startDateWatch(); + var notified = 0; + service.addListener(() => notified++); + + now = DateTime(2026, 12, 7, 0, 0, 1); + service.checkDateChange(); + expect(notified, 0); + + now = DateTime(2026, 12, 8, 0, 0, 1); + service.checkDateChange(); + expect(notified, 1); + expect(service.activeCustomTheme?.id, christmas); + + now = DateTime(2026, 12, 9, 0, 0, 1); + service.checkDateChange(); + expect(notified, 1); + + now = DateTime(2026, 12, 26, 0, 0, 1); + service.checkDateChange(); + expect(notified, 2); + expect(service.activeCustomTheme?.id, newYear); + }); + }); +} diff --git a/test/theme/map_theme_test.dart b/test/theme/map_theme_test.dart new file mode 100644 index 00000000..6f7d18b3 --- /dev/null +++ b/test/theme/map_theme_test.dart @@ -0,0 +1,124 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_cache_manager/flutter_cache_manager.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:meshcore_open/models/custom_theme.dart'; +import 'package:meshcore_open/services/app_settings_service.dart'; +import 'package:meshcore_open/services/map_tile_cache_service.dart'; +import 'package:meshcore_open/storage/prefs_manager.dart'; +import 'package:meshcore_open/theme/mesh_theme.dart'; +import 'package:meshcore_open/widgets/quick_switch_bar.dart'; +import 'package:meshcore_open/l10n/app_localizations.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +void main() { + final custom = CustomTheme.holidayPresets.first; + + test('stock themes keep the fixed map palette', () { + for (final data in [MeshTheme.dark(), MeshTheme.light()]) { + final map = data.extension()!; + expect(map.accent, MapPalette.selected); + expect(map.tileTint, isNull); + expect(map.followsTheme, isFalse); + } + }); + + test('custom themes tint the map with their own colors', () { + final map = MeshTheme.fromCustom(custom).extension()!; + expect(map.accent, custom.accent); + expect(map.tileTint, custom.background); + expect(map.followsTheme, isTrue); + }); + + group('tile layer', () { + late MapTileCacheService tiles; + + setUp(() async { + SharedPreferences.setMockInitialValues({}); + await PrefsManager.initialize(); + tiles = MapTileCacheService( + appSettingsService: AppSettingsService(), + cacheManager: _NoCache(), + ); + }); + + Future> filtersFor( + WidgetTester tester, + ThemeData theme, + ) async { + late Widget layer; + await tester.pumpWidget( + MaterialApp( + theme: theme, + home: Builder( + builder: (context) { + layer = tiles.buildTileLayer(context); + return const SizedBox(); + }, + ), + ), + ); + final found = []; + Widget? w = layer; + while (w is ColorFiltered) { + found.add(w); + w = w.child; + } + return found; + } + + testWidgets('custom themes wash their background over the tiles', ( + tester, + ) async { + final filters = await filtersFor(tester, MeshTheme.fromCustom(custom)); + expect( + filters.first.colorFilter, + ColorFilter.mode( + custom.background.withValues(alpha: MeshMapTheme.tileTintStrength), + BlendMode.srcATop, + ), + ); + }); + + testWidgets('the stock light theme leaves tiles untouched', (tester) async { + expect(await filtersFor(tester, MeshTheme.light()), isEmpty); + }); + }); + + testWidgets('map tab bar follows a custom theme', (tester) async { + Future panelColor(ThemeData theme) async { + await tester.pumpWidget( + MaterialApp( + theme: theme, + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + home: Scaffold( + body: QuickSwitchBar( + selectedIndex: 2, + onDestinationSelected: (_) {}, + highContrast: true, + ), + ), + ), + ); + await tester.pumpAndSettle(); // theme changes animate + final box = tester.widget( + find + .descendant( + of: find.byType(QuickSwitchBar), + matching: find.byType(DecoratedBox), + ) + .first, + ); + return (box.decoration as BoxDecoration).color; + } + + expect(await panelColor(MeshTheme.dark()), MapPalette.panelDark); + expect(await panelColor(MeshTheme.fromCustom(custom)), Colors.transparent); + }); +} + +/// Never touched: these tests only inspect the widget tree. +class _NoCache implements BaseCacheManager { + @override + dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); +} diff --git a/untranslated.json b/untranslated.json index 9e26dfee..9976cabd 100644 --- a/untranslated.json +++ b/untranslated.json @@ -1 +1,1242 @@ -{} \ No newline at end of file +{ + "bg": [ + "appSettings_colorTheme", + "appSettings_holidayAnimations", + "appSettings_holidayAnimationsSubtitle", + "themes_title", + "themes_default", + "themes_defaultSubtitle", + "themes_builtIn", + "themes_holidays", + "themes_holidayAutoSwitch", + "themes_holidayAutoSwitchSubtitle", + "themes_holidayAutoApplied", + "themes_holidayAutoAppliedTag", + "themes_myThemes", + "themes_myThemesEmpty", + "themes_create", + "themes_import", + "themes_importHint", + "themes_importInvalid", + "themes_imported", + "themes_customize", + "themes_copyCode", + "themes_codeCopied", + "themes_deleteConfirm", + "themes_copyName", + "themes_newTitle", + "themes_editTitle", + "themes_name", + "themes_nameRequired", + "themes_background", + "themes_backgroundHelp", + "themes_accent", + "themes_accentHelp", + "themes_hexColor", + "themes_preview", + "themes_previewIncoming", + "themes_previewOutgoing", + "themes_previewSwitch", + "themes_lowContrast", + "themes_saveAndUse", + "themes_icons", + "themes_iconsHelp", + "themes_iconChanged", + "themes_iconSend", + "themes_iconRepeater", + "themes_iconRoom", + "themes_iconSensor", + "themes_mapMarkers", + "themes_mapMarkersHelp", + "themes_iconUsePicture", + "themes_iconReset", + "themes_iconPictureFailed", + "themes_exportFile", + "themes_exportAll", + "themes_importFile", + "themes_pasteCode", + "themes_exportFailed", + "themes_importFileResult", + "themes_importFileNone", + "chatBackground_title", + "chatBackground_thisChatOnly", + "chatBackground_themeOverrides", + "chatBackground_none", + "chatBackground_picture", + "chatBackground_choosePicture", + "chatBackground_pictureFailed", + "chatBackground_fade", + "themes_chatBackground", + "themes_chatBackgroundHelp", + "themes_chatBackgroundEverywhere", + "themes_chatBackgroundEverywhereHelp" + ], + + "de": [ + "appSettings_colorTheme", + "appSettings_holidayAnimations", + "appSettings_holidayAnimationsSubtitle", + "themes_title", + "themes_default", + "themes_defaultSubtitle", + "themes_builtIn", + "themes_holidays", + "themes_holidayAutoSwitch", + "themes_holidayAutoSwitchSubtitle", + "themes_holidayAutoApplied", + "themes_holidayAutoAppliedTag", + "themes_myThemes", + "themes_myThemesEmpty", + "themes_create", + "themes_import", + "themes_importHint", + "themes_importInvalid", + "themes_imported", + "themes_customize", + "themes_copyCode", + "themes_codeCopied", + "themes_deleteConfirm", + "themes_copyName", + "themes_newTitle", + "themes_editTitle", + "themes_name", + "themes_nameRequired", + "themes_background", + "themes_backgroundHelp", + "themes_accent", + "themes_accentHelp", + "themes_hexColor", + "themes_preview", + "themes_previewIncoming", + "themes_previewOutgoing", + "themes_previewSwitch", + "themes_lowContrast", + "themes_saveAndUse", + "themes_icons", + "themes_iconsHelp", + "themes_iconChanged", + "themes_iconSend", + "themes_iconRepeater", + "themes_iconRoom", + "themes_iconSensor", + "themes_mapMarkers", + "themes_mapMarkersHelp", + "themes_iconUsePicture", + "themes_iconReset", + "themes_iconPictureFailed", + "themes_exportFile", + "themes_exportAll", + "themes_importFile", + "themes_pasteCode", + "themes_exportFailed", + "themes_importFileResult", + "themes_importFileNone", + "chatBackground_title", + "chatBackground_thisChatOnly", + "chatBackground_themeOverrides", + "chatBackground_none", + "chatBackground_picture", + "chatBackground_choosePicture", + "chatBackground_pictureFailed", + "chatBackground_fade", + "themes_chatBackground", + "themes_chatBackgroundHelp", + "themes_chatBackgroundEverywhere", + "themes_chatBackgroundEverywhereHelp" + ], + + "es": [ + "appSettings_colorTheme", + "appSettings_holidayAnimations", + "appSettings_holidayAnimationsSubtitle", + "themes_title", + "themes_default", + "themes_defaultSubtitle", + "themes_builtIn", + "themes_holidays", + "themes_holidayAutoSwitch", + "themes_holidayAutoSwitchSubtitle", + "themes_holidayAutoApplied", + "themes_holidayAutoAppliedTag", + "themes_myThemes", + "themes_myThemesEmpty", + "themes_create", + "themes_import", + "themes_importHint", + "themes_importInvalid", + "themes_imported", + "themes_customize", + "themes_copyCode", + "themes_codeCopied", + "themes_deleteConfirm", + "themes_copyName", + "themes_newTitle", + "themes_editTitle", + "themes_name", + "themes_nameRequired", + "themes_background", + "themes_backgroundHelp", + "themes_accent", + "themes_accentHelp", + "themes_hexColor", + "themes_preview", + "themes_previewIncoming", + "themes_previewOutgoing", + "themes_previewSwitch", + "themes_lowContrast", + "themes_saveAndUse", + "themes_icons", + "themes_iconsHelp", + "themes_iconChanged", + "themes_iconSend", + "themes_iconRepeater", + "themes_iconRoom", + "themes_iconSensor", + "themes_mapMarkers", + "themes_mapMarkersHelp", + "themes_iconUsePicture", + "themes_iconReset", + "themes_iconPictureFailed", + "themes_exportFile", + "themes_exportAll", + "themes_importFile", + "themes_pasteCode", + "themes_exportFailed", + "themes_importFileResult", + "themes_importFileNone", + "chatBackground_title", + "chatBackground_thisChatOnly", + "chatBackground_themeOverrides", + "chatBackground_none", + "chatBackground_picture", + "chatBackground_choosePicture", + "chatBackground_pictureFailed", + "chatBackground_fade", + "themes_chatBackground", + "themes_chatBackgroundHelp", + "themes_chatBackgroundEverywhere", + "themes_chatBackgroundEverywhereHelp" + ], + + "fr": [ + "appSettings_colorTheme", + "appSettings_holidayAnimations", + "appSettings_holidayAnimationsSubtitle", + "themes_title", + "themes_default", + "themes_defaultSubtitle", + "themes_builtIn", + "themes_holidays", + "themes_holidayAutoSwitch", + "themes_holidayAutoSwitchSubtitle", + "themes_holidayAutoApplied", + "themes_holidayAutoAppliedTag", + "themes_myThemes", + "themes_myThemesEmpty", + "themes_create", + "themes_import", + "themes_importHint", + "themes_importInvalid", + "themes_imported", + "themes_customize", + "themes_copyCode", + "themes_codeCopied", + "themes_deleteConfirm", + "themes_copyName", + "themes_newTitle", + "themes_editTitle", + "themes_name", + "themes_nameRequired", + "themes_background", + "themes_backgroundHelp", + "themes_accent", + "themes_accentHelp", + "themes_hexColor", + "themes_preview", + "themes_previewIncoming", + "themes_previewOutgoing", + "themes_previewSwitch", + "themes_lowContrast", + "themes_saveAndUse", + "themes_icons", + "themes_iconsHelp", + "themes_iconChanged", + "themes_iconSend", + "themes_iconRepeater", + "themes_iconRoom", + "themes_iconSensor", + "themes_mapMarkers", + "themes_mapMarkersHelp", + "themes_iconUsePicture", + "themes_iconReset", + "themes_iconPictureFailed", + "themes_exportFile", + "themes_exportAll", + "themes_importFile", + "themes_pasteCode", + "themes_exportFailed", + "themes_importFileResult", + "themes_importFileNone", + "chatBackground_title", + "chatBackground_thisChatOnly", + "chatBackground_themeOverrides", + "chatBackground_none", + "chatBackground_picture", + "chatBackground_choosePicture", + "chatBackground_pictureFailed", + "chatBackground_fade", + "themes_chatBackground", + "themes_chatBackgroundHelp", + "themes_chatBackgroundEverywhere", + "themes_chatBackgroundEverywhereHelp" + ], + + "hu": [ + "appSettings_colorTheme", + "appSettings_holidayAnimations", + "appSettings_holidayAnimationsSubtitle", + "themes_title", + "themes_default", + "themes_defaultSubtitle", + "themes_builtIn", + "themes_holidays", + "themes_holidayAutoSwitch", + "themes_holidayAutoSwitchSubtitle", + "themes_holidayAutoApplied", + "themes_holidayAutoAppliedTag", + "themes_myThemes", + "themes_myThemesEmpty", + "themes_create", + "themes_import", + "themes_importHint", + "themes_importInvalid", + "themes_imported", + "themes_customize", + "themes_copyCode", + "themes_codeCopied", + "themes_deleteConfirm", + "themes_copyName", + "themes_newTitle", + "themes_editTitle", + "themes_name", + "themes_nameRequired", + "themes_background", + "themes_backgroundHelp", + "themes_accent", + "themes_accentHelp", + "themes_hexColor", + "themes_preview", + "themes_previewIncoming", + "themes_previewOutgoing", + "themes_previewSwitch", + "themes_lowContrast", + "themes_saveAndUse", + "themes_icons", + "themes_iconsHelp", + "themes_iconChanged", + "themes_iconSend", + "themes_iconRepeater", + "themes_iconRoom", + "themes_iconSensor", + "themes_mapMarkers", + "themes_mapMarkersHelp", + "themes_iconUsePicture", + "themes_iconReset", + "themes_iconPictureFailed", + "themes_exportFile", + "themes_exportAll", + "themes_importFile", + "themes_pasteCode", + "themes_exportFailed", + "themes_importFileResult", + "themes_importFileNone", + "chatBackground_title", + "chatBackground_thisChatOnly", + "chatBackground_themeOverrides", + "chatBackground_none", + "chatBackground_picture", + "chatBackground_choosePicture", + "chatBackground_pictureFailed", + "chatBackground_fade", + "themes_chatBackground", + "themes_chatBackgroundHelp", + "themes_chatBackgroundEverywhere", + "themes_chatBackgroundEverywhereHelp" + ], + + "it": [ + "appSettings_colorTheme", + "appSettings_holidayAnimations", + "appSettings_holidayAnimationsSubtitle", + "themes_title", + "themes_default", + "themes_defaultSubtitle", + "themes_builtIn", + "themes_holidays", + "themes_holidayAutoSwitch", + "themes_holidayAutoSwitchSubtitle", + "themes_holidayAutoApplied", + "themes_holidayAutoAppliedTag", + "themes_myThemes", + "themes_myThemesEmpty", + "themes_create", + "themes_import", + "themes_importHint", + "themes_importInvalid", + "themes_imported", + "themes_customize", + "themes_copyCode", + "themes_codeCopied", + "themes_deleteConfirm", + "themes_copyName", + "themes_newTitle", + "themes_editTitle", + "themes_name", + "themes_nameRequired", + "themes_background", + "themes_backgroundHelp", + "themes_accent", + "themes_accentHelp", + "themes_hexColor", + "themes_preview", + "themes_previewIncoming", + "themes_previewOutgoing", + "themes_previewSwitch", + "themes_lowContrast", + "themes_saveAndUse", + "themes_icons", + "themes_iconsHelp", + "themes_iconChanged", + "themes_iconSend", + "themes_iconRepeater", + "themes_iconRoom", + "themes_iconSensor", + "themes_mapMarkers", + "themes_mapMarkersHelp", + "themes_iconUsePicture", + "themes_iconReset", + "themes_iconPictureFailed", + "themes_exportFile", + "themes_exportAll", + "themes_importFile", + "themes_pasteCode", + "themes_exportFailed", + "themes_importFileResult", + "themes_importFileNone", + "chatBackground_title", + "chatBackground_thisChatOnly", + "chatBackground_themeOverrides", + "chatBackground_none", + "chatBackground_picture", + "chatBackground_choosePicture", + "chatBackground_pictureFailed", + "chatBackground_fade", + "themes_chatBackground", + "themes_chatBackgroundHelp", + "themes_chatBackgroundEverywhere", + "themes_chatBackgroundEverywhereHelp" + ], + + "ja": [ + "appSettings_colorTheme", + "appSettings_holidayAnimations", + "appSettings_holidayAnimationsSubtitle", + "themes_title", + "themes_default", + "themes_defaultSubtitle", + "themes_builtIn", + "themes_holidays", + "themes_holidayAutoSwitch", + "themes_holidayAutoSwitchSubtitle", + "themes_holidayAutoApplied", + "themes_holidayAutoAppliedTag", + "themes_myThemes", + "themes_myThemesEmpty", + "themes_create", + "themes_import", + "themes_importHint", + "themes_importInvalid", + "themes_imported", + "themes_customize", + "themes_copyCode", + "themes_codeCopied", + "themes_deleteConfirm", + "themes_copyName", + "themes_newTitle", + "themes_editTitle", + "themes_name", + "themes_nameRequired", + "themes_background", + "themes_backgroundHelp", + "themes_accent", + "themes_accentHelp", + "themes_hexColor", + "themes_preview", + "themes_previewIncoming", + "themes_previewOutgoing", + "themes_previewSwitch", + "themes_lowContrast", + "themes_saveAndUse", + "themes_icons", + "themes_iconsHelp", + "themes_iconChanged", + "themes_iconSend", + "themes_iconRepeater", + "themes_iconRoom", + "themes_iconSensor", + "themes_mapMarkers", + "themes_mapMarkersHelp", + "themes_iconUsePicture", + "themes_iconReset", + "themes_iconPictureFailed", + "themes_exportFile", + "themes_exportAll", + "themes_importFile", + "themes_pasteCode", + "themes_exportFailed", + "themes_importFileResult", + "themes_importFileNone", + "chatBackground_title", + "chatBackground_thisChatOnly", + "chatBackground_themeOverrides", + "chatBackground_none", + "chatBackground_picture", + "chatBackground_choosePicture", + "chatBackground_pictureFailed", + "chatBackground_fade", + "themes_chatBackground", + "themes_chatBackgroundHelp", + "themes_chatBackgroundEverywhere", + "themes_chatBackgroundEverywhereHelp" + ], + + "ko": [ + "appSettings_colorTheme", + "appSettings_holidayAnimations", + "appSettings_holidayAnimationsSubtitle", + "themes_title", + "themes_default", + "themes_defaultSubtitle", + "themes_builtIn", + "themes_holidays", + "themes_holidayAutoSwitch", + "themes_holidayAutoSwitchSubtitle", + "themes_holidayAutoApplied", + "themes_holidayAutoAppliedTag", + "themes_myThemes", + "themes_myThemesEmpty", + "themes_create", + "themes_import", + "themes_importHint", + "themes_importInvalid", + "themes_imported", + "themes_customize", + "themes_copyCode", + "themes_codeCopied", + "themes_deleteConfirm", + "themes_copyName", + "themes_newTitle", + "themes_editTitle", + "themes_name", + "themes_nameRequired", + "themes_background", + "themes_backgroundHelp", + "themes_accent", + "themes_accentHelp", + "themes_hexColor", + "themes_preview", + "themes_previewIncoming", + "themes_previewOutgoing", + "themes_previewSwitch", + "themes_lowContrast", + "themes_saveAndUse", + "themes_icons", + "themes_iconsHelp", + "themes_iconChanged", + "themes_iconSend", + "themes_iconRepeater", + "themes_iconRoom", + "themes_iconSensor", + "themes_mapMarkers", + "themes_mapMarkersHelp", + "themes_iconUsePicture", + "themes_iconReset", + "themes_iconPictureFailed", + "themes_exportFile", + "themes_exportAll", + "themes_importFile", + "themes_pasteCode", + "themes_exportFailed", + "themes_importFileResult", + "themes_importFileNone", + "chatBackground_title", + "chatBackground_thisChatOnly", + "chatBackground_themeOverrides", + "chatBackground_none", + "chatBackground_picture", + "chatBackground_choosePicture", + "chatBackground_pictureFailed", + "chatBackground_fade", + "themes_chatBackground", + "themes_chatBackgroundHelp", + "themes_chatBackgroundEverywhere", + "themes_chatBackgroundEverywhereHelp" + ], + + "nl": [ + "appSettings_colorTheme", + "appSettings_holidayAnimations", + "appSettings_holidayAnimationsSubtitle", + "themes_title", + "themes_default", + "themes_defaultSubtitle", + "themes_builtIn", + "themes_holidays", + "themes_holidayAutoSwitch", + "themes_holidayAutoSwitchSubtitle", + "themes_holidayAutoApplied", + "themes_holidayAutoAppliedTag", + "themes_myThemes", + "themes_myThemesEmpty", + "themes_create", + "themes_import", + "themes_importHint", + "themes_importInvalid", + "themes_imported", + "themes_customize", + "themes_copyCode", + "themes_codeCopied", + "themes_deleteConfirm", + "themes_copyName", + "themes_newTitle", + "themes_editTitle", + "themes_name", + "themes_nameRequired", + "themes_background", + "themes_backgroundHelp", + "themes_accent", + "themes_accentHelp", + "themes_hexColor", + "themes_preview", + "themes_previewIncoming", + "themes_previewOutgoing", + "themes_previewSwitch", + "themes_lowContrast", + "themes_saveAndUse", + "themes_icons", + "themes_iconsHelp", + "themes_iconChanged", + "themes_iconSend", + "themes_iconRepeater", + "themes_iconRoom", + "themes_iconSensor", + "themes_mapMarkers", + "themes_mapMarkersHelp", + "themes_iconUsePicture", + "themes_iconReset", + "themes_iconPictureFailed", + "themes_exportFile", + "themes_exportAll", + "themes_importFile", + "themes_pasteCode", + "themes_exportFailed", + "themes_importFileResult", + "themes_importFileNone", + "chatBackground_title", + "chatBackground_thisChatOnly", + "chatBackground_themeOverrides", + "chatBackground_none", + "chatBackground_picture", + "chatBackground_choosePicture", + "chatBackground_pictureFailed", + "chatBackground_fade", + "themes_chatBackground", + "themes_chatBackgroundHelp", + "themes_chatBackgroundEverywhere", + "themes_chatBackgroundEverywhereHelp" + ], + + "pl": [ + "appSettings_colorTheme", + "appSettings_holidayAnimations", + "appSettings_holidayAnimationsSubtitle", + "themes_title", + "themes_default", + "themes_defaultSubtitle", + "themes_builtIn", + "themes_holidays", + "themes_holidayAutoSwitch", + "themes_holidayAutoSwitchSubtitle", + "themes_holidayAutoApplied", + "themes_holidayAutoAppliedTag", + "themes_myThemes", + "themes_myThemesEmpty", + "themes_create", + "themes_import", + "themes_importHint", + "themes_importInvalid", + "themes_imported", + "themes_customize", + "themes_copyCode", + "themes_codeCopied", + "themes_deleteConfirm", + "themes_copyName", + "themes_newTitle", + "themes_editTitle", + "themes_name", + "themes_nameRequired", + "themes_background", + "themes_backgroundHelp", + "themes_accent", + "themes_accentHelp", + "themes_hexColor", + "themes_preview", + "themes_previewIncoming", + "themes_previewOutgoing", + "themes_previewSwitch", + "themes_lowContrast", + "themes_saveAndUse", + "themes_icons", + "themes_iconsHelp", + "themes_iconChanged", + "themes_iconSend", + "themes_iconRepeater", + "themes_iconRoom", + "themes_iconSensor", + "themes_mapMarkers", + "themes_mapMarkersHelp", + "themes_iconUsePicture", + "themes_iconReset", + "themes_iconPictureFailed", + "themes_exportFile", + "themes_exportAll", + "themes_importFile", + "themes_pasteCode", + "themes_exportFailed", + "themes_importFileResult", + "themes_importFileNone", + "chatBackground_title", + "chatBackground_thisChatOnly", + "chatBackground_themeOverrides", + "chatBackground_none", + "chatBackground_picture", + "chatBackground_choosePicture", + "chatBackground_pictureFailed", + "chatBackground_fade", + "themes_chatBackground", + "themes_chatBackgroundHelp", + "themes_chatBackgroundEverywhere", + "themes_chatBackgroundEverywhereHelp" + ], + + "pt": [ + "appSettings_colorTheme", + "appSettings_holidayAnimations", + "appSettings_holidayAnimationsSubtitle", + "themes_title", + "themes_default", + "themes_defaultSubtitle", + "themes_builtIn", + "themes_holidays", + "themes_holidayAutoSwitch", + "themes_holidayAutoSwitchSubtitle", + "themes_holidayAutoApplied", + "themes_holidayAutoAppliedTag", + "themes_myThemes", + "themes_myThemesEmpty", + "themes_create", + "themes_import", + "themes_importHint", + "themes_importInvalid", + "themes_imported", + "themes_customize", + "themes_copyCode", + "themes_codeCopied", + "themes_deleteConfirm", + "themes_copyName", + "themes_newTitle", + "themes_editTitle", + "themes_name", + "themes_nameRequired", + "themes_background", + "themes_backgroundHelp", + "themes_accent", + "themes_accentHelp", + "themes_hexColor", + "themes_preview", + "themes_previewIncoming", + "themes_previewOutgoing", + "themes_previewSwitch", + "themes_lowContrast", + "themes_saveAndUse", + "themes_icons", + "themes_iconsHelp", + "themes_iconChanged", + "themes_iconSend", + "themes_iconRepeater", + "themes_iconRoom", + "themes_iconSensor", + "themes_mapMarkers", + "themes_mapMarkersHelp", + "themes_iconUsePicture", + "themes_iconReset", + "themes_iconPictureFailed", + "themes_exportFile", + "themes_exportAll", + "themes_importFile", + "themes_pasteCode", + "themes_exportFailed", + "themes_importFileResult", + "themes_importFileNone", + "chatBackground_title", + "chatBackground_thisChatOnly", + "chatBackground_themeOverrides", + "chatBackground_none", + "chatBackground_picture", + "chatBackground_choosePicture", + "chatBackground_pictureFailed", + "chatBackground_fade", + "themes_chatBackground", + "themes_chatBackgroundHelp", + "themes_chatBackgroundEverywhere", + "themes_chatBackgroundEverywhereHelp" + ], + + "ru": [ + "appSettings_colorTheme", + "appSettings_holidayAnimations", + "appSettings_holidayAnimationsSubtitle", + "themes_title", + "themes_default", + "themes_defaultSubtitle", + "themes_builtIn", + "themes_holidays", + "themes_holidayAutoSwitch", + "themes_holidayAutoSwitchSubtitle", + "themes_holidayAutoApplied", + "themes_holidayAutoAppliedTag", + "themes_myThemes", + "themes_myThemesEmpty", + "themes_create", + "themes_import", + "themes_importHint", + "themes_importInvalid", + "themes_imported", + "themes_customize", + "themes_copyCode", + "themes_codeCopied", + "themes_deleteConfirm", + "themes_copyName", + "themes_newTitle", + "themes_editTitle", + "themes_name", + "themes_nameRequired", + "themes_background", + "themes_backgroundHelp", + "themes_accent", + "themes_accentHelp", + "themes_hexColor", + "themes_preview", + "themes_previewIncoming", + "themes_previewOutgoing", + "themes_previewSwitch", + "themes_lowContrast", + "themes_saveAndUse", + "themes_icons", + "themes_iconsHelp", + "themes_iconChanged", + "themes_iconSend", + "themes_iconRepeater", + "themes_iconRoom", + "themes_iconSensor", + "themes_mapMarkers", + "themes_mapMarkersHelp", + "themes_iconUsePicture", + "themes_iconReset", + "themes_iconPictureFailed", + "themes_exportFile", + "themes_exportAll", + "themes_importFile", + "themes_pasteCode", + "themes_exportFailed", + "themes_importFileResult", + "themes_importFileNone", + "chatBackground_title", + "chatBackground_thisChatOnly", + "chatBackground_themeOverrides", + "chatBackground_none", + "chatBackground_picture", + "chatBackground_choosePicture", + "chatBackground_pictureFailed", + "chatBackground_fade", + "themes_chatBackground", + "themes_chatBackgroundHelp", + "themes_chatBackgroundEverywhere", + "themes_chatBackgroundEverywhereHelp" + ], + + "sk": [ + "appSettings_colorTheme", + "appSettings_holidayAnimations", + "appSettings_holidayAnimationsSubtitle", + "themes_title", + "themes_default", + "themes_defaultSubtitle", + "themes_builtIn", + "themes_holidays", + "themes_holidayAutoSwitch", + "themes_holidayAutoSwitchSubtitle", + "themes_holidayAutoApplied", + "themes_holidayAutoAppliedTag", + "themes_myThemes", + "themes_myThemesEmpty", + "themes_create", + "themes_import", + "themes_importHint", + "themes_importInvalid", + "themes_imported", + "themes_customize", + "themes_copyCode", + "themes_codeCopied", + "themes_deleteConfirm", + "themes_copyName", + "themes_newTitle", + "themes_editTitle", + "themes_name", + "themes_nameRequired", + "themes_background", + "themes_backgroundHelp", + "themes_accent", + "themes_accentHelp", + "themes_hexColor", + "themes_preview", + "themes_previewIncoming", + "themes_previewOutgoing", + "themes_previewSwitch", + "themes_lowContrast", + "themes_saveAndUse", + "themes_icons", + "themes_iconsHelp", + "themes_iconChanged", + "themes_iconSend", + "themes_iconRepeater", + "themes_iconRoom", + "themes_iconSensor", + "themes_mapMarkers", + "themes_mapMarkersHelp", + "themes_iconUsePicture", + "themes_iconReset", + "themes_iconPictureFailed", + "themes_exportFile", + "themes_exportAll", + "themes_importFile", + "themes_pasteCode", + "themes_exportFailed", + "themes_importFileResult", + "themes_importFileNone", + "chatBackground_title", + "chatBackground_thisChatOnly", + "chatBackground_themeOverrides", + "chatBackground_none", + "chatBackground_picture", + "chatBackground_choosePicture", + "chatBackground_pictureFailed", + "chatBackground_fade", + "themes_chatBackground", + "themes_chatBackgroundHelp", + "themes_chatBackgroundEverywhere", + "themes_chatBackgroundEverywhereHelp" + ], + + "sl": [ + "appSettings_colorTheme", + "appSettings_holidayAnimations", + "appSettings_holidayAnimationsSubtitle", + "themes_title", + "themes_default", + "themes_defaultSubtitle", + "themes_builtIn", + "themes_holidays", + "themes_holidayAutoSwitch", + "themes_holidayAutoSwitchSubtitle", + "themes_holidayAutoApplied", + "themes_holidayAutoAppliedTag", + "themes_myThemes", + "themes_myThemesEmpty", + "themes_create", + "themes_import", + "themes_importHint", + "themes_importInvalid", + "themes_imported", + "themes_customize", + "themes_copyCode", + "themes_codeCopied", + "themes_deleteConfirm", + "themes_copyName", + "themes_newTitle", + "themes_editTitle", + "themes_name", + "themes_nameRequired", + "themes_background", + "themes_backgroundHelp", + "themes_accent", + "themes_accentHelp", + "themes_hexColor", + "themes_preview", + "themes_previewIncoming", + "themes_previewOutgoing", + "themes_previewSwitch", + "themes_lowContrast", + "themes_saveAndUse", + "themes_icons", + "themes_iconsHelp", + "themes_iconChanged", + "themes_iconSend", + "themes_iconRepeater", + "themes_iconRoom", + "themes_iconSensor", + "themes_mapMarkers", + "themes_mapMarkersHelp", + "themes_iconUsePicture", + "themes_iconReset", + "themes_iconPictureFailed", + "themes_exportFile", + "themes_exportAll", + "themes_importFile", + "themes_pasteCode", + "themes_exportFailed", + "themes_importFileResult", + "themes_importFileNone", + "chatBackground_title", + "chatBackground_thisChatOnly", + "chatBackground_themeOverrides", + "chatBackground_none", + "chatBackground_picture", + "chatBackground_choosePicture", + "chatBackground_pictureFailed", + "chatBackground_fade", + "themes_chatBackground", + "themes_chatBackgroundHelp", + "themes_chatBackgroundEverywhere", + "themes_chatBackgroundEverywhereHelp" + ], + + "sv": [ + "appSettings_colorTheme", + "appSettings_holidayAnimations", + "appSettings_holidayAnimationsSubtitle", + "themes_title", + "themes_default", + "themes_defaultSubtitle", + "themes_builtIn", + "themes_holidays", + "themes_holidayAutoSwitch", + "themes_holidayAutoSwitchSubtitle", + "themes_holidayAutoApplied", + "themes_holidayAutoAppliedTag", + "themes_myThemes", + "themes_myThemesEmpty", + "themes_create", + "themes_import", + "themes_importHint", + "themes_importInvalid", + "themes_imported", + "themes_customize", + "themes_copyCode", + "themes_codeCopied", + "themes_deleteConfirm", + "themes_copyName", + "themes_newTitle", + "themes_editTitle", + "themes_name", + "themes_nameRequired", + "themes_background", + "themes_backgroundHelp", + "themes_accent", + "themes_accentHelp", + "themes_hexColor", + "themes_preview", + "themes_previewIncoming", + "themes_previewOutgoing", + "themes_previewSwitch", + "themes_lowContrast", + "themes_saveAndUse", + "themes_icons", + "themes_iconsHelp", + "themes_iconChanged", + "themes_iconSend", + "themes_iconRepeater", + "themes_iconRoom", + "themes_iconSensor", + "themes_mapMarkers", + "themes_mapMarkersHelp", + "themes_iconUsePicture", + "themes_iconReset", + "themes_iconPictureFailed", + "themes_exportFile", + "themes_exportAll", + "themes_importFile", + "themes_pasteCode", + "themes_exportFailed", + "themes_importFileResult", + "themes_importFileNone", + "chatBackground_title", + "chatBackground_thisChatOnly", + "chatBackground_themeOverrides", + "chatBackground_none", + "chatBackground_picture", + "chatBackground_choosePicture", + "chatBackground_pictureFailed", + "chatBackground_fade", + "themes_chatBackground", + "themes_chatBackgroundHelp", + "themes_chatBackgroundEverywhere", + "themes_chatBackgroundEverywhereHelp" + ], + + "uk": [ + "appSettings_colorTheme", + "appSettings_holidayAnimations", + "appSettings_holidayAnimationsSubtitle", + "themes_title", + "themes_default", + "themes_defaultSubtitle", + "themes_builtIn", + "themes_holidays", + "themes_holidayAutoSwitch", + "themes_holidayAutoSwitchSubtitle", + "themes_holidayAutoApplied", + "themes_holidayAutoAppliedTag", + "themes_myThemes", + "themes_myThemesEmpty", + "themes_create", + "themes_import", + "themes_importHint", + "themes_importInvalid", + "themes_imported", + "themes_customize", + "themes_copyCode", + "themes_codeCopied", + "themes_deleteConfirm", + "themes_copyName", + "themes_newTitle", + "themes_editTitle", + "themes_name", + "themes_nameRequired", + "themes_background", + "themes_backgroundHelp", + "themes_accent", + "themes_accentHelp", + "themes_hexColor", + "themes_preview", + "themes_previewIncoming", + "themes_previewOutgoing", + "themes_previewSwitch", + "themes_lowContrast", + "themes_saveAndUse", + "themes_icons", + "themes_iconsHelp", + "themes_iconChanged", + "themes_iconSend", + "themes_iconRepeater", + "themes_iconRoom", + "themes_iconSensor", + "themes_mapMarkers", + "themes_mapMarkersHelp", + "themes_iconUsePicture", + "themes_iconReset", + "themes_iconPictureFailed", + "themes_exportFile", + "themes_exportAll", + "themes_importFile", + "themes_pasteCode", + "themes_exportFailed", + "themes_importFileResult", + "themes_importFileNone", + "chatBackground_title", + "chatBackground_thisChatOnly", + "chatBackground_themeOverrides", + "chatBackground_none", + "chatBackground_picture", + "chatBackground_choosePicture", + "chatBackground_pictureFailed", + "chatBackground_fade", + "themes_chatBackground", + "themes_chatBackgroundHelp", + "themes_chatBackgroundEverywhere", + "themes_chatBackgroundEverywhereHelp" + ], + + "zh": [ + "appSettings_colorTheme", + "appSettings_holidayAnimations", + "appSettings_holidayAnimationsSubtitle", + "themes_title", + "themes_default", + "themes_defaultSubtitle", + "themes_builtIn", + "themes_holidays", + "themes_holidayAutoSwitch", + "themes_holidayAutoSwitchSubtitle", + "themes_holidayAutoApplied", + "themes_holidayAutoAppliedTag", + "themes_myThemes", + "themes_myThemesEmpty", + "themes_create", + "themes_import", + "themes_importHint", + "themes_importInvalid", + "themes_imported", + "themes_customize", + "themes_copyCode", + "themes_codeCopied", + "themes_deleteConfirm", + "themes_copyName", + "themes_newTitle", + "themes_editTitle", + "themes_name", + "themes_nameRequired", + "themes_background", + "themes_backgroundHelp", + "themes_accent", + "themes_accentHelp", + "themes_hexColor", + "themes_preview", + "themes_previewIncoming", + "themes_previewOutgoing", + "themes_previewSwitch", + "themes_lowContrast", + "themes_saveAndUse", + "themes_icons", + "themes_iconsHelp", + "themes_iconChanged", + "themes_iconSend", + "themes_iconRepeater", + "themes_iconRoom", + "themes_iconSensor", + "themes_mapMarkers", + "themes_mapMarkersHelp", + "themes_iconUsePicture", + "themes_iconReset", + "themes_iconPictureFailed", + "themes_exportFile", + "themes_exportAll", + "themes_importFile", + "themes_pasteCode", + "themes_exportFailed", + "themes_importFileResult", + "themes_importFileNone", + "chatBackground_title", + "chatBackground_thisChatOnly", + "chatBackground_themeOverrides", + "chatBackground_none", + "chatBackground_picture", + "chatBackground_choosePicture", + "chatBackground_pictureFailed", + "chatBackground_fade", + "themes_chatBackground", + "themes_chatBackgroundHelp", + "themes_chatBackgroundEverywhere", + "themes_chatBackgroundEverywhereHelp" + ] +}