41 Commits

Author SHA1 Message Date
b-dev-mobile 0a36abe695 chore: версия 0.5.127 (135) + CHANGELOG
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 05:34:51 +00:00
b-dev-mobile 4aa732846d feat(deck): полный функционал Карточек — создание/правка/перемещение/метки
Было: только чтение (доски → список названий карточек). Стало —
полноценная работа через внутренний Deck API (/api/v1.0, тот же, что
у веб-версии; app-password + OCS-APIRequest, CSRF не требуется):
- Доска: колонки-стеки со счётчиком; карточки показывают метки-чипы
  (цвета доски), срок, исполнителей, чекбокс «выполнено».
- Карточка-деталь (лист): правка названия/описания, срок через
  DatePicker (+сброс), переключение done, метки доски тапом,
  перемещение в другую колонку, архив, удаление.
- Создание карточки (+ в колонке) и колонки (+ Колонка в шапке).
- Права: если PERMISSION_EDIT=false — всё только для чтения.
- Модели расширены (DeckLabel/description/duedate/assignees/stackId);
  VM перечитывает доску после каждого действия. Поля сверены с
  Card.php на forbion. Запись на устройстве не тестировалась (в прод
  Deck не писал) — проверить при ревью.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 05:33:28 +00:00
b-dev-mobile 7f95b07666 design(menu): шторка и нижняя панель 1:1 по живому forbion
Косяк: оба меню расходились с боевым forbion (_header.css).
Шторка (.app-menu--mobile): убраны скругление верха и ручка-хендл
(в живом их нет), высота — по контенту почти на весь экран (была
½ экрана), нижний отступ 90 под панель, сетка 3 кол. с gap 8 (было 20),
фон #FBFBFB. Иконки-glass теперь ЛОКАЛЬНЫЕ (assets/menu/, офлайн);
Уведомления/Настройки — фирменные mobile-*-glass вместо Material-иконок
в круге.
Нижняя панель (.header__mobile-bottom): фикс. пилюля 328×61, паддинг 3,
кнопки 55 с фоном #FBFBFB и рамкой #E6E6E6 (была градиентная), раскладка
space-between; ВОЗВРАЩЕНА подсветка активного — текущий раздел и открытый
бургер красятся полупрозрачным зелёным градиентом 104° (как в forbion).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 05:22:23 +00:00
b-dev-mobile 92e0e9690b chore: версия 0.5.126 (134) + CHANGELOG релиза
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 04:47:17 +00:00
b-dev-mobile 2cf5977dd4 feat(mail): фильтры — на официальный API, ОБЩИЕ с вебом, полное управление
Заменил собственный sieve-слой (маркированные блоки F7MOBILE) на
штатный API NC Mail GET/PUT /apps/mail/api/filter/{accountId} — тот
самый, которым пользуется веб-модалка «Новый фильтр». Теперь:
- видны ВСЕ правила (созданные и в вебе, и в приложении);
- любое правило можно включить/выключить и удалить с телефона;
- простые правила (1 условие) редактируются инлайн с префиллом формы;
  сложные помечаются «правится в вебе», их JSON сохраняется целиком
  (MailFilterRule держит raw и не теряет незнакомые поля);
- сериализацию в sieve делает сервер (FilterBuilder, секция
  «### Nextcloud Mail: Filters ###») — совместимость гарантирована.
Действия конструктора: переместить в папку / пометить прочитанным
(addsystemflag \\Seen). MailFilterRuleTest — 3 юнит-теста зелёные.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 04:43:42 +00:00
b-dev-mobile ab864aa7d7 feat(mail): sieve-фильтры — список и конструктор «Новый фильтр»
Паритет живого веба (модалка «Новый фильтр»):
- API: GET/PUT /apps/mail/api/sieve/active/{accountId} (MailRepository).
- Наши правила живут в маркированных блоках # F7MOBILE-BEGIN/END
  внутри активного скрипта; пользовательские/веб-правила НЕ трогаем,
  перед каждой записью скрипт перечитывается (не затираем изменения
  из веба). require ["fileinto","imap4flags"] — в начале скрипта.
- Конструктор: если [От/Тема/Кому] содержит X → [переместить в папку /
  пометить прочитанным / удалить]; список правил с удалением.
- Вход: Настройки почты → аккаунт → «Фильтры».
- MailSieveScript покрыт юнит-тестами (roundtrip, сохранение чужого
  скрипта, экранирование кавычек, все действия) — 4 зелёных.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 04:15:17 +00:00
b-dev-mobile 2df46667e0 feat(mail): «Создать задачу» и «Создать событие» из письма
Паритет живого веба: пункты в меню действий письма (иконки темы
create-task-black/calendar-black) → модалки в стиле темы (заголовок
18/600, плашки-выбор списка/календаря #F5F5F5 r10, дата через
DatePicker, «Весь день», время ЧЧ:ММ). Префилл: название = тема
письма, описание = «Из письма от <отправитель>». Сохранение через
существующие TasksRepository.createTask / CalendarRepository.saveEvent
(CalDAV) — feature:mail теперь зависит от feature:tasks и
feature:calendar (цикла нет).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 04:07:21 +00:00
b-dev-mobile 9ec3114506 design(mail): пустая папка — цветная иконка почты по живой теме
mail-icon-color.svg 64dp (забандлена, офлайн) + текст по центру
(был голый серый текст).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 03:25:51 +00:00
b-dev-mobile 8204e605e2 design(mail): модалка меток по живой теме
Заголовок 18/600; строки тегов — плашки #F5F5F5 r10 (minHeight 36),
имя тега — цветная пилюля MailTagChip (был голый текст).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 03:24:42 +00:00
b-dev-mobile 84a1ea9f27 design(calendar): деталь события и пилюли по живой теме
Заголовок события 18/600 (модалки темы); пилюля события в неделе —
#ECF9DE с рамкой #70B62B r4 (был полупрозрачный зелёный r6). Лейблы
детали уже серые, кнопки — дизайн-система (градиентные пилюли) —
совпадали. Наш bottom-sheet и список дня — осознанная моб. адаптация.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 03:22:53 +00:00
b-dev-mobile 753b574e1a design(login): фон, локальный логотип, QR-кнопка по живой теме
_page-login.css: фон страницы #E5EFE8 (был белый); big-forbion.svg
забандлен в assets/login/ — логотип виден офлайн и до ввода адреса
сервера (грузился с сервера); кнопка QR — «ссылка-кнопка» 40dp
с фоном #F0F1F4 r8 и чёрным текстом 14 (была текстовая). Карточка
440/r8/24, заголовок 18/600, поля — уже совпадали.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 03:20:42 +00:00
b-dev-mobile 3da61da45d design(mail): композер 1:1 по живой теме — чипы получателей и поля
_mobile-mail.css 3283–4067:
- Поля Кому/Копия/Скрытая: подтверждённые адреса — ЧИПЫ-пилюли 26dp
  (фон #70B62B 12%, рамка 25%, текст 13/18, крестик 14 чёрный-50%),
  хвост — инлайн-ввод 14sp; значение остаётся строкой с запятыми,
  VM/parseRecipients не тронуты. Поле авто-высотой (FlowRow), minHeight 40.
- Заголовок «Новое сообщение» 16/600 (был Bold titleMedium).
- Поля темы/получателей: текст и плейсхолдер 14/500 (был 15).
- Тулбар форматирования: r8 (был 10), фон #FDFDFD, тень темы, паддинг 4.
Кнопка «Отправить» 44dp на всю ширину и скрепка 32 в углу редактора
уже совпадали.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 02:58:13 +00:00
b-dev-mobile 999b52eb80 chore: версия 0.5.125 (133)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 21:26:12 +00:00
b-dev-mobile 4c7566bbb2 design(contacts): типографика строк по живой теме
_mobile-contacts.css: имя 16/500 (был SemiBold), детали (email/телефон)
14/500 серым (были 12). Задачи/Карточки сверены: уже в токенах темы
(строки/заголовки/F7ListCard r8) — правок не потребовалось.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 21:25:19 +00:00
b-dev-mobile 65805a15af design(calendar): месячная сетка 1:1 по живой теме
_calendar-month-view-mobile.css: месяц — белая карточка r12 с рамкой
и паддингом 12; дни недели — круги 40 #F5F5F5 (16/500, были пилюли);
ячейки — карточки #FDFDFD r4 с тенью, высота 120 (были gridline 66),
зазор 4; номер дня 14/500 справа-сверху; «сегодня» — зелёная плашка
40×24 r4 с белым числом (был круг); события — пилюли #ECF9DE с рамкой
#70B62B r4, текст 10/12, до 3 в ячейке; вне месяца — серые.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 21:20:26 +00:00
b-dev-mobile bc9a31a026 design(talk): пузыри чата и вложения 1:1 по живой теме
_mobile-spreed.css: автор — внутрь пузыря (12/600 чёрный, было зелёное
имя над пузырём), паддинг пузыря 8×10 (был 8×12), зазор сообщений 4px;
вложение-файл — круглая иконка типа 49dp из локальных assets/filetypes
+ имя 14/500 #3F3F3F (был смайлик 📄 зелёным). Радиус r8 и цвета
пузырей (#FDFDFD/#E0F8C9) уже совпадали.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 21:15:48 +00:00
b-dev-mobile bbfb6ae424 design(mail): список, навигация, sender-card 1:1 по живой теме
_mobile-mail.css:
- Карточка письма: r8 (было 12), фон #FDFDFD, нижняя граница #E6E6E6 +
  тень #CBCBCB, отправитель 16/500, тема 14/600 чёрный-50%, ДОБАВЛЕНА
  превью-строка письма (14/500 чёрный-50%, 1 строка), дата 14/500,
  зазор между карточками 2px (был 8).
- Навигация: панель 90% ширины, фон #FBFBFB, имя папки 14/500 (без
  жирнения активной), счётчик 16/500 серым без фона, разделитель
  #E6E6E6 под шапкой аккаунта.
- Sender-card сообщения: аватар 40 (был 44), имя 16/500.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 21:09:11 +00:00
b-dev-mobile 1bc568b059 design(files): навигация, панель выделения, свойства, поповеры — 1:1 по теме
_mobile-files.css, оставшиеся секции:
- Левая панель: ширина 90%, фон #FBFBFB, отступы темы, градиентная
  кнопка «Создать или загрузить» (40dp, 104°, белые папка/плюс/разделитель)
  — кнопка создания из шапки уехала сюда, как в живом; строки 40dp/r8,
  иконка 20, текст 16/20, активная #ECF9DE, без «⋮»; квота по центру серым.
- Панель выделения: 40dp, чекбокс темы «выбрать все» (провязан
  selectAllVisible/clearSelection), «Выбрать все» чёрным + «(Выбран N)»
  серым, пилюля «Действия» 25dp.
- Панель свойств: на весь экран без скруглений, фон #FBFBFB, крестик 40,
  заголовок 18/600 + звезда темы 20 (зелёная/серая), чип владельца-пилюля
  25dp (аватар 16), «дата / размер» серым справа; табы-пилюли 30dp
  с иконками темы (comment/people-icon-black), активная #ECF9DE
  с рамкой #70B62B 20%.
- Поповеры действий (строка и массовые): белые r8 с рамкой и тенью 8%,
  пункты 25dp/r6, иконка 16, текст 14.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 20:58:28 +00:00
b-dev-mobile 6895f1bffd design(files): главный экран 1:1 по живой теме forbion (_mobile-files.css)
Источник — мобильный CSS боевого сервера (копия в design-reference).
- 9 фирменных SVG хрома забандлены в assets/chrome/ (офлайн): чекбоксы
  16dp (контур/зелёный), звезда избранного, ⋮, лупа, дом, тумблеры вида,
  цветная папка (закрыт TODO «папка с сервера»).
- Строка списка: высота 44dp, чекбокс темы 16 в колонке 44, иконка 30
  (было 24) + звезда-оверлей у избранных, колонки размера (56, центр)
  и даты (88, вправо, относительное время как в вебе), ⋮ 16 в колонке 32,
  без скругления, выбранная — #ECF9DE.
- Тумблер вида: круг 40, иконка 16 из темы. Крошки: дом 16 (home-bottom),
  все сегменты серые 14/20, шеврон 16. Фильтр-чипы: пилюли 25dp,
  minWidth 86, текст чёрный, фон #FBFBFB + мягкая тень (как в теме).
- Карточка сетки: радиус 12, иконка 80 (было 48), чекбокс/звезда 16 по
  углам, ⋮ 16, фон #FBFBFB.
- Поиск: фон #FBFBFB, локальная лупа из CSS темы, крестик-очистка 20dp.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 20:07:59 +00:00
b-dev-mobile e5bbf0e123 design: семантика ошибок по боевой теме forbion
Живой мобильный CSS сервера (themes/forbion, _base.css) — теперь источник
истины (решение владельца «копировать один в один»): Error #D74642,
ErrorText #D42722, ErrorBg #FFE2E2. Базовый Red #FF7A66 брендбука
сохранён для тегов.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 18:45:12 +00:00
b-dev-mobile 2758d07e47 fix: чёткий векторный логотип на сплэше
Сплэш показывал лаунчер-иконку: растр 432px тянулся в круг ~1000px —
мыло, легаси-квадрат криво резался маской. Теперь — VectorDrawable
из фирменного logo-header.svg темы forbion (точные цвета #151515/#70B62B),
глиф отцентрирован в безопасной зоне круга (2/3), резкий на любом dpi.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 18:33:04 +00:00
b-dev-mobile c6732546f1 chore: версия 0.5.124 (132)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 17:53:20 +00:00
b-dev-mobile dd5bdbc177 push: 30-с таймаут входящего звонка + уведомление «Пропущенный звонок»
Не отвеченный звонок звонит 30 секунд, после чего снимается сам:
рингтон/уведомление гасятся, показывается «Пропущенный звонок»
(на локскрине — обезличенно, после разблокировки — с названием
комнаты; тап открывает комнату). Полноэкранный входящий закрывается
по тому же событию. Страховочный alarm поднимает процесс и снимает
звонок, даже если система убила приложение во время звонка.
Принятые/отклонённые звонки «Пропущенный» не показывают.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 17:47:53 +00:00
b-dev-mobile 47534ceb59 refactor: session/auth в MainViewModel (Этап 2 п.10, ч.2)
Верхнеуровневый session-жизненный цикл вынесен из AppScaffold в MainViewModel
(AndroidViewModel): держит session (StateFlow), login()=save+set,
logout()=ревокация app password + OfficeWarmup.clear + WebViewPool.dispose +
AuthStore.clear. AppScaffold читает vm.session.collectAsState(), forceLogout=
{vm.logout()}. Бонус: сессия переживает пересоздание Activity (поворот) —
раньше жила в remember и перечитывалась из AuthStore. UI-тумблеры (menuOpen,
sidebar/settings-флаги, pending* deep-link) осознанно оставлены в composable —
это чистое UI-состояние, не бизнес-логика.
2026-07-09 15:02:21 +00:00
b-dev-mobile 8c90e83cef refactor: LoginScreen вынесен из AppScaffold в свой файл (Этап 2 п.10, ч.1)
LoginScreen (~234 строки) был вложен в файл-«бог» AppScaffold. Вынесен в
LoginScreen.kt (internal, тот же пакет) — чистый перенос, поведение не
менялось. AppScaffold: 925→691 строк, убрано 22 импорта, использовавшихся
только в LoginScreen. Первый безопасный слой разбора AppScaffold.
2026-07-09 14:42:55 +00:00
b-dev-mobile a674721353 ux: единый экран ошибки F7ErrorState + retry (Этап 2 п.12)
Новый F7ErrorState: центрированная иконка + сообщение + «Повторить»
вместо россыпи красного текста. F7ModuleScreen при ошибке без данных
показывает его (+ новый onErrorRetry — retry без хедер-кнопки ↻).
Подключено: Контакты/Конференции/Карточки/Поддержка (через F7ModuleScreen),
Файлы (onErrorRetry=refreshCurrent), Почта (пустой список + ошибка →
F7ErrorState, убран верхний баннер-текст). Retry везде дергает load/refresh.
2026-07-09 14:08:36 +00:00
b-dev-mobile 8f7eaff611 ux: SplashScreen на холодном старте (Этап 2 п.12)
androidx core-splashscreen 1.0.1: тема Theme.F7.Splash (фон #FBFBFB как
F7Colors.Background + иконка ic_launcher), postSplashScreenTheme — прежняя
тема приложения. installSplashScreen() в MainActivity.onCreate до super.
Вместо голого белого экрана при запуске.
2026-07-09 13:13:01 +00:00
b-dev-mobile 83e071673c talk-native: убран runBlocking со старта и пути звонка (аудит C4/п.7)
TalkVendorUserSync.ensureUser → suspend(IO). Прогрев на старте приложения —
в фоновом scope (раньше блокировал main в Application.onCreate, вкл. чтение
AuthStore/Keystore). Путь звонка: подготовка vendor-юзера в корутине (IO),
запуск CallActivity на main — убран ANR-риск на входящем звонке.
Поведение то же: при неготовности — тот же тост, фолбэк WebView сохранён.
2026-07-09 12:58:55 +00:00
b-dev-mobile d1d61d0cf8 ux: pull-to-refresh на всех списках (Этап 2 п.12)
Раньше свайп-обновление было только в Файлах. Добавлено (Material3
PullToRefreshBox): Почта (входящие/исходящие, force-обновление), Конференции
(список бесед — заменяет убранную кнопку ↻), Контакты (force + CTag — дёшево),
Задачи (список), Карточки (доски и открытая доска). Контакты: refresh()
получил параметр force (pull-to-refresh форсит sync мимо TTL; с CTag-проверкой
это 1 лёгкий PROPFIND).
2026-07-09 12:48:08 +00:00
b-dev-mobile 286ab9c8bf gitignore: dist/ (локальные архивы исходников для релизов) 2026-07-09 09:41:13 +00:00
b-dev-mobile b03cb09a6c changelog: календарь — кэш событий по CTag 2026-07-09 09:40:28 +00:00
b-dev-mobile fb57156ee9 calendar: кэш событий по CTag (Этап 2, DAV ч.2)
listCalendars теперь забирает и cs:getctag (тот же PROPFIND — ноль лишних
запросов; DavCalendar.ctag). Новый CalendarEventsCache — дисковый кэш
СЫРЫХ REPORT-ответов per (аккаунт, календарь, диапазон), ключ — CTag:
не менялся → события парсятся с диска (боевым парсером CalDavClient),
REPORT-запросы в сеть не идут. Изменился → сеть + обновление кэша.
Хранение сырого XML вместо сериализации моделей — без хрупкого
JSON-маппинга ~20 полей события; чистка записей старше 30 дней.
CalDavClient.queryEventsInRange разделён на queryEventsRawXml +
parseEventsXml (поведение прежнее). Эффект: переключение месяцев,
периодический рефреш и возврат в календарь при неизменных календарях —
1 PROPFIND вместо 1+N REPORT. +5 unit-тестов кэша (JVM, TemporaryFolder).
2026-07-09 09:39:07 +00:00
b-dev-mobile 4c403e5ec2 changelog: контакты — инкрементальная синхронизация по CTag 2026-07-09 06:48:19 +00:00
b-dev-mobile 00daa980a8 contacts: инкрементальная синхронизация по CTag (Этап 2, DAV)
CardDavClient.collectionSignature() — дешёвый PROPFIND depth:1 за CTag книг
(расширение CalendarServer, Nextcloud; фолбэк sync-token), без address-data.
ContactsRepository.syncContacts: перед полной закачкой всех vCard сверяет
подпись коллекций; не менялось → отдаём кэш (Room), не качаем. Ускоряет
pull-to-refresh (раньше — полный PROPFIND ~500 vCard каждый раз).
+4 unit-теста на parseCollectionSignature (regex-парсер, без Android XmlPull).
2026-07-09 06:44:49 +00:00
b-dev-mobile 2709dba03f ci: паркуем CI до Docker-режима (host-исполнение act_runner 0.2.13 сломано)
Диагноз: диспетчеризация Gitea работает, но host-исполнение act_runner
роняет шаги (No such file / MODULE_NOT_FOUND, задвоение hostexecutor/.cache).
Workflow → workflow_dispatch (не auto-fail на push), раннер остановлен.
Рабочий путь на будущее — Docker-образ с JDK+SDK + gradle-кэш (docs/CI.md).
Сборки/релизы пока вручную (v0.5.123 опубликован).
2026-07-09 04:56:43 +00:00
b-dev-mobile c53885b230 ci: обход бага host-режима act_runner — checkout обычным git (без JS-экшенов)
CI / verify (push) Failing after 1s
2026-07-09 04:50:55 +00:00
b-dev-mobile a696d45f2e ci: тест после чистой регистрации раннера
CI / verify (push) Failing after 3s
CI / release (push) Has been skipped
2026-07-09 04:19:35 +00:00
b-dev-mobile 2ae03264ff ci: восстановлен runs-on [self-hosted, f7-android] (метка не была причиной)
CI / verify (push) Failing after 4s
CI / release (push) Has been skipped
2026-07-09 04:12:34 +00:00
b-dev-mobile 47c274e441 ci: тест — runs-on одна метка f7-android
CI / verify (push) Failing after 3s
CI / release (push) Has been skipped
2026-07-09 04:10:19 +00:00
b-dev-mobile 34bb16c59d ci: тест триггера после апгрейда раннера 0.2.13
CI / verify (push) Failing after 4s
CI / release (push) Has been skipped
2026-07-09 04:06:54 +00:00
b-dev-mobile 0fcc575e76 ci: пустой коммит для проверки триггера Actions
CI / verify (push) Failing after 3s
CI / release (push) Has been skipped
2026-07-09 03:55:57 +00:00
93 changed files with 4676 additions and 964 deletions
+17 -9
View File
@@ -1,14 +1,22 @@
name: CI name: CI
# Активируется, когда на инфре B зарегистрирован self-hosted act_runner с меткой `f7-android` # ⏸️ ПАРКОВКА (2026-07-09): CI отложен. Раннер на инфре B развёрнут, но
# (JDK 21 + Android SDK 36 — как на билд-машине). Пока раннера нет — джобы ждут исполнителя. # host-исполнение act_runner 0.2.13 в нашем окружении сломано (криво резолвит
# Регистрация раннера — инфра-шаг ячейки B (см. docs/CI.md). # пути к шагам/JS-экшенам: MODULE_NOT_FOUND / "No such file", задвоение
# hostexecutor/.cache/act). Рабочий путь — Docker-исполнение с кастомным образом
# (JDK 21 + Android SDK 36) и volume для ~/.gradle. До этого — сборки/релизы вручную
# на билд-машине (см. docs/CI.md).
#
# Триггер временно ручной (workflow_dispatch), чтобы push'и не создавали падающие
# прогоны. Когда настроим Docker-раннер — вернуть блок on: push/pull_request ниже.
#
# on:
# push:
# branches: [main]
# tags: ['v*']
# pull_request:
on: on:
push: workflow_dispatch:
branches: [main]
tags: ['v*']
pull_request:
env: env:
JAVA_HOME: /usr/lib/jvm/java-21-openjdk-amd64 JAVA_HOME: /usr/lib/jvm/java-21-openjdk-amd64
@@ -17,7 +25,7 @@ env:
jobs: jobs:
verify: verify:
# lint + unit-тесты + debug-сборка на каждый push в main и на PR # detekt + unit-тесты + Android Lint + debug-сборка на каждый push в main и на PR
runs-on: [self-hosted, f7-android] runs-on: [self-hosted, f7-android]
if: github.ref_type != 'tag' if: github.ref_type != 'tag'
steps: steps:
+1
View File
@@ -24,3 +24,4 @@
*.log *.log
*.tmp *.tmp
.cxx/ .cxx/
dist/
+8
View File
@@ -2,6 +2,14 @@
Формат: `ГГГГ-ММ-ДД | версия | изменение | контракты | риск` Формат: `ГГГГ-ММ-ДД | версия | изменение | контракты | риск`
- 2026-07-10 | v0.5.127 (135) | Меню и Карточки. **Меню 1:1 по живому forbion:** шторка приложений (по «трём полоскам») без скругления верха и ручки, высота по контенту почти на весь экран, сетка 3 кол. gap 8, иконки-glass локально (офлайн); нижняя панель — плавающая пилюля 328×61, кнопки 55 (#FBFBFB/рамка #E6E6E6), возвращена подсветка активного раздела и открытого бургера (полупрозрачный зелёный градиент). **Карточки (Deck) — полный функционал** (было только чтение): доска с колонками-стеками, карточки с метками/сроком/исполнителями/чекбоксом; карточка-деталь (правка названия/описания, срок через пикер, done, метки доски, перемещение в колонку, архив, удаление); создание карточек и колонок; учёт прав PERMISSION_EDIT. Всё через внутренний Deck API — общее с веб-версией | Deck API /api/v1.0 (write) | средний: пишущие операции Deck не тестировались на устройстве — проверить создание/правку/перемещение
- 2026-07-10 | v0.5.126 (134) | СВОДНЫЙ РЕЛИЗ (включает непубликовавшиеся v0.5.124/125). **Пуши/звонки**: клиент собран под верный Firebase-проект f7push (google-services.json владельца; раньше токены уходили в чужой проект → сервер получал «SenderId mismatch», звонки не доходили); входящий звонок звонит 30 с, затем авто-сброс и уведомление «Пропущенный звонок» (на локскрине обезличенно, после разблокировки — с названием комнаты; страховочный alarm на случай смерти процесса). **Дизайн 1:1 по живой теме forbion** (мобильный CSS боевого сервера — новый источник истины): Файлы (строки 44dp с колонками размер/дата, фирменные чекбоксы/иконки офлайн, навигация с кнопкой «Создать или загрузить», панель выделения, свойства, поповеры), Почта (карточки писем с превью-строкой, навигация, sender-card, композер с чипами получателей, модалка меток, пустая папка), Конференции (автор внутри пузыря, вложения-карточки с иконкой типа), Календарь (месяц: ячейки-карточки 120dp, «сегодня»-плашка, пилюли событий), Контакты (типографика), логин (фон, локальный логотип, QR-кнопка), векторный сплэш вместо мыльного растра, семантика ошибок #D74642. **Новые функции**: «Создать задачу» и «Создать событие» из письма (меню ⋮, префилл темой, CalDAV); фильтры почты — общие с веб-версией (штатный API /api/filter: все правила видны, вкл/выкл/удаление, редактирование простых) | +GET/PUT /apps/mail/api/filter/{id}; feature:mail → зависимости feature:tasks, feature:calendar | средний: большой объём UI-правок + новый auth-жизненный цикл (MainViewModel) — проверить вход/выход/поворот, звонки, фильтры на устройстве
- 2026-07-09 | (в разработке) | Этап 2 (DAV, ч.2 — календарь): кэш событий по CTag. `listCalendars` дополнительно забирает `cs:getctag` (тот же PROPFIND — лишних запросов нет). Новый `CalendarEventsCache` — дисковый кэш сырых REPORT-ответов per (аккаунт, календарь, диапазон) с ключом-CTag: календарь не менялся → события парсятся с диска, REPORT в сеть не идёт; менялся → сеть + обновление кэша (+чистка записей >30 дней). Сырой XML вместо сериализации моделей — переиспользуется боевой парсер. Эффект: переключение месяцев/периодический рефреш/возврат в календарь при неизменных данных — 1 PROPFIND вместо 1+N REPORT. +5 unit-тестов | контракты не менялись | низкий: при любом изменении CTag меняется — данные всегда свежие
- 2026-07-09 | (в разработке) | Этап 2 (DAV, ч.1 — контакты): инкрементальная синхронизация по CTag. `CardDavClient.collectionSignature()` — дешёвый PROPFIND depth:1 за CTag адресных книг (расширение CalendarServer, поддерживается Nextcloud; фолбэк на sync-token), без address-data. `ContactsRepository.syncContacts` перед полной закачкой всех vCard сверяет подпись коллекций: не менялось → отдаём кэш (Room), сеть не грузим. Ускоряет pull-to-refresh (было — полный PROPFIND ~500 vCard каждый раз). +4 unit-теста (regex-парсер подписи, без Android XmlPull). Дальше по Этапу 2: кэш событий календаря + CTag (сейчас экран календаря тянет события живьём по диапазону — под него сначала нужен кэш) | контракты не менялись | низкий: только оптимизация, поведение то же при изменениях
- 2026-07-09 | v0.5.123 (131) | Первый тегированный релиз в Gitea (тег `v0.5.123` + Release с APK и архивом исходников GPL). Включает хвосты этапов 0/1: FLAG_SECURE на экранах входа/PIN (аудит п.3, коммит cfa9fe2) + активированный CI-раннер на инфре B (docs/CI). Функциональных изменений в приложении относительно v0.5.122 нет, кроме FLAG_SECURE | контракты не менялись | низкий - 2026-07-09 | v0.5.123 (131) | Первый тегированный релиз в Gitea (тег `v0.5.123` + Release с APK и архивом исходников GPL). Включает хвосты этапов 0/1: FLAG_SECURE на экранах входа/PIN (аудит п.3, коммит cfa9fe2) + активированный CI-раннер на инфре B (docs/CI). Функциональных изменений в приложении относительно v0.5.122 нет, кроме FLAG_SECURE | контракты не менялись | низкий
- 2026-07-08 | v0.5.122 (130) | Убрана кнопка «чаты» из нижней панели (слева теперь всегда «назад», единый layout во всех разделах, включая Конференции) + убрана кнопка обновления ↻ сверху справа в Конференциях (onRefresh у F7ModuleScreen; список грузится при открытии/по push) | контракты не менялись | низкий: только UI - 2026-07-08 | v0.5.122 (130) | Убрана кнопка «чаты» из нижней панели (слева теперь всегда «назад», единый layout во всех разделах, включая Конференции) + убрана кнопка обновления ↻ сверху справа в Конференциях (onRefresh у F7ModuleScreen; список грузится при открытии/по push) | контракты не менялись | низкий: только UI
+3 -2
View File
@@ -39,8 +39,8 @@ android {
applicationId 'ru.forbion.f7cloud.mobile' applicationId 'ru.forbion.f7cloud.mobile'
minSdk 26 minSdk 26
targetSdk 36 targetSdk 36
versionCode 131 versionCode 135
versionName '0.5.123' versionName '0.5.127'
missingDimensionStrategy 'default', 'f7' missingDimensionStrategy 'default', 'f7'
multiDexEnabled true multiDexEnabled true
@@ -128,6 +128,7 @@ dependencies {
implementation libs.firebase.messaging implementation libs.firebase.messaging
implementation libs.coroutines.play.services implementation libs.coroutines.play.services
implementation libs.multidex implementation libs.multidex
implementation libs.core.splashscreen
implementation libs.biometric implementation libs.biometric
implementation libs.fragment.ktx implementation libs.fragment.ktx
implementation libs.camera.camera2 implementation libs.camera.camera2
+1
View File
@@ -37,6 +37,7 @@
android:resource="@mipmap/ic_launcher" /> android:resource="@mipmap/ic_launcher" />
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:theme="@style/Theme.F7.Splash"
android:exported="true"> android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 57 KiB

@@ -25,6 +25,8 @@ import ru.forbion.f7cloud.feature.talknative.TalkNativeCallLauncher
*/ */
class CallIncomingActivity : ComponentActivity() { class CallIncomingActivity : ComponentActivity() {
private var callEndedListener: ((String) -> Unit)? = null
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
enableEdgeToEdge() enableEdgeToEdge()
@@ -55,6 +57,20 @@ class CallIncomingActivity : ComponentActivity() {
finish() finish()
} }
// Звонок сняли извне (30-с таймаут «не берут трубку», принят/отклонён из
// уведомления) — закрываем полноэкранный входящий.
launch.roomToken?.takeIf { it.isNotBlank() }?.let { token ->
val listener: (String) -> Unit = { ended ->
if (ended == token) {
runOnUiThread {
if (!isFinishing) finish()
}
}
}
callEndedListener = listener
F7IncomingCallQueue.addCallEndedListener(listener)
}
setContent { setContent {
F7Theme { F7Theme {
IncomingCallScreen( IncomingCallScreen(
@@ -74,6 +90,12 @@ class CallIncomingActivity : ComponentActivity() {
} }
} }
override fun onDestroy() {
callEndedListener?.let(F7IncomingCallQueue::removeCallEndedListener)
callEndedListener = null
super.onDestroy()
}
override fun onNewIntent(intent: Intent) { override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent) super.onNewIntent(intent)
setIntent(intent) setIntent(intent)
@@ -6,6 +6,7 @@ import android.util.Log
import androidx.activity.compose.setContent import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge import androidx.activity.enableEdgeToEdge
import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.contract.ActivityResultContracts
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
@@ -43,6 +44,8 @@ class MainActivity : FragmentActivity() {
} }
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
// Системный сплэш (фон + иконка) на холодном старте вместо белого экрана
installSplashScreen()
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
enableEdgeToEdge() enableEdgeToEdge()
if (!handleIncomingIntent(intent)) { if (!handleIncomingIntent(intent)) {
@@ -1,10 +1,10 @@
package ru.forbion.f7cloud.mobile.ui package ru.forbion.f7cloud.mobile.ui
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Notifications
import androidx.compose.material.icons.filled.Settings
import ru.forbion.f7cloud.core.designsystem.F7AppMenuItem import ru.forbion.f7cloud.core.designsystem.F7AppMenuItem
// Иконки-glass шторки — локальные (assets/menu/, из живой темы forbion): офлайн + точные.
private fun glass(name: String): String = "file:///android_asset/menu/$name"
enum class AppTab( enum class AppTab(
val title: String, val title: String,
val headerIconPath: String, val headerIconPath: String,
@@ -59,7 +59,7 @@ fun appMenuItems(
val core = coreAppMenuEntries.map { entry -> val core = coreAppMenuEntries.map { entry ->
F7AppMenuItem( F7AppMenuItem(
label = entry.label, label = entry.label,
iconUrl = "$base/themes/forbion/images/header/${entry.iconPath}", iconUrl = glass(entry.iconPath),
selected = entry.tab == active, selected = entry.tab == active,
externalUrl = entry.webPath?.let { "$base$it" }, externalUrl = entry.webPath?.let { "$base$it" },
) )
@@ -72,19 +72,17 @@ fun appMenuItems(
externalUrl = site.openUrl, externalUrl = site.openUrl,
) )
} }
// Нативные пункты по дизайну — действия обрабатываются в AppScaffold по label // Нативные пункты — тоже glass-иконки живой темы (mobile-*-glass), действия по label в AppScaffold
val native = listOf( val native = listOf(
F7AppMenuItem( F7AppMenuItem(
label = "Уведомления", label = "Уведомления",
iconUrl = "", iconUrl = glass("mobile-notifications-glass.svg"),
selected = false, selected = false,
localIcon = Icons.Filled.Notifications,
), ),
F7AppMenuItem( F7AppMenuItem(
label = "Настройки", label = "Настройки",
iconUrl = "", iconUrl = glass("mobile-settings-glass.svg"),
selected = false, selected = false,
localIcon = Icons.Filled.Settings,
), ),
) )
return core + external + native return core + external + native
@@ -18,27 +18,12 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.ui.input.pointer.PointerEventPass import androidx.compose.ui.input.pointer.PointerEventPass
import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.PasswordVisualTransformation
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusProperties
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect
@@ -53,12 +38,9 @@ import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import coil.compose.AsyncImage
import androidx.lifecycle.Lifecycle import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.compose.LocalLifecycleOwner import androidx.lifecycle.compose.LocalLifecycleOwner
@@ -68,34 +50,26 @@ import kotlinx.coroutines.withContext
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.tasks.await import kotlinx.coroutines.tasks.await
import ru.forbion.f7cloud.mobile.BuildConfig
import ru.forbion.f7cloud.core.auth.AppLockStore import ru.forbion.f7cloud.core.auth.AppLockStore
import ru.forbion.f7cloud.core.auth.AppPasswordRevoker
import ru.forbion.f7cloud.core.auth.AuthSession import ru.forbion.f7cloud.core.auth.AuthSession
import ru.forbion.f7cloud.core.auth.AuthStore import androidx.compose.runtime.collectAsState
import ru.forbion.f7cloud.core.auth.AuthVerifier import androidx.lifecycle.viewmodel.compose.viewModel
import ru.forbion.f7cloud.core.auth.normalizeServerUrl
import ru.forbion.f7cloud.core.network.LoginFlowClient import ru.forbion.f7cloud.core.network.LoginFlowClient
import ru.forbion.f7cloud.core.push.F7PushEvent import ru.forbion.f7cloud.core.push.F7PushEvent
import ru.forbion.f7cloud.core.push.F7PushEventHub import ru.forbion.f7cloud.core.push.F7PushEventHub
import ru.forbion.f7cloud.core.push.F7PushRegistrar import ru.forbion.f7cloud.core.push.F7PushRegistrar
import ru.forbion.f7cloud.core.designsystem.F7OverlayNavigationProvider import ru.forbion.f7cloud.core.designsystem.F7OverlayNavigationProvider
import ru.forbion.f7cloud.core.designsystem.F7AppMenuSheet import ru.forbion.f7cloud.core.designsystem.F7AppMenuSheet
import ru.forbion.f7cloud.core.designsystem.F7SecureScreen
import ru.forbion.f7cloud.core.designsystem.F7AppScaffold import ru.forbion.f7cloud.core.designsystem.F7AppScaffold
import ru.forbion.f7cloud.core.designsystem.F7AutoHideBottomBar import ru.forbion.f7cloud.core.designsystem.F7AutoHideBottomBar
import ru.forbion.f7cloud.core.designsystem.F7BottomBarActions import ru.forbion.f7cloud.core.designsystem.F7BottomBarActions
import ru.forbion.f7cloud.core.designsystem.F7BottomBarConfig import ru.forbion.f7cloud.core.designsystem.F7BottomBarConfig
import ru.forbion.f7cloud.core.designsystem.F7MobileBottomBar import ru.forbion.f7cloud.core.designsystem.F7MobileBottomBar
import ru.forbion.f7cloud.core.designsystem.F7Colors import ru.forbion.f7cloud.core.designsystem.F7Colors
import ru.forbion.f7cloud.core.designsystem.F7OutlinedField
import ru.forbion.f7cloud.core.designsystem.F7PrimaryButton
import ru.forbion.f7cloud.core.designsystem.F7TextButton
import ru.forbion.f7cloud.core.designsystem.F7Theme import ru.forbion.f7cloud.core.designsystem.F7Theme
import ru.forbion.f7cloud.core.designsystem.f7SafeTopInsets import ru.forbion.f7cloud.core.designsystem.f7SafeTopInsets
import ru.forbion.f7cloud.mobile.OfficeEditorActivity import ru.forbion.f7cloud.mobile.OfficeEditorActivity
import ru.forbion.f7cloud.mobile.qr.F7QrScannerActivity import ru.forbion.f7cloud.mobile.qr.F7QrScannerActivity
import ru.forbion.f7cloud.mobile.OfficeWebViewPool
import ru.forbion.f7cloud.feature.files.OfficeWarmup import ru.forbion.f7cloud.feature.files.OfficeWarmup
import ru.forbion.f7cloud.mobile.permissions.F7AppPermissions import ru.forbion.f7cloud.mobile.permissions.F7AppPermissions
import ru.forbion.f7cloud.mobile.permissions.F7PermissionRationaleDialog import ru.forbion.f7cloud.mobile.permissions.F7PermissionRationaleDialog
@@ -117,8 +91,8 @@ fun AppScaffold(
onRequestRuntimePermissions: (onFinished: (() -> Unit)?) -> Unit = {}, onRequestRuntimePermissions: (onFinished: (() -> Unit)?) -> Unit = {},
) { ) {
val context = LocalContext.current val context = LocalContext.current
val authStore = remember { AuthStore(context) } val mainVm: MainViewModel = viewModel()
var session by remember { mutableStateOf(authStore.load()) } val session by mainVm.session.collectAsState()
var activeTab by rememberSaveable( var activeTab by rememberSaveable(
saver = Saver( saver = Saver(
save = { state -> state.value.name }, save = { state -> state.value.name },
@@ -173,17 +147,7 @@ fun AppScaffold(
context.applicationContext.getSharedPreferences("f7_permissions", android.content.Context.MODE_PRIVATE) context.applicationContext.getSharedPreferences("f7_permissions", android.content.Context.MODE_PRIVATE)
} }
val logoutScope = rememberCoroutineScope() val forceLogout = { mainVm.logout() }
val forceLogout = {
// Best-effort ревокация app password на сервере ДО очистки локальной сессии.
session?.let { current ->
logoutScope.launch { AppPasswordRevoker.revoke(current) }
}
OfficeWarmup.clear()
OfficeWebViewPool.dispose()
authStore.clear()
session = null
}
LaunchedEffect(session?.serverUrl, session?.username) { LaunchedEffect(session?.serverUrl, session?.username) {
session?.let { OfficeWarmup.warm(it) } session?.let { OfficeWarmup.warm(it) }
} }
@@ -196,10 +160,7 @@ fun AppScaffold(
F7Theme { F7Theme {
if (session == null) { if (session == null) {
LoginScreen(onLogin = { LoginScreen(onLogin = { mainVm.login(it) })
authStore.save(it)
session = it
})
return@F7Theme return@F7Theme
} }
@@ -688,237 +649,3 @@ fun AppScaffold(
} }
private const val PERMISSIONS_PROMPTED_KEY = "runtime_permissions_prompted_v2" private const val PERMISSIONS_PROMPTED_KEY = "runtime_permissions_prompted_v2"
@Composable
private fun LoginScreen(onLogin: (AuthSession) -> Unit) {
F7SecureScreen() // ввод пароля — не в скриншотах/recents
val context = LocalContext.current
val scope = rememberCoroutineScope()
val keyboardController = LocalSoftwareKeyboardController.current
val focusManager = LocalFocusManager.current
val serverFocus = remember { FocusRequester() }
val usernameFocus = remember { FocusRequester() }
val passwordFocus = remember { FocusRequester() }
var serverUrl by rememberSaveable { mutableStateOf(BuildConfig.DEFAULT_SERVER_URL) }
var username by rememberSaveable { mutableStateOf("") }
var password by rememberSaveable { mutableStateOf("") }
var trustAllCerts by rememberSaveable { mutableStateOf(false) }
var loading by rememberSaveable { mutableStateOf(false) }
var error by rememberSaveable { mutableStateOf<String?>(null) }
val qrLauncher = rememberLauncherForActivityResult(
ActivityResultContracts.StartActivityForResult(),
) { result ->
if (result.resultCode != Activity.RESULT_OK) return@rememberLauncherForActivityResult
val qrData = result.data?.getStringExtra(F7QrScannerActivity.RESULT_EXTRA)
?: return@rememberLauncherForActivityResult
scope.launch {
loading = true
error = null
val loginResult = LoginFlowClient.completeQrLogin(qrData, trustAllCerts)
if (loginResult == null) {
error = if (qrData.contains("/login/v2/flow/")) {
"Для входа в браузер откройте профиль в приложении и выберите «Сканировать QR браузера»"
} else {
"Не удалось распознать QR-код"
}
loading = false
return@launch
}
val newSession = AuthSession(
serverUrl = normalizeServerUrl(loginResult.serverUrl),
username = loginResult.username,
appPassword = loginResult.appPassword,
trustAllCerts = trustAllCerts,
)
AuthVerifier.verify(newSession)
.onSuccess { verified -> onLogin(verified) }
.onFailure { error = it.message ?: "Ошибка входа по QR" }
loading = false
}
}
val cameraPermissionLauncher = rememberLauncherForActivityResult(
ActivityResultContracts.RequestPermission(),
) { granted ->
if (granted) {
qrLauncher.launch(F7QrScannerActivity.intent(context))
}
}
fun launchQrScan() {
if (androidx.core.content.ContextCompat.checkSelfPermission(
context,
android.Manifest.permission.CAMERA,
) == android.content.pm.PackageManager.PERMISSION_GRANTED
) {
qrLauncher.launch(F7QrScannerActivity.intent(context))
} else {
cameraPermissionLauncher.launch(android.Manifest.permission.CAMERA)
}
}
fun submitLogin() {
if (loading || serverUrl.isBlank() || username.isBlank() || password.isBlank()) {
return
}
val newSession = AuthSession(
serverUrl = normalizeServerUrl(serverUrl),
username = username.trim(),
appPassword = password,
trustAllCerts = trustAllCerts,
)
scope.launch {
loading = true
error = null
AuthVerifier.verify(newSession)
.onSuccess { verified -> onLogin(verified) }
.onFailure { error = it.message ?: "Ошибка входа" }
loading = false
}
}
val logoUrl = remember(serverUrl) {
"${normalizeServerUrl(serverUrl).trimEnd('/')}/themes/forbion/images/login/big-forbion.svg"
}
Box(
modifier = Modifier
.fillMaxSize()
.f7SafeTopInsets()
.verticalScroll(rememberScrollState())
.padding(horizontal = 16.dp, vertical = 24.dp),
contentAlignment = Alignment.TopCenter,
) {
Column(
modifier = Modifier
.widthIn(max = 440.dp)
.fillMaxWidth(),
horizontalAlignment = Alignment.CenterHorizontally,
) {
AsyncImage(
model = logoUrl,
contentDescription = "Forbion",
modifier = Modifier
.width(300.dp)
.height(70.dp)
.padding(bottom = 48.dp),
contentScale = ContentScale.Fit,
)
Surface(
modifier = Modifier.fillMaxWidth(),
shape = RoundedCornerShape(8.dp),
color = F7Colors.Background,
) {
Column(
modifier = Modifier.padding(24.dp),
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
Text(
"Вход",
fontSize = 18.sp,
fontWeight = FontWeight.SemiBold,
lineHeight = 20.sp,
color = F7Colors.TextPrimary,
modifier = Modifier.padding(bottom = 12.dp),
)
Text(
"Используйте тот же пароль, что и для входа в веб-интерфейс. " +
"Если включена двухфакторная аутентификация — нужен пароль приложения.",
style = MaterialTheme.typography.bodySmall,
color = F7Colors.TextSecondary,
modifier = Modifier.padding(bottom = 8.dp),
)
F7OutlinedField(
value = serverUrl,
onValueChange = { serverUrl = it },
label = "Адрес сервера",
modifier = Modifier
.focusRequester(serverFocus)
.focusProperties { next = usernameFocus },
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.Uri,
imeAction = ImeAction.Next,
autoCorrectEnabled = false,
),
keyboardActions = KeyboardActions(
onNext = { usernameFocus.requestFocus() },
),
onEnter = { usernameFocus.requestFocus() },
)
F7OutlinedField(
value = username,
onValueChange = { username = it },
label = "Имя пользователя",
modifier = Modifier
.focusRequester(usernameFocus)
.focusProperties { next = passwordFocus },
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.Text,
imeAction = ImeAction.Next,
autoCorrectEnabled = false,
),
keyboardActions = KeyboardActions(
onNext = { passwordFocus.requestFocus() },
),
onEnter = { passwordFocus.requestFocus() },
)
F7OutlinedField(
value = password,
onValueChange = { password = it },
label = "Пароль",
modifier = Modifier.focusRequester(passwordFocus),
visualTransformation = PasswordVisualTransformation(),
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.Password,
imeAction = ImeAction.Done,
autoCorrectEnabled = false,
),
keyboardActions = KeyboardActions(
onDone = {
focusManager.clearFocus()
keyboardController?.hide()
submitLogin()
},
onGo = {
focusManager.clearFocus()
keyboardController?.hide()
submitLogin()
},
),
onEnter = {
focusManager.clearFocus()
keyboardController?.hide()
submitLogin()
},
)
Spacer(Modifier.height(8.dp))
F7PrimaryButton(
text = if (loading) "" else "Войти",
onClick = { submitLogin() },
enabled = !loading && serverUrl.isNotBlank() && username.isNotBlank() && password.isNotBlank(),
modifier = Modifier.fillMaxWidth(),
)
F7TextButton(
text = "Сканировать QR для входа",
onClick = { launchQrScan() },
enabled = !loading,
modifier = Modifier.fillMaxWidth(),
)
if (loading) {
CircularProgressIndicator(color = F7Colors.Primary)
}
if (error != null) {
Text(text = error ?: "", color = F7Colors.Error, style = MaterialTheme.typography.bodyMedium)
F7TextButton(
text = "Очистить",
onClick = {
error = null
password = ""
},
)
}
}
}
}
}
}
@@ -0,0 +1,312 @@
package ru.forbion.f7cloud.mobile.ui
import android.app.Activity
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.focus.focusProperties
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.PasswordVisualTransformation
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import coil.compose.AsyncImage
import kotlinx.coroutines.launch
import ru.forbion.f7cloud.core.auth.AuthSession
import ru.forbion.f7cloud.core.auth.AuthVerifier
import ru.forbion.f7cloud.core.auth.normalizeServerUrl
import ru.forbion.f7cloud.core.designsystem.F7Colors
import ru.forbion.f7cloud.core.designsystem.F7OutlinedField
import ru.forbion.f7cloud.core.designsystem.F7PrimaryButton
import ru.forbion.f7cloud.core.designsystem.F7SecureScreen
import ru.forbion.f7cloud.core.designsystem.F7TextButton
import ru.forbion.f7cloud.core.designsystem.f7SafeTopInsets
import ru.forbion.f7cloud.core.network.LoginFlowClient
import ru.forbion.f7cloud.mobile.BuildConfig
import ru.forbion.f7cloud.mobile.qr.F7QrScannerActivity
@Composable
internal fun LoginScreen(onLogin: (AuthSession) -> Unit) {
F7SecureScreen() // ввод пароля — не в скриншотах/recents
val context = LocalContext.current
val scope = rememberCoroutineScope()
val keyboardController = LocalSoftwareKeyboardController.current
val focusManager = LocalFocusManager.current
val serverFocus = remember { FocusRequester() }
val usernameFocus = remember { FocusRequester() }
val passwordFocus = remember { FocusRequester() }
var serverUrl by rememberSaveable { mutableStateOf(BuildConfig.DEFAULT_SERVER_URL) }
var username by rememberSaveable { mutableStateOf("") }
var password by rememberSaveable { mutableStateOf("") }
var trustAllCerts by rememberSaveable { mutableStateOf(false) }
var loading by rememberSaveable { mutableStateOf(false) }
var error by rememberSaveable { mutableStateOf<String?>(null) }
val qrLauncher = rememberLauncherForActivityResult(
ActivityResultContracts.StartActivityForResult(),
) { result ->
if (result.resultCode != Activity.RESULT_OK) return@rememberLauncherForActivityResult
val qrData = result.data?.getStringExtra(F7QrScannerActivity.RESULT_EXTRA)
?: return@rememberLauncherForActivityResult
scope.launch {
loading = true
error = null
val loginResult = LoginFlowClient.completeQrLogin(qrData, trustAllCerts)
if (loginResult == null) {
error = if (qrData.contains("/login/v2/flow/")) {
"Для входа в браузер откройте профиль в приложении и выберите «Сканировать QR браузера»"
} else {
"Не удалось распознать QR-код"
}
loading = false
return@launch
}
val newSession = AuthSession(
serverUrl = normalizeServerUrl(loginResult.serverUrl),
username = loginResult.username,
appPassword = loginResult.appPassword,
trustAllCerts = trustAllCerts,
)
AuthVerifier.verify(newSession)
.onSuccess { verified -> onLogin(verified) }
.onFailure { error = it.message ?: "Ошибка входа по QR" }
loading = false
}
}
val cameraPermissionLauncher = rememberLauncherForActivityResult(
ActivityResultContracts.RequestPermission(),
) { granted ->
if (granted) {
qrLauncher.launch(F7QrScannerActivity.intent(context))
}
}
fun launchQrScan() {
if (androidx.core.content.ContextCompat.checkSelfPermission(
context,
android.Manifest.permission.CAMERA,
) == android.content.pm.PackageManager.PERMISSION_GRANTED
) {
qrLauncher.launch(F7QrScannerActivity.intent(context))
} else {
cameraPermissionLauncher.launch(android.Manifest.permission.CAMERA)
}
}
fun submitLogin() {
if (loading || serverUrl.isBlank() || username.isBlank() || password.isBlank()) {
return
}
val newSession = AuthSession(
serverUrl = normalizeServerUrl(serverUrl),
username = username.trim(),
appPassword = password,
trustAllCerts = trustAllCerts,
)
scope.launch {
loading = true
error = null
AuthVerifier.verify(newSession)
.onSuccess { verified -> onLogin(verified) }
.onFailure { error = it.message ?: "Ошибка входа" }
loading = false
}
}
// Логотип — локальный (assets/login/big-forbion.svg из живой темы): виден офлайн и до
// ввода адреса сервера.
val logoUrl = "file:///android_asset/login/big-forbion.svg"
Box(
modifier = Modifier
.fillMaxSize()
// Живая тема логина: фон страницы --backgroud-color-main-darkgray
.background(Color(0xFFE5EFE8))
.f7SafeTopInsets()
.verticalScroll(rememberScrollState())
.padding(horizontal = 16.dp, vertical = 24.dp),
contentAlignment = Alignment.TopCenter,
) {
Column(
modifier = Modifier
.widthIn(max = 440.dp)
.fillMaxWidth(),
horizontalAlignment = Alignment.CenterHorizontally,
) {
AsyncImage(
model = logoUrl,
contentDescription = "Forbion",
modifier = Modifier
.width(300.dp)
.height(70.dp)
.padding(bottom = 48.dp),
contentScale = ContentScale.Fit,
)
Surface(
modifier = Modifier.fillMaxWidth(),
shape = RoundedCornerShape(8.dp),
color = F7Colors.Background,
) {
Column(
modifier = Modifier.padding(24.dp),
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
Text(
"Вход",
fontSize = 18.sp,
fontWeight = FontWeight.SemiBold,
lineHeight = 20.sp,
color = F7Colors.TextPrimary,
modifier = Modifier.padding(bottom = 12.dp),
)
Text(
"Используйте тот же пароль, что и для входа в веб-интерфейс. " +
"Если включена двухфакторная аутентификация — нужен пароль приложения.",
style = MaterialTheme.typography.bodySmall,
color = F7Colors.TextSecondary,
modifier = Modifier.padding(bottom = 8.dp),
)
F7OutlinedField(
value = serverUrl,
onValueChange = { serverUrl = it },
label = "Адрес сервера",
modifier = Modifier
.focusRequester(serverFocus)
.focusProperties { next = usernameFocus },
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.Uri,
imeAction = ImeAction.Next,
autoCorrectEnabled = false,
),
keyboardActions = KeyboardActions(
onNext = { usernameFocus.requestFocus() },
),
onEnter = { usernameFocus.requestFocus() },
)
F7OutlinedField(
value = username,
onValueChange = { username = it },
label = "Имя пользователя",
modifier = Modifier
.focusRequester(usernameFocus)
.focusProperties { next = passwordFocus },
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.Text,
imeAction = ImeAction.Next,
autoCorrectEnabled = false,
),
keyboardActions = KeyboardActions(
onNext = { passwordFocus.requestFocus() },
),
onEnter = { passwordFocus.requestFocus() },
)
F7OutlinedField(
value = password,
onValueChange = { password = it },
label = "Пароль",
modifier = Modifier.focusRequester(passwordFocus),
visualTransformation = PasswordVisualTransformation(),
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.Password,
imeAction = ImeAction.Done,
autoCorrectEnabled = false,
),
keyboardActions = KeyboardActions(
onDone = {
focusManager.clearFocus()
keyboardController?.hide()
submitLogin()
},
onGo = {
focusManager.clearFocus()
keyboardController?.hide()
submitLogin()
},
),
onEnter = {
focusManager.clearFocus()
keyboardController?.hide()
submitLogin()
},
)
Spacer(Modifier.height(8.dp))
F7PrimaryButton(
text = if (loading) "" else "Войти",
onClick = { submitLogin() },
enabled = !loading && serverUrl.isNotBlank() && username.isNotBlank() && password.isNotBlank(),
modifier = Modifier.fillMaxWidth(),
)
// Живая тема: вторичная кнопка-ссылка 40dp, фон #F0F1F4, r8, текст 14 чёрный
Box(
modifier = Modifier
.fillMaxWidth()
.height(40.dp)
.clip(RoundedCornerShape(8.dp))
.background(Color(0xFFF0F1F4))
.clickable(enabled = !loading, onClick = { launchQrScan() }),
contentAlignment = Alignment.Center,
) {
Text(
"Сканировать QR для входа",
fontSize = 14.sp,
lineHeight = 20.sp,
color = F7Colors.TextPrimary,
)
}
if (loading) {
CircularProgressIndicator(color = F7Colors.Primary)
}
if (error != null) {
Text(text = error ?: "", color = F7Colors.Error, style = MaterialTheme.typography.bodyMedium)
F7TextButton(
text = "Очистить",
onClick = {
error = null
password = ""
},
)
}
}
}
}
}
}
@@ -0,0 +1,41 @@
package ru.forbion.f7cloud.mobile.ui
import android.app.Application
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.launch
import ru.forbion.f7cloud.core.auth.AppPasswordRevoker
import ru.forbion.f7cloud.core.auth.AuthSession
import ru.forbion.f7cloud.core.auth.AuthStore
import ru.forbion.f7cloud.feature.files.OfficeWarmup
import ru.forbion.f7cloud.mobile.OfficeWebViewPool
/**
* Держит session/auth-жизненный цикл верхнего уровня (вынесено из AppScaffold).
* В ViewModel сессия переживает пересоздание Activity (поворот и т.п.) — раньше
* жила в remember и перечитывалась из AuthStore.
*/
class MainViewModel(app: Application) : AndroidViewModel(app) {
private val authStore = AuthStore(app)
private val _session = MutableStateFlow(authStore.load())
val session: StateFlow<AuthSession?> = _session.asStateFlow()
fun login(newSession: AuthSession) {
authStore.save(newSession)
_session.value = newSession
}
fun logout() {
// Best-effort ревокация app password на сервере ДО очистки локальной сессии.
_session.value?.let { current ->
viewModelScope.launch { runCatching { AppPasswordRevoker.revoke(current) } }
}
OfficeWarmup.clear()
OfficeWebViewPool.dispose()
authStore.clear()
_session.value = null
}
}
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Логотип F7 для сплэша: вектор из темы forbion (logo-header.svg) вместо растянутого
растра лаунчер-иконки (мыло). Глиф (35×32, контент x 2.2633.53 / y 5.0125.99)
отцентрирован в центральных 2/3 квадрата 48 — безопасная зона круглой маски сплэша. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="48"
android:viewportHeight="48">
<group
android:scaleX="1.0233"
android:scaleY="1.0233"
android:translateX="5.69"
android:translateY="8.14">
<path
android:fillColor="#151515"
android:pathData="M8.33398 18.9808V25.9711C8.33398 25.9761 8.33209 25.981 8.32873 25.9845C8.32537 25.9881 8.3208 25.9901 8.31605 25.9901H2.27416C2.2718 25.9901 2.26947 25.9896 2.2673 25.9887C2.26512 25.9877 2.26314 25.9863 2.26148 25.9845C2.25812 25.981 2.25623 25.9761 2.25623 25.9711V5.02973C2.25623 5.02724 2.25669 5.02477 2.25759 5.02246C2.25849 5.02016 2.25981 5.01807 2.26148 5.0163C2.26484 5.01274 2.2694 5.01074 2.27416 5.01074H19.7382C19.7415 5.01074 19.7447 5.01166 19.7475 5.01343C19.7503 5.0152 19.7526 5.01773 19.7541 5.02076C19.7556 5.0238 19.7564 5.02722 19.7562 5.03065C19.756 5.03409 19.755 5.03742 19.7532 5.04028L16.2595 10.7647C16.2578 10.7674 16.2555 10.7696 16.2528 10.771C16.2501 10.7725 16.2471 10.7732 16.244 10.7731H8.35192C8.34716 10.7731 8.3426 10.7751 8.33924 10.7787C8.33587 10.7823 8.33398 10.7871 8.33398 10.7921V13.1672C8.33398 13.1723 8.33587 13.1771 8.33924 13.1807C8.3426 13.1842 8.34716 13.1862 8.35192 13.1862H14.9303C14.9328 13.1862 14.9352 13.1867 14.9374 13.1878C14.9397 13.1888 14.9417 13.1903 14.9434 13.1922C14.9451 13.194 14.9464 13.1963 14.9472 13.1987C14.948 13.2011 14.9484 13.2037 14.9483 13.2063L14.6937 18.9439C14.6935 18.9487 14.6915 18.9533 14.6881 18.9566C14.6848 18.96 14.6804 18.9618 14.6758 18.9618H8.35192C8.34716 18.9618 8.3426 18.9638 8.33924 18.9674C8.33587 18.9709 8.33398 18.9758 8.33398 18.9808Z" />
<path
android:fillColor="#70B62B"
android:pathData="M26.2675 10.8048C26.2877 10.7837 26.2836 10.7731 26.255 10.7731H17.7975C17.7762 10.7731 17.7714 10.7638 17.783 10.7452L21.3221 5.03395C21.3317 5.01848 21.3453 5.01074 21.3629 5.01074H33.5155C33.5188 5.01074 33.5219 5.01213 33.5243 5.0146C33.5266 5.01708 33.5279 5.02043 33.5279 5.02393V10.7494C33.5279 10.7673 33.5218 10.7826 33.5095 10.7953C31.0839 13.3392 28.8027 16.2518 27.1169 19.4365C26.3193 20.944 25.6677 22.6434 25.4834 24.3571C25.4296 24.8592 25.4445 25.4268 25.445 25.9632C25.445 25.9811 25.4367 25.9901 25.4201 25.9901H18.4337C18.4164 25.9901 18.4072 25.981 18.4063 25.9627C18.3571 24.9535 18.4315 23.9955 18.6294 23.0886C19.0753 21.0468 20.0567 19.0346 21.1572 17.2724C22.6248 14.9221 24.3809 12.7806 26.2675 10.8048Z" />
</group>
</vector>
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Сплэш при холодном старте (androidx core-splashscreen): фон в цвет
F7Colors.Background + векторный логотип F7 (лаунчер-иконка — растянутый
растр, мылится на сплэше); после — прежняя тема. -->
<style name="Theme.F7.Splash" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">#FBFBFB</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/f7_splash_logo</item>
<item name="postSplashScreenTheme">@android:style/Theme.Material.Light.NoActionBar</item>
</style>
</resources>
@@ -0,0 +1,44 @@
<svg width="49" height="49" viewBox="0 0 49 49" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_di_2888_36127)">
<circle cx="24.5" cy="23.5" r="22.5" fill="url(#paint0_linear_2888_36127)" fill-opacity="0.6" shape-rendering="crispEdges"/>
<circle cx="24.5" cy="23.5" r="22" stroke="url(#paint1_linear_2888_36127)" stroke-opacity="0.2" shape-rendering="crispEdges"/>
</g>
<path d="M9.46191 34.6143V16.043H39.5381V34.6143C39.5381 36.2224 38.2345 37.5259 36.6264 37.5259H12.3736C10.7655 37.5259 9.46191 36.2224 9.46191 34.6143Z" fill="white" stroke="black"/>
<path d="M9.46191 16.0426V12.5093C9.46191 10.9013 10.7655 9.59766 12.3736 9.59766H36.6264C38.2345 9.59766 39.5381 10.9012 39.5381 12.5093V16.0426H9.46191Z" fill="white" stroke="black"/>
<path d="M15.1792 7.44922H14.4867C14.0847 7.44922 13.7588 7.77512 13.7588 8.17713V12.092C13.7588 12.4941 14.0847 12.82 14.4867 12.82H15.1792C15.5812 12.82 15.9071 12.4941 15.9071 12.092V8.17713C15.9071 7.77512 15.5812 7.44922 15.1792 7.44922Z" fill="white" stroke="black"/>
<path d="M21.6235 7.44922H20.931C20.529 7.44922 20.2031 7.77512 20.2031 8.17713V12.092C20.2031 12.4941 20.529 12.82 20.931 12.82H21.6235C22.0255 12.82 22.3514 12.4941 22.3514 12.092V8.17713C22.3514 7.77512 22.0255 7.44922 21.6235 7.44922Z" fill="white" stroke="black"/>
<path d="M28.0688 7.44922H27.3764C26.9743 7.44922 26.6484 7.77512 26.6484 8.17713V12.092C26.6484 12.4941 26.9743 12.82 27.3764 12.82H28.0688C28.4708 12.82 28.7967 12.4941 28.7967 12.092V8.17713C28.7967 7.77512 28.4708 7.44922 28.0688 7.44922Z" fill="white" stroke="black"/>
<path d="M34.5132 7.44922H33.8207C33.4187 7.44922 33.0928 7.77512 33.0928 8.17713V12.092C33.0928 12.4941 33.4187 12.82 33.8207 12.82H34.5132C34.9152 12.82 35.2411 12.4941 35.2411 12.092V8.17713C35.2411 7.77512 34.9152 7.44922 34.5132 7.44922Z" fill="white" stroke="black"/>
<path d="M24.0094 29.8013V31.043H19.2809V29.8013H20.9992V23.4547C20.9323 23.5551 20.8194 23.668 20.6605 23.7934C20.51 23.9104 20.3386 24.0275 20.1463 24.1446C19.954 24.2533 19.7533 24.3453 19.5443 24.4205C19.3436 24.4958 19.1596 24.5334 18.9924 24.5334V23.2541C19.2181 23.2541 19.4439 23.1955 19.6697 23.0785C19.9038 22.9614 20.1212 22.8276 20.3219 22.6771C20.5226 22.5182 20.6814 22.3761 20.7985 22.2507C20.9239 22.1252 20.9908 22.0583 20.9992 22.05H22.4165V29.8013H24.0094ZM27.7577 31.1433C27.2643 31.1433 26.8128 31.0722 26.4031 30.9301C26.0017 30.7879 25.663 30.5831 25.3871 30.3155C25.1112 30.0479 24.9105 29.7385 24.7851 29.3874L25.5376 28.4843C25.5962 28.7017 25.7174 28.9191 25.9014 29.1365C26.0937 29.3539 26.3403 29.5295 26.6414 29.6633C26.9507 29.7971 27.3103 29.864 27.72 29.864C28.0796 29.864 28.3973 29.8096 28.6733 29.7009C28.9576 29.5839 29.1833 29.4208 29.3506 29.2118C29.5178 29.0027 29.6014 28.756 29.6014 28.4717C29.6014 28.154 29.5011 27.8864 29.3004 27.669C29.0997 27.4516 28.8112 27.2886 28.4349 27.1799C28.0587 27.0712 27.6071 27.0168 27.0804 27.0168H26.6539V25.9131H27.0804C27.7744 25.9131 28.3262 25.8002 28.736 25.5744C29.1541 25.3487 29.3631 25.0142 29.3631 24.571C29.3631 24.2951 29.2878 24.0568 29.1373 23.8561C28.9868 23.6471 28.7903 23.4924 28.5478 23.392C28.3053 23.2833 28.0378 23.229 27.7451 23.229C27.2685 23.229 26.8546 23.3377 26.5034 23.5551C26.1522 23.7725 25.8972 24.0401 25.7383 24.3578L24.8352 23.3669C25.0108 23.091 25.2533 22.8527 25.5627 22.652C25.8721 22.4513 26.2191 22.2966 26.6037 22.1879C26.9967 22.0792 27.3939 22.0249 27.7953 22.0249C28.3806 22.0249 28.9032 22.1294 29.3631 22.3385C29.823 22.5475 30.1825 22.836 30.4418 23.2039C30.701 23.5634 30.8306 23.9732 30.8306 24.4331C30.8306 24.7675 30.7595 25.0685 30.6173 25.3361C30.4836 25.6037 30.2871 25.8295 30.0278 26.0134C29.777 26.189 29.476 26.3186 29.1248 26.4022C29.5011 26.4691 29.8313 26.6113 30.1156 26.8287C30.4083 27.0461 30.6299 27.3137 30.7804 27.6314C30.9393 27.9491 31.0187 28.2962 31.0187 28.6724C31.0187 29.1909 30.8682 29.634 30.5672 30.0019C30.2745 30.3699 29.8815 30.6542 29.3882 30.8548C28.8948 31.0471 28.3513 31.1433 27.7577 31.1433Z" fill="url(#paint2_linear_2888_36127)" fill-opacity="0.91"/>
<defs>
<filter id="filter0_di_2888_36127" x="0" y="0" width="49" height="49" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="1"/>
<feComposite in2="hardAlpha" operator="out"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.901961 0 0 0 0 0.901961 0 0 0 0 0.901961 0 0 0 1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2888_36127"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="1.5"/>
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
<feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.4 0"/>
<feBlend mode="normal" in2="shape" result="effect2_innerShadow_2888_36127"/>
<feBlend mode="normal" in="effect2_innerShadow_2888_36127" in2="effect1_dropShadow_2888_36127" result="effect2_innerShadow_2888_36127"/>
</filter>
<linearGradient id="paint0_linear_2888_36127" x1="2" y1="1" x2="55.0086" y2="14.4599" gradientUnits="userSpaceOnUse">
<stop stop-color="white"/>
<stop offset="0.453125" stop-color="white"/>
</linearGradient>
<linearGradient id="paint1_linear_2888_36127" x1="3.40625" y1="3.04546" x2="47" y2="3.04546" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.65625" stop-color="#70B62B"/>
</linearGradient>
<linearGradient id="paint2_linear_2888_36127" x1="18.0547" y1="16.043" x2="35.1" y2="18.8562" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.453125" stop-color="#70B62B"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 5.8 KiB

@@ -0,0 +1,48 @@
<svg width="49" height="49" viewBox="0 0 49 49" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_di_2888_36139)">
<circle cx="24.5" cy="23.5" r="22.5" fill="url(#paint0_linear_2888_36139)" fill-opacity="0.6" shape-rendering="crispEdges"/>
<circle cx="24.5" cy="23.5" r="22" stroke="url(#paint1_linear_2888_36139)" stroke-opacity="0.2" shape-rendering="crispEdges"/>
</g>
<path d="M13.334 35.4905V11.5096C13.334 9.84638 14.6823 8.49805 16.3456 8.49805H33.6594C35.3227 8.49805 36.671 9.84638 36.671 11.5096V35.4905C36.671 37.1541 35.3224 38.5028 33.6587 38.5028H16.3463C14.6827 38.5028 13.334 37.1541 13.334 35.4905Z" fill="white" stroke="black" stroke-width="1.00411"/>
<path d="M13.334 36.2802V10.7206C13.334 9.49313 14.3291 8.49805 15.5566 8.49805H17.7791V38.5028H15.5566C14.3291 38.5028 13.334 37.5077 13.334 36.2802Z" fill="white" stroke="black" stroke-width="1.00411"/>
<path d="M10.1787 22.5852V23.3016C10.1787 23.7175 10.5159 24.0547 10.9318 24.0547H14.9821C15.398 24.0547 15.7351 23.7175 15.7351 23.3016V22.5852C15.7351 22.1693 15.398 21.8321 14.9821 21.8321H10.9318C10.5159 21.8321 10.1787 22.1693 10.1787 22.5852Z" fill="white" stroke="black" stroke-width="1.00411"/>
<path d="M10.1787 29.2532V29.9696C10.1787 30.3855 10.5159 30.7227 10.9318 30.7227H14.9821C15.398 30.7227 15.7351 30.3855 15.7351 29.9696V29.2532C15.7351 28.8372 15.398 28.5001 14.9821 28.5001H10.9318C10.5159 28.5001 10.1787 28.8372 10.1787 29.2532Z" fill="white" stroke="black" stroke-width="1.00411"/>
<path d="M10 15.9192V16.6356C10 17.0515 10.3372 17.3887 10.7531 17.3887H14.8034C15.2193 17.3887 15.5564 17.0515 15.5564 16.6356V15.9192C15.5564 15.5033 15.2193 15.1661 14.8034 15.1661H10.7531C10.3372 15.1661 10 15.5033 10 15.9192Z" fill="white" stroke="black" stroke-width="1.00411"/>
<circle cx="27.2246" cy="21.21" r="2.29203" fill="url(#paint2_linear_2888_36139)" fill-opacity="0.91"/>
<path d="M27.2247 24.2676C24.6649 24.2676 23.1772 26.2776 22.7615 27.4917C22.6522 27.8111 22.9143 28.0876 23.2518 28.0876H31.1975C31.5351 28.0876 31.7972 27.8111 31.6879 27.4917C31.2722 26.2776 29.7844 24.2676 27.2247 24.2676Z" fill="url(#paint3_linear_2888_36139)" fill-opacity="0.91"/>
<defs>
<filter id="filter0_di_2888_36139" x="0" y="0" width="49" height="49" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="1"/>
<feComposite in2="hardAlpha" operator="out"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.901961 0 0 0 0 0.901961 0 0 0 0 0.901961 0 0 0 1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2888_36139"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="1.5"/>
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
<feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.4 0"/>
<feBlend mode="normal" in2="shape" result="effect2_innerShadow_2888_36139"/>
<feBlend mode="normal" in="effect2_innerShadow_2888_36139" in2="effect1_dropShadow_2888_36139" result="effect2_innerShadow_2888_36139"/>
</filter>
<linearGradient id="paint0_linear_2888_36139" x1="2" y1="1" x2="55.0086" y2="14.4599" gradientUnits="userSpaceOnUse">
<stop stop-color="white"/>
<stop offset="0.453125" stop-color="white"/>
</linearGradient>
<linearGradient id="paint1_linear_2888_36139" x1="3.40625" y1="3.04546" x2="47" y2="3.04546" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.65625" stop-color="#70B62B"/>
</linearGradient>
<linearGradient id="paint2_linear_2888_36139" x1="24.9326" y1="18.918" x2="30.3325" y2="20.2891" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.453125" stop-color="#70B62B"/>
</linearGradient>
<linearGradient id="paint3_linear_2888_36139" x1="22.6406" y1="24.2676" x2="31.0235" y2="29.3761" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.453125" stop-color="#70B62B"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 4.2 KiB

@@ -0,0 +1,52 @@
<svg width="49" height="49" viewBox="0 0 49 49" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_di_2888_36152)">
<circle cx="24.5" cy="23.5" r="22.5" fill="url(#paint0_linear_2888_36152)" fill-opacity="0.6" shape-rendering="crispEdges"/>
<circle cx="24.5" cy="23.5" r="22" stroke="url(#paint1_linear_2888_36152)" stroke-opacity="0.2" shape-rendering="crispEdges"/>
</g>
<path d="M10.0049 34.4152V12.5841C10.0049 10.9153 11.3577 9.5625 13.0265 9.5625H35.9733C37.6421 9.5625 38.9949 10.9153 38.9949 12.5841V34.4152C38.9949 36.0844 37.6417 37.4375 35.9725 37.4375H13.0272C11.358 37.4375 10.0049 36.0844 10.0049 34.4152Z" fill="white" stroke="black"/>
<path d="M12.792 15.1387H18.4224" stroke="url(#paint2_linear_2888_36152)" stroke-opacity="0.91" stroke-linecap="round"/>
<path d="M30.6318 15.1387H36.2623" stroke="url(#paint3_linear_2888_36152)" stroke-opacity="0.91" stroke-linecap="round"/>
<path d="M21.7119 15.1387H27.3423" stroke="url(#paint4_linear_2888_36152)" stroke-opacity="0.91" stroke-linecap="round"/>
<rect x="12.7344" y="31.3613" width="13.495" height="5.69" rx="0.614981" transform="rotate(-90 12.7344 31.3613)" fill="white" stroke="black"/>
<rect x="30.5742" y="31.3613" width="13.495" height="5.69" rx="0.614981" transform="rotate(-90 30.5742 31.3613)" fill="white" stroke="black"/>
<rect x="21.6543" y="23.5586" width="5.69" height="5.69" rx="0.614981" transform="rotate(-90 21.6543 23.5586)" fill="white" stroke="black"/>
<defs>
<filter id="filter0_di_2888_36152" x="0" y="0" width="49" height="49" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="1"/>
<feComposite in2="hardAlpha" operator="out"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.901961 0 0 0 0 0.901961 0 0 0 0 0.901961 0 0 0 1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2888_36152"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="1.5"/>
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
<feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.4 0"/>
<feBlend mode="normal" in2="shape" result="effect2_innerShadow_2888_36152"/>
<feBlend mode="normal" in="effect2_innerShadow_2888_36152" in2="effect1_dropShadow_2888_36152" result="effect2_innerShadow_2888_36152"/>
</filter>
<linearGradient id="paint0_linear_2888_36152" x1="2" y1="1" x2="55.0086" y2="14.4599" gradientUnits="userSpaceOnUse">
<stop stop-color="white"/>
<stop offset="0.453125" stop-color="white"/>
</linearGradient>
<linearGradient id="paint1_linear_2888_36152" x1="3.40625" y1="3.04546" x2="47" y2="3.04546" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.65625" stop-color="#70B62B"/>
</linearGradient>
<linearGradient id="paint2_linear_2888_36152" x1="12.792" y1="15.1387" x2="15.1114" y2="18.4546" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.453125" stop-color="#70B62B"/>
</linearGradient>
<linearGradient id="paint3_linear_2888_36152" x1="30.6318" y1="15.1387" x2="32.9512" y2="18.4546" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.453125" stop-color="#70B62B"/>
</linearGradient>
<linearGradient id="paint4_linear_2888_36152" x1="21.7119" y1="15.1387" x2="24.0313" y2="18.4546" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.453125" stop-color="#70B62B"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

@@ -0,0 +1,17 @@
<svg width="35" height="35" viewBox="0 0 35 35" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_205_591)">
<circle cx="17.5" cy="17.5" r="17.5" fill="#e5efe8"/>
<path d="M6.125 25.6282V8.49625C6.125 7.18664 7.18664 6.125 8.49625 6.125H26.5037C27.8134 6.125 28.875 7.18664 28.875 8.49625V25.6282C28.875 26.9381 27.8131 28 26.5032 28H8.49683C7.18691 28 6.125 26.9381 6.125 25.6282Z" fill="#F5F5F5" stroke="black" stroke-width="0.790611"/>
<path d="M8.3125 10.5L12.6875 10.5" stroke="#70B62B" stroke-width="0.7875" stroke-linecap="round"/>
<path d="M22.3125 10.5L26.7537 10.5" stroke="#70B62B" stroke-width="0.7875" stroke-linecap="round"/>
<path d="M15.3125 10.5L19.8459 10.5" stroke="#70B62B" stroke-width="0.7875" stroke-linecap="round"/>
<rect x="8.26875" y="23.2313" width="10.5875" height="4.4625" rx="0.48125" transform="rotate(-90 8.26875 23.2313)" stroke="black" stroke-width="0.7875"/>
<rect x="22.2687" y="23.2313" width="10.5875" height="4.4625" rx="0.48125" transform="rotate(-90 22.2687 23.2313)" stroke="black" stroke-width="0.7875"/>
<rect x="15.2687" y="17.1063" width="4.4625" height="4.4625" rx="0.48125" transform="rotate(-90 15.2687 17.1063)" stroke="black" stroke-width="0.7875"/>
</g>
<defs>
<clipPath id="clip0_205_591">
<rect width="35" height="35" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

@@ -0,0 +1,52 @@
<svg width="49" height="49" viewBox="0 0 49 49" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_di_2888_36114)">
<circle cx="24.5" cy="23.5" r="22.5" fill="url(#paint0_linear_2888_36114)" fill-opacity="0.6" shape-rendering="crispEdges"/>
<circle cx="24.5" cy="23.5" r="22" stroke="url(#paint1_linear_2888_36114)" stroke-opacity="0.2" shape-rendering="crispEdges"/>
</g>
<path d="M38.5625 20.1419V27.3323C38.5625 28.9311 37.2664 30.2272 35.6677 30.2272H12.2519C10.6531 30.2272 9.35707 28.9311 9.35707 27.3323V16.8968C9.35707 15.298 10.6531 14.002 12.2519 14.002H24.3832C25.151 14.002 25.8873 14.3069 26.4302 14.8498L27.9795 16.3991C28.5224 16.942 29.2587 17.247 30.0264 17.247H35.6676C37.2664 17.247 38.5625 18.5431 38.5625 20.1419Z" fill="white" stroke="black"/>
<path d="M13.6836 8.01172V29.7271C13.6836 30.0032 13.9075 30.2271 14.1836 30.2271H34.8172C35.0934 30.2271 35.3172 30.0032 35.3172 29.727V8.01172C35.3172 7.73558 35.0934 7.51172 34.8172 7.51172H14.1836C13.9075 7.51172 13.6836 7.73558 13.6836 8.01172Z" fill="white" stroke="black"/>
<path d="M12.6016 10.1758V32.9728C12.6016 33.2489 12.8254 33.4728 13.1016 33.4728H32.6535C32.9297 33.4728 33.1535 33.2489 33.1535 32.9728V10.1758C33.1535 9.89964 32.9297 9.67578 32.6535 9.67578H13.1016C12.8254 9.67578 12.6016 9.89964 12.6016 10.1758Z" fill="white" stroke="black"/>
<path d="M9.35645 25.552V34.9059C9.35645 36.5046 10.6525 37.8007 12.2513 37.8007H36.7487C38.3475 37.8007 39.6436 36.5046 39.6436 34.9059V22.307C39.6436 20.7082 38.3475 19.4121 36.7487 19.4121H22.0977C21.3387 19.4121 20.61 19.7102 20.0686 20.2423L18.4561 21.827C17.9147 22.359 17.1861 22.6572 16.427 22.6572H12.2513C10.6525 22.6572 9.35645 23.9532 9.35645 25.552Z" fill="white" stroke="black"/>
<path d="M14.7656 12.9219H30.9909" stroke="url(#paint2_linear_2888_36114)" stroke-opacity="0.91" stroke-linecap="round"/>
<path d="M14.7656 15.084H30.9909" stroke="url(#paint3_linear_2888_36114)" stroke-opacity="0.91" stroke-linecap="round"/>
<path d="M14.7656 17.248H30.9909" stroke="url(#paint4_linear_2888_36114)" stroke-opacity="0.91" stroke-linecap="round"/>
<defs>
<filter id="filter0_di_2888_36114" x="0" y="0" width="49" height="49" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="1"/>
<feComposite in2="hardAlpha" operator="out"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.901961 0 0 0 0 0.901961 0 0 0 0 0.901961 0 0 0 1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2888_36114"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="1.5"/>
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
<feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.4 0"/>
<feBlend mode="normal" in2="shape" result="effect2_innerShadow_2888_36114"/>
<feBlend mode="normal" in="effect2_innerShadow_2888_36114" in2="effect1_dropShadow_2888_36114" result="effect2_innerShadow_2888_36114"/>
</filter>
<linearGradient id="paint0_linear_2888_36114" x1="2" y1="1" x2="55.0086" y2="14.4599" gradientUnits="userSpaceOnUse">
<stop stop-color="white"/>
<stop offset="0.453125" stop-color="white"/>
</linearGradient>
<linearGradient id="paint1_linear_2888_36114" x1="3.40625" y1="3.04546" x2="47" y2="3.04546" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.65625" stop-color="#70B62B"/>
</linearGradient>
<linearGradient id="paint2_linear_2888_36114" x1="14.7656" y1="12.9219" x2="15.8976" y2="17.5854" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.453125" stop-color="#70B62B"/>
</linearGradient>
<linearGradient id="paint3_linear_2888_36114" x1="14.7656" y1="15.084" x2="15.8976" y2="19.7475" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.453125" stop-color="#70B62B"/>
</linearGradient>
<linearGradient id="paint4_linear_2888_36114" x1="14.7656" y1="17.248" x2="15.8976" y2="21.9116" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.453125" stop-color="#70B62B"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 4.4 KiB

@@ -0,0 +1,46 @@
<svg width="49" height="49" viewBox="0 0 49 49" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_di_2888_36103)">
<circle cx="24.5" cy="23.5" r="22.5" fill="url(#paint0_linear_2888_36103)" fill-opacity="0.6" shape-rendering="crispEdges"/>
<circle cx="24.5" cy="23.5" r="22" stroke="url(#paint1_linear_2888_36103)" stroke-opacity="0.2" shape-rendering="crispEdges"/>
</g>
<path d="M8.42773 13.3065V34.6143C8.42773 35.2994 8.83838 35.9178 9.46984 36.1836C9.67894 36.2716 9.90352 36.317 10.1304 36.317H23.3758H31.3029H38.9154C39.1238 36.317 39.331 36.285 39.5298 36.2223L39.6153 36.1953C40.4645 35.9272 41.0418 35.1395 41.0418 34.2491V13.3065C41.0418 12.1794 40.1281 11.2656 39.0009 11.2656H24.7348H10.4686C9.34148 11.2656 8.42773 12.1794 8.42773 13.3065Z" fill="white" stroke="black"/>
<path d="M40.5785 32.6801L26.9358 18.7502C25.7321 17.5211 23.7523 17.5249 22.5533 18.7586L9.28202 32.414C8.73422 32.9777 8.42777 33.7327 8.42777 34.5187V35.0417C8.42777 35.4792 8.65206 35.886 9.02193 36.1196C9.22561 36.2482 9.46157 36.3164 9.70245 36.3164L11.1456 36.3164H16.486L31.7755 36.3164H39.2299C41.0832 36.3164 41.5051 33.9059 40.5785 32.6801Z" stroke="black"/>
<path d="M9.146 14.507L24.064 27.5691C24.4505 27.9076 25.0284 27.9059 25.413 27.5651L40.5352 14.1648C40.8643 13.8732 41.0527 13.4545 41.0527 13.0148C41.0527 12.6817 40.9445 12.3577 40.7444 12.0915L40.5825 11.8761C40.299 11.4989 39.9081 11.216 39.4612 11.0646L38.8141 10.8454C38.4978 10.7383 38.166 10.6836 37.8319 10.6836H32.9989H25.3423H21.2663H17.1904H10.2031C8.47223 10.6836 8.04652 12.7971 8.75386 14.0571C8.85195 14.2318 8.99525 14.375 9.146 14.507Z" fill="white" stroke="black"/>
<path d="M24.5492 15.8516C24.2716 15.8516 24.0158 15.9584 23.7809 16.1738C23.5461 16.3891 23.3683 16.6953 23.2492 17.0923C23.1309 17.4893 23.0706 17.8417 23.0706 18.1487C23.0706 18.5584 23.1536 18.8612 23.3188 19.0546C23.4849 19.2481 23.6904 19.3457 23.9353 19.3457L24.1282 20.1784C23.9839 20.2146 23.8346 20.2322 23.6795 20.2322C23.1444 20.2322 22.7007 20.0472 22.3476 19.6771C22.2377 19.5618 22.1446 19.434 22.0691 19.2944C21.9022 18.9874 21.8184 18.6231 21.8184 18.2009C21.8184 17.4414 22.0314 16.7483 22.4566 16.1225C22.9724 15.3595 23.6325 14.9785 24.4385 14.9785C24.5006 14.9785 24.5609 14.981 24.6188 14.9869L24.5492 15.8508V15.8516Z" fill="url(#paint2_linear_2888_36103)" fill-opacity="0.91"/>
<path d="M27.3354 14.694C26.7617 14.1591 25.9607 13.8916 24.9333 13.8916C24.0602 13.8916 23.3205 14.0708 22.7132 14.4274C22.106 14.784 21.6481 15.2862 21.3403 15.9347C21.0325 16.5824 20.879 17.257 20.879 17.9576C20.879 18.5111 20.9922 19.025 21.2186 19.4986C21.2706 19.6079 21.3294 19.7148 21.3931 19.8199C21.7361 20.3793 22.2184 20.7864 22.8382 21.0429C23.458 21.2995 24.1676 21.4281 24.9668 21.4281C25.7661 21.4281 26.3994 21.3205 26.9529 21.106C27.5073 20.8915 27.9535 20.5685 28.2923 20.1395H29.3214C28.9994 20.7956 28.5054 21.3087 27.8377 21.6813C27.0737 22.1078 26.1427 22.3214 25.044 22.3214C23.9453 22.3214 23.0621 22.1414 22.2897 21.7814C21.5164 21.4206 20.9419 20.8898 20.5645 20.1866C20.1879 19.4826 20 18.7172 20 17.8903C20 16.9819 20.2139 16.1366 20.6425 15.3526C21.071 14.5696 21.6581 13.9808 22.4021 13.588C23.146 13.1968 23.9965 13 24.9534 13C25.7653 13 26.4866 13.159 27.119 13.4752C27.7505 13.7915 28.2328 14.2424 28.5658 14.8253C28.8996 15.4082 29.0665 16.0457 29.0665 16.7372C29.0665 17.5606 28.8132 18.3059 28.3074 18.9712C27.6725 19.8115 26.859 20.2312 25.8668 20.2312C25.6001 20.2312 25.3979 20.185 25.2621 20.0907C25.127 19.9974 25.0365 19.8603 24.992 19.6794C24.7303 19.9326 24.441 20.0983 24.1256 20.1774L23.9327 19.3447C24.1164 19.3447 24.2883 19.2992 24.4494 19.2084C24.5718 19.1445 24.6926 19.0427 24.8117 18.9031C24.9828 18.7062 25.1296 18.4186 25.2545 18.0401C25.3787 17.6624 25.4407 17.3108 25.4407 16.9836C25.4407 16.6194 25.356 16.3385 25.1874 16.1433C25.018 15.9473 24.805 15.8498 24.5475 15.8498L24.6171 14.9859C25.0994 15.028 25.4634 15.245 25.7074 15.637L25.8282 15.0986H27.1039L26.3742 18.5733C26.3297 18.7937 26.3063 18.9359 26.3063 18.9998C26.3063 19.0805 26.3247 19.1411 26.3625 19.1815C26.4002 19.2219 26.4438 19.242 26.495 19.242C26.6493 19.242 26.8497 19.1487 27.0938 18.9611C27.4226 18.7155 27.6885 18.3866 27.8914 17.9728C28.0944 17.5589 28.1959 17.1308 28.1959 16.6884C28.1959 15.9431 27.9434 15.3131 27.4402 14.7958C27.4067 14.7613 27.3714 14.7277 27.3354 14.694Z" fill="url(#paint3_linear_2888_36103)" fill-opacity="0.91"/>
<defs>
<filter id="filter0_di_2888_36103" x="0" y="0" width="49" height="49" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="1"/>
<feComposite in2="hardAlpha" operator="out"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.901961 0 0 0 0 0.901961 0 0 0 0 0.901961 0 0 0 1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2888_36103"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="1.5"/>
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
<feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.4 0"/>
<feBlend mode="normal" in2="shape" result="effect2_innerShadow_2888_36103"/>
<feBlend mode="normal" in="effect2_innerShadow_2888_36103" in2="effect1_dropShadow_2888_36103" result="effect2_innerShadow_2888_36103"/>
</filter>
<linearGradient id="paint0_linear_2888_36103" x1="2" y1="1" x2="55.0086" y2="14.4599" gradientUnits="userSpaceOnUse">
<stop stop-color="white"/>
<stop offset="0.453125" stop-color="white"/>
</linearGradient>
<linearGradient id="paint1_linear_2888_36103" x1="3.40625" y1="3.04546" x2="47" y2="3.04546" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.65625" stop-color="#70B62B"/>
</linearGradient>
<linearGradient id="paint2_linear_2888_36103" x1="21.8184" y1="14.9785" x2="25.2667" y2="15.4453" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.453125" stop-color="#70B62B"/>
</linearGradient>
<linearGradient id="paint3_linear_2888_36103" x1="20" y1="13" x2="30.9804" y2="15.7881" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.453125" stop-color="#70B62B"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 6.4 KiB

@@ -0,0 +1,8 @@
<svg width="35" height="35" viewBox="0 0 35 35" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="17.5" cy="17.5" r="17.5" fill="#e5efe8"/>
<path d="M5 10.0405V26.6132C5 27.1461 5.31939 27.627 5.81053 27.8338C5.97316 27.9022 6.14783 27.9375 6.32429 27.9375H16.6263H22.7918H28.7126C28.8747 27.9375 29.0359 27.9127 29.1905 27.8639L29.257 27.8429C29.9174 27.6344 30.3665 27.0217 30.3665 26.3291V10.0405C30.3665 9.16381 29.6558 8.45312 28.7791 8.45312H17.6832H6.58736C5.71069 8.45312 5 9.16381 5 10.0405Z" fill="#F5F5F5" stroke="black" stroke-width="0.793683"/>
<path d="M30.0062 25.1093L19.3952 14.2749C18.4589 13.3189 16.9191 13.3219 15.9866 14.2814L5.66445 24.9023C5.23838 25.3407 5.00003 25.928 5.00003 26.5393V26.9461C5.00003 27.2863 5.17448 27.6028 5.46215 27.7844C5.62057 27.8844 5.80409 27.9375 5.99144 27.9375H7.1139H11.2675L23.1594 27.9375L28.9572 27.9375C30.3987 27.9375 30.7269 26.0626 30.0062 25.1093Z" stroke="black" stroke-width="0.793683"/>
<path d="M5.55865 10.9737L17.1615 21.1332C17.4622 21.3965 17.9117 21.3951 18.2107 21.1301L29.9725 10.7076C30.2285 10.4808 30.375 10.1551 30.375 9.81312C30.375 9.55409 30.2908 9.30207 30.1352 9.09501L30.0093 8.92751C29.7887 8.6341 29.4848 8.41412 29.1371 8.29636L28.6339 8.12588C28.3878 8.04252 28.1297 8 27.8699 8H24.1109H18.1557H14.9856H11.8154H6.38085C5.0346 8 4.7035 9.64383 5.25366 10.6238C5.32995 10.7597 5.4414 10.8711 5.55865 10.9737Z" fill="#F5F5F5" stroke="black" stroke-width="0.793683"/>
<path d="M17.5381 12.2162C17.3221 12.2162 17.1232 12.2993 16.9405 12.4667C16.7579 12.6342 16.6196 12.8724 16.5269 13.1811C16.435 13.4899 16.388 13.7641 16.388 14.0028C16.388 14.3214 16.4526 14.557 16.5811 14.7074C16.7102 14.8579 16.8701 14.9338 17.0605 14.9338L17.2106 15.5815C17.0984 15.6096 16.9823 15.6233 16.8616 15.6233C16.4454 15.6233 16.1003 15.4794 15.8257 15.1915C15.7402 15.1019 15.6678 15.0025 15.6091 14.8939C15.4793 14.6551 15.4141 14.3718 15.4141 14.0434C15.4141 13.4526 15.5798 12.9136 15.9105 12.4268C16.3117 11.8335 16.8251 11.5371 17.4519 11.5371C17.5002 11.5371 17.5472 11.5391 17.5922 11.5437L17.5381 12.2155V12.2162Z" fill="#70B62B"/>
<path d="M19.7053 11.3176C19.2591 10.9015 18.6361 10.6935 17.837 10.6935C17.1579 10.6935 16.5826 10.8328 16.1103 11.1102C15.638 11.3876 15.2818 11.7782 15.0424 12.2826C14.803 12.7863 14.6836 13.311 14.6836 13.8559C14.6836 14.2864 14.7717 14.6861 14.9478 15.0545C14.9883 15.1395 15.0339 15.2226 15.0835 15.3044C15.3503 15.7394 15.7254 16.0561 16.2075 16.2556C16.6896 16.4551 17.2414 16.5552 17.8631 16.5552C18.4848 16.5552 18.9773 16.4715 19.4078 16.3047C19.839 16.1378 20.186 15.8866 20.4496 15.553H21.25C20.9995 16.0633 20.6153 16.4623 20.096 16.7521C19.5018 17.0838 18.7777 17.25 17.9231 17.25C17.0686 17.25 16.3817 17.11 15.7809 16.83C15.1794 16.5493 14.7326 16.1365 14.439 15.5896C14.1461 15.042 14 14.4467 14 13.8036C14 13.097 14.1663 12.4396 14.4997 11.8298C14.833 11.2208 15.2897 10.7628 15.8683 10.4573C16.4469 10.1531 17.1084 10 17.8527 10C18.4841 10 19.0451 10.1236 19.537 10.3696C20.0282 10.6156 20.4033 10.9663 20.6623 11.4196C20.9219 11.873 21.0517 12.3689 21.0517 12.9067C21.0517 13.5471 20.8547 14.1268 20.4613 14.6443C19.9675 15.2978 19.3348 15.6243 18.5631 15.6243C18.3556 15.6243 18.1984 15.5883 18.0927 15.515C17.9877 15.4424 17.9172 15.3358 17.8827 15.1951C17.6791 15.392 17.4541 15.5209 17.2088 15.5824L17.0588 14.9347C17.2016 14.9347 17.3354 14.8994 17.4606 14.8288C17.5559 14.779 17.6498 14.6999 17.7424 14.5913C17.8755 14.4382 17.9897 14.2144 18.0869 13.9201C18.1834 13.6263 18.2317 13.3528 18.2317 13.0984C18.2317 12.8151 18.1658 12.5966 18.0347 12.4448C17.9029 12.2924 17.7372 12.2165 17.5369 12.2165L17.5911 11.5446C17.9662 11.5773 18.2493 11.7461 18.4391 12.051L18.533 11.6323H19.5252L18.9577 14.3348C18.9231 14.5062 18.9049 14.6168 18.9049 14.6665C18.9049 14.7293 18.9192 14.7764 18.9486 14.8078C18.9779 14.8392 19.0119 14.8549 19.0516 14.8549C19.1717 14.8549 19.3276 14.7823 19.5174 14.6364C19.7731 14.4454 19.9799 14.1896 20.1378 13.8677C20.2956 13.5458 20.3746 13.2128 20.3746 12.8687C20.3746 12.2891 20.1782 11.7991 19.7868 11.3967C19.7607 11.3699 19.7333 11.3438 19.7053 11.3176Z" fill="#70B62B"/>
</svg>

After

Width:  |  Height:  |  Size: 4.1 KiB

@@ -0,0 +1,12 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_1460_27244)">
<path d="M3 3H13.5341" stroke="#808080" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M3 8H13.5" stroke="#808080" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M3 13H13.5" stroke="#808080" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</g>
<defs>
<clipPath id="clip0_1460_27244">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 570 B

@@ -0,0 +1,31 @@
<svg width="49" height="49" viewBox="0 0 49 49" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_di_mobile_lk)">
<circle cx="24.5" cy="23.5" r="22.5" fill="#FBFBFB"/>
<circle cx="24.5" cy="23.5" r="22" stroke="url(#paint0_linear_mobile_lk)" stroke-opacity="0.2"/>
</g>
<path d="M21.6484 30.5127L21.4043 30.3672C20.5844 29.8802 19.8801 29.3418 19.2324 28.9043L19.0439 28.7695C18.119 28.0734 17.4972 27.0443 17.3047 25.8936L16.9492 23.7686L16.8799 23.3516H16.4561C15.6199 23.3515 14.9443 22.676 14.9443 21.8398C14.9443 21.2184 15.3169 20.6859 15.8516 20.4541L16.3086 20.2568L16.1133 19.7988C15.5068 18.3768 15.0616 16.8689 14.7939 15.3223V15.3213C14.633 14.3931 14.554 13.4916 14.7578 12.6826L14.8018 12.5215C15.0627 11.6631 15.7059 11.0626 16.3135 11.043L16.4043 11.0488L16.6992 11.0693L16.8594 10.8193C17.3654 10.0292 18.1702 9.48976 19.0498 9.1709C19.9382 8.84842 20.8853 8.73496 21.8906 8.61914L21.8896 8.61816C22.2806 8.57336 22.6678 8.53 23.0557 8.49121L23.0547 8.49023C24.8442 8.31807 26.7407 8.28354 28.501 8.77344C30.2556 9.26222 31.9082 10.3473 32.7705 12.0332C33.4592 13.378 33.6123 15.0327 33.4307 16.6416C33.3107 17.7074 33.054 18.7541 32.7461 19.8057L32.6143 20.2578L33.0576 20.417C33.6407 20.6259 34.0566 21.1833 34.0566 21.8398C34.0566 22.6762 33.3819 23.3516 32.5449 23.3516H32.1211L32.0518 23.7686L31.6963 25.8936C31.491 27.1211 30.7974 28.2101 29.7686 28.9043C29.119 29.3424 28.4178 29.88 27.5977 30.3672L27.3525 30.5127V32.2617L27.7021 32.3721L34.3613 34.4746C36.836 35.2559 38.7321 37.1384 39.5879 39.4785C39.4957 39.5654 39.4051 39.6539 39.3115 39.7393L38.7871 40.2021C38.0881 40.801 37.3502 41.3559 36.5791 41.8633C33.1124 44.1452 28.9623 45.4726 24.501 45.4727C20.3184 45.4727 16.4089 44.3062 13.0801 42.2803L12.4219 41.8633C11.6508 41.3559 10.9129 40.801 10.2139 40.2021L9.68945 39.7393C9.59565 39.6538 9.50443 39.5656 9.41211 39.4785C10.2674 37.1379 12.1653 35.2555 14.6396 34.4746L21.2998 32.3721L21.6484 32.2617V30.5127Z" fill="#F5F5F5" stroke="#151515"/>
<path d="M25.45 32.4766H23.6647C23.5097 32.4766 23.4011 32.6295 23.4523 32.7758L23.8998 34.0557C23.9314 34.1459 24.0165 34.2064 24.1122 34.2064H25.0025C25.0981 34.2064 25.1833 34.1459 25.2149 34.0557L25.6624 32.7758C25.7135 32.6295 25.6049 32.4766 25.45 32.4766Z" fill="#70B62B"/>
<path d="M22.4034 42.3473L23.921 34.2577C23.9409 34.1513 24.0338 34.0742 24.1421 34.0742H24.9757C25.0851 34.0742 25.1787 34.153 25.1974 34.2608L26.5986 42.3528C26.6101 42.4189 26.5914 42.4868 26.5476 42.5377L24.7261 44.6592C24.638 44.7618 24.4799 44.7641 24.3889 44.664L22.4581 42.5401C22.4107 42.4879 22.3905 42.4165 22.4034 42.3473Z" fill="#70B62B"/>
<defs>
<filter id="filter0_di_mobile_lk" x="0" y="0" width="49" height="49" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="1"/>
<feComposite in2="hardAlpha" operator="out"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.901961 0 0 0 0 0.901961 0 0 0 0 0.901961 0 0 0 1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="1.5"/>
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
<feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.4 0"/>
<feBlend mode="normal" in2="shape" result="effect2_innerShadow"/>
</filter>
<linearGradient id="paint0_linear_mobile_lk" x1="3.40625" y1="3.04546" x2="47" y2="3.04546" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.65625" stop-color="#70B62B"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 3.9 KiB

@@ -0,0 +1,39 @@
<svg width="49" height="49" viewBox="0 0 49 49" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_di_mobile_notif)">
<circle cx="24.5" cy="23.5" r="22.5" fill="#FBFBFB"/>
<circle cx="24.5" cy="23.5" r="22" stroke="url(#paint0_linear_mobile_notif)" stroke-opacity="0.2"/>
</g>
<path d="M25.45 32.4766H23.6647C23.5097 32.4766 23.4011 32.6295 23.4523 32.7758L23.8998 34.0557C23.9314 34.1459 24.0165 34.2064 24.1122 34.2064H25.0025C25.0981 34.2064 25.1833 34.1459 25.2149 34.0557L25.6624 32.7758C25.7135 32.6295 25.6049 32.4766 25.45 32.4766Z" fill="#70B62B"/>
<g clip-path="url(#clip0_mobile_notif)">
<path d="M26.873 34.1191C26.8587 35.4359 26.5062 36.604 25.9668 37.4336C25.413 38.2852 24.7067 38.7265 24 38.7266C23.2932 38.7266 22.586 38.2854 22.0322 37.4336C21.4929 36.604 21.1403 35.4358 21.126 34.1191C21.7482 34.1398 22.4045 34.1546 23.0967 34.1611L24 34.165C25.0307 34.165 25.9866 34.1486 26.873 34.1191Z" fill="#F5F5F5" stroke="#151515"/>
<circle cx="23.9108" cy="10.1384" r="1.91181" fill="white" stroke="#151515"/>
<path d="M23.918 11.918C24.6991 11.9182 25.1174 11.9077 25.8135 12.0244C26.3882 12.1208 26.7767 12.283 27.2783 12.4951V12.4941C30.3861 13.8088 32.5654 16.8863 32.5654 20.4707V26.2158C32.5654 27.4878 33.1606 28.6857 34.1719 29.4561C34.5152 29.7176 34.9215 30.011 35.3926 30.3262C35.5803 30.4517 35.6934 30.6634 35.6934 30.8906V33.3008C35.6932 33.5439 35.5641 33.7652 35.3604 33.8857L35.2686 33.9307C34.2146 34.3548 31.3656 34.9795 23.9092 34.9795C16.4527 34.9795 13.6037 34.3548 12.5498 33.9307C12.2938 33.8277 12.1251 33.5786 12.125 33.3008V30.8906C12.125 30.6633 12.2381 30.4517 12.4258 30.3262C12.8969 30.011 13.3031 29.7176 13.6465 29.4561C14.6577 28.6857 15.2529 27.4878 15.2529 26.2158V20.5225C15.2531 16.3239 17.8426 12.5461 21.9854 12.0283C22.75 11.9328 23.1522 11.9178 23.918 11.918Z" fill="#F5F5F5" stroke="#151515"/>
<path d="M11.0015 18.9519C11.0717 18.9699 11.1419 18.978 11.2113 18.978C11.5917 18.978 11.9382 18.7213 12.0358 18.3356C12.0464 18.2936 13.1533 14.0906 17.2979 11.8968C17.7134 11.6768 17.8722 11.1618 17.6522 10.7463C17.4322 10.3308 16.9171 10.172 16.5016 10.392C15.3903 10.9801 14.3773 11.7409 13.4908 12.6527C12.7843 13.3792 12.1566 14.2028 11.6252 15.0999C10.7167 16.6341 10.3987 17.8655 10.3857 17.9173C10.2702 18.3732 10.5461 18.8364 11.0015 18.9519Z" fill="#70B62B"/>
<path d="M30.425 11.8969C31.3683 12.3961 32.2299 13.041 32.9862 13.8132C33.596 14.4365 34.1405 15.1446 34.6033 15.9177C35.3976 17.2442 35.6829 18.3176 35.6878 18.3376C35.7862 18.7221 36.1323 18.978 36.5119 18.978C36.5813 18.978 36.6515 18.9695 36.7217 18.9519C37.1776 18.8364 37.4531 18.3736 37.3376 17.9176C37.3245 17.8658 37.0066 16.6344 36.098 15.1001C35.5666 14.2026 34.9388 13.3793 34.2323 12.6528C33.3458 11.741 32.3327 10.9802 31.2213 10.392C30.8058 10.172 30.2907 10.3308 30.0707 10.7463C29.8507 11.1618 30.0095 11.6769 30.425 11.8969Z" fill="#70B62B"/>
</g>
<defs>
<filter id="filter0_di_mobile_notif" x="0" y="0" width="49" height="49" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="1"/>
<feComposite in2="hardAlpha" operator="out"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.901961 0 0 0 0 0.901961 0 0 0 0 0.901961 0 0 0 1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="1.5"/>
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
<feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.4 0"/>
<feBlend mode="normal" in2="shape" result="effect2_innerShadow"/>
</filter>
<linearGradient id="paint0_linear_mobile_notif" x1="3.40625" y1="3.04546" x2="47" y2="3.04546" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.65625" stop-color="#70B62B"/>
</linearGradient>
<clipPath id="clip0_mobile_notif">
<rect width="29.25" height="31.5" fill="white" transform="translate(9.375 7.72656)"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 4.3 KiB

@@ -0,0 +1,29 @@
<svg width="49" height="49" viewBox="0 0 49 49" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_di_mobile_settings)">
<circle cx="24.5" cy="23.5" r="22.5" fill="#FBFBFB"/>
<circle cx="24.5" cy="23.5" r="22" stroke="url(#paint0_linear_mobile_settings)" stroke-opacity="0.2"/>
</g>
<path d="M17.2747 15.3916C17.6719 15.5314 18.0947 15.5836 18.514 15.5447C18.9333 15.5057 19.3392 15.3765 19.7039 15.1659C20.0685 14.9552 20.3833 14.6682 20.6266 14.3245C20.8699 13.9807 21.0359 13.5884 21.1133 13.1745L21.5804 10.6641C23.5009 10.2266 25.4952 10.2266 27.4157 10.6641L27.8857 13.1745C27.963 13.5884 28.1291 13.9807 28.3724 14.3245C28.6156 14.6682 28.9304 14.9552 29.2951 15.1659C29.6597 15.3765 30.0657 15.5057 30.485 15.5447C30.9043 15.5836 31.3271 15.5314 31.7243 15.3916L34.1311 14.545C35.4708 15.9882 36.469 17.7141 37.0517 19.5951L35.1105 21.259C34.7908 21.533 34.5341 21.873 34.3582 22.2556C34.1822 22.6381 34.0911 23.0542 34.0911 23.4753C34.0911 23.8964 34.1822 24.3125 34.3582 24.6951C34.5341 25.0777 34.7908 25.4176 35.1105 25.6917L37.0517 27.3541C36.469 29.2351 35.4708 30.961 34.1311 32.4042L31.7228 31.5576C31.3256 31.4178 30.9028 31.3656 30.4835 31.4046C30.0642 31.4435 29.6583 31.5727 29.2936 31.7834C28.929 31.994 28.6142 32.281 28.3709 32.6247C28.1276 32.9685 27.9616 33.3608 27.8842 33.7747L27.4186 36.2852C25.4981 36.7227 23.5038 36.7227 21.5833 36.2852L21.1133 33.7747C21.0359 33.3608 20.8699 32.9685 20.6266 32.6247C20.3833 32.281 20.0685 31.994 19.7039 31.7834C19.3392 31.5727 18.9333 31.4435 18.514 31.4046C18.0947 31.3656 17.6719 31.4178 17.2747 31.5576L14.8678 32.4042C13.5281 30.961 12.53 29.2351 11.9473 27.3541L13.8885 25.6902C14.2079 25.4162 14.4644 25.0763 14.6402 24.6939C14.816 24.3114 14.907 23.8955 14.907 23.4746C14.907 23.0537 14.816 22.6378 14.6402 22.2554C14.4644 21.8729 14.2079 21.533 13.8885 21.259L11.9473 19.5951C12.5295 17.7142 13.5272 15.9883 14.8664 14.545L17.2747 15.3916ZM24.4995 19.0959C25.6608 19.0959 26.7745 19.5573 27.5957 20.3784C28.4168 21.1996 28.8782 22.3133 28.8782 23.4746C28.8782 24.6359 28.4168 25.7496 27.5957 26.5708C26.7745 27.392 25.6608 27.8533 24.4995 27.8533C23.3382 27.8533 22.2244 27.392 21.4033 26.5708C20.5821 25.7496 20.1208 24.6359 20.1208 23.4746C20.1208 22.3133 20.5821 21.1996 21.4033 20.3784C22.2244 19.5573 23.3382 19.0959 24.4995 19.0959Z" stroke="#151515" stroke-width="1.04493" stroke-linecap="round" stroke-linejoin="round"/>
<defs>
<filter id="filter0_di_mobile_settings" x="0" y="0" width="49" height="49" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="1"/>
<feComposite in2="hardAlpha" operator="out"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.901961 0 0 0 0 0.901961 0 0 0 0 0.901961 0 0 0 1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="-0.25"/>
<feGaussianBlur stdDeviation="1.5"/>
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
<feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.4 0"/>
<feBlend mode="normal" in2="shape" result="effect2_innerShadow"/>
</filter>
<linearGradient id="paint0_linear_mobile_settings" x1="3.40625" y1="3.04546" x2="47" y2="3.04546" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.65625" stop-color="#70B62B"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

@@ -0,0 +1,51 @@
<svg width="49" height="49" viewBox="0 0 49 49" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_di_2888_36178)">
<circle cx="24.5" cy="23.5" r="22.5" fill="url(#paint0_linear_2888_36178)" fill-opacity="0.6" shape-rendering="crispEdges"/>
<circle cx="24.5" cy="23.5" r="22" stroke="url(#paint1_linear_2888_36178)" stroke-opacity="0.2" shape-rendering="crispEdges"/>
</g>
<path d="M10.5596 34.5319V12.4645C10.5596 10.8596 11.8606 9.55859 13.4655 9.55859H35.5336C37.1385 9.55859 38.4396 10.8596 38.4396 12.4645V34.5319C38.4396 36.1372 37.1382 37.4386 35.5329 37.4386H13.4662C11.8609 37.4386 10.5596 36.1372 10.5596 34.5319Z" fill="white" stroke="black"/>
<path d="M32.3645 20.0973L34.4368 22.0599M26.6445 27.7874L29.2714 27.6498L34.7878 21.8678C34.9257 21.7232 35.0352 21.5515 35.1099 21.3625C35.1846 21.1736 35.223 20.971 35.223 20.7665C35.223 20.562 35.1846 20.3594 35.1099 20.1705C35.0352 19.9815 34.9257 19.8098 34.7878 19.6652C34.6498 19.5205 34.486 19.4058 34.3057 19.3275C34.1254 19.2493 33.9322 19.209 33.737 19.209C33.5419 19.209 33.3487 19.2493 33.1684 19.3275C32.9881 19.4058 32.8243 19.5205 32.6863 19.6652L27.1699 25.4471L26.6445 27.7874Z" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M13.7773 22.4258H26.645" stroke="url(#paint2_linear_2888_36178)" stroke-opacity="0.91" stroke-linecap="round"/>
<path d="M13.7773 26.7148H24.5004" stroke="url(#paint3_linear_2888_36178)" stroke-opacity="0.91" stroke-linecap="round"/>
<path d="M13.7773 31.0039H26.645" stroke="url(#paint4_linear_2888_36178)" stroke-opacity="0.91" stroke-linecap="round"/>
<path d="M10.5596 15.9924V12.4653C10.5596 10.86 11.8609 9.55859 13.4662 9.55859H35.5329C37.1382 9.55859 38.4396 10.86 38.4396 12.4653V15.9924H10.5596Z" fill="white" stroke="black" stroke-width="0.968889"/>
<defs>
<filter id="filter0_di_2888_36178" x="0" y="0" width="49" height="49" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="1"/>
<feComposite in2="hardAlpha" operator="out"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.901961 0 0 0 0 0.901961 0 0 0 0 0.901961 0 0 0 1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2888_36178"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="1.5"/>
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
<feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.4 0"/>
<feBlend mode="normal" in2="shape" result="effect2_innerShadow_2888_36178"/>
<feBlend mode="normal" in="effect2_innerShadow_2888_36178" in2="effect1_dropShadow_2888_36178" result="effect2_innerShadow_2888_36178"/>
</filter>
<linearGradient id="paint0_linear_2888_36178" x1="2" y1="1" x2="55.0086" y2="14.4599" gradientUnits="userSpaceOnUse">
<stop stop-color="white"/>
<stop offset="0.453125" stop-color="white"/>
</linearGradient>
<linearGradient id="paint1_linear_2888_36178" x1="3.40625" y1="3.04546" x2="47" y2="3.04546" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.65625" stop-color="#70B62B"/>
</linearGradient>
<linearGradient id="paint2_linear_2888_36178" x1="13.7773" y1="22.4258" x2="15.1593" y2="26.9411" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.453125" stop-color="#70B62B"/>
</linearGradient>
<linearGradient id="paint3_linear_2888_36178" x1="13.7773" y1="26.7148" x2="15.3755" y2="31.0662" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.453125" stop-color="#70B62B"/>
</linearGradient>
<linearGradient id="paint4_linear_2888_36178" x1="13.7773" y1="31.0039" x2="15.1593" y2="35.5192" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.453125" stop-color="#70B62B"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 4.1 KiB

@@ -0,0 +1,5 @@
<svg width="8" height="8" viewBox="0 0 8 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="4" cy="4" r="4" fill="#B62B2B"/>
<path d="M4.05859 1.91016V4.44118" stroke="white" stroke-width="0.86956" stroke-linecap="round"/>
<circle cx="4.05833" cy="5.92942" r="0.511452" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 304 B

@@ -0,0 +1,40 @@
<svg width="49" height="49" viewBox="0 0 49 49" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_di_2888_36093)">
<circle cx="24.5" cy="23.5" r="22.5" fill="url(#paint0_linear_2888_36093)" fill-opacity="0.6" shape-rendering="crispEdges"/>
<circle cx="24.5" cy="23.5" r="22" stroke="url(#paint1_linear_2888_36093)" stroke-opacity="0.2" shape-rendering="crispEdges"/>
</g>
<path d="M22.5421 31.5021C25.4539 31.5021 28.1032 30.3783 30.08 28.5408C32.2554 26.5187 33.6163 23.6322 33.6163 20.4278C33.6163 14.3115 28.6583 9.35352 22.5421 9.35352C16.4258 9.35352 11.4678 14.3115 11.4678 20.4278C11.4678 26.5441 16.4258 31.5021 22.5421 31.5021Z" fill="white" stroke="black" stroke-width="1.11673" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M34.7117 37.4755L28.4082 30.2022L30.6417 27.9688L37.2753 35.5501C37.8919 36.2547 37.7206 37.3456 36.9177 37.8273C36.1945 38.2612 35.2641 38.1128 34.7117 37.4755Z" fill="white" stroke="black" stroke-width="1.11673"/>
<path d="M27.85 17.36C27.1173 16.2965 26.247 15.4531 25.2888 14.8782C24.3306 14.3033 23.3034 14.0082 22.2663 14.0098C21.2292 14.0082 20.202 14.3033 19.2438 14.8782C18.2856 15.4531 17.4152 16.2965 16.6826 17.36" stroke="url(#paint2_linear_2888_36093)" stroke-opacity="0.91" stroke-width="1.6751" stroke-linecap="round" stroke-linejoin="round"/>
<defs>
<filter id="filter0_di_2888_36093" x="0" y="0" width="49" height="49" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="1"/>
<feComposite in2="hardAlpha" operator="out"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.901961 0 0 0 0 0.901961 0 0 0 0 0.901961 0 0 0 1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2888_36093"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="1.5"/>
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
<feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.4 0"/>
<feBlend mode="normal" in2="shape" result="effect2_innerShadow_2888_36093"/>
<feBlend mode="normal" in="effect2_innerShadow_2888_36093" in2="effect1_dropShadow_2888_36093" result="effect2_innerShadow_2888_36093"/>
</filter>
<linearGradient id="paint0_linear_2888_36093" x1="2" y1="1" x2="55.0086" y2="14.4599" gradientUnits="userSpaceOnUse">
<stop stop-color="white"/>
<stop offset="0.453125" stop-color="white"/>
</linearGradient>
<linearGradient id="paint1_linear_2888_36093" x1="3.40625" y1="3.04546" x2="47" y2="3.04546" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.65625" stop-color="#70B62B"/>
</linearGradient>
<linearGradient id="paint2_linear_2888_36093" x1="16.6826" y1="14.0098" x2="24.841" y2="20.915" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.453125" stop-color="#70B62B"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

@@ -0,0 +1,3 @@
<svg width="25" height="25" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M14.9847 20L7.43923 13.1999C7.01817 12.8204 7.01861 12.1598 7.44019 11.7809L14.9847 5" stroke="#808080" stroke-width="1.73077" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 264 B

@@ -0,0 +1,42 @@
<svg width="49" height="49" viewBox="0 0 49 49" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_di_2888_36209)">
<circle cx="24.5" cy="23.5" r="22.5" fill="url(#paint0_linear_2888_36209)" fill-opacity="0.6" shape-rendering="crispEdges"/>
<circle cx="24.5" cy="23.5" r="22" stroke="url(#paint1_linear_2888_36209)" stroke-opacity="0.2" shape-rendering="crispEdges"/>
</g>
<path d="M22.2695 33.4517V32.061C22.2695 31.3434 22.8513 30.7617 23.5688 30.7617H25.4328C26.1504 30.7617 26.7321 31.3434 26.7321 32.061V33.4517C26.7321 34.1693 26.1504 34.751 25.4328 34.751H23.5688C22.8513 34.751 22.2695 34.1693 22.2695 33.4517Z" fill="white" stroke="black"/>
<path d="M16.2301 27.8098C18.4045 29.9843 21.2222 31.1235 24.0706 31.2275C27.2051 31.342 30.377 30.2027 32.7699 27.8098C37.3374 23.2424 37.3374 15.8374 32.7699 11.2699C28.2025 6.7025 20.7975 6.7025 16.2301 11.2699C11.6626 15.8374 11.6626 23.2424 16.2301 27.8098Z" fill="white" stroke="black" stroke-width="1.1" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M20.7786 23.2638C21.7571 24.2423 23.025 24.7549 24.3068 24.8017C25.7173 24.8532 27.1446 24.3406 28.2214 23.2638C30.2767 21.2085 30.2767 17.8763 28.2214 15.821C26.1661 13.7657 22.8339 13.7657 20.7786 15.821C18.7233 17.8763 18.7233 21.2085 20.7786 23.2638Z" fill="white" stroke="black" stroke-width="1.1" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M23.7287 12.1655C23.9315 12.3683 24.1943 12.4746 24.4599 12.4843C24.7523 12.4949 25.0481 12.3887 25.2713 12.1655C25.6973 11.7395 25.6973 11.0489 25.2713 10.6229C24.8453 10.1969 24.1547 10.1969 23.7287 10.6229C23.3027 11.0489 23.3027 11.7395 23.7287 12.1655Z" fill="url(#paint2_linear_2888_36209)" fill-opacity="0.91"/>
<path d="M16.8008 37.0142V35.6235C16.8008 34.9059 17.3825 34.3242 18.1001 34.3242H30.9003C31.6179 34.3242 32.1996 34.9059 32.1996 35.6235V37.0142C32.1996 37.7318 31.6179 38.3135 30.9003 38.3135H18.1001C17.3825 38.3135 16.8008 37.7318 16.8008 37.0142Z" fill="white" stroke="black"/>
<defs>
<filter id="filter0_di_2888_36209" x="0" y="0" width="49" height="49" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="1"/>
<feComposite in2="hardAlpha" operator="out"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.901961 0 0 0 0 0.901961 0 0 0 0 0.901961 0 0 0 1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2888_36209"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="1.5"/>
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
<feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.4 0"/>
<feBlend mode="normal" in2="shape" result="effect2_innerShadow_2888_36209"/>
<feBlend mode="normal" in="effect2_innerShadow_2888_36209" in2="effect1_dropShadow_2888_36209" result="effect2_innerShadow_2888_36209"/>
</filter>
<linearGradient id="paint0_linear_2888_36209" x1="2" y1="1" x2="55.0086" y2="14.4599" gradientUnits="userSpaceOnUse">
<stop stop-color="white"/>
<stop offset="0.453125" stop-color="white"/>
</linearGradient>
<linearGradient id="paint1_linear_2888_36209" x1="3.40625" y1="3.04546" x2="47" y2="3.04546" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.65625" stop-color="#70B62B"/>
</linearGradient>
<linearGradient id="paint2_linear_2888_36209" x1="24.5" y1="9.85156" x2="25.8558" y2="12.1301" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.453125" stop-color="#70B62B"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

@@ -0,0 +1,15 @@
<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_1200_28545)">
<circle cx="15" cy="15" r="15" fill="#e5efe8"/>
<path d="M13.5283 21.8039V20.8864C13.5283 20.4131 13.9121 20.0293 14.3855 20.0293H15.6151C16.0885 20.0293 16.4722 20.4131 16.4722 20.8864V21.8039C16.4722 22.2772 16.0885 22.661 15.6151 22.661H14.3855C13.9121 22.661 13.5283 22.2772 13.5283 21.8039Z" fill="#F5F5F5" stroke="black" stroke-width="0.8"/>
<path d="M9.54439 18.0817C10.9789 19.5161 12.8376 20.2677 14.7167 20.3363C16.7846 20.4118 18.877 19.6603 20.4556 18.0817C23.4687 15.0686 23.4687 10.1835 20.4556 7.17045C17.4425 4.15735 12.5575 4.15735 9.54439 7.17045C6.5313 10.1835 6.5313 15.0686 9.54439 18.0817Z" fill="#F5F5F5" stroke="black" stroke-width="0.8" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M12.545 15.0817C13.1905 15.7272 14.027 16.0654 14.8725 16.0963C15.803 16.1303 16.7446 15.7921 17.455 15.0817C18.8108 13.7258 18.8108 11.5276 17.455 10.1718C16.0991 8.8159 13.9009 8.8159 12.545 10.1718C11.1892 11.5276 11.1892 13.7258 12.545 15.0817Z" fill="#F5F5F5" stroke="black" stroke-width="0.8" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M14.3769 7.87512C14.5407 8.03895 14.753 8.12479 14.9676 8.13262C15.2038 8.14125 15.4428 8.05541 15.6231 7.87512C15.9672 7.53099 15.9672 6.97307 15.6231 6.62895C15.279 6.28482 14.721 6.28482 14.3769 6.62895C14.0328 6.97307 14.0328 7.53099 14.3769 7.87512Z" fill="#70B62B"/>
<path d="M9.9209 24.1535V23.236C9.9209 22.7627 10.3047 22.3789 10.778 22.3789H19.2222C19.6956 22.3789 20.0794 22.7627 20.0794 23.236V24.1535C20.0794 24.6268 19.6956 25.0106 19.2222 25.0106H10.778C10.3047 25.0106 9.9209 24.6268 9.9209 24.1535Z" fill="#F5F5F5" stroke="black" stroke-width="0.8"/>
</g>
<defs>
<clipPath id="clip0_1200_28545">
<rect width="30" height="30" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

@@ -0,0 +1,58 @@
<svg width="49" height="49" viewBox="0 0 49 49" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_di_2888_36164)">
<circle cx="24.5" cy="23.5" r="22.5" fill="url(#paint0_linear_2888_36164)" fill-opacity="0.6" shape-rendering="crispEdges"/>
<circle cx="24.5" cy="23.5" r="22" stroke="url(#paint1_linear_2888_36164)" stroke-opacity="0.2" shape-rendering="crispEdges"/>
</g>
<path d="M10.5596 34.5319V12.4645C10.5596 10.8596 11.8606 9.55859 13.4655 9.55859H35.5336C37.1385 9.55859 38.4396 10.8596 38.4396 12.4645V34.5319C38.4396 36.1372 37.1382 37.4386 35.5329 37.4386H13.4662C11.8609 37.4386 10.5596 36.1372 10.5596 34.5319Z" fill="white" stroke="black"/>
<path d="M10.5596 17.6009V12.4653C10.5596 10.86 11.8609 9.55859 13.4662 9.55859H35.5329C37.1382 9.55859 38.4396 10.86 38.4396 12.4653V17.6009H10.5596Z" fill="white" stroke="black"/>
<circle cx="13.5093" cy="13.5796" r="0.804231" fill="url(#paint2_linear_2888_36164)" fill-opacity="0.91"/>
<circle cx="15.8687" cy="13.5796" r="0.804231" fill="url(#paint3_linear_2888_36164)" fill-opacity="0.91"/>
<circle cx="18.229" cy="13.5796" r="0.804231" fill="url(#paint4_linear_2888_36164)" fill-opacity="0.91"/>
<path d="M21.2832 13.5801H35.9132" stroke="url(#paint5_linear_2888_36164)" stroke-opacity="0.91" stroke-linecap="round"/>
<rect x="13.2051" y="20.7832" width="9.72308" height="3.28923" rx="0.572308" stroke="black"/>
<rect x="13.2051" y="26.1445" width="15.0846" height="3.28923" rx="0.572308" stroke="black"/>
<rect x="18.5664" y="31.5078" width="17.2292" height="3.28923" rx="0.572308" stroke="black"/>
<defs>
<filter id="filter0_di_2888_36164" x="0" y="0" width="49" height="49" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="1"/>
<feComposite in2="hardAlpha" operator="out"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.901961 0 0 0 0 0.901961 0 0 0 0 0.901961 0 0 0 1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2888_36164"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="1.5"/>
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
<feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.4 0"/>
<feBlend mode="normal" in2="shape" result="effect2_innerShadow_2888_36164"/>
<feBlend mode="normal" in="effect2_innerShadow_2888_36164" in2="effect1_dropShadow_2888_36164" result="effect2_innerShadow_2888_36164"/>
</filter>
<linearGradient id="paint0_linear_2888_36164" x1="2" y1="1" x2="55.0086" y2="14.4599" gradientUnits="userSpaceOnUse">
<stop stop-color="white"/>
<stop offset="0.453125" stop-color="white"/>
</linearGradient>
<linearGradient id="paint1_linear_2888_36164" x1="3.40625" y1="3.04546" x2="47" y2="3.04546" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.65625" stop-color="#70B62B"/>
</linearGradient>
<linearGradient id="paint2_linear_2888_36164" x1="12.7051" y1="12.7754" x2="14.5998" y2="13.2565" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.453125" stop-color="#70B62B"/>
</linearGradient>
<linearGradient id="paint3_linear_2888_36164" x1="15.0645" y1="12.7754" x2="16.9592" y2="13.2565" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.453125" stop-color="#70B62B"/>
</linearGradient>
<linearGradient id="paint4_linear_2888_36164" x1="17.4248" y1="12.7754" x2="19.3195" y2="13.2565" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.453125" stop-color="#70B62B"/>
</linearGradient>
<linearGradient id="paint5_linear_2888_36164" x1="21.2832" y1="13.5801" x2="22.5227" y2="18.1847" gradientUnits="userSpaceOnUse">
<stop stop-color="#C0FF7B"/>
<stop offset="0.453125" stop-color="#70B62B"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 4.1 KiB

@@ -13,21 +13,20 @@ import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.grid.GridCells import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.itemsIndexed
import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.BasicTextField import androidx.compose.foundation.text.BasicTextField
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text import androidx.compose.material3.Text
@@ -53,13 +52,12 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import coil.compose.AsyncImage import coil.compose.AsyncImage
// Живой forbion (_header.css .app-menu--mobile): нижний отступ 90 под плавающую панель,
// иконки 62, сетка 3 колонки с gap 8, БЕЗ скругления верха и БЕЗ ручки-хендла,
// высота — по контенту (почти весь экран), фон #FBFBFB.
private val BottomBarReserve: Dp = 90.dp private val BottomBarReserve: Dp = 90.dp
private val MenuIconSize = 62.dp private val MenuIconSize = 62.dp
private val MenuGridGap = 20.dp private val MenuGridGap = 8.dp
// Меню-лист выезжает снизу и занимает ~пол-экрана (не весь), по требованию владельца
private const val MenuSheetHeightFraction = 0.6f
private val MenuSheetShape = RoundedCornerShape(topStart = 20.dp, topEnd = 20.dp)
data class F7AppMenuItem( data class F7AppMenuItem(
val label: String, val label: String,
@@ -110,7 +108,8 @@ fun F7AppMenuSheet(
), ),
) )
} }
// Сам лист — выезжает снизу вверх на ~пол-экрана, скруглённый верх + тень // Сам лист — выезжает снизу вверх (translateY 100%→0), как в живом forbion:
// без скругления верха и без ручки, высота по контенту до почти всего экрана.
AnimatedVisibility( AnimatedVisibility(
visible = visible, visible = visible,
enter = fadeIn(tween(250)) + slideInVertically( enter = fadeIn(tween(250)) + slideInVertically(
@@ -126,60 +125,46 @@ fun F7AppMenuSheet(
Column( Column(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.fillMaxHeight(MenuSheetHeightFraction) .heightIn(max = 640.dp)
.padding(bottom = BottomBarReserve)
.navigationBarsPadding()
.shadow(16.dp, MenuSheetShape, clip = false)
.clip(MenuSheetShape)
.background(F7Colors.Background) .background(F7Colors.Background)
.padding(start = 16.dp, end = 16.dp, top = 8.dp, bottom = 8.dp), .navigationBarsPadding()
.padding(start = 16.dp, end = 16.dp, top = 16.dp, bottom = BottomBarReserve)
.verticalScroll(rememberScrollState()),
) { ) {
// Ручка-хендл
Box(
modifier = Modifier
.align(Alignment.CenterHorizontally)
.padding(top = 2.dp, bottom = 10.dp)
.width(40.dp)
.height(4.dp)
.clip(RoundedCornerShape(2.dp))
.background(F7Colors.Border),
)
F7AppMenuSearchField( F7AppMenuSearchField(
serverUrl = base, serverUrl = base,
value = searchQuery, value = searchQuery,
onValueChange = { searchQuery = it }, onValueChange = { searchQuery = it },
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.padding(bottom = 20.dp), .padding(bottom = 24.dp),
) )
LazyVerticalGrid( // Сетка 3 колонки, gap 8 (живой forbion). Не-ленивая — лист сам в verticalScroll.
columns = GridCells.Fixed(3), Column(
horizontalArrangement = Arrangement.spacedBy(MenuGridGap), modifier = Modifier.fillMaxWidth(),
verticalArrangement = Arrangement.spacedBy(MenuGridGap), verticalArrangement = Arrangement.spacedBy(MenuGridGap),
contentPadding = PaddingValues(horizontal = 2.dp),
modifier = Modifier
.fillMaxWidth()
.weight(1f),
) { ) {
itemsIndexed( filteredItems.chunked(3).forEach { rowItems ->
items = filteredItems, Row(
key = { index, item -> "${item.label}-$index" }, modifier = Modifier.fillMaxWidth(),
) { index, item -> horizontalArrangement = Arrangement.spacedBy(MenuGridGap),
) {
rowItems.forEach { item ->
val originalIndex = items.indexOf(item) val originalIndex = items.indexOf(item)
Box( Box(
modifier = Modifier.fillMaxWidth(), modifier = Modifier.weight(1f),
contentAlignment = Alignment.TopCenter, contentAlignment = Alignment.TopCenter,
) { ) {
F7AppMenuGridItem( F7AppMenuGridItem(
item = item, item = item,
onClick = { onClick = { if (originalIndex >= 0) onItemClick(originalIndex) },
if (originalIndex >= 0) {
onItemClick(originalIndex)
}
},
) )
} }
} }
// добить ряд пустыми ячейками для выравнивания по левому краю
repeat(3 - rowItems.size) { Box(modifier = Modifier.weight(1f)) {} }
}
}
} }
} }
} }
@@ -42,9 +42,11 @@ object F7Colors {
val SecondaryButtonBg = Color(0xFFFDFDFD) val SecondaryButtonBg = Color(0xFFFDFDFD)
val SecondaryButtonBorder = Grey3 val SecondaryButtonBorder = Grey3
// Дизайн-красный #FF7A66 (был #D74642 — расходился с макетом) // Семантика ошибок — по боевой теме forbion (_base.css: --color-element-error /
val Error = Red // --color-text-error / --color-error); базовый Red #FF7A66 из брендбука остаётся для тегов.
val ErrorBg = Red10 val Error = Color(0xFFD74642)
val ErrorText = Color(0xFFD42722)
val ErrorBg = Color(0xFFFFE2E2)
val StatusNew = Color(0xFF2B9AB6) val StatusNew = Color(0xFF2B9AB6)
val StatusProgress = Color(0xFF70B62B) val StatusProgress = Color(0xFF70B62B)
@@ -16,8 +16,11 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.ButtonDefaults
@@ -43,11 +46,14 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.text.input.VisualTransformation import androidx.compose.ui.text.input.VisualTransformation
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.draw.shadow import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.window.Dialog import androidx.compose.ui.window.Dialog
/** /**
@@ -69,6 +75,46 @@ fun F7ScreenBackground(modifier: Modifier = Modifier, content: @Composable () ->
} }
} }
/**
* Единый экран ошибки (по центру): иконка + сообщение + кнопка «Повторить».
* Используется везде, где загрузка упала и данных нет вместо россыпи красного текста.
*/
@Composable
fun F7ErrorState(
message: String,
modifier: Modifier = Modifier,
onRetry: (() -> Unit)? = null,
) {
Column(
modifier = modifier
.fillMaxSize()
.padding(24.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
) {
Box(
modifier = Modifier
.size(56.dp)
.clip(CircleShape)
.background(F7Colors.Error.copy(alpha = 0.12f)),
contentAlignment = Alignment.Center,
) {
Text("!", color = F7Colors.Error, fontSize = 30.sp, fontWeight = FontWeight.Bold)
}
Spacer(Modifier.height(12.dp))
Text(
text = message,
style = MaterialTheme.typography.bodyMedium,
color = F7Colors.TextSecondary,
textAlign = TextAlign.Center,
)
if (onRetry != null) {
Spacer(Modifier.height(16.dp))
F7SecondaryButton(text = "Повторить", onClick = onRetry)
}
}
}
@Composable @Composable
fun F7ModuleScreen( fun F7ModuleScreen(
title: String? = null, title: String? = null,
@@ -76,6 +122,9 @@ fun F7ModuleScreen(
loading: Boolean = false, loading: Boolean = false,
error: String? = null, error: String? = null,
onRefresh: (() -> Unit)? = null, onRefresh: (() -> Unit)? = null,
// Действие «Повторить» в экране ошибки; по умолчанию — как onRefresh.
// Позволяет дать retry, не показывая хедер-кнопку ↻ (когда onRefresh не задан).
onErrorRetry: (() -> Unit)? = onRefresh,
headerActions: @Composable RowScope.() -> Unit = {}, headerActions: @Composable RowScope.() -> Unit = {},
content: @Composable ColumnScope.() -> Unit, content: @Composable ColumnScope.() -> Unit,
) { ) {
@@ -126,8 +175,15 @@ fun F7ModuleScreen(
CircularProgressIndicator(color = F7Colors.Primary) CircularProgressIndicator(color = F7Colors.Primary)
} }
if (!error.isNullOrBlank()) { if (!error.isNullOrBlank()) {
Text(text = error, color = F7Colors.Error, style = MaterialTheme.typography.bodyMedium) // Ошибка без данных → центрированный экран с «Повторить»
} F7ErrorState(
message = error,
onRetry = onErrorRetry,
modifier = Modifier
.fillMaxWidth()
.weight(1f),
)
} else {
Column( Column(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
@@ -136,6 +192,7 @@ fun F7ModuleScreen(
) )
} }
} }
}
@Composable @Composable
fun F7PrimaryButton( fun F7PrimaryButton(
@@ -9,7 +9,8 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentWidth import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
@@ -34,17 +35,19 @@ data class F7BottomBarActions(
val onMenuClick: () -> Unit = {}, val onMenuClick: () -> Unit = {},
) )
// Живой forbion (_header.css .header__mobile-bottom): пилюля 328×61, паддинг 3,
// фон #F5F5F5; кнопки 55, фон #FBFBFB, рамка #E6E6E6; активная кнопка-раздел и открытый
// бургер — полупрозрачный зелёный градиент 104°.
private val BottomBarWidth = 328.dp
private val BottomBarHeight = 61.dp
private val BottomBarButtonSize = 55.dp private val BottomBarButtonSize = 55.dp
private val BottomBarIconSize = 34.dp private val BottomBarIconSize = 34.dp
// Иконки-разделы (Почта/Карточки/Конференции) — серверные SVG с внутренним
// «воздухом», поэтому рендерим крупнее, чтобы заполняли кружок.
private val BottomBarSectionIconSize = 46.dp private val BottomBarSectionIconSize = 46.dp
private val BottomBarGap = 8.dp private val BottomBarOuterPadding = 3.dp
private val BottomBarOuterPaddingH = 6.dp
private val BottomBarOuterPaddingV = 6.dp
private val BottomBarButtonShape = RoundedCornerShape(100.dp) private val BottomBarButtonShape = RoundedCornerShape(100.dp)
private val BottomBarBorderBrush = Brush.linearGradient( private val BottomBarButtonBg = Color(0xFFFBFBFB)
private val BottomBarButtonBorder = Color(0xFFE6E6E6)
private val BottomBarActiveBrush = Brush.linearGradient(
listOf(Color(0x33C0FF7B), Color(0x3370B62B)), listOf(Color(0x33C0FF7B), Color(0x3370B62B)),
) )
@@ -62,10 +65,11 @@ fun F7MobileBottomBar(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
) { ) {
val base = serverUrl.trimEnd('/') val base = serverUrl.trimEnd('/')
val pillShape = RoundedCornerShape(percent = 50) val pillShape = RoundedCornerShape(100.dp)
Row( Row(
modifier = modifier modifier = modifier
.wrapContentWidth() .width(BottomBarWidth)
.height(BottomBarHeight)
.shadow( .shadow(
elevation = 2.dp, elevation = 2.dp,
shape = pillShape, shape = pillShape,
@@ -73,11 +77,8 @@ fun F7MobileBottomBar(
) )
.clip(pillShape) .clip(pillShape)
.background(Color(0xFFF5F5F5)) .background(Color(0xFFF5F5F5))
.padding( .padding(BottomBarOuterPadding),
horizontal = BottomBarOuterPaddingH, horizontalArrangement = Arrangement.SpaceBetween,
vertical = BottomBarOuterPaddingV,
),
horizontalArrangement = Arrangement.spacedBy(BottomBarGap),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
) { ) {
config.slots.forEach { slot -> config.slots.forEach { slot ->
@@ -89,6 +90,7 @@ fun F7MobileBottomBar(
"$base/themes/forbion/images/header/chat-icon-gray.svg" "$base/themes/forbion/images/header/chat-icon-gray.svg"
}, },
contentDescription = "Чаты", contentDescription = "Чаты",
active = chatsHighlighted,
onClick = actions.onChatsClick, onClick = actions.onChatsClick,
) )
F7BottomBarSlot.NavBack -> F7BottomBarIconSlot( F7BottomBarSlot.NavBack -> F7BottomBarIconSlot(
@@ -101,18 +103,21 @@ fun F7MobileBottomBar(
iconUrl = "$base/themes/forbion/images/header/mail-header-icon.svg", iconUrl = "$base/themes/forbion/images/header/mail-header-icon.svg",
contentDescription = "Почта", contentDescription = "Почта",
iconSize = BottomBarSectionIconSize, iconSize = BottomBarSectionIconSize,
active = activeTabKey.equals("mail", ignoreCase = true),
onClick = actions.onMailClick, onClick = actions.onMailClick,
) )
F7BottomBarSlot.SectionCards -> F7BottomBarIconSlot( F7BottomBarSlot.SectionCards -> F7BottomBarIconSlot(
iconUrl = "$base/themes/forbion/images/header/deck-header-icon.svg", iconUrl = "$base/themes/forbion/images/header/deck-header-icon.svg",
contentDescription = "Карточки", contentDescription = "Карточки",
iconSize = BottomBarSectionIconSize, iconSize = BottomBarSectionIconSize,
active = activeTabKey.equals("deck", ignoreCase = true),
onClick = actions.onCardsClick, onClick = actions.onCardsClick,
) )
F7BottomBarSlot.SectionConferences -> F7BottomBarIconSlot( F7BottomBarSlot.SectionConferences -> F7BottomBarIconSlot(
iconUrl = "$base/themes/forbion/images/header/spreed-header-icon.svg", iconUrl = "$base/themes/forbion/images/header/spreed-header-icon.svg",
contentDescription = "Конференции", contentDescription = "Конференции",
iconSize = BottomBarSectionIconSize, iconSize = BottomBarSectionIconSize,
active = activeTabKey.equals("talk", ignoreCase = true),
onClick = actions.onConferencesClick, onClick = actions.onConferencesClick,
) )
F7BottomBarSlot.Menu -> F7BottomBarIconSlot( F7BottomBarSlot.Menu -> F7BottomBarIconSlot(
@@ -122,6 +127,7 @@ fun F7MobileBottomBar(
"$base/themes/forbion/images/header/menu-burger-gray.svg" "$base/themes/forbion/images/header/menu-burger-gray.svg"
}, },
contentDescription = "Меню", contentDescription = "Меню",
active = menuOpen,
showBadge = showNotificationBadge, showBadge = showNotificationBadge,
onClick = actions.onMenuClick, onClick = actions.onMenuClick,
) )
@@ -135,19 +141,27 @@ private fun F7BottomBarIconSlot(
iconUrl: String, iconUrl: String,
contentDescription: String, contentDescription: String,
onClick: () -> Unit, onClick: () -> Unit,
active: Boolean = false,
iconRotation: Float = 0f, iconRotation: Float = 0f,
showBadge: Boolean = false, showBadge: Boolean = false,
iconSize: Dp = BottomBarIconSize, iconSize: Dp = BottomBarIconSize,
) { ) {
// Зелёной подложки под активной кнопкой быть не должно — фон всегда нейтральный. // Живой forbion: кнопка 55, фон #FBFBFB + рамка #E6E6E6; активная (текущий раздел /
// открытый бургер) — полупрозрачный зелёный градиент 104°.
Box( Box(
modifier = Modifier modifier = Modifier
.size(BottomBarButtonSize) .size(BottomBarButtonSize)
.clip(BottomBarButtonShape) .clip(BottomBarButtonShape)
.background(Color(0x99FFFFFF), BottomBarButtonShape) .then(
if (active) {
Modifier.background(BottomBarActiveBrush, BottomBarButtonShape)
} else {
Modifier.background(BottomBarButtonBg, BottomBarButtonShape)
},
)
.border( .border(
width = 1.dp, width = 1.dp,
brush = BottomBarBorderBrush, color = BottomBarButtonBorder,
shape = BottomBarButtonShape, shape = BottomBarButtonShape,
) )
.clickable( .clickable(
@@ -22,6 +22,9 @@ data class DavCalendar(
val href: String, val href: String,
val displayName: String, val displayName: String,
val color: String? = null, val color: String? = null,
// CTag коллекции (CalendarServer-расширение, Nextcloud поддерживает):
// меняется при любом изменении в календаре → ключ инкрементального кэша событий.
val ctag: String = "",
) )
data class DavEvent( data class DavEvent(
@@ -103,7 +106,7 @@ object CalDavClient {
val body = """ val body = """
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<d:propfind xmlns:d="DAV:" xmlns:cs="http://calendarserver.org/ns/" xmlns:ical="http://apple.com/ns/ical/"> <d:propfind xmlns:d="DAV:" xmlns:cs="http://calendarserver.org/ns/" xmlns:ical="http://apple.com/ns/ical/">
<d:prop><d:displayname/><d:resourcetype/><ical:calendar-color/></d:prop> <d:prop><d:displayname/><d:resourcetype/><ical:calendar-color/><cs:getctag/></d:prop>
</d:propfind> </d:propfind>
""".trimIndent() """.trimIndent()
val xml = propfind(client, baseUrl, depth = 1, body) val xml = propfind(client, baseUrl, depth = 1, body)
@@ -129,7 +132,15 @@ object CalDavClient {
calendar: DavCalendar, calendar: DavCalendar,
rangeStart: Instant, rangeStart: Instant,
rangeEnd: Instant, rangeEnd: Instant,
): List<DavEvent> { ): List<DavEvent> = parseEventsXml(queryEventsRawXml(client, calendar, rangeStart, rangeEnd), calendar)
/** Сырой REPORT-ответ (для кэширования на диске с ключом по CTag). */
fun queryEventsRawXml(
client: OkHttpClient,
calendar: DavCalendar,
rangeStart: Instant,
rangeEnd: Instant,
): String {
val startStr = formatCalDavTime(rangeStart) val startStr = formatCalDavTime(rangeStart)
val endStr = formatCalDavTime(rangeEnd) val endStr = formatCalDavTime(rangeEnd)
val body = """ val body = """
@@ -146,10 +157,13 @@ object CalDavClient {
</c:calendar-query> </c:calendar-query>
""".trimIndent() """.trimIndent()
val href = calendar.href.trimEnd('/') + "/" val href = calendar.href.trimEnd('/') + "/"
val xml = report(client, href, body) return report(client, href, body)
return parseCalendarQueryResponses(xml, calendar)
} }
/** Парсинг REPORT-ответа (в т.ч. взятого из кэша). */
fun parseEventsXml(xml: String, calendar: DavCalendar): List<DavEvent> =
parseCalendarQueryResponses(xml, calendar)
fun createEvent( fun createEvent(
client: OkHttpClient, client: OkHttpClient,
calendar: DavCalendar, calendar: DavCalendar,
@@ -782,6 +796,7 @@ object CalDavClient {
var href = "" var href = ""
var displayName = "" var displayName = ""
var calendarColor: String? = null var calendarColor: String? = null
var ctag = ""
var isCollection = false var isCollection = false
while (parser.eventType != XmlPullParser.END_DOCUMENT) { while (parser.eventType != XmlPullParser.END_DOCUMENT) {
when (parser.eventType) { when (parser.eventType) {
@@ -791,11 +806,13 @@ object CalDavClient {
href = "" href = ""
displayName = "" displayName = ""
calendarColor = null calendarColor = null
ctag = ""
isCollection = false isCollection = false
} }
"collection" -> if (inResponse) isCollection = true "collection" -> if (inResponse) isCollection = true
"displayname" -> if (inResponse) displayName = parser.readText().trim() "displayname" -> if (inResponse) displayName = parser.readText().trim()
"calendar-color" -> if (inResponse) calendarColor = parser.readText().trim() "calendar-color" -> if (inResponse) calendarColor = parser.readText().trim()
"getctag" -> if (inResponse) ctag = parser.readText().trim()
"href" -> if (inResponse) href = parser.readText().trim() "href" -> if (inResponse) href = parser.readText().trim()
} }
XmlPullParser.END_TAG -> if (parser.localTag() == "response" && inResponse) { XmlPullParser.END_TAG -> if (parser.localTag() == "response" && inResponse) {
@@ -809,7 +826,7 @@ object CalDavClient {
val name = displayName.ifBlank { val name = displayName.ifBlank {
fullPath.removePrefix(basePath).trim('/').substringAfterLast('/') fullPath.removePrefix(basePath).trim('/').substringAfterLast('/')
} }
out += DavCalendar(href = full, displayName = name, color = calendarColor) out += DavCalendar(href = full, displayName = name, color = calendarColor, ctag = ctag)
} }
} }
inResponse = false inResponse = false
@@ -69,6 +69,53 @@ object CardDavClient {
return out.distinctBy { "${it.uid}|${it.email}" } return out.distinctBy { "${it.uid}|${it.email}" }
} }
/**
* Дешёвая «подпись» состояния адресных книг CTag коллекций (расширение
* CalendarServer, поддерживается Nextcloud), с фолбэком на sync-token.
* Один PROPFIND depth:1 без address-data. Если подпись не изменилась с прошлой
* синхронизации контакты качать не нужно. null при ошибке/неподдержке полный sync.
*/
fun collectionSignature(
client: OkHttpClient,
serverUrl: String,
userId: String,
): String? = runCatching {
val base = davAddressBooksBaseUrl(serverUrl, userId)
val body = """
<?xml version="1.0" encoding="utf-8"?>
<d:propfind xmlns:d="DAV:" xmlns:cs="http://calendarserver.org/ns/">
<d:prop><cs:getctag/><d:sync-token/></d:prop>
</d:propfind>
""".trimIndent()
val xml = propfind(client, base, depth = 1, body)
parseCollectionSignature(xml).ifBlank { null }
}.getOrNull()
/**
* Парсит PROPFIND-ответ в стабильную подпись «href=ctag» (по книгам, отсортировано).
* Regex-парсинг (как ICS в проекте) чистая функция, тестируется без Android XmlPull.
*/
internal fun parseCollectionSignature(xml: String): String {
val entries = sortedSetOf<String>()
for (m in responseBlockPattern.findAll(xml)) {
val block = m.value
val href = hrefTagPattern.find(block)?.groupValues?.get(1)?.trim().orEmpty()
val tag = (
getctagPattern.find(block)?.groupValues?.get(1)
?: syncTokenPattern.find(block)?.groupValues?.get(1)
)?.trim().orEmpty()
if (href.isNotBlank() && tag.isNotBlank()) {
entries += "$href=$tag"
}
}
return entries.joinToString("\n")
}
private val responseBlockPattern = Regex("(?is)<(?:\\w+:)?response\\b.*?</(?:\\w+:)?response>")
private val hrefTagPattern = Regex("(?is)<(?:\\w+:)?href>(.*?)</(?:\\w+:)?href>")
private val getctagPattern = Regex("(?is)<(?:\\w+:)?getctag>(.*?)</(?:\\w+:)?getctag>")
private val syncTokenPattern = Regex("(?is)<(?:\\w+:)?sync-token>(.*?)</(?:\\w+:)?sync-token>")
fun createContact( fun createContact(
client: OkHttpClient, client: OkHttpClient,
serverUrl: String, serverUrl: String,
@@ -0,0 +1,56 @@
package ru.forbion.f7cloud.core.network
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotEquals
import org.junit.Assert.assertTrue
import org.junit.Test
/**
* Тесты подписи коллекций CardDAV (CTag/sync-token) основа инкрементальной
* синхронизации: если подпись не изменилась, контакты не перекачиваются.
*/
class CardDavSignatureTest {
private val ns = """xmlns:d="DAV:" xmlns:cs="http://calendarserver.org/ns/""""
private fun body(vararg responses: String) =
"""<?xml version="1.0"?><d:multistatus $ns>${responses.joinToString("")}</d:multistatus>"""
private fun resp(href: String, ctag: String? = null, token: String? = null) = """
<d:response>
<d:href>$href</d:href>
<d:propstat><d:prop>
${ctag?.let { "<cs:getctag>$it</cs:getctag>" } ?: ""}
${token?.let { "<d:sync-token>$it</d:sync-token>" } ?: ""}
</d:prop></d:propstat>
</d:response>
""".trimIndent()
@Test fun ctag_signature_is_stable_and_sorted() {
val a = CardDavClient.parseCollectionSignature(
body(resp("/dav/addressbooks/u/b1/", ctag = "111"), resp("/dav/addressbooks/u/b2/", ctag = "222")),
)
// порядок ответов не влияет на подпись
val b = CardDavClient.parseCollectionSignature(
body(resp("/dav/addressbooks/u/b2/", ctag = "222"), resp("/dav/addressbooks/u/b1/", ctag = "111")),
)
assertEquals(a, b)
assertTrue(a.contains("/dav/addressbooks/u/b1/=111"))
assertTrue(a.contains("/dav/addressbooks/u/b2/=222"))
}
@Test fun ctag_change_changes_signature() {
val before = CardDavClient.parseCollectionSignature(body(resp("/b1/", ctag = "111")))
val after = CardDavClient.parseCollectionSignature(body(resp("/b1/", ctag = "999")))
assertNotEquals(before, after)
}
@Test fun sync_token_fallback_when_no_ctag() {
val sig = CardDavClient.parseCollectionSignature(body(resp("/b1/", token = "http://sabre/sync/42")))
assertEquals("/b1/=http://sabre/sync/42", sig)
}
@Test fun empty_when_no_tags() {
assertEquals("", CardDavClient.parseCollectionSignature(body(resp("/b1/"))))
}
}
@@ -4,16 +4,19 @@ import android.content.BroadcastReceiver
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
/** Handles Decline on incoming Talk call notifications. */ /** Handles Decline and ring-timeout on incoming Talk call notifications. */
class F7CallActionReceiver : BroadcastReceiver() { class F7CallActionReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) { override fun onReceive(context: Context, intent: Intent) {
if (intent.action != ACTION_DECLINE) return
val roomToken = intent.getStringExtra(EXTRA_ROOM_TOKEN) val roomToken = intent.getStringExtra(EXTRA_ROOM_TOKEN)
F7IncomingCallQueue.dismissAndShowNext(context, roomToken) when (intent.action) {
ACTION_DECLINE -> F7IncomingCallQueue.dismissAndShowNext(context, roomToken)
ACTION_CALL_TIMEOUT -> F7IncomingCallQueue.timeoutActive(context, roomToken)
}
} }
companion object { companion object {
const val ACTION_DECLINE = "ru.forbion.f7cloud.action.DECLINE_CALL" const val ACTION_DECLINE = "ru.forbion.f7cloud.action.DECLINE_CALL"
const val ACTION_CALL_TIMEOUT = "ru.forbion.f7cloud.action.CALL_TIMEOUT"
const val EXTRA_NOTIFICATION_ID = "notificationId" const val EXTRA_NOTIFICATION_ID = "notificationId"
const val EXTRA_ROOM_TOKEN = "roomToken" const val EXTRA_ROOM_TOKEN = "roomToken"
} }
@@ -1,10 +1,13 @@
package ru.forbion.f7cloud.core.push package ru.forbion.f7cloud.core.push
import android.app.AlarmManager
import android.app.NotificationManager import android.app.NotificationManager
import android.app.PendingIntent import android.app.PendingIntent
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.Build import android.os.Build
import android.os.Handler
import android.os.Looper
import android.util.Log import android.util.Log
import androidx.core.app.NotificationCompat import androidx.core.app.NotificationCompat
import androidx.core.app.Person import androidx.core.app.Person
@@ -21,10 +24,36 @@ object F7IncomingCallQueue {
private const val KEY_QUEUE = "queue" private const val KEY_QUEUE = "queue"
private const val KEY_ACTIVE_TOKEN = "active_token" private const val KEY_ACTIVE_TOKEN = "active_token"
private const val KEY_ACTIVE_AT = "active_at" private const val KEY_ACTIVE_AT = "active_at"
private const val KEY_ACTIVE_CALL = "active_call"
const val ACTIVE_NOTIFICATION_ID = 5000 const val ACTIVE_NOTIFICATION_ID = 5000
private const val MISSED_NOTIFICATION_BASE = 5100
private const val ACTIVE_RING_TTL_MS = 3 * 60 * 1000L private const val ACTIVE_RING_TTL_MS = 3 * 60 * 1000L
/** Входящий звонит 30 с; дальше — авто-сброс и уведомление «Пропущенный звонок». */
private const val RING_TIMEOUT_MS = 30_000L
/** Запас страховочного alarm поверх основного in-process таймера. */
private const val TIMEOUT_ALARM_SLACK_MS = 5_000L
private val lock = Any() private val lock = Any()
private val handler = Handler(Looper.getMainLooper())
private var timeoutRunnable: Runnable? = null
private val callEndedListeners = java.util.concurrent.CopyOnWriteArraySet<(String) -> Unit>()
/** Уведомляет UI (полноэкранный входящий), что активный звонок снят: принят/отклонён/протух. */
fun addCallEndedListener(listener: (String) -> Unit) {
callEndedListeners.add(listener)
}
fun removeCallEndedListener(listener: (String) -> Unit) {
callEndedListeners.remove(listener)
}
private fun notifyCallEnded(token: String) {
callEndedListeners.forEach { listener ->
runCatching { listener(token) }
}
}
fun enqueue( fun enqueue(
context: Context, context: Context,
@@ -58,10 +87,10 @@ object F7IncomingCallQueue {
} }
if (active.isEmpty()) { if (active.isEmpty()) {
setActive(prefs, token)
val shown = showNotification(context, call, waiting = 0) val shown = showNotification(context, call, waiting = 0)
if (!shown) { if (shown) {
prefs.edit().remove(KEY_ACTIVE_TOKEN).remove(KEY_ACTIVE_AT).apply() setActive(prefs, call)
scheduleTimeout(context, token)
} }
return shown return shown
} }
@@ -74,6 +103,7 @@ object F7IncomingCallQueue {
} }
fun dismissAndShowNext(context: Context, roomToken: String?) { fun dismissAndShowNext(context: Context, roomToken: String?) {
var ended: String? = null
synchronized(lock) { synchronized(lock) {
val prefs = prefs(context) val prefs = prefs(context)
val active = prefs.getString(KEY_ACTIVE_TOKEN, "").orEmpty() val active = prefs.getString(KEY_ACTIVE_TOKEN, "").orEmpty()
@@ -88,14 +118,60 @@ object F7IncomingCallQueue {
} }
} }
cancelTimeout(context)
cancelNotification(context) cancelNotification(context)
prefs.edit().remove(KEY_ACTIVE_TOKEN).remove(KEY_ACTIVE_AT).apply() clearActive(prefs)
ended = active.takeIf { it.isNotEmpty() }
advanceQueueLocked(context, prefs, queue)
}
ended?.let { notifyCallEnded(it) }
}
/**
* Авто-сброс не отвеченного звонка (истекли [RING_TIMEOUT_MS]): снять входящий,
* показать «Пропущенный звонок» и следующий звонок из очереди, если есть.
* Принятые/отклонённые звонки сюда не попадают их снимает [dismissAndShowNext].
*/
fun timeoutActive(context: Context, roomToken: String?) {
var ended: String? = null
synchronized(lock) {
val prefs = prefs(context)
val active = prefs.getString(KEY_ACTIVE_TOKEN, "").orEmpty()
if (active.isEmpty()) return
if (!roomToken.isNullOrBlank() && roomToken.trim() != active) return
val call = readActiveCall(prefs)
cancelTimeout(context)
cancelNotification(context)
clearActive(prefs)
ended = active
Log.i(TAG, "Call timed out (unanswered): $active")
if (call != null) {
showMissedNotification(context, call)
}
advanceQueueLocked(context, prefs, readQueue(prefs))
}
ended?.let { notifyCallEnded(it) }
}
fun clearAll(context: Context) {
synchronized(lock) {
val prefs = prefs(context)
cancelTimeout(context)
cancelNotification(context)
prefs.edit().remove(KEY_QUEUE).remove(KEY_ACTIVE_TOKEN).remove(KEY_ACTIVE_AT).remove(KEY_ACTIVE_CALL).apply()
}
}
private fun advanceQueueLocked(
context: Context,
prefs: android.content.SharedPreferences,
queue: JSONArray,
) {
if (queue.length() == 0) { if (queue.length() == 0) {
prefs.edit().remove(KEY_QUEUE).apply() prefs.edit().remove(KEY_QUEUE).apply()
return return
} }
runCatching { runCatching {
val next = PendingCall.fromJson(queue.getJSONObject(0)) val next = PendingCall.fromJson(queue.getJSONObject(0))
val rest = JSONArray() val rest = JSONArray()
@@ -104,22 +180,14 @@ object F7IncomingCallQueue {
} }
prefs.edit().putString(KEY_QUEUE, rest.toString()).apply() prefs.edit().putString(KEY_QUEUE, rest.toString()).apply()
if (showNotification(context, next, rest.length())) { if (showNotification(context, next, rest.length())) {
setActive(prefs, next.roomToken) setActive(prefs, next)
scheduleTimeout(context, next.roomToken)
} }
}.onFailure { }.onFailure {
Log.w(TAG, "Failed to parse queued call", it) Log.w(TAG, "Failed to parse queued call", it)
prefs.edit().remove(KEY_QUEUE).apply() prefs.edit().remove(KEY_QUEUE).apply()
} }
} }
}
fun clearAll(context: Context) {
synchronized(lock) {
val prefs = prefs(context)
cancelNotification(context)
prefs.edit().remove(KEY_QUEUE).remove(KEY_ACTIVE_TOKEN).apply()
}
}
private fun showNotification( private fun showNotification(
context: Context, context: Context,
@@ -343,13 +411,106 @@ object F7IncomingCallQueue {
private fun prefs(context: Context) = private fun prefs(context: Context) =
context.applicationContext.getSharedPreferences(PREFS, Context.MODE_PRIVATE) context.applicationContext.getSharedPreferences(PREFS, Context.MODE_PRIVATE)
private fun setActive(prefs: android.content.SharedPreferences, token: String) { private fun setActive(prefs: android.content.SharedPreferences, call: PendingCall) {
prefs.edit() prefs.edit()
.putString(KEY_ACTIVE_TOKEN, token) .putString(KEY_ACTIVE_TOKEN, call.roomToken)
.putLong(KEY_ACTIVE_AT, System.currentTimeMillis()) .putLong(KEY_ACTIVE_AT, System.currentTimeMillis())
// Персистим весь звонок: страховочный alarm после смерти процесса должен уметь
// показать «Пропущенный» с названием комнаты.
.putString(KEY_ACTIVE_CALL, call.toJson().toString())
.apply() .apply()
} }
private fun clearActive(prefs: android.content.SharedPreferences) {
prefs.edit().remove(KEY_ACTIVE_TOKEN).remove(KEY_ACTIVE_AT).remove(KEY_ACTIVE_CALL).apply()
}
private fun readActiveCall(prefs: android.content.SharedPreferences): PendingCall? {
val raw = prefs.getString(KEY_ACTIVE_CALL, null) ?: return null
return runCatching { PendingCall.fromJson(JSONObject(raw)) }.getOrNull()
}
private fun scheduleTimeout(context: Context, token: String) {
val app = context.applicationContext
timeoutRunnable?.let(handler::removeCallbacks)
val runnable = Runnable { timeoutActive(app, token) }
timeoutRunnable = runnable
handler.postDelayed(runnable, RING_TIMEOUT_MS)
// Страховка: если процесс умрёт до срабатывания таймера, alarm поднимет его и
// заменит зависшее уведомление звонка на «Пропущенный». timeoutActive идемпотентен.
runCatching {
app.getSystemService(AlarmManager::class.java)?.setAndAllowWhileIdle(
AlarmManager.RTC_WAKEUP,
System.currentTimeMillis() + RING_TIMEOUT_MS + TIMEOUT_ALARM_SLACK_MS,
timeoutAlarmIntent(app, token),
)
}.onFailure { Log.w(TAG, "Timeout alarm schedule failed", it) }
}
private fun cancelTimeout(context: Context) {
timeoutRunnable?.let(handler::removeCallbacks)
timeoutRunnable = null
runCatching {
context.applicationContext.getSystemService(AlarmManager::class.java)
?.cancel(timeoutAlarmIntent(context.applicationContext, null))
}
}
private fun timeoutAlarmIntent(context: Context, token: String?): PendingIntent {
val intent = Intent(context, F7CallActionReceiver::class.java).apply {
action = F7CallActionReceiver.ACTION_CALL_TIMEOUT
if (token != null) {
putExtra(F7CallActionReceiver.EXTRA_ROOM_TOKEN, token)
}
}
return PendingIntent.getBroadcast(
context,
ACTIVE_NOTIFICATION_ID + 2,
intent,
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE,
)
}
private fun showMissedNotification(context: Context, call: PendingCall) {
F7NotificationChannels.ensureAll(context)
val manager = context.getSystemService(NotificationManager::class.java) ?: return
val roomName = call.displayName.ifBlank { call.title }
val notificationId = MISSED_NOTIFICATION_BASE + kotlin.math.abs(call.roomToken.hashCode() % 1000)
val pending = context.packageManager.getLaunchIntentForPackage(context.packageName)?.let { launch ->
PendingIntent.getActivity(
context,
notificationId,
Intent(launch).putExtra(PushIntents.EXTRA_ROOM_TOKEN, call.roomToken),
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE,
)
}
val iconRes = context.applicationInfo.icon.takeIf { it != 0 }
?: android.R.drawable.sym_call_missed
// Локскрин — обезличенно (минимум информации, решение владельца); название комнаты
// видно после разблокировки.
val publicVersion = NotificationCompat.Builder(context, F7NotificationChannels.MESSAGES)
.setSmallIcon(iconRes)
.setContentTitle("F7cloud")
.setContentText(context.getString(R.string.call_missed_public))
.setAutoCancel(true)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.apply { if (pending != null) setContentIntent(pending) }
.build()
val notification = NotificationCompat.Builder(context, F7NotificationChannels.MESSAGES)
.setSmallIcon(iconRes)
.setContentTitle(context.getString(R.string.call_missed_title))
.setContentText(roomName)
.setCategory(NotificationCompat.CATEGORY_MISSED_CALL)
.setAutoCancel(true)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setVisibility(NotificationCompat.VISIBILITY_PRIVATE)
.setPublicVersion(publicVersion)
.apply { if (pending != null) setContentIntent(pending) }
.build()
runCatching { manager.notify(notificationId, notification) }
.onFailure { Log.w(TAG, "Missed-call notification failed", it) }
}
private fun touchActive(prefs: android.content.SharedPreferences) { private fun touchActive(prefs: android.content.SharedPreferences) {
prefs.edit().putLong(KEY_ACTIVE_AT, System.currentTimeMillis()).apply() prefs.edit().putLong(KEY_ACTIVE_AT, System.currentTimeMillis()).apply()
} }
@@ -360,7 +521,7 @@ object F7IncomingCallQueue {
val activeAt = prefs.getLong(KEY_ACTIVE_AT, 0L) val activeAt = prefs.getLong(KEY_ACTIVE_AT, 0L)
if (activeAt <= 0L || System.currentTimeMillis() - activeAt > ACTIVE_RING_TTL_MS) { if (activeAt <= 0L || System.currentTimeMillis() - activeAt > ACTIVE_RING_TTL_MS) {
Log.w(TAG, "Clearing stale active call: $active") Log.w(TAG, "Clearing stale active call: $active")
prefs.edit().remove(KEY_ACTIVE_TOKEN).remove(KEY_ACTIVE_AT).apply() clearActive(prefs)
} }
} }
@@ -5,6 +5,8 @@
<string name="call_action_accept">Принять</string> <string name="call_action_accept">Принять</string>
<string name="call_action_decline">Отклонить</string> <string name="call_action_decline">Отклонить</string>
<string name="incoming_call_subtitle">F7cloud звонок</string> <string name="incoming_call_subtitle">F7cloud звонок</string>
<string name="call_missed_title">Пропущенный звонок</string>
<string name="call_missed_public">Вы пропустили звонок</string>
<plurals name="call_queue_waiting"> <plurals name="call_queue_waiting">
<item quantity="one">Ещё %d звонок в очереди</item> <item quantity="one">Ещё %d звонок в очереди</item>
<item quantity="few">Ещё %d звонка в очереди</item> <item quantity="few">Ещё %d звонка в очереди</item>
+20 -5
View File
@@ -48,9 +48,24 @@ scripts/package-source.sh dist/ # → dist/f7cloud-mobile-v<ver>-<rev>-sourc
В CI прикладывается к каждому Gitea Release. До появления раннера — публиковать исходник В CI прикладывается к каждому Gitea Release. До появления раннера — публиковать исходник
вручную этим скриптом к каждой распространяемой сборке. вручную этим скриптом к каждой распространяемой сборке.
## Статус ## Статус — ⏸️ ОТЛОЖЕНО (2026-07-09)
**Активно (2026-07-09):** self-hosted раннер `f7-b-android` зарегистрирован и запущен на инфре B Раннер развёрнут на инфре B (act_runner 0.2.13 + Node 20 + Docker + systemd), диспетчеризация
(scope — репозиторий, host-исполнение). Workflow срабатывает на push/PR (lint+тесты+assembleDebug). Gitea работает (джобы доходят до раннера). **НО host-исполнение act_runner 0.2.13 в нашем
Осталось для джобы `release` по тегу: завести Secrets репозитория (keystore base64 + пароли) окружении сломано**: криво резолвит путь к шагам и JS-экшенам
пока release-сборки делаются вручную на билд-машине тем же ключом. `No such file or directory` на `.cache/act/<id>/act/workflow/0.sh` и `MODULE_NOT_FOUND` на
`actions/checkout` (задвоение `hostexecutor/.cache/act`). Обойти на уровне workflow нельзя
(ломается сам запуск шага). Workflow **запаркован** (триггер `workflow_dispatch`), сервис
раннера остановлен и отключён от автозапуска — чтобы push'и не плодили падающие прогоны.
**Рабочий путь (когда вернёмся):** Docker-исполнение вместо host —
- кастомный образ с JDK 21 + Android SDK 36 (в дефолтном ubuntu их нет);
- volume для тёплого `~/.gradle` (vendor/WebRTC);
- раннер с меткой на docker-образ (не `:host`); в docker-режиме пути корректны, JS-экшены работают;
- регистрировать repo-токеном именно из **`f7cloud_mobile`** (id 24) — при отладке «repo-токены»
ошибочно регистрировали к чужому `f7cloud_client` (id 4) или в user-scope; в Gitea осталось
~5 дублей раннера `f7-b-android` (удалить в админке).
**Пока:** сборки и релизы — **вручную** на билд-машине (боевой ключ владельца из
`/root/.f7cloud-keys/`), исходники — `scripts/package-source.sh`, Release в Gitea — через API.
Что и делаем: релиз `v0.5.123` опубликован (APK + source) вручную.
+1
View File
@@ -38,4 +38,5 @@ dependencies {
implementation libs.core.ktx implementation libs.core.ktx
implementation libs.coil.compose implementation libs.coil.compose
implementation libs.coil.svg implementation libs.coil.svg
testImplementation libs.junit
} }
@@ -392,41 +392,46 @@ fun CalendarMonthGrid(
) { ) {
val days = CalendarRepository.monthGridDays(month) val days = CalendarRepository.monthGridDays(month)
val today = LocalDate.now() val today = LocalDate.now()
// Живая тема (_calendar-month-view-mobile.css): месяц — белая карточка r12 с рамкой,
// внутри дни недели — круги 40 (#F5F5F5, 16/500) и ячейки-карточки #FDFDFD r4
// с тенью, зазор 4.
Column( Column(
modifier = Modifier.fillMaxWidth(), modifier = Modifier
verticalArrangement = Arrangement.spacedBy(6.dp), .fillMaxWidth()
.clip(RoundedCornerShape(12.dp))
.background(Color.White)
.border(1.dp, F7Colors.Border, RoundedCornerShape(12.dp))
.padding(12.dp),
verticalArrangement = Arrangement.spacedBy(4.dp),
) { ) {
// Заголовок дней недели — серые пилюли (по макету «Календарь · Месяц»)
Row( Row(
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(4.dp), horizontalArrangement = Arrangement.spacedBy(4.dp),
) { ) {
weekDayLabels.forEach { label -> weekDayLabels.forEach { label ->
Box(modifier = Modifier.weight(1f), contentAlignment = Alignment.Center) {
Box( Box(
modifier = Modifier modifier = Modifier
.weight(1f) .size(40.dp)
.clip(RoundedCornerShape(100.dp)) .clip(CircleShape)
.background(F7Colors.Grey2) .background(F7Colors.Grey2),
.padding(vertical = 6.dp),
contentAlignment = Alignment.Center, contentAlignment = Alignment.Center,
) { ) {
Text( Text(
text = label, text = label,
style = MaterialTheme.typography.labelMedium, style = MaterialTheme.typography.bodyLarge,
fontWeight = FontWeight.Medium, fontWeight = FontWeight.Medium,
color = F7Colors.TextSecondary, color = F7Colors.TextPrimary,
) )
} }
} }
} }
// Гридлайн-сетка без скруглений (по макету) }
Column(
modifier = Modifier
.fillMaxWidth()
.border(0.5.dp, F7Colors.Grey3),
) {
days.chunked(7).forEach { week -> days.chunked(7).forEach { week ->
Row(modifier = Modifier.fillMaxWidth()) { Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(4.dp),
) {
week.forEach { day -> week.forEach { day ->
val inMonth = day.month == month.month val inMonth = day.month == month.month
val dayEvents = eventsByDay[day].orEmpty() val dayEvents = eventsByDay[day].orEmpty()
@@ -444,7 +449,6 @@ fun CalendarMonthGrid(
} }
} }
} }
}
@Composable @Composable
private fun CalendarDayCell( private fun CalendarDayCell(
@@ -456,45 +460,55 @@ private fun CalendarDayCell(
onClick: () -> Unit, onClick: () -> Unit,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
) { ) {
val cellBg = when { // Живая тема: ячейка — карточка #FDFDFD r4 с тонкой тенью, высота 120, паддинг 4;
isToday -> F7Colors.Green10 // номер дня 14/500 СПРАВА-сверху (чужой месяц — серый); «сегодня» — зелёная плашка
selected -> F7Colors.PrimaryLight // 40×24 r4 с белым числом; выбранный день подсвечиваем #ECF9DE (наша адаптация тапа).
else -> F7Colors.Surface
}
Column( Column(
modifier = modifier modifier = modifier
.heightIn(min = 66.dp) .height(120.dp)
.border(0.5.dp, F7Colors.Grey3) .shadow(
.background(cellBg) elevation = 1.dp,
shape = RoundedCornerShape(4.dp),
spotColor = F7Colors.Border,
)
.clip(RoundedCornerShape(4.dp))
.background(if (selected) F7Colors.PrimaryLight else Color(0xFFFDFDFD))
.clickable(onClick = onClick) .clickable(onClick = onClick)
.padding(horizontal = 4.dp, vertical = 4.dp), .padding(4.dp),
verticalArrangement = Arrangement.spacedBy(2.dp), verticalArrangement = Arrangement.spacedBy(2.dp),
) { ) {
// Номер дня сверху-слева; сегодня — в зелёном круге Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End) {
if (isToday) {
Box( Box(
modifier = Modifier modifier = Modifier
.size(22.dp) .width(40.dp)
.then(if (isToday) Modifier.clip(CircleShape).background(F7Colors.Primary) else Modifier), .height(24.dp)
.clip(RoundedCornerShape(4.dp))
.background(F7Colors.Primary),
contentAlignment = Alignment.Center, contentAlignment = Alignment.Center,
) { ) {
Text( Text(
text = day.toString(), text = day.toString(),
style = MaterialTheme.typography.bodySmall, style = MaterialTheme.typography.bodyMedium,
fontWeight = if (isToday) FontWeight.SemiBold else FontWeight.Normal, fontWeight = FontWeight.Medium,
color = when { color = Color.White,
isToday -> F7Colors.TextOnPrimary
!inMonth -> F7Colors.TextMuted
else -> F7Colors.TextPrimary
},
) )
} }
if (inMonth) { } else {
events.take(2).forEach { event ->
CalendarDayEventPill(event.summary.ifBlank { "Событие" })
}
if (events.size > 2) {
Text( Text(
"+${events.size - 2}", text = day.toString(),
style = MaterialTheme.typography.bodyMedium,
fontWeight = FontWeight.Medium,
color = if (inMonth) F7Colors.TextPrimary else F7Colors.TextSecondary,
)
}
}
events.take(3).forEach { event ->
CalendarDayEventPill(event.summary.ifBlank { "Событие" }, muted = !inMonth)
}
if (events.size > 3) {
Text(
"+${events.size - 3}",
style = MaterialTheme.typography.labelSmall, style = MaterialTheme.typography.labelSmall,
color = F7Colors.Primary, color = F7Colors.Primary,
fontWeight = FontWeight.Medium, fontWeight = FontWeight.Medium,
@@ -502,19 +516,23 @@ private fun CalendarDayCell(
} }
} }
} }
}
@Composable @Composable
private fun CalendarDayEventPill(text: String) { private fun CalendarDayEventPill(text: String, muted: Boolean = false) {
// Живая тема: пилюля события — фон #ECF9DE, рамка #70B62B, r4, текст 10/12;
// вне текущего месяца — серые с белым текстом.
Text( Text(
text = text, text = text,
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.clip(RoundedCornerShape(4.dp)) .clip(RoundedCornerShape(4.dp))
.background(F7Colors.PrimaryLight) .background(if (muted) F7Colors.TextSecondary else F7Colors.PrimaryLight)
.padding(horizontal = 4.dp, vertical = 1.dp), .border(1.dp, if (muted) F7Colors.TextSecondary else F7Colors.Primary, RoundedCornerShape(4.dp))
style = MaterialTheme.typography.labelSmall, .padding(horizontal = 4.dp, vertical = 2.dp),
color = F7Colors.PrimaryDark, fontSize = 10.sp,
lineHeight = 12.sp,
fontWeight = FontWeight.Medium,
color = if (muted) Color.White else F7Colors.TextPrimary,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
) )
@@ -811,12 +829,14 @@ fun CalendarEventRow(
@Composable @Composable
private fun CalendarEventChip(event: CalendarEventItem, onClick: () -> Unit) { private fun CalendarEventChip(event: CalendarEventItem, onClick: () -> Unit) {
// Живая тема: пилюля события — #ECF9DE с рамкой #70B62B, r4, текст 12/16
Text( Text(
event.summary, event.summary,
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.clip(RoundedCornerShape(6.dp)) .clip(RoundedCornerShape(4.dp))
.background(F7Colors.Primary.copy(alpha = 0.15f)) .background(F7Colors.PrimaryLight)
.border(1.dp, F7Colors.Primary, RoundedCornerShape(4.dp))
.clickable(onClick = onClick) .clickable(onClick = onClick)
.padding(horizontal = 6.dp, vertical = 4.dp), .padding(horizontal = 6.dp, vertical = 4.dp),
style = MaterialTheme.typography.labelSmall, style = MaterialTheme.typography.labelSmall,
@@ -1075,7 +1095,13 @@ fun CalendarEventDetailSheet(
.padding(bottom = 28.dp), .padding(bottom = 28.dp),
verticalArrangement = Arrangement.spacedBy(12.dp), verticalArrangement = Arrangement.spacedBy(12.dp),
) { ) {
Text(event.summary, style = MaterialTheme.typography.titleLarge, fontWeight = FontWeight.Bold) // Живая тема: заголовки модалок 18/600
Text(
event.summary,
style = MaterialTheme.typography.titleMedium.copy(fontSize = 18.sp),
fontWeight = FontWeight.SemiBold,
color = F7Colors.TextPrimary,
)
CalendarDetailRow( CalendarDetailRow(
iconUrl = "$base/themes/forbion/images/calendar/event-clock.svg", iconUrl = "$base/themes/forbion/images/calendar/event-clock.svg",
label = "Время", label = "Время",
@@ -0,0 +1,58 @@
package ru.forbion.f7cloud.feature.calendar
import android.content.Context
import java.io.File
import java.security.MessageDigest
/**
* Дисковый кэш «сырых» REPORT-ответов CalDAV (события по диапазону), ключуемый
* CTag'ом календаря: CTag не изменился события читаются с диска, сеть не трогаем.
*
* Храним именно сырой XML (а не сериализованные модели) переиспользуем боевой
* парсер CalDavClient и не заводим хрупкий JSON-маппинг ~20 полей события.
* Формат файла: первая строка CTag на момент загрузки, дальше XML.
*/
class CalendarEventsCache(private val dir: File) {
constructor(context: Context) : this(File(context.cacheDir, "caldav_events"))
/** XML событий, если кэш есть и его CTag совпадает с текущим; иначе null. */
fun get(accountKey: String, calendarHref: String, rangeKey: String, ctag: String): String? {
if (ctag.isBlank()) return null
val f = entryFile(accountKey, calendarHref, rangeKey)
if (!f.isFile) return null
return runCatching {
val text = f.readText()
val nl = text.indexOf('\n')
if (nl > 0 && text.substring(0, nl) == ctag) text.substring(nl + 1) else null
}.getOrNull()
}
fun put(accountKey: String, calendarHref: String, rangeKey: String, ctag: String, xml: String) {
if (ctag.isBlank()) return
runCatching {
dir.mkdirs()
entryFile(accountKey, calendarHref, rangeKey).writeText("$ctag\n$xml")
prune()
}
}
/** Чистка устаревших записей (диапазоны уезжают со временем — файлы копятся). */
private fun prune(maxAgeMillis: Long = MAX_AGE_MILLIS) {
val now = System.currentTimeMillis()
dir.listFiles()?.forEach { f ->
if (now - f.lastModified() > maxAgeMillis) f.delete()
}
}
private fun entryFile(accountKey: String, calendarHref: String, rangeKey: String): File =
File(dir, md5("$accountKey|$calendarHref|$rangeKey") + ".xml")
private fun md5(s: String): String =
MessageDigest.getInstance("MD5").digest(s.toByteArray())
.joinToString("") { "%02x".format(it) }
private companion object {
const val MAX_AGE_MILLIS = 30L * 24 * 3600 * 1000 // 30 дней
}
}
@@ -22,6 +22,8 @@ import java.time.ZoneOffset
class CalendarRepository( class CalendarRepository(
private val apiClient: CalendarApiClient = CalendarApiClient(), private val apiClient: CalendarApiClient = CalendarApiClient(),
// Кэш событий по CTag (null — без кэша, поведение как раньше)
private val eventsCache: CalendarEventsCache? = null,
) { ) {
fun listCalendars(session: AuthSession): List<DavCalendar> = openDavContext(session).calendars fun listCalendars(session: AuthSession): List<DavCalendar> = openDavContext(session).calendars
@@ -38,7 +40,7 @@ class CalendarRepository(
val ctx = openDavContext(session) val ctx = openDavContext(session)
val startInstant = rangeStart.atStartOfDay(ZoneOffset.UTC).toInstant() val startInstant = rangeStart.atStartOfDay(ZoneOffset.UTC).toInstant()
val endInstant = rangeEnd.plusDays(1).atStartOfDay(ZoneOffset.UTC).toInstant() val endInstant = rangeEnd.plusDays(1).atStartOfDay(ZoneOffset.UTC).toInstant()
return fetchEvents(ctx, startInstant, endInstant, visibleHrefs) return fetchEvents(ctx, startInstant, endInstant, visibleHrefs, accountKey(session))
} }
fun loadUnscheduledTasks(session: AuthSession): List<CalendarTaskItem> { fun loadUnscheduledTasks(session: AuthSession): List<CalendarTaskItem> {
@@ -210,13 +212,25 @@ class CalendarRepository(
rangeStart: Instant, rangeStart: Instant,
rangeEnd: Instant, rangeEnd: Instant,
visibleHrefs: Set<String>, visibleHrefs: Set<String>,
accountKey: String,
): List<CalendarEventItem> { ): List<CalendarEventItem> {
val calendars = if (visibleHrefs.isEmpty()) ctx.calendars else ctx.calendars.filter { it.href in visibleHrefs } val calendars = if (visibleHrefs.isEmpty()) ctx.calendars else ctx.calendars.filter { it.href in visibleHrefs }
val rangeKey = "${rangeStart.epochSecond}-${rangeEnd.epochSecond}"
val events = mutableListOf<DavEvent>() val events = mutableListOf<DavEvent>()
var successCount = 0 var successCount = 0
var lastError: String? = null var lastError: String? = null
for (cal in calendars.take(12)) { for (cal in calendars.take(12)) {
runCatching { CalDavClient.queryEventsInRange(ctx.client, cal, rangeStart, rangeEnd) } runCatching {
// CTag календаря не менялся → сырой REPORT-ответ берём с диска, сеть не трогаем
val cachedXml = eventsCache?.get(accountKey, cal.href, rangeKey, cal.ctag)
if (cachedXml != null) {
CalDavClient.parseEventsXml(cachedXml, cal)
} else {
val xml = CalDavClient.queryEventsRawXml(ctx.client, cal, rangeStart, rangeEnd)
eventsCache?.put(accountKey, cal.href, rangeKey, cal.ctag, xml)
CalDavClient.parseEventsXml(xml, cal)
}
}
.onSuccess { successCount++; events += it } .onSuccess { successCount++; events += it }
.onFailure { lastError = it.message } .onFailure { lastError = it.message }
} }
@@ -226,6 +240,9 @@ class CalendarRepository(
return events.distinctBy { it.uid }.sortedBy { it.startEpochMilli }.map { it.toItem() } return events.distinctBy { it.uid }.sortedBy { it.startEpochMilli }.map { it.toItem() }
} }
private fun accountKey(session: AuthSession): String =
"${session.serverUrl}|${session.username}"
private fun DavEvent.toItem() = CalendarEventItem( private fun DavEvent.toItem() = CalendarEventItem(
uid = uid, uid = uid,
href = href, href = href,
@@ -62,7 +62,9 @@ data class CalendarUiState(
class CalendarViewModel( class CalendarViewModel(
context: Context, context: Context,
private val repository: CalendarRepository = CalendarRepository(), private val repository: CalendarRepository = CalendarRepository(
eventsCache = CalendarEventsCache(context.applicationContext),
),
) : ViewModel() { ) : ViewModel() {
private val appContext = context.applicationContext private val appContext = context.applicationContext
private val deviceClient = DeviceCalendarClient(appContext) private val deviceClient = DeviceCalendarClient(appContext)
@@ -0,0 +1,54 @@
package ru.forbion.f7cloud.feature.calendar
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TemporaryFolder
/**
* Кэш «сырых» REPORT-ответов CalDAV: CTag совпал XML с диска; изменился/пусто null.
*/
class CalendarEventsCacheTest {
@get:Rule
val tmp = TemporaryFolder()
private fun cache() = CalendarEventsCache(tmp.newFolder("caldav"))
@Test fun hit_when_ctag_matches() {
val c = cache()
c.put("acc", "/cal/personal/", "r1", "ctag-1", "<xml>events</xml>")
assertEquals("<xml>events</xml>", c.get("acc", "/cal/personal/", "r1", "ctag-1"))
}
@Test fun miss_when_ctag_changed() {
val c = cache()
c.put("acc", "/cal/personal/", "r1", "ctag-1", "<xml/>")
assertNull(c.get("acc", "/cal/personal/", "r1", "ctag-2"))
}
@Test fun miss_on_blank_ctag_and_unknown_range() {
val c = cache()
c.put("acc", "/cal/personal/", "r1", "", "<xml/>") // пустой ctag не кэшируется
assertNull(c.get("acc", "/cal/personal/", "r1", ""))
assertNull(c.get("acc", "/cal/personal/", "other-range", "ctag-1"))
}
@Test fun entries_are_isolated_by_account_calendar_range() {
val c = cache()
c.put("acc1", "/cal/a/", "r1", "t", "<a1/>")
c.put("acc2", "/cal/a/", "r1", "t", "<a2/>")
c.put("acc1", "/cal/b/", "r1", "t", "<b1/>")
assertEquals("<a1/>", c.get("acc1", "/cal/a/", "r1", "t"))
assertEquals("<a2/>", c.get("acc2", "/cal/a/", "r1", "t"))
assertEquals("<b1/>", c.get("acc1", "/cal/b/", "r1", "t"))
}
@Test fun multiline_xml_preserved() {
val c = cache()
val xml = "<multistatus>\n <response>\n <href>/e1.ics</href>\n </response>\n</multistatus>"
c.put("acc", "/cal/", "r", "ct", xml)
assertEquals(xml, c.get("acc", "/cal/", "r", "ct"))
}
}
@@ -74,6 +74,18 @@ class ContactsRepository(context: Context) {
) { ) {
return dao.getAll(key).map { it.toItem() } return dao.getAll(key).map { it.toItem() }
} }
// Дешёвая проверка CTag: если адресные книги не менялись (и бэкфиллы сделаны) —
// полный PROPFIND всех vCard не нужен, отдаём кэш. Это ускоряет pull-to-refresh.
val needsBackfill = needsPhotoBackfill || needsDetailsBackfill
val client = authedClient(session)
val userId = session.davUserId ?: OcsUserResolver.resolveDavUserId(session)
val currentSig = CardDavClient.collectionSignature(client, session.serverUrl, userId)
if (!needsBackfill && currentSig != null &&
currentSig == prefs.getString(ctagKey(key), null)
) {
prefs.edit().putLong(lastSyncKey(key), System.currentTimeMillis()).apply()
return dao.getAll(key).map { it.toItem() }
}
val remote = fetchRemoteContacts(session) val remote = fetchRemoteContacts(session)
val entities = remote.map { contact -> val entities = remote.map { contact ->
ContactEntity( ContactEntity(
@@ -95,11 +107,12 @@ class ContactsRepository(context: Context) {
) )
} }
dao.replaceAll(key, entities) dao.replaceAll(key, entities)
prefs.edit() val editor = prefs.edit()
.putLong(lastSyncKey(key), System.currentTimeMillis()) .putLong(lastSyncKey(key), System.currentTimeMillis())
.putBoolean(photoSyncDoneKey(key), true) .putBoolean(photoSyncDoneKey(key), true)
.putBoolean(detailsSyncDoneKey(key), true) .putBoolean(detailsSyncDoneKey(key), true)
.apply() if (currentSig != null) editor.putString(ctagKey(key), currentSig) else editor.remove(ctagKey(key))
editor.apply()
return entities.map { it.toItem() } return entities.map { it.toItem() }
} }
@@ -190,6 +203,8 @@ class ContactsRepository(context: Context) {
private fun lastSyncKey(accountKey: String) = "last_sync_$accountKey" private fun lastSyncKey(accountKey: String) = "last_sync_$accountKey"
private fun ctagKey(accountKey: String) = "ctag_$accountKey"
private fun photoSyncDoneKey(accountKey: String) = "photo_sync_done_$accountKey" private fun photoSyncDoneKey(accountKey: String) = "photo_sync_done_$accountKey"
private fun detailsSyncDoneKey(accountKey: String) = "details_sync_done_$accountKey" private fun detailsSyncDoneKey(accountKey: String) = "details_sync_done_$accountKey"
@@ -21,6 +21,8 @@ import androidx.compose.foundation.text.BasicTextField
import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.pulltorefresh.PullToRefreshBox
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect
@@ -51,6 +53,7 @@ import ru.forbion.f7cloud.core.designsystem.F7Colors
import ru.forbion.f7cloud.core.designsystem.F7CreateButton import ru.forbion.f7cloud.core.designsystem.F7CreateButton
import ru.forbion.f7cloud.core.designsystem.F7ModuleScreen import ru.forbion.f7cloud.core.designsystem.F7ModuleScreen
@OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
fun ContactsScreen( fun ContactsScreen(
session: AuthSession, session: AuthSession,
@@ -76,6 +79,7 @@ fun ContactsScreen(
modifier = modifier, modifier = modifier,
loading = state.loading && state.contacts.isEmpty(), loading = state.loading && state.contacts.isEmpty(),
error = state.error, error = state.error,
onErrorRetry = { vm.refresh(session, force = true) },
) { ) {
// Поиск + кнопка создания контакта (создание раньше вызывалось из нижней // Поиск + кнопка создания контакта (создание раньше вызывалось из нижней
// панели, теперь — из шапки, панель стала навигационной) // панели, теперь — из шапки, панель стала навигационной)
@@ -94,14 +98,13 @@ fun ContactsScreen(
) )
F7CreateButton(onClick = vm::openAddSheet, size = 40.dp) F7CreateButton(onClick = vm::openAddSheet, size = 40.dp)
} }
if (state.syncing && state.contacts.isNotEmpty()) { PullToRefreshBox(
Text( isRefreshing = state.syncing && state.contacts.isNotEmpty(),
"Обновление…", onRefresh = { vm.refresh(session, force = true) },
modifier = Modifier.padding(horizontal = 4.dp, vertical = 2.dp), modifier = Modifier
style = MaterialTheme.typography.labelSmall, .weight(1f)
color = F7Colors.TextSecondary, .fillMaxWidth(),
) ) {
}
LazyColumn(modifier = Modifier.fillMaxSize()) { LazyColumn(modifier = Modifier.fillMaxSize()) {
items(state.filteredContacts, key = { "${it.uid}|${it.email}" }) { contact -> items(state.filteredContacts, key = { "${it.uid}|${it.email}" }) { contact ->
ContactListRow( ContactListRow(
@@ -112,6 +115,7 @@ fun ContactsScreen(
} }
} }
} }
}
state.selectedContact?.let { contact -> state.selectedContact?.let { contact ->
ContactDetailSheet( ContactDetailSheet(
@@ -277,17 +281,19 @@ fun ContactListRow(
} }
} }
Column(modifier = Modifier.weight(1f)) { Column(modifier = Modifier.weight(1f)) {
// Живая тема: имя 16/500, детали 14/500 серым
Text( Text(
contact.displayName.ifBlank { contact.email }, contact.displayName.ifBlank { contact.email },
style = MaterialTheme.typography.bodyLarge, style = MaterialTheme.typography.bodyLarge,
fontWeight = FontWeight.SemiBold, fontWeight = FontWeight.Medium,
color = F7Colors.TextPrimary,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
) )
if (contact.email.isNotBlank() && contact.displayName.isNotBlank()) { if (contact.email.isNotBlank() && contact.displayName.isNotBlank()) {
Text( Text(
contact.email, contact.email,
style = MaterialTheme.typography.bodySmall, style = MaterialTheme.typography.bodyMedium,
color = F7Colors.TextSecondary, color = F7Colors.TextSecondary,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
@@ -295,7 +301,7 @@ fun ContactListRow(
} else if (contact.phone.isNotBlank()) { } else if (contact.phone.isNotBlank()) {
Text( Text(
contact.phone, contact.phone,
style = MaterialTheme.typography.bodySmall, style = MaterialTheme.typography.bodyMedium,
color = F7Colors.TextSecondary, color = F7Colors.TextSecondary,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
@@ -99,14 +99,16 @@ class ContactsViewModel(
} }
} }
fun refresh(session: AuthSession, showLoading: Boolean = false) { fun refresh(session: AuthSession, showLoading: Boolean = false, force: Boolean = false) {
viewModelScope.launch(Dispatchers.IO) { viewModelScope.launch(Dispatchers.IO) {
if (showLoading && _state.value.contacts.isEmpty()) { if (showLoading && _state.value.contacts.isEmpty()) {
_state.update { it.copy(loading = true, error = null) } _state.update { it.copy(loading = true, error = null) }
} else { } else {
_state.update { it.copy(syncing = true, error = null) } _state.update { it.copy(syncing = true, error = null) }
} }
runCatching { repository.syncContacts(session) } // force (pull-to-refresh) с CTag-проверкой дешёвый: 1 лёгкий PROPFIND,
// полная закачка vCard — только если адресные книги реально менялись
runCatching { repository.syncContacts(session, force = force) }
.onFailure { t -> .onFailure { t ->
_state.update { _state.update {
it.copy( it.copy(
@@ -0,0 +1,260 @@
package ru.forbion.f7cloud.feature.deck
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Checkbox
import androidx.compose.material3.CheckboxDefaults
import androidx.compose.material3.DatePicker
import androidx.compose.material3.DatePickerDialog
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.rememberDatePickerState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties
import ru.forbion.f7cloud.core.designsystem.F7Colors
import ru.forbion.f7cloud.core.designsystem.F7OutlinedField
import ru.forbion.f7cloud.core.designsystem.F7PrimaryButton
import ru.forbion.f7cloud.core.designsystem.F7SecondaryButton
import java.time.Instant
import java.time.ZoneId
import java.time.format.DateTimeFormatter
@OptIn(ExperimentalMaterial3Api::class, ExperimentalLayoutApi::class)
@Composable
fun DeckCardSheet(
card: DeckCard,
boardLabels: List<DeckLabel>,
stacks: List<DeckStack>,
canEdit: Boolean,
busy: Boolean,
onDismiss: () -> Unit,
onToggleDone: () -> Unit,
onSave: (title: String, description: String, duedate: String?) -> Unit,
onToggleLabel: (DeckLabel) -> Unit,
onMove: (targetStackId: Int) -> Unit,
onArchive: () -> Unit,
onDelete: () -> Unit,
) {
var title by remember(card.id) { mutableStateOf(card.title) }
var description by remember(card.id) { mutableStateOf(card.description) }
// duedate храним как ISO-строку (как отдаёт/принимает Deck), null = без срока
var duedate by remember(card.id) { mutableStateOf(card.duedate) }
var datePickerOpen by remember { mutableStateOf(false) }
Dialog(onDismissRequest = onDismiss, properties = DialogProperties(usePlatformDefaultWidth = false)) {
Surface(
modifier = Modifier.fillMaxWidth(0.96f).heightIn(max = 680.dp),
shape = RoundedCornerShape(16.dp),
color = Color.White,
) {
Column(
modifier = Modifier.verticalScroll(rememberScrollState()).padding(16.dp),
verticalArrangement = Arrangement.spacedBy(12.dp),
) {
// Done + заголовок
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
Checkbox(
checked = card.done,
onCheckedChange = { if (canEdit) onToggleDone() },
enabled = canEdit && !busy,
colors = CheckboxDefaults.colors(checkedColor = F7Colors.Primary),
)
Text(
if (card.done) "Выполнена" else "Не выполнена",
style = MaterialTheme.typography.bodyMedium,
color = F7Colors.TextSecondary,
)
}
F7OutlinedField(value = title, onValueChange = { title = it }, label = "Название")
F7OutlinedField(value = description, onValueChange = { description = it }, label = "Описание", minLines = 3)
// Срок
Text("Срок", style = MaterialTheme.typography.bodyMedium, color = F7Colors.TextSecondary)
Row(
modifier = Modifier
.fillMaxWidth()
.heightIn(min = 36.dp)
.clip(RoundedCornerShape(10.dp))
.background(F7Colors.SurfaceMuted)
.clickable(enabled = canEdit) { datePickerOpen = true }
.padding(horizontal = 10.dp, vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Text(
duedate?.let { formatDeckDue(it) } ?: "Без срока",
modifier = Modifier.weight(1f),
style = MaterialTheme.typography.bodyMedium,
color = if (duedate != null) F7Colors.TextPrimary else F7Colors.TextSecondary,
)
if (duedate != null) {
Text("Сбросить", color = F7Colors.Primary, style = MaterialTheme.typography.bodyMedium, modifier = Modifier.clickable { duedate = null })
}
}
// Метки доски
if (boardLabels.isNotEmpty()) {
Text("Метки", style = MaterialTheme.typography.bodyMedium, color = F7Colors.TextSecondary)
FlowRow(horizontalArrangement = Arrangement.spacedBy(6.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
boardLabels.forEach { label ->
val active = card.labels.any { it.id == label.id }
Box(
modifier = Modifier
.clip(RoundedCornerShape(4.dp))
.background(
(parseDeckColor(label.color) ?: F7Colors.Primary)
.copy(alpha = if (active) 0.35f else 0.12f),
)
.border(
if (active) 2.dp else 1.dp,
parseDeckColor(label.color) ?: F7Colors.Primary,
RoundedCornerShape(4.dp),
)
.clickable(enabled = canEdit && !busy) { onToggleLabel(label) }
.padding(horizontal = 8.dp, vertical = 3.dp),
) {
Text(label.title, style = MaterialTheme.typography.labelMedium, color = F7Colors.TextPrimary)
}
}
}
}
// Переместить в колонку
if (canEdit && stacks.size > 1) {
Text("Колонка", style = MaterialTheme.typography.bodyMedium, color = F7Colors.TextSecondary)
FlowRow(horizontalArrangement = Arrangement.spacedBy(6.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
stacks.forEach { stack ->
val current = stack.id == card.stackId
Box(
modifier = Modifier
.clip(RoundedCornerShape(100.dp))
.background(if (current) F7Colors.PrimaryLight else F7Colors.SurfaceMuted)
.clickable(enabled = !current && !busy) { onMove(stack.id) }
.padding(horizontal = 10.dp, vertical = 4.dp),
) {
Text(stack.title, style = MaterialTheme.typography.bodyMedium, color = F7Colors.TextPrimary)
}
}
}
}
if (canEdit) {
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
F7SecondaryButton("Закрыть", onClick = onDismiss, modifier = Modifier.weight(1f))
F7PrimaryButton(
text = if (busy) "" else "Сохранить",
onClick = { onSave(title, description, duedate) },
enabled = !busy && title.isNotBlank(),
modifier = Modifier.weight(1f),
)
}
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
F7SecondaryButton("В архив", onClick = onArchive, enabled = !busy, modifier = Modifier.weight(1f))
F7SecondaryButton("Удалить", onClick = onDelete, enabled = !busy, modifier = Modifier.weight(1f))
}
} else {
F7SecondaryButton("Закрыть", onClick = onDismiss, modifier = Modifier.fillMaxWidth())
}
}
}
}
if (datePickerOpen) {
val initMillis = duedate?.let { parseDeckDueMillis(it) }
?: System.currentTimeMillis()
val pickerState = rememberDatePickerState(initialSelectedDateMillis = initMillis)
DatePickerDialog(
onDismissRequest = { datePickerOpen = false },
confirmButton = {
TextButton(onClick = {
pickerState.selectedDateMillis?.let { millis ->
// Deck принимает ISO-8601 (в полдень UTC достаточно для «дня»)
val instant = Instant.ofEpochMilli(millis)
duedate = DateTimeFormatter.ISO_INSTANT.format(instant)
}
datePickerOpen = false
}) { Text("ОК", color = F7Colors.Primary) }
},
dismissButton = {
TextButton(onClick = { datePickerOpen = false }) { Text("Отмена", color = F7Colors.TextSecondary) }
},
) { DatePicker(state = pickerState) }
}
}
@Composable
fun DeckTextPromptDialog(
title: String,
label: String,
confirmText: String,
onConfirm: (String) -> Unit,
onDismiss: () -> Unit,
) {
var text by remember { mutableStateOf("") }
Dialog(onDismissRequest = onDismiss) {
Surface(shape = RoundedCornerShape(16.dp), color = Color.White) {
Column(modifier = Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(12.dp)) {
Text(
title,
style = MaterialTheme.typography.titleMedium.copy(fontSize = 18.sp),
fontWeight = FontWeight.SemiBold,
color = F7Colors.TextPrimary,
)
F7OutlinedField(value = text, onValueChange = { text = it }, label = label)
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
F7SecondaryButton("Отмена", onClick = onDismiss, modifier = Modifier.weight(1f))
F7PrimaryButton(
text = confirmText,
onClick = { onConfirm(text) },
enabled = text.isNotBlank(),
modifier = Modifier.weight(1f),
)
}
}
}
}
}
/** Парсит ISO-строку срока Deck в миллисекунды (для инициализации пикера). */
internal fun parseDeckDueMillis(iso: String): Long? = runCatching {
Instant.parse(iso).toEpochMilli()
}.getOrElse {
runCatching {
java.time.OffsetDateTime.parse(iso).toInstant().toEpochMilli()
}.getOrNull()
}
/** Отображение срока: «12 мар». */
internal fun formatDeckDue(iso: String): String {
val millis = parseDeckDueMillis(iso) ?: return iso.take(10)
val date = Instant.ofEpochMilli(millis).atZone(ZoneId.systemDefault()).toLocalDate()
return date.format(DateTimeFormatter.ofPattern("d MMM"))
}
@@ -1,91 +1,219 @@
package ru.forbion.f7cloud.feature.deck package ru.forbion.f7cloud.feature.deck
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import okhttp3.Request import okhttp3.Request
import okhttp3.RequestBody.Companion.toRequestBody
import org.json.JSONArray import org.json.JSONArray
import org.json.JSONObject import org.json.JSONObject
import ru.forbion.f7cloud.core.auth.AuthSession import ru.forbion.f7cloud.core.auth.AuthSession
import ru.forbion.f7cloud.core.network.NetworkFactory import ru.forbion.f7cloud.core.network.NetworkFactory
import ru.forbion.f7cloud.core.network.UnauthorizedException
/**
* Deck через внутренний фронт-API (`/index.php/apps/deck/api/v1.0`) тот же, что у веб-версии.
* Пишущие запросы авторизуются app-password + OCS-APIRequest (CSRF при app-password не требуется).
*/
class DeckRepository { class DeckRepository {
private fun apiBase(session: AuthSession): String { private fun apiBase(session: AuthSession): String =
return "${session.serverUrl.trimEnd('/')}/index.php/apps/deck/api/v1.0" "${session.serverUrl.trimEnd('/')}/index.php/apps/deck/api/v1.0"
}
private fun client(session: AuthSession): OkHttpClient =
NetworkFactory.newAuthedClient(session.username, session.appPassword, session.trustAllCerts)
// --- Чтение ---
suspend fun loadBoards(session: AuthSession): List<DeckBoard> { suspend fun loadBoards(session: AuthSession): List<DeckBoard> {
val client = NetworkFactory.newAuthedClient(session.username, session.appPassword, session.trustAllCerts) val json = getJson(client(session), "${apiBase(session)}/boards")
val json = getJson(client, "${apiBase(session)}/boards") val array = json as? JSONArray ?: (json as? JSONObject)?.let { JSONArray().put(it) } ?: JSONArray()
val array = when (json) {
is JSONArray -> json
is JSONObject -> JSONArray().put(json)
else -> JSONArray()
}
val out = mutableListOf<DeckBoard>() val out = mutableListOf<DeckBoard>()
for (i in 0 until array.length()) { for (i in 0 until array.length()) {
val board = array.optJSONObject(i) ?: continue val board = array.optJSONObject(i) ?: continue
val id = board.optInt("id", 0) val id = board.optInt("id", 0)
val title = board.optString("title") if (id > 0 && !board.optBoolean("archived", false)) {
if (id > 0 && title.isNotBlank()) { out += DeckBoard(
out += DeckBoard(id = id, title = title, color = board.optString("color")) id = id,
title = board.optString("title"),
color = board.optString("color"),
canEdit = board.optJSONObject("permissions")?.optBoolean("PERMISSION_EDIT", true) ?: true,
)
} }
} }
return out return out
} }
suspend fun loadCard(session: AuthSession, cardId: Int): DeckCardDetail { suspend fun loadCard(session: AuthSession, cardId: Int): DeckCardDetail {
val client = NetworkFactory.newAuthedClient(session.username, session.appPassword, session.trustAllCerts) val json = getJson(client(session), "${apiBase(session)}/cards/$cardId") as JSONObject
val json = getJson(client, "${apiBase(session)}/cards/$cardId") as JSONObject
val boardId = json.optInt("boardId", json.optInt("board_id", 0)) val boardId = json.optInt("boardId", json.optInt("board_id", 0))
if (boardId <= 0) error("Карточка не найдена") if (boardId <= 0) error("Карточка не найдена")
return DeckCardDetail( return DeckCardDetail(cardId = cardId, boardId = boardId, title = json.optString("title"))
cardId = cardId,
boardId = boardId,
title = json.optString("title"),
)
} }
suspend fun loadBoardDetail(session: AuthSession, boardId: Int): DeckBoardDetail { suspend fun loadBoardDetail(session: AuthSession, boardId: Int): DeckBoardDetail {
val client = NetworkFactory.newAuthedClient(session.username, session.appPassword, session.trustAllCerts) val c = client(session)
val stacksJson = getJson(client, "${apiBase(session)}/boards/$boardId/stacks") val board = getJson(c, "${apiBase(session)}/boards/$boardId") as JSONObject
val stacksArray = when (stacksJson) { val labels = parseLabels(board.optJSONArray("labels"))
is JSONArray -> stacksJson val canEdit = board.optJSONObject("permissions")?.optBoolean("PERMISSION_EDIT", true) ?: true
else -> JSONArray() val stacksJson = getJson(c, "${apiBase(session)}/boards/$boardId/stacks") as? JSONArray ?: JSONArray()
}
val stacks = mutableListOf<DeckStack>() val stacks = mutableListOf<DeckStack>()
for (i in 0 until stacksArray.length()) { for (i in 0 until stacksJson.length()) {
val stack = stacksArray.optJSONObject(i) ?: continue val stack = stacksJson.optJSONObject(i) ?: continue
val stackId = stack.optInt("id", 0) val stackId = stack.optInt("id", 0)
val title = stack.optString("title") if (stackId <= 0) continue
val cards = mutableListOf<DeckCard>()
val cardsArray = stack.optJSONArray("cards") ?: JSONArray() val cardsArray = stack.optJSONArray("cards") ?: JSONArray()
for (c in 0 until cardsArray.length()) { val cards = mutableListOf<DeckCard>()
val card = cardsArray.optJSONObject(c) ?: continue for (cIdx in 0 until cardsArray.length()) {
val cardTitle = card.optString("title") cardsArray.optJSONObject(cIdx)?.let { cards += parseCard(it, stackId) }
if (cardTitle.isNotBlank()) { }
cards += DeckCard( stacks += DeckStack(
id = card.optInt("id", 0), id = stackId,
title = cardTitle, boardId = boardId,
done = card.has("done") && !card.isNull("done"), title = stack.optString("title").ifBlank { "Колонка" },
order = stack.optInt("order", i),
cards = cards.sortedBy { it.order },
) )
} }
} return DeckBoardDetail(
if (stackId > 0) { boardId = boardId,
stacks += DeckStack(id = stackId, title = title.ifBlank { "Stack" }, cards = cards) title = board.optString("title"),
} canEdit = canEdit,
} labels = labels,
return DeckBoardDetail(boardId = boardId, stacks = stacks) stacks = stacks.sortedBy { it.order },
)
} }
private fun getJson(client: okhttp3.OkHttpClient, url: String): Any { private fun parseCard(card: JSONObject, stackId: Int): DeckCard = DeckCard(
val request = Request.Builder().url(url).build() id = card.optInt("id", 0),
client.newCall(request).execute().use { response -> title = card.optString("title"),
if (!response.isSuccessful || response.body == null) { done = !card.isNull("done") && card.optString("done").isNotBlank(),
error("Deck API HTTP ${response.code}") description = card.optString("description"),
duedate = card.optString("duedate").takeIf { it.isNotBlank() && it != "null" },
order = card.optInt("order", 0),
stackId = stackId,
labels = parseLabels(card.optJSONArray("labels")),
assignees = parseAssignees(card.optJSONArray("assignedUsers")),
)
private fun parseLabels(array: JSONArray?): List<DeckLabel> {
if (array == null) return emptyList()
val out = mutableListOf<DeckLabel>()
for (i in 0 until array.length()) {
val l = array.optJSONObject(i) ?: continue
val id = l.optInt("id", 0)
if (id > 0) out += DeckLabel(id = id, title = l.optString("title"), color = l.optString("color"))
} }
return out
}
private fun parseAssignees(array: JSONArray?): List<String> {
if (array == null) return emptyList()
val out = mutableListOf<String>()
for (i in 0 until array.length()) {
val a = array.optJSONObject(i) ?: continue
val p = a.optJSONObject("participant")
val name = p?.optString("displayname")?.takeIf { it.isNotBlank() }
?: p?.optString("uid")?.takeIf { it.isNotBlank() }
?: a.optString("displayname")
if (name.isNotBlank()) out += name
}
return out
}
// --- Запись ---
fun createCard(session: AuthSession, stackId: Int, title: String): DeckCard {
val body = JSONObject().put("title", title).put("type", "plain").put("order", 999).put("stackId", stackId)
val json = sendJson(session, "POST", "${apiBase(session)}/cards", body) as? JSONObject
return json?.let { parseCard(it, stackId) }
?: DeckCard(id = 0, title = title, done = false, stackId = stackId)
}
fun updateCard(
session: AuthSession,
card: DeckCard,
title: String,
description: String,
duedate: String?,
) {
val body = JSONObject()
.put("title", title)
.put("type", "plain")
.put("owner", session.username)
.put("description", description)
.put("order", card.order)
.put("stackId", card.stackId)
.put("duedate", duedate ?: JSONObject.NULL)
sendJson(session, "PUT", "${apiBase(session)}/cards/${card.id}", body)
}
fun setCardDone(session: AuthSession, cardId: Int, done: Boolean) {
val path = if (done) "done" else "undone"
sendJson(session, "PUT", "${apiBase(session)}/cards/$cardId/$path", JSONObject())
}
fun moveCard(session: AuthSession, cardId: Int, targetStackId: Int, order: Int = 0) {
val body = JSONObject().put("stackId", targetStackId).put("order", order)
sendJson(session, "PUT", "${apiBase(session)}/cards/$cardId/reorder", body)
}
fun archiveCard(session: AuthSession, cardId: Int) {
sendJson(session, "PUT", "${apiBase(session)}/cards/$cardId/archive", JSONObject())
}
fun deleteCard(session: AuthSession, cardId: Int) {
sendJson(session, "DELETE", "${apiBase(session)}/cards/$cardId", null)
}
fun assignLabel(session: AuthSession, cardId: Int, labelId: Int) {
sendJson(session, "POST", "${apiBase(session)}/cards/$cardId/label/$labelId", JSONObject())
}
fun removeLabel(session: AuthSession, cardId: Int, labelId: Int) {
sendJson(session, "DELETE", "${apiBase(session)}/cards/$cardId/label/$labelId", null)
}
fun createStack(session: AuthSession, boardId: Int, title: String): DeckStack {
val body = JSONObject().put("title", title).put("boardId", boardId).put("order", 999)
val json = sendJson(session, "POST", "${apiBase(session)}/stacks", body) as? JSONObject
val id = json?.optInt("id", 0) ?: 0
return DeckStack(id = id, boardId = boardId, title = title, order = 999, cards = emptyList())
}
// --- HTTP ---
private fun getJson(client: OkHttpClient, url: String): Any {
val request = Request.Builder().url(url).header("OCS-APIRequest", "true").build()
client.newCall(request).execute().use { response ->
if (!response.isSuccessful || response.body == null) error("Deck API HTTP ${response.code}")
val body = response.body!!.string().trim() val body = response.body!!.string().trim()
if (body.startsWith("[")) return JSONArray(body) return when {
if (body.startsWith("{")) return JSONObject(body) body.startsWith("[") -> JSONArray(body)
return JSONArray() body.startsWith("{") -> JSONObject(body)
else -> JSONArray()
}
}
}
private val jsonMedia = "application/json".toMediaType()
private fun sendJson(session: AuthSession, method: String, url: String, body: JSONObject?): Any? {
val payload = (body?.toString() ?: "{}").toRequestBody(jsonMedia)
val builder = Request.Builder()
.url(url)
.header("OCS-APIRequest", "true")
.header("Accept", "application/json")
when (method) {
"POST" -> builder.post(payload)
"PUT" -> builder.put(payload)
"DELETE" -> if (body != null) builder.delete(payload) else builder.delete()
}
client(session).newCall(builder.build()).execute().use { response ->
if (!response.isSuccessful) error("Deck API HTTP ${response.code}")
val text = response.body?.string()?.trim().orEmpty()
return when {
text.startsWith("{") -> JSONObject(text)
text.startsWith("[") -> JSONArray(text)
else -> null
}
} }
} }
} }
@@ -94,11 +222,20 @@ data class DeckBoard(
val id: Int, val id: Int,
val title: String, val title: String,
val color: String, val color: String,
val canEdit: Boolean = true,
)
data class DeckLabel(
val id: Int,
val title: String,
val color: String,
) )
data class DeckStack( data class DeckStack(
val id: Int, val id: Int,
val boardId: Int,
val title: String, val title: String,
val order: Int,
val cards: List<DeckCard>, val cards: List<DeckCard>,
) )
@@ -106,10 +243,19 @@ data class DeckCard(
val id: Int, val id: Int,
val title: String, val title: String,
val done: Boolean, val done: Boolean,
val description: String = "",
val duedate: String? = null,
val order: Int = 0,
val stackId: Int = 0,
val labels: List<DeckLabel> = emptyList(),
val assignees: List<String> = emptyList(),
) )
data class DeckBoardDetail( data class DeckBoardDetail(
val boardId: Int, val boardId: Int,
val title: String,
val canEdit: Boolean,
val labels: List<DeckLabel>,
val stacks: List<DeckStack>, val stacks: List<DeckStack>,
) )
@@ -1,22 +1,55 @@
package ru.forbion.f7cloud.feature.deck package ru.forbion.f7cloud.feature.deck
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.pulltorefresh.PullToRefreshBox
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel import androidx.lifecycle.viewmodel.compose.viewModel
import ru.forbion.f7cloud.core.auth.AuthSession import ru.forbion.f7cloud.core.auth.AuthSession
import ru.forbion.f7cloud.core.designsystem.F7ListCard import ru.forbion.f7cloud.core.designsystem.F7Colors
import ru.forbion.f7cloud.core.designsystem.F7ModuleScreen import ru.forbion.f7cloud.core.designsystem.F7ModuleScreen
import ru.forbion.f7cloud.core.designsystem.F7OverlayDismissHandler import ru.forbion.f7cloud.core.designsystem.F7OverlayDismissHandler
import ru.forbion.f7cloud.core.designsystem.F7SecondaryButton import ru.forbion.f7cloud.core.designsystem.F7SecondaryButton
@OptIn(ExperimentalMaterial3Api::class, ExperimentalLayoutApi::class)
@Composable @Composable
fun DeckScreen( fun DeckScreen(
session: AuthSession, session: AuthSession,
@@ -27,23 +60,18 @@ fun DeckScreen(
) { ) {
val vm: DeckViewModel = viewModel() val vm: DeckViewModel = viewModel()
val state by vm.state.collectAsState() val state by vm.state.collectAsState()
var addStackOpen by remember { mutableStateOf(false) }
var addCardStackId by remember { mutableStateOf<Int?>(null) }
LaunchedEffect(session.serverUrl, session.username) { LaunchedEffect(session.serverUrl, session.username) { vm.load(session) }
vm.load(session)
}
LaunchedEffect(openCardId) { LaunchedEffect(openCardId) {
val cardId = openCardId ?: return@LaunchedEffect val cardId = openCardId ?: return@LaunchedEffect
vm.openCardById(session, cardId) vm.openCardById(session, cardId)
onOpenCardConsumed() onOpenCardConsumed()
} }
LaunchedEffect(state.unauthorized) { LaunchedEffect(state.unauthorized) { if (state.unauthorized) onUnauthorized() }
if (state.unauthorized) onUnauthorized()
}
F7OverlayDismissHandler( F7OverlayDismissHandler(enabled = state.boardDetail != null, onDismiss = vm::closeBoard)
enabled = state.boardDetail != null,
onDismiss = vm::closeBoard,
)
F7ModuleScreen( F7ModuleScreen(
modifier = modifier, modifier = modifier,
@@ -51,32 +79,256 @@ fun DeckScreen(
error = state.error, error = state.error,
onRefresh = { vm.load(session) }, onRefresh = { vm.load(session) },
headerActions = { headerActions = {
if (state.selectedBoardId != null) { val detail = state.boardDetail
if (detail != null) {
if (detail.canEdit) {
F7SecondaryButton(text = "+ Колонка", onClick = { addStackOpen = true })
Spacer(Modifier.size(8.dp))
}
F7SecondaryButton(text = "Назад", onClick = { vm.closeBoard() }) F7SecondaryButton(text = "Назад", onClick = { vm.closeBoard() })
} }
}, },
) { ) {
val detail = state.boardDetail val detail = state.boardDetail
PullToRefreshBox(
isRefreshing = state.loading && (state.boards.isNotEmpty() || detail != null),
onRefresh = {
if (detail != null) vm.openBoard(session, detail.boardId) else vm.load(session)
},
modifier = Modifier.weight(1f).fillMaxWidth(),
) {
if (detail != null) { if (detail != null) {
LazyColumn(modifier = Modifier.fillMaxSize()) { LazyColumn(
modifier = Modifier.fillMaxSize(),
contentPadding = androidx.compose.foundation.layout.PaddingValues(bottom = 24.dp),
verticalArrangement = Arrangement.spacedBy(12.dp),
) {
items(detail.stacks, key = { it.id }) { stack -> items(detail.stacks, key = { it.id }) { stack ->
F7ListCard { DeckStackSection(
Text(stack.title, style = MaterialTheme.typography.titleSmall) stack = stack,
stack.cards.forEach { card -> canEdit = detail.canEdit,
val prefix = if (card.done) "" else "" onCardClick = { vm.openCard(it) },
Text(prefix + card.title, style = MaterialTheme.typography.bodyMedium) onToggleDone = { vm.toggleDone(session, it) },
} onAddCard = { addCardStackId = stack.id },
} )
} }
} }
} else { } else {
LazyColumn(modifier = Modifier.fillMaxSize()) { LazyColumn(
modifier = Modifier.fillMaxSize(),
contentPadding = androidx.compose.foundation.layout.PaddingValues(vertical = 8.dp),
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
items(state.boards, key = { it.id }) { board -> items(state.boards, key = { it.id }) { board ->
F7ListCard(onClick = { vm.openBoard(session, board.id) }) { DeckBoardRow(board = board, onClick = { vm.openBoard(session, board.id) })
Text(board.title, style = MaterialTheme.typography.titleSmall)
} }
} }
} }
} }
} }
// Карточка-деталь
state.openedCard?.let { card ->
DeckCardSheet(
card = card,
boardLabels = state.boardDetail?.labels.orEmpty(),
stacks = state.boardDetail?.stacks.orEmpty(),
canEdit = state.boardDetail?.canEdit ?: false,
busy = state.busy,
onDismiss = vm::closeCard,
onToggleDone = { vm.toggleDone(session, card) },
onSave = { title, desc, due -> vm.updateCard(session, card, title, desc, due) },
onToggleLabel = { vm.toggleLabel(session, card, it) },
onMove = { vm.moveCard(session, card, it) },
onArchive = { vm.archiveCard(session, card) },
onDelete = { vm.deleteCard(session, card) },
)
}
if (addStackOpen) {
DeckTextPromptDialog(
title = "Новая колонка",
label = "Название колонки",
confirmText = "Создать",
onConfirm = { vm.createStack(session, it); addStackOpen = false },
onDismiss = { addStackOpen = false },
)
}
addCardStackId?.let { stackId ->
DeckTextPromptDialog(
title = "Новая карточка",
label = "Название карточки",
confirmText = "Создать",
onConfirm = { vm.createCard(session, stackId, it); addCardStackId = null },
onDismiss = { addCardStackId = null },
)
}
}
@Composable
private fun DeckBoardRow(board: DeckBoard, onClick: () -> Unit) {
Row(
modifier = Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(8.dp))
.background(Color(0xFFFDFDFD))
.border(1.dp, Color(0xFFF0F1F4), RoundedCornerShape(8.dp))
.clickable(onClick = onClick)
.padding(horizontal = 12.dp, vertical = 14.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(10.dp),
) {
Box(
modifier = Modifier
.size(12.dp)
.clip(CircleShape)
.background(parseDeckColor(board.color) ?: F7Colors.Primary),
)
Text(
board.title,
modifier = Modifier.weight(1f),
style = MaterialTheme.typography.bodyLarge,
fontWeight = FontWeight.Medium,
color = F7Colors.TextPrimary,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
}
}
@OptIn(ExperimentalLayoutApi::class)
@Composable
private fun DeckStackSection(
stack: DeckStack,
canEdit: Boolean,
onCardClick: (DeckCard) -> Unit,
onToggleDone: (DeckCard) -> Unit,
onAddCard: () -> Unit,
) {
Column(
modifier = Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(8.dp))
.background(F7Colors.Grey2)
.padding(8.dp),
verticalArrangement = Arrangement.spacedBy(6.dp),
) {
Row(verticalAlignment = Alignment.CenterVertically) {
Text(
stack.title,
modifier = Modifier.weight(1f),
style = MaterialTheme.typography.titleSmall,
fontWeight = FontWeight.SemiBold,
color = F7Colors.TextPrimary,
)
Text(
stack.cards.size.toString(),
style = MaterialTheme.typography.bodyMedium,
color = F7Colors.TextSecondary,
)
if (canEdit) {
Spacer(Modifier.size(8.dp))
Box(
modifier = Modifier
.size(28.dp)
.clip(CircleShape)
.background(F7Colors.PrimaryLight)
.clickable(onClick = onAddCard),
contentAlignment = Alignment.Center,
) {
Icon(Icons.Filled.Add, contentDescription = "Добавить карточку", tint = F7Colors.Primary, modifier = Modifier.size(18.dp))
}
}
}
stack.cards.forEach { card ->
DeckCardRow(card = card, onClick = { onCardClick(card) }, onToggleDone = { onToggleDone(card) })
}
if (stack.cards.isEmpty()) {
Text("Нет карточек", style = MaterialTheme.typography.bodyMedium, color = F7Colors.TextSecondary)
}
}
}
@OptIn(ExperimentalLayoutApi::class)
@Composable
private fun DeckCardRow(card: DeckCard, onClick: () -> Unit, onToggleDone: () -> Unit) {
Column(
modifier = Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(8.dp))
.background(Color(0xFFFDFDFD))
.border(1.dp, F7Colors.Border, RoundedCornerShape(8.dp))
.clickable(onClick = onClick)
.padding(10.dp),
verticalArrangement = Arrangement.spacedBy(4.dp),
) {
if (card.labels.isNotEmpty()) {
FlowRow(horizontalArrangement = Arrangement.spacedBy(4.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) {
card.labels.forEach { DeckLabelChip(it) }
}
}
Row(verticalAlignment = Alignment.CenterVertically) {
Box(
modifier = Modifier
.size(20.dp)
.clip(RoundedCornerShape(4.dp))
.border(1.5.dp, if (card.done) F7Colors.Primary else F7Colors.Grey1, RoundedCornerShape(4.dp))
.background(if (card.done) F7Colors.Primary else Color.Transparent)
.clickable(onClick = onToggleDone),
contentAlignment = Alignment.Center,
) {
if (card.done) Text("", color = Color.White, style = MaterialTheme.typography.labelSmall)
}
Spacer(Modifier.size(8.dp))
Text(
card.title,
modifier = Modifier.weight(1f),
style = MaterialTheme.typography.bodyMedium,
color = F7Colors.TextPrimary,
maxLines = 3,
overflow = TextOverflow.Ellipsis,
)
}
val due = card.duedate?.let { formatDeckDue(it) }
if (due != null || card.assignees.isNotEmpty()) {
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp),
modifier = Modifier.padding(start = 28.dp),
) {
if (due != null) {
Text("🗓 $due", style = MaterialTheme.typography.labelMedium, color = F7Colors.TextSecondary)
}
if (card.assignees.isNotEmpty()) {
Text("👤 ${card.assignees.joinToString(", ")}", style = MaterialTheme.typography.labelMedium, color = F7Colors.TextSecondary, maxLines = 1, overflow = TextOverflow.Ellipsis)
}
}
}
}
}
@Composable
internal fun DeckLabelChip(label: DeckLabel) {
val bg = parseDeckColor(label.color) ?: F7Colors.Primary
Box(
modifier = Modifier
.clip(RoundedCornerShape(4.dp))
.background(bg.copy(alpha = 0.22f))
.border(1.dp, bg, RoundedCornerShape(4.dp))
.padding(horizontal = 6.dp, vertical = 1.dp),
) {
Text(
label.title,
style = MaterialTheme.typography.labelMedium,
color = F7Colors.TextPrimary,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
}
}
/** Цвет Deck («RRGGBB» без #, иногда с #). */
internal fun parseDeckColor(hex: String?): Color? {
val h = hex?.trim()?.removePrefix("#")?.takeIf { it.length == 6 } ?: return null
return runCatching { Color(("FF$h").toLong(16)) }.getOrNull()
} }
@@ -6,6 +6,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import ru.forbion.f7cloud.core.auth.AuthSession import ru.forbion.f7cloud.core.auth.AuthSession
import ru.forbion.f7cloud.core.network.UnauthorizedException import ru.forbion.f7cloud.core.network.UnauthorizedException
@@ -15,6 +16,8 @@ data class DeckUiState(
val boards: List<DeckBoard> = emptyList(), val boards: List<DeckBoard> = emptyList(),
val selectedBoardId: Int? = null, val selectedBoardId: Int? = null,
val boardDetail: DeckBoardDetail? = null, val boardDetail: DeckBoardDetail? = null,
val openedCard: DeckCard? = null,
val busy: Boolean = false,
val error: String? = null, val error: String? = null,
val unauthorized: Boolean = false, val unauthorized: Boolean = false,
) )
@@ -27,61 +30,116 @@ class DeckViewModel(
fun load(session: AuthSession) { fun load(session: AuthSession) {
viewModelScope.launch(Dispatchers.IO) { viewModelScope.launch(Dispatchers.IO) {
_state.value = _state.value.copy(loading = true, error = null) _state.update { it.copy(loading = true, error = null) }
runCatching { repository.loadBoards(session) } runCatching { repository.loadBoards(session) }
.onSuccess { boards -> .onSuccess { boards -> _state.update { it.copy(loading = false, boards = boards, error = null) } }
_state.value = _state.value.copy(loading = false, boards = boards, error = null) .onFailure { t -> fail(t) }
}
.onFailure { t ->
_state.value = _state.value.copy(
loading = false,
error = t.message,
unauthorized = t is UnauthorizedException,
)
}
} }
} }
fun openBoard(session: AuthSession, boardId: Int) { fun openBoard(session: AuthSession, boardId: Int) {
viewModelScope.launch(Dispatchers.IO) { viewModelScope.launch(Dispatchers.IO) {
_state.value = _state.value.copy( _state.update { it.copy(loading = true, selectedBoardId = boardId, boardDetail = null, error = null) }
loading = true, runCatching { repository.loadBoardDetail(session, boardId) }
selectedBoardId = boardId, .onSuccess { detail -> _state.update { it.copy(loading = false, boardDetail = detail) } }
boardDetail = null, .onFailure { t -> fail(t) }
error = null, }
) }
private fun reloadBoard(session: AuthSession) {
val boardId = _state.value.selectedBoardId ?: return
viewModelScope.launch(Dispatchers.IO) {
runCatching { repository.loadBoardDetail(session, boardId) } runCatching { repository.loadBoardDetail(session, boardId) }
.onSuccess { detail -> .onSuccess { detail ->
_state.value = _state.value.copy(loading = false, boardDetail = detail) // если открыта карточка — подставим её свежую версию
val openedId = _state.value.openedCard?.id
val freshCard = openedId?.let { id ->
detail.stacks.flatMap { it.cards }.firstOrNull { it.id == id }
} }
.onFailure { t -> _state.update { it.copy(boardDetail = detail, openedCard = freshCard ?: it.openedCard, busy = false) }
_state.value = _state.value.copy(
loading = false,
error = t.message,
unauthorized = t is UnauthorizedException,
)
} }
.onFailure { t -> fail(t) }
} }
} }
fun closeBoard() { fun closeBoard() {
_state.value = _state.value.copy(selectedBoardId = null, boardDetail = null) _state.update { it.copy(selectedBoardId = null, boardDetail = null, openedCard = null) }
}
fun openCard(card: DeckCard) {
_state.update { it.copy(openedCard = card) }
}
fun closeCard() {
_state.update { it.copy(openedCard = null) }
} }
fun openCardById(session: AuthSession, cardId: Int) { fun openCardById(session: AuthSession, cardId: Int) {
viewModelScope.launch(Dispatchers.IO) { viewModelScope.launch(Dispatchers.IO) {
_state.value = _state.value.copy(loading = true, error = null) _state.update { it.copy(loading = true, error = null) }
runCatching { repository.loadCard(session, cardId) } runCatching { repository.loadCard(session, cardId) }
.onSuccess { card -> .onSuccess { card -> openBoard(session, card.boardId) }
openBoard(session, card.boardId) .onFailure { t -> fail(t, "Не удалось открыть карточку") }
} }
.onFailure { t -> }
_state.value = _state.value.copy(
// --- Действия (оптимистично не мутируем, перечитываем доску) ---
fun createCard(session: AuthSession, stackId: Int, title: String) =
mutate(session) { repository.createCard(session, stackId, title.trim()) }
fun toggleDone(session: AuthSession, card: DeckCard) =
mutate(session) { repository.setCardDone(session, card.id, !card.done) }
fun updateCard(session: AuthSession, card: DeckCard, title: String, description: String, duedate: String?) =
mutate(session) { repository.updateCard(session, card, title.trim(), description.trim(), duedate) }
fun moveCard(session: AuthSession, card: DeckCard, targetStackId: Int) =
mutate(session) { repository.moveCard(session, card.id, targetStackId) }
fun archiveCard(session: AuthSession, card: DeckCard) =
mutate(session, closeCardAfter = true) { repository.archiveCard(session, card.id) }
fun deleteCard(session: AuthSession, card: DeckCard) =
mutate(session, closeCardAfter = true) { repository.deleteCard(session, card.id) }
fun toggleLabel(session: AuthSession, card: DeckCard, label: DeckLabel) = mutate(session) {
if (card.labels.any { it.id == label.id }) {
repository.removeLabel(session, card.id, label.id)
} else {
repository.assignLabel(session, card.id, label.id)
}
}
fun createStack(session: AuthSession, title: String) {
val boardId = _state.value.selectedBoardId ?: return
mutate(session) { repository.createStack(session, boardId, title.trim()) }
}
private fun mutate(
session: AuthSession,
closeCardAfter: Boolean = false,
action: () -> Unit,
) {
_state.update { it.copy(busy = true, error = null) }
viewModelScope.launch(Dispatchers.IO) {
runCatching { action() }
.onSuccess {
if (closeCardAfter) _state.update { it.copy(openedCard = null) }
reloadBoard(session)
}
.onFailure { t -> fail(t) }
}
}
private fun fail(t: Throwable, fallback: String? = null) {
_state.update {
it.copy(
loading = false, loading = false,
error = t.message ?: "Не удалось открыть карточку", busy = false,
error = t.message ?: fallback,
unauthorized = t is UnauthorizedException, unauthorized = t is UnauthorizedException,
) )
} }
} }
} }
}
@@ -0,0 +1,15 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
<g clip-path="url(#clip0_3969_9720)">
<g clip-path="url(#clip1_3969_9720)">
<rect x="1.75" y="1.75" width="12.5" height="12.5" rx="2.25" stroke="#808080" stroke-width="1.5"/>
</g>
</g>
<defs>
<clipPath id="clip0_3969_9720">
<rect width="16" height="16" fill="white"/>
</clipPath>
<clipPath id="clip1_3969_9720">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 592 B

@@ -0,0 +1,16 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
<g clip-path="url(#clip0_3969_9737)">
<g clip-path="url(#clip1_3969_9737)">
<rect x="1.75" y="1.75" width="12.5" height="12.5" rx="2.25" fill="#70B62B" stroke="#70B62B" stroke-width="1.5"/>
<path d="M4 9.14286L7.80954 11.864C7.90955 11.9354 8.04971 11.9006 8.10467 11.7907L12 4" stroke="white" stroke-width="1.5" stroke-linecap="round"/>
</g>
</g>
<defs>
<clipPath id="clip0_3969_9737">
<rect width="16" height="16" fill="white"/>
</clipPath>
<clipPath id="clip1_3969_9737">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 768 B

@@ -0,0 +1,13 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_655_2917)">
<path d="M2.5 5C2.5 3.61929 3.61929 2.5 5 2.5H10H15C16.3807 2.5 17.5 3.61929 17.5 5V12.2727C17.5 13.6534 16.3807 14.7727 15 14.7727H11.6654C11.3957 14.7727 11.1333 14.86 10.9172 15.0214L6.32676 18.4514C6.16189 18.5746 5.92712 18.4569 5.92712 18.2511V15.0227C5.92712 14.8847 5.81519 14.7727 5.67712 14.7727H5C3.61929 14.7727 2.5 13.6534 2.5 12.2727V5Z" stroke="black" stroke-width="1.5"/>
<path d="M6.25 8.75H6.25972" stroke="black" stroke-width="1.875" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M10.0098 8.75H10.0195" stroke="black" stroke-width="1.875" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M13.7695 8.75H13.7793" stroke="black" stroke-width="1.875" stroke-linecap="round" stroke-linejoin="round"/>
</g>
<defs>
<clipPath id="clip0_655_2917">
<rect width="20" height="20" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 983 B

@@ -0,0 +1,12 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_10995_59807)">
<circle cx="8.5" cy="13.5" r="1.5" transform="rotate(-90 8.5 13.5)" fill="#808080"/>
<circle cx="8.5" cy="8.5" r="1.5" transform="rotate(-90 8.5 8.5)" fill="#808080"/>
<circle cx="8.5" cy="3.5" r="1.5" transform="rotate(-90 8.5 3.5)" fill="#808080"/>
</g>
<defs>
<clipPath id="clip0_10995_59807">
<rect width="16" height="16" fill="white" transform="matrix(0 -1 1 0 0 16)"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 538 B

@@ -0,0 +1,17 @@
<svg width="75" height="75" viewBox="0 0 75 75" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_17_4782)">
<circle cx="37.5" cy="37.5" r="37.5" fill="#E6E6E6"/>
<path d="M61.875 32.8754V45.3395C61.875 48.1108 59.6284 50.3574 56.857 50.3574H16.268C13.4966 50.3574 11.25 48.1108 11.25 45.3395V27.2504C11.25 24.479 13.4966 22.2324 16.268 22.2324H37.2965C38.6273 22.2324 39.9037 22.7611 40.8447 23.7021L43.5303 26.3877C44.4713 27.3287 45.7477 27.8574 47.0785 27.8574H56.857C59.6284 27.8574 61.875 30.104 61.875 32.8754Z" fill="#F5F5F5" stroke="black" stroke-width="1.67266"/>
<path d="M18.75 10.9824V50.3574H56.25V10.9824H18.75Z" fill="#F5F5F5" stroke="black" stroke-width="1.67266"/>
<path d="M16.875 14.7324V55.9824H52.5V14.7324H16.875Z" fill="#FCFEFC" stroke="black" stroke-width="1.67266"/>
<path d="M11.25 42.2504V58.4645C11.25 61.2358 13.4966 63.4824 16.268 63.4824H58.732C61.5034 63.4824 63.75 61.2358 63.75 58.4645V36.6254C63.75 33.854 61.5034 31.6074 58.732 31.6074H33.3359C32.0202 31.6074 30.7571 32.1242 29.8186 33.0464L27.0235 35.7934C26.085 36.7157 24.8219 37.2324 23.5062 37.2324H16.268C13.4966 37.2324 11.25 39.479 11.25 42.2504Z" fill="#F5F5F5" stroke="black" stroke-width="1.67266"/>
<path d="M20.625 20.3574H48.75" stroke="#70B62B" stroke-width="1.67266" stroke-linecap="square"/>
<path d="M20.625 24.1074H48.75" stroke="#70B62B" stroke-width="1.67266" stroke-linecap="square"/>
<path d="M20.625 27.8574H48.75" stroke="#70B62B" stroke-width="1.67266" stroke-linecap="square"/>
</g>
<defs>
<clipPath id="clip0_17_4782">
<rect width="75" height="75" rx="15" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

@@ -0,0 +1,4 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M15 4.72274V12.6619C15 13.4009 14.4009 14 13.6619 14H2.33813C1.5991 14 1 13.4009 1 12.6619L1 3.33812C1 2.5991 1.5991 2 2.33813 2H8.17409C8.55792 2 8.92327 2.16483 9.17728 2.45259L9.60049 2.93203C9.8545 3.21979 10.2199 3.38462 10.6037 3.38462H13.6619C14.4009 3.38462 15 3.98371 15 4.72274Z" stroke="#ffffffff" stroke-width="1.5"/>
<path d="M1 8.74989V12.6619C1 13.4009 1.5991 14 2.33813 14H13.6619C14.4009 14 15 13.4009 15 12.6619V7.33812C15 6.5991 14.4009 6 13.6619 6H6.86607C6.52921 6 6.20475 6.12705 5.95745 6.35578L5.20044 7.05598C4.95315 7.28472 4.62868 7.41176 4.29183 7.41176H2.33812C1.5991 7.41176 1 8.01086 1 8.74989Z" stroke="#ffffffff" stroke-width="1.5"/>
</svg>

After

Width:  |  Height:  |  Size: 779 B

@@ -0,0 +1,15 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_17_4585)">
<path d="M4.25 2L4.25 6C4.25 6.13807 4.13807 6.25 4 6.25L2 6.25C1.86193 6.25 1.75 6.13807 1.75 6L1.75 2C1.75 1.86193 1.86193 1.75 2 1.75L4 1.75C4.13807 1.75 4.25 1.86193 4.25 2Z" stroke="#808080" stroke-width="1.5"/>
<path d="M4.25 10L4.25 14C4.25 14.1381 4.13807 14.25 4 14.25H2C1.86193 14.25 1.75 14.1381 1.75 14L1.75 10C1.75 9.86193 1.86193 9.75 2 9.75H4C4.13807 9.75 4.25 9.86193 4.25 10Z" stroke="#808080" stroke-width="1.5"/>
<path d="M9.25 2V6C9.25 6.13807 9.13807 6.25 9 6.25L7 6.25C6.86193 6.25 6.75 6.13807 6.75 6L6.75 2C6.75 1.86193 6.86193 1.75 7 1.75L9 1.75C9.13807 1.75 9.25 1.86193 9.25 2Z" stroke="#808080" stroke-width="1.5"/>
<path d="M9.25 10V14C9.25 14.1381 9.13807 14.25 9 14.25H7C6.86193 14.25 6.75 14.1381 6.75 14L6.75 10C6.75 9.86193 6.86193 9.75 7 9.75H9C9.13807 9.75 9.25 9.86193 9.25 10Z" stroke="#808080" stroke-width="1.5"/>
<path d="M14.25 2V6C14.25 6.13807 14.1381 6.25 14 6.25L12 6.25C11.8619 6.25 11.75 6.13807 11.75 6V2C11.75 1.86193 11.8619 1.75 12 1.75L14 1.75C14.1381 1.75 14.25 1.86193 14.25 2Z" stroke="#808080" stroke-width="1.5"/>
<path d="M14.25 10V14C14.25 14.1381 14.1381 14.25 14 14.25H12C11.8619 14.25 11.75 14.1381 11.75 14V10C11.75 9.86193 11.8619 9.75 12 9.75H14C14.1381 9.75 14.25 9.86193 14.25 10Z" stroke="#808080" stroke-width="1.5"/>
</g>
<defs>
<clipPath id="clip0_17_4585">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

@@ -0,0 +1,21 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_1460_24542)">
<g clip-path="url(#clip1_1460_24542)">
<g clip-path="url(#clip2_1460_24542)">
<path d="M10.2102 14.9989V9.10405C10.2102 8.90862 10.1326 8.7212 9.99441 8.58301C9.85623 8.44482 9.6688 8.36719 9.47337 8.36719H6.52592C6.3305 8.36719 6.14307 8.44482 6.00488 8.58301C5.8667 8.7212 5.78906 8.90862 5.78906 9.10405V14.9989" stroke="#808080" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M1.36719 6.89451C1.36714 6.68014 1.41386 6.46833 1.50409 6.27387C1.59432 6.07941 1.72589 5.90697 1.88962 5.76859L7.04766 1.34815C7.31366 1.12334 7.65068 1 7.99895 1C8.34722 1 8.68424 1.12334 8.95024 1.34815L14.1083 5.76859C14.272 5.90697 14.4036 6.07941 14.4938 6.27387C14.584 6.46833 14.6308 6.68014 14.6307 6.89451V13.5263C14.6307 13.9171 14.4754 14.292 14.1991 14.5684C13.9227 14.8447 13.5478 15 13.157 15H2.84091C2.45006 15 2.07521 14.8447 1.79883 14.5684C1.52245 14.292 1.36719 13.9171 1.36719 13.5263V6.89451Z" stroke="#808080" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</g>
</g>
</g>
<defs>
<clipPath id="clip0_1460_24542">
<rect width="16" height="16" fill="white"/>
</clipPath>
<clipPath id="clip1_1460_24542">
<rect width="16" height="16" fill="white"/>
</clipPath>
<clipPath id="clip2_1460_24542">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,15 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_5015_21462)">
<rect x="1" y="2" width="3" height="3" fill="#151515"/>
<path d="M6 3.5L14 3.5" stroke="#151515" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<rect x="1" y="7" width="3" height="3" fill="#151515"/>
<path d="M6 8.5L14 8.5" stroke="#151515" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<rect x="1" y="12" width="3" height="3" fill="#151515"/>
<path d="M6 13.5L14 13.5" stroke="#151515" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</g>
<defs>
<clipPath id="clip0_5015_21462">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 749 B

@@ -0,0 +1,13 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_655_7627)">
<path d="M15.3624 8.67973C15.2352 10.4449 13.9258 11.8048 12.4978 11.8048C11.0698 11.8048 9.75817 10.4454 9.63317 8.67973C9.50296 6.84333 10.7777 5.55469 12.4978 5.55469C14.2179 5.55469 15.4926 6.87675 15.3624 8.67973Z" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M12.5004 14.584C9.67175 14.584 6.95162 15.989 6.27017 18.7251C6.17989 19.0871 6.50327 19.3756 6.87524 19.3756H18.3187C18.6907 19.3756 18.82 19.0871 18.731 18.7251C18.0496 15.9451 15.3295 14.584 12.5004 14.584Z" stroke="black" stroke-width="1.5" stroke-miterlimit="10"/>
<path d="M8.74367 3.83406C8.63931 5.28263 7.55198 6.42347 6.37993 6.42347C5.20787 6.42347 4.11876 5.28308 4.01618 3.83406C3.90959 2.32706 4.96792 1.25 6.37993 1.25C7.79193 1.25 8.85026 2.35471 8.74367 3.83406Z" stroke="black" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M8.75 9.39002C7.97203 8.92775 7.11518 8.75 6.20704 8.75C3.96579 8.75 1.80642 10.1949 1.26551 13.0094C1.19439 13.3816 1.37455 13.75 1.66936 13.75H6.50875" stroke="black" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round"/>
</g>
<defs>
<clipPath id="clip0_655_7627">
<rect width="20" height="20" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

@@ -0,0 +1,11 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_245_63266)">
<path d="M1.5 8L14.5 8" stroke="white" stroke-width="1.5" stroke-linecap="round"/>
<path d="M8 1.5L8 14.5" stroke="white" stroke-width="1.5" stroke-linecap="round"/>
</g>
<defs>
<clipPath id="clip0_245_63266">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 415 B

@@ -0,0 +1 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0)"><circle cx="5.5" cy="5.5" r="4.75" stroke="#808080" stroke-width="1.5"/><path d="M8.73541 9L14.7354 15" stroke="#808080" stroke-width="1.5" stroke-linecap="round"/></g><defs><clipPath id="clip0"><rect width="16" height="16" fill="white"/></clipPath></defs></svg>

After

Width:  |  Height:  |  Size: 385 B

@@ -0,0 +1,10 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_12335_36924)">
<path d="M6.10476 3.60501C6.94943 2.09034 7.37143 1.33301 8.00276 1.33301C8.63409 1.33301 9.05609 2.09034 9.90076 3.60501L10.1194 3.99701C10.3594 4.42767 10.4794 4.64301 10.6661 4.78501C10.8528 4.92701 11.0861 4.97967 11.5528 5.08501L11.9768 5.18101C13.6168 5.55234 14.4361 5.73767 14.6314 6.36501C14.8261 6.99167 14.2674 7.64567 13.1494 8.95301L12.8601 9.29101C12.5428 9.66234 12.3834 9.84834 12.3121 10.0777C12.2408 10.3077 12.2648 10.5557 12.3128 11.051L12.3568 11.5023C12.5254 13.247 12.6101 14.119 12.0994 14.5063C11.5888 14.8937 10.8208 14.5403 9.28609 13.8337L8.88809 13.651C8.45209 13.4497 8.23409 13.3497 8.00276 13.3497C7.77143 13.3497 7.55343 13.4497 7.11743 13.651L6.72009 13.8337C5.18476 14.5403 4.41676 14.8937 3.90676 14.507C3.39543 14.119 3.48009 13.247 3.64876 11.5023L3.69276 11.0517C3.74076 10.5557 3.76476 10.3077 3.69276 10.0783C3.62209 9.84834 3.46276 9.66234 3.14543 9.29167L2.85609 8.95301C1.73809 7.64634 1.17943 6.99234 1.37409 6.36501C1.56876 5.73767 2.38943 5.55167 4.02943 5.18101L4.45343 5.08501C4.91943 4.97967 5.15209 4.92701 5.33943 4.78501C5.52676 4.64301 5.64609 4.42767 5.88609 3.99701L6.10476 3.60501Z" stroke="#808080" stroke-width="1.5"/>
</g>
<defs>
<clipPath id="clip0_12335_36924">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,10 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="#70B62B" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_11908_43900)">
<path d="M6.10476 3.60501C6.94943 2.09034 7.37143 1.33301 8.00276 1.33301C8.63409 1.33301 9.05609 2.09034 9.90076 3.60501L10.1194 3.99701C10.3594 4.42767 10.4794 4.64301 10.6661 4.78501C10.8528 4.92701 11.0861 4.97967 11.5528 5.08501L11.9768 5.18101C13.6168 5.55234 14.4361 5.73767 14.6314 6.36501C14.8261 6.99167 14.2674 7.64567 13.1494 8.95301L12.8601 9.29101C12.5428 9.66234 12.3834 9.84834 12.3121 10.0777C12.2408 10.3077 12.2648 10.5557 12.3128 11.051L12.3568 11.5023C12.5254 13.247 12.6101 14.119 12.0994 14.5063C11.5888 14.8937 10.8208 14.5403 9.28609 13.8337L8.88809 13.651C8.45209 13.4497 8.23409 13.3497 8.00276 13.3497C7.77143 13.3497 7.55343 13.4497 7.11743 13.651L6.72009 13.8337C5.18476 14.5403 4.41676 14.8937 3.90676 14.507C3.39543 14.119 3.48009 13.247 3.64876 11.5023L3.69276 11.0517C3.74076 10.5557 3.76476 10.3077 3.69276 10.0783C3.62209 9.84834 3.46276 9.66234 3.14543 9.29167L2.85609 8.95301C1.73809 7.64634 1.17943 6.99234 1.37409 6.36501C1.56876 5.73767 2.38943 5.55167 4.02943 5.18101L4.45343 5.08501C4.91943 4.97967 5.15209 4.92701 5.33943 4.78501C5.52676 4.64301 5.64609 4.42767 5.88609 3.99701L6.10476 3.60501Z" stroke="#70B62B" stroke-width="1.5"/>
</g>
<defs>
<clipPath id="clip0_11908_43900">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -1,13 +1,16 @@
package ru.forbion.f7cloud.feature.files package ru.forbion.f7cloud.feature.files
object FileIcons { object FileIcons {
/** Локальные SVG хрома Файлов из боевой темы forbion (assets/chrome/, coil-svg). */
fun chromeAsset(name: String): String = "file:///android_asset/chrome/$name"
/** /**
* Иконка типа файла. Типы файлов ЛОКАЛЬНЫЕ SVG из дизайна (assets/filetypes/, грузятся * Иконка типа файла. Типы файлов ЛОКАЛЬНЫЕ SVG из дизайна (assets/filetypes/, грузятся
* coil-svg): офлайн + точные иконки макета (раньше тянулись с сервера аудит: офлайн ломался). * coil-svg): офлайн + точные иконки макета (раньше тянулись с сервера аудит: офлайн ломался).
* Папка пока с сервера (иконки папки в наборе дизайна нет; TODO забрать из Figma). * Папка фирменная folder-icon-colored.svg из боевой темы (тоже локально).
*/ */
fun iconUrl(serverUrl: String, name: String, isDirectory: Boolean): String { fun iconUrl(serverUrl: String, name: String, isDirectory: Boolean): String {
if (isDirectory) return "${serverUrl.trimEnd('/')}/core/img/filetypes/folder.svg" if (isDirectory) return chromeAsset("folder-icon-colored.svg")
return "file:///android_asset/filetypes/${localIcon(name)}.svg" return "file:///android_asset/filetypes/${localIcon(name)}.svg"
} }
@@ -4,34 +4,32 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.border import androidx.compose.foundation.border
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.horizontalScroll import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.List import androidx.compose.material.icons.filled.ChevronRight
import androidx.compose.material.icons.filled.GridView
import androidx.compose.material.icons.filled.Home
import androidx.compose.material.icons.filled.MoreVert
import androidx.compose.material.icons.filled.Star
import androidx.compose.material.icons.filled.StarBorder
import androidx.compose.material3.Checkbox
import androidx.compose.material3.CheckboxDefaults
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color import androidx.compose.ui.draw.shadow
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
@@ -40,30 +38,59 @@ import ru.forbion.f7cloud.core.designsystem.F7Colors
import ru.forbion.f7cloud.core.designsystem.F7Radius import ru.forbion.f7cloud.core.designsystem.F7Radius
import ru.forbion.f7cloud.core.designsystem.F7Spacing import ru.forbion.f7cloud.core.designsystem.F7Spacing
// Размеры — из боевой темы forbion (_mobile-files.css), копия один в один.
enum class FilesViewMode { List, Grid } enum class FilesViewMode { List, Grid }
/** Квадратная кнопка-переключатель вида список⇄сетка справа от поиска (макет F-17/F-22). */ /**
* Чекбокс из боевой темы: 16×16, серый контур / зелёная заливка с галкой
* (checkbox-blank-outline-icon.svg / checkbox-marked-icon.svg). Тап-зона задаётся снаружи.
*/
@Composable
fun F7ThemeCheckbox(checked: Boolean, onToggle: () -> Unit, modifier: Modifier = Modifier) {
AsyncImage(
model = FileIcons.chromeAsset(
if (checked) "checkbox-marked-icon.svg" else "checkbox-blank-outline-icon.svg",
),
contentDescription = if (checked) "Снять выбор" else "Выбрать",
modifier = modifier
.size(16.dp)
.clickable(
interactionSource = remember { MutableInteractionSource() },
indication = null,
onClick = onToggle,
),
)
}
/** Стиль «пилюли» темы: фон #FBFBFB, рамка #E6E6E6, мягкая тень 0 1px 2px. */
private fun Modifier.f7PillSurface(shape: RoundedCornerShape): Modifier = this
.shadow(1.dp, shape, ambientColor = F7Colors.Border, spotColor = F7Colors.Border)
.clip(shape)
.background(F7Colors.Background)
.border(1.dp, F7Colors.Border, shape)
/** Круглая кнопка-переключатель список⇄сетка справа от поиска (40×40, иконка 16). */
@Composable @Composable
fun FilesViewToggleButton(viewMode: FilesViewMode, onToggle: () -> Unit) { fun FilesViewToggleButton(viewMode: FilesViewMode, onToggle: () -> Unit) {
Box( Box(
modifier = Modifier modifier = Modifier
.size(40.dp) .size(40.dp)
.clip(RoundedCornerShape(F7Radius.md)) .f7PillSurface(RoundedCornerShape(F7Radius.pill))
.background(F7Colors.SecondaryButtonBg)
.border(1.dp, F7Colors.Border, RoundedCornerShape(F7Radius.md))
.clickable(onClick = onToggle), .clickable(onClick = onToggle),
contentAlignment = Alignment.Center, contentAlignment = Alignment.Center,
) { ) {
Icon( AsyncImage(
imageVector = if (viewMode == FilesViewMode.List) Icons.Filled.GridView else Icons.AutoMirrored.Filled.List, model = FileIcons.chromeAsset(
if (viewMode == FilesViewMode.List) "grid-files-gray.svg" else "list-view-icon.svg",
),
contentDescription = "Сменить вид", contentDescription = "Сменить вид",
tint = F7Colors.TextSecondary, modifier = Modifier.size(16.dp),
modifier = Modifier.size(20.dp),
) )
} }
} }
/** Хлебные крошки: домой + сегменты пути через ›, прокрутка по горизонтали (макет F-21/F-22). */ /** Хлебные крошки: дом 16 + сегменты (все — серые 14/20) через шеврон 16, h-прокрутка. */
@Composable @Composable
fun FilesBreadcrumb( fun FilesBreadcrumb(
segments: List<String>, segments: List<String>,
@@ -75,23 +102,28 @@ fun FilesBreadcrumb(
modifier = modifier modifier = modifier
.fillMaxWidth() .fillMaxWidth()
.horizontalScroll(rememberScrollState()) .horizontalScroll(rememberScrollState())
.padding(vertical = F7Spacing.sm), .padding(horizontal = F7Spacing.sm, vertical = F7Spacing.xs),
horizontalArrangement = Arrangement.spacedBy(F7Spacing.xs),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
) { ) {
Icon( AsyncImage(
imageVector = Icons.Filled.Home, model = FileIcons.chromeAsset("home-bottom.svg"),
contentDescription = "В начало", contentDescription = "В начало",
tint = F7Colors.TextSecondary,
modifier = Modifier modifier = Modifier
.size(22.dp) .size(16.dp)
.clickable(onClick = onHomeClick), .clickable(onClick = onHomeClick),
) )
segments.forEachIndexed { i, seg -> segments.forEachIndexed { i, seg ->
Text(" ", style = MaterialTheme.typography.bodyMedium, color = F7Colors.TextSecondary) Icon(
imageVector = Icons.Filled.ChevronRight,
contentDescription = null,
tint = F7Colors.TextSecondary,
modifier = Modifier.size(16.dp),
)
Text( Text(
text = seg, text = seg,
style = MaterialTheme.typography.bodyMedium, style = MaterialTheme.typography.bodyMedium,
color = if (i == segments.lastIndex) F7Colors.TextPrimary else F7Colors.TextSecondary, color = F7Colors.TextSecondary,
maxLines = 1, maxLines = 1,
modifier = Modifier.clickable { onSegmentClick(i) }, modifier = Modifier.clickable { onSegmentClick(i) },
) )
@@ -99,7 +131,7 @@ fun FilesBreadcrumb(
} }
} }
/** Ряд фильтр-чипов: Тип файла / Участники / Изменен (макет F-18/F-22). */ /** Ряд фильтр-чипов: Тип файла / Участники / Изменен (пилюли 25dp, minWidth 86). */
@Composable @Composable
fun FilesFilterChips( fun FilesFilterChips(
onTypeClick: () -> Unit, onTypeClick: () -> Unit,
@@ -111,7 +143,7 @@ fun FilesFilterChips(
modifier = modifier modifier = modifier
.fillMaxWidth() .fillMaxWidth()
.horizontalScroll(rememberScrollState()) .horizontalScroll(rememberScrollState())
.padding(vertical = F7Spacing.xs), .padding(horizontal = F7Spacing.xs, vertical = F7Spacing.xs),
horizontalArrangement = Arrangement.spacedBy(F7Spacing.sm), horizontalArrangement = Arrangement.spacedBy(F7Spacing.sm),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
) { ) {
@@ -125,16 +157,21 @@ fun FilesFilterChips(
private fun FilterChip(label: String, onClick: () -> Unit) { private fun FilterChip(label: String, onClick: () -> Unit) {
Box( Box(
modifier = Modifier modifier = Modifier
.clip(RoundedCornerShape(F7Radius.pill)) .height(25.dp)
.border(1.dp, F7Colors.Border, RoundedCornerShape(F7Radius.pill)) .widthIn(min = 86.dp)
.f7PillSurface(RoundedCornerShape(F7Radius.pill))
.clickable(onClick = onClick) .clickable(onClick = onClick)
.padding(horizontal = F7Spacing.md, vertical = F7Spacing.xs), .padding(horizontal = F7Spacing.sm),
contentAlignment = Alignment.Center,
) { ) {
Text(label, style = MaterialTheme.typography.bodyMedium, color = F7Colors.TextSecondary) Text(label, style = MaterialTheme.typography.bodyMedium, color = F7Colors.TextPrimary)
} }
} }
/** Карточка сетки: чекбокс + звезда сверху, крупная иконка по центру, имя + ⋮ снизу (макет F-17). */ /**
* Карточка сетки (2 колонки): чекбокс 16 слева-сверху, зелёная звезда 16 справа-сверху
* (только у избранных), иконка 80 по центру, имя 14/20 + 16 снизу. Радиус 12, отступ 12.
*/
@Composable @Composable
fun FilesGridCard( fun FilesGridCard(
serverUrl: String, serverUrl: String,
@@ -146,41 +183,40 @@ fun FilesGridCard(
onMenuClick: () -> Unit, onMenuClick: () -> Unit,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
) { ) {
val shape = RoundedCornerShape(12.dp)
Column( Column(
modifier = modifier modifier = modifier
.clip(RoundedCornerShape(F7Radius.lg)) .clip(shape)
.background(if (selected) F7Colors.PrimaryLight else F7Colors.Surface) .background(if (selected) F7Colors.PrimaryLight else F7Colors.Background)
.border(1.dp, F7Colors.Border, RoundedCornerShape(F7Radius.lg)) .border(1.dp, F7Colors.Border, shape)
.clickable(onClick = onOpenClick) .clickable(onClick = onOpenClick)
.padding(F7Spacing.md), .padding(12.dp),
) { ) {
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth()) { Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth()) {
Checkbox( F7ThemeCheckbox(checked = selected, onToggle = onSelectedChange)
checked = selected,
onCheckedChange = { onSelectedChange() },
colors = CheckboxDefaults.colors(checkedColor = F7Colors.Primary),
)
Spacer(Modifier.width(F7Spacing.sm))
Box(modifier = Modifier.weight(1f)) Box(modifier = Modifier.weight(1f))
Icon( if (favorite) {
imageVector = if (favorite) Icons.Filled.Star else Icons.Filled.StarBorder, AsyncImage(
contentDescription = null, model = FileIcons.chromeAsset("star-green-full.svg"),
tint = if (favorite) F7Colors.Primary else F7Colors.TextMuted, contentDescription = "В избранном",
modifier = Modifier.size(18.dp), modifier = Modifier.size(16.dp),
) )
} }
}
Spacer(Modifier.height(F7Spacing.sm))
Box( Box(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.padding(vertical = F7Spacing.lg), .height(80.dp),
contentAlignment = Alignment.Center, contentAlignment = Alignment.Center,
) { ) {
AsyncImage( AsyncImage(
model = FileIcons.iconUrl(serverUrl, item.name, item.isDirectory), model = FileIcons.iconUrl(serverUrl, item.name, item.isDirectory),
contentDescription = null, contentDescription = null,
modifier = Modifier.size(48.dp), modifier = Modifier.size(80.dp),
) )
} }
Spacer(Modifier.height(F7Spacing.sm))
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth()) { Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth()) {
Text( Text(
text = item.name, text = item.name,
@@ -191,12 +227,11 @@ fun FilesGridCard(
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
) )
Icon( AsyncImage(
imageVector = Icons.Filled.MoreVert, model = FileIcons.chromeAsset("dots-vertic-gray.svg"),
contentDescription = "Меню", contentDescription = "Меню",
tint = F7Colors.TextSecondary,
modifier = Modifier modifier = Modifier
.size(18.dp) .size(16.dp)
.clickable(onClick = onMenuClick), .clickable(onClick = onMenuClick),
) )
} }
@@ -221,7 +256,7 @@ fun FilesEmptyState(
Box( Box(
modifier = Modifier modifier = Modifier
.size(72.dp) .size(72.dp)
.clip(RoundedCornerShape(F7Radius.pill)) .clip(CircleShape)
.background(F7Colors.SurfaceMuted), .background(F7Colors.SurfaceMuted),
contentAlignment = Alignment.Center, contentAlignment = Alignment.Center,
) { ) {
@@ -16,6 +16,8 @@ import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.width
@@ -26,11 +28,7 @@ import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowForward import androidx.compose.material.icons.automirrored.filled.ArrowForward
import androidx.compose.material.icons.filled.ChatBubbleOutline
import androidx.compose.material.icons.filled.Close import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.filled.Group
import androidx.compose.material.icons.filled.Star
import androidx.compose.material.icons.filled.StarBorder
import androidx.compose.material3.Checkbox import androidx.compose.material3.Checkbox
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.CheckboxDefaults import androidx.compose.material3.CheckboxDefaults
@@ -66,6 +64,7 @@ import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
@@ -103,6 +102,7 @@ fun FilesNavigationSidebar(
onToggleTreePath: (String) -> Unit, onToggleTreePath: (String) -> Unit,
onToggleSection: (String) -> Unit, onToggleSection: (String) -> Unit,
onWebOnlyClick: (String) -> Unit, onWebOnlyClick: (String) -> Unit,
onCreateClick: (() -> Unit)? = null,
) { ) {
val base = serverUrl.trimEnd('/') val base = serverUrl.trimEnd('/')
AnimatedVisibility( AnimatedVisibility(
@@ -124,11 +124,18 @@ fun FilesNavigationSidebar(
Column( Column(
modifier = Modifier modifier = Modifier
.fillMaxHeight() .fillMaxHeight()
.fillMaxWidth(0.86f) .fillMaxWidth(0.9f)
.background(F7Colors.Surface) .background(F7Colors.Background)
.verticalScroll(rememberScrollState()) .verticalScroll(rememberScrollState())
.padding(horizontal = 12.dp, vertical = 12.dp), .padding(start = 10.dp, top = 10.dp, end = 16.dp, bottom = 26.dp),
verticalArrangement = Arrangement.spacedBy(4.dp),
) { ) {
onCreateClick?.let { create ->
FilesSidebarCreateButton(
onClick = create,
modifier = Modifier.padding(bottom = 4.dp),
)
}
FilesSidebarRow( FilesSidebarRow(
serverUrl = base, serverUrl = base,
iconPath = "files/folder-gray.svg", iconPath = "files/folder-gray.svg",
@@ -231,11 +238,13 @@ fun FilesNavigationSidebar(
} }
if (usage.isNotBlank()) { if (usage.isNotBlank()) {
Spacer(Modifier.height(8.dp)) Spacer(Modifier.height(8.dp))
// Живая тема: квота по центру, серым 16/20, без прогресс-бара.
Text( Text(
text = "Использовано $usage", text = "Использовано $usage",
style = MaterialTheme.typography.bodySmall, style = MaterialTheme.typography.bodyLarge,
color = F7Colors.TextSecondary, color = F7Colors.TextSecondary,
modifier = Modifier.padding(horizontal = 8.dp), textAlign = TextAlign.Center,
modifier = Modifier.fillMaxWidth(),
) )
} }
} }
@@ -305,6 +314,56 @@ private fun FilesTreeNodeRows(
} }
} }
/**
* Градиентная кнопка «Создать или загрузить» сверху панели (живая тема: 40dp, r100,
* градиент 104°, белая папка слева, разделитель и плюс справа).
*/
@Composable
fun FilesSidebarCreateButton(onClick: () -> Unit, modifier: Modifier = Modifier) {
Row(
modifier = modifier
.fillMaxWidth()
.height(40.dp)
.clip(RoundedCornerShape(F7Radius.pill))
.background(
Brush.linearGradient(listOf(Color(0xFFC0FF7B), Color(0xFF7CBC3D))),
)
.clickable(onClick = onClick)
.padding(horizontal = 14.dp),
verticalAlignment = Alignment.CenterVertically,
) {
AsyncImage(
model = FileIcons.chromeAsset("folder-white.svg"),
contentDescription = null,
modifier = Modifier.size(16.dp),
)
Text(
text = "Создать или загрузить",
modifier = Modifier
.weight(1f)
.padding(horizontal = 12.dp),
style = MaterialTheme.typography.bodyLarge,
fontWeight = FontWeight.Medium,
color = Color(0xFFFDFDFD),
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
Box(
modifier = Modifier
.width(2.dp)
.height(40.dp)
.background(Color.White),
)
AsyncImage(
model = FileIcons.chromeAsset("plus-white.svg"),
contentDescription = "Создать",
modifier = Modifier
.padding(start = 14.dp)
.size(16.dp),
)
}
}
@Composable @Composable
private fun FilesSidebarRow( private fun FilesSidebarRow(
serverUrl: String, serverUrl: String,
@@ -313,36 +372,34 @@ private fun FilesSidebarRow(
selected: Boolean = false, selected: Boolean = false,
onClick: () -> Unit, onClick: () -> Unit,
) { ) {
// Живая тема: строка minHeight 40, r8, иконка 20 серым, текст 16/20 #151515,
// активная — фон #ECF9DE; правых «⋮» в навигации нет.
Row( Row(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.heightIn(min = 40.dp)
.clip(RoundedCornerShape(8.dp)) .clip(RoundedCornerShape(8.dp))
.background(if (selected) Color(0xFFE8F5E0) else Color.Transparent) .background(if (selected) F7Colors.PrimaryLight else Color.Transparent)
.clickable(onClick = onClick) .clickable(onClick = onClick)
.padding(horizontal = 8.dp, vertical = 10.dp), .padding(horizontal = 8.dp, vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
) { ) {
AsyncImage( AsyncImage(
model = "$serverUrl/themes/forbion/images/$iconPath", model = "$serverUrl/themes/forbion/images/$iconPath",
contentDescription = null, contentDescription = null,
modifier = Modifier.size(18.dp), modifier = Modifier.size(20.dp),
contentScale = ContentScale.Fit, contentScale = ContentScale.Fit,
) )
Spacer(Modifier.width(10.dp)) Spacer(Modifier.width(8.dp))
Text( Text(
text = title, text = title,
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f),
style = MaterialTheme.typography.bodyMedium, style = MaterialTheme.typography.bodyLarge,
fontWeight = if (selected) FontWeight.SemiBold else FontWeight.Normal, fontWeight = FontWeight.Medium,
color = F7Colors.TextPrimary,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
) )
AsyncImage(
model = "$serverUrl/themes/forbion/images/files/dots-vertic-gray.svg",
contentDescription = null,
modifier = Modifier.size(16.dp),
contentScale = ContentScale.Fit,
)
} }
} }
@@ -364,16 +421,12 @@ private fun FilesSidebarChildRow(
Text( Text(
text = title, text = title,
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f),
style = MaterialTheme.typography.bodyMedium, style = MaterialTheme.typography.bodyLarge,
fontWeight = FontWeight.Medium,
color = F7Colors.TextPrimary,
maxLines = 2, maxLines = 2,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
) )
AsyncImage(
model = "$serverUrl/themes/forbion/images/files/dots-vertic-gray.svg",
contentDescription = null,
modifier = Modifier.size(16.dp),
contentScale = ContentScale.Fit,
)
} }
} }
@@ -390,22 +443,23 @@ private fun FilesSidebarExpandableSection(
Row( Row(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.heightIn(min = 40.dp)
.clip(RoundedCornerShape(8.dp)) .clip(RoundedCornerShape(8.dp))
.clickable(onClick = onToggle) .clickable(onClick = onToggle)
.padding(horizontal = 8.dp, vertical = 10.dp), .padding(horizontal = 8.dp, vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
) { ) {
AsyncImage( AsyncImage(
model = "$serverUrl/themes/forbion/images/$iconPath", model = "$serverUrl/themes/forbion/images/$iconPath",
contentDescription = null, contentDescription = null,
modifier = Modifier.size(18.dp), modifier = Modifier.size(20.dp),
contentScale = ContentScale.Fit, contentScale = ContentScale.Fit,
) )
Spacer(Modifier.width(10.dp)) Spacer(Modifier.width(8.dp))
Text( Text(
text = title, text = title,
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f),
style = MaterialTheme.typography.bodyMedium, style = MaterialTheme.typography.bodyLarge,
fontWeight = FontWeight.Medium, fontWeight = FontWeight.Medium,
) )
Text(text = if (expanded) "" else "", color = F7Colors.TextSecondary) Text(text = if (expanded) "" else "", color = F7Colors.TextSecondary)
@@ -559,7 +613,6 @@ fun FilesSearchBar(
onQueryChange: (String) -> Unit, onQueryChange: (String) -> Unit,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
) { ) {
val base = serverUrl.trimEnd('/')
Box( Box(
modifier = modifier modifier = modifier
.height(40.dp) .height(40.dp)
@@ -569,7 +622,7 @@ fun FilesSearchBar(
spotColor = Color(0xFFCBCBCB), spotColor = Color(0xFFCBCBCB),
) )
.clip(RoundedCornerShape(100.dp)) .clip(RoundedCornerShape(100.dp))
.background(Color(0xFFFDFDFD)) .background(F7Colors.Background)
.border(1.dp, F7Colors.Border, RoundedCornerShape(100.dp)), .border(1.dp, F7Colors.Border, RoundedCornerShape(100.dp)),
contentAlignment = Alignment.CenterStart, contentAlignment = Alignment.CenterStart,
) { ) {
@@ -581,7 +634,7 @@ fun FilesSearchBar(
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
) { ) {
AsyncImage( AsyncImage(
model = "$base/themes/forbion/images/header/search-gray.svg", model = FileIcons.chromeAsset("search-gray.svg"),
contentDescription = null, contentDescription = null,
modifier = Modifier.size(16.dp), modifier = Modifier.size(16.dp),
contentScale = ContentScale.Fit, contentScale = ContentScale.Fit,
@@ -620,6 +673,16 @@ fun FilesSearchBar(
} }
}, },
) )
if (query.isNotEmpty()) {
Icon(
imageVector = Icons.Filled.Close,
contentDescription = "Очистить поиск",
tint = F7Colors.TextSecondary,
modifier = Modifier
.size(20.dp)
.clickable { onQueryChange("") },
)
}
} }
} }
} }
@@ -733,47 +796,60 @@ private fun FilesHeaderColumn(
} }
} }
/**
* Панель выделения по живой теме: 40dp, чекбокс 16 «выбрать все», «Выбрать все» чёрным +
* «(Выбран N)» серым, справа пилюля «Действия» 25dp (без иконки).
*/
@Composable @Composable
fun FilesBulkActionsBar( fun FilesBulkActionsBar(
serverUrl: String, serverUrl: String,
selectedCount: Int, selectedCount: Int,
allSelected: Boolean = false,
onToggleSelectAll: (() -> Unit)? = null,
onActionsClick: (Rect) -> Unit, onActionsClick: (Rect) -> Unit,
) { ) {
var anchorBounds by remember { mutableStateOf<Rect?>(null) } var anchorBounds by remember { mutableStateOf<Rect?>(null) }
val base = serverUrl.trimEnd('/')
Row( Row(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.padding(bottom = 8.dp), .height(40.dp)
.padding(horizontal = 12.dp),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp), horizontalArrangement = Arrangement.spacedBy(8.dp),
) { ) {
F7ThemeCheckbox(checked = allSelected, onToggle = { onToggleSelectAll?.invoke() })
Text( Text(
text = "Выбрано $selectedCount", text = buildAnnotatedString {
append("Выбрать все ")
withStyle(SpanStyle(color = F7Colors.TextSecondary)) {
append("(Выбран $selectedCount)")
}
},
modifier = Modifier.weight(1f),
style = MaterialTheme.typography.bodyMedium, style = MaterialTheme.typography.bodyMedium,
fontWeight = FontWeight.Medium, fontWeight = FontWeight.Medium,
color = F7Colors.TextPrimary,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
) )
Row( Box(
modifier = Modifier modifier = Modifier
.height(25.dp)
.clip(RoundedCornerShape(100.dp)) .clip(RoundedCornerShape(100.dp))
.background(F7Colors.Background)
.border(1.dp, F7Colors.Border, RoundedCornerShape(100.dp)) .border(1.dp, F7Colors.Border, RoundedCornerShape(100.dp))
.clickable { .clickable { anchorBounds?.let(onActionsClick) }
anchorBounds?.let(onActionsClick)
}
.onGloballyPositioned { coords -> .onGloballyPositioned { coords ->
anchorBounds = coords.boundsInWindow() anchorBounds = coords.boundsInWindow()
} }
.padding(horizontal = 12.dp, vertical = 8.dp), .padding(horizontal = 8.dp),
verticalAlignment = Alignment.CenterVertically, contentAlignment = Alignment.Center,
horizontalArrangement = Arrangement.spacedBy(6.dp),
) { ) {
AsyncImage( Text(
model = "$base/themes/forbion/images/files/dots-vertic-gray.svg", "Действия",
contentDescription = null, style = MaterialTheme.typography.bodyMedium,
modifier = Modifier.size(14.dp), color = F7Colors.TextPrimary,
contentScale = ContentScale.Fit,
) )
Text("Действия", style = MaterialTheme.typography.bodyMedium)
} }
} }
} }
@@ -793,27 +869,36 @@ fun FilesListRow(
val hasExt = !item.isDirectory && item.name.contains('.') val hasExt = !item.isDirectory && item.name.contains('.')
val baseName = if (hasExt) item.name.substringBeforeLast('.') else item.name val baseName = if (hasExt) item.name.substringBeforeLast('.') else item.name
val extension = if (hasExt && showExtensions) "." + item.name.substringAfterLast('.') else "" val extension = if (hasExt && showExtensions) "." + item.name.substringAfterLast('.') else ""
// Строка 44dp по боевой теме (_mobile-files.css): чекбокс 16 в колонке 44, иконка 30
// (зелёная звезда 16 поверх у избранных), имя, размер 56 по центру, дата 88 вправо, ⋮ в 32.
Row( Row(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.clip(RoundedCornerShape(F7Radius.md)) .height(44.dp)
// выбранная строка — светло-зелёный фон (макет F-21)
.background(if (selected) F7Colors.PrimaryLight else Color.Transparent) .background(if (selected) F7Colors.PrimaryLight else Color.Transparent)
.clickable(onClick = onOpenClick) .clickable(onClick = onOpenClick),
.padding(horizontal = F7Spacing.sm, vertical = 10.dp),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
) { ) {
Checkbox( Box(modifier = Modifier.size(44.dp), contentAlignment = Alignment.Center) {
checked = selected, F7ThemeCheckbox(checked = selected, onToggle = onSelectedChange)
onCheckedChange = { onSelectedChange() }, }
colors = CheckboxDefaults.colors(checkedColor = F7Colors.Primary), Box(modifier = Modifier.size(30.dp)) {
)
AsyncImage( AsyncImage(
model = FileIcons.iconUrl(serverUrl, item.name, item.isDirectory), model = FileIcons.iconUrl(serverUrl, item.name, item.isDirectory),
contentDescription = null, contentDescription = null,
modifier = Modifier.size(24.dp), modifier = Modifier.size(30.dp),
contentScale = ContentScale.Fit, contentScale = ContentScale.Fit,
) )
if (item.favorite) {
AsyncImage(
model = FileIcons.chromeAsset("star-green-full.svg"),
contentDescription = "В избранном",
modifier = Modifier
.size(16.dp)
.offset(x = 20.dp, y = (-4).dp),
)
}
}
Text( Text(
text = buildAnnotatedString { text = buildAnnotatedString {
append(baseName) append(baseName)
@@ -823,17 +908,38 @@ fun FilesListRow(
}, },
modifier = Modifier modifier = Modifier
.weight(1f) .weight(1f)
.padding(horizontal = F7Spacing.sm), .padding(start = F7Spacing.sm, end = F7Spacing.xs),
style = MaterialTheme.typography.bodyMedium, style = MaterialTheme.typography.bodyMedium,
fontWeight = FontWeight.Medium, fontWeight = FontWeight.Medium,
color = F7Colors.TextPrimary, color = F7Colors.TextPrimary,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
) )
item.size?.takeIf { !item.isDirectory }?.let { size ->
Text(
text = formatFileSize(size),
modifier = Modifier.width(56.dp),
style = MaterialTheme.typography.bodyMedium,
color = F7Colors.TextPrimary,
maxLines = 1,
textAlign = TextAlign.Center,
)
}
item.lastModified?.let { mtime ->
Text(
text = formatRelativeTime(mtime),
modifier = Modifier.width(88.dp),
style = MaterialTheme.typography.bodyMedium,
color = F7Colors.TextPrimary,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
textAlign = TextAlign.End,
)
}
Box( Box(
modifier = Modifier modifier = Modifier
.size(36.dp) .width(32.dp)
.clip(RoundedCornerShape(8.dp)) .height(44.dp)
.clickable( .clickable(
interactionSource = remember { MutableInteractionSource() }, interactionSource = remember { MutableInteractionSource() },
indication = null, indication = null,
@@ -845,7 +951,7 @@ fun FilesListRow(
contentAlignment = Alignment.Center, contentAlignment = Alignment.Center,
) { ) {
AsyncImage( AsyncImage(
model = "${serverUrl.trimEnd('/')}/themes/forbion/images/files/dots-vertic-gray.svg", model = FileIcons.chromeAsset("dots-vertic-gray.svg"),
contentDescription = "Действия", contentDescription = "Действия",
modifier = Modifier.size(16.dp), modifier = Modifier.size(16.dp),
contentScale = ContentScale.Fit, contentScale = ContentScale.Fit,
@@ -854,6 +960,15 @@ fun FilesListRow(
} }
} }
/** Относительное время как в вебе (moment.js): «5 мин. назад», «вчера», иначе дата. */
internal fun formatRelativeTime(epochMillis: Long): String =
android.text.format.DateUtils.getRelativeTimeSpanString(
epochMillis,
System.currentTimeMillis(),
android.text.format.DateUtils.MINUTE_IN_MILLIS,
android.text.format.DateUtils.FORMAT_ABBREV_RELATIVE,
).toString()
@Composable @Composable
fun FileActionMenuPopup( fun FileActionMenuPopup(
expanded: Boolean, expanded: Boolean,
@@ -879,12 +994,14 @@ fun FileActionMenuPopup(
properties = PopupProperties(focusable = true), properties = PopupProperties(focusable = true),
) { ) {
Surface( Surface(
modifier = Modifier.widthIn(min = 260.dp, max = 320.dp), modifier = Modifier
shape = RoundedCornerShape(12.dp), .widthIn(min = 280.dp, max = 340.dp)
shadowElevation = 8.dp, .border(1.dp, F7Colors.Border, RoundedCornerShape(8.dp)),
shape = RoundedCornerShape(8.dp),
shadowElevation = 4.dp,
color = Color.White, color = Color.White,
) { ) {
Column(modifier = Modifier.padding(vertical = 6.dp)) { Column(modifier = Modifier.padding(4.dp)) {
entries.forEachIndexed { index, entry -> entries.forEachIndexed { index, entry ->
if (entry.destructive && index > 0) { if (entry.destructive && index > 0) {
HorizontalDivider( HorizontalDivider(
@@ -895,18 +1012,20 @@ fun FileActionMenuPopup(
Row( Row(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.heightIn(min = 25.dp)
.clip(RoundedCornerShape(6.dp))
.clickable { .clickable {
onDismiss() onDismiss()
onAction(entry.action) onAction(entry.action)
} }
.padding(horizontal = 14.dp, vertical = 11.dp), .padding(horizontal = 8.dp, vertical = 4.dp),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(12.dp), horizontalArrangement = Arrangement.spacedBy(8.dp),
) { ) {
AsyncImage( AsyncImage(
model = "$base/themes/forbion/images/${entry.iconPath}", model = "$base/themes/forbion/images/${entry.iconPath}",
contentDescription = null, contentDescription = null,
modifier = Modifier.size(18.dp), modifier = Modifier.size(16.dp),
contentScale = ContentScale.Fit, contentScale = ContentScale.Fit,
) )
Text( Text(
@@ -956,12 +1075,14 @@ fun FilesBulkActionMenuPopup(
properties = PopupProperties(focusable = true), properties = PopupProperties(focusable = true),
) { ) {
Surface( Surface(
modifier = Modifier.widthIn(min = 240.dp, max = 300.dp), modifier = Modifier
shape = RoundedCornerShape(12.dp), .widthIn(min = 240.dp, max = 300.dp)
shadowElevation = 8.dp, .border(1.dp, F7Colors.Border, RoundedCornerShape(8.dp)),
shape = RoundedCornerShape(8.dp),
shadowElevation = 4.dp,
color = Color.White, color = Color.White,
) { ) {
Column(modifier = Modifier.padding(vertical = 6.dp)) { Column(modifier = Modifier.padding(4.dp)) {
entries.forEachIndexed { index, (action, label, icon) -> entries.forEachIndexed { index, (action, label, icon) ->
if (index == entries.lastIndex) { if (index == entries.lastIndex) {
HorizontalDivider( HorizontalDivider(
@@ -1013,25 +1134,26 @@ fun FilesDetailsSheet(
) { ) {
if (item == null) return if (item == null) return
var commentDraft by remember(item.relativePath) { mutableStateOf("") } var commentDraft by remember(item.relativePath) { mutableStateOf("") }
androidx.compose.ui.window.Dialog(onDismissRequest = onDismiss) { // Живая тема: панель на весь экран, фон #FBFBFB, без скруглений.
androidx.compose.ui.window.Dialog(
onDismissRequest = onDismiss,
properties = androidx.compose.ui.window.DialogProperties(usePlatformDefaultWidth = false),
) {
Surface( Surface(
modifier = Modifier modifier = Modifier.fillMaxSize(),
.fillMaxWidth() color = F7Colors.Background,
.fillMaxHeight(0.92f),
shape = RoundedCornerShape(16.dp),
color = F7Colors.Surface,
) { ) {
Column( Column(
modifier = Modifier modifier = Modifier
.fillMaxSize() .fillMaxSize()
.padding(20.dp), .padding(horizontal = 16.dp, vertical = 12.dp),
) { ) {
// Крестик закрытия — правый верхний угол (по макету) // Крестик 40dp — правый верхний угол
Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End) { Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End) {
Box( Box(
modifier = Modifier modifier = Modifier
.size(28.dp) .size(40.dp)
.clip(CircleShape) .clip(RoundedCornerShape(8.dp))
.clickable(onClick = onDismiss), .clickable(onClick = onDismiss),
contentAlignment = Alignment.Center, contentAlignment = Alignment.Center,
) { ) {
@@ -1043,32 +1165,50 @@ fun FilesDetailsSheet(
) )
} }
} }
// Заголовок 18/600 + звезда 20 справа (живая тема)
Row( Row(
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(12.dp), horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.Top, verticalAlignment = Alignment.CenterVertically,
) { ) {
Column(modifier = Modifier.weight(1f)) {
Text( Text(
item.name, item.name,
style = MaterialTheme.typography.titleLarge, modifier = Modifier.weight(1f),
style = MaterialTheme.typography.titleMedium.copy(fontSize = 18.sp),
fontWeight = FontWeight.SemiBold, fontWeight = FontWeight.SemiBold,
maxLines = 2, color = F7Colors.TextPrimary,
maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
) )
AsyncImage(
model = FileIcons.chromeAsset(
if (item.favorite) "star-green-full.svg" else "star-gray.svg",
),
contentDescription = "Избранное",
modifier = Modifier
.size(20.dp)
.clickable(onClick = onToggleFavorite),
)
}
Spacer(Modifier.height(8.dp)) Spacer(Modifier.height(8.dp))
// Чип владельца (аватар-инициал + логин) — по макету // Чип владельца (пилюля 25dp) слева, «дата / размер» серым справа
Row(
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically,
) {
Row( Row(
modifier = Modifier modifier = Modifier
.height(25.dp)
.clip(RoundedCornerShape(100.dp)) .clip(RoundedCornerShape(100.dp))
.background(F7Colors.SurfaceMuted) .background(F7Colors.Background)
.padding(start = 4.dp, end = 10.dp, top = 4.dp, bottom = 4.dp), .border(1.dp, F7Colors.Border, RoundedCornerShape(100.dp))
.padding(horizontal = 4.dp),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(6.dp), horizontalArrangement = Arrangement.spacedBy(4.dp),
) { ) {
Box( Box(
modifier = Modifier modifier = Modifier
.size(20.dp) .size(16.dp)
.clip(CircleShape) .clip(CircleShape)
.background(F7Colors.PrimaryLight), .background(F7Colors.PrimaryLight),
contentAlignment = Alignment.Center, contentAlignment = Alignment.Center,
@@ -1082,14 +1222,13 @@ fun FilesDetailsSheet(
} }
Text( Text(
ownerLabel, ownerLabel,
style = MaterialTheme.typography.bodySmall, style = MaterialTheme.typography.labelMedium,
color = F7Colors.TextSecondary, color = F7Colors.TextPrimary,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
) )
} }
} Spacer(Modifier.weight(1f))
Column(horizontalAlignment = Alignment.End) {
val dateSize = buildList { val dateSize = buildList {
item.lastModified?.let { item.lastModified?.let {
add(SimpleDateFormat("d MMMM", Locale("ru")).format(Date(it))) add(SimpleDateFormat("d MMMM", Locale("ru")).format(Date(it)))
@@ -1099,20 +1238,9 @@ fun FilesDetailsSheet(
if (dateSize.isNotEmpty()) { if (dateSize.isNotEmpty()) {
Text( Text(
dateSize.joinToString(" / "), dateSize.joinToString(" / "),
style = MaterialTheme.typography.bodySmall, style = MaterialTheme.typography.bodyMedium,
color = F7Colors.TextSecondary, color = F7Colors.TextSecondary,
) )
Spacer(Modifier.height(8.dp))
}
Icon(
if (item.favorite) Icons.Filled.Star else Icons.Filled.StarBorder,
contentDescription = "Избранное",
tint = if (item.favorite) F7Colors.Primary else F7Colors.TextSecondary,
modifier = Modifier
.size(24.dp)
.clip(CircleShape)
.clickable(onClick = onToggleFavorite),
)
} }
} }
Spacer(Modifier.height(16.dp)) Spacer(Modifier.height(16.dp))
@@ -1121,14 +1249,14 @@ fun FilesDetailsSheet(
horizontalArrangement = Arrangement.spacedBy(12.dp), horizontalArrangement = Arrangement.spacedBy(12.dp),
) { ) {
FilesDetailsTabPill( FilesDetailsTabPill(
icon = Icons.Filled.ChatBubbleOutline, iconAsset = "comment-icon-black.svg",
contentDescription = "Обсуждение", contentDescription = "Обсуждение",
selected = tab == FileDetailsTab.Events, selected = tab == FileDetailsTab.Events,
onClick = { onTabChange(FileDetailsTab.Events) }, onClick = { onTabChange(FileDetailsTab.Events) },
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f),
) )
FilesDetailsTabPill( FilesDetailsTabPill(
icon = Icons.Filled.Group, iconAsset = "people-icon-black.svg",
contentDescription = "Общий доступ", contentDescription = "Общий доступ",
selected = tab == FileDetailsTab.Sharing, selected = tab == FileDetailsTab.Sharing,
onClick = { onTabChange(FileDetailsTab.Sharing) }, onClick = { onTabChange(FileDetailsTab.Sharing) },
@@ -1179,27 +1307,31 @@ fun FilesDetailsSheet(
@Composable @Composable
private fun FilesDetailsTabPill( private fun FilesDetailsTabPill(
icon: androidx.compose.ui.graphics.vector.ImageVector, iconAsset: String,
contentDescription: String, contentDescription: String,
selected: Boolean, selected: Boolean,
onClick: () -> Unit, onClick: () -> Unit,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
) { ) {
val shape = RoundedCornerShape(14.dp) // Живая тема: пилюля 30dp r100; активная — фон #ECF9DE, рамка #70B62B 20%; иконка темы 16.
val shape = RoundedCornerShape(100.dp)
Box( Box(
modifier = modifier modifier = modifier
.height(40.dp) .height(30.dp)
.clip(shape) .clip(shape)
.background(if (selected) F7Colors.PrimaryLight else F7Colors.Surface) .background(if (selected) F7Colors.PrimaryLight else F7Colors.Background)
.border(1.dp, if (selected) Color.Transparent else F7Colors.Border, shape) .border(
1.dp,
if (selected) F7Colors.Primary.copy(alpha = 0.2f) else F7Colors.Border,
shape,
)
.clickable(onClick = onClick), .clickable(onClick = onClick),
contentAlignment = Alignment.Center, contentAlignment = Alignment.Center,
) { ) {
Icon( AsyncImage(
icon, model = FileIcons.chromeAsset(iconAsset),
contentDescription = contentDescription, contentDescription = contentDescription,
tint = if (selected) F7Colors.Primary else F7Colors.TextSecondary, modifier = Modifier.size(16.dp),
modifier = Modifier.size(20.dp),
) )
} }
} }
@@ -172,6 +172,7 @@ fun FilesScreen(
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
loading = state.loading && displayItems.isEmpty(), loading = state.loading && displayItems.isEmpty(),
error = state.error, error = state.error,
onErrorRetry = { vm.refreshCurrent(session) },
headerActions = {}, headerActions = {},
) { ) {
Column(modifier = Modifier.fillMaxSize()) { Column(modifier = Modifier.fillMaxSize()) {
@@ -190,9 +191,8 @@ fun FilesScreen(
FilesViewToggleButton(viewMode) { FilesViewToggleButton(viewMode) {
viewMode = if (viewMode == FilesViewMode.List) FilesViewMode.Grid else FilesViewMode.List viewMode = if (viewMode == FilesViewMode.List) FilesViewMode.Grid else FilesViewMode.List
} }
// Создание (загрузка/новая папка) — раньше вызывалось из нижней панели, // Кнопки создания в шапке нет (живая тема): «Создать или загрузить» —
// теперь кнопка в шапке (нижняя панель стала навигационной) // градиентная кнопка сверху панели навигации.
F7CreateButton(onClick = { showCreateMenu = true }, size = 40.dp)
} }
// Хлебные крошки // Хлебные крошки
val crumbSegments = state.currentPath.split("/").filter { it.isNotBlank() } val crumbSegments = state.currentPath.split("/").filter { it.isNotBlank() }
@@ -202,9 +202,15 @@ fun FilesScreen(
onSegmentClick = { i -> vm.navigateToPath(session, crumbSegments.take(i + 1).joinToString("/")) }, onSegmentClick = { i -> vm.navigateToPath(session, crumbSegments.take(i + 1).joinToString("/")) },
) )
if (selectionMode) { if (selectionMode) {
val allSelected = displayItems.isNotEmpty() &&
state.selectedPaths.size >= displayItems.size
FilesBulkActionsBar( FilesBulkActionsBar(
serverUrl = session.serverUrl, serverUrl = session.serverUrl,
selectedCount = state.selectedPaths.size, selectedCount = state.selectedPaths.size,
allSelected = allSelected,
onToggleSelectAll = {
if (allSelected) vm.clearSelection() else vm.selectAllVisible()
},
onActionsClick = { rect -> onActionsClick = { rect ->
bulkMenuAnchor = rect bulkMenuAnchor = rect
bulkMenuOpen = true bulkMenuOpen = true
@@ -322,6 +328,10 @@ fun FilesScreen(
vm.showWebOnlyMessage(title) vm.showWebOnlyMessage(title)
onSidebarOpenChange(false) onSidebarOpenChange(false)
}, },
onCreateClick = {
onSidebarOpenChange(false)
showCreateMenu = true
},
) )
FilesCreateMenu( FilesCreateMenu(
+4
View File
@@ -29,8 +29,12 @@ dependencies {
implementation project(':core:designsystem') implementation project(':core:designsystem')
implementation project(':feature:files') implementation project(':feature:files')
implementation project(':feature:contacts') implementation project(':feature:contacts')
// создание задач/событий из письма (живой веб-паритет)
implementation project(':feature:tasks')
implementation project(':feature:calendar')
implementation libs.coroutines.android implementation libs.coroutines.android
implementation libs.json implementation libs.json
testImplementation libs.junit
def composeBom = platform(libs.compose.bom) def composeBom = platform(libs.compose.bom)
implementation composeBom implementation composeBom
implementation libs.compose.ui implementation libs.compose.ui
@@ -0,0 +1,4 @@
<svg width="35" height="32" viewBox="0 0 35 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M8.33398 18.9808V25.9711C8.33398 25.9761 8.33209 25.981 8.32873 25.9845C8.32537 25.9881 8.3208 25.9901 8.31605 25.9901H2.27416C2.2718 25.9901 2.26947 25.9896 2.2673 25.9887C2.26512 25.9877 2.26314 25.9863 2.26148 25.9845C2.25812 25.981 2.25623 25.9761 2.25623 25.9711V5.02973C2.25623 5.02724 2.25669 5.02477 2.25759 5.02246C2.25849 5.02016 2.25981 5.01807 2.26148 5.0163C2.26484 5.01274 2.2694 5.01074 2.27416 5.01074H19.7382C19.7415 5.01074 19.7447 5.01166 19.7475 5.01343C19.7503 5.0152 19.7526 5.01773 19.7541 5.02076C19.7556 5.0238 19.7564 5.02722 19.7562 5.03065C19.756 5.03409 19.755 5.03742 19.7532 5.04028L16.2595 10.7647C16.2578 10.7674 16.2555 10.7696 16.2528 10.771C16.2501 10.7725 16.2471 10.7732 16.244 10.7731H8.35192C8.34716 10.7731 8.3426 10.7751 8.33924 10.7787C8.33587 10.7823 8.33398 10.7871 8.33398 10.7921V13.1672C8.33398 13.1723 8.33587 13.1771 8.33924 13.1807C8.3426 13.1842 8.34716 13.1862 8.35192 13.1862H14.9303C14.9328 13.1862 14.9352 13.1867 14.9374 13.1878C14.9397 13.1888 14.9417 13.1903 14.9434 13.1922C14.9451 13.194 14.9464 13.1963 14.9472 13.1987C14.948 13.2011 14.9484 13.2037 14.9483 13.2063L14.6937 18.9439C14.6935 18.9487 14.6915 18.9533 14.6881 18.9566C14.6848 18.96 14.6804 18.9618 14.6758 18.9618H8.35192C8.34716 18.9618 8.3426 18.9638 8.33924 18.9674C8.33587 18.9709 8.33398 18.9758 8.33398 18.9808Z" fill="#151515"/>
<path d="M26.2675 10.8048C26.2877 10.7837 26.2836 10.7731 26.255 10.7731H17.7975C17.7762 10.7731 17.7714 10.7638 17.783 10.7452L21.3221 5.03395C21.3317 5.01848 21.3453 5.01074 21.3629 5.01074H33.5155C33.5188 5.01074 33.5219 5.01213 33.5243 5.0146C33.5266 5.01708 33.5279 5.02043 33.5279 5.02393V10.7494C33.5279 10.7673 33.5218 10.7826 33.5095 10.7953C31.0839 13.3392 28.8027 16.2518 27.1169 19.4365C26.3193 20.944 25.6677 22.6434 25.4834 24.3571C25.4296 24.8592 25.4445 25.4268 25.445 25.9632C25.445 25.9811 25.4367 25.9901 25.4201 25.9901H18.4337C18.4164 25.9901 18.4072 25.981 18.4063 25.9627C18.3571 24.9535 18.4315 23.9955 18.6294 23.0886C19.0753 21.0468 20.0567 19.0346 21.1572 17.2724C22.6248 14.9221 24.3809 12.7806 26.2675 10.8048Z" fill="#70B62B"/>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

@@ -18,6 +18,7 @@ import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.width
@@ -32,6 +33,7 @@ import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Checkbox import androidx.compose.material3.Checkbox
import androidx.compose.material3.CheckboxDefaults import androidx.compose.material3.CheckboxDefaults
import androidx.compose.material3.DropdownMenu import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.IconButton import androidx.compose.material3.IconButton
import androidx.compose.material3.MenuDefaults import androidx.compose.material3.MenuDefaults
@@ -46,6 +48,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.draw.shadow import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
@@ -328,8 +331,8 @@ fun MailNavigationSidebar(
Column( Column(
modifier = Modifier modifier = Modifier
.fillMaxHeight() .fillMaxHeight()
.fillMaxWidth(0.8f) .fillMaxWidth(0.9f)
.background(F7Colors.Surface) .background(F7Colors.Background)
.verticalScroll(rememberScrollState()) .verticalScroll(rememberScrollState())
.padding(horizontal = 12.dp, vertical = 12.dp), .padding(horizontal = 12.dp, vertical = 12.dp),
) { ) {
@@ -422,7 +425,10 @@ fun MailNavigationSidebar(
expanded = !collapsed, expanded = !collapsed,
onToggleExpanded = { onToggleAccountCollapsed(account.id) }, onToggleExpanded = { onToggleAccountCollapsed(account.id) },
) )
Spacer(Modifier.height(4.dp)) HorizontalDivider(
modifier = Modifier.padding(bottom = 8.dp),
color = F7Colors.Border,
)
} }
if (!collapsed) { if (!collapsed) {
accountFolders.forEach { folder -> accountFolders.forEach { folder ->
@@ -533,14 +539,17 @@ private fun MailSidebarRow(
title, title,
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f),
style = MaterialTheme.typography.bodyMedium, style = MaterialTheme.typography.bodyMedium,
fontWeight = if (selected) FontWeight.SemiBold else FontWeight.Medium, fontWeight = FontWeight.Medium,
color = F7Colors.TextPrimary,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
) )
if (unread != null && unread > 0) { if (unread != null && unread > 0) {
// Живая тема: счётчик 16/500, серый, без фона
Text( Text(
unread.toString(), unread.toString(),
style = MaterialTheme.typography.labelMedium, style = MaterialTheme.typography.bodyLarge,
fontWeight = FontWeight.Medium,
color = F7Colors.TextSecondary, color = F7Colors.TextSecondary,
) )
} }
@@ -598,7 +607,9 @@ fun MailEnvelopeRow(
val sender = message.fromEmail.takeIf { it.isNotBlank() } val sender = message.fromEmail.takeIf { it.isNotBlank() }
?: message.from.takeIf { it.isNotBlank() && !it.equals("Unknown", ignoreCase = true) } ?: message.from.takeIf { it.isNotBlank() && !it.equals("Unknown", ignoreCase = true) }
?: "Неизвестный" ?: "Неизвестный"
val mutedColor = F7Colors.TextSecondary // Живая тема (_mobile-mail.css): карточка #FDFDFD r8, нижняя граница #E6E6E6 + тень #CBCBCB,
// отправитель 16/500 чёрный, тема 14/600 и превью/дата 14/500 — чёрный 50%.
val fadedColor = Color(0x80151515)
val subject = message.subject.ifBlank { "(без темы)" } val subject = message.subject.ifBlank { "(без темы)" }
Box( Box(
@@ -606,14 +617,21 @@ fun MailEnvelopeRow(
.fillMaxWidth() .fillMaxWidth()
.shadow( .shadow(
elevation = 1.dp, elevation = 1.dp,
shape = RoundedCornerShape(12.dp), shape = RoundedCornerShape(8.dp),
spotColor = Color(0x14000000), spotColor = Color(0xFFCBCBCB),
) )
.clip(RoundedCornerShape(12.dp)) .clip(RoundedCornerShape(8.dp))
.background(MailCardSurface) .background(MailCardSurface)
.border(1.dp, F7Colors.Border.copy(alpha = 0.45f), RoundedCornerShape(12.dp)) .drawBehind {
drawLine(
color = Color(0xFFE6E6E6),
start = androidx.compose.ui.geometry.Offset(0f, size.height - 0.5f),
end = androidx.compose.ui.geometry.Offset(size.width, size.height - 0.5f),
strokeWidth = 1.dp.toPx(),
)
}
.clickable(onClick = onClick) .clickable(onClick = onClick)
.padding(12.dp), .padding(8.dp),
) { ) {
Row( Row(
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
@@ -624,7 +642,7 @@ fun MailEnvelopeRow(
email = message.fromEmail, email = message.fromEmail,
modifier = Modifier.size(40.dp), modifier = Modifier.size(40.dp),
) )
Spacer(Modifier.width(10.dp)) Spacer(Modifier.width(8.dp))
Column(modifier = Modifier.weight(1f)) { Column(modifier = Modifier.weight(1f)) {
Row( Row(
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
@@ -634,15 +652,15 @@ fun MailEnvelopeRow(
sender, sender,
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f),
style = MaterialTheme.typography.bodyLarge, style = MaterialTheme.typography.bodyLarge,
fontWeight = if (unread) FontWeight.SemiBold else FontWeight.Medium, fontWeight = FontWeight.Medium,
color = F7Colors.TextPrimary, color = F7Colors.TextPrimary,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
) )
Text( Text(
formatEnvelopeDate(message.dateInt), formatEnvelopeDate(message.dateInt),
style = MaterialTheme.typography.labelSmall, style = MaterialTheme.typography.bodyMedium,
color = mutedColor, color = fadedColor,
) )
if (message.flags.flagged) { if (message.flags.flagged) {
Spacer(Modifier.width(4.dp)) Spacer(Modifier.width(4.dp))
@@ -654,18 +672,27 @@ fun MailEnvelopeRow(
) )
} }
} }
Spacer(Modifier.height(4.dp))
Text( Text(
subject, subject,
style = MaterialTheme.typography.bodySmall, style = MaterialTheme.typography.bodyMedium,
fontWeight = FontWeight.Normal, fontWeight = FontWeight.SemiBold,
color = mutedColor, color = fadedColor,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
) )
if (message.preview.isNotBlank()) {
Text(
message.preview,
style = MaterialTheme.typography.bodyMedium,
fontWeight = FontWeight.Medium,
color = fadedColor,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
}
// Теги письма цветными пилюлями (макет «Список сообщений») // Теги письма цветными пилюлями (макет «Список сообщений»)
if (message.tags.isNotEmpty()) { if (message.tags.isNotEmpty()) {
Spacer(Modifier.height(6.dp)) Spacer(Modifier.height(4.dp))
Row(horizontalArrangement = Arrangement.spacedBy(4.dp)) { Row(horizontalArrangement = Arrangement.spacedBy(4.dp)) {
message.tags.take(4).forEach { MailTagChip(it) } message.tags.take(4).forEach { MailTagChip(it) }
} }
@@ -955,6 +982,8 @@ fun MailMessageSenderCard(
onMove: () -> Unit, onMove: () -> Unit,
onSnooze: () -> Unit, onSnooze: () -> Unit,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
onCreateTask: (() -> Unit)? = null,
onCreateEvent: (() -> Unit)? = null,
) { ) {
val base = serverUrl.trimEnd('/') val base = serverUrl.trimEnd('/')
var headersExpanded by remember { mutableStateOf(false) } var headersExpanded by remember { mutableStateOf(false) }
@@ -987,15 +1016,15 @@ fun MailMessageSenderCard(
MailAvatar( MailAvatar(
name = fromName, name = fromName,
email = fromEmail, email = fromEmail,
modifier = Modifier.size(44.dp), modifier = Modifier.size(40.dp),
) )
Spacer(Modifier.width(10.dp)) Spacer(Modifier.width(8.dp))
Column(modifier = Modifier.weight(1f)) { Column(modifier = Modifier.weight(1f)) {
Text( Text(
displayName, displayName,
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
style = MaterialTheme.typography.bodyLarge, style = MaterialTheme.typography.bodyLarge,
fontWeight = FontWeight.SemiBold, fontWeight = FontWeight.Medium,
color = F7Colors.TextPrimary, color = F7Colors.TextPrimary,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
@@ -1099,6 +1128,8 @@ fun MailMessageSenderCard(
onEditTags = onEditTags, onEditTags = onEditTags,
onMove = onMove, onMove = onMove,
onSnooze = onSnooze, onSnooze = onSnooze,
onCreateTask = onCreateTask,
onCreateEvent = onCreateEvent,
) )
} }
} }
@@ -1158,6 +1189,8 @@ fun MailMessageActionsMenu(
onEditTags: () -> Unit, onEditTags: () -> Unit,
onMove: () -> Unit, onMove: () -> Unit,
onSnooze: () -> Unit, onSnooze: () -> Unit,
onCreateTask: (() -> Unit)? = null,
onCreateEvent: (() -> Unit)? = null,
) { ) {
DropdownMenu( DropdownMenu(
expanded = expanded, expanded = expanded,
@@ -1211,6 +1244,18 @@ fun MailMessageActionsMenu(
onDismiss() onDismiss()
onEditTags() onEditTags()
} }
onCreateTask?.let { create ->
MailMessageIconMenuItem(serverUrl, "create-task-black.svg", "Создать задачу") {
onDismiss()
create()
}
}
onCreateEvent?.let { create ->
MailMessageIconMenuItem(serverUrl, "calendar-black.svg", "Создать событие") {
onDismiss()
create()
}
}
MailMessageIconMenuItem(serverUrl, "folder-black.svg", "Переместить сообщение") { MailMessageIconMenuItem(serverUrl, "folder-black.svg", "Переместить сообщение") {
onDismiss() onDismiss()
onMove() onMove()
@@ -1302,13 +1347,15 @@ fun MailMessageTagsSheet(
shape = RoundedCornerShape(16.dp), shape = RoundedCornerShape(16.dp),
color = Color.White, color = Color.White,
) { ) {
Column(modifier = Modifier.padding(16.dp)) { Column(modifier = Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
// Живая тема: заголовок модалки 18/600; строки тегов — плашки #F5F5F5 r10
// (minHeight 36), имя тега — цветная пилюля.
Text( Text(
"Изменить метки", "Изменить метки",
style = MaterialTheme.typography.titleMedium, style = MaterialTheme.typography.titleMedium.copy(fontSize = 18.sp),
fontWeight = FontWeight.SemiBold, fontWeight = FontWeight.SemiBold,
color = F7Colors.TextPrimary,
) )
Spacer(Modifier.height(12.dp))
if (availableTags.isEmpty()) { if (availableTags.isEmpty()) {
Text("Нет доступных меток", color = F7Colors.TextSecondary) Text("Нет доступных меток", color = F7Colors.TextSecondary)
} else { } else {
@@ -1317,17 +1364,20 @@ fun MailMessageTagsSheet(
Row( Row(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.clip(RoundedCornerShape(8.dp)) .heightIn(min = 36.dp)
.clip(RoundedCornerShape(10.dp))
.background(F7Colors.SurfaceMuted)
.clickable { onToggle(tag) } .clickable { onToggle(tag) }
.padding(vertical = 6.dp), .padding(horizontal = 8.dp, vertical = 4.dp),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp),
) { ) {
Checkbox( Checkbox(
checked = checked, checked = checked,
onCheckedChange = { onToggle(tag) }, onCheckedChange = { onToggle(tag) },
colors = CheckboxDefaults.colors(checkedColor = F7Colors.Primary), colors = CheckboxDefaults.colors(checkedColor = F7Colors.Primary),
) )
Text(tag.displayName, style = MaterialTheme.typography.bodyMedium) MailTagChip(tag)
} }
} }
} }
@@ -331,8 +331,8 @@ private fun MailComposeHeader(
Column(modifier = Modifier.weight(1f).padding(horizontal = 8.dp)) { Column(modifier = Modifier.weight(1f).padding(horizontal = 8.dp)) {
Text( Text(
title, title,
style = MaterialTheme.typography.titleMedium, style = MaterialTheme.typography.bodyLarge,
fontWeight = FontWeight.Bold, fontWeight = FontWeight.SemiBold,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
) )
@@ -457,11 +457,11 @@ private fun MailComposeField(
value = value, value = value,
onValueChange = onValueChange, onValueChange = onValueChange,
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f),
textStyle = TextStyle(fontSize = 15.sp, color = F7Colors.TextPrimary), textStyle = TextStyle(fontSize = 14.sp, lineHeight = 20.sp, color = F7Colors.TextPrimary),
cursorBrush = SolidColor(F7Colors.Primary), cursorBrush = SolidColor(F7Colors.Primary),
decorationBox = { inner -> decorationBox = { inner ->
if (value.isEmpty()) { if (value.isEmpty()) {
Text(label, color = F7Colors.TextSecondary, fontSize = 15.sp) Text(label, color = F7Colors.TextSecondary, fontSize = 14.sp)
} }
inner() inner()
}, },
@@ -507,10 +507,11 @@ private fun MailComposeFormattingToolbar(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.padding(horizontal = 12.dp) .padding(horizontal = 12.dp)
.clip(RoundedCornerShape(10.dp)) .shadow(1.dp, RoundedCornerShape(8.dp), spotColor = F7Colors.Border)
.border(1.dp, F7Colors.Border, RoundedCornerShape(10.dp)) .clip(RoundedCornerShape(8.dp))
.background(Color.White) .border(1.dp, F7Colors.Border, RoundedCornerShape(8.dp))
.padding(8.dp), .background(Color(0xFFFDFDFD))
.padding(4.dp),
verticalArrangement = Arrangement.spacedBy(6.dp), verticalArrangement = Arrangement.spacedBy(6.dp),
) { ) {
Row( Row(
@@ -0,0 +1,325 @@
package ru.forbion.f7cloud.feature.mail
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Checkbox
import androidx.compose.material3.CheckboxDefaults
import androidx.compose.material3.DatePicker
import androidx.compose.material3.DatePickerDialog
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.rememberDatePickerState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties
import ru.forbion.f7cloud.core.designsystem.F7Colors
import ru.forbion.f7cloud.core.designsystem.F7OutlinedField
import ru.forbion.f7cloud.core.designsystem.F7PrimaryButton
import ru.forbion.f7cloud.core.designsystem.F7SecondaryButton
import java.time.Instant
import java.time.LocalDate
import java.time.ZoneId
import java.time.format.DateTimeFormatter
/** Выбор из вариантов «плашками» — как строки в модалках живой темы (#F5F5F5, r10, 36dp). */
@Composable
private fun <T> PickerRows(
options: List<T>,
selected: T?,
label: (T) -> String,
onSelect: (T) -> Unit,
) {
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
options.forEach { option ->
val isSelected = option == selected
Row(
modifier = Modifier
.fillMaxWidth()
.heightIn(min = 36.dp)
.clip(RoundedCornerShape(10.dp))
.background(if (isSelected) F7Colors.PrimaryLight else F7Colors.SurfaceMuted)
.then(
if (isSelected) {
Modifier.border(
1.dp,
F7Colors.Primary.copy(alpha = 0.25f),
RoundedCornerShape(10.dp),
)
} else {
Modifier
},
)
.clickable { onSelect(option) }
.padding(horizontal = 10.dp, vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Text(
label(option),
style = MaterialTheme.typography.bodyMedium,
color = F7Colors.TextPrimary,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
}
}
}
}
@Composable
private fun CreateSheetScaffold(
title: String,
onDismiss: () -> Unit,
content: @Composable () -> Unit,
) {
Dialog(
onDismissRequest = onDismiss,
properties = DialogProperties(usePlatformDefaultWidth = false),
) {
Surface(
modifier = Modifier
.fillMaxWidth(0.94f)
.heightIn(max = 620.dp),
shape = RoundedCornerShape(16.dp),
color = Color.White,
) {
Column(
modifier = Modifier
.verticalScroll(rememberScrollState())
.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(10.dp),
) {
// Живая тема: заголовки модалок 18/600
Text(
title,
style = MaterialTheme.typography.titleMedium.copy(fontSize = 18.sp),
fontWeight = FontWeight.SemiBold,
color = F7Colors.TextPrimary,
)
content()
}
}
}
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
private fun DueDateRow(dueDate: LocalDate?, onChange: (LocalDate?) -> Unit) {
var pickerOpen by remember { mutableStateOf(false) }
Row(
modifier = Modifier
.fillMaxWidth()
.heightIn(min = 36.dp)
.clip(RoundedCornerShape(10.dp))
.background(F7Colors.SurfaceMuted)
.clickable { pickerOpen = true }
.padding(horizontal = 10.dp, vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Text(
dueDate?.format(DateTimeFormatter.ofPattern("d MMMM yyyy"))
?: "Срок не задан (нажмите, чтобы выбрать)",
modifier = Modifier.weight(1f),
style = MaterialTheme.typography.bodyMedium,
color = if (dueDate != null) F7Colors.TextPrimary else F7Colors.TextSecondary,
)
if (dueDate != null) {
Text(
"Сбросить",
style = MaterialTheme.typography.bodyMedium,
color = F7Colors.Primary,
modifier = Modifier.clickable { onChange(null) },
)
}
}
if (pickerOpen) {
val state = rememberDatePickerState(
initialSelectedDateMillis = (dueDate ?: LocalDate.now())
.atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli(),
)
DatePickerDialog(
onDismissRequest = { pickerOpen = false },
confirmButton = {
TextButton(onClick = {
state.selectedDateMillis?.let { millis ->
onChange(
Instant.ofEpochMilli(millis).atZone(ZoneId.systemDefault()).toLocalDate(),
)
}
pickerOpen = false
}) { Text("ОК", color = F7Colors.Primary) }
},
dismissButton = {
TextButton(onClick = { pickerOpen = false }) {
Text("Отмена", color = F7Colors.TextSecondary)
}
},
) {
DatePicker(state = state)
}
}
}
/** Модалка «Создать задачу» из письма (паритет живого веба). */
@Composable
fun MailCreateTaskSheet(
visible: Boolean,
taskLists: List<MailTargetList>,
defaultSummary: String,
defaultDescription: String,
creating: Boolean,
onDismiss: () -> Unit,
onCreate: (listHref: String, summary: String, description: String, due: LocalDate?) -> Unit,
) {
if (!visible) return
var summary by rememberSaveable(defaultSummary) { mutableStateOf(defaultSummary) }
var description by rememberSaveable(defaultDescription) { mutableStateOf(defaultDescription) }
var dueDate by remember { mutableStateOf<LocalDate?>(null) }
var selectedList by remember(taskLists) { mutableStateOf(taskLists.firstOrNull()) }
CreateSheetScaffold(title = "Создать задачу", onDismiss = onDismiss) {
F7OutlinedField(value = summary, onValueChange = { summary = it }, label = "Название")
F7OutlinedField(
value = description,
onValueChange = { description = it },
label = "Описание",
minLines = 3,
)
if (taskLists.isNotEmpty()) {
Text("Список задач", style = MaterialTheme.typography.bodyMedium, color = F7Colors.TextSecondary)
PickerRows(
options = taskLists,
selected = selectedList,
label = { it.name },
onSelect = { selectedList = it },
)
}
Text("Срок", style = MaterialTheme.typography.bodyMedium, color = F7Colors.TextSecondary)
DueDateRow(dueDate) { dueDate = it }
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
F7SecondaryButton("Отмена", onClick = onDismiss, modifier = Modifier.weight(1f))
F7PrimaryButton(
text = if (creating) "Создание…" else "Создать",
onClick = {
selectedList?.let { onCreate(it.href, summary.trim(), description.trim(), dueDate) }
},
enabled = !creating && summary.isNotBlank() && selectedList != null,
modifier = Modifier.weight(1f),
)
}
}
}
/** Модалка «Создать событие» из письма (паритет живого веба). */
@Composable
fun MailCreateEventSheet(
visible: Boolean,
calendars: List<MailTargetList>,
defaultTitle: String,
defaultDescription: String,
creating: Boolean,
onDismiss: () -> Unit,
onCreate: (
calendarHref: String,
title: String,
description: String,
date: LocalDate,
startTime: String,
endTime: String,
allDay: Boolean,
) -> Unit,
) {
if (!visible) return
var title by rememberSaveable(defaultTitle) { mutableStateOf(defaultTitle) }
var description by rememberSaveable(defaultDescription) { mutableStateOf(defaultDescription) }
var date by remember { mutableStateOf(LocalDate.now()) }
var startTime by rememberSaveable { mutableStateOf("10:00") }
var endTime by rememberSaveable { mutableStateOf("11:00") }
var allDay by rememberSaveable { mutableStateOf(false) }
var selectedCalendar by remember(calendars) { mutableStateOf(calendars.firstOrNull()) }
CreateSheetScaffold(title = "Создать событие", onDismiss = onDismiss) {
F7OutlinedField(value = title, onValueChange = { title = it }, label = "Название")
Text("Дата", style = MaterialTheme.typography.bodyMedium, color = F7Colors.TextSecondary)
DueDateRow(date) { picked -> picked?.let { date = it } }
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(4.dp),
) {
Checkbox(
checked = allDay,
onCheckedChange = { allDay = it },
colors = CheckboxDefaults.colors(checkedColor = F7Colors.Primary),
)
Text("Весь день", style = MaterialTheme.typography.bodyMedium, color = F7Colors.TextPrimary)
}
if (!allDay) {
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
Box(modifier = Modifier.weight(1f)) {
F7OutlinedField(value = startTime, onValueChange = { startTime = it }, label = "Начало (ЧЧ:ММ)")
}
Box(modifier = Modifier.weight(1f)) {
F7OutlinedField(value = endTime, onValueChange = { endTime = it }, label = "Конец (ЧЧ:ММ)")
}
}
}
if (calendars.isNotEmpty()) {
Text("Календарь", style = MaterialTheme.typography.bodyMedium, color = F7Colors.TextSecondary)
PickerRows(
options = calendars,
selected = selectedCalendar,
label = { it.name },
onSelect = { selectedCalendar = it },
)
}
F7OutlinedField(
value = description,
onValueChange = { description = it },
label = "Описание",
minLines = 3,
)
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
F7SecondaryButton("Отмена", onClick = onDismiss, modifier = Modifier.weight(1f))
F7PrimaryButton(
text = if (creating) "Создание…" else "Создать",
onClick = {
selectedCalendar?.let {
onCreate(it.href, title.trim(), description.trim(), date, startTime, endTime, allDay)
}
},
enabled = !creating && title.isNotBlank() && selectedCalendar != null,
modifier = Modifier.weight(1f),
)
}
}
}
/** Цель создания (список задач или календарь): href + имя. */
data class MailTargetList(val href: String, val name: String)
@@ -3,16 +3,24 @@ package ru.forbion.f7cloud.feature.mail
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.border import androidx.compose.foundation.border
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.BasicTextField import androidx.compose.foundation.text.BasicTextField
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Close
import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
@@ -31,6 +39,13 @@ import ru.forbion.f7cloud.core.designsystem.F7Colors
import ru.forbion.f7cloud.feature.contacts.ContactItem import ru.forbion.f7cloud.feature.contacts.ContactItem
import ru.forbion.f7cloud.feature.contacts.ContactListRow import ru.forbion.f7cloud.feature.contacts.ContactListRow
/**
* Поле получателей с чипами как в живой теме (_mobile-mail.css):
* подтверждённые адреса (сегменты строки через запятую) пилюли 26dp
* (фон #70B62B 12%, рамка 25%, текст 13/18, крестик 14), хвост инлайн-ввод.
* Значение остаётся строкой «a, b, черновик» VM/parseRecipients не меняются.
*/
@OptIn(ExperimentalLayoutApi::class)
@Composable @Composable
fun MailRecipientComposeField( fun MailRecipientComposeField(
label: String, label: String,
@@ -43,6 +58,19 @@ fun MailRecipientComposeField(
trailingIconUrl: String? = null, trailingIconUrl: String? = null,
onTrailingClick: (() -> Unit)? = null, onTrailingClick: (() -> Unit)? = null,
) { ) {
val parts = value.split(',').map { it.trim() }
val draft = if (value.trimEnd().endsWith(",")) "" else parts.lastOrNull().orEmpty()
val committed = (if (draft.isEmpty()) parts else parts.dropLast(1)).filter { it.isNotBlank() }
fun rebuild(newCommitted: List<String>, newDraft: String): String {
val head = newCommitted.joinToString(", ")
return when {
head.isEmpty() -> newDraft
newDraft.isEmpty() -> "$head, "
else -> "$head, $newDraft"
}
}
Box(modifier = Modifier.fillMaxWidth()) { Box(modifier = Modifier.fillMaxWidth()) {
Row( Row(
modifier = Modifier modifier = Modifier
@@ -51,27 +79,55 @@ fun MailRecipientComposeField(
.clip(RoundedCornerShape(8.dp)) .clip(RoundedCornerShape(8.dp))
.border(1.dp, F7Colors.Border, RoundedCornerShape(8.dp)) .border(1.dp, F7Colors.Border, RoundedCornerShape(8.dp))
.background(Color.White) .background(Color.White)
.padding(horizontal = 12.dp, vertical = 10.dp), .heightIn(min = 40.dp)
.padding(4.dp),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
) { ) {
BasicTextField( FlowRow(
value = value,
onValueChange = onValueChange,
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f),
textStyle = TextStyle(fontSize = 15.sp, color = F7Colors.TextPrimary), horizontalArrangement = androidx.compose.foundation.layout.Arrangement.spacedBy(4.dp),
cursorBrush = SolidColor(F7Colors.Primary), verticalArrangement = androidx.compose.foundation.layout.Arrangement.spacedBy(4.dp),
decorationBox = { inner -> ) {
if (value.isEmpty()) { committed.forEachIndexed { index, recipient ->
Text(label, color = F7Colors.TextSecondary, fontSize = 15.sp) RecipientChip(
} text = recipient,
inner() onRemove = {
val rest = committed.toMutableList().also { it.removeAt(index) }
onValueChange(rebuild(rest, draft))
}, },
) )
}
BasicTextField(
value = draft,
onValueChange = { new -> onValueChange(rebuild(committed, new)) },
modifier = Modifier
.widthIn(min = 80.dp)
.weight(1f)
.height(26.dp)
.padding(horizontal = 4.dp),
singleLine = true,
textStyle = TextStyle(
fontSize = 14.sp,
lineHeight = 20.sp,
color = F7Colors.TextPrimary,
),
cursorBrush = SolidColor(F7Colors.Primary),
decorationBox = { inner ->
Box(contentAlignment = Alignment.CenterStart, modifier = Modifier.height(26.dp)) {
if (draft.isEmpty() && committed.isEmpty()) {
Text(label, color = F7Colors.TextSecondary, fontSize = 14.sp)
}
inner()
}
},
)
}
if (trailingIconUrl != null && onTrailingClick != null) { if (trailingIconUrl != null && onTrailingClick != null) {
AsyncImage( AsyncImage(
model = trailingIconUrl, model = trailingIconUrl,
contentDescription = null, contentDescription = null,
modifier = Modifier modifier = Modifier
.padding(end = 4.dp)
.size(16.dp) .size(16.dp)
.clickable(onClick = onTrailingClick), .clickable(onClick = onTrailingClick),
contentScale = ContentScale.Fit, contentScale = ContentScale.Fit,
@@ -107,3 +163,39 @@ fun MailRecipientComposeField(
} }
} }
} }
@Composable
private fun RecipientChip(text: String, onRemove: () -> Unit) {
Row(
modifier = Modifier
.height(26.dp)
.clip(RoundedCornerShape(100.dp))
.background(F7Colors.Primary.copy(alpha = 0.12f))
.border(1.dp, F7Colors.Primary.copy(alpha = 0.25f), RoundedCornerShape(100.dp))
.padding(start = 6.dp, end = 8.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = androidx.compose.foundation.layout.Arrangement.spacedBy(4.dp),
) {
Text(
text,
fontSize = 13.sp,
lineHeight = 18.sp,
color = F7Colors.TextPrimary,
maxLines = 1,
overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis,
modifier = Modifier.widthIn(max = 220.dp),
)
Icon(
imageVector = Icons.Filled.Close,
contentDescription = "Убрать получателя",
tint = F7Colors.TextPrimary.copy(alpha = 0.5f),
modifier = Modifier
.size(14.dp)
.clickable(
interactionSource = androidx.compose.runtime.remember { MutableInteractionSource() },
indication = null,
onClick = onRemove,
),
)
}
}
@@ -967,7 +967,115 @@ class MailRepository {
}.sortedByDescending { it.updatedAt } }.sortedByDescending { it.updatedAt }
} }
// --- Фильтры почты: официальный API NC Mail (тот же, что у веб-модалки «Новый фильтр») ---
// GET/PUT /apps/mail/api/filter/{accountId}; сервер сам сериализует в sieve-скрипт
// (секция «### Nextcloud Mail: Filters ###»), правила ОБЩИЕ между вебом и приложением.
fun getMailFilters(session: AuthSession, accountId: Int): List<MailFilterRule> {
val client = authedClient(session)
val array = getJsonArray(client, "${apiBase(session)}/filter/$accountId")
return buildList {
for (i in 0 until array.length()) {
array.optJSONObject(i)?.let { add(MailFilterRule(it)) }
}
}
}
fun putMailFilters(session: AuthSession, accountId: Int, filters: List<MailFilterRule>) {
val client = authedClient(session)
val payload = JSONObject()
.put("filters", JSONArray().apply { filters.forEach { put(it.raw) } })
.toString()
val request = Request.Builder()
.url("${apiBase(session)}/filter/$accountId")
.header("OCS-APIRequest", "true")
.header("Accept", "application/json")
.put(payload.toRequestBody("application/json".toMediaType()))
.build()
client.newCall(request).execute().use { response ->
if (!response.isSuccessful) {
error("Filter API HTTP ${response.code}")
}
}
}
companion object { companion object {
const val PAGE_SIZE = 20 const val PAGE_SIZE = 20
} }
} }
/**
* Правило фильтра почты. Держим исходный JSON (raw) целиком, чтобы при правке
* простых полей не терять незнакомые поля сложных правил, созданных в вебе.
*/
class MailFilterRule(val raw: JSONObject) {
val name: String get() = raw.optString("name")
val enable: Boolean get() = raw.optBoolean("enable", true)
val operator: String get() = raw.optString("operator", "allof")
val priority: Int get() = raw.optInt("priority", 10)
val tests: List<Triple<String, String, List<String>>>
get() = raw.optJSONArray("tests")?.let { arr ->
buildList {
for (i in 0 until arr.length()) {
val t = arr.optJSONObject(i) ?: continue
val values = t.optJSONArray("values")?.let { v ->
(0 until v.length()).map { v.optString(it) }
}.orEmpty()
add(Triple(t.optString("field"), t.optString("operator", "contains"), values))
}
}
}.orEmpty()
val actions: List<JSONObject>
get() = raw.optJSONArray("actions")?.let { arr ->
(0 until arr.length()).mapNotNull { arr.optJSONObject(it) }
}.orEmpty()
/** Простое правило (1 тест, действия из нашего конструктора) — редактируемо инлайн. */
val isSimple: Boolean
get() = tests.size == 1 && actions.all {
it.optString("type") in setOf("fileinto", "addflag", "addsystemflag")
}
fun withEnable(value: Boolean): MailFilterRule =
MailFilterRule(JSONObject(raw.toString()).put("enable", value))
companion object {
fun simple(
name: String,
field: String,
contains: String,
action: String,
targetFolder: String,
priority: Int = 10,
): MailFilterRule {
val actions = JSONArray()
when (action) {
"markread" -> actions.put(
JSONObject().put("type", "addsystemflag").put("flag", "\\Seen"),
)
else -> actions.put(
JSONObject().put("type", "fileinto").put("mailbox", targetFolder),
)
}
return MailFilterRule(
JSONObject()
.put("name", name)
.put("enable", true)
.put("operator", "allof")
.put("priority", priority)
.put(
"tests",
JSONArray().put(
JSONObject()
.put("field", field)
.put("operator", "contains")
.put("values", JSONArray().put(contains)),
),
)
.put("actions", actions),
)
}
}
}
@@ -24,6 +24,8 @@ import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.pulltorefresh.PullToRefreshBox
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState import androidx.compose.runtime.collectAsState
@@ -46,6 +48,7 @@ import androidx.lifecycle.viewmodel.compose.viewModel
import ru.forbion.f7cloud.core.auth.AuthSession import ru.forbion.f7cloud.core.auth.AuthSession
import androidx.activity.compose.BackHandler import androidx.activity.compose.BackHandler
import ru.forbion.f7cloud.core.designsystem.F7Colors import ru.forbion.f7cloud.core.designsystem.F7Colors
import ru.forbion.f7cloud.core.designsystem.F7ErrorState
import ru.forbion.f7cloud.core.designsystem.F7OverlayDismissHandler import ru.forbion.f7cloud.core.designsystem.F7OverlayDismissHandler
import ru.forbion.f7cloud.core.designsystem.f7SwipeFromRightToDismiss import ru.forbion.f7cloud.core.designsystem.f7SwipeFromRightToDismiss
import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.compose.rememberLauncherForActivityResult
@@ -246,6 +249,23 @@ fun MailScreen(
onSettingsOpenChange(false) onSettingsOpenChange(false)
}, },
onSwipeBack = { mailNavigateBack() }, onSwipeBack = { mailNavigateBack() },
onOpenSieveFilters = { accountId -> vm.openSieveFilters(session, accountId) },
)
MailSieveFiltersSheet(
visible = state.sieveAccountId != null,
rules = state.sieveRules,
folders = state.mailboxes
.filter { it.accountId == state.sieveAccountId && !it.isInbox && it.specialRole.isNullOrBlank() }
.map { it.displayName },
loading = state.sieveLoading,
saving = state.sieveSaving,
error = state.sieveError,
onDismiss = { vm.closeSieveFilters() },
onAdd = { rule -> vm.addFilterRule(session, rule) },
onUpdate = { index, rule -> vm.updateFilterRule(session, index, rule) },
onDelete = { index -> vm.deleteFilterRule(session, index) },
onToggle = { index, enable -> vm.toggleFilterRule(session, index, enable) },
) )
BackHandler(enabled = mailCanGoBack) { BackHandler(enabled = mailCanGoBack) {
@@ -462,6 +482,34 @@ fun MailScreen(
openScheduledReplyForMessage(detail, option) openScheduledReplyForMessage(detail, option)
}, },
) )
// «Создать задачу/событие из письма» — паритет живого веба:
// префилл темой письма и отправителем.
val createDefaults = state.messageDetail?.let { detail ->
detail.subject.ifBlank { "(без темы)" } to
"Из письма от ${detail.from.ifBlank { detail.fromEmail }}"
}
MailCreateTaskSheet(
visible = state.createTaskSheetOpen,
taskLists = state.createTargets,
defaultSummary = createDefaults?.first.orEmpty(),
defaultDescription = createDefaults?.second.orEmpty(),
creating = state.creatingFromMessage,
onDismiss = vm::dismissCreateSheets,
onCreate = { listHref, summary, description, due ->
vm.createTaskFromMessage(session, listHref, summary, description, due)
},
)
MailCreateEventSheet(
visible = state.createEventSheetOpen,
calendars = state.createTargets,
defaultTitle = createDefaults?.first.orEmpty(),
defaultDescription = createDefaults?.second.orEmpty(),
creating = state.creatingFromMessage,
onDismiss = vm::dismissCreateSheets,
onCreate = { calHref, title, description, date, start, end, allDay ->
vm.createEventFromMessage(session, calHref, title, description, date, start, end, allDay)
},
)
} }
} else { } else {
MailInboxScreen( MailInboxScreen(
@@ -485,6 +533,8 @@ fun MailScreen(
onOutboxRetry = { vm.retryOutboxMessage(session, it) }, onOutboxRetry = { vm.retryOutboxMessage(session, it) },
onOutboxDelete = { vm.deleteOutboxMessage(session, it) }, onOutboxDelete = { vm.deleteOutboxMessage(session, it) },
onLoadMore = { vm.loadMore(session) }, onLoadMore = { vm.loadMore(session) },
refreshing = state.loading,
onRefresh = { vm.load(session, forceRefresh = true) },
) )
} }
MailNavigationSidebar( MailNavigationSidebar(
@@ -520,6 +570,7 @@ fun MailScreen(
} }
} }
@OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
private fun MailInboxScreen( private fun MailInboxScreen(
session: AuthSession, session: AuthSession,
@@ -542,6 +593,8 @@ private fun MailInboxScreen(
onOutboxRetry: (Int) -> Unit, onOutboxRetry: (Int) -> Unit,
onOutboxDelete: (Int) -> Unit, onOutboxDelete: (Int) -> Unit,
onLoadMore: () -> Unit, onLoadMore: () -> Unit,
refreshing: Boolean = false,
onRefresh: () -> Unit = {},
) { ) {
val listItems = remember(messages) { buildMailInboxListItems(messages) } val listItems = remember(messages) { buildMailInboxListItems(messages) }
val folderTitle = mailFolderListTitle(selectedFolder, searchQuery, searchParams) val folderTitle = mailFolderListTitle(selectedFolder, searchQuery, searchParams)
@@ -592,14 +645,14 @@ private fun MailInboxScreen(
color = F7Colors.TextPrimary, color = F7Colors.TextPrimary,
) )
} }
if (!error.isNullOrBlank()) { PullToRefreshBox(
Text(text = error, color = F7Colors.Error, style = MaterialTheme.typography.bodyMedium) isRefreshing = refreshing && !loading,
} onRefresh = onRefresh,
Box(
modifier = Modifier modifier = Modifier
.weight(1f) .weight(1f)
.fillMaxWidth(), .fillMaxWidth(),
) { ) {
Box(modifier = Modifier.fillMaxSize()) {
if (loading) { if (loading) {
Box( Box(
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
@@ -633,11 +686,25 @@ private fun MailInboxScreen(
} }
return@Box return@Box
} }
if (messages.isEmpty()) { if (messages.isEmpty() && !error.isNullOrBlank()) {
Box( F7ErrorState(
message = error,
onRetry = onRefresh,
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.Center, )
} else if (messages.isEmpty()) {
// Живая тема: пустая папка — цветная иконка почты 64dp + текст 16/20
Column(
modifier = Modifier.fillMaxSize(),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
) { ) {
coil.compose.AsyncImage(
model = "file:///android_asset/mailchrome/mail-icon-color.svg",
contentDescription = null,
modifier = Modifier.size(64.dp),
)
Spacer(Modifier.height(12.dp))
Text( Text(
if (searchQuery.isNotBlank() || searchParams.isActive()) { if (searchQuery.isNotBlank() || searchParams.isActive()) {
"Ничего не найдено" "Ничего не найдено"
@@ -666,7 +733,8 @@ private fun MailInboxScreen(
LazyColumn( LazyColumn(
state = listState, state = listState,
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
verticalArrangement = Arrangement.spacedBy(8.dp), // Живая тема: зазор между карточками писем 2px
verticalArrangement = Arrangement.spacedBy(2.dp),
) { ) {
items( items(
listItems, listItems,
@@ -707,6 +775,7 @@ private fun MailInboxScreen(
} }
} }
} }
}
@Composable @Composable
private fun MailMessageDetailHeader( private fun MailMessageDetailHeader(
@@ -759,6 +828,8 @@ private fun MailMessageDetailHeader(
onEditTags = onTagsSheetOpen, onEditTags = onTagsSheetOpen,
onMove = onMoveSheetOpen, onMove = onMoveSheetOpen,
onSnooze = onSnoozeSheetOpen, onSnooze = onSnoozeSheetOpen,
onCreateTask = { vm.openCreateTaskSheet(session) },
onCreateEvent = { vm.openCreateEventSheet(session) },
) )
} }
@@ -77,6 +77,7 @@ fun MailSettingsSheet(
onDeleteTextBlock: (Int) -> Unit, onDeleteTextBlock: (Int) -> Unit,
onDismiss: () -> Unit, onDismiss: () -> Unit,
onSwipeBack: () -> Unit = onDismiss, onSwipeBack: () -> Unit = onDismiss,
onOpenSieveFilters: ((Int) -> Unit)? = null,
) { ) {
if (!visible) return if (!visible) return
LaunchedEffect(visible, editingAccountId) { LaunchedEffect(visible, editingAccountId) {
@@ -102,6 +103,9 @@ fun MailSettingsSheet(
mailboxes = mailboxes.filter { it.accountId == editingAccountId }, mailboxes = mailboxes.filter { it.accountId == editingAccountId },
onBack = onAccountSettingsBack, onBack = onAccountSettingsBack,
onSave = onSaveAccountSettings, onSave = onSaveAccountSettings,
onOpenSieveFilters = onOpenSieveFilters?.let { open ->
{ open(editingAccountId) }
},
) )
} else { } else {
MailAppSettingsScreen( MailAppSettingsScreen(
@@ -517,6 +521,7 @@ private fun MailAccountSettingsScreen(
mailboxes: List<MailMailbox>, mailboxes: List<MailMailbox>,
onBack: () -> Unit, onBack: () -> Unit,
onSave: (MailAccountSettings) -> Unit, onSave: (MailAccountSettings) -> Unit,
onOpenSieveFilters: (() -> Unit)? = null,
) { ) {
var draft by remember { mutableStateOf<MailAccountSettings?>(null) } var draft by remember { mutableStateOf<MailAccountSettings?>(null) }
LaunchedEffect(settings) { LaunchedEffect(settings) {
@@ -567,6 +572,27 @@ private fun MailAccountSettingsScreen(
draft!!.quotaPercentage?.let { quota -> draft!!.quotaPercentage?.let { quota ->
MailSettingsInfoRow("Квота", "$quota%") MailSettingsInfoRow("Квота", "$quota%")
} }
onOpenSieveFilters?.let { open ->
// Sieve-фильтры (паритет живого веба)
Row(
modifier = Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(10.dp))
.background(F7Colors.SurfaceMuted)
.clickable(onClick = open)
.padding(horizontal = 12.dp, vertical = 10.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Text(
"Фильтры",
modifier = Modifier.weight(1f),
style = MaterialTheme.typography.bodyMedium,
fontWeight = FontWeight.Medium,
color = F7Colors.TextPrimary,
)
Text("", style = MaterialTheme.typography.titleMedium, color = F7Colors.TextSecondary)
}
}
MailSettingsTextArea( MailSettingsTextArea(
label = "Подпись", label = "Подпись",
value = draft!!.signature, value = draft!!.signature,
@@ -0,0 +1,306 @@
package ru.forbion.f7cloud.feature.mail
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Close
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Switch
import androidx.compose.material3.SwitchDefaults
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties
import ru.forbion.f7cloud.core.designsystem.F7Colors
import ru.forbion.f7cloud.core.designsystem.F7OutlinedField
import ru.forbion.f7cloud.core.designsystem.F7PrimaryButton
import ru.forbion.f7cloud.core.designsystem.F7SecondaryButton
private val FIELD_OPTIONS = listOf("from" to "От", "subject" to "Тема", "to" to "Кому")
private val ACTION_OPTIONS = listOf(
"fileinto" to "Переместить в папку",
"markread" to "Пометить прочитанным",
)
/** Пилюля-переключатель варианта (чипы живой темы: актив — #ECF9DE). */
@Composable
private fun OptionChip(text: String, selected: Boolean, onClick: () -> Unit) {
Box(
modifier = Modifier
.heightIn(min = 25.dp)
.clip(RoundedCornerShape(100.dp))
.background(if (selected) F7Colors.PrimaryLight else F7Colors.SurfaceMuted)
.clickable(onClick = onClick)
.padding(horizontal = 10.dp, vertical = 4.dp),
contentAlignment = Alignment.Center,
) {
Text(text, style = MaterialTheme.typography.bodyMedium, color = F7Colors.TextPrimary)
}
}
private fun ruleSummary(rule: MailFilterRule): String {
val tests = rule.tests.joinToString("; ") { (field, op, values) ->
val fieldLabel = FIELD_OPTIONS.firstOrNull { it.first == field }?.second ?: field
"$fieldLabel $op «${values.joinToString(", ")}»"
}
val actions = rule.actions.joinToString("; ") { action ->
when (action.optString("type")) {
"fileinto" -> "в папку «${action.optString("mailbox")}»"
"addflag", "addsystemflag" ->
if (action.optString("flag").contains("Seen")) "пометить прочитанным"
else "флаг «${action.optString("flag")}»"
"keep" -> "оставить"
"stop" -> "стоп"
else -> action.optString("type")
}
}
return "$tests$actions"
}
/**
* Фильтры почты общие с веб-версией (официальный API NC Mail).
* Список всех правил (вкл/выкл, удаление), редактирование простых, конструктор нового.
*/
@Composable
fun MailSieveFiltersSheet(
visible: Boolean,
rules: List<MailFilterRule>,
folders: List<String>,
loading: Boolean,
saving: Boolean,
error: String?,
onDismiss: () -> Unit,
onAdd: (MailFilterRule) -> Unit,
onUpdate: (Int, MailFilterRule) -> Unit,
onDelete: (Int) -> Unit,
onToggle: (Int, Boolean) -> Unit,
) {
if (!visible) return
var name by rememberSaveable { mutableStateOf("") }
var field by rememberSaveable { mutableStateOf("subject") }
var contains by rememberSaveable { mutableStateOf("") }
var action by rememberSaveable { mutableStateOf("fileinto") }
var targetFolder by rememberSaveable(folders) { mutableStateOf(folders.firstOrNull().orEmpty()) }
// -1 = создание нового; иначе — индекс редактируемого правила
var editingIndex by rememberSaveable { mutableIntStateOf(-1) }
fun loadIntoForm(rule: MailFilterRule) {
name = rule.name
rule.tests.firstOrNull()?.let { (f, _, values) ->
field = f
contains = values.joinToString(", ")
}
val act = rule.actions.firstOrNull()
action = if (act?.optString("type") == "fileinto") "fileinto" else "markread"
if (act?.optString("type") == "fileinto") {
targetFolder = act.optString("mailbox")
}
}
fun clearForm() {
name = ""
contains = ""
editingIndex = -1
}
Dialog(
onDismissRequest = onDismiss,
properties = DialogProperties(usePlatformDefaultWidth = false),
) {
Surface(
modifier = Modifier
.fillMaxWidth(0.94f)
.heightIn(max = 660.dp),
shape = RoundedCornerShape(16.dp),
color = Color.White,
) {
Column(
modifier = Modifier
.verticalScroll(rememberScrollState())
.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(10.dp),
) {
Text(
"Фильтры",
style = MaterialTheme.typography.titleMedium.copy(fontSize = 18.sp),
fontWeight = FontWeight.SemiBold,
color = F7Colors.TextPrimary,
)
when {
loading -> Box(
modifier = Modifier.fillMaxWidth().padding(vertical = 16.dp),
contentAlignment = Alignment.Center,
) {
CircularProgressIndicator(color = F7Colors.Primary)
}
else -> {
if (rules.isEmpty()) {
Text(
"Фильтров пока нет.",
style = MaterialTheme.typography.bodyMedium,
color = F7Colors.TextSecondary,
)
}
rules.forEachIndexed { index, rule ->
Row(
modifier = Modifier
.fillMaxWidth()
.heightIn(min = 36.dp)
.clip(RoundedCornerShape(10.dp))
.background(
if (editingIndex == index) F7Colors.PrimaryLight else F7Colors.SurfaceMuted,
)
.clickable(enabled = !saving && rule.isSimple) {
editingIndex = index
loadIntoForm(rule)
}
.padding(horizontal = 10.dp, vertical = 6.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp),
) {
Column(modifier = Modifier.weight(1f)) {
Text(
rule.name.ifBlank { "Без названия" },
style = MaterialTheme.typography.bodyMedium,
fontWeight = FontWeight.Medium,
color = F7Colors.TextPrimary,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
Text(
ruleSummary(rule) +
if (!rule.isSimple) " (сложное — правится в вебе)" else "",
style = MaterialTheme.typography.bodyMedium,
color = F7Colors.TextSecondary,
maxLines = 2,
overflow = TextOverflow.Ellipsis,
)
}
Switch(
checked = rule.enable,
onCheckedChange = { onToggle(index, it) },
enabled = !saving,
colors = SwitchDefaults.colors(checkedTrackColor = F7Colors.Primary),
)
Icon(
imageVector = Icons.Filled.Close,
contentDescription = "Удалить фильтр",
tint = F7Colors.TextSecondary,
modifier = Modifier
.size(16.dp)
.clickable(enabled = !saving) {
if (editingIndex == index) clearForm()
onDelete(index)
},
)
}
}
Text(
if (editingIndex >= 0) "Изменить фильтр" else "Новый фильтр",
style = MaterialTheme.typography.bodyLarge,
fontWeight = FontWeight.Medium,
color = F7Colors.TextPrimary,
)
F7OutlinedField(value = name, onValueChange = { name = it }, label = "Название")
Text("Если", style = MaterialTheme.typography.bodyMedium, color = F7Colors.TextSecondary)
Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
FIELD_OPTIONS.forEach { (value, label) ->
OptionChip(label, selected = field == value) { field = value }
}
}
F7OutlinedField(value = contains, onValueChange = { contains = it }, label = "Содержит")
Text("То", style = MaterialTheme.typography.bodyMedium, color = F7Colors.TextSecondary)
Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
ACTION_OPTIONS.forEach { (value, label) ->
OptionChip(label, selected = action == value) { action = value }
}
}
if (action == "fileinto" && folders.isNotEmpty()) {
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
folders.forEach { folder ->
Row(
modifier = Modifier
.fillMaxWidth()
.heightIn(min = 32.dp)
.clip(RoundedCornerShape(10.dp))
.background(
if (folder == targetFolder) F7Colors.PrimaryLight else F7Colors.SurfaceMuted,
)
.clickable { targetFolder = folder }
.padding(horizontal = 10.dp, vertical = 6.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Text(
folder,
style = MaterialTheme.typography.bodyMedium,
color = F7Colors.TextPrimary,
)
}
}
}
}
if (!error.isNullOrBlank()) {
Text(error, color = F7Colors.Error, style = MaterialTheme.typography.bodyMedium)
}
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
F7SecondaryButton(
if (editingIndex >= 0) "Отменить правку" else "Закрыть",
onClick = { if (editingIndex >= 0) clearForm() else onDismiss() },
modifier = Modifier.weight(1f),
)
F7PrimaryButton(
text = when {
saving -> "Сохранение…"
editingIndex >= 0 -> "Сохранить"
else -> "Создать"
},
onClick = {
val rule = MailFilterRule.simple(
name = name.trim().ifBlank { "Фильтр" },
field = field,
contains = contains.trim(),
action = action,
targetFolder = if (action == "fileinto") targetFolder else "",
)
if (editingIndex >= 0) onUpdate(editingIndex, rule) else onAdd(rule)
clearForm()
},
enabled = !saving && contains.isNotBlank() &&
(action != "fileinto" || targetFolder.isNotBlank()),
modifier = Modifier.weight(1f),
)
}
}
}
}
}
}
}
@@ -11,6 +11,7 @@ import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.isActive import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import ru.forbion.f7cloud.core.auth.AuthSession import ru.forbion.f7cloud.core.auth.AuthSession
@@ -44,6 +45,17 @@ data class MailUiState(
val appSettingsSaving: Boolean = false, val appSettingsSaving: Boolean = false,
val error: String? = null, val error: String? = null,
val unauthorized: Boolean = false, val unauthorized: Boolean = false,
// «Создать задачу/событие из письма» (паритет живого веба)
val createTaskSheetOpen: Boolean = false,
val createEventSheetOpen: Boolean = false,
val createTargets: List<MailTargetList> = emptyList(),
val creatingFromMessage: Boolean = false,
// Фильтры почты (официальный API NC Mail — общие с вебом)
val sieveAccountId: Int? = null,
val sieveRules: List<MailFilterRule> = emptyList(),
val sieveLoading: Boolean = false,
val sieveSaving: Boolean = false,
val sieveError: String? = null,
) )
class MailViewModel( class MailViewModel(
@@ -995,6 +1007,172 @@ class MailViewModel(
) )
} }
// --- «Создать задачу/событие из письма» (паритет живого веба) ---
fun openCreateTaskSheet(session: AuthSession) {
_state.update { it.copy(createTaskSheetOpen = true, createTargets = emptyList()) }
viewModelScope.launch(Dispatchers.IO) {
runCatching {
ru.forbion.f7cloud.feature.tasks.TasksRepository()
.listTaskLists(session)
.map { MailTargetList(it.href, it.displayName) }
}.onSuccess { lists ->
_state.update { it.copy(createTargets = lists) }
}.onFailure { t ->
_state.update { it.copy(createTaskSheetOpen = false, error = t.message) }
}
}
}
fun openCreateEventSheet(session: AuthSession) {
_state.update { it.copy(createEventSheetOpen = true, createTargets = emptyList()) }
viewModelScope.launch(Dispatchers.IO) {
runCatching {
ru.forbion.f7cloud.feature.calendar.CalendarRepository()
.listCalendars(session)
.map { MailTargetList(it.href, it.displayName) }
}.onSuccess { calendars ->
_state.update { it.copy(createTargets = calendars) }
}.onFailure { t ->
_state.update { it.copy(createEventSheetOpen = false, error = t.message) }
}
}
}
fun dismissCreateSheets() {
_state.update { it.copy(createTaskSheetOpen = false, createEventSheetOpen = false) }
}
fun createTaskFromMessage(
session: AuthSession,
listHref: String,
summary: String,
description: String,
due: java.time.LocalDate?,
) {
_state.update { it.copy(creatingFromMessage = true) }
viewModelScope.launch(Dispatchers.IO) {
runCatching {
ru.forbion.f7cloud.feature.tasks.TasksRepository().createTask(
session = session,
listHref = listHref,
summary = summary,
dueDate = due,
description = description,
)
}.onSuccess {
_state.update {
it.copy(creatingFromMessage = false, createTaskSheetOpen = false, error = null)
}
}.onFailure { t ->
_state.update { it.copy(creatingFromMessage = false, error = t.message) }
}
}
}
fun createEventFromMessage(
session: AuthSession,
calendarHref: String,
title: String,
description: String,
date: java.time.LocalDate,
startTime: String,
endTime: String,
allDay: Boolean,
) {
_state.update { it.copy(creatingFromMessage = true) }
viewModelScope.launch(Dispatchers.IO) {
runCatching {
ru.forbion.f7cloud.feature.calendar.CalendarRepository().saveEvent(
session,
ru.forbion.f7cloud.feature.calendar.CalendarEventDraft(
title = title,
date = date,
startTime = startTime,
endTime = endTime,
allDay = allDay,
description = description,
calendarHref = calendarHref,
),
)
}.onSuccess {
_state.update {
it.copy(creatingFromMessage = false, createEventSheetOpen = false, error = null)
}
}.onFailure { t ->
_state.update { it.copy(creatingFromMessage = false, error = t.message) }
}
}
}
// --- Фильтры почты (общие с вебом, API /api/filter/{accountId}) ---
fun openSieveFilters(session: AuthSession, accountId: Int) {
_state.update {
it.copy(sieveAccountId = accountId, sieveRules = emptyList(), sieveLoading = true, sieveError = null)
}
viewModelScope.launch(Dispatchers.IO) {
runCatching {
repository.getMailFilters(session, accountId)
}.onSuccess { rules ->
_state.update { it.copy(sieveRules = rules, sieveLoading = false) }
}.onFailure { t ->
_state.update {
it.copy(sieveLoading = false, sieveError = t.message ?: "Фильтры недоступны")
}
}
}
}
fun closeSieveFilters() {
_state.update { it.copy(sieveAccountId = null, sieveError = null) }
}
fun addFilterRule(session: AuthSession, rule: MailFilterRule) {
saveFilterRules(session) { it + rule }
}
fun updateFilterRule(session: AuthSession, index: Int, rule: MailFilterRule) {
saveFilterRules(session) { rules ->
rules.toMutableList().also { if (index in it.indices) it[index] = rule }
}
}
fun deleteFilterRule(session: AuthSession, index: Int) {
saveFilterRules(session) { rules ->
rules.toMutableList().also { if (index in it.indices) it.removeAt(index) }
}
}
fun toggleFilterRule(session: AuthSession, index: Int, enable: Boolean) {
saveFilterRules(session) { rules ->
rules.toMutableList().also {
if (index in it.indices) it[index] = it[index].withEnable(enable)
}
}
}
private fun saveFilterRules(
session: AuthSession,
transform: (List<MailFilterRule>) -> List<MailFilterRule>,
) {
val accountId = _state.value.sieveAccountId ?: return
// Правки применяем к ТЕКУЩЕМУ локальному списку (он же только что с сервера);
// сервер хранит фильтры единым массивом — PUT перезаписывает секцию приложения Mail.
val rules = transform(_state.value.sieveRules)
_state.update { it.copy(sieveSaving = true, sieveError = null) }
viewModelScope.launch(Dispatchers.IO) {
runCatching {
repository.putMailFilters(session, accountId, rules)
repository.getMailFilters(session, accountId)
}.onSuccess { fresh ->
_state.update { it.copy(sieveRules = fresh, sieveSaving = false) }
}.onFailure { t ->
_state.update { it.copy(sieveSaving = false, sieveError = t.message ?: "Ошибка сохранения") }
}
}
}
companion object { companion object {
private const val MARK_READ_DELAY_MS = 2000L private const val MARK_READ_DELAY_MS = 2000L
private const val FOLDER_CACHE_TTL_MS = 15 * 60 * 1000L private const val FOLDER_CACHE_TTL_MS = 15 * 60 * 1000L
@@ -0,0 +1,52 @@
package ru.forbion.f7cloud.feature.mail
import org.json.JSONObject
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
class MailFilterRuleTest {
@Test
fun simple_rule_builds_web_compatible_json() {
val rule = MailFilterRule.simple(
name = "Работа",
field = "subject",
contains = "Отчёт",
action = "fileinto",
targetFolder = "Work",
)
assertEquals("Работа", rule.name)
assertTrue(rule.enable)
assertEquals("allof", rule.operator)
assertEquals(listOf(Triple("subject", "contains", listOf("Отчёт"))), rule.tests)
assertEquals("fileinto", rule.actions.single().optString("type"))
assertEquals("Work", rule.actions.single().optString("mailbox"))
assertTrue(rule.isSimple)
}
@Test
fun markread_uses_system_flag() {
val rule = MailFilterRule.simple("r", "from", "boss", "markread", "")
val action = rule.actions.single()
assertEquals("addsystemflag", action.optString("type"))
assertTrue(action.optString("flag").contains("Seen"))
}
@Test
fun withEnable_preserves_unknown_fields() {
val raw = JSONObject(
"""{"name":"web","enable":true,"operator":"anyof","priority":20,
"tests":[{"field":"subject","operator":"is","values":["x"]},
{"field":"from","operator":"contains","values":["y"]}],
"actions":[{"type":"stop"}],"customField":"keepme"}""",
)
val rule = MailFilterRule(raw)
assertFalse(rule.isSimple)
val disabled = rule.withEnable(false)
assertFalse(disabled.enable)
assertEquals("keepme", disabled.raw.optString("customField"))
assertEquals(2, disabled.tests.size)
}
}
@@ -5,6 +5,10 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import android.util.Log import android.util.Log
import android.widget.Toast import android.widget.Toast
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.launch
import ru.f7cloud.talk.activities.CallActivity import ru.f7cloud.talk.activities.CallActivity
import ru.f7cloud.talk.services.CallForegroundService import ru.f7cloud.talk.services.CallForegroundService
import ru.f7cloud.talk.utils.bundle.BundleKeys import ru.f7cloud.talk.utils.bundle.BundleKeys
@@ -22,6 +26,9 @@ object TalkNativeCallLauncher {
private const val TAG = "TalkNativeCallLauncher" private const val TAG = "TalkNativeCallLauncher"
private const val WEBVIEW_CALL_ACTIVITY = "ru.forbion.f7cloud.feature.talk.TalkCallActivity" private const val WEBVIEW_CALL_ACTIVITY = "ru.forbion.f7cloud.feature.talk.TalkCallActivity"
// Main-scope для запуска звонка после suspend-подготовки vendor-юзера (IO)
private val launchScope = CoroutineScope(SupervisorJob() + Dispatchers.Main)
fun launchIncomingCall( fun launchIncomingCall(
context: Context, context: Context,
session: AuthSession, session: AuthSession,
@@ -83,15 +90,18 @@ object TalkNativeCallLauncher {
} }
return return
} }
if (!TalkVendorBootstrap.ensureSessionReady(context, session)) {
showError(context, "Не удалось подготовить Talk для звонка")
return
}
val token = callContext.roomToken.trim() val token = callContext.roomToken.trim()
if (token.isBlank()) { if (token.isBlank()) {
showError(context, "Некорректная комната звонка") showError(context, "Некорректная комната звонка")
return return
} }
// Подготовка vendor-юзера — suspend (IO): раньше runBlocking держал main
// на пути звонка (ANR-риск на входящем звонке, аудит C4). Запуск activity — на main.
launchScope.launch {
if (!TalkVendorBootstrap.ensureSessionReady(context, session)) {
showError(context, "Не удалось подготовить Talk для звонка")
return@launch
}
runCatching { runCatching {
startCallActivity( startCallActivity(
context, context,
@@ -106,6 +116,7 @@ object TalkNativeCallLauncher {
} }
} }
} }
}
private fun buildCallIntent( private fun buildCallIntent(
context: Context, context: Context,
@@ -2,6 +2,10 @@ package ru.forbion.f7cloud.feature.talknative
import android.content.Context import android.content.Context
import android.util.Log import android.util.Log
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.launch
import ru.forbion.f7cloud.core.auth.AuthSession import ru.forbion.f7cloud.core.auth.AuthSession
import ru.forbion.f7cloud.core.auth.AuthStore import ru.forbion.f7cloud.core.auth.AuthStore
@@ -10,15 +14,20 @@ import ru.forbion.f7cloud.core.auth.AuthStore
*/ */
object TalkVendorBootstrap { object TalkVendorBootstrap {
private const val TAG = "TalkVendorBootstrap" private const val TAG = "TalkVendorBootstrap"
private val warmupScope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
/** Прогрев vendor-юзера на старте — в фоне (раньше блокировал main в Application.onCreate). */
fun onApplicationCreate(context: Context) { fun onApplicationCreate(context: Context) {
if (!TalkNativeConfig.bootstrapVendorRuntime) return if (!TalkNativeConfig.bootstrapVendorRuntime) return
val session = AuthStore(context).load() ?: return val appContext = context.applicationContext
runCatching { TalkVendorUserSync.ensureUser(context, session) } warmupScope.launch {
val session = AuthStore(appContext).load() ?: return@launch
runCatching { TalkVendorUserSync.ensureUser(appContext, session) }
.onFailure { Log.w(TAG, "Talk user sync failed: ${it.message}") } .onFailure { Log.w(TAG, "Talk user sync failed: ${it.message}") }
} }
}
fun ensureSessionReady(context: Context, session: AuthSession): Boolean { suspend fun ensureSessionReady(context: Context, session: AuthSession): Boolean {
if (!TalkNativeConfig.bootstrapVendorRuntime) return true if (!TalkNativeConfig.bootstrapVendorRuntime) return true
return runCatching { TalkVendorUserSync.ensureUser(context, session) } return runCatching { TalkVendorUserSync.ensureUser(context, session) }
.onFailure { Log.w(TAG, "Talk user sync failed: ${it.message}") } .onFailure { Log.w(TAG, "Talk user sync failed: ${it.message}") }
@@ -5,22 +5,25 @@ import android.util.Log
import ru.f7cloud.talk.application.F7cloudTalkApplication import ru.f7cloud.talk.application.F7cloudTalkApplication
import ru.f7cloud.talk.f7cloud.F7TalkUserSync import ru.f7cloud.talk.f7cloud.F7TalkUserSync
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.withContext
import ru.forbion.f7cloud.core.auth.AuthSession import ru.forbion.f7cloud.core.auth.AuthSession
/** /**
* Ensures talk-android [ru.f7cloud.talk.data.user.model.User] exists for F7cloud sessions. * Ensures talk-android [ru.f7cloud.talk.data.user.model.User] exists for F7cloud sessions.
* Required before native [ru.f7cloud.talk.activities.CallActivity] can run. * Required before native [ru.f7cloud.talk.activities.CallActivity] can run.
*
* suspend (IO) раньше был runBlocking на main (старт приложения и путь звонка),
* что давало ANR-риск из аудита (C4/п.7).
*/ */
object TalkVendorUserSync { object TalkVendorUserSync {
private const val TAG = "TalkVendorUserSync" private const val TAG = "TalkVendorUserSync"
fun ensureUser(context: Context, session: AuthSession): Boolean { suspend fun ensureUser(context: Context, session: AuthSession): Boolean {
if (context.applicationContext !is F7cloudTalkApplication) { if (context.applicationContext !is F7cloudTalkApplication) {
Log.w(TAG, "Application is not F7cloudTalkApplication, skip sync") Log.w(TAG, "Application is not F7cloudTalkApplication, skip sync")
return false return false
} }
return runBlocking(Dispatchers.IO) { return withContext(Dispatchers.IO) {
runCatching { runCatching {
F7TalkUserSync.get().ensureUser( F7TalkUserSync.get().ensureUser(
serverUrl = session.serverUrl, serverUrl = session.serverUrl,
@@ -911,12 +911,26 @@ fun TalkMessageBody(
) )
} }
if (!message.attachmentFileName.isNullOrBlank() && !message.hasImageAttachment) { if (!message.attachmentFileName.isNullOrBlank() && !message.hasImageAttachment) {
Text( // Живая тема: карточка файла — круглая иконка типа 49dp + имя 14/500
"📄 ${message.attachmentFileName}", // (иконки типов — общие assets/filetypes из модуля files, мержатся в APK)
style = MaterialTheme.typography.bodyMedium, Row(
color = F7Colors.Primary, verticalAlignment = Alignment.CenterVertically,
fontWeight = FontWeight.Medium, horizontalArrangement = Arrangement.spacedBy(10.dp),
) {
AsyncImage(
model = "file:///android_asset/filetypes/${talkFileTypeIcon(message.attachmentFileName!!)}.svg",
contentDescription = null,
modifier = Modifier.size(49.dp),
) )
Text(
message.attachmentFileName!!,
style = MaterialTheme.typography.bodyMedium,
color = F7Colors.ChatText,
fontWeight = FontWeight.Medium,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
}
} }
val display = buildMessageDisplayText(message.text) val display = buildMessageDisplayText(message.text)
if (display.text.isNotBlank()) { if (display.text.isNotBlank()) {
@@ -966,18 +980,10 @@ fun TalkMessageGroupRow(
group.messages.forEachIndexed { index, message -> group.messages.forEachIndexed { index, message ->
val showAuthor = group.showAuthor && index == 0 && group.outgoing.not() val showAuthor = group.showAuthor && index == 0 && group.outgoing.not()
Column( Column(
modifier = Modifier.padding(vertical = 1.dp), // Живая тема: зазор между сообщениями 4px (--f7-msg-gap)
modifier = Modifier.padding(vertical = 2.dp),
horizontalAlignment = if (group.outgoing) Alignment.End else Alignment.Start, horizontalAlignment = if (group.outgoing) Alignment.End else Alignment.Start,
) { ) {
if (showAuthor) {
Text(
message.actorDisplayName,
fontSize = 12.sp,
color = F7Colors.Primary,
fontWeight = FontWeight.Medium,
modifier = Modifier.padding(start = 4.dp, bottom = 2.dp),
)
}
Box( Box(
modifier = Modifier modifier = Modifier
.shadow( .shadow(
@@ -1004,10 +1010,23 @@ fun TalkMessageGroupRow(
onClick = {}, onClick = {},
onLongClick = { onLongPress?.invoke(message) }, onLongClick = { onLongPress?.invoke(message) },
) )
.padding(horizontal = 12.dp, vertical = 8.dp), // Живая тема: паддинг пузыря 8px 10px
.padding(horizontal = 10.dp, vertical = 8.dp),
) { ) {
Column {
if (showAuthor) {
// Живая тема: автор ВНУТРИ пузыря, 12/600 чёрным
Text(
message.actorDisplayName,
fontSize = 12.sp,
color = F7Colors.TextPrimary,
fontWeight = FontWeight.SemiBold,
modifier = Modifier.padding(bottom = 2.dp),
)
}
TalkMessageBody(session = session, message = message) TalkMessageBody(session = session, message = message)
} }
}
if (message.reactions.isNotEmpty()) { if (message.reactions.isNotEmpty()) {
Row( Row(
horizontalArrangement = Arrangement.spacedBy(4.dp), horizontalArrangement = Arrangement.spacedBy(4.dp),
@@ -1592,3 +1611,18 @@ fun TalkCreateRoomSheet(
} }
} }
} }
/** Иконка типа файла для вложений чата (тот же набор assets/filetypes, что в Файлах). */
internal fun talkFileTypeIcon(name: String): String =
when (name.substringAfterLast('.', "").lowercase()) {
"doc", "docx", "dot", "dotx", "odt", "rtf" -> "word"
"xls", "xlsx", "xlsm", "ods", "csv" -> "spreadsheet"
"ppt", "pptx", "odp" -> "presentation"
"pdf" -> "pdf"
"jpg", "jpeg", "png", "gif", "webp", "bmp", "svg", "heic" -> "image"
"mp3", "wav", "ogg", "flac", "aac" -> "audio"
"mp4", "mkv", "avi", "mov", "webm" -> "video"
"zip", "rar", "7z", "tar", "gz" -> "archive"
"txt", "md", "log" -> "text"
else -> "file"
}
@@ -29,6 +29,8 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.TextButton import androidx.compose.material3.TextButton
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.pulltorefresh.PullToRefreshBox
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState import androidx.compose.runtime.collectAsState
@@ -304,6 +306,7 @@ fun TalkScreen(
modifier = modifier, modifier = modifier,
loading = state.loading && state.rooms.isEmpty(), loading = state.loading && state.rooms.isEmpty(),
error = state.error, error = state.error,
onErrorRetry = { vm.load(session) },
) { ) {
RoomListContent( RoomListContent(
session = session, session = session,
@@ -318,11 +321,14 @@ fun TalkScreen(
onCreateRoom = vm::openCreateRoom, onCreateRoom = vm::openCreateRoom,
onToggleFavorite = { vm.toggleFavorite(session, it.token) }, onToggleFavorite = { vm.toggleFavorite(session, it.token) },
onMarkUnread = { vm.markRoomUnread(session, it.token) }, onMarkUnread = { vm.markRoomUnread(session, it.token) },
refreshing = state.loading && state.rooms.isNotEmpty(),
onRefresh = { vm.load(session) },
) )
} }
} }
} }
@OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
private fun RoomListContent( private fun RoomListContent(
session: AuthSession, session: AuthSession,
@@ -337,6 +343,8 @@ private fun RoomListContent(
onCreateRoom: () -> Unit, onCreateRoom: () -> Unit,
onToggleFavorite: (TalkRoom) -> Unit, onToggleFavorite: (TalkRoom) -> Unit,
onMarkUnread: (TalkRoom) -> Unit, onMarkUnread: (TalkRoom) -> Unit,
refreshing: Boolean = false,
onRefresh: () -> Unit = {},
) { ) {
Column( Column(
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
@@ -351,6 +359,13 @@ private fun RoomListContent(
onCreateClick = onCreateRoom, onCreateClick = onCreateRoom,
) )
TalkFilterChips(selected = roomFilter, onClear = onClearFilter) TalkFilterChips(selected = roomFilter, onClear = onClearFilter)
PullToRefreshBox(
isRefreshing = refreshing,
onRefresh = onRefresh,
modifier = Modifier
.weight(1f)
.fillMaxWidth(),
) {
if (rooms.isEmpty()) { if (rooms.isEmpty()) {
Column( Column(
modifier = Modifier modifier = Modifier
@@ -393,6 +408,7 @@ private fun RoomListContent(
} }
} }
} }
}
@Composable @Composable
private fun ChatContent( private fun ChatContent(
@@ -11,6 +11,8 @@ import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.items
import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.pulltorefresh.PullToRefreshBox
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState import androidx.compose.runtime.collectAsState
@@ -143,6 +145,7 @@ fun TasksScreen(
) )
} }
@OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
private fun TasksMainContent( private fun TasksMainContent(
session: AuthSession, session: AuthSession,
@@ -190,6 +193,13 @@ private fun TasksMainContent(
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
) )
} else { } else {
PullToRefreshBox(
isRefreshing = state.loading,
onRefresh = onReload,
modifier = Modifier
.weight(1f)
.fillMaxWidth(),
) {
LazyColumn( LazyColumn(
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
verticalArrangement = Arrangement.spacedBy(8.dp), verticalArrangement = Arrangement.spacedBy(8.dp),
@@ -232,3 +242,4 @@ private fun TasksMainContent(
} }
} }
} }
}
+1
View File
@@ -60,3 +60,4 @@ multidex = { group = "androidx.multidex", name = "multidex", version.ref = "mult
fragment-ktx = { group = "androidx.fragment", name = "fragment-ktx", version.ref = "fragment" } fragment-ktx = { group = "androidx.fragment", name = "fragment-ktx", version.ref = "fragment" }
documentfile = { group = "androidx.documentfile", name = "documentfile", version.ref = "documentfile" } documentfile = { group = "androidx.documentfile", name = "documentfile", version.ref = "documentfile" }
junit = { group = "junit", name = "junit", version.ref = "junit" } junit = { group = "junit", name = "junit", version.ref = "junit" }
core-splashscreen = { group = "androidx.core", name = "core-splashscreen", version = "1.0.1" }