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..54b4c50e --- /dev/null +++ b/lib/helpers/holiday_triggers.dart @@ -0,0 +1,99 @@ +/// 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)); + } + } + } + } + // Longest first, so the most specific greeting wins: "Boas Festas e Feliz + // Ano Novo" is New Year's even though it contains "Boas Festas". + matchers.sort((a, b) => b.joined.length.compareTo(a.joined.length)); + 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 2c5901d3..3993d19e 100644 --- a/lib/l10n/app_bg.arb +++ b/lib/l10n/app_bg.arb @@ -3452,5 +3452,79 @@ "networkMap_manage": "Управление", "networkMap_addedToContacts": "Добавено към контактите", "networkMap_addFailed": "Неуспешно добавяне към контактите", - "networkMap_unnamed": "Неназован повторител" + "networkMap_unnamed": "Неназован повторител", + "holidayGreeting_halloween": "Честит Хелоуин|Весел Хелоуин|Happy Halloween", + "holidayGreeting_thanksgiving": "Честит Ден на благодарността|Честит Thanksgiving|Happy Thanksgiving", + "holidayGreeting_christmas": "Весела Коледа|Честито Рождество|Честита Коледа|Весели празници|Merry Christmas", + "holidayGreeting_newYear": "Честита Нова година|Щастлива Нова година|Happy New Year", + "appSettings_colorTheme": "Цветова тема", + "appSettings_holidayAnimations": "Анимации за празници в съобщенията", + "appSettings_holidayAnimationsSubtitle": "Прилепи, пуйка, Дядо Коледа или фойерверки, когато някой изпрати празнично пожелание", + "themes_title": "Теми", + "themes_default": "MeshCore", + "themes_defaultSubtitle": "Стандартни цветове, следва настройката Светла / Тъмна", + "themes_builtIn": "Вградени", + "themes_holidays": "Празници", + "themes_holidayAutoSwitch": "Превключвай автоматично", + "themes_holidayAutoSwitchSubtitle": "Използва темата на всеки празник от 17 дни преди него до самия ден", + "themes_holidayAutoApplied": "Темата „{holiday}“ е включена автоматично. Вашата тема се връща след празника.", + "themes_holidayAutoAppliedTag": "Включена автоматично", + "themes_myThemes": "Моите теми", + "themes_myThemesEmpty": "Направете своя тема, като изберете фон и акцентен цвят.", + "themes_create": "Създай тема", + "themes_import": "Импортирай тема", + "themes_importHint": "Поставете код на тема", + "themes_importInvalid": "Това не е валиден код на тема", + "themes_imported": "Добавена тема „{name}“", + "themes_customize": "Персонализирай копие", + "themes_copyCode": "Копирай кода на темата", + "themes_codeCopied": "Кодът на темата е копиран", + "themes_deleteConfirm": "Да изтрия ли темата „{name}“?", + "themes_copyName": "{name} (копие)", + "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": "Импортирани теми: {count}", + "themes_importFileNone": "Във файла не са намерени теми", + "chatBackground_title": "Фон на чата", + "chatBackground_thisChatOnly": "Само за този чат", + "chatBackground_themeOverrides": "Вашата тема „{name}“ задава фона във всички чатове. Изключете това в темата, за да използвате този фон.", + "chatBackground_none": "Няма", + "chatBackground_picture": "Снимка", + "chatBackground_choosePicture": "Избери снимка", + "chatBackground_pictureFailed": "Тази снимка не може да се използва", + "chatBackground_fade": "Избледняване", + "themes_chatBackground": "Фон на чата", + "themes_chatBackgroundHelp": "Показва се в чатове, които нямат свой фон", + "themes_chatBackgroundEverywhere": "Използвай във всички чатове", + "themes_chatBackgroundEverywhereHelp": "Заменя и фоновете, зададени на отделни чатове" } diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index cd4160ae..1fb06197 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -3587,5 +3587,79 @@ "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|Happy Halloween|Schaurig schönes Halloween|Gruselige Halloween|Süßes oder Saures", + "holidayGreeting_thanksgiving": "Frohes Thanksgiving|Schönes Thanksgiving|Frohes Erntedankfest|Happy Thanksgiving|Schönes Erntedankfest", + "holidayGreeting_christmas": "Frohe Weihnachten|Fröhliche Weihnachten|Frohes Fest|Schöne Weihnachten|Merry Christmas|Gesegnete Weihnachten|Frohe Weihnachtstage", + "holidayGreeting_newYear": "Frohes neues Jahr|Gutes neues Jahr|Guten Rutsch|Prosit Neujahr|Happy New Year|Ein gutes neues Jahr|Guten Rutsch ins neue Jahr|Frohes Neues", + "appSettings_colorTheme": "Farbdesign", + "appSettings_holidayAnimations": "Feiertags-Animationen in Nachrichten", + "appSettings_holidayAnimationsSubtitle": "Fledermäuse, ein Truthahn, der Weihnachtsmann oder Feuerwerk, wenn jemand einen Feiertagsgruß schreibt", + "themes_title": "Designs", + "themes_default": "MeshCore", + "themes_defaultSubtitle": "Standardfarben, folgt der Einstellung Hell / Dunkel", + "themes_builtIn": "Vorinstalliert", + "themes_holidays": "Feiertage", + "themes_holidayAutoSwitch": "Automatisch wechseln", + "themes_holidayAutoSwitchSubtitle": "Nutzt das Design jedes Feiertags ab 17 Tage vorher bis zum Feiertag selbst", + "themes_holidayAutoApplied": "Das Design „{holiday}“ ist automatisch aktiv. Nach dem Feiertag kommt Ihr eigenes Design zurück.", + "themes_holidayAutoAppliedTag": "Automatisch aktiv", + "themes_myThemes": "Meine Designs", + "themes_myThemesEmpty": "Erstellen Sie ein eigenes Design, indem Sie einen Hintergrund und eine Akzentfarbe wählen.", + "themes_create": "Design erstellen", + "themes_import": "Design importieren", + "themes_importHint": "Design-Code einfügen", + "themes_importInvalid": "Das ist kein gültiger Design-Code", + "themes_imported": "Design „{name}“ hinzugefügt", + "themes_customize": "Kopie anpassen", + "themes_copyCode": "Design-Code kopieren", + "themes_codeCopied": "Design-Code kopiert", + "themes_deleteConfirm": "Design „{name}“ löschen?", + "themes_copyName": "{name} Kopie", + "themes_newTitle": "Neues Design", + "themes_editTitle": "Design bearbeiten", + "themes_name": "Name", + "themes_nameRequired": "Geben Sie Ihrem Design einen Namen", + "themes_background": "Hintergrund", + "themes_backgroundHelp": "Ein dunkler Hintergrund ergibt ein dunkles Design", + "themes_accent": "Akzent", + "themes_accentHelp": "Schaltflächen, Hervorhebungen und Ihre Chat-Blasen", + "themes_hexColor": "Hex-Farbe", + "themes_preview": "Vorschau", + "themes_previewIncoming": "Ist heute Abend jemand im Mesh?", + "themes_previewOutgoing": "Laut und deutlich!", + "themes_previewSwitch": "Benachrichtigungen", + "themes_lowContrast": "Der Akzent ist auf diesem Hintergrund schlecht zu sehen", + "themes_saveAndUse": "Speichern und verwenden", + "themes_icons": "Symbole", + "themes_iconsHelp": "Tippen Sie auf ein Symbol, um es durch ein anderes Symbol oder ein eigenes Bild zu ersetzen", + "themes_iconChanged": "Geändert", + "themes_iconSend": "Senden-Schaltfläche", + "themes_iconRepeater": "Repeater", + "themes_iconRoom": "Raumserver", + "themes_iconSensor": "Sensoren", + "themes_mapMarkers": "Kartenmarkierungen", + "themes_mapMarkersHelp": "Ersetzen Sie die Markierungen für Knoten und für Sie selbst auf der Karte", + "themes_iconUsePicture": "Bild verwenden", + "themes_iconReset": "Standardsymbol verwenden", + "themes_iconPictureFailed": "Das Bild konnte nicht verwendet werden", + "themes_exportFile": "In Datei exportieren", + "themes_exportAll": "Meine Designs exportieren", + "themes_importFile": "Aus Datei importieren", + "themes_pasteCode": "Design-Code einfügen", + "themes_exportFailed": "Designs konnten nicht exportiert werden", + "themes_importFileResult": "{count} Designs importiert", + "themes_importFileNone": "In dieser Datei wurden keine Designs gefunden", + "chatBackground_title": "Chat-Hintergrund", + "chatBackground_thisChatOnly": "Nur für diesen Chat", + "chatBackground_themeOverrides": "Ihr Design „{name}“ legt den Hintergrund in jedem Chat fest. Schalten Sie das im Design aus, um diesen zu verwenden.", + "chatBackground_none": "Kein Hintergrund", + "chatBackground_picture": "Bild", + "chatBackground_choosePicture": "Bild auswählen", + "chatBackground_pictureFailed": "Das Bild konnte nicht verwendet werden", + "chatBackground_fade": "Abblenden", + "themes_chatBackground": "Chat-Hintergrund", + "themes_chatBackgroundHelp": "Wird in Chats gezeigt, die keinen eigenen Hintergrund haben", + "themes_chatBackgroundEverywhere": "In jedem Chat verwenden", + "themes_chatBackgroundEverywhereHelp": "Ersetzt auch Hintergründe, die für einzelne Chats gesetzt wurden" } diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 8ea0161d..c56769df 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", @@ -3621,5 +3733,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 3404c60d..8738430a 100644 --- a/lib/l10n/app_es.arb +++ b/lib/l10n/app_es.arb @@ -3586,5 +3586,79 @@ }, "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|Feliz Noche de Halloween|Felices Halloween|Truco o trato", + "holidayGreeting_thanksgiving": "Feliz Día de Acción de Gracias|Feliz Thanksgiving|Feliz Día de Gracias|Feliz Acción de Gracias", + "holidayGreeting_christmas": "Feliz Navidad|Felices Fiestas|Feliz Nochebuena|Felices Navidades|Merry Christmas", + "holidayGreeting_newYear": "Feliz Año Nuevo|Próspero Año Nuevo|Feliz Año|Feliz Nochevieja|Próspero Año|Happy New Year", + "appSettings_colorTheme": "Tema de color", + "appSettings_holidayAnimations": "Animaciones de mensajes festivos", + "appSettings_holidayAnimationsSubtitle": "Murciélagos, un pavo, Papá Noel o fuegos artificiales cuando alguien envía un saludo festivo", + "themes_title": "Temas", + "themes_default": "MeshCore", + "themes_defaultSubtitle": "Colores estándar, sigue el ajuste Claro / Oscuro", + "themes_builtIn": "Incluidos", + "themes_holidays": "Fiestas", + "themes_holidayAutoSwitch": "Cambiar automáticamente", + "themes_holidayAutoSwitchSubtitle": "Usa el tema de cada fiesta desde 17 días antes hasta el día mismo", + "themes_holidayAutoApplied": "El tema de {holiday} se activó automáticamente. Tu propio tema vuelve después de la fiesta.", + "themes_holidayAutoAppliedTag": "Activado automáticamente", + "themes_myThemes": "Mis temas", + "themes_myThemesEmpty": "Crea tu propio tema eligiendo un fondo y un color de acento.", + "themes_create": "Crear tema", + "themes_import": "Importar tema", + "themes_importHint": "Pega un código de tema", + "themes_importInvalid": "Ese no es un código de tema válido", + "themes_imported": "Se agregó el tema \"{name}\"", + "themes_customize": "Personalizar una copia", + "themes_copyCode": "Copiar código del tema", + "themes_codeCopied": "Código del tema copiado", + "themes_deleteConfirm": "¿Eliminar el tema \"{name}\"?", + "themes_copyName": "Copia de {name}", + "themes_newTitle": "Tema nuevo", + "themes_editTitle": "Editar tema", + "themes_name": "Nombre", + "themes_nameRequired": "Ponle un nombre a tu tema", + "themes_background": "Fondo", + "themes_backgroundHelp": "Un fondo oscuro crea un tema oscuro", + "themes_accent": "Acento", + "themes_accentHelp": "Botones, resaltados y tus burbujas de chat", + "themes_hexColor": "Color hexadecimal", + "themes_preview": "Vista previa", + "themes_previewIncoming": "¿Alguien en la malla esta noche?", + "themes_previewOutgoing": "¡Fuerte y claro!", + "themes_previewSwitch": "Notificaciones", + "themes_lowContrast": "El acento casi no se ve sobre este fondo", + "themes_saveAndUse": "Guardar y usar", + "themes_icons": "Iconos", + "themes_iconsHelp": "Toca un icono para cambiarlo por otro icono o por tu propia imagen", + "themes_iconChanged": "Cambiado", + "themes_iconSend": "Botón de enviar", + "themes_iconRepeater": "Repetidores", + "themes_iconRoom": "Salas", + "themes_iconSensor": "Sensores", + "themes_mapMarkers": "Marcadores del mapa", + "themes_mapMarkersHelp": "Cambia los marcadores de los nodos y el tuyo en el mapa", + "themes_iconUsePicture": "Usar una imagen", + "themes_iconReset": "Usar el icono predeterminado", + "themes_iconPictureFailed": "No se pudo usar esa imagen", + "themes_exportFile": "Exportar a archivo", + "themes_exportAll": "Exportar mis temas", + "themes_importFile": "Importar desde archivo", + "themes_pasteCode": "Pegar código del tema", + "themes_exportFailed": "No se pudieron exportar los temas", + "themes_importFileResult": "Se importaron {count} temas", + "themes_importFileNone": "No se encontraron temas en ese archivo", + "chatBackground_title": "Fondo del chat", + "chatBackground_thisChatOnly": "Solo para este chat", + "chatBackground_themeOverrides": "Tu tema \"{name}\" define el fondo en todos los chats. Desactívalo en el tema para usar este.", + "chatBackground_none": "Ninguno", + "chatBackground_picture": "Imagen", + "chatBackground_choosePicture": "Elegir una imagen", + "chatBackground_pictureFailed": "No se pudo usar esa imagen", + "chatBackground_fade": "Difuminado", + "themes_chatBackground": "Fondo del chat", + "themes_chatBackgroundHelp": "Se muestra en los chats que no tienen fondo propio", + "themes_chatBackgroundEverywhere": "Usar en todos los chats", + "themes_chatBackgroundEverywhereHelp": "También reemplaza los fondos de chats individuales" } diff --git a/lib/l10n/app_fr.arb b/lib/l10n/app_fr.arb index af5814f3..6c8c0531 100644 --- a/lib/l10n/app_fr.arb +++ b/lib/l10n/app_fr.arb @@ -3586,5 +3586,79 @@ }, "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|Bon Halloween|Happy Halloween", + "holidayGreeting_thanksgiving": "Joyeux Thanksgiving|Joyeuse Action de grâce|Joyeux Jour de l'Action de grâce|Bon Thanksgiving|Happy Thanksgiving", + "holidayGreeting_christmas": "Joyeux Noël|Joyeuses fêtes|Bon Noël|Merry Christmas", + "holidayGreeting_newYear": "Bonne année|Bonne et heureuse année|Happy New Year", + "appSettings_colorTheme": "Thème de couleurs", + "appSettings_holidayAnimations": "Animations des messages de fête", + "appSettings_holidayAnimationsSubtitle": "Chauves-souris, dinde, Père Noël ou feux d'artifice quand quelqu'un envoie des vœux de fête", + "themes_title": "Thèmes", + "themes_default": "MeshCore", + "themes_defaultSubtitle": "Couleurs standard, suit le réglage Clair / Sombre", + "themes_builtIn": "Intégrés", + "themes_holidays": "Fêtes", + "themes_holidayAutoSwitch": "Changer automatiquement", + "themes_holidayAutoSwitchSubtitle": "Utilise le thème de chaque fête de 17 jours avant jusqu'au jour même", + "themes_holidayAutoApplied": "Le thème {holiday} est activé automatiquement. Votre propre thème reviendra après la fête.", + "themes_holidayAutoAppliedTag": "Activé automatiquement", + "themes_myThemes": "Mes thèmes", + "themes_myThemesEmpty": "Créez votre propre thème en choisissant un fond et une couleur d'accent.", + "themes_create": "Créer un thème", + "themes_import": "Importer un thème", + "themes_importHint": "Collez un code de thème", + "themes_importInvalid": "Ce code de thème n'est pas valide", + "themes_imported": "Thème « {name} » ajouté", + "themes_customize": "Personnaliser une copie", + "themes_copyCode": "Copier le code du thème", + "themes_codeCopied": "Code du thème copié", + "themes_deleteConfirm": "Supprimer le thème « {name} » ?", + "themes_copyName": "Copie de {name}", + "themes_newTitle": "Nouveau thème", + "themes_editTitle": "Modifier le thème", + "themes_name": "Nom", + "themes_nameRequired": "Donnez un nom à votre thème", + "themes_background": "Fond", + "themes_backgroundHelp": "Un fond sombre donne un thème sombre", + "themes_accent": "Accent", + "themes_accentHelp": "Boutons, éléments en surbrillance et vos bulles de discussion", + "themes_hexColor": "Couleur hexadécimale", + "themes_preview": "Aperçu", + "themes_previewIncoming": "Quelqu'un sur le réseau ce soir ?", + "themes_previewOutgoing": "Fort et clair !", + "themes_previewSwitch": "Notifications", + "themes_lowContrast": "L'accent est difficile à voir sur ce fond", + "themes_saveAndUse": "Enregistrer et utiliser", + "themes_icons": "Icônes", + "themes_iconsHelp": "Touchez une icône pour la remplacer par une autre icône ou par votre propre image", + "themes_iconChanged": "Modifiée", + "themes_iconSend": "Bouton d'envoi", + "themes_iconRepeater": "Répéteurs", + "themes_iconRoom": "Rooms", + "themes_iconSensor": "Capteurs", + "themes_mapMarkers": "Marqueurs de la carte", + "themes_mapMarkersHelp": "Remplacez les marqueurs des nœuds et le vôtre sur la carte", + "themes_iconUsePicture": "Utiliser une image", + "themes_iconReset": "Utiliser l'icône par défaut", + "themes_iconPictureFailed": "Impossible d'utiliser cette image", + "themes_exportFile": "Exporter vers un fichier", + "themes_exportAll": "Exporter mes thèmes", + "themes_importFile": "Importer depuis un fichier", + "themes_pasteCode": "Coller le code du thème", + "themes_exportFailed": "Impossible d'exporter les thèmes", + "themes_importFileResult": "{count} thèmes importés", + "themes_importFileNone": "Aucun thème trouvé dans ce fichier", + "chatBackground_title": "Fond de discussion", + "chatBackground_thisChatOnly": "Seulement pour cette discussion", + "chatBackground_themeOverrides": "Votre thème « {name} » définit le fond dans toutes les discussions. Désactivez cette option dans le thème pour utiliser celui-ci.", + "chatBackground_none": "Aucun", + "chatBackground_picture": "Image", + "chatBackground_choosePicture": "Choisir une image", + "chatBackground_pictureFailed": "Impossible d'utiliser cette image", + "chatBackground_fade": "Atténuation", + "themes_chatBackground": "Fond de discussion", + "themes_chatBackgroundHelp": "Affiché dans les discussions qui n'ont pas leur propre fond", + "themes_chatBackgroundEverywhere": "Utiliser dans toutes les discussions", + "themes_chatBackgroundEverywhereHelp": "Remplace aussi les fonds définis pour chaque discussion" } diff --git a/lib/l10n/app_hu.arb b/lib/l10n/app_hu.arb index 7a4d652b..441a6f3e 100644 --- a/lib/l10n/app_hu.arb +++ b/lib/l10n/app_hu.arb @@ -3491,5 +3491,79 @@ "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|Boldog Halloweent kívánok|Vidám Halloweent|Happy Halloween", + "holidayGreeting_thanksgiving": "Boldog hálaadást|Boldog hálaadás napot|Boldog Thanksgivinget|Happy Thanksgiving", + "holidayGreeting_christmas": "Boldog karácsonyt|Kellemes karácsonyi ünnepeket|Kellemes ünnepeket|Áldott karácsonyt|Merry Christmas", + "holidayGreeting_newYear": "Boldog új évet|Boldog újévet|Boldog új esztendőt|BÚÉK|Happy New Year", + "appSettings_colorTheme": "Színtéma", + "appSettings_holidayAnimations": "Ünnepi üzenet-animációk", + "appSettings_holidayAnimationsSubtitle": "Denevérek, pulyka, Mikulás vagy tűzijáték, ha valaki ünnepi jókívánságot küld", + "themes_title": "Témák", + "themes_default": "MeshCore", + "themes_defaultSubtitle": "Alapszínek, a Világos / Sötét beállítást követi", + "themes_builtIn": "Beépített", + "themes_holidays": "Ünnepek", + "themes_holidayAutoSwitch": "Automatikus váltás", + "themes_holidayAutoSwitchSubtitle": "Minden ünnep témáját használja az ünnep előtt 17 nappal kezdve, magán az ünnepen is", + "themes_holidayAutoApplied": "A(z) {holiday} téma automatikusan be van kapcsolva. Az ünnep után visszaáll a saját témád.", + "themes_holidayAutoAppliedTag": "Automatikusan bekapcsolva", + "themes_myThemes": "Saját témáim", + "themes_myThemesEmpty": "Készíts saját témát egy háttér és egy kiemelőszín kiválasztásával.", + "themes_create": "Téma létrehozása", + "themes_import": "Téma importálása", + "themes_importHint": "Illeszd be a téma kódját", + "themes_importInvalid": "Ez nem érvényes témakód", + "themes_imported": "A(z) „{name}” téma hozzáadva", + "themes_customize": "Másolat testreszabása", + "themes_copyCode": "Témakód másolása", + "themes_codeCopied": "Témakód másolva", + "themes_deleteConfirm": "Törlöd a(z) „{name}” témát?", + "themes_copyName": "{name} másolata", + "themes_newTitle": "Új téma", + "themes_editTitle": "Téma szerkesztése", + "themes_name": "Név", + "themes_nameRequired": "Adj nevet a témádnak", + "themes_background": "Háttér", + "themes_backgroundHelp": "Sötét háttérrel sötét téma lesz", + "themes_accent": "Kiemelőszín", + "themes_accentHelp": "Gombok, kiemelések és a saját üzenetbuborékaid", + "themes_hexColor": "Hexa színkód", + "themes_preview": "Előnézet", + "themes_previewIncoming": "Van valaki a hálón ma este?", + "themes_previewOutgoing": "Hangosan és tisztán!", + "themes_previewSwitch": "Értesítések", + "themes_lowContrast": "A kiemelőszín nehezen látszik ezen a háttéren", + "themes_saveAndUse": "Mentés és használat", + "themes_icons": "Ikonok", + "themes_iconsHelp": "Koppints egy ikonra, hogy másik ikonra vagy saját képre cseréld", + "themes_iconChanged": "Módosítva", + "themes_iconSend": "Küldés gomb", + "themes_iconRepeater": "Átjátszók", + "themes_iconRoom": "Szobák", + "themes_iconSensor": "Érzékelők", + "themes_mapMarkers": "Térképjelölők", + "themes_mapMarkersHelp": "Cseréld le a csomópontok és a te jelölődet a térképen", + "themes_iconUsePicture": "Kép használata", + "themes_iconReset": "Alapértelmezett ikon használata", + "themes_iconPictureFailed": "Ezt a képet nem sikerült használni", + "themes_exportFile": "Exportálás fájlba", + "themes_exportAll": "Témáim exportálása", + "themes_importFile": "Importálás fájlból", + "themes_pasteCode": "Témakód beillesztése", + "themes_exportFailed": "A témákat nem sikerült exportálni", + "themes_importFileResult": "{count} téma importálva", + "themes_importFileNone": "Nem található téma ebben a fájlban", + "chatBackground_title": "Csevegés háttere", + "chatBackground_thisChatOnly": "Csak ennél a csevegésnél", + "chatBackground_themeOverrides": "A(z) „{name}” témád minden csevegésben beállítja a hátteret. Kapcsold ki ezt a témában, hogy ezt használhasd.", + "chatBackground_none": "Nincs", + "chatBackground_picture": "Kép", + "chatBackground_choosePicture": "Kép kiválasztása", + "chatBackground_pictureFailed": "Ezt a képet nem sikerült használni", + "chatBackground_fade": "Halványítás", + "themes_chatBackground": "Csevegés háttere", + "themes_chatBackgroundHelp": "Azokban a csevegésekben jelenik meg, amelyeknek nincs saját hátterük", + "themes_chatBackgroundEverywhere": "Használat minden csevegésben", + "themes_chatBackgroundEverywhereHelp": "Az egyes csevegésekhez beállított hátteret is felülírja" } diff --git a/lib/l10n/app_it.arb b/lib/l10n/app_it.arb index b189fa13..111bedf6 100644 --- a/lib/l10n/app_it.arb +++ b/lib/l10n/app_it.arb @@ -3586,5 +3586,79 @@ }, "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|Happy Halloween", + "holidayGreeting_thanksgiving": "Buon Ringraziamento|Buon Thanksgiving|Felice Ringraziamento|Felice Thanksgiving|Happy Thanksgiving", + "holidayGreeting_christmas": "Buon Natale|Buone Feste|Felice Natale|Merry Christmas", + "holidayGreeting_newYear": "Felice Anno Nuovo|Buon Anno Nuovo|Buon Capodanno|Buon Anno|Felice Anno|Felice Capodanno|Happy New Year", + "appSettings_colorTheme": "Tema colori", + "appSettings_holidayAnimations": "Animazioni dei messaggi di festa", + "appSettings_holidayAnimationsSubtitle": "Pipistrelli, tacchino, Babbo Natale o fuochi d'artificio quando qualcuno invia un augurio di festa", + "themes_title": "Temi", + "themes_default": "MeshCore", + "themes_defaultSubtitle": "Colori standard, segue l'impostazione Chiaro / Scuro", + "themes_builtIn": "Integrati", + "themes_holidays": "Festività", + "themes_holidayAutoSwitch": "Cambia automaticamente", + "themes_holidayAutoSwitchSubtitle": "Usa il tema di ogni festività da 17 giorni prima fino al giorno stesso", + "themes_holidayAutoApplied": "Il tema {holiday} è attivo automaticamente. Il tuo tema tornerà dopo la festività.", + "themes_holidayAutoAppliedTag": "Attivo automaticamente", + "themes_myThemes": "I miei temi", + "themes_myThemesEmpty": "Crea il tuo tema scegliendo uno sfondo e un colore di risalto.", + "themes_create": "Crea tema", + "themes_import": "Importa tema", + "themes_importHint": "Incolla un codice tema", + "themes_importInvalid": "Questo non è un codice tema valido", + "themes_imported": "Tema \"{name}\" aggiunto", + "themes_customize": "Personalizza una copia", + "themes_copyCode": "Copia codice tema", + "themes_codeCopied": "Codice tema copiato", + "themes_deleteConfirm": "Eliminare il tema \"{name}\"?", + "themes_copyName": "Copia di {name}", + "themes_newTitle": "Nuovo tema", + "themes_editTitle": "Modifica tema", + "themes_name": "Nome", + "themes_nameRequired": "Dai un nome al tuo tema", + "themes_background": "Sfondo", + "themes_backgroundHelp": "Uno sfondo scuro crea un tema scuro", + "themes_accent": "Colore di risalto", + "themes_accentHelp": "Pulsanti, elementi evidenziati e i tuoi fumetti nella chat", + "themes_hexColor": "Colore esadecimale", + "themes_preview": "Anteprima", + "themes_previewIncoming": "C'è qualcuno sulla mesh stasera?", + "themes_previewOutgoing": "Forte e chiaro!", + "themes_previewSwitch": "Notifiche", + "themes_lowContrast": "Il colore di risalto si vede male su questo sfondo", + "themes_saveAndUse": "Salva e usa", + "themes_icons": "Icone", + "themes_iconsHelp": "Tocca un'icona per sostituirla con un'altra icona o con una tua immagine", + "themes_iconChanged": "Modificata", + "themes_iconSend": "Pulsante di invio", + "themes_iconRepeater": "Ripetitori", + "themes_iconRoom": "Stanze", + "themes_iconSensor": "Sensori", + "themes_mapMarkers": "Indicatori della mappa", + "themes_mapMarkersHelp": "Sostituisci gli indicatori dei nodi e il tuo sulla mappa", + "themes_iconUsePicture": "Usa un'immagine", + "themes_iconReset": "Usa l'icona predefinita", + "themes_iconPictureFailed": "Impossibile usare questa immagine", + "themes_exportFile": "Esporta su file", + "themes_exportAll": "Esporta i miei temi", + "themes_importFile": "Importa da file", + "themes_pasteCode": "Incolla codice tema", + "themes_exportFailed": "Impossibile esportare i temi", + "themes_importFileResult": "Importati {count} temi", + "themes_importFileNone": "Nessun tema trovato in questo file", + "chatBackground_title": "Sfondo della chat", + "chatBackground_thisChatOnly": "Solo per questa chat", + "chatBackground_themeOverrides": "Il tuo tema \"{name}\" imposta lo sfondo in tutte le chat. Disattivalo nel tema per usare questo.", + "chatBackground_none": "Nessuno", + "chatBackground_picture": "Immagine", + "chatBackground_choosePicture": "Scegli un'immagine", + "chatBackground_pictureFailed": "Impossibile usare questa immagine", + "chatBackground_fade": "Dissolvenza", + "themes_chatBackground": "Sfondo della chat", + "themes_chatBackgroundHelp": "Mostrato nelle chat che non hanno uno sfondo proprio", + "themes_chatBackgroundEverywhere": "Usa in tutte le chat", + "themes_chatBackgroundEverywhereHelp": "Sostituisce anche gli sfondi impostati sulle singole chat" } diff --git a/lib/l10n/app_ja.arb b/lib/l10n/app_ja.arb index 667dfd64..b45310db 100644 --- a/lib/l10n/app_ja.arb +++ b/lib/l10n/app_ja.arb @@ -3586,5 +3586,79 @@ }, "networkMap_sourceLocalHint": "ラジオが受信したノード", "networkMap_sourceOnlineHint": "オンラインネットワークマップのリピータ", - "networkMap_sourceBothHint": "ラジオのノードとオンラインネットワークマップ" + "networkMap_sourceBothHint": "ラジオのノードとオンラインネットワークマップ", + "appSettings_colorTheme": "カラーテーマ", + "appSettings_holidayAnimations": "祝日メッセージのアニメーション", + "appSettings_holidayAnimationsSubtitle": "祝日のあいさつが届くと、コウモリ、七面鳥、サンタ、花火が表示されます", + "themes_title": "テーマ", + "themes_default": "MeshCore", + "themes_defaultSubtitle": "標準の色。ライト/ダークの設定に合わせます", + "themes_builtIn": "標準のテーマ", + "themes_holidays": "祝日", + "themes_holidayAutoSwitch": "自動で切り替える", + "themes_holidayAutoSwitchSubtitle": "各祝日の17日前から当日まで、その祝日のテーマを使います", + "themes_holidayAutoApplied": "{holiday}のテーマを自動で使っています。祝日が終わると、元のテーマに戻ります。", + "themes_holidayAutoAppliedTag": "自動で使用中", + "themes_myThemes": "マイテーマ", + "themes_myThemesEmpty": "背景とアクセントカラーを選んで、自分だけのテーマを作りましょう。", + "themes_create": "テーマを作成", + "themes_import": "テーマを読み込む", + "themes_importHint": "テーマコードを貼り付けてください", + "themes_importInvalid": "テーマコードが正しくありません", + "themes_imported": "テーマ「{name}」を追加しました", + "themes_customize": "コピーして編集", + "themes_copyCode": "テーマコードをコピー", + "themes_codeCopied": "テーマコードをコピーしました", + "themes_deleteConfirm": "テーマ「{name}」を削除しますか?", + "themes_copyName": "{name}のコピー", + "themes_newTitle": "新しいテーマ", + "themes_editTitle": "テーマを編集", + "themes_name": "名前", + "themes_nameRequired": "テーマの名前を入力してください", + "themes_background": "背景", + "themes_backgroundHelp": "背景が暗いと、ダークテーマになります", + "themes_accent": "アクセント", + "themes_accentHelp": "ボタン、強調表示、自分のチャットの吹き出しに使います", + "themes_hexColor": "16進数カラー", + "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": "{count}件のテーマを読み込みました", + "themes_importFileNone": "そのファイルにテーマが見つかりません", + "chatBackground_title": "チャットの背景", + "chatBackground_thisChatOnly": "このチャットだけ", + "chatBackground_themeOverrides": "テーマ「{name}」が、すべてのチャットの背景を指定しています。この背景を使うには、テーマ側でその設定をオフにしてください。", + "chatBackground_none": "なし", + "chatBackground_picture": "画像", + "chatBackground_choosePicture": "画像を選ぶ", + "chatBackground_pictureFailed": "その画像は使えませんでした", + "chatBackground_fade": "薄さ", + "themes_chatBackground": "チャットの背景", + "themes_chatBackgroundHelp": "個別の背景がないチャットに表示されます", + "themes_chatBackgroundEverywhere": "すべてのチャットで使う", + "themes_chatBackgroundEverywhereHelp": "チャットごとに設定した背景も置き換えます", + "holidayGreeting_halloween": "ハッピーハロウィン|ハッピーハロウィーン|ハッピーハロウィン|ハピハロ|トリックオアトリート|Happy Halloween", + "holidayGreeting_thanksgiving": "ハッピーサンクスギビング|ハッピー・サンクスギビング|感謝祭おめでとう|Happy Thanksgiving", + "holidayGreeting_christmas": "メリークリスマス|メリー・クリスマス|メリクリ|Merry Christmas", + "holidayGreeting_newYear": "あけましておめでとう|明けましておめでとう|あけおめ|アケオメ|ハッピーニューイヤー|ハッピー・ニューイヤー|謹賀新年|Happy New Year" } diff --git a/lib/l10n/app_ko.arb b/lib/l10n/app_ko.arb index 25ec5a34..c9a44d90 100644 --- a/lib/l10n/app_ko.arb +++ b/lib/l10n/app_ko.arb @@ -3586,5 +3586,79 @@ }, "networkMap_sourceLocalHint": "내 라디오가 수신한 노드", "networkMap_sourceOnlineHint": "온라인 네트워크 지도의 리피터", - "networkMap_sourceBothHint": "내 라디오의 노드와 온라인 네트워크 지도" + "networkMap_sourceBothHint": "내 라디오의 노드와 온라인 네트워크 지도", + "appSettings_colorTheme": "색상 테마", + "appSettings_holidayAnimations": "명절 메시지 애니메이션", + "appSettings_holidayAnimationsSubtitle": "누군가 명절 인사를 보내면 박쥐, 칠면조, 산타, 불꽃놀이가 나타납니다", + "themes_title": "테마", + "themes_default": "MeshCore", + "themes_defaultSubtitle": "기본 색상, 밝음/어두움 설정을 따릅니다", + "themes_builtIn": "기본 제공", + "themes_holidays": "명절", + "themes_holidayAutoSwitch": "자동으로 바꾸기", + "themes_holidayAutoSwitchSubtitle": "명절 17일 전부터 당일까지 그 명절 테마를 사용합니다", + "themes_holidayAutoApplied": "{holiday} 테마가 자동으로 켜져 있습니다. 명절이 끝나면 내 테마로 돌아갑니다.", + "themes_holidayAutoAppliedTag": "자동 적용 중", + "themes_myThemes": "내 테마", + "themes_myThemesEmpty": "배경과 강조 색을 골라 나만의 테마를 만들어 보세요.", + "themes_create": "테마 만들기", + "themes_import": "테마 가져오기", + "themes_importHint": "테마 코드를 붙여넣으세요", + "themes_importInvalid": "올바른 테마 코드가 아닙니다", + "themes_imported": "테마 \"{name}\"을(를) 추가했습니다", + "themes_customize": "복사본 꾸미기", + "themes_copyCode": "테마 코드 복사", + "themes_codeCopied": "테마 코드를 복사했습니다", + "themes_deleteConfirm": "테마 \"{name}\"을(를) 삭제할까요?", + "themes_copyName": "{name} 복사본", + "themes_newTitle": "새 테마", + "themes_editTitle": "테마 편집", + "themes_name": "이름", + "themes_nameRequired": "테마 이름을 입력하세요", + "themes_background": "배경", + "themes_backgroundHelp": "어두운 배경을 고르면 어두운 테마가 됩니다", + "themes_accent": "강조 색", + "themes_accentHelp": "버튼, 강조 표시, 내 말풍선에 쓰입니다", + "themes_hexColor": "16진수 색상", + "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": "테마 {count}개를 가져왔습니다", + "themes_importFileNone": "그 파일에서 테마를 찾지 못했습니다", + "chatBackground_title": "채팅 배경", + "chatBackground_thisChatOnly": "이 채팅에만 적용", + "chatBackground_themeOverrides": "내 테마 \"{name}\"이(가) 모든 채팅의 배경을 정하고 있습니다. 이 배경을 쓰려면 테마에서 그 설정을 끄세요.", + "chatBackground_none": "없음", + "chatBackground_picture": "사진", + "chatBackground_choosePicture": "사진 선택", + "chatBackground_pictureFailed": "그 사진을 사용할 수 없습니다", + "chatBackground_fade": "흐리게", + "themes_chatBackground": "채팅 배경", + "themes_chatBackgroundHelp": "따로 배경이 없는 채팅에 표시됩니다", + "themes_chatBackgroundEverywhere": "모든 채팅에 사용", + "themes_chatBackgroundEverywhereHelp": "개별 채팅에 정한 배경도 바뀝니다", + "holidayGreeting_halloween": "해피 할로윈|즐거운 할로윈|행복한 할로윈|할로윈 축하해|할로윈 잘 보내세요|트릭 오어 트릿|해피 할로윈데이", + "holidayGreeting_thanksgiving": "해피 땡스기빙|즐거운 추수감사절|행복한 추수감사절|추수감사절 잘 보내세요|추수감사절 축하해요|해피 땡스기빙데이", + "holidayGreeting_christmas": "메리 크리스마스|즐거운 성탄절|즐거운 크리스마스|행복한 성탄절|성탄 축하드립니다|메리 크리스마스 되세요|해피 크리스마스|메리 크리스마스 이브", + "holidayGreeting_newYear": "새해 복 많이 받으세요|새해 복 많이 받아|새해 복 많이 받으십시오|새해 복 많이 받아요|해피 뉴 이어|해피 뉴이어|즐거운 새해|행복한 새해" } diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 6899c3de..bd9c23d7 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: @@ -11028,6 +11448,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 3c27223b..2779c65d 100644 --- a/lib/l10n/app_localizations_bg.dart +++ b/lib/l10n/app_localizations_bg.dart @@ -830,6 +830,239 @@ class AppLocalizationsBg extends AppLocalizations { @override String get appSettings_themeDark => 'Тъмна'; + @override + String get appSettings_colorTheme => 'Цветова тема'; + + @override + String get appSettings_holidayAnimations => + 'Анимации за празници в съобщенията'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Прилепи, пуйка, Дядо Коледа или фойерверки, когато някой изпрати празнично пожелание'; + + @override + String get themes_title => 'Теми'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Стандартни цветове, следва настройката Светла / Тъмна'; + + @override + String get themes_builtIn => 'Вградени'; + + @override + String get themes_holidays => 'Празници'; + + @override + String get themes_holidayAutoSwitch => 'Превключвай автоматично'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Използва темата на всеки празник от 17 дни преди него до самия ден'; + + @override + String themes_holidayAutoApplied(String holiday) { + return 'Темата „$holiday“ е включена автоматично. Вашата тема се връща след празника.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'Включена автоматично'; + + @override + String get themes_myThemes => 'Моите теми'; + + @override + String get themes_myThemesEmpty => + 'Направете своя тема, като изберете фон и акцентен цвят.'; + + @override + String get themes_create => 'Създай тема'; + + @override + String get themes_import => 'Импортирай тема'; + + @override + String get themes_importHint => 'Поставете код на тема'; + + @override + String get themes_importInvalid => 'Това не е валиден код на тема'; + + @override + String themes_imported(String name) { + return 'Добавена тема „$name“'; + } + + @override + String get themes_customize => 'Персонализирай копие'; + + @override + String get themes_copyCode => 'Копирай кода на темата'; + + @override + String get themes_codeCopied => 'Кодът на темата е копиран'; + + @override + String themes_deleteConfirm(String name) { + return 'Да изтрия ли темата „$name“?'; + } + + @override + String themes_copyName(String name) { + return '$name (копие)'; + } + + @override + String get themes_newTitle => 'Нова тема'; + + @override + String get themes_editTitle => 'Редактиране на тема'; + + @override + String get themes_name => 'Име'; + + @override + String get themes_nameRequired => 'Дайте име на темата си'; + + @override + String get themes_background => 'Фон'; + + @override + String get themes_backgroundHelp => 'Тъмният фон прави тъмна тема'; + + @override + String get themes_accent => 'Акцент'; + + @override + String get themes_accentHelp => + 'Бутони, подчертавания и вашите балончета със съобщения'; + + @override + String get themes_hexColor => 'Шестнадесетичен цвят'; + + @override + String get themes_preview => 'Преглед'; + + @override + String get themes_previewIncoming => 'Има ли някой в мрежата тази вечер?'; + + @override + String get themes_previewOutgoing => 'Чувам ви ясно и силно!'; + + @override + String get themes_previewSwitch => 'Известия'; + + @override + String get themes_lowContrast => 'Акцентът трудно се вижда на този фон'; + + @override + String get themes_saveAndUse => 'Запази и използвай'; + + @override + String get themes_icons => 'Икони'; + + @override + String get themes_iconsHelp => + 'Докоснете икона, за да я смените с друга икона или със своя снимка'; + + @override + String get themes_iconChanged => 'Променена'; + + @override + String get themes_iconSend => 'Бутон за изпращане'; + + @override + String get themes_iconRepeater => 'Повторители'; + + @override + String get themes_iconRoom => 'Стаи'; + + @override + String get themes_iconSensor => 'Сензори'; + + @override + String get themes_mapMarkers => 'Маркери на картата'; + + @override + String get themes_mapMarkersHelp => + 'Сменете маркерите за възлите и за вас на картата'; + + @override + String get themes_iconUsePicture => 'Използвай снимка'; + + @override + String get themes_iconReset => 'Използвай иконата по подразбиране'; + + @override + String get themes_iconPictureFailed => 'Тази снимка не може да се използва'; + + @override + String get themes_exportFile => 'Експортирай във файл'; + + @override + String get themes_exportAll => 'Експортирай моите теми'; + + @override + String get themes_importFile => 'Импортирай от файл'; + + @override + String get themes_pasteCode => 'Поставете код на тема'; + + @override + String get themes_exportFailed => 'Темите не можаха да се експортират'; + + @override + String themes_importFileResult(int count) { + return 'Импортирани теми: $count'; + } + + @override + String get themes_importFileNone => 'Във файла не са намерени теми'; + + @override + String get chatBackground_title => 'Фон на чата'; + + @override + String get chatBackground_thisChatOnly => 'Само за този чат'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Вашата тема „$name“ задава фона във всички чатове. Изключете това в темата, за да използвате този фон.'; + } + + @override + String get chatBackground_none => 'Няма'; + + @override + String get chatBackground_picture => 'Снимка'; + + @override + String get chatBackground_choosePicture => 'Избери снимка'; + + @override + String get chatBackground_pictureFailed => + 'Тази снимка не може да се използва'; + + @override + String get chatBackground_fade => 'Избледняване'; + + @override + String get themes_chatBackground => 'Фон на чата'; + + @override + String get themes_chatBackgroundHelp => + 'Показва се в чатове, които нямат свой фон'; + + @override + String get themes_chatBackgroundEverywhere => 'Използвай във всички чатове'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Заменя и фоновете, зададени на отделни чатове'; + @override String get appSettings_language => 'Език'; @@ -6593,4 +6826,20 @@ class AppLocalizationsBg extends AppLocalizations { @override String get networkMap_unnamed => 'Неназован повторител'; + + @override + String get holidayGreeting_halloween => + 'Честит Хелоуин|Весел Хелоуин|Happy Halloween'; + + @override + String get holidayGreeting_thanksgiving => + 'Честит Ден на благодарността|Честит Thanksgiving|Happy Thanksgiving'; + + @override + String get holidayGreeting_christmas => + 'Весела Коледа|Честито Рождество|Честита Коледа|Весели празници|Merry Christmas'; + + @override + String get holidayGreeting_newYear => + 'Честита Нова година|Щастлива Нова година|Happy New Year'; } diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart index 141491bf..105806d7 100644 --- a/lib/l10n/app_localizations_de.dart +++ b/lib/l10n/app_localizations_de.dart @@ -825,6 +825,243 @@ class AppLocalizationsDe extends AppLocalizations { @override String get appSettings_themeDark => 'Dunkel'; + @override + String get appSettings_colorTheme => 'Farbdesign'; + + @override + String get appSettings_holidayAnimations => + 'Feiertags-Animationen in Nachrichten'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Fledermäuse, ein Truthahn, der Weihnachtsmann oder Feuerwerk, wenn jemand einen Feiertagsgruß schreibt'; + + @override + String get themes_title => 'Designs'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Standardfarben, folgt der Einstellung Hell / Dunkel'; + + @override + String get themes_builtIn => 'Vorinstalliert'; + + @override + String get themes_holidays => 'Feiertage'; + + @override + String get themes_holidayAutoSwitch => 'Automatisch wechseln'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Nutzt das Design jedes Feiertags ab 17 Tage vorher bis zum Feiertag selbst'; + + @override + String themes_holidayAutoApplied(String holiday) { + return 'Das Design „$holiday“ ist automatisch aktiv. Nach dem Feiertag kommt Ihr eigenes Design zurück.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'Automatisch aktiv'; + + @override + String get themes_myThemes => 'Meine Designs'; + + @override + String get themes_myThemesEmpty => + 'Erstellen Sie ein eigenes Design, indem Sie einen Hintergrund und eine Akzentfarbe wählen.'; + + @override + String get themes_create => 'Design erstellen'; + + @override + String get themes_import => 'Design importieren'; + + @override + String get themes_importHint => 'Design-Code einfügen'; + + @override + String get themes_importInvalid => 'Das ist kein gültiger Design-Code'; + + @override + String themes_imported(String name) { + return 'Design „$name“ hinzugefügt'; + } + + @override + String get themes_customize => 'Kopie anpassen'; + + @override + String get themes_copyCode => 'Design-Code kopieren'; + + @override + String get themes_codeCopied => 'Design-Code kopiert'; + + @override + String themes_deleteConfirm(String name) { + return 'Design „$name“ löschen?'; + } + + @override + String themes_copyName(String name) { + return '$name Kopie'; + } + + @override + String get themes_newTitle => 'Neues Design'; + + @override + String get themes_editTitle => 'Design bearbeiten'; + + @override + String get themes_name => 'Name'; + + @override + String get themes_nameRequired => 'Geben Sie Ihrem Design einen Namen'; + + @override + String get themes_background => 'Hintergrund'; + + @override + String get themes_backgroundHelp => + 'Ein dunkler Hintergrund ergibt ein dunkles Design'; + + @override + String get themes_accent => 'Akzent'; + + @override + String get themes_accentHelp => + 'Schaltflächen, Hervorhebungen und Ihre Chat-Blasen'; + + @override + String get themes_hexColor => 'Hex-Farbe'; + + @override + String get themes_preview => 'Vorschau'; + + @override + String get themes_previewIncoming => 'Ist heute Abend jemand im Mesh?'; + + @override + String get themes_previewOutgoing => 'Laut und deutlich!'; + + @override + String get themes_previewSwitch => 'Benachrichtigungen'; + + @override + String get themes_lowContrast => + 'Der Akzent ist auf diesem Hintergrund schlecht zu sehen'; + + @override + String get themes_saveAndUse => 'Speichern und verwenden'; + + @override + String get themes_icons => 'Symbole'; + + @override + String get themes_iconsHelp => + 'Tippen Sie auf ein Symbol, um es durch ein anderes Symbol oder ein eigenes Bild zu ersetzen'; + + @override + String get themes_iconChanged => 'Geändert'; + + @override + String get themes_iconSend => 'Senden-Schaltfläche'; + + @override + String get themes_iconRepeater => 'Repeater'; + + @override + String get themes_iconRoom => 'Raumserver'; + + @override + String get themes_iconSensor => 'Sensoren'; + + @override + String get themes_mapMarkers => 'Kartenmarkierungen'; + + @override + String get themes_mapMarkersHelp => + 'Ersetzen Sie die Markierungen für Knoten und für Sie selbst auf der Karte'; + + @override + String get themes_iconUsePicture => 'Bild verwenden'; + + @override + String get themes_iconReset => 'Standardsymbol verwenden'; + + @override + String get themes_iconPictureFailed => + 'Das Bild konnte nicht verwendet werden'; + + @override + String get themes_exportFile => 'In Datei exportieren'; + + @override + String get themes_exportAll => 'Meine Designs exportieren'; + + @override + String get themes_importFile => 'Aus Datei importieren'; + + @override + String get themes_pasteCode => 'Design-Code einfügen'; + + @override + String get themes_exportFailed => 'Designs konnten nicht exportiert werden'; + + @override + String themes_importFileResult(int count) { + return '$count Designs importiert'; + } + + @override + String get themes_importFileNone => + 'In dieser Datei wurden keine Designs gefunden'; + + @override + String get chatBackground_title => 'Chat-Hintergrund'; + + @override + String get chatBackground_thisChatOnly => 'Nur für diesen Chat'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Ihr Design „$name“ legt den Hintergrund in jedem Chat fest. Schalten Sie das im Design aus, um diesen zu verwenden.'; + } + + @override + String get chatBackground_none => 'Kein Hintergrund'; + + @override + String get chatBackground_picture => 'Bild'; + + @override + String get chatBackground_choosePicture => 'Bild auswählen'; + + @override + String get chatBackground_pictureFailed => + 'Das Bild konnte nicht verwendet werden'; + + @override + String get chatBackground_fade => 'Abblenden'; + + @override + String get themes_chatBackground => 'Chat-Hintergrund'; + + @override + String get themes_chatBackgroundHelp => + 'Wird in Chats gezeigt, die keinen eigenen Hintergrund haben'; + + @override + String get themes_chatBackgroundEverywhere => 'In jedem Chat verwenden'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Ersetzt auch Hintergründe, die für einzelne Chats gesetzt wurden'; + @override String get appSettings_language => 'Sprache'; @@ -6601,4 +6838,20 @@ class AppLocalizationsDe extends AppLocalizations { @override String get networkMap_unnamed => 'Unbenannter Repeater'; + + @override + String get holidayGreeting_halloween => + 'Frohes Halloween|Fröhliches Halloween|Happy Halloween|Schaurig schönes Halloween|Gruselige Halloween|Süßes oder Saures'; + + @override + String get holidayGreeting_thanksgiving => + 'Frohes Thanksgiving|Schönes Thanksgiving|Frohes Erntedankfest|Happy Thanksgiving|Schönes Erntedankfest'; + + @override + String get holidayGreeting_christmas => + 'Frohe Weihnachten|Fröhliche Weihnachten|Frohes Fest|Schöne Weihnachten|Merry Christmas|Gesegnete Weihnachten|Frohe Weihnachtstage'; + + @override + String get holidayGreeting_newYear => + 'Frohes neues Jahr|Gutes neues Jahr|Guten Rutsch|Prosit Neujahr|Happy New Year|Ein gutes neues Jahr|Guten Rutsch ins neue Jahr|Frohes Neues'; } diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 56c6b596..83564176 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'; @@ -6496,4 +6727,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 506ce407..072a7c5f 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 => 'Tema de color'; + + @override + String get appSettings_holidayAnimations => + 'Animaciones de mensajes festivos'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Murciélagos, un pavo, Papá Noel o fuegos artificiales cuando alguien envía un saludo festivo'; + + @override + String get themes_title => 'Temas'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Colores estándar, sigue el ajuste Claro / Oscuro'; + + @override + String get themes_builtIn => 'Incluidos'; + + @override + String get themes_holidays => 'Fiestas'; + + @override + String get themes_holidayAutoSwitch => 'Cambiar automáticamente'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Usa el tema de cada fiesta desde 17 días antes hasta el día mismo'; + + @override + String themes_holidayAutoApplied(String holiday) { + return 'El tema de $holiday se activó automáticamente. Tu propio tema vuelve después de la fiesta.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'Activado automáticamente'; + + @override + String get themes_myThemes => 'Mis temas'; + + @override + String get themes_myThemesEmpty => + 'Crea tu propio tema eligiendo un fondo y un color de acento.'; + + @override + String get themes_create => 'Crear tema'; + + @override + String get themes_import => 'Importar tema'; + + @override + String get themes_importHint => 'Pega un código de tema'; + + @override + String get themes_importInvalid => 'Ese no es un código de tema válido'; + + @override + String themes_imported(String name) { + return 'Se agregó el tema \"$name\"'; + } + + @override + String get themes_customize => 'Personalizar una copia'; + + @override + String get themes_copyCode => 'Copiar código del tema'; + + @override + String get themes_codeCopied => 'Código del tema copiado'; + + @override + String themes_deleteConfirm(String name) { + return '¿Eliminar el tema \"$name\"?'; + } + + @override + String themes_copyName(String name) { + return 'Copia de $name'; + } + + @override + String get themes_newTitle => 'Tema nuevo'; + + @override + String get themes_editTitle => 'Editar tema'; + + @override + String get themes_name => 'Nombre'; + + @override + String get themes_nameRequired => 'Ponle un nombre a tu tema'; + + @override + String get themes_background => 'Fondo'; + + @override + String get themes_backgroundHelp => 'Un fondo oscuro crea un tema oscuro'; + + @override + String get themes_accent => 'Acento'; + + @override + String get themes_accentHelp => 'Botones, resaltados y tus burbujas de chat'; + + @override + String get themes_hexColor => 'Color hexadecimal'; + + @override + String get themes_preview => 'Vista previa'; + + @override + String get themes_previewIncoming => '¿Alguien en la malla esta noche?'; + + @override + String get themes_previewOutgoing => '¡Fuerte y claro!'; + + @override + String get themes_previewSwitch => 'Notificaciones'; + + @override + String get themes_lowContrast => 'El acento casi no se ve sobre este fondo'; + + @override + String get themes_saveAndUse => 'Guardar y usar'; + + @override + String get themes_icons => 'Iconos'; + + @override + String get themes_iconsHelp => + 'Toca un icono para cambiarlo por otro icono o por tu propia imagen'; + + @override + String get themes_iconChanged => 'Cambiado'; + + @override + String get themes_iconSend => 'Botón de enviar'; + + @override + String get themes_iconRepeater => 'Repetidores'; + + @override + String get themes_iconRoom => 'Salas'; + + @override + String get themes_iconSensor => 'Sensores'; + + @override + String get themes_mapMarkers => 'Marcadores del mapa'; + + @override + String get themes_mapMarkersHelp => + 'Cambia los marcadores de los nodos y el tuyo en el mapa'; + + @override + String get themes_iconUsePicture => 'Usar una imagen'; + + @override + String get themes_iconReset => 'Usar el icono predeterminado'; + + @override + String get themes_iconPictureFailed => 'No se pudo usar esa imagen'; + + @override + String get themes_exportFile => 'Exportar a archivo'; + + @override + String get themes_exportAll => 'Exportar mis temas'; + + @override + String get themes_importFile => 'Importar desde archivo'; + + @override + String get themes_pasteCode => 'Pegar código del tema'; + + @override + String get themes_exportFailed => 'No se pudieron exportar los temas'; + + @override + String themes_importFileResult(int count) { + return 'Se importaron $count temas'; + } + + @override + String get themes_importFileNone => 'No se encontraron temas en ese archivo'; + + @override + String get chatBackground_title => 'Fondo del chat'; + + @override + String get chatBackground_thisChatOnly => 'Solo para este chat'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Tu tema \"$name\" define el fondo en todos los chats. Desactívalo en el tema para usar este.'; + } + + @override + String get chatBackground_none => 'Ninguno'; + + @override + String get chatBackground_picture => 'Imagen'; + + @override + String get chatBackground_choosePicture => 'Elegir una imagen'; + + @override + String get chatBackground_pictureFailed => 'No se pudo usar esa imagen'; + + @override + String get chatBackground_fade => 'Difuminado'; + + @override + String get themes_chatBackground => 'Fondo del chat'; + + @override + String get themes_chatBackgroundHelp => + 'Se muestra en los chats que no tienen fondo propio'; + + @override + String get themes_chatBackgroundEverywhere => 'Usar en todos los chats'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'También reemplaza los fondos de chats individuales'; + @override String get appSettings_language => 'Idioma'; @@ -6592,4 +6823,20 @@ class AppLocalizationsEs extends AppLocalizations { @override String get networkMap_unnamed => 'Repetidor sin nombre'; + + @override + String get holidayGreeting_halloween => + 'Feliz Halloween|Feliz Noche de Brujas|Feliz Noche de Halloween|Felices Halloween|Truco o trato'; + + @override + String get holidayGreeting_thanksgiving => + 'Feliz Día de Acción de Gracias|Feliz Thanksgiving|Feliz Día de Gracias|Feliz Acción de Gracias'; + + @override + String get holidayGreeting_christmas => + 'Feliz Navidad|Felices Fiestas|Feliz Nochebuena|Felices Navidades|Merry Christmas'; + + @override + String get holidayGreeting_newYear => + 'Feliz Año Nuevo|Próspero Año Nuevo|Feliz Año|Feliz Nochevieja|Próspero Año|Happy New Year'; } diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart index 6745b3b3..872e0a44 100644 --- a/lib/l10n/app_localizations_fr.dart +++ b/lib/l10n/app_localizations_fr.dart @@ -830,6 +830,239 @@ class AppLocalizationsFr extends AppLocalizations { @override String get appSettings_themeDark => 'Sombre'; + @override + String get appSettings_colorTheme => 'Thème de couleurs'; + + @override + String get appSettings_holidayAnimations => 'Animations des messages de fête'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Chauves-souris, dinde, Père Noël ou feux d\'artifice quand quelqu\'un envoie des vœux de fête'; + + @override + String get themes_title => 'Thèmes'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Couleurs standard, suit le réglage Clair / Sombre'; + + @override + String get themes_builtIn => 'Intégrés'; + + @override + String get themes_holidays => 'Fêtes'; + + @override + String get themes_holidayAutoSwitch => 'Changer automatiquement'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Utilise le thème de chaque fête de 17 jours avant jusqu\'au jour même'; + + @override + String themes_holidayAutoApplied(String holiday) { + return 'Le thème $holiday est activé automatiquement. Votre propre thème reviendra après la fête.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'Activé automatiquement'; + + @override + String get themes_myThemes => 'Mes thèmes'; + + @override + String get themes_myThemesEmpty => + 'Créez votre propre thème en choisissant un fond et une couleur d\'accent.'; + + @override + String get themes_create => 'Créer un thème'; + + @override + String get themes_import => 'Importer un thème'; + + @override + String get themes_importHint => 'Collez un code de thème'; + + @override + String get themes_importInvalid => 'Ce code de thème n\'est pas valide'; + + @override + String themes_imported(String name) { + return 'Thème « $name » ajouté'; + } + + @override + String get themes_customize => 'Personnaliser une copie'; + + @override + String get themes_copyCode => 'Copier le code du thème'; + + @override + String get themes_codeCopied => 'Code du thème copié'; + + @override + String themes_deleteConfirm(String name) { + return 'Supprimer le thème « $name » ?'; + } + + @override + String themes_copyName(String name) { + return 'Copie de $name'; + } + + @override + String get themes_newTitle => 'Nouveau thème'; + + @override + String get themes_editTitle => 'Modifier le thème'; + + @override + String get themes_name => 'Nom'; + + @override + String get themes_nameRequired => 'Donnez un nom à votre thème'; + + @override + String get themes_background => 'Fond'; + + @override + String get themes_backgroundHelp => 'Un fond sombre donne un thème sombre'; + + @override + String get themes_accent => 'Accent'; + + @override + String get themes_accentHelp => + 'Boutons, éléments en surbrillance et vos bulles de discussion'; + + @override + String get themes_hexColor => 'Couleur hexadécimale'; + + @override + String get themes_preview => 'Aperçu'; + + @override + String get themes_previewIncoming => 'Quelqu\'un sur le réseau ce soir ?'; + + @override + String get themes_previewOutgoing => 'Fort et clair !'; + + @override + String get themes_previewSwitch => 'Notifications'; + + @override + String get themes_lowContrast => 'L\'accent est difficile à voir sur ce fond'; + + @override + String get themes_saveAndUse => 'Enregistrer et utiliser'; + + @override + String get themes_icons => 'Icônes'; + + @override + String get themes_iconsHelp => + 'Touchez une icône pour la remplacer par une autre icône ou par votre propre image'; + + @override + String get themes_iconChanged => 'Modifiée'; + + @override + String get themes_iconSend => 'Bouton d\'envoi'; + + @override + String get themes_iconRepeater => 'Répéteurs'; + + @override + String get themes_iconRoom => 'Rooms'; + + @override + String get themes_iconSensor => 'Capteurs'; + + @override + String get themes_mapMarkers => 'Marqueurs de la carte'; + + @override + String get themes_mapMarkersHelp => + 'Remplacez les marqueurs des nœuds et le vôtre sur la carte'; + + @override + String get themes_iconUsePicture => 'Utiliser une image'; + + @override + String get themes_iconReset => 'Utiliser l\'icône par défaut'; + + @override + String get themes_iconPictureFailed => 'Impossible d\'utiliser cette image'; + + @override + String get themes_exportFile => 'Exporter vers un fichier'; + + @override + String get themes_exportAll => 'Exporter mes thèmes'; + + @override + String get themes_importFile => 'Importer depuis un fichier'; + + @override + String get themes_pasteCode => 'Coller le code du thème'; + + @override + String get themes_exportFailed => 'Impossible d\'exporter les thèmes'; + + @override + String themes_importFileResult(int count) { + return '$count thèmes importés'; + } + + @override + String get themes_importFileNone => 'Aucun thème trouvé dans ce fichier'; + + @override + String get chatBackground_title => 'Fond de discussion'; + + @override + String get chatBackground_thisChatOnly => 'Seulement pour cette discussion'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Votre thème « $name » définit le fond dans toutes les discussions. Désactivez cette option dans le thème pour utiliser celui-ci.'; + } + + @override + String get chatBackground_none => 'Aucun'; + + @override + String get chatBackground_picture => 'Image'; + + @override + String get chatBackground_choosePicture => 'Choisir une image'; + + @override + String get chatBackground_pictureFailed => + 'Impossible d\'utiliser cette image'; + + @override + String get chatBackground_fade => 'Atténuation'; + + @override + String get themes_chatBackground => 'Fond de discussion'; + + @override + String get themes_chatBackgroundHelp => + 'Affiché dans les discussions qui n\'ont pas leur propre fond'; + + @override + String get themes_chatBackgroundEverywhere => + 'Utiliser dans toutes les discussions'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Remplace aussi les fonds définis pour chaque discussion'; + @override String get appSettings_language => 'Langue'; @@ -6614,4 +6847,20 @@ class AppLocalizationsFr extends AppLocalizations { @override String get networkMap_unnamed => 'Répéteur sans nom'; + + @override + String get holidayGreeting_halloween => + 'Joyeux Halloween|Joyeuse Halloween|Bon Halloween|Happy Halloween'; + + @override + String get holidayGreeting_thanksgiving => + 'Joyeux Thanksgiving|Joyeuse Action de grâce|Joyeux Jour de l\'Action de grâce|Bon Thanksgiving|Happy Thanksgiving'; + + @override + String get holidayGreeting_christmas => + 'Joyeux Noël|Joyeuses fêtes|Bon Noël|Merry Christmas'; + + @override + String get holidayGreeting_newYear => + 'Bonne année|Bonne et heureuse année|Happy New Year'; } diff --git a/lib/l10n/app_localizations_hu.dart b/lib/l10n/app_localizations_hu.dart index f209318c..c0771ef8 100644 --- a/lib/l10n/app_localizations_hu.dart +++ b/lib/l10n/app_localizations_hu.dart @@ -823,6 +823,239 @@ class AppLocalizationsHu extends AppLocalizations { @override String get appSettings_themeDark => 'Sötét'; + @override + String get appSettings_colorTheme => 'Színtéma'; + + @override + String get appSettings_holidayAnimations => 'Ünnepi üzenet-animációk'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Denevérek, pulyka, Mikulás vagy tűzijáték, ha valaki ünnepi jókívánságot küld'; + + @override + String get themes_title => 'Témák'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Alapszínek, a Világos / Sötét beállítást követi'; + + @override + String get themes_builtIn => 'Beépített'; + + @override + String get themes_holidays => 'Ünnepek'; + + @override + String get themes_holidayAutoSwitch => 'Automatikus váltás'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Minden ünnep témáját használja az ünnep előtt 17 nappal kezdve, magán az ünnepen is'; + + @override + String themes_holidayAutoApplied(String holiday) { + return 'A(z) $holiday téma automatikusan be van kapcsolva. Az ünnep után visszaáll a saját témád.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'Automatikusan bekapcsolva'; + + @override + String get themes_myThemes => 'Saját témáim'; + + @override + String get themes_myThemesEmpty => + 'Készíts saját témát egy háttér és egy kiemelőszín kiválasztásával.'; + + @override + String get themes_create => 'Téma létrehozása'; + + @override + String get themes_import => 'Téma importálása'; + + @override + String get themes_importHint => 'Illeszd be a téma kódját'; + + @override + String get themes_importInvalid => 'Ez nem érvényes témakód'; + + @override + String themes_imported(String name) { + return 'A(z) „$name” téma hozzáadva'; + } + + @override + String get themes_customize => 'Másolat testreszabása'; + + @override + String get themes_copyCode => 'Témakód másolása'; + + @override + String get themes_codeCopied => 'Témakód másolva'; + + @override + String themes_deleteConfirm(String name) { + return 'Törlöd a(z) „$name” témát?'; + } + + @override + String themes_copyName(String name) { + return '$name másolata'; + } + + @override + String get themes_newTitle => 'Új téma'; + + @override + String get themes_editTitle => 'Téma szerkesztése'; + + @override + String get themes_name => 'Név'; + + @override + String get themes_nameRequired => 'Adj nevet a témádnak'; + + @override + String get themes_background => 'Háttér'; + + @override + String get themes_backgroundHelp => 'Sötét háttérrel sötét téma lesz'; + + @override + String get themes_accent => 'Kiemelőszín'; + + @override + String get themes_accentHelp => + 'Gombok, kiemelések és a saját üzenetbuborékaid'; + + @override + String get themes_hexColor => 'Hexa színkód'; + + @override + String get themes_preview => 'Előnézet'; + + @override + String get themes_previewIncoming => 'Van valaki a hálón ma este?'; + + @override + String get themes_previewOutgoing => 'Hangosan és tisztán!'; + + @override + String get themes_previewSwitch => 'Értesítések'; + + @override + String get themes_lowContrast => + 'A kiemelőszín nehezen látszik ezen a háttéren'; + + @override + String get themes_saveAndUse => 'Mentés és használat'; + + @override + String get themes_icons => 'Ikonok'; + + @override + String get themes_iconsHelp => + 'Koppints egy ikonra, hogy másik ikonra vagy saját képre cseréld'; + + @override + String get themes_iconChanged => 'Módosítva'; + + @override + String get themes_iconSend => 'Küldés gomb'; + + @override + String get themes_iconRepeater => 'Átjátszók'; + + @override + String get themes_iconRoom => 'Szobák'; + + @override + String get themes_iconSensor => 'Érzékelők'; + + @override + String get themes_mapMarkers => 'Térképjelölők'; + + @override + String get themes_mapMarkersHelp => + 'Cseréld le a csomópontok és a te jelölődet a térképen'; + + @override + String get themes_iconUsePicture => 'Kép használata'; + + @override + String get themes_iconReset => 'Alapértelmezett ikon használata'; + + @override + String get themes_iconPictureFailed => 'Ezt a képet nem sikerült használni'; + + @override + String get themes_exportFile => 'Exportálás fájlba'; + + @override + String get themes_exportAll => 'Témáim exportálása'; + + @override + String get themes_importFile => 'Importálás fájlból'; + + @override + String get themes_pasteCode => 'Témakód beillesztése'; + + @override + String get themes_exportFailed => 'A témákat nem sikerült exportálni'; + + @override + String themes_importFileResult(int count) { + return '$count téma importálva'; + } + + @override + String get themes_importFileNone => 'Nem található téma ebben a fájlban'; + + @override + String get chatBackground_title => 'Csevegés háttere'; + + @override + String get chatBackground_thisChatOnly => 'Csak ennél a csevegésnél'; + + @override + String chatBackground_themeOverrides(String name) { + return 'A(z) „$name” témád minden csevegésben beállítja a hátteret. Kapcsold ki ezt a témában, hogy ezt használhasd.'; + } + + @override + String get chatBackground_none => 'Nincs'; + + @override + String get chatBackground_picture => 'Kép'; + + @override + String get chatBackground_choosePicture => 'Kép kiválasztása'; + + @override + String get chatBackground_pictureFailed => + 'Ezt a képet nem sikerült használni'; + + @override + String get chatBackground_fade => 'Halványítás'; + + @override + String get themes_chatBackground => 'Csevegés háttere'; + + @override + String get themes_chatBackgroundHelp => + 'Azokban a csevegésekben jelenik meg, amelyeknek nincs saját hátterük'; + + @override + String get themes_chatBackgroundEverywhere => 'Használat minden csevegésben'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Az egyes csevegésekhez beállított hátteret is felülírja'; + @override String get appSettings_language => 'Nyelv'; @@ -6579,4 +6812,20 @@ class AppLocalizationsHu extends AppLocalizations { @override String get networkMap_unnamed => 'Névtelen repeater'; + + @override + String get holidayGreeting_halloween => + 'Boldog Halloweent|Boldog Halloween|Boldog Halloweent kívánok|Vidám Halloweent|Happy Halloween'; + + @override + String get holidayGreeting_thanksgiving => + 'Boldog hálaadást|Boldog hálaadás napot|Boldog Thanksgivinget|Happy Thanksgiving'; + + @override + String get holidayGreeting_christmas => + 'Boldog karácsonyt|Kellemes karácsonyi ünnepeket|Kellemes ünnepeket|Áldott karácsonyt|Merry Christmas'; + + @override + String get holidayGreeting_newYear => + 'Boldog új évet|Boldog újévet|Boldog új esztendőt|BÚÉK|Happy New Year'; } diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart index cd27c1fe..94960af9 100644 --- a/lib/l10n/app_localizations_it.dart +++ b/lib/l10n/app_localizations_it.dart @@ -828,6 +828,240 @@ class AppLocalizationsIt extends AppLocalizations { @override String get appSettings_themeDark => 'Scuro'; + @override + String get appSettings_colorTheme => 'Tema colori'; + + @override + String get appSettings_holidayAnimations => + 'Animazioni dei messaggi di festa'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Pipistrelli, tacchino, Babbo Natale o fuochi d\'artificio quando qualcuno invia un augurio di festa'; + + @override + String get themes_title => 'Temi'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Colori standard, segue l\'impostazione Chiaro / Scuro'; + + @override + String get themes_builtIn => 'Integrati'; + + @override + String get themes_holidays => 'Festività'; + + @override + String get themes_holidayAutoSwitch => 'Cambia automaticamente'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Usa il tema di ogni festività da 17 giorni prima fino al giorno stesso'; + + @override + String themes_holidayAutoApplied(String holiday) { + return 'Il tema $holiday è attivo automaticamente. Il tuo tema tornerà dopo la festività.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'Attivo automaticamente'; + + @override + String get themes_myThemes => 'I miei temi'; + + @override + String get themes_myThemesEmpty => + 'Crea il tuo tema scegliendo uno sfondo e un colore di risalto.'; + + @override + String get themes_create => 'Crea tema'; + + @override + String get themes_import => 'Importa tema'; + + @override + String get themes_importHint => 'Incolla un codice tema'; + + @override + String get themes_importInvalid => 'Questo non è un codice tema valido'; + + @override + String themes_imported(String name) { + return 'Tema \"$name\" aggiunto'; + } + + @override + String get themes_customize => 'Personalizza una copia'; + + @override + String get themes_copyCode => 'Copia codice tema'; + + @override + String get themes_codeCopied => 'Codice tema copiato'; + + @override + String themes_deleteConfirm(String name) { + return 'Eliminare il tema \"$name\"?'; + } + + @override + String themes_copyName(String name) { + return 'Copia di $name'; + } + + @override + String get themes_newTitle => 'Nuovo tema'; + + @override + String get themes_editTitle => 'Modifica tema'; + + @override + String get themes_name => 'Nome'; + + @override + String get themes_nameRequired => 'Dai un nome al tuo tema'; + + @override + String get themes_background => 'Sfondo'; + + @override + String get themes_backgroundHelp => 'Uno sfondo scuro crea un tema scuro'; + + @override + String get themes_accent => 'Colore di risalto'; + + @override + String get themes_accentHelp => + 'Pulsanti, elementi evidenziati e i tuoi fumetti nella chat'; + + @override + String get themes_hexColor => 'Colore esadecimale'; + + @override + String get themes_preview => 'Anteprima'; + + @override + String get themes_previewIncoming => 'C\'è qualcuno sulla mesh stasera?'; + + @override + String get themes_previewOutgoing => 'Forte e chiaro!'; + + @override + String get themes_previewSwitch => 'Notifiche'; + + @override + String get themes_lowContrast => + 'Il colore di risalto si vede male su questo sfondo'; + + @override + String get themes_saveAndUse => 'Salva e usa'; + + @override + String get themes_icons => 'Icone'; + + @override + String get themes_iconsHelp => + 'Tocca un\'icona per sostituirla con un\'altra icona o con una tua immagine'; + + @override + String get themes_iconChanged => 'Modificata'; + + @override + String get themes_iconSend => 'Pulsante di invio'; + + @override + String get themes_iconRepeater => 'Ripetitori'; + + @override + String get themes_iconRoom => 'Stanze'; + + @override + String get themes_iconSensor => 'Sensori'; + + @override + String get themes_mapMarkers => 'Indicatori della mappa'; + + @override + String get themes_mapMarkersHelp => + 'Sostituisci gli indicatori dei nodi e il tuo sulla mappa'; + + @override + String get themes_iconUsePicture => 'Usa un\'immagine'; + + @override + String get themes_iconReset => 'Usa l\'icona predefinita'; + + @override + String get themes_iconPictureFailed => 'Impossibile usare questa immagine'; + + @override + String get themes_exportFile => 'Esporta su file'; + + @override + String get themes_exportAll => 'Esporta i miei temi'; + + @override + String get themes_importFile => 'Importa da file'; + + @override + String get themes_pasteCode => 'Incolla codice tema'; + + @override + String get themes_exportFailed => 'Impossibile esportare i temi'; + + @override + String themes_importFileResult(int count) { + return 'Importati $count temi'; + } + + @override + String get themes_importFileNone => 'Nessun tema trovato in questo file'; + + @override + String get chatBackground_title => 'Sfondo della chat'; + + @override + String get chatBackground_thisChatOnly => 'Solo per questa chat'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Il tuo tema \"$name\" imposta lo sfondo in tutte le chat. Disattivalo nel tema per usare questo.'; + } + + @override + String get chatBackground_none => 'Nessuno'; + + @override + String get chatBackground_picture => 'Immagine'; + + @override + String get chatBackground_choosePicture => 'Scegli un\'immagine'; + + @override + String get chatBackground_pictureFailed => + 'Impossibile usare questa immagine'; + + @override + String get chatBackground_fade => 'Dissolvenza'; + + @override + String get themes_chatBackground => 'Sfondo della chat'; + + @override + String get themes_chatBackgroundHelp => + 'Mostrato nelle chat che non hanno uno sfondo proprio'; + + @override + String get themes_chatBackgroundEverywhere => 'Usa in tutte le chat'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Sostituisce anche gli sfondi impostati sulle singole chat'; + @override String get appSettings_language => 'Lingua'; @@ -6599,4 +6833,20 @@ class AppLocalizationsIt extends AppLocalizations { @override String get networkMap_unnamed => 'Ripetitore senza nome'; + + @override + String get holidayGreeting_halloween => + 'Buon Halloween|Felice Halloween|Happy Halloween'; + + @override + String get holidayGreeting_thanksgiving => + 'Buon Ringraziamento|Buon Thanksgiving|Felice Ringraziamento|Felice Thanksgiving|Happy Thanksgiving'; + + @override + String get holidayGreeting_christmas => + 'Buon Natale|Buone Feste|Felice Natale|Merry Christmas'; + + @override + String get holidayGreeting_newYear => + 'Felice Anno Nuovo|Buon Anno Nuovo|Buon Capodanno|Buon Anno|Felice Anno|Felice Capodanno|Happy New Year'; } diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart index 110733a0..b76ae22e 100644 --- a/lib/l10n/app_localizations_ja.dart +++ b/lib/l10n/app_localizations_ja.dart @@ -785,6 +785,229 @@ class AppLocalizationsJa extends AppLocalizations { @override String get appSettings_themeDark => 'ダーク'; + @override + String get appSettings_colorTheme => 'カラーテーマ'; + + @override + String get appSettings_holidayAnimations => '祝日メッセージのアニメーション'; + + @override + String get appSettings_holidayAnimationsSubtitle => + '祝日のあいさつが届くと、コウモリ、七面鳥、サンタ、花火が表示されます'; + + @override + String get themes_title => 'テーマ'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => '標準の色。ライト/ダークの設定に合わせます'; + + @override + String get themes_builtIn => '標準のテーマ'; + + @override + String get themes_holidays => '祝日'; + + @override + String get themes_holidayAutoSwitch => '自動で切り替える'; + + @override + String get themes_holidayAutoSwitchSubtitle => '各祝日の17日前から当日まで、その祝日のテーマを使います'; + + @override + String themes_holidayAutoApplied(String holiday) { + return '$holidayのテーマを自動で使っています。祝日が終わると、元のテーマに戻ります。'; + } + + @override + String get themes_holidayAutoAppliedTag => '自動で使用中'; + + @override + String get themes_myThemes => 'マイテーマ'; + + @override + String get themes_myThemesEmpty => '背景とアクセントカラーを選んで、自分だけのテーマを作りましょう。'; + + @override + String get themes_create => 'テーマを作成'; + + @override + String get themes_import => 'テーマを読み込む'; + + @override + String get themes_importHint => 'テーマコードを貼り付けてください'; + + @override + String get themes_importInvalid => 'テーマコードが正しくありません'; + + @override + String themes_imported(String name) { + return 'テーマ「$name」を追加しました'; + } + + @override + String get themes_customize => 'コピーして編集'; + + @override + String get themes_copyCode => 'テーマコードをコピー'; + + @override + String get themes_codeCopied => 'テーマコードをコピーしました'; + + @override + String themes_deleteConfirm(String name) { + return 'テーマ「$name」を削除しますか?'; + } + + @override + String themes_copyName(String name) { + return '$nameのコピー'; + } + + @override + String get themes_newTitle => '新しいテーマ'; + + @override + String get themes_editTitle => 'テーマを編集'; + + @override + String get themes_name => '名前'; + + @override + String get themes_nameRequired => 'テーマの名前を入力してください'; + + @override + String get themes_background => '背景'; + + @override + String get themes_backgroundHelp => '背景が暗いと、ダークテーマになります'; + + @override + String get themes_accent => 'アクセント'; + + @override + String get themes_accentHelp => 'ボタン、強調表示、自分のチャットの吹き出しに使います'; + + @override + String get themes_hexColor => '16進数カラー'; + + @override + String get themes_preview => 'プレビュー'; + + @override + String get themes_previewIncoming => '今夜、メッシュにいる人はいますか?'; + + @override + String get themes_previewOutgoing => 'はっきり聞こえます!'; + + @override + String get themes_previewSwitch => '通知'; + + @override + String get themes_lowContrast => 'この背景ではアクセントが見えにくいです'; + + @override + String get themes_saveAndUse => '保存して使う'; + + @override + String get themes_icons => 'アイコン'; + + @override + String get themes_iconsHelp => 'アイコンをタップすると、ほかのアイコンや自分の画像に変更できます'; + + @override + String get themes_iconChanged => '変更済み'; + + @override + String get themes_iconSend => '送信ボタン'; + + @override + String get themes_iconRepeater => 'リピータ'; + + @override + String get themes_iconRoom => 'ルームサーバー'; + + @override + String get themes_iconSensor => 'センサー'; + + @override + String get themes_mapMarkers => '地図のマーカー'; + + @override + String get themes_mapMarkersHelp => '地図上のノードと自分のマーカーを変更します'; + + @override + String get themes_iconUsePicture => '画像を使う'; + + @override + String get themes_iconReset => '標準のアイコンに戻す'; + + @override + String get themes_iconPictureFailed => 'その画像は使えませんでした'; + + @override + String get themes_exportFile => 'ファイルに書き出す'; + + @override + String get themes_exportAll => 'マイテーマを書き出す'; + + @override + String get themes_importFile => 'ファイルから読み込む'; + + @override + String get themes_pasteCode => 'テーマコードを貼り付け'; + + @override + String get themes_exportFailed => 'テーマを書き出せませんでした'; + + @override + String themes_importFileResult(int count) { + return '$count件のテーマを読み込みました'; + } + + @override + String get themes_importFileNone => 'そのファイルにテーマが見つかりません'; + + @override + String get chatBackground_title => 'チャットの背景'; + + @override + String get chatBackground_thisChatOnly => 'このチャットだけ'; + + @override + String chatBackground_themeOverrides(String name) { + return 'テーマ「$name」が、すべてのチャットの背景を指定しています。この背景を使うには、テーマ側でその設定をオフにしてください。'; + } + + @override + String get chatBackground_none => 'なし'; + + @override + String get chatBackground_picture => '画像'; + + @override + String get chatBackground_choosePicture => '画像を選ぶ'; + + @override + String get chatBackground_pictureFailed => 'その画像は使えませんでした'; + + @override + String get chatBackground_fade => '薄さ'; + + @override + String get themes_chatBackground => 'チャットの背景'; + + @override + String get themes_chatBackgroundHelp => '個別の背景がないチャットに表示されます'; + + @override + String get themes_chatBackgroundEverywhere => 'すべてのチャットで使う'; + + @override + String get themes_chatBackgroundEverywhereHelp => 'チャットごとに設定した背景も置き換えます'; + @override String get appSettings_language => '言語'; @@ -6284,4 +6507,20 @@ class AppLocalizationsJa extends AppLocalizations { @override String get networkMap_unnamed => '名前のないリピータ'; + + @override + String get holidayGreeting_halloween => + 'ハッピーハロウィン|ハッピーハロウィーン|ハッピーハロウィン|ハピハロ|トリックオアトリート|Happy Halloween'; + + @override + String get holidayGreeting_thanksgiving => + 'ハッピーサンクスギビング|ハッピー・サンクスギビング|感謝祭おめでとう|Happy Thanksgiving'; + + @override + String get holidayGreeting_christmas => + 'メリークリスマス|メリー・クリスマス|メリクリ|Merry Christmas'; + + @override + String get holidayGreeting_newYear => + 'あけましておめでとう|明けましておめでとう|あけおめ|アケオメ|ハッピーニューイヤー|ハッピー・ニューイヤー|謹賀新年|Happy New Year'; } diff --git a/lib/l10n/app_localizations_ko.dart b/lib/l10n/app_localizations_ko.dart index eb2c2c87..aeb094b4 100644 --- a/lib/l10n/app_localizations_ko.dart +++ b/lib/l10n/app_localizations_ko.dart @@ -787,6 +787,230 @@ class AppLocalizationsKo extends AppLocalizations { @override String get appSettings_themeDark => '어두움'; + @override + String get appSettings_colorTheme => '색상 테마'; + + @override + String get appSettings_holidayAnimations => '명절 메시지 애니메이션'; + + @override + String get appSettings_holidayAnimationsSubtitle => + '누군가 명절 인사를 보내면 박쥐, 칠면조, 산타, 불꽃놀이가 나타납니다'; + + @override + String get themes_title => '테마'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => '기본 색상, 밝음/어두움 설정을 따릅니다'; + + @override + String get themes_builtIn => '기본 제공'; + + @override + String get themes_holidays => '명절'; + + @override + String get themes_holidayAutoSwitch => '자동으로 바꾸기'; + + @override + String get themes_holidayAutoSwitchSubtitle => + '명절 17일 전부터 당일까지 그 명절 테마를 사용합니다'; + + @override + String themes_holidayAutoApplied(String holiday) { + return '$holiday 테마가 자동으로 켜져 있습니다. 명절이 끝나면 내 테마로 돌아갑니다.'; + } + + @override + String get themes_holidayAutoAppliedTag => '자동 적용 중'; + + @override + String get themes_myThemes => '내 테마'; + + @override + String get themes_myThemesEmpty => '배경과 강조 색을 골라 나만의 테마를 만들어 보세요.'; + + @override + String get themes_create => '테마 만들기'; + + @override + String get themes_import => '테마 가져오기'; + + @override + String get themes_importHint => '테마 코드를 붙여넣으세요'; + + @override + String get themes_importInvalid => '올바른 테마 코드가 아닙니다'; + + @override + String themes_imported(String name) { + return '테마 \"$name\"을(를) 추가했습니다'; + } + + @override + String get themes_customize => '복사본 꾸미기'; + + @override + String get themes_copyCode => '테마 코드 복사'; + + @override + String get themes_codeCopied => '테마 코드를 복사했습니다'; + + @override + String themes_deleteConfirm(String name) { + return '테마 \"$name\"을(를) 삭제할까요?'; + } + + @override + String themes_copyName(String name) { + return '$name 복사본'; + } + + @override + String get themes_newTitle => '새 테마'; + + @override + String get themes_editTitle => '테마 편집'; + + @override + String get themes_name => '이름'; + + @override + String get themes_nameRequired => '테마 이름을 입력하세요'; + + @override + String get themes_background => '배경'; + + @override + String get themes_backgroundHelp => '어두운 배경을 고르면 어두운 테마가 됩니다'; + + @override + String get themes_accent => '강조 색'; + + @override + String get themes_accentHelp => '버튼, 강조 표시, 내 말풍선에 쓰입니다'; + + @override + String get themes_hexColor => '16진수 색상'; + + @override + String get themes_preview => '미리보기'; + + @override + String get themes_previewIncoming => '오늘 밤 메시에 계신 분 있나요?'; + + @override + String get themes_previewOutgoing => '잘 들립니다!'; + + @override + String get themes_previewSwitch => '알림'; + + @override + String get themes_lowContrast => '이 배경에서는 강조 색이 잘 보이지 않습니다'; + + @override + String get themes_saveAndUse => '저장하고 사용'; + + @override + String get themes_icons => '아이콘'; + + @override + String get themes_iconsHelp => '아이콘을 눌러 다른 아이콘이나 내 사진으로 바꾸세요'; + + @override + String get themes_iconChanged => '변경됨'; + + @override + String get themes_iconSend => '보내기 버튼'; + + @override + String get themes_iconRepeater => '리피터'; + + @override + String get themes_iconRoom => '룸'; + + @override + String get themes_iconSensor => '센서'; + + @override + String get themes_mapMarkers => '지도 마커'; + + @override + String get themes_mapMarkersHelp => '지도에서 노드와 내 위치 마커를 바꿉니다'; + + @override + String get themes_iconUsePicture => '사진 사용'; + + @override + String get themes_iconReset => '기본 아이콘 사용'; + + @override + String get themes_iconPictureFailed => '그 사진을 사용할 수 없습니다'; + + @override + String get themes_exportFile => '파일로 내보내기'; + + @override + String get themes_exportAll => '내 테마 내보내기'; + + @override + String get themes_importFile => '파일에서 가져오기'; + + @override + String get themes_pasteCode => '테마 코드 붙여넣기'; + + @override + String get themes_exportFailed => '테마를 내보내지 못했습니다'; + + @override + String themes_importFileResult(int count) { + return '테마 $count개를 가져왔습니다'; + } + + @override + String get themes_importFileNone => '그 파일에서 테마를 찾지 못했습니다'; + + @override + String get chatBackground_title => '채팅 배경'; + + @override + String get chatBackground_thisChatOnly => '이 채팅에만 적용'; + + @override + String chatBackground_themeOverrides(String name) { + return '내 테마 \"$name\"이(가) 모든 채팅의 배경을 정하고 있습니다. 이 배경을 쓰려면 테마에서 그 설정을 끄세요.'; + } + + @override + String get chatBackground_none => '없음'; + + @override + String get chatBackground_picture => '사진'; + + @override + String get chatBackground_choosePicture => '사진 선택'; + + @override + String get chatBackground_pictureFailed => '그 사진을 사용할 수 없습니다'; + + @override + String get chatBackground_fade => '흐리게'; + + @override + String get themes_chatBackground => '채팅 배경'; + + @override + String get themes_chatBackgroundHelp => '따로 배경이 없는 채팅에 표시됩니다'; + + @override + String get themes_chatBackgroundEverywhere => '모든 채팅에 사용'; + + @override + String get themes_chatBackgroundEverywhereHelp => '개별 채팅에 정한 배경도 바뀝니다'; + @override String get appSettings_language => '언어'; @@ -6294,4 +6518,20 @@ 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 990a7ea7..d7fcde62 100644 --- a/lib/l10n/app_localizations_nl.dart +++ b/lib/l10n/app_localizations_nl.dart @@ -821,6 +821,240 @@ class AppLocalizationsNl extends AppLocalizations { @override String get appSettings_themeDark => 'Donker'; + @override + String get appSettings_colorTheme => 'Kleurthema'; + + @override + String get appSettings_holidayAnimations => 'Feestdaganimaties in berichten'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Vleermuizen, een kalkoen, de Kerstman of vuurwerk wanneer iemand een feestdagwens stuurt'; + + @override + String get themes_title => 'Thema\'s'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Standaardkleuren, volgt de instelling Licht / Donker'; + + @override + String get themes_builtIn => 'Ingebouwd'; + + @override + String get themes_holidays => 'Feestdagen'; + + @override + String get themes_holidayAutoSwitch => 'Automatisch wisselen'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Gebruikt het thema van elke feestdag vanaf 17 dagen ervoor tot de dag zelf'; + + @override + String themes_holidayAutoApplied(String holiday) { + return 'Het thema $holiday staat automatisch aan. Na de feestdag komt je eigen thema terug.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'Automatisch aan'; + + @override + String get themes_myThemes => 'Mijn thema\'s'; + + @override + String get themes_myThemesEmpty => + 'Maak je eigen thema door een achtergrond en een accentkleur te kiezen.'; + + @override + String get themes_create => 'Thema maken'; + + @override + String get themes_import => 'Thema importeren'; + + @override + String get themes_importHint => 'Plak een themacode'; + + @override + String get themes_importInvalid => 'Dit is geen geldige themacode'; + + @override + String themes_imported(String name) { + return 'Thema \"$name\" toegevoegd'; + } + + @override + String get themes_customize => 'Kopie aanpassen'; + + @override + String get themes_copyCode => 'Themacode kopiëren'; + + @override + String get themes_codeCopied => 'Themacode gekopieerd'; + + @override + String themes_deleteConfirm(String name) { + return 'Thema \"$name\" verwijderen?'; + } + + @override + String themes_copyName(String name) { + return 'Kopie van $name'; + } + + @override + String get themes_newTitle => 'Nieuw thema'; + + @override + String get themes_editTitle => 'Thema bewerken'; + + @override + String get themes_name => 'Naam'; + + @override + String get themes_nameRequired => 'Geef je thema een naam'; + + @override + String get themes_background => 'Achtergrond'; + + @override + String get themes_backgroundHelp => + 'Een donkere achtergrond geeft een donker thema'; + + @override + String get themes_accent => 'Accent'; + + @override + String get themes_accentHelp => 'Knoppen, markeringen en je chatballonnen'; + + @override + String get themes_hexColor => 'Hexkleur'; + + @override + String get themes_preview => 'Voorbeeld'; + + @override + String get themes_previewIncoming => 'Is er vanavond iemand op de mesh?'; + + @override + String get themes_previewOutgoing => 'Luid en duidelijk!'; + + @override + String get themes_previewSwitch => 'Meldingen'; + + @override + String get themes_lowContrast => + 'Het accent is slecht te zien op deze achtergrond'; + + @override + String get themes_saveAndUse => 'Opslaan en gebruiken'; + + @override + String get themes_icons => 'Pictogrammen'; + + @override + String get themes_iconsHelp => + 'Tik op een pictogram om het te vervangen door een ander pictogram of je eigen afbeelding'; + + @override + String get themes_iconChanged => 'Gewijzigd'; + + @override + String get themes_iconSend => 'Verzendknop'; + + @override + String get themes_iconRepeater => 'Repeaters'; + + @override + String get themes_iconRoom => 'Rooms'; + + @override + String get themes_iconSensor => 'Sensoren'; + + @override + String get themes_mapMarkers => 'Kaartmarkeringen'; + + @override + String get themes_mapMarkersHelp => + 'Vervang de markeringen voor nodes en voor jezelf op de kaart'; + + @override + String get themes_iconUsePicture => 'Een afbeelding gebruiken'; + + @override + String get themes_iconReset => 'Standaardpictogram gebruiken'; + + @override + String get themes_iconPictureFailed => + 'Die afbeelding kon niet worden gebruikt'; + + @override + String get themes_exportFile => 'Exporteren naar bestand'; + + @override + String get themes_exportAll => 'Mijn thema\'s exporteren'; + + @override + String get themes_importFile => 'Importeren uit bestand'; + + @override + String get themes_pasteCode => 'Themacode plakken'; + + @override + String get themes_exportFailed => 'Thema\'s konden niet worden geëxporteerd'; + + @override + String themes_importFileResult(int count) { + return '$count thema\'s geïmporteerd'; + } + + @override + String get themes_importFileNone => 'Geen thema\'s gevonden in dat bestand'; + + @override + String get chatBackground_title => 'Chatachtergrond'; + + @override + String get chatBackground_thisChatOnly => 'Alleen voor deze chat'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Je thema \"$name\" stelt de achtergrond in voor elke chat. Zet dat uit in het thema om deze te gebruiken.'; + } + + @override + String get chatBackground_none => 'Geen'; + + @override + String get chatBackground_picture => 'Afbeelding'; + + @override + String get chatBackground_choosePicture => 'Kies een afbeelding'; + + @override + String get chatBackground_pictureFailed => + 'Die afbeelding kon niet worden gebruikt'; + + @override + String get chatBackground_fade => 'Vervagen'; + + @override + String get themes_chatBackground => 'Chatachtergrond'; + + @override + String get themes_chatBackgroundHelp => + 'Getoond in chats die geen eigen achtergrond hebben'; + + @override + String get themes_chatBackgroundEverywhere => 'In elke chat gebruiken'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Vervangt ook achtergronden die voor afzonderlijke chats zijn ingesteld'; + @override String get appSettings_language => 'Taal'; @@ -6553,4 +6787,20 @@ class AppLocalizationsNl extends AppLocalizations { @override String get networkMap_unnamed => 'Naamloze repeater'; + + @override + String get holidayGreeting_halloween => + 'Fijne Halloween|Gelukkige Halloween|Happy Halloween|Gruwelijke Halloween'; + + @override + String get holidayGreeting_thanksgiving => + 'Fijne Thanksgiving|Gelukkige Thanksgiving|Happy Thanksgiving|Fijne Thanksgiving Day'; + + @override + String get holidayGreeting_christmas => + 'Vrolijk kerstfeest|Fijne kerst|Prettige kerstdagen|Zalig kerstfeest|Vrolijk kerst|Zalig kerst|Merry Christmas|Fijne feestdagen|Prettige feestdagen'; + + @override + String get holidayGreeting_newYear => + 'Gelukkig Nieuwjaar|Gelukkig nieuw jaar|Prettig nieuwjaar|Een gelukkig nieuwjaar|Happy New Year|Zalig nieuwjaar|Fijne jaarwisseling'; } diff --git a/lib/l10n/app_localizations_pl.dart b/lib/l10n/app_localizations_pl.dart index 7693de9c..bc243688 100644 --- a/lib/l10n/app_localizations_pl.dart +++ b/lib/l10n/app_localizations_pl.dart @@ -832,6 +832,238 @@ class AppLocalizationsPl extends AppLocalizations { @override String get appSettings_themeDark => 'Ciemny'; + @override + String get appSettings_colorTheme => 'Motyw kolorystyczny'; + + @override + String get appSettings_holidayAnimations => + 'Animacje świątecznych wiadomości'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Nietoperze, indyk, Mikołaj lub fajerwerki, gdy ktoś wyśle świąteczne życzenia'; + + @override + String get themes_title => 'Motywy'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Standardowe kolory, zależą od ustawienia Jasny / Ciemny'; + + @override + String get themes_builtIn => 'Wbudowane'; + + @override + String get themes_holidays => 'Święta'; + + @override + String get themes_holidayAutoSwitch => 'Przełączaj automatycznie'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Używa motywu każdego święta od 17 dni przed nim aż do samego dnia'; + + @override + String themes_holidayAutoApplied(String holiday) { + return 'Motyw $holiday jest włączony automatycznie. Twój własny motyw wróci po świętach.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'Włączony automatycznie'; + + @override + String get themes_myThemes => 'Moje motywy'; + + @override + String get themes_myThemesEmpty => + 'Stwórz własny motyw, wybierając tło i kolor akcentu.'; + + @override + String get themes_create => 'Utwórz motyw'; + + @override + String get themes_import => 'Importuj motyw'; + + @override + String get themes_importHint => 'Wklej kod motywu'; + + @override + String get themes_importInvalid => 'To nie jest prawidłowy kod motywu'; + + @override + String themes_imported(String name) { + return 'Dodano motyw „$name”'; + } + + @override + String get themes_customize => 'Dostosuj kopię'; + + @override + String get themes_copyCode => 'Kopiuj kod motywu'; + + @override + String get themes_codeCopied => 'Skopiowano kod motywu'; + + @override + String themes_deleteConfirm(String name) { + return 'Usunąć motyw „$name”?'; + } + + @override + String themes_copyName(String name) { + return '$name – kopia'; + } + + @override + String get themes_newTitle => 'Nowy motyw'; + + @override + String get themes_editTitle => 'Edytuj motyw'; + + @override + String get themes_name => 'Nazwa'; + + @override + String get themes_nameRequired => 'Nadaj motywowi nazwę'; + + @override + String get themes_background => 'Tło'; + + @override + String get themes_backgroundHelp => 'Ciemne tło tworzy ciemny motyw'; + + @override + String get themes_accent => 'Akcent'; + + @override + String get themes_accentHelp => 'Przyciski, wyróżnienia i Twoje dymki czatu'; + + @override + String get themes_hexColor => 'Kolor szesnastkowy'; + + @override + String get themes_preview => 'Podgląd'; + + @override + String get themes_previewIncoming => 'Ktoś jest dziś wieczorem w sieci?'; + + @override + String get themes_previewOutgoing => 'Odbiór głośny i wyraźny!'; + + @override + String get themes_previewSwitch => 'Powiadomienia'; + + @override + String get themes_lowContrast => + 'Kolor akcentu jest słabo widoczny na tym tle'; + + @override + String get themes_saveAndUse => 'Zapisz i użyj'; + + @override + String get themes_icons => 'Ikony'; + + @override + String get themes_iconsHelp => + 'Dotknij ikony, aby zamienić ją na inną ikonę lub własne zdjęcie'; + + @override + String get themes_iconChanged => 'Zmieniono'; + + @override + String get themes_iconSend => 'Przycisk wysyłania'; + + @override + String get themes_iconRepeater => 'Przekaźniki'; + + @override + String get themes_iconRoom => 'Pokoje'; + + @override + String get themes_iconSensor => 'Czujniki'; + + @override + String get themes_mapMarkers => 'Znaczniki na mapie'; + + @override + String get themes_mapMarkersHelp => + 'Zamień znaczniki węzłów i swojej pozycji na mapie'; + + @override + String get themes_iconUsePicture => 'Użyj zdjęcia'; + + @override + String get themes_iconReset => 'Użyj domyślnej ikony'; + + @override + String get themes_iconPictureFailed => 'Nie udało się użyć tego zdjęcia'; + + @override + String get themes_exportFile => 'Eksportuj do pliku'; + + @override + String get themes_exportAll => 'Eksportuj moje motywy'; + + @override + String get themes_importFile => 'Importuj z pliku'; + + @override + String get themes_pasteCode => 'Wklej kod motywu'; + + @override + String get themes_exportFailed => 'Nie udało się wyeksportować motywów'; + + @override + String themes_importFileResult(int count) { + return 'Zaimportowano motywy: $count'; + } + + @override + String get themes_importFileNone => 'Nie znaleziono motywów w tym pliku'; + + @override + String get chatBackground_title => 'Tło czatu'; + + @override + String get chatBackground_thisChatOnly => 'Tylko w tym czacie'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Twój motyw „$name” ustawia tło w każdym czacie. Wyłącz to w motywie, aby użyć tego tła.'; + } + + @override + String get chatBackground_none => 'Brak'; + + @override + String get chatBackground_picture => 'Zdjęcie'; + + @override + String get chatBackground_choosePicture => 'Wybierz zdjęcie'; + + @override + String get chatBackground_pictureFailed => 'Nie udało się użyć tego zdjęcia'; + + @override + String get chatBackground_fade => 'Zanikanie'; + + @override + String get themes_chatBackground => 'Tło czatu'; + + @override + String get themes_chatBackgroundHelp => + 'Pokazywane w czatach, które nie mają własnego tła'; + + @override + String get themes_chatBackgroundEverywhere => 'Użyj w każdym czacie'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Zastępuje też tła ustawione w pojedynczych czatach'; + @override String get appSettings_language => 'Język'; @@ -6619,4 +6851,20 @@ class AppLocalizationsPl extends AppLocalizations { @override String get networkMap_unnamed => 'Repeater bez nazwy'; + + @override + String get holidayGreeting_halloween => + 'Wesołego Halloween|Szczęśliwego Halloween|Straszne Halloween|Cukierek albo psikus|Happy Halloween'; + + @override + String get holidayGreeting_thanksgiving => + 'Szczęśliwego Święta Dziękczynienia|Wesołego Święta Dziękczynienia|Szczęśliwego Dnia Dziękczynienia|Wesołego Dnia Dziękczynienia|Happy Thanksgiving'; + + @override + String get holidayGreeting_christmas => + 'Wesołych Świąt|Wesołych Świąt Bożego Narodzenia|Wesołej Gwiazdki|Radosnych Świąt|Merry Christmas'; + + @override + String get holidayGreeting_newYear => + 'Szczęśliwego Nowego Roku|Dobrego Nowego Roku|Udanego Nowego Roku|Happy New Year'; } diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart index 52986179..f227ff76 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 => 'Tema de cores'; + + @override + String get appSettings_holidayAnimations => 'Animações de mensagens festivas'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Morcegos, um peru, o Papai Noel ou fogos de artifício quando alguém envia uma saudação festiva'; + + @override + String get themes_title => 'Temas'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Cores padrão, segue a configuração Claro / Escuro'; + + @override + String get themes_builtIn => 'Incluídos'; + + @override + String get themes_holidays => 'Feriados'; + + @override + String get themes_holidayAutoSwitch => 'Mudar automaticamente'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Usa o tema de cada feriado de 17 dias antes até o próprio dia'; + + @override + String themes_holidayAutoApplied(String holiday) { + return 'O tema de $holiday foi ativado automaticamente. Seu próprio tema volta depois do feriado.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'Ativado automaticamente'; + + @override + String get themes_myThemes => 'Meus temas'; + + @override + String get themes_myThemesEmpty => + 'Crie seu próprio tema escolhendo um fundo e uma cor de destaque.'; + + @override + String get themes_create => 'Criar tema'; + + @override + String get themes_import => 'Importar tema'; + + @override + String get themes_importHint => 'Cole um código de tema'; + + @override + String get themes_importInvalid => 'Esse não é um código de tema válido'; + + @override + String themes_imported(String name) { + return 'Tema \"$name\" adicionado'; + } + + @override + String get themes_customize => 'Personalizar uma cópia'; + + @override + String get themes_copyCode => 'Copiar código do tema'; + + @override + String get themes_codeCopied => 'Código do tema copiado'; + + @override + String themes_deleteConfirm(String name) { + return 'Excluir o tema \"$name\"?'; + } + + @override + String themes_copyName(String name) { + return 'Cópia de $name'; + } + + @override + String get themes_newTitle => 'Novo tema'; + + @override + String get themes_editTitle => 'Editar tema'; + + @override + String get themes_name => 'Nome'; + + @override + String get themes_nameRequired => 'Dê um nome ao seu tema'; + + @override + String get themes_background => 'Fundo'; + + @override + String get themes_backgroundHelp => 'Um fundo escuro cria um tema escuro'; + + @override + String get themes_accent => 'Destaque'; + + @override + String get themes_accentHelp => 'Botões, realces e seus balões de conversa'; + + @override + String get themes_hexColor => 'Cor hexadecimal'; + + @override + String get themes_preview => 'Pré-visualização'; + + @override + String get themes_previewIncoming => 'Alguém na malha esta noite?'; + + @override + String get themes_previewOutgoing => 'Alto e claro!'; + + @override + String get themes_previewSwitch => 'Notificações'; + + @override + String get themes_lowContrast => 'O destaque quase não aparece neste fundo'; + + @override + String get themes_saveAndUse => 'Salvar e usar'; + + @override + String get themes_icons => 'Ícones'; + + @override + String get themes_iconsHelp => + 'Toque em um ícone para trocá-lo por outro ícone ou por uma imagem sua'; + + @override + String get themes_iconChanged => 'Alterado'; + + @override + String get themes_iconSend => 'Botão de enviar'; + + @override + String get themes_iconRepeater => 'Repetidores'; + + @override + String get themes_iconRoom => 'Salas'; + + @override + String get themes_iconSensor => 'Sensores'; + + @override + String get themes_mapMarkers => 'Marcadores do mapa'; + + @override + String get themes_mapMarkersHelp => + 'Troque os marcadores dos nós e o seu no mapa'; + + @override + String get themes_iconUsePicture => 'Usar uma imagem'; + + @override + String get themes_iconReset => 'Usar o ícone padrão'; + + @override + String get themes_iconPictureFailed => 'Não foi possível usar essa imagem'; + + @override + String get themes_exportFile => 'Exportar para arquivo'; + + @override + String get themes_exportAll => 'Exportar meus temas'; + + @override + String get themes_importFile => 'Importar de arquivo'; + + @override + String get themes_pasteCode => 'Colar código do tema'; + + @override + String get themes_exportFailed => 'Não foi possível exportar os temas'; + + @override + String themes_importFileResult(int count) { + return '$count temas importados'; + } + + @override + String get themes_importFileNone => 'Nenhum tema encontrado nesse arquivo'; + + @override + String get chatBackground_title => 'Fundo da conversa'; + + @override + String get chatBackground_thisChatOnly => 'Somente para esta conversa'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Seu tema \"$name\" define o fundo em todas as conversas. Desative isso no tema para usar este.'; + } + + @override + String get chatBackground_none => 'Nenhum'; + + @override + String get chatBackground_picture => 'Imagem'; + + @override + String get chatBackground_choosePicture => 'Escolher uma imagem'; + + @override + String get chatBackground_pictureFailed => + 'Não foi possível usar essa imagem'; + + @override + String get chatBackground_fade => 'Esmaecer'; + + @override + String get themes_chatBackground => 'Fundo da conversa'; + + @override + String get themes_chatBackgroundHelp => + 'Mostrado nas conversas que não têm fundo próprio'; + + @override + String get themes_chatBackgroundEverywhere => 'Usar em todas as conversas'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Também substitui os fundos definidos em conversas individuais'; + @override String get appSettings_language => 'Idioma'; @@ -6586,4 +6817,20 @@ class AppLocalizationsPt extends AppLocalizations { @override String get networkMap_unnamed => 'Repetidor sem nome'; + + @override + String get holidayGreeting_halloween => + 'Feliz Halloween|Feliz Dia das Bruxas|Feliz Dia de Halloween|Doce ou travessura'; + + @override + String get holidayGreeting_thanksgiving => + 'Feliz Dia de Ação de Graças|Feliz Thanksgiving|Feliz Ação de Graças|Feliz Dia de Graças'; + + @override + String get holidayGreeting_christmas => + 'Feliz Natal|Boas Festas|Boas Festas de Natal|Feliz Natal e Boas Festas|Merry Christmas'; + + @override + String get holidayGreeting_newYear => + 'Feliz Ano Novo|Próspero Ano Novo|Feliz Ano|Feliz Réveillon|Boas Festas e Feliz Ano Novo|Happy New Year'; } diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart index c1b89d27..4ba9f082 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 => 'Цветовая тема'; + + @override + String get appSettings_holidayAnimations => 'Анимации праздничных сообщений'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Летучие мыши, индейка, Дед Мороз или салют, когда кто-то отправляет праздничное поздравление'; + + @override + String get themes_title => 'Темы'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Стандартные цвета, зависят от настройки «Светлая / Тёмная»'; + + @override + String get themes_builtIn => 'Встроенные'; + + @override + String get themes_holidays => 'Праздники'; + + @override + String get themes_holidayAutoSwitch => 'Переключать автоматически'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Тема каждого праздника включается за 17 дней до него и действует до самого праздника'; + + @override + String themes_holidayAutoApplied(String holiday) { + return 'Тема «$holiday» включена автоматически. Ваша тема вернётся после праздника.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'Включена автоматически'; + + @override + String get themes_myThemes => 'Мои темы'; + + @override + String get themes_myThemesEmpty => + 'Создайте свою тему: выберите фон и акцентный цвет.'; + + @override + String get themes_create => 'Создать тему'; + + @override + String get themes_import => 'Импортировать тему'; + + @override + String get themes_importHint => 'Вставьте код темы'; + + @override + String get themes_importInvalid => 'Это неверный код темы'; + + @override + String themes_imported(String name) { + return 'Тема «$name» добавлена'; + } + + @override + String get themes_customize => 'Изменить копию'; + + @override + String get themes_copyCode => 'Скопировать код темы'; + + @override + String get themes_codeCopied => 'Код темы скопирован'; + + @override + String themes_deleteConfirm(String name) { + return 'Удалить тему «$name»?'; + } + + @override + String themes_copyName(String name) { + return 'Копия «$name»'; + } + + @override + String get themes_newTitle => 'Новая тема'; + + @override + String get themes_editTitle => 'Изменить тему'; + + @override + String get themes_name => 'Название'; + + @override + String get themes_nameRequired => 'Дайте теме название'; + + @override + String get themes_background => 'Фон'; + + @override + String get themes_backgroundHelp => 'Тёмный фон даёт тёмную тему'; + + @override + String get themes_accent => 'Акцент'; + + @override + String get themes_accentHelp => 'Кнопки, выделения и ваши сообщения в чате'; + + @override + String get themes_hexColor => 'HEX-цвет'; + + @override + String get themes_preview => 'Предпросмотр'; + + @override + String get themes_previewIncoming => 'Кто-нибудь сегодня на связи?'; + + @override + String get themes_previewOutgoing => 'Слышу вас отлично!'; + + @override + String get themes_previewSwitch => 'Уведомления'; + + @override + String get themes_lowContrast => 'Акцентный цвет плохо виден на этом фоне'; + + @override + String get themes_saveAndUse => 'Сохранить и применить'; + + @override + String get themes_icons => 'Значки'; + + @override + String get themes_iconsHelp => + 'Нажмите на значок, чтобы заменить его другим значком или своей картинкой'; + + @override + String get themes_iconChanged => 'Изменён'; + + @override + String get themes_iconSend => 'Кнопка отправки'; + + @override + String get themes_iconRepeater => 'Репитеры'; + + @override + String get themes_iconRoom => 'Комнаты'; + + @override + String get themes_iconSensor => 'Сенсоры'; + + @override + String get themes_mapMarkers => 'Маркеры на карте'; + + @override + String get themes_mapMarkersHelp => + 'Замените маркеры для нод и для себя на карте'; + + @override + String get themes_iconUsePicture => 'Использовать картинку'; + + @override + String get themes_iconReset => 'Использовать значок по умолчанию'; + + @override + String get themes_iconPictureFailed => 'Не удалось использовать эту картинку'; + + @override + String get themes_exportFile => 'Экспорт в файл'; + + @override + String get themes_exportAll => 'Экспортировать мои темы'; + + @override + String get themes_importFile => 'Импорт из файла'; + + @override + String get themes_pasteCode => 'Вставить код темы'; + + @override + String get themes_exportFailed => 'Не удалось экспортировать темы'; + + @override + String themes_importFileResult(int count) { + return 'Импортировано тем: $count'; + } + + @override + String get themes_importFileNone => 'В этом файле нет тем'; + + @override + String get chatBackground_title => 'Фон чата'; + + @override + String get chatBackground_thisChatOnly => 'Только для этого чата'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Ваша тема «$name» задаёт фон во всех чатах. Отключите это в теме, чтобы использовать этот фон.'; + } + + @override + String get chatBackground_none => 'Нет'; + + @override + String get chatBackground_picture => 'Картинка'; + + @override + String get chatBackground_choosePicture => 'Выбрать картинку'; + + @override + String get chatBackground_pictureFailed => + 'Не удалось использовать эту картинку'; + + @override + String get chatBackground_fade => 'Затемнение'; + + @override + String get themes_chatBackground => 'Фон чата'; + + @override + String get themes_chatBackgroundHelp => + 'Показывается в чатах, у которых нет своего фона'; + + @override + String get themes_chatBackgroundEverywhere => 'Использовать во всех чатах'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Также заменяет фоны, заданные в отдельных чатах'; + @override String get appSettings_language => 'Язык'; @@ -6606,4 +6837,20 @@ class AppLocalizationsRu extends AppLocalizations { @override String get networkMap_unnamed => 'Репитер без имени'; + + @override + String get holidayGreeting_halloween => + 'С Хэллоуином|С Хеллоуином|Счастливого Хэллоуина|Счастливого Хеллоуина|Happy Halloween'; + + @override + String get holidayGreeting_thanksgiving => + 'С Днём благодарения|С Днем благодарения|Счастливого Дня благодарения|Happy Thanksgiving'; + + @override + String get holidayGreeting_christmas => + 'С Рождеством|С Рождеством Христовым|Счастливого Рождества|Весёлого Рождества|Веселого Рождества|Merry Christmas'; + + @override + String get holidayGreeting_newYear => + 'С Новым годом|С Новым годом!|С Новым годом всех|С наступающим Новым годом|Счастливого Нового года|Happy New Year'; } diff --git a/lib/l10n/app_localizations_sk.dart b/lib/l10n/app_localizations_sk.dart index fc5e67cf..e283d889 100644 --- a/lib/l10n/app_localizations_sk.dart +++ b/lib/l10n/app_localizations_sk.dart @@ -820,6 +820,239 @@ class AppLocalizationsSk extends AppLocalizations { @override String get appSettings_themeDark => 'Tmavé'; + @override + String get appSettings_colorTheme => 'Farebná téma'; + + @override + String get appSettings_holidayAnimations => 'Sviatočné animácie správ'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Netopiere, moriak, Santa alebo ohňostroj, keď niekto pošle sviatočné želanie'; + + @override + String get themes_title => 'Témy'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Štandardné farby, riadi sa nastavením Svetlý / Tmavý'; + + @override + String get themes_builtIn => 'Vstavané'; + + @override + String get themes_holidays => 'Sviatky'; + + @override + String get themes_holidayAutoSwitch => 'Prepínať automaticky'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Používa tému každého sviatku od 17 dní pred ním až do samotného dňa'; + + @override + String themes_holidayAutoApplied(String holiday) { + return 'Téma $holiday je zapnutá automaticky. Vaša vlastná téma sa vráti po sviatku.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'Zapnuté automaticky'; + + @override + String get themes_myThemes => 'Moje témy'; + + @override + String get themes_myThemesEmpty => + 'Vytvorte si vlastnú tému výberom pozadia a farby zvýraznenia.'; + + @override + String get themes_create => 'Vytvoriť tému'; + + @override + String get themes_import => 'Importovať tému'; + + @override + String get themes_importHint => 'Vložte kód témy'; + + @override + String get themes_importInvalid => 'Toto nie je platný kód témy'; + + @override + String themes_imported(String name) { + return 'Pridaná téma „$name“'; + } + + @override + String get themes_customize => 'Upraviť kópiu'; + + @override + String get themes_copyCode => 'Kopírovať kód témy'; + + @override + String get themes_codeCopied => 'Kód témy skopírovaný'; + + @override + String themes_deleteConfirm(String name) { + return 'Odstrániť tému „$name“?'; + } + + @override + String themes_copyName(String name) { + return '$name – kópia'; + } + + @override + String get themes_newTitle => 'Nová téma'; + + @override + String get themes_editTitle => 'Upraviť tému'; + + @override + String get themes_name => 'Názov'; + + @override + String get themes_nameRequired => 'Pomenujte svoju tému'; + + @override + String get themes_background => 'Pozadie'; + + @override + String get themes_backgroundHelp => 'Tmavé pozadie vytvorí tmavú tému'; + + @override + String get themes_accent => 'Zvýraznenie'; + + @override + String get themes_accentHelp => + 'Tlačidlá, zvýraznenia a vaše bubliny v chate'; + + @override + String get themes_hexColor => 'Hexadecimálna farba'; + + @override + String get themes_preview => 'Náhľad'; + + @override + String get themes_previewIncoming => 'Je dnes večer niekto v sieti?'; + + @override + String get themes_previewOutgoing => 'Počujem hlasno a zreteľne!'; + + @override + String get themes_previewSwitch => 'Upozornenia'; + + @override + String get themes_lowContrast => + 'Farba zvýraznenia je na tomto pozadí zle viditeľná'; + + @override + String get themes_saveAndUse => 'Uložiť a použiť'; + + @override + String get themes_icons => 'Ikony'; + + @override + String get themes_iconsHelp => + 'Ťuknite na ikonu a zamente ju za inú ikonu alebo vlastný obrázok'; + + @override + String get themes_iconChanged => 'Zmenené'; + + @override + String get themes_iconSend => 'Tlačidlo odoslať'; + + @override + String get themes_iconRepeater => 'Opakovače'; + + @override + String get themes_iconRoom => 'Miestnosti'; + + @override + String get themes_iconSensor => 'Senzory'; + + @override + String get themes_mapMarkers => 'Značky na mape'; + + @override + String get themes_mapMarkersHelp => + 'Zamente značky uzlov a vašej polohy na mape'; + + @override + String get themes_iconUsePicture => 'Použiť obrázok'; + + @override + String get themes_iconReset => 'Použiť predvolenú ikonu'; + + @override + String get themes_iconPictureFailed => 'Tento obrázok sa nepodarilo použiť'; + + @override + String get themes_exportFile => 'Exportovať do súboru'; + + @override + String get themes_exportAll => 'Exportovať moje témy'; + + @override + String get themes_importFile => 'Importovať zo súboru'; + + @override + String get themes_pasteCode => 'Vložiť kód témy'; + + @override + String get themes_exportFailed => 'Témy sa nepodarilo exportovať'; + + @override + String themes_importFileResult(int count) { + return 'Importované témy: $count'; + } + + @override + String get themes_importFileNone => 'V tomto súbore sa nenašli žiadne témy'; + + @override + String get chatBackground_title => 'Pozadie chatu'; + + @override + String get chatBackground_thisChatOnly => 'Len pre tento chat'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Vaša téma „$name“ nastavuje pozadie v každom chate. Vypnite to v téme, ak chcete použiť toto.'; + } + + @override + String get chatBackground_none => 'Žiadne'; + + @override + String get chatBackground_picture => 'Obrázok'; + + @override + String get chatBackground_choosePicture => 'Vybrať obrázok'; + + @override + String get chatBackground_pictureFailed => + 'Tento obrázok sa nepodarilo použiť'; + + @override + String get chatBackground_fade => 'Vyblednutie'; + + @override + String get themes_chatBackground => 'Pozadie chatu'; + + @override + String get themes_chatBackgroundHelp => + 'Zobrazuje sa v chatoch, ktoré nemajú vlastné pozadie'; + + @override + String get themes_chatBackgroundEverywhere => 'Použiť v každom chate'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Nahradí aj pozadia nastavené v jednotlivých chatoch'; + @override String get appSettings_language => 'Jazyk'; @@ -6573,4 +6806,20 @@ class AppLocalizationsSk extends AppLocalizations { @override String get networkMap_unnamed => 'Nepomenovaný opakovač'; + + @override + String get holidayGreeting_halloween => + 'Veselý Halloween|Šťastný Halloween|Veselého Halloweenu|Happy Halloween'; + + @override + String get holidayGreeting_thanksgiving => + 'Šťastný Deň vďakyvzdania|Šťastný Deň vďaky|Happy Thanksgiving'; + + @override + String get holidayGreeting_christmas => + 'Veselé Vianoce|Šťastné a veselé Vianoce|Príjemné Vianoce|Požehnané Vianoce|Merry Christmas'; + + @override + String get holidayGreeting_newYear => + 'Šťastný Nový rok|Úspešný nový rok|Happy New Year'; } diff --git a/lib/l10n/app_localizations_sl.dart b/lib/l10n/app_localizations_sl.dart index 6ba2232f..ba6db474 100644 --- a/lib/l10n/app_localizations_sl.dart +++ b/lib/l10n/app_localizations_sl.dart @@ -819,6 +819,238 @@ class AppLocalizationsSl extends AppLocalizations { @override String get appSettings_themeDark => 'Temno'; + @override + String get appSettings_colorTheme => 'Barvna tema'; + + @override + String get appSettings_holidayAnimations => + 'Animacije praznikov v sporočilih'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Netopirji, puran, božiček ali ognjemet, ko nekdo pošlje praznično voščilo'; + + @override + String get themes_title => 'Teme'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Standardne barve, sledi nastavitvi Svetlo / Temno'; + + @override + String get themes_builtIn => 'Vgrajene'; + + @override + String get themes_holidays => 'Prazniki'; + + @override + String get themes_holidayAutoSwitch => 'Samodejno preklopi'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Uporabi temo posameznega praznika od 17 dni prej do praznika samega'; + + @override + String themes_holidayAutoApplied(String holiday) { + return 'Tema $holiday je vklopljena samodejno. Vaša tema se vrne po prazniku.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'Samodejno vklopljeno'; + + @override + String get themes_myThemes => 'Moje teme'; + + @override + String get themes_myThemesEmpty => + 'Ustvarite svojo temo z izbiro ozadja in poudarjene barve.'; + + @override + String get themes_create => 'Ustvari temo'; + + @override + String get themes_import => 'Uvozi temo'; + + @override + String get themes_importHint => 'Prilepite kodo teme'; + + @override + String get themes_importInvalid => 'To ni veljavna koda teme'; + + @override + String themes_imported(String name) { + return 'Dodana tema »$name«'; + } + + @override + String get themes_customize => 'Prilagodi kopijo'; + + @override + String get themes_copyCode => 'Kopiraj kodo teme'; + + @override + String get themes_codeCopied => 'Koda teme kopirana'; + + @override + String themes_deleteConfirm(String name) { + return 'Izbrišem temo »$name«?'; + } + + @override + String themes_copyName(String name) { + return '$name (kopija)'; + } + + @override + String get themes_newTitle => 'Nova tema'; + + @override + String get themes_editTitle => 'Uredi temo'; + + @override + String get themes_name => 'Ime'; + + @override + String get themes_nameRequired => 'Poimenujte svojo temo'; + + @override + String get themes_background => 'Ozadje'; + + @override + String get themes_backgroundHelp => 'Temno ozadje naredi temno temo'; + + @override + String get themes_accent => 'Poudarek'; + + @override + String get themes_accentHelp => 'Gumbi, označbe in vaši mehurčki s sporočili'; + + @override + String get themes_hexColor => 'Šestnajstiška barva'; + + @override + String get themes_preview => 'Predogled'; + + @override + String get themes_previewIncoming => 'Je kdo nocoj na mreži?'; + + @override + String get themes_previewOutgoing => 'Slišim vas glasno in jasno!'; + + @override + String get themes_previewSwitch => 'Obvestila'; + + @override + String get themes_lowContrast => + 'Poudarjena barva je na tem ozadju slabo vidna'; + + @override + String get themes_saveAndUse => 'Shrani in uporabi'; + + @override + String get themes_icons => 'Ikone'; + + @override + String get themes_iconsHelp => + 'Tapnite ikono, da jo zamenjate z drugo ikono ali svojo sliko'; + + @override + String get themes_iconChanged => 'Spremenjeno'; + + @override + String get themes_iconSend => 'Gumb za pošiljanje'; + + @override + String get themes_iconRepeater => 'Ponavljalniki'; + + @override + String get themes_iconRoom => 'Sobe'; + + @override + String get themes_iconSensor => 'Senzorji'; + + @override + String get themes_mapMarkers => 'Označbe na zemljevidu'; + + @override + String get themes_mapMarkersHelp => + 'Zamenjajte označbe za vozlišča in zase na zemljevidu'; + + @override + String get themes_iconUsePicture => 'Uporabi sliko'; + + @override + String get themes_iconReset => 'Uporabi privzeto ikono'; + + @override + String get themes_iconPictureFailed => 'Te slike ni mogoče uporabiti'; + + @override + String get themes_exportFile => 'Izvozi v datoteko'; + + @override + String get themes_exportAll => 'Izvozi moje teme'; + + @override + String get themes_importFile => 'Uvozi iz datoteke'; + + @override + String get themes_pasteCode => 'Prilepi kodo teme'; + + @override + String get themes_exportFailed => 'Tem ni bilo mogoče izvoziti'; + + @override + String themes_importFileResult(int count) { + return 'Uvoženih tem: $count'; + } + + @override + String get themes_importFileNone => 'V tej datoteki ni najdenih tem'; + + @override + String get chatBackground_title => 'Ozadje klepeta'; + + @override + String get chatBackground_thisChatOnly => 'Samo za ta klepet'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Vaša tema »$name« nastavi ozadje v vseh klepetih. Izklopite to v temi, če želite uporabiti to ozadje.'; + } + + @override + String get chatBackground_none => 'Brez'; + + @override + String get chatBackground_picture => 'Slika'; + + @override + String get chatBackground_choosePicture => 'Izberi sliko'; + + @override + String get chatBackground_pictureFailed => 'Te slike ni mogoče uporabiti'; + + @override + String get chatBackground_fade => 'Zbledelost'; + + @override + String get themes_chatBackground => 'Ozadje klepeta'; + + @override + String get themes_chatBackgroundHelp => + 'Prikazano v klepetih, ki nimajo svojega ozadja'; + + @override + String get themes_chatBackgroundEverywhere => 'Uporabi v vseh klepetih'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Zamenja tudi ozadja, nastavljena v posameznih klepetih'; + @override String get appSettings_language => 'Jezik'; @@ -6559,4 +6791,20 @@ class AppLocalizationsSl extends AppLocalizations { @override String get networkMap_unnamed => 'Repeater brez imena'; + + @override + String get holidayGreeting_halloween => + 'Vesel Halloween|Srečen Halloween|Happy Halloween'; + + @override + String get holidayGreeting_thanksgiving => + 'Vesel dan zahvalnosti|Srečen dan zahvalnosti|Happy Thanksgiving'; + + @override + String get holidayGreeting_christmas => + 'Vesel božič|Srečen božič|Vesele božične praznike|Merry Christmas'; + + @override + String get holidayGreeting_newYear => + 'Srečno novo leto|Srečno v novem letu|Vse najboljše v novem letu|Happy New Year'; } diff --git a/lib/l10n/app_localizations_sv.dart b/lib/l10n/app_localizations_sv.dart index 5c28c9fa..f07d3aa4 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 => 'Färgtema'; + + @override + String get appSettings_holidayAnimations => 'Helganimationer i meddelanden'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Fladdermöss, en kalkon, tomten eller fyrverkerier när någon skickar en helghälsning'; + + @override + String get themes_title => 'Teman'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Standardfärger, följer inställningen Ljust / Mörkt'; + + @override + String get themes_builtIn => 'Inbyggda'; + + @override + String get themes_holidays => 'Helger'; + + @override + String get themes_holidayAutoSwitch => 'Byt automatiskt'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Använder varje helgs tema från 17 dagar före till själva dagen'; + + @override + String themes_holidayAutoApplied(String holiday) { + return 'Temat $holiday är på automatiskt. Ditt eget tema kommer tillbaka efter helgen.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'På automatiskt'; + + @override + String get themes_myThemes => 'Mina teman'; + + @override + String get themes_myThemesEmpty => + 'Skapa ett eget tema genom att välja en bakgrund och en accentfärg.'; + + @override + String get themes_create => 'Skapa tema'; + + @override + String get themes_import => 'Importera tema'; + + @override + String get themes_importHint => 'Klistra in en temakod'; + + @override + String get themes_importInvalid => 'Det där är ingen giltig temakod'; + + @override + String themes_imported(String name) { + return 'Lade till temat \"$name\"'; + } + + @override + String get themes_customize => 'Anpassa en kopia'; + + @override + String get themes_copyCode => 'Kopiera temakod'; + + @override + String get themes_codeCopied => 'Temakoden kopierades'; + + @override + String themes_deleteConfirm(String name) { + return 'Radera temat \"$name\"?'; + } + + @override + String themes_copyName(String name) { + return 'Kopia av $name'; + } + + @override + String get themes_newTitle => 'Nytt tema'; + + @override + String get themes_editTitle => 'Redigera tema'; + + @override + String get themes_name => 'Namn'; + + @override + String get themes_nameRequired => 'Ge ditt tema ett namn'; + + @override + String get themes_background => 'Bakgrund'; + + @override + String get themes_backgroundHelp => 'En mörk bakgrund ger ett mörkt tema'; + + @override + String get themes_accent => 'Accentfärg'; + + @override + String get themes_accentHelp => 'Knappar, markeringar och dina chattbubblor'; + + @override + String get themes_hexColor => 'Hex-färg'; + + @override + String get themes_preview => 'Förhandsvisning'; + + @override + String get themes_previewIncoming => 'Är det någon på nätet ikväll?'; + + @override + String get themes_previewOutgoing => 'Hör dig tydligt!'; + + @override + String get themes_previewSwitch => 'Aviseringar'; + + @override + String get themes_lowContrast => + 'Accentfärgen syns dåligt mot den här bakgrunden'; + + @override + String get themes_saveAndUse => 'Spara och använd'; + + @override + String get themes_icons => 'Ikoner'; + + @override + String get themes_iconsHelp => + 'Tryck på en ikon för att byta ut den mot en annan ikon eller en egen bild'; + + @override + String get themes_iconChanged => 'Ändrad'; + + @override + String get themes_iconSend => 'Skickaknapp'; + + @override + String get themes_iconRepeater => 'Repeaters'; + + @override + String get themes_iconRoom => 'Rum'; + + @override + String get themes_iconSensor => 'Sensorer'; + + @override + String get themes_mapMarkers => 'Kartmarkörer'; + + @override + String get themes_mapMarkersHelp => + 'Byt ut markörerna för noder och för dig själv på kartan'; + + @override + String get themes_iconUsePicture => 'Använd en bild'; + + @override + String get themes_iconReset => 'Använd standardikonen'; + + @override + String get themes_iconPictureFailed => 'Kunde inte använda den bilden'; + + @override + String get themes_exportFile => 'Exportera till fil'; + + @override + String get themes_exportAll => 'Exportera mina teman'; + + @override + String get themes_importFile => 'Importera från fil'; + + @override + String get themes_pasteCode => 'Klistra in temakod'; + + @override + String get themes_exportFailed => 'Kunde inte exportera teman'; + + @override + String themes_importFileResult(int count) { + return 'Importerade $count teman'; + } + + @override + String get themes_importFileNone => 'Inga teman hittades i filen'; + + @override + String get chatBackground_title => 'Chattbakgrund'; + + @override + String get chatBackground_thisChatOnly => 'Endast för den här chatten'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Ditt tema \"$name\" anger bakgrunden i alla chattar. Stäng av det i temat för att använda den här.'; + } + + @override + String get chatBackground_none => 'Ingen'; + + @override + String get chatBackground_picture => 'Bild'; + + @override + String get chatBackground_choosePicture => 'Välj en bild'; + + @override + String get chatBackground_pictureFailed => 'Kunde inte använda den bilden'; + + @override + String get chatBackground_fade => 'Tona ut'; + + @override + String get themes_chatBackground => 'Chattbakgrund'; + + @override + String get themes_chatBackgroundHelp => + 'Visas i chattar som inte har en egen bakgrund'; + + @override + String get themes_chatBackgroundEverywhere => 'Använd i alla chattar'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Ersätter även bakgrunder som är inställda för enskilda chattar'; + @override String get appSettings_language => 'Språk'; @@ -6533,4 +6764,20 @@ class AppLocalizationsSv extends AppLocalizations { @override String get networkMap_unnamed => 'Namnlös repeater'; + + @override + String get holidayGreeting_halloween => + 'Glad Halloween|Trevlig Halloween|Happy Halloween|Gott Halloween'; + + @override + String get holidayGreeting_thanksgiving => + 'Glad Thanksgiving|Trevlig Thanksgiving|Happy Thanksgiving|Glad tacksägelsedag'; + + @override + String get holidayGreeting_christmas => + 'God jul|Glad jul|Trevlig jul|Merry Christmas|God jul och gott nytt år'; + + @override + String get holidayGreeting_newYear => + 'Gott nytt år|Happy New Year|Ett gott nytt år'; } diff --git a/lib/l10n/app_localizations_uk.dart b/lib/l10n/app_localizations_uk.dart index 2f9d6dec..28562cf4 100644 --- a/lib/l10n/app_localizations_uk.dart +++ b/lib/l10n/app_localizations_uk.dart @@ -822,6 +822,238 @@ class AppLocalizationsUk extends AppLocalizations { @override String get appSettings_themeDark => 'Темна'; + @override + String get appSettings_colorTheme => 'Кольорова тема'; + + @override + String get appSettings_holidayAnimations => 'Анімації святкових повідомлень'; + + @override + String get appSettings_holidayAnimationsSubtitle => + 'Кажани, індик, Дід Мороз або феєрверк, коли хтось надсилає святкове привітання'; + + @override + String get themes_title => 'Теми'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => + 'Стандартні кольори, залежать від налаштування «Світла / Темна»'; + + @override + String get themes_builtIn => 'Вбудовані'; + + @override + String get themes_holidays => 'Свята'; + + @override + String get themes_holidayAutoSwitch => 'Перемикати автоматично'; + + @override + String get themes_holidayAutoSwitchSubtitle => + 'Тема кожного свята вмикається за 17 днів до нього і діє до самого свята'; + + @override + String themes_holidayAutoApplied(String holiday) { + return 'Тему «$holiday» увімкнено автоматично. Ваша тема повернеться після свята.'; + } + + @override + String get themes_holidayAutoAppliedTag => 'Увімкнено автоматично'; + + @override + String get themes_myThemes => 'Мої теми'; + + @override + String get themes_myThemesEmpty => + 'Створіть власну тему: оберіть фон і акцентний колір.'; + + @override + String get themes_create => 'Створити тему'; + + @override + String get themes_import => 'Імпортувати тему'; + + @override + String get themes_importHint => 'Вставте код теми'; + + @override + String get themes_importInvalid => 'Це недійсний код теми'; + + @override + String themes_imported(String name) { + return 'Тему «$name» додано'; + } + + @override + String get themes_customize => 'Змінити копію'; + + @override + String get themes_copyCode => 'Скопіювати код теми'; + + @override + String get themes_codeCopied => 'Код теми скопійовано'; + + @override + String themes_deleteConfirm(String name) { + return 'Видалити тему «$name»?'; + } + + @override + String themes_copyName(String name) { + return 'Копія «$name»'; + } + + @override + String get themes_newTitle => 'Нова тема'; + + @override + String get themes_editTitle => 'Змінити тему'; + + @override + String get themes_name => 'Назва'; + + @override + String get themes_nameRequired => 'Дайте темі назву'; + + @override + String get themes_background => 'Фон'; + + @override + String get themes_backgroundHelp => 'Темний фон дає темну тему'; + + @override + String get themes_accent => 'Акцент'; + + @override + String get themes_accentHelp => + 'Кнопки, виділення та ваші повідомлення в чаті'; + + @override + String get themes_hexColor => 'HEX-колір'; + + @override + String get themes_preview => 'Попередній перегляд'; + + @override + String get themes_previewIncoming => 'Хто-небудь сьогодні на зв\'язку?'; + + @override + String get themes_previewOutgoing => 'Чую вас чудово!'; + + @override + String get themes_previewSwitch => 'Сповіщення'; + + @override + String get themes_lowContrast => 'Акцентний колір погано видно на цьому тлі'; + + @override + String get themes_saveAndUse => 'Зберегти та застосувати'; + + @override + String get themes_icons => 'Значки'; + + @override + String get themes_iconsHelp => + 'Натисніть на значок, щоб замінити його іншим значком або власною картинкою'; + + @override + String get themes_iconChanged => 'Змінено'; + + @override + String get themes_iconSend => 'Кнопка надсилання'; + + @override + String get themes_iconRepeater => 'Ретранслятори'; + + @override + String get themes_iconRoom => 'Кімнати'; + + @override + String get themes_iconSensor => 'Сенсори'; + + @override + String get themes_mapMarkers => 'Маркери на мапі'; + + @override + String get themes_mapMarkersHelp => + 'Замініть маркери для вузлів і для себе на мапі'; + + @override + String get themes_iconUsePicture => 'Використати картинку'; + + @override + String get themes_iconReset => 'Використати значок за замовчуванням'; + + @override + String get themes_iconPictureFailed => 'Не вдалося використати цю картинку'; + + @override + String get themes_exportFile => 'Експорт у файл'; + + @override + String get themes_exportAll => 'Експортувати мої теми'; + + @override + String get themes_importFile => 'Імпорт із файлу'; + + @override + String get themes_pasteCode => 'Вставити код теми'; + + @override + String get themes_exportFailed => 'Не вдалося експортувати теми'; + + @override + String themes_importFileResult(int count) { + return 'Імпортовано тем: $count'; + } + + @override + String get themes_importFileNone => 'У цьому файлі немає тем'; + + @override + String get chatBackground_title => 'Тло чату'; + + @override + String get chatBackground_thisChatOnly => 'Лише для цього чату'; + + @override + String chatBackground_themeOverrides(String name) { + return 'Ваша тема «$name» задає тло в усіх чатах. Вимкніть це в темі, щоб використати це тло.'; + } + + @override + String get chatBackground_none => 'Немає'; + + @override + String get chatBackground_picture => 'Картинка'; + + @override + String get chatBackground_choosePicture => 'Обрати картинку'; + + @override + String get chatBackground_pictureFailed => + 'Не вдалося використати цю картинку'; + + @override + String get chatBackground_fade => 'Затемнення'; + + @override + String get themes_chatBackground => 'Тло чату'; + + @override + String get themes_chatBackgroundHelp => + 'Показується в чатах, які не мають власного тла'; + + @override + String get themes_chatBackgroundEverywhere => 'Використовувати в усіх чатах'; + + @override + String get themes_chatBackgroundEverywhereHelp => + 'Також замінює тла, задані в окремих чатах'; + @override String get appSettings_language => 'Мова'; @@ -6612,4 +6844,20 @@ class AppLocalizationsUk extends AppLocalizations { @override String get networkMap_unnamed => 'Ретранслятор без назви'; + + @override + String get holidayGreeting_halloween => + 'З Гелловіном|З Хелловіном|З Геловіном|Щасливого Гелловіну|Щасливого Хелловіну|Happy Halloween'; + + @override + String get holidayGreeting_thanksgiving => + 'З Днем подяки|З Днём подяки|Щасливого Дня подяки|Happy Thanksgiving'; + + @override + String get holidayGreeting_christmas => + 'З Різдвом|З Різдвом Христовим|Веселого Різдва|Щасливого Різдва|Веселих свят|Merry Christmas'; + + @override + String get holidayGreeting_newYear => + 'З Новим роком|З наступаючим Новим роком|Щасливого Нового року|Happy New Year'; } diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index 9b42bb0f..c306e8b9 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -773,6 +773,229 @@ class AppLocalizationsZh extends AppLocalizations { @override String get appSettings_themeDark => '深色'; + @override + String get appSettings_colorTheme => '配色主题'; + + @override + String get appSettings_holidayAnimations => '节日消息动画'; + + @override + String get appSettings_holidayAnimationsSubtitle => + '有人发送节日祝福时,显示蝙蝠、火鸡、圣诞老人或烟花'; + + @override + String get themes_title => '主题'; + + @override + String get themes_default => 'MeshCore'; + + @override + String get themes_defaultSubtitle => '标准颜色,跟随浅色/深色设置'; + + @override + String get themes_builtIn => '内置'; + + @override + String get themes_holidays => '节日'; + + @override + String get themes_holidayAutoSwitch => '自动切换'; + + @override + String get themes_holidayAutoSwitchSubtitle => '每个节日的主题从节日前 17 天使用到节日当天'; + + @override + String themes_holidayAutoApplied(String holiday) { + return '已自动启用$holiday主题。节日过后会恢复你自己的主题。'; + } + + @override + String get themes_holidayAutoAppliedTag => '已自动启用'; + + @override + String get themes_myThemes => '我的主题'; + + @override + String get themes_myThemesEmpty => '选择背景和强调色,制作你自己的主题。'; + + @override + String get themes_create => '创建主题'; + + @override + String get themes_import => '导入主题'; + + @override + String get themes_importHint => '粘贴主题代码'; + + @override + String get themes_importInvalid => '这不是有效的主题代码'; + + @override + String themes_imported(String name) { + return '已添加主题“$name”'; + } + + @override + String get themes_customize => '自定义副本'; + + @override + String get themes_copyCode => '复制主题代码'; + + @override + String get themes_codeCopied => '主题代码已复制'; + + @override + String themes_deleteConfirm(String name) { + return '删除主题“$name”?'; + } + + @override + String themes_copyName(String name) { + return '$name 副本'; + } + + @override + String get themes_newTitle => '新主题'; + + @override + String get themes_editTitle => '编辑主题'; + + @override + String get themes_name => '名称'; + + @override + String get themes_nameRequired => '请为主题起个名字'; + + @override + String get themes_background => '背景'; + + @override + String get themes_backgroundHelp => '深色背景会生成深色主题'; + + @override + String get themes_accent => '强调色'; + + @override + String get themes_accentHelp => '按钮、高亮和你的聊天气泡'; + + @override + String get themes_hexColor => '十六进制颜色'; + + @override + String get themes_preview => '预览'; + + @override + String get themes_previewIncoming => '今晚网络里有人吗?'; + + @override + String get themes_previewOutgoing => '收到,信号很清楚!'; + + @override + String get themes_previewSwitch => '通知'; + + @override + String get themes_lowContrast => '在此背景上很难看清强调色'; + + @override + String get themes_saveAndUse => '保存并使用'; + + @override + String get themes_icons => '图标'; + + @override + String get themes_iconsHelp => '点按图标,可换成其他图标或你自己的图片'; + + @override + String get themes_iconChanged => '已更改'; + + @override + String get themes_iconSend => '发送按钮'; + + @override + String get themes_iconRepeater => '中继器'; + + @override + String get themes_iconRoom => '房间'; + + @override + String get themes_iconSensor => '传感器'; + + @override + String get themes_mapMarkers => '地图标记'; + + @override + String get themes_mapMarkersHelp => '更换地图上节点和你自己的标记'; + + @override + String get themes_iconUsePicture => '使用图片'; + + @override + String get themes_iconReset => '使用默认图标'; + + @override + String get themes_iconPictureFailed => '无法使用该图片'; + + @override + String get themes_exportFile => '导出到文件'; + + @override + String get themes_exportAll => '导出我的主题'; + + @override + String get themes_importFile => '从文件导入'; + + @override + String get themes_pasteCode => '粘贴主题代码'; + + @override + String get themes_exportFailed => '无法导出主题'; + + @override + String themes_importFileResult(int count) { + return '已导入 $count 个主题'; + } + + @override + String get themes_importFileNone => '该文件中没有找到主题'; + + @override + String get chatBackground_title => '聊天背景'; + + @override + String get chatBackground_thisChatOnly => '仅用于此聊天'; + + @override + String chatBackground_themeOverrides(String name) { + return '你的主题“$name”为所有聊天设置了背景。请在该主题中关闭此项,才能使用这里的背景。'; + } + + @override + String get chatBackground_none => '无'; + + @override + String get chatBackground_picture => '图片'; + + @override + String get chatBackground_choosePicture => '选择图片'; + + @override + String get chatBackground_pictureFailed => '无法使用该图片'; + + @override + String get chatBackground_fade => '淡化'; + + @override + String get themes_chatBackground => '聊天背景'; + + @override + String get themes_chatBackgroundHelp => '显示在没有自己背景的聊天中'; + + @override + String get themes_chatBackgroundEverywhere => '用于所有聊天'; + + @override + String get themes_chatBackgroundEverywhereHelp => '同时会替换单个聊天中设置的背景'; + @override String get appSettings_language => '语言'; @@ -6136,4 +6359,18 @@ 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 39d4c864..bb6ca89b 100644 --- a/lib/l10n/app_nl.arb +++ b/lib/l10n/app_nl.arb @@ -3353,5 +3353,79 @@ "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|Happy Halloween|Gruwelijke Halloween", + "holidayGreeting_thanksgiving": "Fijne Thanksgiving|Gelukkige Thanksgiving|Happy Thanksgiving|Fijne Thanksgiving Day", + "holidayGreeting_christmas": "Vrolijk kerstfeest|Fijne kerst|Prettige kerstdagen|Zalig kerstfeest|Vrolijk kerst|Zalig kerst|Merry Christmas|Fijne feestdagen|Prettige feestdagen", + "holidayGreeting_newYear": "Gelukkig Nieuwjaar|Gelukkig nieuw jaar|Prettig nieuwjaar|Een gelukkig nieuwjaar|Happy New Year|Zalig nieuwjaar|Fijne jaarwisseling", + "appSettings_colorTheme": "Kleurthema", + "appSettings_holidayAnimations": "Feestdaganimaties in berichten", + "appSettings_holidayAnimationsSubtitle": "Vleermuizen, een kalkoen, de Kerstman of vuurwerk wanneer iemand een feestdagwens stuurt", + "themes_title": "Thema's", + "themes_default": "MeshCore", + "themes_defaultSubtitle": "Standaardkleuren, volgt de instelling Licht / Donker", + "themes_builtIn": "Ingebouwd", + "themes_holidays": "Feestdagen", + "themes_holidayAutoSwitch": "Automatisch wisselen", + "themes_holidayAutoSwitchSubtitle": "Gebruikt het thema van elke feestdag vanaf 17 dagen ervoor tot de dag zelf", + "themes_holidayAutoApplied": "Het thema {holiday} staat automatisch aan. Na de feestdag komt je eigen thema terug.", + "themes_holidayAutoAppliedTag": "Automatisch aan", + "themes_myThemes": "Mijn thema's", + "themes_myThemesEmpty": "Maak je eigen thema door een achtergrond en een accentkleur te kiezen.", + "themes_create": "Thema maken", + "themes_import": "Thema importeren", + "themes_importHint": "Plak een themacode", + "themes_importInvalid": "Dit is geen geldige themacode", + "themes_imported": "Thema \"{name}\" toegevoegd", + "themes_customize": "Kopie aanpassen", + "themes_copyCode": "Themacode kopiëren", + "themes_codeCopied": "Themacode gekopieerd", + "themes_deleteConfirm": "Thema \"{name}\" verwijderen?", + "themes_copyName": "Kopie van {name}", + "themes_newTitle": "Nieuw thema", + "themes_editTitle": "Thema bewerken", + "themes_name": "Naam", + "themes_nameRequired": "Geef je thema een naam", + "themes_background": "Achtergrond", + "themes_backgroundHelp": "Een donkere achtergrond geeft een donker thema", + "themes_accent": "Accent", + "themes_accentHelp": "Knoppen, markeringen en je chatballonnen", + "themes_hexColor": "Hexkleur", + "themes_preview": "Voorbeeld", + "themes_previewIncoming": "Is er vanavond iemand op de mesh?", + "themes_previewOutgoing": "Luid en duidelijk!", + "themes_previewSwitch": "Meldingen", + "themes_lowContrast": "Het accent is slecht te zien op deze achtergrond", + "themes_saveAndUse": "Opslaan en gebruiken", + "themes_icons": "Pictogrammen", + "themes_iconsHelp": "Tik op een pictogram om het te vervangen door een ander pictogram of je eigen afbeelding", + "themes_iconChanged": "Gewijzigd", + "themes_iconSend": "Verzendknop", + "themes_iconRepeater": "Repeaters", + "themes_iconRoom": "Rooms", + "themes_iconSensor": "Sensoren", + "themes_mapMarkers": "Kaartmarkeringen", + "themes_mapMarkersHelp": "Vervang de markeringen voor nodes en voor jezelf op de kaart", + "themes_iconUsePicture": "Een afbeelding gebruiken", + "themes_iconReset": "Standaardpictogram gebruiken", + "themes_iconPictureFailed": "Die afbeelding kon niet worden gebruikt", + "themes_exportFile": "Exporteren naar bestand", + "themes_exportAll": "Mijn thema's exporteren", + "themes_importFile": "Importeren uit bestand", + "themes_pasteCode": "Themacode plakken", + "themes_exportFailed": "Thema's konden niet worden geëxporteerd", + "themes_importFileResult": "{count} thema's geïmporteerd", + "themes_importFileNone": "Geen thema's gevonden in dat bestand", + "chatBackground_title": "Chatachtergrond", + "chatBackground_thisChatOnly": "Alleen voor deze chat", + "chatBackground_themeOverrides": "Je thema \"{name}\" stelt de achtergrond in voor elke chat. Zet dat uit in het thema om deze te gebruiken.", + "chatBackground_none": "Geen", + "chatBackground_picture": "Afbeelding", + "chatBackground_choosePicture": "Kies een afbeelding", + "chatBackground_pictureFailed": "Die afbeelding kon niet worden gebruikt", + "chatBackground_fade": "Vervagen", + "themes_chatBackground": "Chatachtergrond", + "themes_chatBackgroundHelp": "Getoond in chats die geen eigen achtergrond hebben", + "themes_chatBackgroundEverywhere": "In elke chat gebruiken", + "themes_chatBackgroundEverywhereHelp": "Vervangt ook achtergronden die voor afzonderlijke chats zijn ingesteld" } diff --git a/lib/l10n/app_pl.arb b/lib/l10n/app_pl.arb index 74a9347b..d2e636b4 100644 --- a/lib/l10n/app_pl.arb +++ b/lib/l10n/app_pl.arb @@ -3485,5 +3485,79 @@ "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|Straszne Halloween|Cukierek albo psikus|Happy Halloween", + "holidayGreeting_thanksgiving": "Szczęśliwego Święta Dziękczynienia|Wesołego Święta Dziękczynienia|Szczęśliwego Dnia Dziękczynienia|Wesołego Dnia Dziękczynienia|Happy Thanksgiving", + "holidayGreeting_christmas": "Wesołych Świąt|Wesołych Świąt Bożego Narodzenia|Wesołej Gwiazdki|Radosnych Świąt|Merry Christmas", + "holidayGreeting_newYear": "Szczęśliwego Nowego Roku|Dobrego Nowego Roku|Udanego Nowego Roku|Happy New Year", + "appSettings_colorTheme": "Motyw kolorystyczny", + "appSettings_holidayAnimations": "Animacje świątecznych wiadomości", + "appSettings_holidayAnimationsSubtitle": "Nietoperze, indyk, Mikołaj lub fajerwerki, gdy ktoś wyśle świąteczne życzenia", + "themes_title": "Motywy", + "themes_default": "MeshCore", + "themes_defaultSubtitle": "Standardowe kolory, zależą od ustawienia Jasny / Ciemny", + "themes_builtIn": "Wbudowane", + "themes_holidays": "Święta", + "themes_holidayAutoSwitch": "Przełączaj automatycznie", + "themes_holidayAutoSwitchSubtitle": "Używa motywu każdego święta od 17 dni przed nim aż do samego dnia", + "themes_holidayAutoApplied": "Motyw {holiday} jest włączony automatycznie. Twój własny motyw wróci po świętach.", + "themes_holidayAutoAppliedTag": "Włączony automatycznie", + "themes_myThemes": "Moje motywy", + "themes_myThemesEmpty": "Stwórz własny motyw, wybierając tło i kolor akcentu.", + "themes_create": "Utwórz motyw", + "themes_import": "Importuj motyw", + "themes_importHint": "Wklej kod motywu", + "themes_importInvalid": "To nie jest prawidłowy kod motywu", + "themes_imported": "Dodano motyw „{name}”", + "themes_customize": "Dostosuj kopię", + "themes_copyCode": "Kopiuj kod motywu", + "themes_codeCopied": "Skopiowano kod motywu", + "themes_deleteConfirm": "Usunąć motyw „{name}”?", + "themes_copyName": "{name} – kopia", + "themes_newTitle": "Nowy motyw", + "themes_editTitle": "Edytuj motyw", + "themes_name": "Nazwa", + "themes_nameRequired": "Nadaj motywowi nazwę", + "themes_background": "Tło", + "themes_backgroundHelp": "Ciemne tło tworzy ciemny motyw", + "themes_accent": "Akcent", + "themes_accentHelp": "Przyciski, wyróżnienia i Twoje dymki czatu", + "themes_hexColor": "Kolor szesnastkowy", + "themes_preview": "Podgląd", + "themes_previewIncoming": "Ktoś jest dziś wieczorem w sieci?", + "themes_previewOutgoing": "Odbiór głośny i wyraźny!", + "themes_previewSwitch": "Powiadomienia", + "themes_lowContrast": "Kolor akcentu jest słabo widoczny na tym tle", + "themes_saveAndUse": "Zapisz i użyj", + "themes_icons": "Ikony", + "themes_iconsHelp": "Dotknij ikony, aby zamienić ją na inną ikonę lub własne zdjęcie", + "themes_iconChanged": "Zmieniono", + "themes_iconSend": "Przycisk wysyłania", + "themes_iconRepeater": "Przekaźniki", + "themes_iconRoom": "Pokoje", + "themes_iconSensor": "Czujniki", + "themes_mapMarkers": "Znaczniki na mapie", + "themes_mapMarkersHelp": "Zamień znaczniki węzłów i swojej pozycji na mapie", + "themes_iconUsePicture": "Użyj zdjęcia", + "themes_iconReset": "Użyj domyślnej ikony", + "themes_iconPictureFailed": "Nie udało się użyć tego zdjęcia", + "themes_exportFile": "Eksportuj do pliku", + "themes_exportAll": "Eksportuj moje motywy", + "themes_importFile": "Importuj z pliku", + "themes_pasteCode": "Wklej kod motywu", + "themes_exportFailed": "Nie udało się wyeksportować motywów", + "themes_importFileResult": "Zaimportowano motywy: {count}", + "themes_importFileNone": "Nie znaleziono motywów w tym pliku", + "chatBackground_title": "Tło czatu", + "chatBackground_thisChatOnly": "Tylko w tym czacie", + "chatBackground_themeOverrides": "Twój motyw „{name}” ustawia tło w każdym czacie. Wyłącz to w motywie, aby użyć tego tła.", + "chatBackground_none": "Brak", + "chatBackground_picture": "Zdjęcie", + "chatBackground_choosePicture": "Wybierz zdjęcie", + "chatBackground_pictureFailed": "Nie udało się użyć tego zdjęcia", + "chatBackground_fade": "Zanikanie", + "themes_chatBackground": "Tło czatu", + "themes_chatBackgroundHelp": "Pokazywane w czatach, które nie mają własnego tła", + "themes_chatBackgroundEverywhere": "Użyj w każdym czacie", + "themes_chatBackgroundEverywhereHelp": "Zastępuje też tła ustawione w pojedynczych czatach" } diff --git a/lib/l10n/app_pt.arb b/lib/l10n/app_pt.arb index bdd7bf83..58f6143d 100644 --- a/lib/l10n/app_pt.arb +++ b/lib/l10n/app_pt.arb @@ -3452,5 +3452,79 @@ }, "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|Feliz Dia de Halloween|Doce ou travessura", + "holidayGreeting_thanksgiving": "Feliz Dia de Ação de Graças|Feliz Thanksgiving|Feliz Ação de Graças|Feliz Dia de Graças", + "holidayGreeting_christmas": "Feliz Natal|Boas Festas|Boas Festas de Natal|Feliz Natal e Boas Festas|Merry Christmas", + "holidayGreeting_newYear": "Feliz Ano Novo|Próspero Ano Novo|Feliz Ano|Feliz Réveillon|Boas Festas e Feliz Ano Novo|Happy New Year", + "appSettings_colorTheme": "Tema de cores", + "appSettings_holidayAnimations": "Animações de mensagens festivas", + "appSettings_holidayAnimationsSubtitle": "Morcegos, um peru, o Papai Noel ou fogos de artifício quando alguém envia uma saudação festiva", + "themes_title": "Temas", + "themes_default": "MeshCore", + "themes_defaultSubtitle": "Cores padrão, segue a configuração Claro / Escuro", + "themes_builtIn": "Incluídos", + "themes_holidays": "Feriados", + "themes_holidayAutoSwitch": "Mudar automaticamente", + "themes_holidayAutoSwitchSubtitle": "Usa o tema de cada feriado de 17 dias antes até o próprio dia", + "themes_holidayAutoApplied": "O tema de {holiday} foi ativado automaticamente. Seu próprio tema volta depois do feriado.", + "themes_holidayAutoAppliedTag": "Ativado automaticamente", + "themes_myThemes": "Meus temas", + "themes_myThemesEmpty": "Crie seu próprio tema escolhendo um fundo e uma cor de destaque.", + "themes_create": "Criar tema", + "themes_import": "Importar tema", + "themes_importHint": "Cole um código de tema", + "themes_importInvalid": "Esse não é um código de tema válido", + "themes_imported": "Tema \"{name}\" adicionado", + "themes_customize": "Personalizar uma cópia", + "themes_copyCode": "Copiar código do tema", + "themes_codeCopied": "Código do tema copiado", + "themes_deleteConfirm": "Excluir o tema \"{name}\"?", + "themes_copyName": "Cópia de {name}", + "themes_newTitle": "Novo tema", + "themes_editTitle": "Editar tema", + "themes_name": "Nome", + "themes_nameRequired": "Dê um nome ao seu tema", + "themes_background": "Fundo", + "themes_backgroundHelp": "Um fundo escuro cria um tema escuro", + "themes_accent": "Destaque", + "themes_accentHelp": "Botões, realces e seus balões de conversa", + "themes_hexColor": "Cor hexadecimal", + "themes_preview": "Pré-visualização", + "themes_previewIncoming": "Alguém na malha esta noite?", + "themes_previewOutgoing": "Alto e claro!", + "themes_previewSwitch": "Notificações", + "themes_lowContrast": "O destaque quase não aparece neste fundo", + "themes_saveAndUse": "Salvar e usar", + "themes_icons": "Ícones", + "themes_iconsHelp": "Toque em um ícone para trocá-lo por outro ícone ou por uma imagem sua", + "themes_iconChanged": "Alterado", + "themes_iconSend": "Botão de enviar", + "themes_iconRepeater": "Repetidores", + "themes_iconRoom": "Salas", + "themes_iconSensor": "Sensores", + "themes_mapMarkers": "Marcadores do mapa", + "themes_mapMarkersHelp": "Troque os marcadores dos nós e o seu no mapa", + "themes_iconUsePicture": "Usar uma imagem", + "themes_iconReset": "Usar o ícone padrão", + "themes_iconPictureFailed": "Não foi possível usar essa imagem", + "themes_exportFile": "Exportar para arquivo", + "themes_exportAll": "Exportar meus temas", + "themes_importFile": "Importar de arquivo", + "themes_pasteCode": "Colar código do tema", + "themes_exportFailed": "Não foi possível exportar os temas", + "themes_importFileResult": "{count} temas importados", + "themes_importFileNone": "Nenhum tema encontrado nesse arquivo", + "chatBackground_title": "Fundo da conversa", + "chatBackground_thisChatOnly": "Somente para esta conversa", + "chatBackground_themeOverrides": "Seu tema \"{name}\" define o fundo em todas as conversas. Desative isso no tema para usar este.", + "chatBackground_none": "Nenhum", + "chatBackground_picture": "Imagem", + "chatBackground_choosePicture": "Escolher uma imagem", + "chatBackground_pictureFailed": "Não foi possível usar essa imagem", + "chatBackground_fade": "Esmaecer", + "themes_chatBackground": "Fundo da conversa", + "themes_chatBackgroundHelp": "Mostrado nas conversas que não têm fundo próprio", + "themes_chatBackgroundEverywhere": "Usar em todas as conversas", + "themes_chatBackgroundEverywhereHelp": "Também substitui os fundos definidos em conversas individuais" } diff --git a/lib/l10n/app_ru.arb b/lib/l10n/app_ru.arb index ea90df6d..e3077cb4 100644 --- a/lib/l10n/app_ru.arb +++ b/lib/l10n/app_ru.arb @@ -2749,5 +2749,79 @@ "networkMap_manage": "Управлять", "networkMap_addedToContacts": "Добавлено в контакты", "networkMap_addFailed": "Не удалось добавить в контакты", - "networkMap_unnamed": "Репитер без имени" + "networkMap_unnamed": "Репитер без имени", + "holidayGreeting_halloween": "С Хэллоуином|С Хеллоуином|Счастливого Хэллоуина|Счастливого Хеллоуина|Happy Halloween", + "holidayGreeting_thanksgiving": "С Днём благодарения|С Днем благодарения|Счастливого Дня благодарения|Happy Thanksgiving", + "holidayGreeting_christmas": "С Рождеством|С Рождеством Христовым|Счастливого Рождества|Весёлого Рождества|Веселого Рождества|Merry Christmas", + "holidayGreeting_newYear": "С Новым годом|С Новым годом!|С Новым годом всех|С наступающим Новым годом|Счастливого Нового года|Happy New Year", + "appSettings_colorTheme": "Цветовая тема", + "appSettings_holidayAnimations": "Анимации праздничных сообщений", + "appSettings_holidayAnimationsSubtitle": "Летучие мыши, индейка, Дед Мороз или салют, когда кто-то отправляет праздничное поздравление", + "themes_title": "Темы", + "themes_default": "MeshCore", + "themes_defaultSubtitle": "Стандартные цвета, зависят от настройки «Светлая / Тёмная»", + "themes_builtIn": "Встроенные", + "themes_holidays": "Праздники", + "themes_holidayAutoSwitch": "Переключать автоматически", + "themes_holidayAutoSwitchSubtitle": "Тема каждого праздника включается за 17 дней до него и действует до самого праздника", + "themes_holidayAutoApplied": "Тема «{holiday}» включена автоматически. Ваша тема вернётся после праздника.", + "themes_holidayAutoAppliedTag": "Включена автоматически", + "themes_myThemes": "Мои темы", + "themes_myThemesEmpty": "Создайте свою тему: выберите фон и акцентный цвет.", + "themes_create": "Создать тему", + "themes_import": "Импортировать тему", + "themes_importHint": "Вставьте код темы", + "themes_importInvalid": "Это неверный код темы", + "themes_imported": "Тема «{name}» добавлена", + "themes_customize": "Изменить копию", + "themes_copyCode": "Скопировать код темы", + "themes_codeCopied": "Код темы скопирован", + "themes_deleteConfirm": "Удалить тему «{name}»?", + "themes_copyName": "Копия «{name}»", + "themes_newTitle": "Новая тема", + "themes_editTitle": "Изменить тему", + "themes_name": "Название", + "themes_nameRequired": "Дайте теме название", + "themes_background": "Фон", + "themes_backgroundHelp": "Тёмный фон даёт тёмную тему", + "themes_accent": "Акцент", + "themes_accentHelp": "Кнопки, выделения и ваши сообщения в чате", + "themes_hexColor": "HEX-цвет", + "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": "Импортировано тем: {count}", + "themes_importFileNone": "В этом файле нет тем", + "chatBackground_title": "Фон чата", + "chatBackground_thisChatOnly": "Только для этого чата", + "chatBackground_themeOverrides": "Ваша тема «{name}» задаёт фон во всех чатах. Отключите это в теме, чтобы использовать этот фон.", + "chatBackground_none": "Нет", + "chatBackground_picture": "Картинка", + "chatBackground_choosePicture": "Выбрать картинку", + "chatBackground_pictureFailed": "Не удалось использовать эту картинку", + "chatBackground_fade": "Затемнение", + "themes_chatBackground": "Фон чата", + "themes_chatBackgroundHelp": "Показывается в чатах, у которых нет своего фона", + "themes_chatBackgroundEverywhere": "Использовать во всех чатах", + "themes_chatBackgroundEverywhereHelp": "Также заменяет фоны, заданные в отдельных чатах" } diff --git a/lib/l10n/app_sk.arb b/lib/l10n/app_sk.arb index f6e28798..328979fa 100644 --- a/lib/l10n/app_sk.arb +++ b/lib/l10n/app_sk.arb @@ -3453,5 +3453,79 @@ "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|Veselého Halloweenu|Happy Halloween", + "holidayGreeting_thanksgiving": "Šťastný Deň vďakyvzdania|Šťastný Deň vďaky|Happy Thanksgiving", + "holidayGreeting_christmas": "Veselé Vianoce|Šťastné a veselé Vianoce|Príjemné Vianoce|Požehnané Vianoce|Merry Christmas", + "holidayGreeting_newYear": "Šťastný Nový rok|Úspešný nový rok|Happy New Year", + "appSettings_colorTheme": "Farebná téma", + "appSettings_holidayAnimations": "Sviatočné animácie správ", + "appSettings_holidayAnimationsSubtitle": "Netopiere, moriak, Santa alebo ohňostroj, keď niekto pošle sviatočné želanie", + "themes_title": "Témy", + "themes_default": "MeshCore", + "themes_defaultSubtitle": "Štandardné farby, riadi sa nastavením Svetlý / Tmavý", + "themes_builtIn": "Vstavané", + "themes_holidays": "Sviatky", + "themes_holidayAutoSwitch": "Prepínať automaticky", + "themes_holidayAutoSwitchSubtitle": "Používa tému každého sviatku od 17 dní pred ním až do samotného dňa", + "themes_holidayAutoApplied": "Téma {holiday} je zapnutá automaticky. Vaša vlastná téma sa vráti po sviatku.", + "themes_holidayAutoAppliedTag": "Zapnuté automaticky", + "themes_myThemes": "Moje témy", + "themes_myThemesEmpty": "Vytvorte si vlastnú tému výberom pozadia a farby zvýraznenia.", + "themes_create": "Vytvoriť tému", + "themes_import": "Importovať tému", + "themes_importHint": "Vložte kód témy", + "themes_importInvalid": "Toto nie je platný kód témy", + "themes_imported": "Pridaná téma „{name}“", + "themes_customize": "Upraviť kópiu", + "themes_copyCode": "Kopírovať kód témy", + "themes_codeCopied": "Kód témy skopírovaný", + "themes_deleteConfirm": "Odstrániť tému „{name}“?", + "themes_copyName": "{name} – kópia", + "themes_newTitle": "Nová téma", + "themes_editTitle": "Upraviť tému", + "themes_name": "Názov", + "themes_nameRequired": "Pomenujte svoju tému", + "themes_background": "Pozadie", + "themes_backgroundHelp": "Tmavé pozadie vytvorí tmavú tému", + "themes_accent": "Zvýraznenie", + "themes_accentHelp": "Tlačidlá, zvýraznenia a vaše bubliny v chate", + "themes_hexColor": "Hexadecimálna farba", + "themes_preview": "Náhľad", + "themes_previewIncoming": "Je dnes večer niekto v sieti?", + "themes_previewOutgoing": "Počujem hlasno a zreteľne!", + "themes_previewSwitch": "Upozornenia", + "themes_lowContrast": "Farba zvýraznenia je na tomto pozadí zle viditeľná", + "themes_saveAndUse": "Uložiť a použiť", + "themes_icons": "Ikony", + "themes_iconsHelp": "Ťuknite na ikonu a zamente ju za inú ikonu alebo vlastný obrázok", + "themes_iconChanged": "Zmenené", + "themes_iconSend": "Tlačidlo odoslať", + "themes_iconRepeater": "Opakovače", + "themes_iconRoom": "Miestnosti", + "themes_iconSensor": "Senzory", + "themes_mapMarkers": "Značky na mape", + "themes_mapMarkersHelp": "Zamente značky uzlov a vašej polohy na mape", + "themes_iconUsePicture": "Použiť obrázok", + "themes_iconReset": "Použiť predvolenú ikonu", + "themes_iconPictureFailed": "Tento obrázok sa nepodarilo použiť", + "themes_exportFile": "Exportovať do súboru", + "themes_exportAll": "Exportovať moje témy", + "themes_importFile": "Importovať zo súboru", + "themes_pasteCode": "Vložiť kód témy", + "themes_exportFailed": "Témy sa nepodarilo exportovať", + "themes_importFileResult": "Importované témy: {count}", + "themes_importFileNone": "V tomto súbore sa nenašli žiadne témy", + "chatBackground_title": "Pozadie chatu", + "chatBackground_thisChatOnly": "Len pre tento chat", + "chatBackground_themeOverrides": "Vaša téma „{name}“ nastavuje pozadie v každom chate. Vypnite to v téme, ak chcete použiť toto.", + "chatBackground_none": "Žiadne", + "chatBackground_picture": "Obrázok", + "chatBackground_choosePicture": "Vybrať obrázok", + "chatBackground_pictureFailed": "Tento obrázok sa nepodarilo použiť", + "chatBackground_fade": "Vyblednutie", + "themes_chatBackground": "Pozadie chatu", + "themes_chatBackgroundHelp": "Zobrazuje sa v chatoch, ktoré nemajú vlastné pozadie", + "themes_chatBackgroundEverywhere": "Použiť v každom chate", + "themes_chatBackgroundEverywhereHelp": "Nahradí aj pozadia nastavené v jednotlivých chatoch" } diff --git a/lib/l10n/app_sl.arb b/lib/l10n/app_sl.arb index 1504bebd..cbd5a560 100644 --- a/lib/l10n/app_sl.arb +++ b/lib/l10n/app_sl.arb @@ -3453,5 +3453,79 @@ }, "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|Happy Halloween", + "holidayGreeting_thanksgiving": "Vesel dan zahvalnosti|Srečen dan zahvalnosti|Happy Thanksgiving", + "holidayGreeting_christmas": "Vesel božič|Srečen božič|Vesele božične praznike|Merry Christmas", + "holidayGreeting_newYear": "Srečno novo leto|Srečno v novem letu|Vse najboljše v novem letu|Happy New Year", + "appSettings_colorTheme": "Barvna tema", + "appSettings_holidayAnimations": "Animacije praznikov v sporočilih", + "appSettings_holidayAnimationsSubtitle": "Netopirji, puran, božiček ali ognjemet, ko nekdo pošlje praznično voščilo", + "themes_title": "Teme", + "themes_default": "MeshCore", + "themes_defaultSubtitle": "Standardne barve, sledi nastavitvi Svetlo / Temno", + "themes_builtIn": "Vgrajene", + "themes_holidays": "Prazniki", + "themes_holidayAutoSwitch": "Samodejno preklopi", + "themes_holidayAutoSwitchSubtitle": "Uporabi temo posameznega praznika od 17 dni prej do praznika samega", + "themes_holidayAutoApplied": "Tema {holiday} je vklopljena samodejno. Vaša tema se vrne po prazniku.", + "themes_holidayAutoAppliedTag": "Samodejno vklopljeno", + "themes_myThemes": "Moje teme", + "themes_myThemesEmpty": "Ustvarite svojo temo z izbiro ozadja in poudarjene barve.", + "themes_create": "Ustvari temo", + "themes_import": "Uvozi temo", + "themes_importHint": "Prilepite kodo teme", + "themes_importInvalid": "To ni veljavna koda teme", + "themes_imported": "Dodana tema »{name}«", + "themes_customize": "Prilagodi kopijo", + "themes_copyCode": "Kopiraj kodo teme", + "themes_codeCopied": "Koda teme kopirana", + "themes_deleteConfirm": "Izbrišem temo »{name}«?", + "themes_copyName": "{name} (kopija)", + "themes_newTitle": "Nova tema", + "themes_editTitle": "Uredi temo", + "themes_name": "Ime", + "themes_nameRequired": "Poimenujte svojo temo", + "themes_background": "Ozadje", + "themes_backgroundHelp": "Temno ozadje naredi temno temo", + "themes_accent": "Poudarek", + "themes_accentHelp": "Gumbi, označbe in vaši mehurčki s sporočili", + "themes_hexColor": "Šestnajstiška barva", + "themes_preview": "Predogled", + "themes_previewIncoming": "Je kdo nocoj na mreži?", + "themes_previewOutgoing": "Slišim vas glasno in jasno!", + "themes_previewSwitch": "Obvestila", + "themes_lowContrast": "Poudarjena barva je na tem ozadju slabo vidna", + "themes_saveAndUse": "Shrani in uporabi", + "themes_icons": "Ikone", + "themes_iconsHelp": "Tapnite ikono, da jo zamenjate z drugo ikono ali svojo sliko", + "themes_iconChanged": "Spremenjeno", + "themes_iconSend": "Gumb za pošiljanje", + "themes_iconRepeater": "Ponavljalniki", + "themes_iconRoom": "Sobe", + "themes_iconSensor": "Senzorji", + "themes_mapMarkers": "Označbe na zemljevidu", + "themes_mapMarkersHelp": "Zamenjajte označbe za vozlišča in zase na zemljevidu", + "themes_iconUsePicture": "Uporabi sliko", + "themes_iconReset": "Uporabi privzeto ikono", + "themes_iconPictureFailed": "Te slike ni mogoče uporabiti", + "themes_exportFile": "Izvozi v datoteko", + "themes_exportAll": "Izvozi moje teme", + "themes_importFile": "Uvozi iz datoteke", + "themes_pasteCode": "Prilepi kodo teme", + "themes_exportFailed": "Tem ni bilo mogoče izvoziti", + "themes_importFileResult": "Uvoženih tem: {count}", + "themes_importFileNone": "V tej datoteki ni najdenih tem", + "chatBackground_title": "Ozadje klepeta", + "chatBackground_thisChatOnly": "Samo za ta klepet", + "chatBackground_themeOverrides": "Vaša tema »{name}« nastavi ozadje v vseh klepetih. Izklopite to v temi, če želite uporabiti to ozadje.", + "chatBackground_none": "Brez", + "chatBackground_picture": "Slika", + "chatBackground_choosePicture": "Izberi sliko", + "chatBackground_pictureFailed": "Te slike ni mogoče uporabiti", + "chatBackground_fade": "Zbledelost", + "themes_chatBackground": "Ozadje klepeta", + "themes_chatBackgroundHelp": "Prikazano v klepetih, ki nimajo svojega ozadja", + "themes_chatBackgroundEverywhere": "Uporabi v vseh klepetih", + "themes_chatBackgroundEverywhereHelp": "Zamenja tudi ozadja, nastavljena v posameznih klepetih" } diff --git a/lib/l10n/app_sv.arb b/lib/l10n/app_sv.arb index 4bbc3691..d372bd24 100644 --- a/lib/l10n/app_sv.arb +++ b/lib/l10n/app_sv.arb @@ -3447,5 +3447,79 @@ }, "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|Trevlig Halloween|Happy Halloween|Gott Halloween", + "holidayGreeting_thanksgiving": "Glad Thanksgiving|Trevlig Thanksgiving|Happy Thanksgiving|Glad tacksägelsedag", + "holidayGreeting_christmas": "God jul|Glad jul|Trevlig jul|Merry Christmas|God jul och gott nytt år", + "holidayGreeting_newYear": "Gott nytt år|Happy New Year|Ett gott nytt år", + "appSettings_colorTheme": "Färgtema", + "appSettings_holidayAnimations": "Helganimationer i meddelanden", + "appSettings_holidayAnimationsSubtitle": "Fladdermöss, en kalkon, tomten eller fyrverkerier när någon skickar en helghälsning", + "themes_title": "Teman", + "themes_default": "MeshCore", + "themes_defaultSubtitle": "Standardfärger, följer inställningen Ljust / Mörkt", + "themes_builtIn": "Inbyggda", + "themes_holidays": "Helger", + "themes_holidayAutoSwitch": "Byt automatiskt", + "themes_holidayAutoSwitchSubtitle": "Använder varje helgs tema från 17 dagar före till själva dagen", + "themes_holidayAutoApplied": "Temat {holiday} är på automatiskt. Ditt eget tema kommer tillbaka efter helgen.", + "themes_holidayAutoAppliedTag": "På automatiskt", + "themes_myThemes": "Mina teman", + "themes_myThemesEmpty": "Skapa ett eget tema genom att välja en bakgrund och en accentfärg.", + "themes_create": "Skapa tema", + "themes_import": "Importera tema", + "themes_importHint": "Klistra in en temakod", + "themes_importInvalid": "Det där är ingen giltig temakod", + "themes_imported": "Lade till temat \"{name}\"", + "themes_customize": "Anpassa en kopia", + "themes_copyCode": "Kopiera temakod", + "themes_codeCopied": "Temakoden kopierades", + "themes_deleteConfirm": "Radera temat \"{name}\"?", + "themes_copyName": "Kopia av {name}", + "themes_newTitle": "Nytt tema", + "themes_editTitle": "Redigera tema", + "themes_name": "Namn", + "themes_nameRequired": "Ge ditt tema ett namn", + "themes_background": "Bakgrund", + "themes_backgroundHelp": "En mörk bakgrund ger ett mörkt tema", + "themes_accent": "Accentfärg", + "themes_accentHelp": "Knappar, markeringar och dina chattbubblor", + "themes_hexColor": "Hex-färg", + "themes_preview": "Förhandsvisning", + "themes_previewIncoming": "Är det någon på nätet ikväll?", + "themes_previewOutgoing": "Hör dig tydligt!", + "themes_previewSwitch": "Aviseringar", + "themes_lowContrast": "Accentfärgen syns dåligt mot den här bakgrunden", + "themes_saveAndUse": "Spara och använd", + "themes_icons": "Ikoner", + "themes_iconsHelp": "Tryck på en ikon för att byta ut den mot en annan ikon eller en egen bild", + "themes_iconChanged": "Ändrad", + "themes_iconSend": "Skickaknapp", + "themes_iconRepeater": "Repeaters", + "themes_iconRoom": "Rum", + "themes_iconSensor": "Sensorer", + "themes_mapMarkers": "Kartmarkörer", + "themes_mapMarkersHelp": "Byt ut markörerna för noder och för dig själv på kartan", + "themes_iconUsePicture": "Använd en bild", + "themes_iconReset": "Använd standardikonen", + "themes_iconPictureFailed": "Kunde inte använda den bilden", + "themes_exportFile": "Exportera till fil", + "themes_exportAll": "Exportera mina teman", + "themes_importFile": "Importera från fil", + "themes_pasteCode": "Klistra in temakod", + "themes_exportFailed": "Kunde inte exportera teman", + "themes_importFileResult": "Importerade {count} teman", + "themes_importFileNone": "Inga teman hittades i filen", + "chatBackground_title": "Chattbakgrund", + "chatBackground_thisChatOnly": "Endast för den här chatten", + "chatBackground_themeOverrides": "Ditt tema \"{name}\" anger bakgrunden i alla chattar. Stäng av det i temat för att använda den här.", + "chatBackground_none": "Ingen", + "chatBackground_picture": "Bild", + "chatBackground_choosePicture": "Välj en bild", + "chatBackground_pictureFailed": "Kunde inte använda den bilden", + "chatBackground_fade": "Tona ut", + "themes_chatBackground": "Chattbakgrund", + "themes_chatBackgroundHelp": "Visas i chattar som inte har en egen bakgrund", + "themes_chatBackgroundEverywhere": "Använd i alla chattar", + "themes_chatBackgroundEverywhereHelp": "Ersätter även bakgrunder som är inställda för enskilda chattar" } diff --git a/lib/l10n/app_uk.arb b/lib/l10n/app_uk.arb index 1cf738eb..04736e28 100644 --- a/lib/l10n/app_uk.arb +++ b/lib/l10n/app_uk.arb @@ -3432,5 +3432,79 @@ "networkMap_manage": "Керувати", "networkMap_addedToContacts": "Додано до контактів", "networkMap_addFailed": "Не вдалося додати до контактів", - "networkMap_unnamed": "Ретранслятор без назви" + "networkMap_unnamed": "Ретранслятор без назви", + "holidayGreeting_halloween": "З Гелловіном|З Хелловіном|З Геловіном|Щасливого Гелловіну|Щасливого Хелловіну|Happy Halloween", + "holidayGreeting_thanksgiving": "З Днем подяки|З Днём подяки|Щасливого Дня подяки|Happy Thanksgiving", + "holidayGreeting_christmas": "З Різдвом|З Різдвом Христовим|Веселого Різдва|Щасливого Різдва|Веселих свят|Merry Christmas", + "holidayGreeting_newYear": "З Новим роком|З наступаючим Новим роком|Щасливого Нового року|Happy New Year", + "appSettings_colorTheme": "Кольорова тема", + "appSettings_holidayAnimations": "Анімації святкових повідомлень", + "appSettings_holidayAnimationsSubtitle": "Кажани, індик, Дід Мороз або феєрверк, коли хтось надсилає святкове привітання", + "themes_title": "Теми", + "themes_default": "MeshCore", + "themes_defaultSubtitle": "Стандартні кольори, залежать від налаштування «Світла / Темна»", + "themes_builtIn": "Вбудовані", + "themes_holidays": "Свята", + "themes_holidayAutoSwitch": "Перемикати автоматично", + "themes_holidayAutoSwitchSubtitle": "Тема кожного свята вмикається за 17 днів до нього і діє до самого свята", + "themes_holidayAutoApplied": "Тему «{holiday}» увімкнено автоматично. Ваша тема повернеться після свята.", + "themes_holidayAutoAppliedTag": "Увімкнено автоматично", + "themes_myThemes": "Мої теми", + "themes_myThemesEmpty": "Створіть власну тему: оберіть фон і акцентний колір.", + "themes_create": "Створити тему", + "themes_import": "Імпортувати тему", + "themes_importHint": "Вставте код теми", + "themes_importInvalid": "Це недійсний код теми", + "themes_imported": "Тему «{name}» додано", + "themes_customize": "Змінити копію", + "themes_copyCode": "Скопіювати код теми", + "themes_codeCopied": "Код теми скопійовано", + "themes_deleteConfirm": "Видалити тему «{name}»?", + "themes_copyName": "Копія «{name}»", + "themes_newTitle": "Нова тема", + "themes_editTitle": "Змінити тему", + "themes_name": "Назва", + "themes_nameRequired": "Дайте темі назву", + "themes_background": "Фон", + "themes_backgroundHelp": "Темний фон дає темну тему", + "themes_accent": "Акцент", + "themes_accentHelp": "Кнопки, виділення та ваші повідомлення в чаті", + "themes_hexColor": "HEX-колір", + "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": "Імпортовано тем: {count}", + "themes_importFileNone": "У цьому файлі немає тем", + "chatBackground_title": "Тло чату", + "chatBackground_thisChatOnly": "Лише для цього чату", + "chatBackground_themeOverrides": "Ваша тема «{name}» задає тло в усіх чатах. Вимкніть це в темі, щоб використати це тло.", + "chatBackground_none": "Немає", + "chatBackground_picture": "Картинка", + "chatBackground_choosePicture": "Обрати картинку", + "chatBackground_pictureFailed": "Не вдалося використати цю картинку", + "chatBackground_fade": "Затемнення", + "themes_chatBackground": "Тло чату", + "themes_chatBackgroundHelp": "Показується в чатах, які не мають власного тла", + "themes_chatBackgroundEverywhere": "Використовувати в усіх чатах", + "themes_chatBackgroundEverywhereHelp": "Також замінює тла, задані в окремих чатах" } diff --git a/lib/l10n/app_zh.arb b/lib/l10n/app_zh.arb index aeddf53d..29a502be 100644 --- a/lib/l10n/app_zh.arb +++ b/lib/l10n/app_zh.arb @@ -3457,5 +3457,79 @@ }, "networkMap_sourceLocalHint": "你的无线电听到的节点", "networkMap_sourceOnlineHint": "来自在线网络地图的中继器", - "networkMap_sourceBothHint": "你的无线电节点加上在线网络地图" + "networkMap_sourceBothHint": "你的无线电节点加上在线网络地图", + "holidayGreeting_halloween": "万圣节快乐|萬聖節快樂|万圣夜快乐|萬聖夜快樂|不给糖就捣蛋|不給糖就搗蛋", + "holidayGreeting_thanksgiving": "感恩节快乐|感恩節快樂|感恩节愉快|感恩節愉快", + "holidayGreeting_christmas": "圣诞快乐|聖誕快樂|圣诞节快乐|聖誕節快樂|圣诞节愉快|聖誕節愉快|圣诞愉快|聖誕愉快", + "holidayGreeting_newYear": "新年快乐|新年快樂|元旦快乐|元旦快樂|新年好|新年愉快", + "appSettings_colorTheme": "配色主题", + "appSettings_holidayAnimations": "节日消息动画", + "appSettings_holidayAnimationsSubtitle": "有人发送节日祝福时,显示蝙蝠、火鸡、圣诞老人或烟花", + "themes_title": "主题", + "themes_default": "MeshCore", + "themes_defaultSubtitle": "标准颜色,跟随浅色/深色设置", + "themes_builtIn": "内置", + "themes_holidays": "节日", + "themes_holidayAutoSwitch": "自动切换", + "themes_holidayAutoSwitchSubtitle": "每个节日的主题从节日前 17 天使用到节日当天", + "themes_holidayAutoApplied": "已自动启用{holiday}主题。节日过后会恢复你自己的主题。", + "themes_holidayAutoAppliedTag": "已自动启用", + "themes_myThemes": "我的主题", + "themes_myThemesEmpty": "选择背景和强调色,制作你自己的主题。", + "themes_create": "创建主题", + "themes_import": "导入主题", + "themes_importHint": "粘贴主题代码", + "themes_importInvalid": "这不是有效的主题代码", + "themes_imported": "已添加主题“{name}”", + "themes_customize": "自定义副本", + "themes_copyCode": "复制主题代码", + "themes_codeCopied": "主题代码已复制", + "themes_deleteConfirm": "删除主题“{name}”?", + "themes_copyName": "{name} 副本", + "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": "已导入 {count} 个主题", + "themes_importFileNone": "该文件中没有找到主题", + "chatBackground_title": "聊天背景", + "chatBackground_thisChatOnly": "仅用于此聊天", + "chatBackground_themeOverrides": "你的主题“{name}”为所有聊天设置了背景。请在该主题中关闭此项,才能使用这里的背景。", + "chatBackground_none": "无", + "chatBackground_picture": "图片", + "chatBackground_choosePicture": "选择图片", + "chatBackground_pictureFailed": "无法使用该图片", + "chatBackground_fade": "淡化", + "themes_chatBackground": "聊天背景", + "themes_chatBackgroundHelp": "显示在没有自己背景的聊天中", + "themes_chatBackgroundEverywhere": "用于所有聊天", + "themes_chatBackgroundEverywhereHelp": "同时会替换单个聊天中设置的背景" } 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 d0475aa7..29aaf814 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'; @@ -136,6 +137,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; @@ -266,6 +286,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, @@ -357,6 +382,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, @@ -495,6 +525,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: @@ -638,6 +680,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, @@ -726,6 +773,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 becc7c38..33bb651e 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); +}