Compare commits
23 Commits
43e0dc177c
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 680669df00 | |||
| d13f35e045 | |||
| 9fce19dab2 | |||
| c0a4c71766 | |||
| d65be8a1ef | |||
| 9f8877a741 | |||
| 3f681feb26 | |||
| a31a88f87a | |||
| 9382a1f946 | |||
| 6f32eb8972 | |||
| 058926cf6f | |||
| 7534ecf7d1 | |||
| c01372353c | |||
| 288b5e70d4 | |||
| c0463e51f9 | |||
| 48a50744de | |||
| 5a72c71cfc | |||
| 762178d9f9 | |||
| 6c689d1f34 | |||
| 1f692b1e4e | |||
| 94632e0611 | |||
| 5c28e91279 | |||
| ab8637bf6a |
2
.github/pull_request_template.md
vendored
@@ -1,4 +1,4 @@
|
||||
- [ ] I have read and understood the [contributing guidelines](https://github.com/krille-chan/fluffychat/blob/main/CONTRIBUTING.md).
|
||||
- [ ] I have read and understood the [contributing guidelines](https://gitea.weltonmoura.com.br/welton/tatuchat/blob/main/CONTRIBUTING.md).
|
||||
|
||||
### Pull Request has been tested on:
|
||||
|
||||
|
||||
@@ -5,4 +5,4 @@ SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
-->
|
||||
|
||||
Has been moved to https://fluffychat.im/privacy
|
||||
Has been moved to https://tatuchat.weltonmoura.com.br/home/politica-de-privacidade/
|
||||
296
README.md
@@ -5,134 +5,280 @@ SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
-->
|
||||
|
||||
[TatuChat](https://fluffy.chat) is an open source, nonprofit and cute [[matrix](https://matrix.org)] client written in [Flutter](https://flutter.dev). The goal of the app is to create an easy to use instant messenger which is open source and accessible for everyone.
|
||||
# TatuChat
|
||||
|
||||
### Links:
|
||||
<p align="center">
|
||||
<img src="https://tatuchat.weltonmoura.com.br/home/assets/logo.png" height="180" alt="TatuChat">
|
||||
</p>
|
||||
|
||||
- 🌐 [[Weblate] Translate TatuChat into your language](https://hosted.weblate.org/projects/fluffychat/)
|
||||
- 🌍 [[m] Join the community](https://matrix.to/#/#fluffy-space:matrix.org)
|
||||
- 📰 [[Mastodon] Get updates on social media](https://troet.cafe/@krille)
|
||||
- 💝 [[Liberapay] Support TatuChat development](https://de.liberapay.com/KrilleChritzelius)
|
||||
<p align="center">
|
||||
Cliente de mensagens instantâneas <strong>open source</strong>, <strong>sem fins lucrativos</strong> e
|
||||
multiplataforma, construído sobre o protocolo
|
||||
<a href="https://matrix.org">Matrix</a> com <a href="https://flutter.dev">Flutter</a>.
|
||||
TatuChat é um <em>fork</em> do acclaimed
|
||||
<a href="https://fluffy.chat">FluffyChat</a>, com foco em privacidade, simplicidade e
|
||||
código aberto.
|
||||
</p>
|
||||
|
||||
<a href='https://ko-fi.com/krille' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://storage.ko-fi.com/cdn/kofi5.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
|
||||
> 🌐 **Site, downloads e novidades:** <https://tatuchat.weltonmoura.com.br/home/>
|
||||
|
||||
### Screenshots:
|
||||
> ⚠️ **Status do projeto: alfa.** O aplicativo está em desenvolvimento ativo e ainda pode
|
||||
> apresentar erros, perder dados ou mudar de comportamento entre versões. Use com cuidado e
|
||||
> reporte problemas para ajudar a tornar o TatuChat mais estável.
|
||||
|
||||
<img src="https://github.com/krille-chan/fluffychat-website/blob/main/public/img/screenshot_mobile.png?raw=true" height="300">
|
||||
<img src="https://github.com/krille-chan/fluffychat-website/blob/main/public/img/screenshot_desktop.png?raw=true" height="300">
|
||||
## O que é o TatuChat
|
||||
|
||||
# Features
|
||||
Um mensageiro federado e descentralizado: nenhuma empresa no meio, nenhum servidor único. Você
|
||||
escolhe o *homeserver* que quiser (ou usa um dos recomendados), conversa com quem está em outros
|
||||
servidores e continua sendo dono dos seus dados. Tudo com criptografia ponta a ponta
|
||||
(Olm/Megolm via [Vodozemac](https://github.com/matrix-org/vodozemac) em WebAssembly).
|
||||
|
||||
- 📩 Send all kinds of messages, images and files
|
||||
- 🤙 Video calls with Matrix RTC
|
||||
- 🎙️ Voice messages
|
||||
- 📍 Location sharing
|
||||
- 🔔 Push notifications
|
||||
- 💬 Unlimited private and public group chats
|
||||
- 📣 Public channels with thousands of participants
|
||||
- 🛠️ Feature rich group moderation including all matrix features
|
||||
- 🔍 Discover and join public groups
|
||||
- 🎨 Material You design
|
||||
- 😄 Custom emotes and stickers
|
||||
- 🌌 Spaces
|
||||
- 🔐 End to end encryption
|
||||
- 🔒 Encrypted chat backup
|
||||
- 😀 Emoji verification & cross signing
|
||||
... and much more.
|
||||
- 🔐 Criptografia ponta a ponta, com verificação por emoji e *cross-signing*
|
||||
- 💾 Backup de conversas criptografado
|
||||
- 📩 Texto, imagens, áudio, vídeo, arquivos, stickers, emotes e localização
|
||||
- 🤙 Videochamadas pelo Matrix RTC (LiveKit)
|
||||
- 🎙️ Mensagens de voz
|
||||
- 🔔 Notificações push, com ou sem Google (UnifiedPush / ntfy)
|
||||
- 🌌 Espaços para navegar hierarquias inteiras de salas
|
||||
- 🎨 Design Material You, com cores dinâmicas do Android
|
||||
|
||||
## 🚀 Inovações do TatuChat
|
||||
|
||||
# Installation
|
||||
O TatuChat reescreveu a forma de navegar e de consumir conteúdo dentro do Matrix. As seções
|
||||
abaixo descrevem os módulos desenvolvidos sobre o FluffyChat.
|
||||
|
||||
Please visit the website for installation instructions:
|
||||
### Abas e barra lateral
|
||||
|
||||
- https://fluffy.chat
|
||||
O app não usa mais a *navigation rail* do FluffyChat. A navegação principal virou uma
|
||||
**barra lateral** (desktop e tablet) com as entradas *Criar grupo*, *Definir status*,
|
||||
*Convidar contato*, *Arquivo*, **Apps** e *Configurações*, além do seletor de contas.
|
||||
|
||||
# Configuration and Mobile Device Management (MDM)
|
||||
A tela inicial foi dividida em **quatro abas**, com barra superior em telas largas e barra
|
||||
inferior em telas compactas:
|
||||
|
||||
TatuChat supports configuration via MDM on Android&iOS (since v2.10.0) and via a config.json file on web. You can see the populated configuration for MDM on Android in this file under `/android/app/src/main/res/xml/app_restrictions.xml`.
|
||||
An example configuration can be found in the `config.sample.json` file.
|
||||
| Aba | O que mostra |
|
||||
| --- | --- |
|
||||
| **Conversas** | Apenas conversas normais |
|
||||
| **Canais** | Apenas canais |
|
||||
| **Espaços** | Os espaços em que você entrou, como tela inicial |
|
||||
| **Murais** | Apenas murais |
|
||||
|
||||
# How to build
|
||||
Canais e murais **não aparecem** na lista de conversas, e vice-versa: cada tipo tem sua própria
|
||||
aba, com busca própria — e os murais mostram ainda o número de inscritos de cada um.
|
||||
|
||||
1. To build TatuChat you need [Flutter](https://flutter.dev) and [Rust](https://www.rust-lang.org/tools/install)
|
||||
### 📣 Canais
|
||||
|
||||
2. Clone the repo:
|
||||
```
|
||||
git clone https://github.com/krille-chan/fluffychat.git
|
||||
cd fluffychat
|
||||
```
|
||||
3. Choose your target platform below and enable support for it.
|
||||
3.1 If you want, enable Googles Firebase Cloud Messaging:
|
||||
Um canal é uma sala pública de distribuição, no estilo de um feed, não de um chat. O tipo é
|
||||
gravado no estado compartilhado da sala (`tatuchat.room_type = "canal"`), com uma tag pessoal
|
||||
(`tatuchat_canal`) para identificação local.
|
||||
|
||||
`./scripts/add-firebase-messaging.sh`
|
||||
A sala usa a página de chat normal, mas em **modo feed**:
|
||||
|
||||
4. Debug with: `flutter run`
|
||||
- 🗞️ Publicações viram **cartões de largura total**, em vez de balões
|
||||
- ✍️ O nome do autor aparece **sempre**, inclusive nas suas próprias publicações, para que o
|
||||
feed nunca pareça anônimo
|
||||
- ⬅️ Tudo alinhado à esquerda, com balões totalmente arredondados
|
||||
- 🖼️ Imagens ocupam a largura total, mantendo a proporção original
|
||||
- 🔐 **Somente administradores publicam no nível principal**; dentro das threads, qualquer
|
||||
participante comenta
|
||||
- 💬 Cada publicação abre uma **thread de comentários**, com reações, respostas, edição,
|
||||
exclusão e denúncia
|
||||
|
||||
### 🖼️ Murais
|
||||
|
||||
Um mural é uma página dedicada — não uma variante da timeline. O tipo é gravado em
|
||||
`tatuchat.room_type = "mural"` (tag pessoal `tatuchat_mural`), e abrir o mural **nunca** mostra
|
||||
a lista de mensagens: mostra um **grid visual**.
|
||||
|
||||
- 🟦 Grade responsiva de 3 colunas alimentada apenas por **imagens, vídeos e stickers**
|
||||
- 🎨 Cabeçalho com capa, avatar, nome, descrição, autor e número de inscritos
|
||||
- 👆 **Toque simples** abre o visualizador do post, com painel de comentários e campo de
|
||||
resposta
|
||||
- 🤏 **Toque longo** abre a imagem em tela cheia, com *pinch-to-zoom* e deslize entre as mídias
|
||||
do mural
|
||||
- 💬 Comentários são **threads Matrix reais**, com árvore aninhada, reações, resposta,
|
||||
exclusão do próprio comentário e denúncia
|
||||
- 🧹 A timeline carrega em blocos conforme você desce, para não travar em murais grandes
|
||||
|
||||
### 🌌 Espaços
|
||||
|
||||
Matrix costuma tratar espaços como um recurso de segunda classe. No TatuChat eles viraram uma
|
||||
**tela inicial** completa:
|
||||
|
||||
- 🧭 A aba **Espaços** é a porta de entrada: explorer a hierarquia inteira de uma conta sem sair
|
||||
do app
|
||||
- 🔎 Busca e filtro dentro do espaço, com capa do espaço e destaque da sala ativa
|
||||
- ➕ Ingresso rápido em salas filhas públicas, direto da hierarquia
|
||||
- 🛠️ Edição das salas filhas a partir do próprio explorador
|
||||
- ↔️ A sala ativa é carregada na coluna lateral e preservada entre navegações
|
||||
|
||||
### 🧩 Mini Apps
|
||||
|
||||
O TatuChat é **extensível pela comunidade**: qualquer pessoa pode escrever um mini app e
|
||||
instalá-lo no próprio app, sem loja, sem build e sem publishing.
|
||||
|
||||
Um mini app é **um único arquivo `.html`**, executado em um *web view* isolado:
|
||||
|
||||
- 📥 Instalação **por arquivo** ou **por URL**
|
||||
- 🔐 Cada app tem seu próprio armazenamento chave-valor, persistido no *account data* do Matrix
|
||||
(ou seja, o app sincroniza entre os seus dispositivos)
|
||||
- 🎨 A ponte expõe a paleta e o brilho do tema atual, para o app acompanhar o Material You
|
||||
- 👤 A ponte expõe o perfil do usuário (id, nome, avatar e homeserver)
|
||||
- 📦 Dois mini apps já vêm embutidos: **`tasks`** (lista de tarefas) e **`accountdata`**
|
||||
(editor de *account data*)
|
||||
|
||||
As ações disponíveis na ponte são:
|
||||
|
||||
| Ação | O que faz |
|
||||
| --- | --- |
|
||||
| `io.tatuchat.storage.load` | Lê o armazenamento do app |
|
||||
| `io.tatuchat.storage.save` | Sobrescreve o armazenamento do app |
|
||||
| `io.tatuchat.identity.get` | Perfil do usuário + avatar como data URI |
|
||||
| `io.tatuchat.theme.get` | Paleta e brilho do tema em hex CSS |
|
||||
| `io.tatuchat.accountdata.list` | Lista todas as chaves de *account data* |
|
||||
| `io.tatuchat.accountdata.get` | Lê uma chave de *account data* |
|
||||
| `io.tatuchat.accountdata.set` | Escreve uma chave de *account data* |
|
||||
|
||||
**📖 Documentação completa:** [`docs/miniapps.md`](docs/miniapps.md) — manifesto em `<meta>`,
|
||||
protocolo da ponte, exemplo de HTML e limitações.
|
||||
|
||||
> 🔐 **Segurança — leia antes de instalar apps de terceiros.** As ações de `accountdata.*` não
|
||||
> são restritas por app: um mini app pode ler e escrever qualquer chave de *account data* da
|
||||
> conta, incluindo as chaves de outros mini apps. Não existe modelo de permissões nem pedido de
|
||||
> consentimento. Instale apenas apps cujo código você auditou. O app **não** expõe salas,
|
||||
> mensagens, arquivos nem envio de mensagens pela ponte.
|
||||
|
||||
### Outros detalhes
|
||||
|
||||
- 🎨 **Identidade visual própria:** cor primária esmeralda `#00D084`, paleta de sementes
|
||||
customizada, ícone, splash e ícone de notificação próprios
|
||||
- ⏱️ **Status personalizado aparece na hora:** a atualização de status é aplicada no cache local
|
||||
imediatamente, sem esperar o *sync* do homeserver
|
||||
- 🖼️ **Papel de parede e tema sincronizados:** via *account data* da conta Matrix, o tema segue
|
||||
entre dispositivos; há também a opção de suavizar a cor primária
|
||||
- 🔗 Deep links próprios (`im.tatuchat://chat/`) e convites com `client=im.tatuchat`
|
||||
|
||||
## 📲 Instalação
|
||||
|
||||
Downloads para Android, iOS, Linux, Windows, macOS e Web (PWA), além de notas de versão:
|
||||
|
||||
- <https://tatuchat.weltonmoura.com.br/home/>
|
||||
|
||||
## ⚙️ Configuração e MDM
|
||||
|
||||
O TatuChat aceita configuração gerenciada em Android e iOS (via MDM) e por um arquivo
|
||||
`config.json` na versão web.
|
||||
|
||||
- **Android:** as restrições declaradas ficam em
|
||||
`android/app/src/main/res/xml/app_restrictions.xml`, com as chaves `defaultHomeserver`,
|
||||
`presetHomeserver` e `welcomeText`. O restante das chaves é lido de `ManagedConfigurations`.
|
||||
- **Web:** sirva um `config.json` no mesmo caminho do app. O exemplo completo está em
|
||||
[`config.sample.json`](config.sample.json).
|
||||
|
||||
⚠️ Passe **somente os valores que você realmente precisa alterar**. Todas as chaves são
|
||||
opcionais; por exemplo, para trocar o homeserver padrão, altere apenas `defaultHomeserver`.
|
||||
|
||||
## 🛠️ Como compilar
|
||||
|
||||
1. Para compilar o TatuChat você precisa do [Flutter](https://flutter.dev) (3.47.3, Dart
|
||||
`>=3.11.1 <4.0.0`); para a versão web, também do [Rust](https://www.rust-lang.org/tools/install),
|
||||
usado para compilar o Vodozemac.
|
||||
|
||||
2. Clone o repositório:
|
||||
```bash
|
||||
git clone https://gitea.weltonmoura.com.br/welton/tatuchat.git
|
||||
cd tatuchat
|
||||
```
|
||||
|
||||
3. Escolha a plataforma alvo abaixo e habilite o suporte a ela.
|
||||
|
||||
4. Opcionalmente, habilite o Google Firebase Cloud Messaging:
|
||||
```bash
|
||||
./scripts/add-firebase-messaging.sh
|
||||
```
|
||||
|
||||
5. Debug com `flutter run`.
|
||||
|
||||
### Android
|
||||
|
||||
* Build with: `flutter build apk`
|
||||
```bash
|
||||
flutter build apk --release
|
||||
# ou, por arquitetura (APKs bem menores):
|
||||
flutter build apk --release --split-per-abi
|
||||
```
|
||||
|
||||
Para assinar, preencha `android/key.properties` (já ignorado pelo Git) com `storeFile`,
|
||||
`keyAlias`, `storePassword` e `keyPassword`; o script `prepare-android-release.sh` faz isso a
|
||||
partir do segredo `$FDROID_KEY` em CI.
|
||||
|
||||
### iOS / iPadOS
|
||||
|
||||
* Have a Mac with Xcode installed, and set up for Xcode-managed app signing
|
||||
* If you want automatic app installation to connected devices, make sure you have Apple Configurator installed, with the Automation Tools (`cfgutil`) enabled
|
||||
* Set a few environment variables
|
||||
* FLUFFYCHAT_NEW_TEAM: the Apple Developer team that your certificates should live under
|
||||
* FLUFFYCHAT_NEW_GROUP: the group you want App IDs and such to live under (ie: com.example.fluffychat)
|
||||
* FLUFFYCHAT_INSTALL_IPA: set to `1` if you want the IPA to be deployed to connected devices after building, otherwise unset
|
||||
* Run `./scripts/build-ios.sh`
|
||||
* Um Mac com Xcode instalado, configurado para o *app signing* gerenciado pelo Xcode
|
||||
* Se quiser instalar automaticamente nos dispositivos conectados, tenha o Apple Configurator com
|
||||
as ferramentas de automação (`cfgutil`) habilitadas
|
||||
* Defina algumas variáveis de ambiente:
|
||||
* `FLUFFYCHAT_NEW_TEAM`: o time de Apple Developer que deve emitir os certificados
|
||||
* `FLUFFYCHAT_NEW_GROUP`: o grupo onde os App IDs vivem (ex.: `com.example.tatuchat`)
|
||||
* `FLUFFYCHAT_INSTALL_IPA`: defina como `1` para fazer o *deploy* do IPA nos dispositivos
|
||||
conectados após o build
|
||||
* Execute `./scripts/build-ios.sh`
|
||||
|
||||
### Web
|
||||
|
||||
* Build with:
|
||||
```bash
|
||||
./scripts/prepare-web.sh # To install Vodozemac
|
||||
./scripts/prepare-web.sh # compila o Vodozemac para WebAssembly
|
||||
flutter build web --release
|
||||
```
|
||||
|
||||
* Optionally configure by serving a `config.json` at the same path as fluffychat.
|
||||
An example can be found at `config.sample.json`. All values there are optional.
|
||||
**Please only the values, you really need**. If you e.g. only want
|
||||
to change the default homeserver, then only modify the `defaultHomeserver` key.
|
||||
|
||||
### Desktop (Linux, Windows, macOS)
|
||||
|
||||
* Enable Desktop support in Flutter: https://flutter.dev/desktop
|
||||
Habilite o suporte a desktop do Flutter: <https://flutter.dev/desktop>
|
||||
|
||||
#### Install custom dependencies (Linux)
|
||||
Dependências no Linux:
|
||||
|
||||
```bash
|
||||
sudo apt install libjsoncpp1 libsecret-1-dev libsecret-1-0 librhash0 libwebkit2gtk-4.0-dev lld
|
||||
```
|
||||
|
||||
* Build with one of these:
|
||||
```bash
|
||||
flutter build linux --release
|
||||
flutter build windows --release
|
||||
flutter build macos --release
|
||||
```
|
||||
|
||||
## How to run integration tests
|
||||
## 🧪 Testes de integração
|
||||
|
||||
You need to have docker installed locally! Run the preparation script before every test run:
|
||||
Os testes completos precisam de Docker (Synapse) rodando localmente. Antes de cada execução:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
./scripts/prepare_integration_test.sh
|
||||
```
|
||||
|
||||
Then run all tests with:
|
||||
|
||||
```sh
|
||||
flutter test integration_test/mobile_test.dart
|
||||
```
|
||||
|
||||
## 📜 Licença
|
||||
|
||||
# Special thanks
|
||||
TatuChat é software livre, licença **AGPL-3.0-or-later**. Ele é derivado do FluffyChat, também
|
||||
AGPL-3.0-or-later, Copyright de Christian Kußowski e colaboradores. O arquivo `LICENSES/` traz as
|
||||
licenças de todas as dependências (REUSE).
|
||||
|
||||
* <a href="https://github.com/fabiyamada">Fabiyamada</a> is a graphics designer and has made the tatuchat logo and the banner. Big thanks for her great designs.
|
||||
## 🔗 Links
|
||||
|
||||
* Also thanks to all translators and testers! With your help, tatuchat is now available in more than 12 languages.
|
||||
- 🌐 [Site do TatuChat](https://tatuchat.weltonmoura.com.br/home/)
|
||||
- 💻 [Código-fonte](https://gitea.weltonmoura.com.br/welton/tatuchat)
|
||||
- 🐞 [Issues e bugs](https://gitea.weltonmoura.com.br/welton/tatuchat/issues)
|
||||
- 🧩 [Documentação dos Mini Apps](docs/miniapps.md)
|
||||
- 🌍 [[Weblate] Traduza o TatuChat](https://hosted.weblate.org/projects/fluffychat/)
|
||||
- 🦊 [Código do FluffyChat, o projeto original](https://github.com/krille-chan/fluffy-chat)
|
||||
- 📄 [Política de privacidade](PRIVACY.md) · [Segurança](SECURITY.md) · [Contribuindo](CONTRIBUTING.md) · [Changelog](CHANGELOG.md)
|
||||
|
||||
* The Matrix Foundation for making and maintaining the [emoji translations](https://github.com/matrix-org/matrix-spec/blob/main/data-definitions/sas-emoji.json) used for emoji verification, licensed Apache 2.0
|
||||
## 🙏 Agradecimentos
|
||||
|
||||
* Special thanks to MTRNord, Sorunome and Advocatux.
|
||||
* **[Fabiyamada](https://github.com/fabiyamada)** é designer gráfico e criou o logo e o banner do
|
||||
TatuChat. Muito obrigado pelos belos designs.
|
||||
* A todos os tradutores e testadores! Com a ajuda de vocês o TatuChat já está disponível em mais
|
||||
de 12 idiomas.
|
||||
* À **Matrix Foundation**, por manter e licenciar (Apache 2.0) as
|
||||
[traduções de emoji](https://github.com/matrix-org/matrix-spec/blob/main/data-definitions/sas-emoji.json)
|
||||
usadas na verificação por emoji.
|
||||
* A **MTRNord**, **Sorunome** e **Advocatux**.
|
||||
* Ao **FluffyChat** e a toda a comunidade Matrix — o TatuChat existe graças a esse trabalho.
|
||||
|
||||
@@ -11,7 +11,7 @@ If you believe you have discovered a security vulnerability in this project, **d
|
||||
|
||||
To report a security issue responsibly, please go to the Security tab or visit:
|
||||
|
||||
https://github.com/krille-chan/fluffychat/security/advisories/new
|
||||
https://gitea.weltonmoura.com.br/welton/tatuchat
|
||||
|
||||
The following information can help us address the issue:
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 882 B After Width: | Height: | Size: 790 B |
|
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 566 B After Width: | Height: | Size: 499 B |
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 74 KiB |
@@ -1,29 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<group android:scaleX="0.33822063"
|
||||
android:scaleY="0.33822063"
|
||||
android:translateX="30.24"
|
||||
android:translateY="31.24">
|
||||
<path
|
||||
android:pathData="M130.9,74.3c1.5,-0.3 2.8,-1 3.8,-2 4,-5.3 0.8,-11.8 -4.5,-12.6 -0.8,0 -1.5,-0.8 -1.5,-1.5v-0.5c0.8,-0.8 1.5,-1.8 2.5,-3.3 8.1,-10.8 11.8,-50.6 3.8,-53.7 -9.8,-3.3 -29.7,6.3 -38.3,17.4 -0.5,-0.3 -1,-1 -1,-1.8a7,7 0,0 0,-3.5 -6.8,7.8 7.8,0 0,0 -10.6,3.3c-0.5,0.8 -1.3,1.3 -2,1 -0.8,0 -1.5,-0.8 -1.5,-1.5 -0.5,-2.5 -2,-4.5 -4.3,-5.5 -4.8,-2 -9.8,0.8 -10.6,5.3 -0.3,0.8 -0.8,1.5 -1.5,1.5 -0.8,0.3 -1.5,-0.3 -2,-1a8,8 0,0 0,-6.5 -3.8,8 8,0 0,0 -7.8,7.3v0.6c0,0.8 -0.5,1.5 -1,1.8h-0.3c-8.3,-10.8 -28.5,-20.7 -38.5,-17.4 -8.1,2.8 -4.3,42.6 4,53.4 1.5,2 2.8,3.5 3.8,4.5 -0.3,0.8 -1,1.5 -1.8,1.5 -1.3,0 -2.5,0.5 -3.5,1.3a7.7,7.7 0,0 0,3 13.4c0.8,0.3 1.5,1 1.5,1.8s-0.5,1.8 -1.3,2c-1,0.5 -2,1 -2.8,2 -4,5.8 0,12.3 5.5,12.3a2,2 0,0 1,1.8 1.3c0.3,0.8 0.3,1.5 -0.5,2a6.5,6.5 0,0 0,-2 5.5c0.3,2.8 2,5.3 4.8,6.5 1.5,0.8 3,0.8 4.5,0.5 0.8,-0.3 1.5,0 2,0.8 0.5,0.5 0.5,1.5 0.3,2 -0.8,1.5 -1,3.3 -0.5,5a7.7,7.7 0,0 0,5.5 5.5c2.5,0.5 4.3,-0.3 5.5,-0.8 0.5,-0.3 -3.3,9.1 -6,15.4 -0.8,2 1.3,4.3 3.5,3.3 8.3,-3.8 22.2,-10.3 22.2,-9.8 0.5,5.3 6.5,9.1 12.3,5.3 1.3,-0.8 2,-2.3 2.3,-3.5 0.3,-0.8 1,-1.5 2,-1.5s1.8,0.5 2,1.5c0.3,1.3 0.8,2.3 1.8,3 5.8,4.5 12.3,0.8 12.8,-4.8a2,2 0,0 1,1.3 -1.8c0.8,-0.3 1.5,0 2,0.5a7.6,7.6 0,0 0,5.3 2.5c2.5,0 5,-1.3 6.5,-3.8 1,-1.5 1.3,-3 1,-5 0,-0.8 0.3,-1.5 0.8,-2s1.5,-0.5 2,0c1.5,0.8 3.3,1.3 5,0.8 2.8,-0.5 5,-2.8 5.8,-5.3 0.5,-1.8 0.3,-3.5 -0.5,-5.3 -0.3,-0.8 -0.3,-1.5 0.3,-2s1.3,-0.8 2,-0.8c1.8,0.3 3.3,0.3 4.8,-0.5 2.3,-1 3.8,-3 4.3,-5.5a7,7 0,0 0,-2 -6.5c-0.5,-0.5 -0.8,-1.3 -0.5,-2 0.3,-0.7 1,-1.3 1.8,-1.3 1.8,0 3.8,-0.5 5,-2a7.6,7.6 0,0 0,-2.5 -12.6c-0.8,-0.3 -1.3,-1 -1.3,-2 0,-0.9 0.7,-1.6 1.5,-1.6z"
|
||||
android:fillColor="#4d3f92"/>
|
||||
<path
|
||||
android:pathData="M110.7,21.4a7,7 0,0 1,0 4.5c-0.3,0.8 0,1.5 0.5,2s1.3,0.8 2,0.5c1,-0.5 2,-0.5 3,-0.5a7,7 0,0 1,5.8 3c1,1.3 1.8,3 1.5,4.8a7,7 0,0 1,-1.3 4c-0.5,0.5 -0.5,1.5 0,2 0.3,0.3 0.5,0.8 1,0.8 1,-0.3 2,-1 2.8,-2 4.5,-6.3 5.3,-26.2 0.8,-27.7s-12.3,1.5 -17.9,6c1.1,0.5 1.6,1.3 1.8,2.6z"
|
||||
android:fillColor="#fff"/>
|
||||
<path
|
||||
android:pathData="M18.3,42.8l0.8,-0.8c0.5,-0.8 0.3,-1.5 0,-2a7.6,7.6 0,0 1,-1.3 -5.8c0.5,-2.8 2.8,-5 5.5,-5.8 1.5,-0.5 3,-0.3 4.5,0.3 0.8,0.3 1.5,0 2,-0.5s0.8,-1.3 0.5,-2a7,7 0,0 1,0 -4.5c0.3,-1 0.8,-2 1.5,-2.8 -5.5,-4.5 -13.9,-7.8 -18.4,-6.3 -4.5,1.5 -3.7,21.4 0.9,27.7 1,1.5 2.2,2.2 4,2.5z"
|
||||
android:fillColor="#fff"/>
|
||||
<path
|
||||
android:pathData="M40.2,73.8m-9.3,0a9.3,9.3 0,1 1,18.6 0a9.3,9.3 0,1 1,-18.6 0"
|
||||
android:fillColor="#fff"/>
|
||||
<path
|
||||
android:pathData="M80,73.8a9.3,9.3 0,1 1,-18.6 0c0,-5 18.6,-5.3 18.6,0z"
|
||||
android:fillColor="#fff"/>
|
||||
<path
|
||||
android:pathData="M100.9,73.8m-9.3,0a9.3,9.3 0,1 1,18.6 0a9.3,9.3 0,1 1,-18.6 0"
|
||||
android:fillColor="#fff"/>
|
||||
</group>
|
||||
</vector>
|
||||
BIN
assets/logo/background.png
Normal file
|
After Width: | Height: | Size: 1.7 MiB |
|
Before Width: | Height: | Size: 274 KiB |
|
Before Width: | Height: | Size: 274 KiB After Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 19 KiB |
@@ -2,9 +2,9 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200">
|
||||
<defs>
|
||||
<linearGradient id="background" x1="0%" y1="0%" x2="0%" y2="100%">
|
||||
<stop offset="0" style="stop-color:#7c67e4; stop-opacity:1" />
|
||||
<stop offset="1" style="stop-color:#261386; stop-opacity:1" />
|
||||
<stop offset="0" style="stop-color:#7c67e4; stop-opacity:0" />
|
||||
<stop offset="1" style="stop-color:#261386; stop-opacity:0" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<rect width="200" height="200" fill="url(#background)" />
|
||||
</svg>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 418 B After Width: | Height: | Size: 419 B |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 19 KiB |
513
assets/miniapps/accountdata.html
Normal file
@@ -0,0 +1,513 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||
<meta name="mini-app-id" content="accountdata">
|
||||
<meta name="mini-app-name" content="Account Data">
|
||||
<meta name="mini-app-category" content="developer">
|
||||
<meta name="mini-app-description" content="Read and edit the account data of your Matrix account.">
|
||||
<meta name="mini-app-logo" content="">
|
||||
<meta name="mini-app-in-chat" content="false">
|
||||
<title>Account Data</title>
|
||||
<style>
|
||||
:root {
|
||||
--accent: #1F8EF1;
|
||||
--bg: #ffffff;
|
||||
--fg: #1a1a1a;
|
||||
--card: #f6f6f6;
|
||||
--border: #e3e3e3;
|
||||
--muted: #757575;
|
||||
--danger: #d93025;
|
||||
--ok: #00D084;
|
||||
}
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--bg: #121212;
|
||||
--fg: #e3e3e3;
|
||||
--card: #1e1e1e;
|
||||
--border: #333333;
|
||||
--muted: #9e9e9e;
|
||||
}
|
||||
}
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
body {
|
||||
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
||||
background: var(--bg);
|
||||
color: var(--fg);
|
||||
min-height: 100vh;
|
||||
}
|
||||
main { max-width: 800px; margin: 0 auto; padding: 20px 16px 32px; }
|
||||
header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
|
||||
header .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
|
||||
header h1 { font-size: 1.3rem; font-weight: 700; }
|
||||
|
||||
/* Profile card */
|
||||
#profile {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 16px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 12px;
|
||||
background: var(--card);
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
#profile img {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border-radius: 50%;
|
||||
object-fit: cover;
|
||||
background: var(--border);
|
||||
}
|
||||
#profile .placeholder {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: var(--accent);
|
||||
color: #fff;
|
||||
font-weight: 700;
|
||||
font-size: 1.3rem;
|
||||
}
|
||||
#profile .info { min-width: 0; }
|
||||
#profile .name { font-weight: 700; font-size: 1.05rem; word-break: break-word; }
|
||||
#profile .meta { color: var(--muted); font-size: .85rem; word-break: break-word; }
|
||||
|
||||
/* Toolbar */
|
||||
#toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 8px; flex-wrap: wrap; }
|
||||
#toolbar h2 { font-size: 1rem; font-weight: 600; }
|
||||
#toolbar .actions { display: flex; gap: 8px; }
|
||||
button {
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
background: var(--card);
|
||||
color: var(--fg);
|
||||
padding: 8px 14px;
|
||||
font-size: .88rem;
|
||||
cursor: pointer;
|
||||
font-family: inherit;
|
||||
}
|
||||
button:hover { border-color: var(--accent); }
|
||||
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
|
||||
button.primary:hover { opacity: .9; }
|
||||
button.danger { color: var(--danger); }
|
||||
#addKeyBtn { flex-shrink: 0; }
|
||||
|
||||
/* Key cards */
|
||||
#list { list-style: none; }
|
||||
.key-card {
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 12px;
|
||||
background: var(--card);
|
||||
margin-bottom: 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.key-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 12px 14px;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
}
|
||||
.key-head .key {
|
||||
flex: 1;
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||
font-size: .85rem;
|
||||
word-break: break-all;
|
||||
}
|
||||
.key-head .chevron {
|
||||
color: var(--muted);
|
||||
font-size: .8rem;
|
||||
transition: transform .15s;
|
||||
}
|
||||
.key-card.open .chevron { transform: rotate(90deg); }
|
||||
.key-head .size {
|
||||
color: var(--muted);
|
||||
font-size: .75rem;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.key-body {
|
||||
display: none;
|
||||
border-top: 1px solid var(--border);
|
||||
padding: 12px 14px;
|
||||
}
|
||||
.key-card.open .key-body { display: block; }
|
||||
textarea {
|
||||
width: 100%;
|
||||
min-height: 160px;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
background: var(--bg);
|
||||
color: var(--fg);
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||
font-size: .8rem;
|
||||
resize: vertical;
|
||||
outline: none;
|
||||
}
|
||||
textarea:focus { border-color: var(--accent); }
|
||||
.key-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
|
||||
.status {
|
||||
display: none;
|
||||
margin-top: 10px;
|
||||
padding: 8px 12px;
|
||||
border-radius: 8px;
|
||||
font-size: .85rem;
|
||||
}
|
||||
.status.ok { display: block; background: rgba(0, 208, 132, .15); color: var(--ok); }
|
||||
.status.err { display: block; background: rgba(217, 48, 37, .12); color: var(--danger); }
|
||||
|
||||
.empty { text-align: center; padding: 48px 0 24px; color: var(--muted); }
|
||||
.spinner {
|
||||
margin: 60px auto;
|
||||
width: 32px; height: 32px;
|
||||
border: 3px solid var(--border);
|
||||
border-top-color: var(--accent);
|
||||
border-radius: 50%;
|
||||
animation: spin .8s linear infinite;
|
||||
}
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
|
||||
/* Add key modal */
|
||||
#modalBg {
|
||||
display: none;
|
||||
position: fixed; inset: 0;
|
||||
background: rgba(0,0,0,.5);
|
||||
align-items: center; justify-content: center;
|
||||
padding: 16px; z-index: 10;
|
||||
}
|
||||
#modalBg.open { display: flex; }
|
||||
#modal {
|
||||
width: 100%; max-width: 560px;
|
||||
background: var(--bg);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 14px;
|
||||
padding: 20px;
|
||||
max-height: 90vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
#modal h3 { margin-bottom: 6px; font-size: 1rem; }
|
||||
#modal p.hint { color: var(--muted); font-size: .82rem; margin-bottom: 14px; }
|
||||
#modal label { display: block; font-size: .85rem; margin-bottom: 4px; }
|
||||
#newKeyType {
|
||||
width: 100%;
|
||||
padding: 9px 12px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
background: var(--card);
|
||||
color: var(--fg);
|
||||
font-family: ui-monospace, Menlo, Consolas, monospace;
|
||||
font-size: .82rem;
|
||||
margin-bottom: 12px;
|
||||
outline: none;
|
||||
}
|
||||
#modal .modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<header>
|
||||
<div class="dot"></div>
|
||||
<h1>Account Data</h1>
|
||||
</header>
|
||||
|
||||
<div id="profile"></div>
|
||||
|
||||
<div id="toolbar">
|
||||
<h2>Keys</h2>
|
||||
<div class="actions">
|
||||
<button id="reloadBtn" title="Reload">↻ Reload</button>
|
||||
<button id="addKeyBtn" class="primary">+ Add key</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul id="list"></ul>
|
||||
|
||||
<div id="modalBg">
|
||||
<div id="modal">
|
||||
<h3>Add new key</h3>
|
||||
<p class="hint">The content must be a valid JSON object.</p>
|
||||
<label for="newKeyType">Key type</label>
|
||||
<input id="newKeyType" placeholder="e.g. com.example.data" />
|
||||
<label for="newKeyContent">Content (JSON)</label>
|
||||
<textarea id="newKeyContent" style="min-height:120px">{}</textarea>
|
||||
<div class="modal-actions">
|
||||
<button id="modalCancel">Cancel</button>
|
||||
<button id="modalSave" class="primary">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script>
|
||||
const APP_ID = 'accountdata';
|
||||
|
||||
// ----- Bridge (same protocol as tasks.html).
|
||||
const _pending = new Map();
|
||||
let _requestCounter = 0;
|
||||
|
||||
function bridgeRequest(action, data) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
const requestId = 'r' + (++_requestCounter);
|
||||
_pending.set(requestId, { resolve: resolve, reject: reject });
|
||||
window.parent.postMessage({
|
||||
api: 'fromMiniApp',
|
||||
widgetId: APP_ID,
|
||||
requestId: requestId,
|
||||
action: action,
|
||||
data: data
|
||||
}, '*');
|
||||
});
|
||||
}
|
||||
|
||||
window.addEventListener('message', function (event) {
|
||||
const msg = event.data;
|
||||
if (!msg || msg.api !== 'fromMiniApp' || !msg.requestId) return;
|
||||
if (msg.response === undefined) return;
|
||||
if (!_pending.has(msg.requestId)) return;
|
||||
const pending = _pending.get(msg.requestId);
|
||||
_pending.delete(msg.requestId);
|
||||
const response = msg.response || {};
|
||||
if (response.error) {
|
||||
pending.reject(new Error(response.error));
|
||||
} else {
|
||||
pending.resolve(response.data);
|
||||
}
|
||||
});
|
||||
|
||||
// ----- App state and DOM.
|
||||
const profileEl = document.getElementById('profile');
|
||||
const listEl = document.getElementById('list');
|
||||
const modalBg = document.getElementById('modalBg');
|
||||
const newKeyType = document.getElementById('newKeyType');
|
||||
const newKeyContent = document.getElementById('newKeyContent');
|
||||
|
||||
const KEY_DENYLIST = ['m.cross_signing.user_signing', 'm.cross_signing.master'];
|
||||
|
||||
document.getElementById('reloadBtn').addEventListener('click', init);
|
||||
document.getElementById('addKeyBtn').addEventListener('click', openModal);
|
||||
document.getElementById('modalCancel').addEventListener('click', closeModal);
|
||||
modalBg.addEventListener('click', function (e) {
|
||||
if (e.target === modalBg) closeModal();
|
||||
});
|
||||
document.getElementById('modalSave').addEventListener('click', saveNewKey);
|
||||
|
||||
function openModal() {
|
||||
newKeyType.value = '';
|
||||
newKeyContent.value = '{}';
|
||||
modalBg.classList.add('open');
|
||||
newKeyType.focus();
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
modalBg.classList.remove('open');
|
||||
}
|
||||
|
||||
async function saveNewKey() {
|
||||
const type = newKeyType.value.trim();
|
||||
if (!type) { alert('Enter a key type.'); return; }
|
||||
let content;
|
||||
try {
|
||||
content = JSON.parse(newKeyContent.value);
|
||||
} catch (e) {
|
||||
alert('Invalid JSON: ' + e.message);
|
||||
return;
|
||||
}
|
||||
if (!content || typeof content !== 'object' || Array.isArray(content)) {
|
||||
alert('Content must be a JSON object.');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await bridgeRequest('io.tatuchat.accountdata.set', {
|
||||
key: type,
|
||||
content: content
|
||||
});
|
||||
closeModal();
|
||||
init();
|
||||
} catch (e) {
|
||||
alert('Failed to save: ' + e.message);
|
||||
}
|
||||
}
|
||||
|
||||
async function init() {
|
||||
listEl.innerHTML = '<div class="spinner"></div>';
|
||||
try {
|
||||
const [identity, data] = await Promise.all([
|
||||
bridgeRequest('io.tatuchat.identity.get'),
|
||||
bridgeRequest('io.tatuchat.accountdata.list')
|
||||
]);
|
||||
renderProfile(identity || {});
|
||||
renderList(data || {});
|
||||
} catch (e) {
|
||||
listEl.innerHTML = '<div class="empty">Failed to load: ' + escapeHtml(String(e.message || e)) + '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
function renderProfile(info) {
|
||||
const displayName = info.displayName || info.userId || 'Anonymous';
|
||||
const initials = displayName.trim().charAt(0).toUpperCase() || '?';
|
||||
const avatar = (info.avatarDataUri || info.avatarHttpUrl)
|
||||
? '<img src="' + escapeHtml(info.avatarDataUri || info.avatarHttpUrl) + '" alt="avatar">'
|
||||
: '<div class="placeholder">' + escapeHtml(initials) + '</div>';
|
||||
const meta = [];
|
||||
if (info.userId) meta.push(escapeHtml(info.userId));
|
||||
if (info.homeserver) meta.push(escapeHtml(info.homeserver));
|
||||
profileEl.innerHTML =
|
||||
avatar +
|
||||
'<div class="info">' +
|
||||
'<div class="name">' + escapeHtml(displayName) + '</div>' +
|
||||
'<div class="meta">' + meta.join(' · ') + '</div>' +
|
||||
'</div>';
|
||||
}
|
||||
|
||||
function renderList(data) {
|
||||
const keys = Object.keys(data || {}).sort();
|
||||
listEl.textContent = '';
|
||||
if (keys.length === 0) {
|
||||
const empty = document.createElement('div');
|
||||
empty.className = 'empty';
|
||||
empty.textContent = 'No account data yet';
|
||||
listEl.appendChild(empty);
|
||||
return;
|
||||
}
|
||||
keys.forEach(function (key) {
|
||||
listEl.appendChild(buildCard(key, data[key]));
|
||||
});
|
||||
}
|
||||
|
||||
function buildCard(key, content) {
|
||||
const card = document.createElement('li');
|
||||
card.className = 'key-card';
|
||||
|
||||
const head = document.createElement('div');
|
||||
head.className = 'key-head';
|
||||
const keySpan = document.createElement('span');
|
||||
keySpan.className = 'key';
|
||||
keySpan.textContent = key;
|
||||
const chevron = document.createElement('span');
|
||||
chevron.className = 'chevron';
|
||||
chevron.textContent = '\u25B8';
|
||||
const size = document.createElement('span');
|
||||
size.className = 'size';
|
||||
let sizeText;
|
||||
try {
|
||||
sizeText = (JSON.stringify(content) || '').length + ' B';
|
||||
} catch (e) {
|
||||
sizeText = '?';
|
||||
}
|
||||
size.textContent = sizeText;
|
||||
head.append(keySpan, size, chevron);
|
||||
|
||||
const body = document.createElement('div');
|
||||
body.className = 'key-body';
|
||||
const textarea = document.createElement('textarea');
|
||||
textarea.spellcheck = false;
|
||||
try {
|
||||
textarea.value = JSON.stringify(content, null, 2);
|
||||
} catch (e) {
|
||||
textarea.value = '// not serializable';
|
||||
}
|
||||
const actions = document.createElement('div');
|
||||
actions.className = 'key-actions';
|
||||
const status = document.createElement('div');
|
||||
status.className = 'status';
|
||||
|
||||
const saveBtn = document.createElement('button');
|
||||
saveBtn.className = 'primary';
|
||||
saveBtn.textContent = 'Save';
|
||||
saveBtn.addEventListener('click', async function () {
|
||||
status.className = 'status';
|
||||
if (KEY_DENYLIST.includes(key)) {
|
||||
status.className = 'status err';
|
||||
status.textContent = 'This key is protected and cannot be edited.';
|
||||
return;
|
||||
}
|
||||
let value;
|
||||
try {
|
||||
value = JSON.parse(textarea.value);
|
||||
} catch (e) {
|
||||
status.className = 'status err';
|
||||
status.textContent = 'Invalid JSON: ' + e.message;
|
||||
return;
|
||||
}
|
||||
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
||||
status.className = 'status err';
|
||||
status.textContent = 'Content must be a JSON object.';
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await bridgeRequest('io.tatuchat.accountdata.set', { key: key, content: value });
|
||||
status.className = 'status ok';
|
||||
status.textContent = 'Saved. Reloading...';
|
||||
await init();
|
||||
} catch (e) {
|
||||
status.className = 'status err';
|
||||
status.textContent = 'Save failed: ' + (e.message || e);
|
||||
}
|
||||
});
|
||||
|
||||
const resetBtn = document.createElement('button');
|
||||
resetBtn.textContent = 'Reset';
|
||||
resetBtn.addEventListener('click', function () {
|
||||
try {
|
||||
textarea.value = JSON.stringify(content, null, 2);
|
||||
} catch (e) {}
|
||||
});
|
||||
|
||||
actions.append(saveBtn, resetBtn);
|
||||
body.append(textarea, actions, status);
|
||||
|
||||
head.addEventListener('click', function () {
|
||||
card.classList.toggle('open');
|
||||
});
|
||||
// Don't toggle when clicking buttons inside the body.
|
||||
body.addEventListener('click', function (e) { e.stopPropagation(); });
|
||||
|
||||
card.append(head, body);
|
||||
return card;
|
||||
}
|
||||
|
||||
function escapeHtml(value) {
|
||||
return String(value)
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"');
|
||||
}
|
||||
|
||||
// Follow the theme TatuChat is *actually* using instead of the environment's
|
||||
// `prefers-color-scheme` (which on native webviews follows the device, not
|
||||
// the app). Applies the palette reported by `io.tatuchat.theme.get`.
|
||||
function applyTatuTheme(palette) {
|
||||
if (!palette) return;
|
||||
var root = document.documentElement.style;
|
||||
var vars = {
|
||||
'--accent': palette.primary,
|
||||
'--bg': palette.surface,
|
||||
'--fg': palette.onSurface,
|
||||
'--card': palette.surfaceContainer,
|
||||
'--border': palette.outlineVariant,
|
||||
'--muted': palette.onSurfaceVariant,
|
||||
'--danger': palette.error,
|
||||
'--ok': palette.primary
|
||||
};
|
||||
Object.keys(vars).forEach(function (key) {
|
||||
if (vars[key]) root.setProperty(key, vars[key]);
|
||||
});
|
||||
if (palette.brightness) {
|
||||
document.documentElement.style.colorScheme = palette.brightness;
|
||||
}
|
||||
}
|
||||
|
||||
bridgeRequest('io.tatuchat.theme.get').then(function (res) {
|
||||
applyTatuTheme(res && res.palette);
|
||||
}).catch(function () {});
|
||||
|
||||
init();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
242
assets/miniapps/tasks.html
Normal file
@@ -0,0 +1,242 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||
<meta name="mini-app-id" content="tasks">
|
||||
<meta name="mini-app-name" content="Tasks">
|
||||
<meta name="mini-app-category" content="productivity">
|
||||
<meta name="mini-app-description" content="A simple task checklist that lives in your Matrix account data.">
|
||||
<meta name="mini-app-logo" content="">
|
||||
<meta name="mini-app-in-chat" content="false">
|
||||
<title>Tasks</title>
|
||||
<style>
|
||||
:root {
|
||||
--accent: #00D084;
|
||||
--bg: #ffffff;
|
||||
--fg: #1a1a1a;
|
||||
--card: #f6f6f6;
|
||||
--border: #e3e3e3;
|
||||
--muted: #757575;
|
||||
}
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--bg: #121212;
|
||||
--fg: #e3e3e3;
|
||||
--card: #1e1e1e;
|
||||
--border: #333333;
|
||||
--muted: #9e9e9e;
|
||||
}
|
||||
}
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
body {
|
||||
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
||||
background: var(--bg);
|
||||
color: var(--fg);
|
||||
min-height: 100vh;
|
||||
}
|
||||
main { max-width: 640px; margin: 0 auto; padding: 20px 16px 32px; }
|
||||
header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
|
||||
header .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
|
||||
header h1 { font-size: 1.3rem; font-weight: 700; }
|
||||
#addForm { display: flex; gap: 8px; margin-bottom: 20px; }
|
||||
#taskInput {
|
||||
flex: 1;
|
||||
padding: 11px 14px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
background: var(--card);
|
||||
color: var(--fg);
|
||||
font-size: 0.95rem;
|
||||
outline: none;
|
||||
}
|
||||
#taskInput:focus { border-color: var(--accent); }
|
||||
#addBtn {
|
||||
width: 44px;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
background: var(--accent);
|
||||
color: #fff;
|
||||
font-size: 1.4rem;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
}
|
||||
ul { list-style: none; }
|
||||
li {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 12px 14px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
margin-bottom: 10px;
|
||||
background: var(--card);
|
||||
}
|
||||
li.done span { text-decoration: line-through; opacity: .55; }
|
||||
li input[type="checkbox"] {
|
||||
flex-shrink: 0;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
accent-color: var(--accent);
|
||||
cursor: pointer;
|
||||
}
|
||||
li span { flex: 1; word-break: break-word; }
|
||||
li button {
|
||||
flex-shrink: 0;
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--muted);
|
||||
font-size: 0.9rem;
|
||||
cursor: pointer;
|
||||
padding: 4px;
|
||||
}
|
||||
li button:hover { color: var(--fg); }
|
||||
.empty { text-align: center; padding: 48px 0 24px; color: var(--muted); }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<header>
|
||||
<div class="dot"></div>
|
||||
<h1>Tasks</h1>
|
||||
</header>
|
||||
<form id="addForm" autocomplete="off">
|
||||
<input id="taskInput" placeholder="What do you need to do?" />
|
||||
<button id="addBtn" type="submit">+</button>
|
||||
</form>
|
||||
<ul id="list"></ul>
|
||||
</main>
|
||||
<script>
|
||||
const APP_ID = 'tasks';
|
||||
|
||||
// ----- Bridge: the app talks to the TatuChat client through postMessage.
|
||||
// The host replies with {api, widgetId, requestId, response:{data,error}}.
|
||||
const _pending = new Map();
|
||||
let _requestCounter = 0;
|
||||
|
||||
function bridgeRequest(action, data) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
const requestId = 'r' + (++_requestCounter);
|
||||
_pending.set(requestId, { resolve: resolve, reject: reject });
|
||||
window.parent.postMessage({
|
||||
api: 'fromMiniApp',
|
||||
widgetId: APP_ID,
|
||||
requestId: requestId,
|
||||
action: action,
|
||||
data: data
|
||||
}, '*');
|
||||
});
|
||||
}
|
||||
|
||||
window.addEventListener('message', function (event) {
|
||||
const msg = event.data;
|
||||
if (!msg || msg.api !== 'fromMiniApp' || !msg.requestId) return;
|
||||
if (msg.response === undefined) return;
|
||||
if (!_pending.has(msg.requestId)) return;
|
||||
const pending = _pending.get(msg.requestId);
|
||||
_pending.delete(msg.requestId);
|
||||
const response = msg.response || {};
|
||||
if (response.error) {
|
||||
pending.reject(new Error(response.error));
|
||||
} else {
|
||||
pending.resolve(response.data);
|
||||
}
|
||||
});
|
||||
|
||||
// ----- Tasks application logic.
|
||||
let tasks = [];
|
||||
const listEl = document.getElementById('list');
|
||||
const addForm = document.getElementById('addForm');
|
||||
const taskInput = document.getElementById('taskInput');
|
||||
|
||||
addForm.addEventListener('submit', function (event) {
|
||||
event.preventDefault();
|
||||
const text = taskInput.value.trim();
|
||||
if (!text) return;
|
||||
tasks.push({ id: String(Date.now()), text: text, done: false });
|
||||
taskInput.value = '';
|
||||
render();
|
||||
save();
|
||||
});
|
||||
|
||||
function toggleTask(id) {
|
||||
const task = tasks.find(function (t) { return t.id === id; });
|
||||
if (!task) return;
|
||||
task.done = !task.done;
|
||||
render();
|
||||
save();
|
||||
}
|
||||
|
||||
function deleteTask(id) {
|
||||
tasks = tasks.filter(function (t) { return t.id !== id; });
|
||||
render();
|
||||
save();
|
||||
}
|
||||
|
||||
function render() {
|
||||
listEl.textContent = '';
|
||||
if (tasks.length === 0) {
|
||||
const empty = document.createElement('div');
|
||||
empty.className = 'empty';
|
||||
empty.textContent = 'No tasks yet';
|
||||
listEl.appendChild(empty);
|
||||
return;
|
||||
}
|
||||
tasks.forEach(function (task) {
|
||||
const li = document.createElement('li');
|
||||
if (task.done) li.className = 'done';
|
||||
const checkbox = document.createElement('input');
|
||||
checkbox.type = 'checkbox';
|
||||
checkbox.checked = task.done;
|
||||
checkbox.addEventListener('change', function () { toggleTask(task.id); });
|
||||
const span = document.createElement('span');
|
||||
span.textContent = task.text;
|
||||
const del = document.createElement('button');
|
||||
del.textContent = '\u2715';
|
||||
del.setAttribute('aria-label', 'Delete task');
|
||||
del.addEventListener('click', function () { deleteTask(task.id); });
|
||||
li.append(checkbox, span, del);
|
||||
listEl.appendChild(li);
|
||||
});
|
||||
}
|
||||
|
||||
function load() {
|
||||
return bridgeRequest('io.tatuchat.storage.load').then(function (data) {
|
||||
if (data && Array.isArray(data.tasks)) tasks = data.tasks;
|
||||
}).catch(function () {});
|
||||
}
|
||||
|
||||
function save() {
|
||||
return bridgeRequest('io.tatuchat.storage.save', { tasks: tasks }).catch(function () {});
|
||||
}
|
||||
|
||||
// Follow the theme TatuChat is *actually* using instead of the environment's
|
||||
// `prefers-color-scheme` (which on native webviews follows the device, not
|
||||
// the app). Applies the palette reported by `io.tatuchat.theme.get`.
|
||||
function applyTatuTheme(palette) {
|
||||
if (!palette) return;
|
||||
var root = document.documentElement.style;
|
||||
var vars = {
|
||||
'--accent': palette.primary,
|
||||
'--bg': palette.surface,
|
||||
'--fg': palette.onSurface,
|
||||
'--card': palette.surfaceContainer,
|
||||
'--border': palette.outlineVariant,
|
||||
'--muted': palette.onSurfaceVariant
|
||||
};
|
||||
Object.keys(vars).forEach(function (key) {
|
||||
if (vars[key]) root.setProperty(key, vars[key]);
|
||||
});
|
||||
if (palette.brightness) {
|
||||
document.documentElement.style.colorScheme = palette.brightness;
|
||||
}
|
||||
}
|
||||
|
||||
bridgeRequest('io.tatuchat.theme.get').then(function (res) {
|
||||
applyTatuTheme(res && res.palette);
|
||||
}).catch(function () {});
|
||||
|
||||
load().finally(render);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,7 +3,7 @@
|
||||
"defaultHomeserver": "https://matrix.weltonmoura.com.br",
|
||||
"presetHomeserver": "https://matrix.weltonmoura.com.br",
|
||||
"welcomeText": "",
|
||||
"privacyUrl": "https://github.com/krille-chan/fluffychat/blob/main/PRIVACY.md",
|
||||
"privacyUrl": "https://tatuchat.weltonmoura.com.br/home/politica-de-privacidade/",
|
||||
"audioRecordingNumChannels": 1,
|
||||
"audioRecordingAutoGain": true,
|
||||
"audioRecordingEchoCancel": false,
|
||||
|
||||
209
docs/miniapps.md
Normal file
@@ -0,0 +1,209 @@
|
||||
# TatuChat Mini Apps
|
||||
|
||||
Mini apps are small, self-contained HTML documents that run inside TatuChat in a
|
||||
sandboxed web view. They can read/write their own key-value store, inspect the
|
||||
user's profile and read/write arbitrary account data through a tiny messaging
|
||||
bridge. There are no dependencies and no build step: an app is just one `.html`
|
||||
file.
|
||||
|
||||
## Creating a mini app
|
||||
|
||||
1. Write a single `.html` file (assets may be inlined; see limitations below).
|
||||
2. Import it in TatuChat:
|
||||
- **From file:** open *Apps* → the **import** menu → *Import from file* and
|
||||
pick your `.html` file.
|
||||
- **From URL:** *Apps* → import menu → *Import from URL* and paste a link to
|
||||
the HTML document.
|
||||
3. Open the app from the *Installed* list. Use the reload button in the top bar
|
||||
while developing.
|
||||
|
||||
The available apps page (`/rooms/apps`) lists the built-in apps (`tasks`,
|
||||
`accountdata`) under *Installed* once you install them, plus every app you
|
||||
import.
|
||||
|
||||
## Manifest (meta tags)
|
||||
|
||||
Before installing an app, TatuChat reads the `<meta>` tags of the document and
|
||||
uses them as the app's manifest. **Every tag listed below must be present** in
|
||||
the `<head>` of your document, even if the value is empty — except `id` and
|
||||
`name`, which must also be non-empty. An app that is missing any of these tags
|
||||
**cannot be installed**.
|
||||
|
||||
```html
|
||||
<meta name="mini-app-id" content="myapp">
|
||||
<meta name="mini-app-name" content="My App">
|
||||
<meta name="mini-app-category" content="productivity">
|
||||
<meta name="mini-app-description" content="What my app does">
|
||||
<meta name="mini-app-logo" content=""> <!-- empty is allowed -->
|
||||
<meta name="mini-app-in-chat" content="false"> <!-- true|false -->
|
||||
```
|
||||
|
||||
`mini-app-in-chat` must be `true` or `false` (empty defaults to `false`).
|
||||
Values are trimmed and read case-insensitively.
|
||||
|
||||
The `mini-app-id` is used **as the key in the account data store**: the app's
|
||||
store is persisted under `im.tatuchat.miniapps.data.<id>` and its HTML source
|
||||
under `im.tatuchat.miniapps.source.<id>`. It must be unique: ids of built-in
|
||||
apps (`tasks`, `accountdata`) are reserved and an already installed id cannot
|
||||
be reused. This id is also the `widgetId` your app must send in the bridge
|
||||
protocol.
|
||||
|
||||
The remaining fields are stored as metadata (`category`, `description`, `logo`,
|
||||
`inChat`) and shown in the *Apps* page.
|
||||
|
||||
## Talking to TatuChat
|
||||
|
||||
The host listens for `message` events. A channel app sends a request with
|
||||
`window.parent.postMessage`, and the host answers with the same `requestId`.
|
||||
Replies are delivered in an event with a `response` object of the form
|
||||
`{data, error}`.
|
||||
|
||||
Request payload:
|
||||
|
||||
```js
|
||||
{
|
||||
api: 'fromMiniApp',
|
||||
widgetId: '<appId>',
|
||||
requestId: 'any-unique-string',
|
||||
action: 'io.tatuchat.storage.load', // one of the actions below
|
||||
data: { /* action-specific payload */ }
|
||||
}
|
||||
```
|
||||
|
||||
Helper for your app (copy this into your HTML):
|
||||
|
||||
```js
|
||||
const APP_ID = 'myapp'; // must match the app id
|
||||
const _pending = new Map();
|
||||
let _requestCounter = 0;
|
||||
|
||||
function bridgeRequest(action, data) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
const requestId = 'r' + (++_requestCounter);
|
||||
_pending.set(requestId, { resolve: resolve, reject: reject });
|
||||
window.parent.postMessage({
|
||||
api: 'fromMiniApp',
|
||||
widgetId: APP_ID,
|
||||
requestId: requestId,
|
||||
action: action,
|
||||
data: data
|
||||
}, '*');
|
||||
});
|
||||
}
|
||||
|
||||
window.addEventListener('message', function (event) {
|
||||
const msg = event.data;
|
||||
if (!msg || msg.api !== 'fromMiniApp' || !msg.requestId) return;
|
||||
if (msg.response === undefined) return;
|
||||
if (!_pending.has(msg.requestId)) return;
|
||||
const pending = _pending.get(msg.requestId);
|
||||
_pending.delete(msg.requestId);
|
||||
const response = msg.response;
|
||||
if (response.error) pending.reject(new Error(response.error));
|
||||
else pending.resolve(response.data);
|
||||
});
|
||||
```
|
||||
|
||||
## Available actions
|
||||
|
||||
### `io.tatuchat.storage.load`
|
||||
|
||||
Loads the app's own key-value store (persisted in the user's account data under
|
||||
`im.tatuchat.miniapps.data.<appId>`). Resolves with a plain object.
|
||||
|
||||
```js
|
||||
const data = await bridgeRequest('io.tatuchat.storage.load');
|
||||
// data => { ... } (any JSON values previously saved)
|
||||
```
|
||||
|
||||
### `io.tatuchat.storage.save`
|
||||
|
||||
Replaces the whole store. `data` must be an object. Resolves with `null`.
|
||||
|
||||
```js
|
||||
await bridgeRequest('io.tatuchat.storage.save', { tasks: [...], version: 1 });
|
||||
```
|
||||
|
||||
> Note: this **replaces** the entire store; there is no per-key merge. Load,
|
||||
> mutate, then save.
|
||||
|
||||
### `io.tatuchat.identity.get`
|
||||
|
||||
Resolves with the signed-in user's profile:
|
||||
|
||||
```js
|
||||
const info = await bridgeRequest('io.tatuchat.identity.get');
|
||||
// => {
|
||||
// userId: '@user:server',
|
||||
// displayName: 'Tatu',
|
||||
// avatarUrl: 'mxc://server/...',
|
||||
// avatarHttpUrl: 'https://.../download/...', // may require auth
|
||||
// avatarDataUri: 'data:image/png;base64,...', // always renderable
|
||||
// homeserver: 'https://server.example'
|
||||
// }
|
||||
```
|
||||
|
||||
The `avatarDataUri` is a base64 data URI fetched by TatuChat with the user's
|
||||
credentials. **Use `avatarDataUri` for `<img src>`** – the homeserver usually
|
||||
requires an authenticated media request that a plain `<img>` tag cannot send
|
||||
(this is what caused the `M_MISSING_TOKEN` error). Fall back to `avatarHttpUrl`
|
||||
only if `avatarDataUri` is absent.
|
||||
|
||||
### `io.tatuchat.theme.get`
|
||||
|
||||
Resolves with the color palette currently used by TatuChat, so your app can
|
||||
match the ecosystem (light/dark aware). Colors are `#RRGGBBAA` hex strings
|
||||
(CSS 8-digit order: red, green, blue, alpha) suitable for CSS.
|
||||
|
||||
```js
|
||||
const { palette } = await bridgeRequest('io.tatuchat.theme.get');
|
||||
// => {
|
||||
// brightness: 'light' | 'dark',
|
||||
// primary: '#00D084FF',
|
||||
// onPrimary: '#000000FF',
|
||||
// primaryContainer: '#00D08433',
|
||||
// surface: '#FEF7FF00',
|
||||
// surfaceContainerLowest/Low/Container/High/Highest: '#…',
|
||||
// secondary..., tertiary..., error...,
|
||||
// outline, outlineVariant, background, onBackground, onSurface, ...
|
||||
// }
|
||||
document.documentElement.style.setProperty('--primary', palette.primary);
|
||||
```
|
||||
|
||||
### `io.tatuchat.accountdata.list`
|
||||
|
||||
Resolves with a map of **all** account data of the signed-in user as an object
|
||||
of `{ key: { ...content } }`.
|
||||
|
||||
### `io.tatuchat.accountdata.get`
|
||||
|
||||
`data: { key: 'org.example.something' }` resolves with `{ key, content }` where
|
||||
`content` is the stored JSON content (or `{}` if absent).
|
||||
|
||||
### `io.tatuchat.accountdata.set`
|
||||
|
||||
`data: { key: 'org.example.something', content: { ... } }` stores or replaces
|
||||
the content of that account data key. Resolves with `null`.
|
||||
|
||||
## Caveats & limitations
|
||||
|
||||
- **Distribution / installation:** apps imported from URL must be served with
|
||||
permissive CORS headers (`Access-Control-Allow-Origin`) so the browser can
|
||||
read them. On the web, TatuChat retries through a CORS proxy if you configure
|
||||
one (setting `miniAppCorsProxy` in the app settings/config). If the server
|
||||
blocks cross-origin reads, import the `.html` file manually instead.
|
||||
- **Size:** the HTML source is stored in the user's account data, where
|
||||
individual events are limited to about **64 KB** (homeservers like matrix.org
|
||||
enforce this). Keep mini apps small and inline the assets; or load heavy
|
||||
content from a URL at runtime.
|
||||
- **Security:** the app runs in a sandboxed web view with `allow-scripts` /
|
||||
`allow-forms` / `allow-same-origin`. It can only reach TatuChat through the
|
||||
bridge actions above – it cannot access the user's rooms, messages or files.
|
||||
- **No unsolicited access:** data is only exchanged when the app explicitly
|
||||
calls the bridge. The host never pushes data into the app on its own.
|
||||
- **Store is per app:** every app has its own `storage.load`/`save` namespace.
|
||||
`accountdata.*` is the only way to share data between apps.
|
||||
- **`storage.save` overwrites:** there is no merge/patch semantics.
|
||||
- **Native platforms:** the HTML is rendered by the platform web view; take
|
||||
care with features that differ between browsers (e.g. storage APIs inside the
|
||||
sandbox, `window.parent` assumptions). Prefer the bridge over `localStorage`.
|
||||
@@ -19,7 +19,7 @@ extension on TatuChatTester {
|
||||
await ensureLoggedIn();
|
||||
|
||||
// Login user 2
|
||||
await tapOn(Key('accounts_and_settings_buttons'));
|
||||
await tapOn(Icons.menu);
|
||||
await tapOn('Add account');
|
||||
await login(username: user2Name, password: user2Pw);
|
||||
await initCryptoIdentity(username: user2Name);
|
||||
|
||||
@@ -17,10 +17,11 @@ abstract class AppConfig {
|
||||
static const String inviteLinkPrefix = 'https://matrix.to/#/';
|
||||
static const String deepLinkPrefix = 'im.tatuchat://chat/';
|
||||
static const String schemePrefix = 'matrix:';
|
||||
static const String pushNotificationsChannelId = 'tatuchat_push';
|
||||
static const String pushNotificationsChannelId = 'tatuchat_push_v2';
|
||||
static const String pushNotificationsAppId = 'chat.fluffy.tatuchat';
|
||||
static const double borderRadius = 18.0;
|
||||
static const double spaceBorderRadius = 11.0;
|
||||
static const double muralBorderRadius = 11.0;
|
||||
static const double columnWidth = 360.0;
|
||||
|
||||
static const String enablePushTutorial =
|
||||
@@ -36,10 +37,13 @@ abstract class AppConfig {
|
||||
static const String muralTag = 'tatuchat_mural';
|
||||
|
||||
static const String sourceCodeUrl =
|
||||
'https://github.com/krille-chan/fluffychat';
|
||||
'https://gitea.weltonmoura.com.br/welton/tatuchat';
|
||||
static const String licenseUrl =
|
||||
'https://gitea.weltonmoura.com.br/welton/tatuchat/src/branch/main/LICENSE';
|
||||
static const String supportUrl =
|
||||
'https://github.com/krille-chan/fluffychat/issues';
|
||||
static const String changelogUrl = 'https://fluffychat.im/changelog/';
|
||||
'https://gitea.weltonmoura.com.br/welton/tatuchat/issues';
|
||||
static const String changelogUrl =
|
||||
'https://tatuchat.weltonmoura.com.br/home/';
|
||||
static const String helpUrl =
|
||||
'https://ko-fi.com/post/How-can-I-support-FluffyChat-J2G325WE6I';
|
||||
|
||||
@@ -47,8 +51,8 @@ abstract class AppConfig {
|
||||
|
||||
static final Uri newIssueUrl = Uri(
|
||||
scheme: 'https',
|
||||
host: 'github.com',
|
||||
path: '/krille-chan/fluffychat/issues/new',
|
||||
host: 'gitea.weltonmoura.com.br',
|
||||
path: '/welton/tatuchat/issues/new',
|
||||
);
|
||||
|
||||
static final Uri homeserverList = Uri(
|
||||
|
||||
162
lib/config/miniapp_config.dart
Normal file
@@ -0,0 +1,162 @@
|
||||
// SPDX-FileCopyrightText: 2019-Present Christian Kußowski
|
||||
// SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:tatchat/l10n/l10n.dart';
|
||||
import 'package:tatchat/utils/miniapp_store.dart';
|
||||
|
||||
/// ID of the built-in tasks example app.
|
||||
const String miniAppTasksId = 'tasks';
|
||||
|
||||
/// ID of the built-in account data explorer app.
|
||||
const String miniAppAccountDataId = 'accountdata';
|
||||
|
||||
/// Static registry of all built-in mini apps that ship with this build. A mini
|
||||
/// app only shows up in the "Apps" page once the user installs it (see
|
||||
/// [installedMiniApps]). Additionally to this list, users can import their own
|
||||
/// single-file HTML apps which are resolved through [resolveMiniAppConfig].
|
||||
const List<MiniAppConfig> availableMiniApps = [
|
||||
MiniAppConfig(
|
||||
id: miniAppTasksId,
|
||||
icon: Icons.checklist_rounded,
|
||||
color: Color(0xFF00D084),
|
||||
category: 'productivity',
|
||||
description:
|
||||
'A simple task checklist that lives in your Matrix account data.',
|
||||
inChat: false,
|
||||
htmlAsset: 'assets/miniapps/tasks.html',
|
||||
),
|
||||
MiniAppConfig(
|
||||
id: miniAppAccountDataId,
|
||||
icon: Icons.storage_rounded,
|
||||
color: Color(0xFF1F8EF1),
|
||||
category: 'developer',
|
||||
description: 'Read and edit the account data of your Matrix account.',
|
||||
inChat: false,
|
||||
htmlAsset: 'assets/miniapps/accountdata.html',
|
||||
),
|
||||
];
|
||||
|
||||
/// Declarative description of a mini app. The rendering is either a
|
||||
/// self-contained HTML document loaded from [htmlAsset] (built-in apps) or
|
||||
/// from [html] which is stored in the user's account data (imported apps).
|
||||
class MiniAppConfig {
|
||||
final String id;
|
||||
final IconData icon;
|
||||
final Color color;
|
||||
final String? name;
|
||||
final String? category;
|
||||
final String? description;
|
||||
|
||||
/// Logo of the app: either an http(s) URL or a `data:` URI.
|
||||
final String? logo;
|
||||
|
||||
/// Whether the mini app can run inside a chat room.
|
||||
final bool inChat;
|
||||
final String? htmlAsset;
|
||||
final String? html;
|
||||
|
||||
const MiniAppConfig({
|
||||
required this.id,
|
||||
required this.icon,
|
||||
required this.color,
|
||||
this.name,
|
||||
this.category,
|
||||
this.description,
|
||||
this.logo,
|
||||
this.inChat = false,
|
||||
this.htmlAsset,
|
||||
this.html,
|
||||
});
|
||||
|
||||
/// Config for a user-imported app whose HTML source is persisted in the
|
||||
/// account data store.
|
||||
MiniAppConfig.custom({
|
||||
required String id,
|
||||
String? name,
|
||||
String? category,
|
||||
String? description,
|
||||
String? logo,
|
||||
bool inChat = false,
|
||||
String? html,
|
||||
}) : this(
|
||||
id: id,
|
||||
icon: Icons.web_asset_rounded,
|
||||
color: const Color(0xFF9C27B0),
|
||||
name: name,
|
||||
category: category,
|
||||
description: description,
|
||||
logo: logo,
|
||||
inChat: inChat,
|
||||
html: html,
|
||||
);
|
||||
|
||||
bool get isCustom => html != null || htmlAsset == null;
|
||||
|
||||
/// Resolves the HTML source that should be rendered for this app. Returns a
|
||||
/// bundled asset path for built-in apps or the raw HTML for imported apps.
|
||||
String? get htmlSource => html ?? htmlAsset;
|
||||
}
|
||||
|
||||
/// Resolves the config of a single installed app, whether it is built-in or
|
||||
/// user-imported. Returns null if the app is not installed or not available.
|
||||
MiniAppConfig? resolveMiniAppConfig(Client client, String appId) {
|
||||
for (final app in availableMiniApps) {
|
||||
if (app.id == appId) return app;
|
||||
}
|
||||
if (client.isMiniAppInstalled(appId)) {
|
||||
final html = client.getMiniAppSource(appId);
|
||||
if (html != null) {
|
||||
return MiniAppConfig.custom(
|
||||
id: appId,
|
||||
name: client.getMiniAppName(appId),
|
||||
category: client.getMiniAppCategory(appId),
|
||||
description: client.getMiniAppDescription(appId),
|
||||
logo: client.getMiniAppLogo(appId),
|
||||
inChat: client.getMiniAppInChat(appId),
|
||||
html: html,
|
||||
);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Returns the configs of all installed apps: built-in ones plus the
|
||||
/// user-imported ones. The visual order is: installed built-in apps first,
|
||||
/// then imported apps.
|
||||
List<MiniAppConfig> installedMiniAppConfigs(Client client) {
|
||||
final installed = client.installedMiniApps;
|
||||
return [
|
||||
for (final app in availableMiniApps)
|
||||
if (installed.contains(app.id)) app,
|
||||
for (final id in installed)
|
||||
if (!availableMiniApps.any((app) => app.id == id))
|
||||
if (client.getMiniAppSource(id) != null)
|
||||
MiniAppConfig.custom(
|
||||
id: id,
|
||||
name: client.getMiniAppName(id),
|
||||
category: client.getMiniAppCategory(id),
|
||||
description: client.getMiniAppDescription(id),
|
||||
logo: client.getMiniAppLogo(id),
|
||||
inChat: client.getMiniAppInChat(id),
|
||||
html: client.getMiniAppSource(id),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
/// Resolves the localized display name of a mini app configuration.
|
||||
String miniAppName(BuildContext context, MiniAppConfig app) {
|
||||
final customName = app.name;
|
||||
if (customName != null && customName.isNotEmpty) return customName;
|
||||
switch (app.id) {
|
||||
case miniAppTasksId:
|
||||
return L10n.of(context).tasks;
|
||||
case miniAppAccountDataId:
|
||||
return L10n.of(context).accountDataEditor;
|
||||
default:
|
||||
return app.id;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,8 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:tatchat/config/themes.dart';
|
||||
import 'package:tatchat/pages/apps/apps.dart';
|
||||
import 'package:tatchat/pages/apps/miniapp_page.dart';
|
||||
import 'package:tatchat/pages/archive/archive.dart';
|
||||
import 'package:tatchat/pages/bootstrap/bootstrap_page.dart';
|
||||
import 'package:tatchat/pages/chat/chat.dart';
|
||||
@@ -241,6 +243,23 @@ abstract class AppRoutes {
|
||||
),
|
||||
redirect: loggedOutRedirect,
|
||||
),
|
||||
GoRoute(
|
||||
path: 'apps',
|
||||
pageBuilder: (context, state) =>
|
||||
defaultPageBuilder(context, state, const Apps()),
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: ':appId',
|
||||
pageBuilder: (context, state) => defaultPageBuilder(
|
||||
context,
|
||||
state,
|
||||
MiniAppPage(appId: state.pathParameters['appId']!),
|
||||
),
|
||||
redirect: loggedOutRedirect,
|
||||
),
|
||||
],
|
||||
redirect: loggedOutRedirect,
|
||||
),
|
||||
ShellRoute(
|
||||
pageBuilder: (context, state, child) => defaultPageBuilder(
|
||||
context,
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:async/async.dart';
|
||||
import 'package:tatchat/utils/platform_infos.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:managed_configurations/managed_configurations.dart';
|
||||
import 'package:matrix/matrix_api_lite/utils/logs.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:tatchat/utils/platform_infos.dart';
|
||||
|
||||
enum AppSettings<T> {
|
||||
textMessageMaxLength<int>('textMessageMaxLength', 16384),
|
||||
@@ -29,7 +29,7 @@ enum AppSettings<T> {
|
||||
unifiedPushEndpoint<String>('chat.fluffy.unifiedpush.endpoint', ''),
|
||||
pushNotificationsGatewayUrl<String>(
|
||||
'pushNotificationsGatewayUrl',
|
||||
'https://push.fluffychat.im/_matrix/push/v1/notify',
|
||||
'https://push.tatuchat.weltonmoura.com.br/_matrix/push/v1/notify',
|
||||
),
|
||||
pushNotificationsPusherFormat<String>(
|
||||
'pushNotificationsPusherFormat',
|
||||
@@ -59,6 +59,11 @@ enum AppSettings<T> {
|
||||
),
|
||||
// colorSchemeSeed stored as ARGB int
|
||||
colorSchemeSeedInt<int>('chat.fluffy.color_scheme_seed', 0xFF00D084),
|
||||
|
||||
/// When false the chosen seed color is used verbatim as the theme primary
|
||||
/// color. When true the Material 3 tonal palette is used instead, which
|
||||
/// softens it.
|
||||
softenThemeColor<bool>('chat.fluffy.soften_theme_color', false),
|
||||
emojiSuggestionLocale<String>('emoji_suggestion_locale', ''),
|
||||
enableSoftLogout<bool>('chat.fluffy.enable_soft_logout', true),
|
||||
enableMatrixNativeOIDC<bool>('chat.fluffy.enable_matrix_native_oidc', true),
|
||||
@@ -67,16 +72,16 @@ enum AppSettings<T> {
|
||||
'https://matrix.weltonmoura.com.br',
|
||||
),
|
||||
welcomeText<String>('chat.fluffy.welcome_text', ''),
|
||||
website<String>('chat.fluffy.website_url', 'https://fluffychat.im'),
|
||||
website<String>('chat.fluffy.website_url', 'https://tatuchat.weltonmoura.com.br/home'),
|
||||
logoUrl<String>(
|
||||
'chat.fluffy.logo_url',
|
||||
'https://fluffychat.im/assets/favicon.png',
|
||||
'https://tatuchat.weltonmoura.com.br/assets/assets/logo/mini/logo_mini.png',
|
||||
),
|
||||
privacyPolicy<String>(
|
||||
'chat.fluffy.privacy_policy_url',
|
||||
'https://fluffychat.im/privacy',
|
||||
'https://tatuchat.weltonmoura.com.br/home/politica-de-privacidade/',
|
||||
),
|
||||
tos<String>('chat.fluffy.tos_url', 'https://fluffychat.im/tos'),
|
||||
tos<String>('chat.fluffy.tos_url', 'https://tatuchat.weltonmoura.com.br/tos'),
|
||||
sendTimelineEventTimeout<int>('chat.fluffy.send_timeline_event_timeout', 15),
|
||||
webNotificationSound<bool>('chat.fluffy.web_notification_sound', true),
|
||||
chatFilter<String>('chat.fluffy.chat_filter', 'allChats'),
|
||||
@@ -87,7 +92,11 @@ enum AppSettings<T> {
|
||||
benchmarksInLogs<bool>('chat.fluffy.benchmarks_in_logs', false),
|
||||
autoSendErrorReports<bool?>('chat.fluffy.auto_send_eror_reports', null),
|
||||
knownErrorHashes<List<String>>('chat.fluffy.known_crash_hashes', []),
|
||||
customLiveKitInstance<String>('chat.fluffy.custom_live_kit_instance', '');
|
||||
customLiveKitInstance<String>('chat.fluffy.custom_live_kit_instance', ''),
|
||||
/// URL of a CORS proxy used as a fallback when importing a mini app from a
|
||||
/// URL on web, if the target server does not send CORS headers. Should end
|
||||
/// with `?url=` or `?` (the target URL gets appended). Empty means disabled.
|
||||
miniAppCorsProxy<String>('chat.fluffy.miniapp_cors_proxy', '');
|
||||
|
||||
final String key;
|
||||
final T _defaultValue;
|
||||
|
||||
@@ -97,7 +97,14 @@ abstract class TatuPalette {
|
||||
/// When a [seed] is provided (e.g. a color chosen by the user or a system
|
||||
/// dynamic color), its tonal values are used for the primary family while
|
||||
/// the brand surfaces, accent and error colors are preserved.
|
||||
static ColorScheme scheme(Brightness brightness, [Color? seed]) {
|
||||
///
|
||||
/// Unless [softenPrimary] is set, the seed is used verbatim as the primary
|
||||
/// color, because the Material 3 tonal palette noticeably dulls it down.
|
||||
static ColorScheme scheme(
|
||||
Brightness brightness, [
|
||||
Color? seed,
|
||||
bool softenPrimary = false,
|
||||
]) {
|
||||
final isDark = brightness == Brightness.dark;
|
||||
final p = isDark ? _dark : _light;
|
||||
final base = ColorScheme.fromSeed(
|
||||
@@ -106,12 +113,17 @@ abstract class TatuPalette {
|
||||
dynamicSchemeVariant: DynamicSchemeVariant.rainbow,
|
||||
);
|
||||
final useBrandPrimary = seed == null;
|
||||
// Only force the exact color when the caller did not ask for the soft
|
||||
// Material 3 palette. `null` here means "keep the value from [base]".
|
||||
final exactPrimary = !useBrandPrimary && !softenPrimary ? seed : null;
|
||||
return base.copyWith(
|
||||
primary: useBrandPrimary ? p.primary : null,
|
||||
onPrimary: useBrandPrimary ? p.onPrimary : null,
|
||||
primary: useBrandPrimary ? p.primary : exactPrimary,
|
||||
onPrimary: useBrandPrimary
|
||||
? p.onPrimary
|
||||
: (exactPrimary == null ? null : _contrastOn(exactPrimary)),
|
||||
primaryContainer: useBrandPrimary ? p.primaryContainer : null,
|
||||
onPrimaryContainer: useBrandPrimary ? p.onPrimaryContainer : null,
|
||||
surfaceTint: useBrandPrimary ? p.primary : null,
|
||||
surfaceTint: useBrandPrimary ? p.primary : exactPrimary,
|
||||
secondary: p.secondary,
|
||||
onSecondary: p.onSecondary,
|
||||
secondaryContainer: p.secondaryContainer,
|
||||
@@ -141,6 +153,12 @@ abstract class TatuPalette {
|
||||
surfaceBright: p.surfaceBright,
|
||||
);
|
||||
}
|
||||
|
||||
/// Picks the readable foreground for an arbitrary background color.
|
||||
static Color _contrastOn(Color background) =>
|
||||
ThemeData.estimateBrightnessForColor(background) == Brightness.dark
|
||||
? Colors.white
|
||||
: Colors.black;
|
||||
}
|
||||
|
||||
class _Scheme {
|
||||
@@ -209,4 +227,4 @@ class _Scheme {
|
||||
final Color surfaceHighest;
|
||||
final Color surfaceDim;
|
||||
final Color surfaceBright;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,9 @@ abstract class FluffyThemes {
|
||||
|
||||
static const double navRailWidth = 80.0;
|
||||
|
||||
/// Width of the navigation sidebar (column mode only).
|
||||
static const double sidebarWidth = 280.0;
|
||||
|
||||
static bool isColumnModeByWidth(double width) =>
|
||||
width > columnWidth * 2 + navRailWidth;
|
||||
|
||||
@@ -44,8 +47,9 @@ abstract class FluffyThemes {
|
||||
BuildContext context,
|
||||
Brightness brightness, [
|
||||
Color? seed,
|
||||
bool softenPrimary = false,
|
||||
]) {
|
||||
final colorScheme = TatuPalette.scheme(brightness, seed);
|
||||
final colorScheme = TatuPalette.scheme(brightness, seed, softenPrimary);
|
||||
final isColumnMode = FluffyThemes.isColumnMode(context);
|
||||
final dividerColor = brightness == Brightness.dark
|
||||
? colorScheme.surfaceContainerHighest
|
||||
|
||||
@@ -540,7 +540,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "دعاك {username} إلى FluffyChat.\n1. قم بزيارة موقع fluffychat.im وقم بتثبيت التطبيق\n2. قم بإنشاءحساب أو تسجيل الدخول\n3. افتح رابط الدعوة:\n {link}",
|
||||
"inviteText": "دعاك {username} إلى TatuChat.\n1. قم بزيارة موقع tatuchat.weltonmoura.com.br وقم بتثبيت التطبيق\n2. قم بإنشاءحساب أو تسجيل الدخول\n3. افتح رابط الدعوة:\n {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
@@ -672,7 +672,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"newMessageInFluffyChat": "💬 رسالة جديدة في FluffyChat",
|
||||
"newMessageInFluffyChat": "💬 رسالة جديدة في TatuChat",
|
||||
"@newMessageInFluffyChat": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
@@ -2455,7 +2455,7 @@
|
||||
"advancedConfigurations": "التكويناتالمتقدمة",
|
||||
"signIn": "تسجيل الدخول",
|
||||
"createNewAccount": "إنشاء حساب جديد",
|
||||
"signUpGreeting": "FluffyChat لا مركزي! اختر الخادم الذي تريد إنشاء حسابك عليه ولنبدأ!",
|
||||
"signUpGreeting": "TatuChat لا مركزي! اختر الخادم الذي تريد إنشاء حسابك عليه ولنبدأ!",
|
||||
"signInGreeting": "هل لديك حساب بالفعل في ماتريكس؟ أهلاً بك مجدداً! اختر خادمك المنزلي وسجّل الدخول.",
|
||||
"theProcessWasCanceled": "تم إلغاء العملية.",
|
||||
"join": "انضمام",
|
||||
@@ -2474,7 +2474,7 @@
|
||||
},
|
||||
"createNewChat": "إنشاء محادثة جديدة",
|
||||
"reset": "إعادة تعيين",
|
||||
"supportFluffyChat": "ادعم FluffyChat",
|
||||
"supportFluffyChat": "ادعم TatuChat",
|
||||
"support": "دعم",
|
||||
"setLowPriority": "حدد أولوية منخفضة",
|
||||
"unsetLowPriority": "إلغاء تعيين الأولوية المنخفضة",
|
||||
@@ -2484,7 +2484,7 @@
|
||||
"tagName": "اسم الوسم",
|
||||
"createNewTag": "إنشاء وسم جديد",
|
||||
"hideRoomsInSpaces": "إخفاء الغرف الموجودة في مساحة",
|
||||
"possibleByYou": "لم يكن هذا الإصدار ليتحقق لولا دعمكم. سيظل FluffyChat مجانيًا ومفتوح المصدر، ويعتمد كليًا على جهود المجتمع.",
|
||||
"possibleByYou": "لم يكن هذا الإصدار ليتحقق لولا دعمكم. سيظل TatuChat مجانيًا ومفتوح المصدر، ويعتمد كليًا على جهود المجتمع.",
|
||||
"showThumbnailsInTimeline": "عرض الصور المصغرة للصور ومقاطع الفيديو",
|
||||
"appSubtitle": "اتصال آمن [مصفوفة]",
|
||||
"appDescription": "التواصل بشكل مشفر عبر شبكة [المصفوفة] اللامركزية بطريقة سهلة ومتاحة للجميع.",
|
||||
@@ -2558,7 +2558,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"newPassphraseDescription": "يستخدم تطبيق FluffyChat التشفير التام بين الطرفين. ولضمان عدم فقدان رسائلك، يُرجى اختيار عبارة مرور قوية لحماية هويتك الرقمية ونسخة احتياطية من رسائلك المشفرة.",
|
||||
"newPassphraseDescription": "يستخدم تطبيق TatuChat التشفير التام بين الطرفين. ولضمان عدم فقدان رسائلك، يُرجى اختيار عبارة مرور قوية لحماية هويتك الرقمية ونسخة احتياطية من رسائلك المشفرة.",
|
||||
"@newPassphraseDescription": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
|
||||
@@ -924,7 +924,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} запрасіў вас у FluffyChat.\n1. Перайдзіце на fluffychat.im і ўстанавіце праграму\n2. Зарэгестрыруйцесь альбо ўвайдзіце\n3. Перайдзіце па запрашальнай спасылцы:\n{link}",
|
||||
"inviteText": "{username} запрасіў вас у TatuChat.\n1. Перайдзіце на tatuchat.weltonmoura.com.br і ўстанавіце праграму\n2. Зарэгестрыруйцесь альбо ўвайдзіце\n3. Перайдзіце па запрашальнай спасылцы:\n{link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
@@ -1085,7 +1085,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"newMessageInFluffyChat": "💬 Новае паведамленне ў FluffyChat",
|
||||
"newMessageInFluffyChat": "💬 Новае паведамленне ў TatuChat",
|
||||
"@newMessageInFluffyChat": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
@@ -2464,7 +2464,7 @@
|
||||
"advancedConfigurations": "Пашыраная канфігурацыя",
|
||||
"signIn": "Увайсці",
|
||||
"createNewAccount": "Стварыць новы ўліковы запіс",
|
||||
"signUpGreeting": "FluffyChat дэцэнтралізаваны! Выберыце свой сервер, дзе вы хаціце стварыць уліковы запіс і прайягвайце!",
|
||||
"signUpGreeting": "TatuChat дэцэнтралізаваны! Выберыце свой сервер, дзе вы хаціце стварыць уліковы запіс і прайягвайце!",
|
||||
"signInGreeting": "Вы ўжо маеце ўліковы запіс у Matrix? З вяртаннем! Выберыце свой хатні сервер і аўтарызуйцеся.",
|
||||
"theProcessWasCanceled": "Працэс быў скасаваны.",
|
||||
"join": "Далучыцца",
|
||||
@@ -2484,7 +2484,7 @@
|
||||
},
|
||||
"createNewChat": "Стварыць новы чат",
|
||||
"reset": "Скінуць",
|
||||
"supportFluffyChat": "Падтрымаць FluffyChat",
|
||||
"supportFluffyChat": "Падтрымаць TatuChat",
|
||||
"support": "Падтрымаць",
|
||||
"setLowPriority": "Прызначыць нізкі прыярытэт",
|
||||
"unsetLowPriority": "Скасаваць нізкі прыярытэт",
|
||||
|
||||
@@ -625,7 +625,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} t'ha convidat a FluffyChat.\n1. Visita fluffychat.im i instaŀla l'app\n2. Registra't o inicia sessió\n3. Obre l'enllaç d'invitació:\n{link}",
|
||||
"inviteText": "{username} t'ha convidat a TatuChat.\n1. Visita tatuchat.weltonmoura.com.br i instaŀla l'app\n2. Registra't o inicia sessió\n3. Obre l'enllaç d'invitació:\n{link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
@@ -772,7 +772,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"newMessageInFluffyChat": "💬 Missatge nou al FluffyChat",
|
||||
"newMessageInFluffyChat": "💬 Missatge nou al TatuChat",
|
||||
"@newMessageInFluffyChat": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
@@ -797,7 +797,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"noGoogleServicesWarning": "Sembla que no teniu els Serveis de Google al telèfon. Això és una bona decisió respecte a la vostra privadesa! Per a rebre notificacions automàtiques del FluffyChat, us recomanem instaŀlar ntfy. Amb ntfy o qualsevol altre proveïdor de Unified Push, pots rebre notificacions de forma segura i lliure. Pots instaŀlar ntfy des de la PlayStore o des de F-Droid.",
|
||||
"noGoogleServicesWarning": "Sembla que no teniu els Serveis de Google al telèfon. Això és una bona decisió respecte a la vostra privadesa! Per a rebre notificacions automàtiques del TatuChat, us recomanem instaŀlar ntfy. Amb ntfy o qualsevol altre proveïdor de Unified Push, pots rebre notificacions de forma segura i lliure. Pots instaŀlar ntfy des de la PlayStore o des de F-Droid.",
|
||||
"@noGoogleServicesWarning": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
@@ -2476,7 +2476,7 @@
|
||||
"advancedConfigurations": "Configuracions avançades",
|
||||
"signIn": "Obre sessió",
|
||||
"createNewAccount": "Crea un compte nou",
|
||||
"signUpGreeting": "El FluffyChat és descentralitzat! Tria un servidor on vulguis crear-t'hi un compte, i som-hi!",
|
||||
"signUpGreeting": "El TatuChat és descentralitzat! Tria un servidor on vulguis crear-t'hi un compte, i som-hi!",
|
||||
"signInGreeting": "Si ja tens un compte a Matrix, benvingudi! Tria el teu servidor i inicia-hi sessió.",
|
||||
"theProcessWasCanceled": "S'ha canceŀlat el procés.",
|
||||
"join": "Entra",
|
||||
@@ -2496,7 +2496,7 @@
|
||||
},
|
||||
"createNewChat": "Crea un nou xat",
|
||||
"reset": "Reseteja",
|
||||
"supportFluffyChat": "Dona suport a FluffyChat",
|
||||
"supportFluffyChat": "Dona suport a TatuChat",
|
||||
"support": "Aporta",
|
||||
"setLowPriority": "Estableix una prioritat baixa",
|
||||
"unsetLowPriority": "Restableix la prioritat",
|
||||
|
||||
@@ -814,7 +814,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} vás pozval/a na FluffyChat.\n1. Navštivte fluffychat.im a nainstalujte si aplikaci.\n2. Zaregistrujte se nebo se přihlaste.\n3. Otevřte pozvánku: \n {link}",
|
||||
"inviteText": "{username} vás pozval/a na TatuChat.\n1. Navštivte tatuchat.weltonmoura.com.br.im a nainstalujte si aplikaci.\n2. Zaregistrujte se nebo se přihlaste.\n3. Otevřte pozvánku: \n {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
@@ -971,7 +971,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"newMessageInFluffyChat": "💬 Nová zpráva ve FluffyChatu",
|
||||
"newMessageInFluffyChat": "💬 Nová zpráva ve TatuChat",
|
||||
"@newMessageInFluffyChat": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
@@ -2327,7 +2327,7 @@
|
||||
"advancedConfigs": "Pokročilá nastavení",
|
||||
"signIn": "Přihlásit se",
|
||||
"createNewAccount": "Vytvořit nový účet",
|
||||
"signUpGreeting": "FluffyChat je decentralizovaný! Vyberte server, kde si chcete vytvořit účet, a jdeme na věc!",
|
||||
"signUpGreeting": "TatuChat je decentralizovaný! Vyberte server, kde si chcete vytvořit účet, a jdeme na věc!",
|
||||
"signInGreeting": "Již máte účet na Matrixu? Vítejte zpět! Vyberte svůj domácí server a přihlaste se.",
|
||||
"theProcessWasCanceled": "Proces byl zrušen.",
|
||||
"sendImages": "Poslat {count} obrazků",
|
||||
|
||||
@@ -809,7 +809,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} hat Dich zu FluffyChat eingeladen. \n1. Gehe auf fluffychat.im und installiere die App \n2. Melde Dich in der App an \n3. Öffne den Einladungslink: \n {link}",
|
||||
"inviteText": "{username} hat Dich zu TatuChat eingeladen. \n1. Gehe auf TatuChat und installiere die App \n2. Melde Dich in der App an \n3. Öffne den Einladungslink: \n {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
@@ -966,7 +966,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"newMessageInFluffyChat": "💬 Neue Nachricht in FluffyChat",
|
||||
"newMessageInFluffyChat": "💬 Neue Nachricht in TatuChat",
|
||||
"@newMessageInFluffyChat": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
@@ -2483,7 +2483,7 @@
|
||||
"advancedConfigurations": "Erweiterte Konfigurationen",
|
||||
"signIn": "Anmelden",
|
||||
"createNewAccount": "Neues Konto erstellen",
|
||||
"signUpGreeting": "FluffyChat ist dezentral! Wähle einen Server, auf dem du dein Konto erstellen möchtest, und los geht's!",
|
||||
"signUpGreeting": "TatuChat ist dezentral! Wähle einen Server, auf dem du dein Konto erstellen möchtest, und los geht's!",
|
||||
"signInGreeting": "Du hast bereits ein Konto bei Matrix? Willkommen zurück! Wähle deinen Homeserver aus und melde dich an.",
|
||||
"theProcessWasCanceled": "Der Vorgang wurde abgebrochen.",
|
||||
"federationBaseUrl": "Basis-URL der Föderation",
|
||||
@@ -2505,7 +2505,7 @@
|
||||
"description": "This should be a very short string because there is not much space in the button!"
|
||||
},
|
||||
"createNewChat": "Neuen Chat erstellen",
|
||||
"supportFluffyChat": "FluffyChat unterstützen",
|
||||
"supportFluffyChat": "TatuChat unterstützen",
|
||||
"support": "Unterstützen",
|
||||
"createNewTag": "Neuen tag erstellen",
|
||||
"tagName": "Tag-Name",
|
||||
@@ -2523,7 +2523,7 @@
|
||||
"showMore": "Mehr anzeigen",
|
||||
"showLess": "Weniger anzeigen",
|
||||
"hideRoomsInSpaces": "Räume ausblenden, die sich in einem space befinden",
|
||||
"possibleByYou": "Diese Veröffentlichung war nur dank eurer Unterstützung möglich. FluffyChat bleibt kostenlos, Open-Source und vollständig von der Community getragen.",
|
||||
"possibleByYou": "Diese Veröffentlichung war nur dank eurer Unterstützung möglich. TatuChat bleibt kostenlos, Open-Source und vollständig von der Community getragen.",
|
||||
"showThumbnailsInTimeline": "Thumbnails von Bildern und Videos anzeigen",
|
||||
"appSubtitle": "Sichere [matrix]-Kommunikation",
|
||||
"interactiveVerification": "Interaktive Verifikation",
|
||||
@@ -2606,7 +2606,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"newPassphraseDescription": "FluffyChat verwendet Ende-zu-Ende-Verschlüsselung. Um deine Nachrichten nicht zu verlieren, wähle bitte eine starke Passphrase, um deine Krypto-Identität und dein verschlüsseltes Nachrichten-Backup zu sichern.",
|
||||
"newPassphraseDescription": "TatuChat verwendet Ende-zu-Ende-Verschlüsselung. Um deine Nachrichten nicht zu verlieren, wähle bitte eine starke Passphrase, um deine Krypto-Identität und dein verschlüsseltes Nachrichten-Backup zu sichern.",
|
||||
"@newPassphraseDescription": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
{
|
||||
"developer": "Developer",
|
||||
"editImage": "Edit image",
|
||||
"@editImage": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"environmentVariables": "Environment variables",
|
||||
"licence": "Licence",
|
||||
"rotateLeft": "Rotate left",
|
||||
"@rotateLeft": {
|
||||
"type": "String",
|
||||
@@ -996,7 +999,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} invited you to FluffyChat.\n1. Visit fluffychat.im and install the app \n2. Sign up or sign in \n3. Open the invite link: \n {link}",
|
||||
"inviteText": "{username} invited you to TatuChat.\n1. Visit tatuchat.weltonmoura.com.br and install the app \n2. Sign up or sign in \n3. Open the invite link: \n {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
@@ -1157,7 +1160,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"newMessageInFluffyChat": "💬 New message in FluffyChat",
|
||||
"newMessageInFluffyChat": "💬 New message in TatuChat",
|
||||
"@newMessageInFluffyChat": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
@@ -2359,6 +2362,7 @@
|
||||
},
|
||||
"appWantsToUseForLoginDescription": "You hereby allow the app and website to share information about you.",
|
||||
"open": "Open",
|
||||
"refresh": "Refresh",
|
||||
"waitingForServer": "Waiting for server...",
|
||||
"newChatRequest": "📩 New chat request",
|
||||
"contentNotificationSettings": "Content notification settings",
|
||||
@@ -2465,6 +2469,16 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"countFollowers": "{count, plural, =1{1 subscriber} other{{count} subscribers}}",
|
||||
"@countFollowers": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"by": "by",
|
||||
"spaceMemberOf": "Space member of {spaces}",
|
||||
"@spaceMemberOf": {
|
||||
"type": "String",
|
||||
@@ -2551,12 +2565,19 @@
|
||||
"advancedConfigurations": "Advanced configurations",
|
||||
"signIn": "Sign in",
|
||||
"createNewAccount": "Create new account",
|
||||
"signUpGreeting": "FluffyChat is decentralized! Select a server where you want to create your account and let's go!",
|
||||
"signUpGreeting": "TatuChat is decentralized! Select a server where you want to create your account and let's go!",
|
||||
"signInGreeting": "You already have an account in Matrix? Welcome back! Select your homeserver and sign in.",
|
||||
"theProcessWasCanceled": "The process was canceled.",
|
||||
"join": "Join",
|
||||
"searchOrEnterHomeserverAddress": "Search or enter homeserver address",
|
||||
"matrixId": "Matrix ID",
|
||||
"@matrixId": {
|
||||
"description": "The Matrix ID of the user"
|
||||
},
|
||||
"menu": "Menu",
|
||||
"@menu": {
|
||||
"description": "Label for the navigation menu button"
|
||||
},
|
||||
"setPowerLevel": "Set power level",
|
||||
"makeModerator": "Make moderator",
|
||||
"makeAdmin": "Make admin",
|
||||
@@ -2571,7 +2592,7 @@
|
||||
},
|
||||
"createNewChat": "Create new chat",
|
||||
"reset": "Reset",
|
||||
"supportFluffyChat": "Support FluffyChat",
|
||||
"supportFluffyChat": "Support TatuChat",
|
||||
"support": "Support",
|
||||
"setLowPriority": "Set low priority",
|
||||
"unsetLowPriority": "Unset low priority",
|
||||
@@ -2581,7 +2602,7 @@
|
||||
"tagName": "Tag name",
|
||||
"createNewTag": "Create new tag",
|
||||
"hideRoomsInSpaces": "Hide rooms that are in a space",
|
||||
"possibleByYou": "This release was only possible thanks to your support. FluffyChat remains free, open-source, and entirely community-driven.",
|
||||
"possibleByYou": "This release was only possible thanks to your support. TatuChat remains free, open-source, and entirely community-driven.",
|
||||
"showThumbnailsInTimeline": "Show thumbnails of images and videos",
|
||||
"appSubtitle": "Um App de comunicação segura",
|
||||
"appDescription": "Communicate encrypted over the decentralized [matrix] network in an easy and accessible way for everyone.",
|
||||
@@ -2665,7 +2686,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"newPassphraseDescription": "FluffyChat uses end to end encryption. To not lose your messages, please choose a strong passphrase to secure your crypto identity and your encrypted message backup.",
|
||||
"newPassphraseDescription": "TatuChat uses end to end encryption. To not lose your messages, please choose a strong passphrase to secure your crypto identity and your encrypted message backup.",
|
||||
"@newPassphraseDescription": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
@@ -2923,5 +2944,100 @@
|
||||
"areYouSureDeletePost": "Delete",
|
||||
"@areYouSureDeletePost": {
|
||||
"description": "Delete this post from the mural"
|
||||
},
|
||||
"apps": "Apps",
|
||||
"@apps": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"tasks": "Tasks",
|
||||
"@tasks": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"accountDataEditor": "Account data",
|
||||
"@accountDataEditor": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"addTask": "Add task",
|
||||
"@addTask": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"taskInputPlaceholder": "What do you need to do?",
|
||||
"@taskInputPlaceholder": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"noTasksYet": "No tasks yet",
|
||||
"@noTasksYet": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"install": "Install",
|
||||
"@install": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"uninstall": "Uninstall",
|
||||
"@uninstall": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"installedApps": "Installed apps",
|
||||
"@installedApps": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"availableApps": "Available apps",
|
||||
"@availableApps": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"importApp": "Import app",
|
||||
"@importApp": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"importFromFile": "Import from file",
|
||||
"@importFromFile": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"importFromUrl": "Import from URL",
|
||||
"@importFromUrl": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"appImported": "App imported",
|
||||
"@appImported": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"moreOptions": "More options",
|
||||
"@moreOptions": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"uninstallApp": "Uninstall app?",
|
||||
"@uninstallApp": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"uninstallAppConfirm": "Do you really want to uninstall this app?",
|
||||
"@uninstallAppConfirm": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"softenThemeColor": "Soften theme color",
|
||||
"@softenThemeColor": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"softenThemeColorSubtitle": "Use a soft Material 3 palette derived from the selected color instead of the exact color.",
|
||||
"@softenThemeColorSubtitle": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -803,7 +803,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} invitis vin al FluffyChat. \n1. Instalu la aplikaĵon FluffyChat: https://fluffychat.im \n2. Registriĝu aŭ salutu \n3. Malfermu la invitan ligilon: {link}",
|
||||
"inviteText": "{username} invitis vin al TatuChat. \n1. Instalu la aplikaĵon TatuChat: https://tatuchat.weltonmoura.com.br \n2. Registriĝu aŭ salutu \n3. Malfermu la invitan ligilon: {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
@@ -950,7 +950,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"newMessageInFluffyChat": "Nova mesaĝo en FluffyChat",
|
||||
"newMessageInFluffyChat": "Nova mesaĝo en TatuChat",
|
||||
"@newMessageInFluffyChat": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
|
||||
@@ -622,7 +622,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} te invitó a FluffyChat.\n1.Visita fluffychat.im e instala la app\n2. Regístrate o inicia sesión\n3. Abre el enlace de invitación:\n{link}",
|
||||
"inviteText": "{username} te invitó a TatuChat.\n1.Visita TatuChat e instala la app\n2. Regístrate o inicia sesión\n3. Abre el enlace de invitación:\n{link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
@@ -759,7 +759,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"newMessageInFluffyChat": "Nuevo mensaje en FluffyChat",
|
||||
"newMessageInFluffyChat": "Nuevo mensaje en TatuChat",
|
||||
"@newMessageInFluffyChat": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
@@ -2485,7 +2485,7 @@
|
||||
"advancedConfigurations": "Configuraciones Avanzadas",
|
||||
"signIn": "Iniciar sesión",
|
||||
"createNewAccount": "Crear nueva cuenta",
|
||||
"signUpGreeting": "¡FluffyChat está descentralizado! ¡Selecciona un servidor donde quieres crear tu cuenta y sigamos!",
|
||||
"signUpGreeting": "TatuChat está descentralizado! ¡Selecciona un servidor donde quieres crear tu cuenta y sigamos!",
|
||||
"signInGreeting": "¿Ya tienes una cuenta en Matrix? ¡Bienvenido de nuevo! Selecciona tu servidor e inicia sesión.",
|
||||
"theProcessWasCanceled": "El proceso se ha cancelado.",
|
||||
"join": "Unirse",
|
||||
@@ -2505,7 +2505,7 @@
|
||||
},
|
||||
"createNewChat": "Crear nuevo chat",
|
||||
"reset": "Resetear",
|
||||
"supportFluffyChat": "Apoyar FluffyChat",
|
||||
"supportFluffyChat": "Apoyar TatuChat",
|
||||
"support": "Apoyar",
|
||||
"setLowPriority": "Colocar baja prioridad",
|
||||
"unsetLowPriority": "Desactivar baja prioridad",
|
||||
@@ -2522,7 +2522,7 @@
|
||||
"showMore": "Mostrar más",
|
||||
"showLess": "Mostrar menos",
|
||||
"hideRoomsInSpaces": "Esconder salas que estén en un espacio",
|
||||
"possibleByYou": "Esta versión sólo fue posible gracias a tu apoyo. FluffyChat sigue siendo gratis, de código abierto y totalmente impulsado por la comunidad.",
|
||||
"possibleByYou": "Esta versión sólo fue posible gracias a tu apoyo. TatuChat sigue siendo gratis, de código abierto y totalmente impulsado por la comunidad.",
|
||||
"showThumbnailsInTimeline": "Mostrar miniaturas de imágenes y videos",
|
||||
"appSubtitle": "Comunicación [matrix] Segura",
|
||||
"appDescription": "Comunicación cifrada a través de la red descentralizada [matrix] de una manera fácil y accesible para todos.",
|
||||
|
||||
@@ -814,7 +814,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} kutsus sind kasutama Matrix'i-põhist suhtlusrakendust FluffyChat. \n1. Ava fluffychat.im ja paigalda FluffyChat'i rakendus \n2. Liitu kasutajaks või logi sisse olemasoleva Matrix'i kasutajakontoga\n3. Ava kutse link: \n {link}",
|
||||
"inviteText": "{username} kutsus sind kasutama Matrix'i-põhist suhtlusrakendust TatuChat. \n1. Ava TatuChat ja paigalda TatuChat'i rakendus \n2. Liitu kasutajaks või logi sisse olemasoleva Matrix'i kasutajakontoga\n3. Ava kutse link: \n {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
@@ -971,7 +971,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"newMessageInFluffyChat": "💬 Uus sõnum FluffyChati vahendusel",
|
||||
"newMessageInFluffyChat": "💬 Uus sõnum TatuChat vahendusel",
|
||||
"@newMessageInFluffyChat": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
@@ -1006,7 +1006,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"noGoogleServicesWarning": "Tundub, et sinu nutiseadmes pole Firebase Cloud Messaging teenuseid. Sinu privaatsuse mõttes on see kindlasti hea otsus! Kui sa soovid FluffyChatis näha tõuketeavitusi, siis soovitame, et selle jaoks kasutad ntfy liidestust. Kasutades ntfyd või mõnda muud Unified Push standardil põhinevat liidestust saad tõuketeavitusi turvalisel moel. Ntfy rakendus on saadaval nii PlayStore kui F-Droidi rakendusepoodides.",
|
||||
"noGoogleServicesWarning": "Tundub, et sinu nutiseadmes pole Firebase Cloud Messaging teenuseid. Sinu privaatsuse mõttes on see kindlasti hea otsus! Kui sa soovid TatuChat näha tõuketeavitusi, siis soovitame, et selle jaoks kasutad ntfy liidestust. Kasutades ntfyd või mõnda muud Unified Push standardil põhinevat liidestust saad tõuketeavitusi turvalisel moel. Ntfy rakendus on saadaval nii PlayStore kui F-Droidi rakendusepoodides.",
|
||||
"@noGoogleServicesWarning": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
@@ -2480,7 +2480,7 @@
|
||||
"advancedConfigurations": "Täiendavad seadistused",
|
||||
"signIn": "Logi sisse",
|
||||
"createNewAccount": "Loo uus kasutajakonto",
|
||||
"signUpGreeting": "FluffyChat kasutab hajutatud võrku! Vali server, kuhu tahad oma kasutajakonto lisada ning alustame!",
|
||||
"signUpGreeting": "TatuChat kasutab hajutatud võrku! Vali server, kuhu tahad oma kasutajakonto lisada ning alustame!",
|
||||
"signInGreeting": "Sul juba on Matrixi kasutajakonto olemas? Tere tulemast tagasi! Vali oma koduserver ja logi sisse.",
|
||||
"theProcessWasCanceled": "Protsess on katkestatud.",
|
||||
"join": "Liitu",
|
||||
@@ -2500,7 +2500,7 @@
|
||||
},
|
||||
"createNewChat": "Loo uus vestlus",
|
||||
"reset": "Lähtesta",
|
||||
"supportFluffyChat": "Toeta FluffyChati",
|
||||
"supportFluffyChat": "Toeta TatuChat",
|
||||
"support": "Toeta meid",
|
||||
"setLowPriority": "Märgi vähetähtsaks",
|
||||
"unsetLowPriority": "Eemalda märkimine vähetähtsaks",
|
||||
@@ -2515,7 +2515,7 @@
|
||||
"placeholders": {}
|
||||
},
|
||||
"hideRoomsInSpaces": "Peida jututoad, mis on osa kogukonnast",
|
||||
"possibleByYou": "Selle versiooni väljaandmine oli võimalik vaid sinu toetusele. FluffyChat jääb vabaks, avatud lähtekoodi põhiseks ja kogukonnakeskseks.",
|
||||
"possibleByYou": "Selle versiooni väljaandmine oli võimalik vaid sinu toetusele. TatuChat jääb vabaks, avatud lähtekoodi põhiseks ja kogukonnakeskseks.",
|
||||
"showThumbnailsInTimeline": "Näita piltide ja videote pisipilte",
|
||||
"appSubtitle": "Turvaline suhtlus [matrix]'i võrgus",
|
||||
"appDescription": "Suhtle krüptitult hajutatud [matrix] võrgustikus viisil, mis on lihtne ja kõigile kättesaadav.",
|
||||
@@ -2617,7 +2617,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"newPassphraseDescription": "FluffyChat kasutab läbivat krüptimist. Et sa ei kaotaks oma sõnumeid, turvaks oma krüptidentitedi ja krüptiks sõnumite varunduse, siis palun sisesta korralik ja tugev salafraas.",
|
||||
"newPassphraseDescription": "TatuChat kasutab läbivat krüptimist. Et sa ei kaotaks oma sõnumeid, turvaks oma krüptidentitedi ja krüptiks sõnumite varunduse, siis palun sisesta korralik ja tugev salafraas.",
|
||||
"@newPassphraseDescription": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
|
||||
@@ -534,7 +534,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username}(e)k FluffyChatera gonbidatu zaitu.\n1. Bisitatu https://fluffychat.im eta instalatu aplikazioa\n2. Eman izena edo hasi saioa\n3. Ireki gonbidapen-esteka:\n{link}",
|
||||
"inviteText": "{username}(e)k TatuChat gonbidatu zaitu.\n1. Bisitatu TatuChat eta instalatu aplikazioa\n2. Eman izena edo hasi saioa\n3. Ireki gonbidapen-esteka:\n{link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
@@ -666,7 +666,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"newMessageInFluffyChat": "💬 Mezu berria FluffyChaten",
|
||||
"newMessageInFluffyChat": "💬 Mezu berria TatuChat",
|
||||
"@newMessageInFluffyChat": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
@@ -2477,7 +2477,7 @@
|
||||
"identityServer": "Identitate-zerbitzaria:",
|
||||
"signIn": "Hasi saioa",
|
||||
"createNewAccount": "Sortu kontu berria",
|
||||
"signUpGreeting": "FluffyChat deszentralizatua da! Hautatu zure kontua zein zerbitzaritan sortu nahi duzun, eta hasi erabiltzen!",
|
||||
"signUpGreeting": "TatuChat deszentralizatua da! Hautatu zure kontua zein zerbitzaritan sortu nahi duzun, eta hasi erabiltzen!",
|
||||
"signInGreeting": "Baduzu dagoeneko Matrix kontu bat? Ongi etorri berriro ere! Hautatu zure zerbitzaria eta hasi saioa.",
|
||||
"theProcessWasCanceled": "Eragiketa bertan behera utzi da.",
|
||||
"join": "Batu",
|
||||
@@ -2497,7 +2497,7 @@
|
||||
},
|
||||
"createNewChat": "Sortu txat berria",
|
||||
"reset": "Berrezarri",
|
||||
"supportFluffyChat": "Eman babesa FluffyChat-i",
|
||||
"supportFluffyChat": "Eman babesa TatuChat-i",
|
||||
"support": "Lagundu",
|
||||
"setLowPriority": "Ezarri lehentasun baxua",
|
||||
"unsetLowPriority": "Kendu lehentasun baxua",
|
||||
@@ -2514,7 +2514,7 @@
|
||||
"showMore": "Erakutsi gehiago",
|
||||
"showLess": "Erakutsi gutxiago",
|
||||
"hideRoomsInSpaces": "Ezkutatu gune batean dauden gelak",
|
||||
"possibleByYou": "Bertsio hau zure laguntzari esker izan da posible. FluffyChat-ek doakoa, kode irekikoa eta guztiz komunitarioa izaten jarraitzen du.",
|
||||
"possibleByYou": "Bertsio hau zure laguntzari esker izan da posible. TatuChat-ek doakoa, kode irekikoa eta guztiz komunitarioa izaten jarraitzen du.",
|
||||
"showThumbnailsInTimeline": "Erakutsi irudi eta bideoen iruditxoa",
|
||||
"appSubtitle": "[matrix] komunikazio segurua",
|
||||
"appDescription": "Komunikatu [matrix] sare deszentralizatuaren bidez, era zifratuan, mundu guztiarentzat modu erraz eta eskuragarrian.",
|
||||
|
||||
@@ -1337,7 +1337,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} شما را به فلافیچت دعوت کرد.\n۱. به fluffychat.im بروید و برنامه را نصب کنید\n۲. ثبتنام کنید یا وارد شوید\n۳. پیوند دعوت را باز کنید:\n {link}",
|
||||
"inviteText": "{username} شما را به فلافیچت دعوت کرد.\n۱. به TatuChat بروید و برنامه را نصب کنید\n۲. ثبتنام کنید یا وارد شوید\n۳. پیوند دعوت را باز کنید:\n {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"repeatPassword": "Salasana uudelleen",
|
||||
"about": "Tietoa FluffyChatista",
|
||||
"about": "Tietoa TatuChat",
|
||||
"@about": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
@@ -638,7 +638,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} kutsui sinut FluffyChattiin.\n1. Viereaile sivulla: https://fluffychat.im ja asenna sovellus\n2. Rekisteröidy tai kirjaudu sisään\n3. Avaa kutsulinkki:\n{link}",
|
||||
"inviteText": "{username} kutsui sinut TatuChat.\n1. Viereaile sivulla: TatuChat ja asenna sovellus\n2. Rekisteröidy tai kirjaudu sisään\n3. Avaa kutsulinkki:\n{link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
@@ -815,7 +815,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} vous a invité·e sur FluffyChat.\n1. Visiter fluffychat.im et installer l'application\n2. Inscrivez-vous ou connectez-vous\n3. Ouvrez le lien d'invitation :\n{link}",
|
||||
"inviteText": "{username} vous a invité·e sur TatuChat.\n1. Visiter TatuChat et installer l'application\n2. Inscrivez-vous ou connectez-vous\n3. Ouvrez le lien d'invitation :\n{link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
@@ -972,7 +972,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"newMessageInFluffyChat": "💬 Nouveau message dans FluffyChat",
|
||||
"newMessageInFluffyChat": "💬 Nouveau message dans TatuChat",
|
||||
"@newMessageInFluffyChat": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
@@ -2317,7 +2317,7 @@
|
||||
"notificationRuleIsUserMentionDescription": "Notifie l'utilisateur/trice lorsqu'il est mentionné directement dans un message.",
|
||||
"notificationRuleServerAcl": "Retire les Évènements ACL du Serveur",
|
||||
"advancedConfigurations": "Configurations avancées",
|
||||
"signUpGreeting": "FluffyChat est décentralisé ! Selectionnez un hôte sur lequel vous voulez créer un compte et c'est parti !",
|
||||
"signUpGreeting": "TatuChat est décentralisé ! Selectionnez un hôte sur lequel vous voulez créer un compte et c'est parti !",
|
||||
"notificationRuleCall": "Appeler",
|
||||
"baseUrl": "URL racine",
|
||||
"pause": "Pause",
|
||||
@@ -2487,7 +2487,7 @@
|
||||
"approve": "Approuver",
|
||||
"notificationRuleRoomnotifDescription": "Notifie l'utilisateur/trice lorsqu'un message contient '@room'.",
|
||||
"generalNotificationSettings": "Réglages généraux des notifications",
|
||||
"supportFluffyChat": "Soutenir FluffyChat",
|
||||
"supportFluffyChat": "Soutenir TatuChat",
|
||||
"notificationRuleEncrypted": "Chiffré",
|
||||
"pleaseFillOut": "Veuillez remplir",
|
||||
"changedTheChatName": "{username} a changé le nom de la discussion",
|
||||
@@ -2508,7 +2508,7 @@
|
||||
"showMore": "Voir plus",
|
||||
"showLess": "Voir moins",
|
||||
"hideRoomsInSpaces": "Cacher les salons qui sont dans un espace",
|
||||
"possibleByYou": "Cette mise à jour a été possible uniquement grâce à votre support. FluffyChat restera gratuit, open-source et entièrement communautaire.",
|
||||
"possibleByYou": "Cette mise à jour a été possible uniquement grâce à votre support. TatuChat restera gratuit, open-source et entièrement communautaire.",
|
||||
"showThumbnailsInTimeline": "Afficher les apperçus des images et vidéos",
|
||||
"appSubtitle": "Communication [matrix] Sécurisée",
|
||||
"appDescription": "Communiquez de façon chiffrée sur le réseau décentralisé [matrix] de façon aisée et accessible pour tous.",
|
||||
@@ -2590,7 +2590,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"newPassphraseDescription": "FluffyChat utilise le chiffrement de bout en bout. Pour ne pas perdre vos messages, veuillez choisir une phrase de passe forte pour sécuriser votre profile crypto et votre sauvegarde chiffrée des messages.",
|
||||
"newPassphraseDescription": "TatuChat utilise le chiffrement de bout en bout. Pour ne pas perdre vos messages, veuillez choisir une phrase de passe forte pour sécuriser votre profile crypto et votre sauvegarde chiffrée des messages.",
|
||||
"@newPassphraseDescription": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
|
||||
@@ -999,7 +999,7 @@
|
||||
"placeholders": {}
|
||||
},
|
||||
"scanQrCode": "Scan cód QR",
|
||||
"inviteText": "Thug {username} cuireadh duit chuig FluffyChat.\n1. Tabhair cuairt ar fluffychat.im agus a shuiteáil an app\n2. Cláraigh nó sínigh isteach\n3. Oscail an nasc cuirí:\n {link}",
|
||||
"inviteText": "Thug {username} cuireadh duit chuig FluffyChat.\n1. Tabhair cuairt ar tatuchat.weltonmoura.com.br/home/ agus a shuiteáil an app\n2. Cláraigh nó sínigh isteach\n3. Oscail an nasc cuirí:\n {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
@@ -814,7 +814,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} convidoute a FluffyChat.\n1. Visita fluffychat.im e instala a app\n2. Crea unha conta ou Accede\n3. Abre a ligazón do convite: \n {link}",
|
||||
"inviteText": "{username} convidoute a FluffyChat.\n1. Visita tatuchat.weltonmoura.com.br/home/ e instala a app\n2. Crea unha conta ou Accede\n3. Abre a ligazón do convite: \n {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
@@ -619,7 +619,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} הזמין אותך ל-FluffyChat.\n1. התקן את FluffyChat: https://fluffychat.im\n2. הירשם או היכנס\n3. פתח את קישור ההזמנה: {link}",
|
||||
"inviteText": "{username} הזמין אותך ל-FluffyChat.\n1. התקן את FluffyChat: https://tatuchat.weltonmoura.com.br/home/\n2. הירשם או היכנס\n3. פתח את קישור ההזמנה: {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
@@ -800,7 +800,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} te je pozvao/la u FluffyChat. \n1. Posjeti strnicu fluffychat.im i instaliraj aplikaciju \n2. Registriraj ili prijavi se \n3. Otvori poveznicu poziva: \n {link}",
|
||||
"inviteText": "{username} te je pozvao/la u FluffyChat. \n1. Posjeti strnicu tatuchat.weltonmoura.com.br/home/ i instaliraj aplikaciju \n2. Registriraj ili prijavi se \n3. Otvori poveznicu poziva: \n {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
@@ -569,7 +569,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} meghívta a FluffyChat-be.\n1. Keresse fel a fluffychat.im oldalt, és telepítse az alkalmazást \n2. Regisztráljon vagy jelentkezzen be \n3. Nyissa meg a meghívó linket: \n {link}",
|
||||
"inviteText": "{username} meghívta a FluffyChat-be.\n1. Keresse fel a tatuchat.weltonmoura.com.br/home/ oldalt, és telepítse az alkalmazást \n2. Regisztráljon vagy jelentkezzen be \n3. Nyissa meg a meghívó linket: \n {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} mengundang kamu ke FluffyChat. \n1. Kunjungi fluffychat.im dan instal aplikasi\n2. Daftar atau masuk \n3. Buka tautan undangan: \n {link}",
|
||||
"inviteText": "{username} mengundang kamu ke FluffyChat. \n1. Kunjungi tatuchat.weltonmoura.com.br/home/ dan instal aplikasi\n2. Daftar atau masuk \n3. Buka tautan undangan: \n {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
@@ -690,7 +690,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} ti ha invitato/a a FluffyChat.\n1. Visita fluffychat.im e installa l'applicazione\n2. Iscriviti o accedi\n3. Apri il collegamento di invito: \n {link}",
|
||||
"inviteText": "{username} ti ha invitato/a a FluffyChat.\n1. Visita tatuchat.weltonmoura.com.br/home/ e installa l'applicazione\n2. Iscriviti o accedi\n3. Apri il collegamento di invito: \n {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
@@ -697,7 +697,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username}があなたをFluffyChatに招待しました。\n1. FluffyChatをインストール: fluffychat.im \n2. アカウントの作成、またはサインインを行う\n3. 招待リンクを開く\n {link}",
|
||||
"inviteText": "{username}があなたをFluffyChatに招待しました。\n1. FluffyChatをインストール: tatuchat.weltonmoura.com.br/home/ \n2. アカウントの作成、またはサインインを行う\n3. 招待リンクを開く\n {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
@@ -1139,7 +1139,7 @@
|
||||
}
|
||||
},
|
||||
"noChatDescriptionYet": "Ulac aglam n udiwenni i d-yenulfan yakan.",
|
||||
"inviteText": "{username} yeɛreḍ-ik·m ɣer FluffyChat.\n1. Rzu ɣer fluffychat.im syin sbedd asnas \n2. Jerred neɣ kcem \n3. Ldi aseɣwen n tinubga: \n {link}",
|
||||
"inviteText": "{username} yeɛreḍ-ik·m ɣer FluffyChat.\n1. Rzu ɣer tatuchat.weltonmoura.com.br/home/ syin sbedd asnas \n2. Jerred neɣ kcem \n3. Ldi aseɣwen n tinubga: \n {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
@@ -1493,7 +1493,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username}님이 당신을 FluffyChat에 초대했습니다.\n1. FluffyChat 설치: https://fluffychat.im \n2. 가입하거나 로그인 \n3. 초대 링크 열기: \n {link}",
|
||||
"inviteText": "{username}님이 당신을 FluffyChat에 초대했습니다.\n1. FluffyChat 설치: https://tatuchat.weltonmoura.com.br/home/ \n2. 가입하거나 로그인 \n3. 초대 링크 열기: \n {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
@@ -1461,7 +1461,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"inviteText": "{username} pakvietė jus prisijungti prie FluffyChat. \n1. Įdiekite FluffyChat: https://fluffychat.im \n2. Prisiregistruokite arba prisijunkite \n3. Atidarykite pakvietimo nuorodą: {link}",
|
||||
"inviteText": "{username} pakvietė jus prisijungti prie FluffyChat. \n1. Įdiekite FluffyChat: https://tatuchat.weltonmoura.com.br/home/ \n2. Prisiregistruokite arba prisijunkite \n3. Atidarykite pakvietimo nuorodą: {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
@@ -515,7 +515,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} uzaicināja pievienoties FluffyChat.\n1. Jāapmeklē fluffychat.im un jāuzstāda lietotne \n2. Jāizveido konts vai jāpiesakās \n3. Jāatver uzaicinājuma saite: \n {link}",
|
||||
"inviteText": "{username} uzaicināja pievienoties FluffyChat.\n1. Jāapmeklē tatuchat.weltonmoura.com.br/home/ un jāuzstāda lietotne \n2. Jāizveido konts vai jāpiesakās \n3. Jāatver uzaicinājuma saite: \n {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
@@ -663,7 +663,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} har invitert deg til FluffyChat. \n1. Installer FluffyChat: https://fluffychat.im \n2. Registrer deg eller logg inn \n3. Åpne invitasjonslenken: \n {link}",
|
||||
"inviteText": "{username} har invitert deg til FluffyChat. \n1. Installer FluffyChat: https://tatuchat.weltonmoura.com.br/home/ \n2. Registrer deg eller logg inn \n3. Åpne invitasjonslenken: \n {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
@@ -814,7 +814,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} heeft je uitgenodigd voor FluffyChat.\n1. Bezoek https://fluffychat.im en installeer de app\n2. Registreer of log in\n3. Open deze uitnodigingslink:\n{link}",
|
||||
"inviteText": "{username} heeft je uitgenodigd voor FluffyChat.\n1. Bezoek https://tatuchat.weltonmoura.com.br/home/ en installeer de app\n2. Registreer of log in\n3. Open deze uitnodigingslink:\n{link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
@@ -726,7 +726,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} zaprosił/-a Cię do FluffyChat.\n1. Odwiedź fluffychat.im i zainstaluj aplikację\n2. Zarejestuj się lub zaloguj\n3. Otwórz link zaproszenia:\n{link}",
|
||||
"inviteText": "{username} zaprosił/-a Cię do FluffyChat.\n1. Odwiedź tatuchat.weltonmoura.com.br/home/ i zainstaluj aplikację\n2. Zarejestuj się lub zaloguj\n3. Otwórz link zaproszenia:\n{link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
@@ -2043,5 +2043,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"areYouSureDeletePost": "Eliminar"
|
||||
"areYouSureDeletePost": "Eliminar",
|
||||
"softenThemeColor": "Suavizar cor do tema",
|
||||
"softenThemeColorSubtitle": "Usa uma paleta suave do Material 3 derivada da cor escolhida em vez da cor exata."
|
||||
}
|
||||
|
||||
@@ -563,6 +563,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"developer": "Desenvolvedor",
|
||||
"devices": "Dispositivos",
|
||||
"@devices": {
|
||||
"type": "String",
|
||||
@@ -672,6 +673,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"environmentVariables": "Variáveis e ambiente",
|
||||
"errorObtainingLocation": "Erro ao obter localização: {error}",
|
||||
"@errorObtainingLocation": {
|
||||
"type": "String",
|
||||
@@ -892,6 +894,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"licence": "Licença",
|
||||
"lightTheme": "Claro",
|
||||
"@lightTheme": {
|
||||
"type": "String",
|
||||
@@ -1974,6 +1977,7 @@
|
||||
"createCanalAndInviteUsers": "Criar um canal e convidar pessoas",
|
||||
"createMuralAndInviteUsers": "Criar um mural e convidar pessoas",
|
||||
"mural": "Mural",
|
||||
"menu": "Menu",
|
||||
"muralIsPublic": "O mural é público",
|
||||
"muralName": "Nome do mural",
|
||||
"noBackupWarning": "Atenção! Se não ativar o backup de conversas, você perderá acesso a suas mensagens criptografadas. É altamente recomendável ativar o backup antes de sair.",
|
||||
@@ -1986,7 +1990,7 @@
|
||||
"blockedUsers": "Usuários bloqueados",
|
||||
"passwordIsWrong": "A senha digitada está incorreta",
|
||||
"pleaseEnterYourCurrentPassword": "Digite sua senha atual",
|
||||
"groupCanBeFoundViaSearch": "Grupos podem ser encontrados por pesquisa",
|
||||
"groupCanBeFoundViaSearch": "Sala pode ser encontrada na pesquisa",
|
||||
"noUsersFoundWithQuery": "Infelizmente, não foi encontrado usuário com \"{query}\". Verifique se digitou corretamente.",
|
||||
"@noUsersFoundWithQuery": {
|
||||
"type": "String",
|
||||
@@ -2006,7 +2010,7 @@
|
||||
"select": "Selecionar",
|
||||
"pleaseChooseAStrongPassword": "Escolha uma senha forte",
|
||||
"blockUsername": "Ignorar nome de usuário",
|
||||
"addChatOrSubSpace": "Adicionar conversa ou subespaço",
|
||||
"addChatOrSubSpace": "Criar grupo aqui",
|
||||
"groupName": "Nome do grupo",
|
||||
"leaveEmptyToClearStatus": "Deixe em branco para limpar seu estado.",
|
||||
"joinSpace": "Entrar no espaço",
|
||||
@@ -2401,6 +2405,16 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"countFollowers": "{count, plural, =0{0 inscritos} =1{1 inscrito} other{{count} inscritos}}",
|
||||
"@countFollowers": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"by": "por",
|
||||
"spaceMemberOf": "Membro do espaço de {spaces}",
|
||||
"@spaceMemberOf": {
|
||||
"type": "String",
|
||||
@@ -2498,7 +2512,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"muralsComingSoon": "Murais em breve",
|
||||
"muralsComingSoon": "Nenhum mural por aqui",
|
||||
"@muralsComingSoon": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
@@ -2570,7 +2584,7 @@
|
||||
},
|
||||
"areYouSureDeletePost": "Apagar",
|
||||
"accountsAndSettings": "Contas e configurações",
|
||||
"addTag": "Adicionar etiqueta",
|
||||
"addTag": "Adicionar tag",
|
||||
"advancedConfigs": "Configurações avançadas",
|
||||
"advancedConfigurations": "Configurações avançadas",
|
||||
"appDescription": "Comunique-se com criptografia na rede descentralizada [matrix], de forma simples e acessível para todos.",
|
||||
@@ -2603,7 +2617,7 @@
|
||||
},
|
||||
"createNewAccount": "Criar nova conta",
|
||||
"createNewChat": "Criar nova conversa",
|
||||
"createNewTag": "Criar nova etiqueta",
|
||||
"createNewTag": "Criar nova tag",
|
||||
"crop": "Cortar",
|
||||
"decline": "Recusar",
|
||||
"deviceIdentityKey": "Chave de identidade do dispositivo",
|
||||
@@ -2698,7 +2712,7 @@
|
||||
"raiseHand": "Levantar a mão",
|
||||
"removeAdminRights": "Remover direitos de administrador",
|
||||
"removeModeratorRights": "Remover direitos de moderador",
|
||||
"removeTag": "Remover etiqueta",
|
||||
"removeTag": "Remover tag",
|
||||
"repeatPassphrase": "Repita a frase secreta",
|
||||
"reset": "Redefinir",
|
||||
"resetAccount": "Redefinir conta",
|
||||
@@ -2756,7 +2770,7 @@
|
||||
"storeRecoveryKeyDescription": "Anote sua chave de recuperação para poder restaurar suas mensagens criptografadas e sua identidade criptográfica.",
|
||||
"support": "Suporte",
|
||||
"supportFluffyChat": "Apoie o TatuChat",
|
||||
"tagName": "Nome da etiqueta",
|
||||
"tagName": "Nome da tag",
|
||||
"theProcessWasCanceled": "O processo foi cancelado.",
|
||||
"today": "Hoje",
|
||||
"toggleCamera": "Alternar câmera",
|
||||
|
||||
@@ -761,7 +761,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} convidou-te para o FluffyChat.\n1. Instala o FluffyChat: https://fluffychat.im\n2. Regista-te ou inicia sessão.\n3. Abre a ligação de convite: {link}",
|
||||
"inviteText": "{username} convidou-te para o TatuChat.\n1. Instala o TatuChat: https://tatuchat.weltonmoura.com.br. Regista-te ou inicia sessão.\n3. Abre a ligação de convite: {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
@@ -918,7 +918,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"newMessageInFluffyChat": "Nova mensagem no FluffyChat",
|
||||
"newMessageInFluffyChat": "Nova mensagem no TatuChat",
|
||||
"@newMessageInFluffyChat": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
@@ -938,7 +938,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"noConnectionToTheServer": "Nenhuma ligação ao servidor",
|
||||
"noConnectionToTheServer": "Sem conexão com o servidor",
|
||||
"@noConnectionToTheServer": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
@@ -953,7 +953,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"noGoogleServicesWarning": "Parece que não tens nenhuns serviços da Google no seu telemóvel. É uma boa decisão para a sua privacidade! Para receber notificações instantâneas no FluffyChat, recomendamos que uses https://microg.org/ ou https://unifiedpush.org/.",
|
||||
"noGoogleServicesWarning": "Parece que não tens nenhuns serviços da Google no seu telemóvel. É uma boa decisão para a sua privacidade! Para receber notificações instantâneas no TatuChat, recomendamos que uses https://microg.org/ ou https://unifiedpush.org/.",
|
||||
"@noGoogleServicesWarning": {
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
|
||||
@@ -714,7 +714,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"inviteText": "{username} v-a invitat la FluffyChat.\n1. Instalați FluffyChat: https://fluffychat.im\n2. Înregistrați-vă sau conectați-vă\n3. Deschideți invitația: {link}",
|
||||
"inviteText": "{username} v-a invitat la FluffyChat.\n1. Instalați FluffyChat: https://tatuchat.weltonmoura.com.br/home/\n2. Înregistrați-vă sau conectați-vă\n3. Deschideți invitația: {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
@@ -814,7 +814,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} пригласил(а) вас в FluffyChat. \n1. Посетите https://fluffychat.im и установите приложение \n2. Зарегистрируйтесь или войдите \n3. Откройте ссылку приглашения: \n {link}",
|
||||
"inviteText": "{username} пригласил(а) вас в FluffyChat. \n1. Посетите https://tatuchat.weltonmoura.com.br/home/ и установите приложение \n2. Зарегистрируйтесь или войдите \n3. Откройте ссылку приглашения: \n {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
@@ -516,7 +516,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} vás pozval na FluffyChat.\n1. Nainštalujte si FluffyChat: https://fluffychat.im\n2. Zaregistrujte sa alebo sa prihláste\n3. Otvorte odkaz na pozvánku: {link}",
|
||||
"inviteText": "{username} vás pozval na FluffyChat.\n1. Nainštalujte si FluffyChat: https://tatuchat.weltonmoura.com.br/home/\n2. Zaregistrujte sa alebo sa prihláste\n3. Otvorte odkaz na pozvánku: {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
@@ -766,7 +766,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} вас позива у FluffyChat. \n1. Инсталирајте FluffyChat: https://fluffychat.im \n2. Региструјте се или пријавите \n3. Отворите везу позивнице: {link}",
|
||||
"inviteText": "{username} вас позива у FluffyChat. \n1. Инсталирајте FluffyChat: https://tatuchat.weltonmoura.com.br/home/ \n2. Региструјте се или пријавите \n3. Отворите везу позивнице: {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
@@ -648,7 +648,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} bjöd in dig till FluffyChat.\n1. Besök fluffychat.im och installera appen\n2. Registrera dig eller logga in\n3. Öppna inbjudningslänk:\n {link}",
|
||||
"inviteText": "{username} bjöd in dig till FluffyChat.\n1. Besök tatuchat.weltonmoura.com.br/home/ och installera appen\n2. Registrera dig eller logga in\n3. Öppna inbjudningslänk:\n {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
@@ -815,7 +815,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} sizi FluffyChat'e davet etti.\n1. fluffychat.im adresini ziyaret edin ve uygulamayı kurun \n2. Kaydolun veya oturum açın \n3. Davet bağlantısını açın: \n {link}",
|
||||
"inviteText": "{username} sizi FluffyChat'e davet etti.\n1. tatuchat.weltonmoura.com.br/home/ adresini ziyaret edin ve uygulamayı kurun \n2. Kaydolun veya oturum açın \n3. Davet bağlantısını açın: \n {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
@@ -534,7 +534,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} запрошує вас у FluffyChat. \n1. Перейдіть на fluffychat.im й установіть застосунок \n2. Зареєструйтесь або ввійдіть \n3. Відкрийте запрошувальне посилання:\n {link}",
|
||||
"inviteText": "{username} запрошує вас у FluffyChat. \n1. Перейдіть на tatuchat.weltonmoura.com.br/home/ й установіть застосунок \n2. Зареєструйтесь або ввійдіть \n3. Відкрийте запрошувальне посилання:\n {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
@@ -844,7 +844,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} sizni FluffyChat’ga taklif qildi.\n1. fluffychat.im saytiga tashrif buyuring va ilovani oʻrnating.\n2. Roʻyxatdan oʻting yoki tizimga kiring.\n3. Taklif havolasini oching:\n{link}",
|
||||
"inviteText": "{username} sizni FluffyChat’ga taklif qildi.\n1. tatuchat.weltonmoura.com.br/home/ saytiga tashrif buyuring va ilovani oʻrnating.\n2. Roʻyxatdan oʻting yoki tizimga kiring.\n3. Taklif havolasini oching:\n{link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
@@ -786,7 +786,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} 邀请你使用 FluffyChat。 \n1. 安装 FluffyChat:https://fluffychat.im \n2. 注册或登录 \n3. 打开邀请链接:\n {link}",
|
||||
"inviteText": "{username} 邀请你使用 FluffyChat。 \n1. 安装 FluffyChat:https://tatuchat.weltonmoura.com.br/home/ \n2. 注册或登录 \n3. 打开邀请链接:\n {link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
@@ -685,7 +685,7 @@
|
||||
"type": "String",
|
||||
"placeholders": {}
|
||||
},
|
||||
"inviteText": "{username} 邀請您使用 FluffyChat\n1. 安裝 FluffyChat:https://fluffychat.im\n2. 登入或註冊\n3. 打開該邀請網址:\n{link}",
|
||||
"inviteText": "{username} 邀請您使用 FluffyChat\n1. 安裝 FluffyChat:https://tatuchat.weltonmoura.com.br/home/\n2. 登入或註冊\n3. 打開該邀請網址:\n{link}",
|
||||
"@inviteText": {
|
||||
"type": "String",
|
||||
"placeholders": {
|
||||
|
||||
129
lib/pages/apps/apps.dart
Normal file
@@ -0,0 +1,129 @@
|
||||
// SPDX-FileCopyrightText: 2019-Present Christian Kußowski
|
||||
// SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:tatchat/config/miniapp_config.dart';
|
||||
import 'package:tatchat/config/setting_keys.dart';
|
||||
import 'package:tatchat/utils/miniapp_meta.dart';
|
||||
import 'package:tatchat/utils/miniapp_store.dart';
|
||||
import 'package:tatchat/widgets/matrix.dart';
|
||||
|
||||
import 'apps_view.dart';
|
||||
|
||||
class Apps extends StatefulWidget {
|
||||
const Apps({super.key});
|
||||
|
||||
@override
|
||||
AppsController createState() => AppsController();
|
||||
}
|
||||
|
||||
class AppsController extends State<Apps> {
|
||||
Client get client => Matrix.of(context).client;
|
||||
|
||||
Future<void> installMiniApp(String appId) async {
|
||||
await client.installMiniApp(appId);
|
||||
if (!mounted) return;
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
Future<void> uninstallMiniApp(String appId) async {
|
||||
await client.uninstallMiniApp(appId);
|
||||
if (!mounted) return;
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
/// Lets the user pick a `.html` file from their device and imports it as a
|
||||
/// custom mini app.
|
||||
Future<void> importMiniAppFromFile() async {
|
||||
final file = await FilePicker.pickFile(
|
||||
type: FileType.custom,
|
||||
allowedExtensions: ['html', 'htm'],
|
||||
);
|
||||
if (file == null) return;
|
||||
final bytes = await file.readAsBytes();
|
||||
await _importHtml(html: _decodeBytes(bytes));
|
||||
if (!mounted) return;
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
/// Fetches an HTML document from [url] and imports it as a custom mini app.
|
||||
///
|
||||
/// On web, the browser enforces CORS, so fetching a page that does not send
|
||||
/// `Access-Control-Allow-Origin` fails with a `ClientException`. In that case
|
||||
/// we transparently retry through a CORS proxy (if configured) so the import
|
||||
/// still works.
|
||||
Future<void> importMiniAppFromUrl(String url) async {
|
||||
if (url.trim().isEmpty) return;
|
||||
final response = await _fetchViaCorsProxy(Uri.parse(url));
|
||||
if (response.statusCode != 200) {
|
||||
throw Exception('${response.statusCode} ${response.reasonPhrase}');
|
||||
}
|
||||
await _importHtml(html: response.body);
|
||||
if (!mounted) return;
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
/// Fetches [url]. On web, if the initial request fails (usually because the
|
||||
/// target server lacks CORS headers), retries through the configured CORS
|
||||
/// proxy. Returns the successful response or rethrows the last error.
|
||||
Future<http.Response> _fetchViaCorsProxy(Uri uri) async {
|
||||
try {
|
||||
final response = await http.get(uri);
|
||||
if (response.statusCode == 200) return response;
|
||||
// Non-200 (e.g. 404): fall through to the proxy only for CORS errors.
|
||||
if (!kIsWeb) return response;
|
||||
} catch (e) {
|
||||
if (!kIsWeb) rethrow;
|
||||
Logs().w('Direct download failed, trying CORS proxy', e);
|
||||
}
|
||||
final proxy = AppSettings.miniAppCorsProxy.value;
|
||||
if (kIsWeb && proxy.isNotEmpty) {
|
||||
final separator = proxy.contains('?') ? '&' : '?';
|
||||
final proxied = await http.get(Uri.parse('$proxy$separator$uri'));
|
||||
if (proxied.statusCode == 200) return proxied;
|
||||
throw Exception('${proxied.statusCode} ${proxied.reasonPhrase}');
|
||||
}
|
||||
throw Exception(
|
||||
'The server does not allow cross-origin requests (CORS). '
|
||||
'Import the file manually or set a CORS proxy in the settings.',
|
||||
);
|
||||
}
|
||||
|
||||
String _decodeBytes(List<int> bytes) {
|
||||
for (final encoding in const [utf8, latin1]) {
|
||||
try {
|
||||
return encoding.decode(bytes);
|
||||
} catch (_) {}
|
||||
}
|
||||
return latin1.decode(bytes, allowInvalid: true);
|
||||
}
|
||||
|
||||
/// Reads the mini app manifest from the meta tags of [html], validates it
|
||||
/// and installs the app. The manifest `id` is used as the account data key.
|
||||
///
|
||||
/// Throws a [FormatException] when the document lacks the required meta
|
||||
/// tags, or an [Exception] when the id is already taken.
|
||||
Future<void> _importHtml({required String html}) async {
|
||||
final meta = parseMiniAppMeta(html);
|
||||
if (availableMiniApps.any((app) => app.id == meta.id)) {
|
||||
throw Exception(
|
||||
'The mini app id "${meta.id}" is reserved and cannot be reused',
|
||||
);
|
||||
}
|
||||
if (client.isMiniAppInstalled(meta.id)) {
|
||||
throw Exception('A mini app with id "${meta.id}" is already installed');
|
||||
}
|
||||
await client.importMiniApp(meta: meta, html: html);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => AppsView(this);
|
||||
}
|
||||
289
lib/pages/apps/apps_view.dart
Normal file
@@ -0,0 +1,289 @@
|
||||
// SPDX-FileCopyrightText: 2019-Present Christian Kußowski
|
||||
// SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:tatchat/config/miniapp_config.dart';
|
||||
import 'package:tatchat/l10n/l10n.dart';
|
||||
import 'package:tatchat/pages/apps/apps.dart';
|
||||
import 'package:tatchat/utils/miniapp_store.dart';
|
||||
import 'package:tatchat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
||||
import 'package:tatchat/widgets/adaptive_dialogs/show_text_input_dialog.dart';
|
||||
import 'package:tatchat/widgets/layouts/max_width_body.dart';
|
||||
|
||||
class AppsView extends StatelessWidget {
|
||||
final AppsController controller;
|
||||
|
||||
const AppsView(this.controller, {super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final installed = controller.client.installedMiniApps;
|
||||
final installedApps = installedMiniAppConfigs(controller.client);
|
||||
final availableApps = availableMiniApps
|
||||
.where((app) => !installed.contains(app.id))
|
||||
.toList();
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: const Center(child: BackButton()),
|
||||
title: Text(L10n.of(context).apps),
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
surfaceTintColor: Colors.transparent,
|
||||
actions: [
|
||||
PopupMenuButton<_ImportAction>(
|
||||
icon: const Icon(Icons.add_box_outlined),
|
||||
tooltip: L10n.of(context).importApp,
|
||||
onSelected: (action) async {
|
||||
switch (action) {
|
||||
case _ImportAction.file:
|
||||
try {
|
||||
await controller.importMiniAppFromFile();
|
||||
if (!context.mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(L10n.of(context).appImported)),
|
||||
);
|
||||
} catch (e, s) {
|
||||
Logs().e('Failed to import mini app', e, s);
|
||||
if (!context.mounted) return;
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(e.toString())));
|
||||
}
|
||||
case _ImportAction.url:
|
||||
final url = await showTextInputDialog(
|
||||
context: context,
|
||||
title: L10n.of(context).importFromUrl,
|
||||
okLabel: L10n.of(context).importApp,
|
||||
);
|
||||
if (url == null || url.trim().isEmpty) break;
|
||||
try {
|
||||
await controller.importMiniAppFromUrl(url);
|
||||
if (!context.mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(L10n.of(context).appImported)),
|
||||
);
|
||||
} catch (e, s) {
|
||||
Logs().e('Failed to import mini app', e, s);
|
||||
if (!context.mounted) return;
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(e.toString())));
|
||||
}
|
||||
}
|
||||
},
|
||||
itemBuilder: (context) => [
|
||||
PopupMenuItem(
|
||||
value: _ImportAction.file,
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.upload_file_outlined),
|
||||
const SizedBox(width: 12),
|
||||
Text(L10n.of(context).importFromFile),
|
||||
],
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: _ImportAction.url,
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.link),
|
||||
const SizedBox(width: 12),
|
||||
Text(L10n.of(context).importFromUrl),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
body: MaxWidthBody(
|
||||
withScrolling: false,
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: [
|
||||
if (installedApps.isNotEmpty) ...[
|
||||
_SectionHeader(L10n.of(context).installedApps),
|
||||
for (final app in installedApps)
|
||||
_AppCard(
|
||||
app: app,
|
||||
onTap: () => context.go('/rooms/apps/${app.id}'),
|
||||
trailing: [
|
||||
_AppCardMenu(
|
||||
onUninstall: () => controller.uninstallMiniApp(app.id),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
if (availableApps.isNotEmpty) ...[
|
||||
_SectionHeader(L10n.of(context).availableApps),
|
||||
for (final app in availableApps)
|
||||
_AppCard(
|
||||
app: app,
|
||||
onTap: null,
|
||||
trailing: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: TextButton(
|
||||
onPressed: () => controller.installMiniApp(app.id),
|
||||
child: Text(L10n.of(context).install),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
enum _ImportAction { file, url }
|
||||
|
||||
class _SectionHeader extends StatelessWidget {
|
||||
final String text;
|
||||
|
||||
const _SectionHeader(this.text);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 8, bottom: 4),
|
||||
child: Text(text, style: Theme.of(context).textTheme.titleSmall),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _AppCard extends StatelessWidget {
|
||||
final MiniAppConfig app;
|
||||
final VoidCallback? onTap;
|
||||
final List<Widget> trailing;
|
||||
|
||||
const _AppCard({required this.app, required this.trailing, this.onTap});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final category = app.category?.trim() ?? '';
|
||||
final description = app.description?.trim() ?? '';
|
||||
final subtitle = [
|
||||
if (category.isNotEmpty) category,
|
||||
if (description.isNotEmpty) description,
|
||||
].join(' · ');
|
||||
final name = miniAppName(context, app);
|
||||
return Card(
|
||||
margin: const EdgeInsets.symmetric(vertical: 4),
|
||||
child: ListTile(
|
||||
onTap: onTap,
|
||||
leading: _Logo(logo: app.logo, color: app.color, name: name),
|
||||
title: Text(name),
|
||||
subtitle: subtitle.isEmpty
|
||||
? null
|
||||
: Text(
|
||||
subtitle,
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
trailing: Row(mainAxisSize: MainAxisSize.min, children: trailing),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
enum _AppMenuAction { uninstall }
|
||||
|
||||
/// Trailing three-dot menu of an installed app. Uninstalling asks for
|
||||
/// confirmation before it is executed.
|
||||
class _AppCardMenu extends StatelessWidget {
|
||||
final VoidCallback onUninstall;
|
||||
|
||||
const _AppCardMenu({required this.onUninstall});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PopupMenuButton<_AppMenuAction>(
|
||||
icon: const Icon(Icons.more_vert),
|
||||
tooltip: L10n.of(context).moreOptions,
|
||||
onSelected: (action) async {
|
||||
switch (action) {
|
||||
case _AppMenuAction.uninstall:
|
||||
final result = await showOkCancelAlertDialog(
|
||||
context: context,
|
||||
title: L10n.of(context).uninstallApp,
|
||||
message: L10n.of(context).uninstallAppConfirm,
|
||||
okLabel: L10n.of(context).uninstall,
|
||||
isDestructive: true,
|
||||
);
|
||||
if (result == OkCancelResult.ok) onUninstall();
|
||||
}
|
||||
},
|
||||
itemBuilder: (context) => [
|
||||
PopupMenuItem<_AppMenuAction>(
|
||||
value: _AppMenuAction.uninstall,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.delete_outline,
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Text(L10n.of(context).uninstall),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Shows the logo declared by the mini app (data URI or http(s) URL), falling
|
||||
/// back to the initial letter of the app name when no usable logo is
|
||||
/// available.
|
||||
class _Logo extends StatelessWidget {
|
||||
final String? logo;
|
||||
final Color color;
|
||||
final String name;
|
||||
|
||||
const _Logo({required this.logo, required this.color, required this.name});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final value = logo?.trim() ?? '';
|
||||
Widget? image;
|
||||
if (value.startsWith('data:image/')) {
|
||||
final comma = value.indexOf(',');
|
||||
if (comma != -1 && value.substring(0, comma).contains('base64')) {
|
||||
try {
|
||||
final bytes = base64Decode(value.substring(comma + 1));
|
||||
image = ClipOval(
|
||||
child: Image.memory(
|
||||
bytes,
|
||||
width: 48,
|
||||
height: 48,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
);
|
||||
} catch (_) {}
|
||||
}
|
||||
} else if (value.startsWith('http://') || value.startsWith('https://')) {
|
||||
image = ClipOval(
|
||||
child: Image.network(value, width: 48, height: 48, fit: BoxFit.cover),
|
||||
);
|
||||
}
|
||||
if (image != null) return CircleAvatar(radius: 24, child: image);
|
||||
final initial = name.trim().isEmpty ? '?' : name.trim()[0].toUpperCase();
|
||||
return CircleAvatar(
|
||||
radius: 24,
|
||||
backgroundColor: color.withValues(alpha: .15),
|
||||
foregroundColor: color,
|
||||
child: Text(
|
||||
initial,
|
||||
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.w600),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
117
lib/pages/apps/miniapp_page.dart
Normal file
@@ -0,0 +1,117 @@
|
||||
// SPDX-FileCopyrightText: 2026 TatuChat
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:tatchat/config/miniapp_config.dart';
|
||||
import 'package:tatchat/utils/miniapp_bridge.dart';
|
||||
import 'package:tatchat/widgets/matrix.dart';
|
||||
|
||||
import 'miniapp_shell_stub.dart'
|
||||
if (dart.library.js_interop) 'miniapp_shell_web.dart'
|
||||
if (dart.library.ffi) 'miniapp_shell_native.dart';
|
||||
|
||||
/// Generic page that renders a mini app. The mini app is a self-contained HTML
|
||||
/// document that talks to the TatuChat client through the [MiniappBridge]
|
||||
/// protocol (see `assets/miniapps/`).
|
||||
class MiniAppPage extends StatefulWidget {
|
||||
final String appId;
|
||||
|
||||
const MiniAppPage({super.key, required this.appId});
|
||||
|
||||
@override
|
||||
State<MiniAppPage> createState() => _MiniAppPageState();
|
||||
}
|
||||
|
||||
class _MiniAppPageState extends State<MiniAppPage> {
|
||||
Client get client => Matrix.of(context).client;
|
||||
|
||||
MiniAppConfig? _config;
|
||||
String? _html;
|
||||
bool _notFound = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_load();
|
||||
}
|
||||
|
||||
Future<void> _load() async {
|
||||
final config = resolveMiniAppConfig(client, widget.appId);
|
||||
if (config == null) {
|
||||
if (!mounted) return;
|
||||
setState(() => _notFound = true);
|
||||
return;
|
||||
}
|
||||
if (config.htmlAsset != null) {
|
||||
final html = await rootBundle.loadString(config.htmlAsset!);
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
_config = config;
|
||||
_html = html;
|
||||
});
|
||||
return;
|
||||
}
|
||||
// Imported app: the HTML source lives in the account data store.
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
_config = config;
|
||||
_html = config.html;
|
||||
});
|
||||
}
|
||||
|
||||
/// Entry point of the bridge: called by the web view/iframe with a request
|
||||
/// coming from the mini app's JavaScript.
|
||||
Future<Map<String, Object?>> handleRequest(Map<String, dynamic> request) {
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
final brightness = Theme.of(context).brightness;
|
||||
return MiniappBridge.handleRequest(
|
||||
client,
|
||||
widget.appId,
|
||||
request,
|
||||
palette: MiniappBridge.buildPalette(scheme, brightness),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final themeColorScheme = Theme.of(context).colorScheme;
|
||||
if (_notFound) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: const Center(child: BackButton()),
|
||||
title: Text(widget.appId),
|
||||
backgroundColor: themeColorScheme.surface,
|
||||
surfaceTintColor: Colors.transparent,
|
||||
foregroundColor: themeColorScheme.onSurface,
|
||||
),
|
||||
body: const Center(child: Text('App not found')),
|
||||
);
|
||||
}
|
||||
final html = _html;
|
||||
final config = _config;
|
||||
if (html == null || config == null) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: const Center(child: BackButton()),
|
||||
title: Text(_config?.name ?? _config?.id ?? widget.appId),
|
||||
backgroundColor: themeColorScheme.surface,
|
||||
surfaceTintColor: Colors.transparent,
|
||||
foregroundColor: themeColorScheme.onSurface,
|
||||
),
|
||||
body: const Center(
|
||||
child: CircularProgressIndicator.adaptive(strokeWidth: 2),
|
||||
),
|
||||
);
|
||||
}
|
||||
return MiniAppShell(
|
||||
key: ValueKey(widget.appId),
|
||||
html: html,
|
||||
appId: widget.appId,
|
||||
title: config.name ?? config.id,
|
||||
onRequest: handleRequest,
|
||||
);
|
||||
}
|
||||
}
|
||||
110
lib/pages/apps/miniapp_shell_native.dart
Normal file
@@ -0,0 +1,110 @@
|
||||
// SPDX-FileCopyrightText: 2026 TatuChat
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
import 'package:tatchat/l10n/l10n.dart';
|
||||
|
||||
/// Native implementation of [MiniAppShell] using an isolated [InAppWebView].
|
||||
///
|
||||
/// The mini app HTML is shipped with a small bridge shim injected before
|
||||
/// `</body>` that forwards `window.parent.postMessage` calls to Dart through
|
||||
/// `flutter_inappwebview`'s JavaScript handler, and delivers the response
|
||||
/// back to the mini app via a `postMessage` with the same `requestId`.
|
||||
class MiniAppShell extends StatefulWidget {
|
||||
final String html;
|
||||
final String appId;
|
||||
final String title;
|
||||
final Future<Map<String, Object?>> Function(Map<String, dynamic> request)
|
||||
onRequest;
|
||||
|
||||
const MiniAppShell({
|
||||
super.key,
|
||||
required this.html,
|
||||
required this.appId,
|
||||
required this.title,
|
||||
required this.onRequest,
|
||||
});
|
||||
|
||||
@override
|
||||
State<MiniAppShell> createState() => _MiniAppShellState();
|
||||
}
|
||||
|
||||
class _MiniAppShellState extends State<MiniAppShell> {
|
||||
static const String _handlerName = 'com.tatuchat.miniapp.bridge';
|
||||
|
||||
InAppWebViewController? _webViewController;
|
||||
|
||||
String get _injectedHtml {
|
||||
const shim =
|
||||
'''
|
||||
<script>
|
||||
window.addEventListener('message', function (event) {
|
||||
var msg = event.data;
|
||||
if (!msg || msg.api !== 'fromMiniApp' || msg.response !== undefined) return;
|
||||
window.flutter_inappwebview.callHandler('$_handlerName', msg).then(function (response) {
|
||||
var reply = Object.assign({}, msg, { response: response });
|
||||
window.postMessage(reply, '*');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
''';
|
||||
final bodyEnd = widget.html.lastIndexOf('</body>');
|
||||
if (bodyEnd == -1) {
|
||||
return '${widget.html}\n$shim';
|
||||
}
|
||||
return widget.html.replaceRange(bodyEnd, bodyEnd, '\n$shim');
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(widget.title),
|
||||
backgroundColor: theme.colorScheme.surface,
|
||||
surfaceTintColor: Colors.transparent,
|
||||
foregroundColor: theme.colorScheme.onSurface,
|
||||
actions: [
|
||||
IconButton(
|
||||
tooltip: L10n.of(context).refresh,
|
||||
icon: const Icon(Icons.refresh_rounded),
|
||||
onPressed: () => _webViewController?.reload(),
|
||||
),
|
||||
],
|
||||
),
|
||||
backgroundColor: theme.colorScheme.surface,
|
||||
body: InAppWebView(
|
||||
initialSettings: InAppWebViewSettings(
|
||||
javaScriptEnabled: true,
|
||||
javaScriptCanOpenWindowsAutomatically: false,
|
||||
domStorageEnabled: true,
|
||||
transparentBackground: false,
|
||||
verticalScrollBarEnabled: true,
|
||||
horizontalScrollBarEnabled: false,
|
||||
),
|
||||
initialData: InAppWebViewInitialData(
|
||||
data: _injectedHtml,
|
||||
mimeType: 'text/html',
|
||||
encoding: 'utf8',
|
||||
baseUrl: WebUri('https://tatuchat.local'),
|
||||
),
|
||||
onWebViewCreated: (controller) {
|
||||
_webViewController = controller;
|
||||
controller.addJavaScriptHandler(
|
||||
handlerName: _handlerName,
|
||||
callback: (args) async {
|
||||
if (args.isEmpty) return null;
|
||||
final raw = args.first;
|
||||
if (raw is Map<String, dynamic>) {
|
||||
return widget.onRequest(Map<String, dynamic>.from(raw));
|
||||
}
|
||||
return null;
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
28
lib/pages/apps/miniapp_shell_stub.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
// SPDX-FileCopyrightText: 2026 TatuChat
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
/// Fallback used when neither `dart.library.js_interop` nor `dart.library.ffi`
|
||||
/// is available. It should never be selected on a supported platform.
|
||||
class MiniAppShell extends StatelessWidget {
|
||||
final String html;
|
||||
final String appId;
|
||||
final String title;
|
||||
final Future<Map<String, Object?>> Function(Map<String, dynamic> request)
|
||||
onRequest;
|
||||
|
||||
const MiniAppShell({
|
||||
super.key,
|
||||
required this.html,
|
||||
required this.appId,
|
||||
required this.title,
|
||||
required this.onRequest,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => throw UnsupportedError(
|
||||
'MiniAppShell is not implemented for this platform',
|
||||
);
|
||||
}
|
||||
150
lib/pages/apps/miniapp_shell_web.dart
Normal file
@@ -0,0 +1,150 @@
|
||||
// SPDX-FileCopyrightText: 2026 TatuChat
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import 'dart:js_interop';
|
||||
import 'dart:ui_web' as ui_web;
|
||||
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
import 'package:tatchat/l10n/l10n.dart';
|
||||
import 'package:tatchat/utils/miniapp_bridge.dart';
|
||||
import 'package:web/web.dart' as web;
|
||||
|
||||
/// Web implementation of [MiniAppShell] rendering the mini app into a sandboxed
|
||||
/// iframe.
|
||||
///
|
||||
/// The mini app talks to TatuChat through `postMessage`. This widget listens on
|
||||
/// `window` for `fromMiniApp` requests, forwards them to the Dart bridge and
|
||||
/// posts the response back to the iframe's `contentWindow`.
|
||||
class MiniAppShell extends StatefulWidget {
|
||||
final String html;
|
||||
final String appId;
|
||||
final String title;
|
||||
final Future<Map<String, Object?>> Function(Map<String, dynamic> request)
|
||||
onRequest;
|
||||
|
||||
const MiniAppShell({
|
||||
super.key,
|
||||
required this.html,
|
||||
required this.appId,
|
||||
required this.title,
|
||||
required this.onRequest,
|
||||
});
|
||||
|
||||
@override
|
||||
State<MiniAppShell> createState() => _MiniAppShellState();
|
||||
}
|
||||
|
||||
class _MiniAppShellState extends State<MiniAppShell> {
|
||||
static int _viewTypeCounter = 0;
|
||||
late final String _viewType;
|
||||
web.HTMLIFrameElement? _iframe;
|
||||
web.HTMLDivElement? _frameElement;
|
||||
JSFunction? _messageListener;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_viewType = 'tatchat-miniapp-${_viewTypeCounter++}';
|
||||
ui_web.platformViewRegistry.registerViewFactory(
|
||||
_viewType,
|
||||
(int viewId) => _createElement(),
|
||||
);
|
||||
final messageListener = _onMessage.toJS;
|
||||
_messageListener = messageListener;
|
||||
web.window.addEventListener('message', messageListener);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
final listener = _messageListener;
|
||||
if (listener != null) {
|
||||
web.window.removeEventListener('message', listener);
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
web.HTMLIFrameElement _buildIframe() {
|
||||
final iframe =
|
||||
web.document.createElement('iframe') as web.HTMLIFrameElement;
|
||||
iframe.style
|
||||
..width = '100%'
|
||||
..height = '100%'
|
||||
..border = 'none';
|
||||
iframe.setAttribute(
|
||||
'sandbox',
|
||||
'allow-scripts allow-forms allow-same-origin',
|
||||
);
|
||||
iframe.setAttribute('srcdoc', widget.html);
|
||||
return iframe;
|
||||
}
|
||||
|
||||
web.HTMLElement _createElement() {
|
||||
final div = web.document.createElement('div') as web.HTMLDivElement;
|
||||
div.style
|
||||
..width = '100%'
|
||||
..height = '100%'
|
||||
..margin = '0'
|
||||
..padding = '0';
|
||||
final iframe = _buildIframe();
|
||||
div.append(iframe);
|
||||
_iframe = iframe;
|
||||
_frameElement = div;
|
||||
return div;
|
||||
}
|
||||
|
||||
void _reload() {
|
||||
final div = _frameElement;
|
||||
if (div == null) return;
|
||||
_iframe?.remove();
|
||||
final iframe = _buildIframe();
|
||||
div.append(iframe);
|
||||
_iframe = iframe;
|
||||
}
|
||||
|
||||
void _onMessage(web.Event event) {
|
||||
if (!event.isA<web.MessageEvent>()) return;
|
||||
final messageEvent = event as web.MessageEvent;
|
||||
final data = messageEvent.data?.dartify();
|
||||
if (data is! Map) return;
|
||||
final request = Map<String, dynamic>.from(data);
|
||||
if (request['api'] != MiniappBridge.api) return;
|
||||
final iframeWindow = _iframe?.contentWindow;
|
||||
if (iframeWindow == null) return;
|
||||
final requestId = request['requestId'];
|
||||
final widgetId = request['widgetId'];
|
||||
widget.onRequest(request).then((result) {
|
||||
iframeWindow.postMessage(
|
||||
{
|
||||
'api': MiniappBridge.api,
|
||||
'widgetId': widgetId,
|
||||
'requestId': requestId,
|
||||
'response': result,
|
||||
}.jsify(),
|
||||
'*'.toJS,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(widget.title),
|
||||
backgroundColor: theme.colorScheme.surface,
|
||||
surfaceTintColor: Colors.transparent,
|
||||
foregroundColor: theme.colorScheme.onSurface,
|
||||
actions: [
|
||||
IconButton(
|
||||
tooltip: L10n.of(context).refresh,
|
||||
icon: const Icon(Icons.refresh_rounded),
|
||||
onPressed: _reload,
|
||||
),
|
||||
],
|
||||
),
|
||||
backgroundColor: theme.colorScheme.surface,
|
||||
body: HtmlElementView(viewType: _viewType),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -10,11 +10,14 @@ import 'package:collection/collection.dart';
|
||||
import 'package:desktop_drop/desktop_drop.dart';
|
||||
import 'package:emoji_picker_flutter/emoji_picker_flutter.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:html/parser.dart' show parseFragment;
|
||||
import 'package:markdown/markdown.dart' show ExtensionSet, markdownToHtml;
|
||||
import 'package:tatchat/config/setting_keys.dart';
|
||||
import 'package:tatchat/config/themes.dart';
|
||||
import 'package:tatchat/l10n/l10n.dart';
|
||||
import 'package:tatchat/pages/chat/chat_view.dart';
|
||||
import 'package:tatchat/pages/chat/event_info_dialog.dart';
|
||||
import 'package:tatchat/pages/chat/edit_media_caption_dialog.dart';
|
||||
import 'package:tatchat/pages/chat/start_poll_bottom_sheet.dart';
|
||||
import 'package:tatchat/pages/chat/trust_user_key_dialog.dart';
|
||||
import 'package:tatchat/pages/chat/utils/web_file_to_x_file.dart';
|
||||
@@ -201,6 +204,8 @@ class ChatController extends State<ChatPageWithRoom>
|
||||
|
||||
bool showEmojiPicker = false;
|
||||
|
||||
bool showAttachmentPicker = false;
|
||||
|
||||
String? get threadLastEventId {
|
||||
final threadId = activeThreadId;
|
||||
if (threadId == null) return null;
|
||||
@@ -975,18 +980,40 @@ class ChatController extends State<ChatPageWithRoom>
|
||||
setState(() => showEmojiPicker = false);
|
||||
}
|
||||
|
||||
void hideAttachmentPicker() {
|
||||
setState(() => showAttachmentPicker = false);
|
||||
}
|
||||
|
||||
void emojiPickerAction() {
|
||||
if (showEmojiPicker) {
|
||||
inputFocus.requestFocus();
|
||||
} else {
|
||||
inputFocus.unfocus();
|
||||
}
|
||||
setState(() => showEmojiPicker = !showEmojiPicker);
|
||||
setState(() {
|
||||
showEmojiPicker = !showEmojiPicker;
|
||||
showAttachmentPicker = false;
|
||||
});
|
||||
}
|
||||
|
||||
void attachmentPickerAction() {
|
||||
if (showAttachmentPicker) {
|
||||
inputFocus.requestFocus();
|
||||
} else {
|
||||
inputFocus.unfocus();
|
||||
}
|
||||
setState(() {
|
||||
showAttachmentPicker = !showAttachmentPicker;
|
||||
showEmojiPicker = false;
|
||||
});
|
||||
}
|
||||
|
||||
void _inputFocusListener() {
|
||||
if (showEmojiPicker && inputFocus.hasFocus) {
|
||||
setState(() => showEmojiPicker = false);
|
||||
if ((showEmojiPicker || showAttachmentPicker) && inputFocus.hasFocus) {
|
||||
setState(() {
|
||||
showEmojiPicker = false;
|
||||
showAttachmentPicker = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1013,6 +1040,7 @@ class ChatController extends State<ChatPageWithRoom>
|
||||
Clipboard.setData(ClipboardData(text: _getSelectedEventString()));
|
||||
setState(() {
|
||||
showEmojiPicker = false;
|
||||
showAttachmentPicker = false;
|
||||
selectedEvents.clear();
|
||||
});
|
||||
}
|
||||
@@ -1041,6 +1069,7 @@ class ChatController extends State<ChatPageWithRoom>
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
showEmojiPicker = false;
|
||||
showAttachmentPicker = false;
|
||||
selectedEvents.clear();
|
||||
});
|
||||
scaffoldMessenger.showSnackBar(
|
||||
@@ -1117,6 +1146,7 @@ class ChatController extends State<ChatPageWithRoom>
|
||||
);
|
||||
setState(() {
|
||||
showEmojiPicker = false;
|
||||
showAttachmentPicker = false;
|
||||
selectedEvents.clear();
|
||||
});
|
||||
}
|
||||
@@ -1302,6 +1332,7 @@ class ChatController extends State<ChatPageWithRoom>
|
||||
void clearSelectedEvents() => setState(() {
|
||||
selectedEvents.clear();
|
||||
showEmojiPicker = false;
|
||||
showAttachmentPicker = false;
|
||||
});
|
||||
|
||||
void clearSingleSelectedEvent() {
|
||||
@@ -1314,6 +1345,16 @@ class ChatController extends State<ChatPageWithRoom>
|
||||
final timeline = this.timeline;
|
||||
if (timeline == null) return;
|
||||
|
||||
if (const {
|
||||
MessageTypes.Image,
|
||||
MessageTypes.Video,
|
||||
MessageTypes.Audio,
|
||||
MessageTypes.File,
|
||||
}.contains(event.messageType)) {
|
||||
_startEditingMediaCaption(event, clearSelection: clearSelection);
|
||||
return;
|
||||
}
|
||||
|
||||
final client = currentRoomBundle.firstWhere(
|
||||
(c) => c?.userID == event.senderId,
|
||||
orElse: () => null,
|
||||
@@ -1336,6 +1377,33 @@ class ChatController extends State<ChatPageWithRoom>
|
||||
inputFocus.requestFocus();
|
||||
}
|
||||
|
||||
Future<void> _startEditingMediaCaption(
|
||||
Event event, {
|
||||
bool clearSelection = false,
|
||||
}) async {
|
||||
final timeline = this.timeline;
|
||||
if (timeline == null) return;
|
||||
if (clearSelection) setState(() => selectedEvents.clear());
|
||||
final caption = event.getDisplayEvent(timeline).body;
|
||||
final result = await showEditMediaCaptionDialog(
|
||||
context,
|
||||
initialCaption: caption,
|
||||
);
|
||||
if (result == null) return;
|
||||
final html = markdownToHtml(
|
||||
result,
|
||||
extensionSet: ExtensionSet.gitHubFlavored,
|
||||
);
|
||||
final content = Map<String, Object?>.of(event.content)
|
||||
..remove('m.relates_to')
|
||||
..['body'] = result;
|
||||
if (parseFragment(html).text != result) {
|
||||
content['format'] = 'org.matrix.custom.html';
|
||||
content['formatted_body'] = html;
|
||||
}
|
||||
await room.sendEvent(content, editEventId: event.eventId);
|
||||
}
|
||||
|
||||
void editSelectedEventAction() {
|
||||
_startEditingEvent(selectedEvents.first, clearSelection: true);
|
||||
}
|
||||
|
||||
168
lib/pages/chat/chat_attachment_picker.dart
Normal file
@@ -0,0 +1,168 @@
|
||||
// SPDX-FileCopyrightText: 2019-Present Christian Kußowski
|
||||
// SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import 'package:tatchat/config/themes.dart';
|
||||
import 'package:tatchat/l10n/l10n.dart';
|
||||
import 'package:tatchat/pages/chat/chat.dart';
|
||||
import 'package:tatchat/utils/platform_infos.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
|
||||
class ChatAttachmentPicker extends StatelessWidget {
|
||||
final ChatController controller;
|
||||
|
||||
const ChatAttachmentPicker(this.controller, {super.key});
|
||||
|
||||
static const double _itemSpacing = 8;
|
||||
static const double _handleSize = 4;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final l10n = L10n.of(context);
|
||||
final mobile = PlatformInfos.isMobile;
|
||||
|
||||
final items = <(IconData, String, AddPopupMenuActions)>[
|
||||
if (mobile)
|
||||
(
|
||||
Icons.gps_fixed_outlined,
|
||||
l10n.shareLocation,
|
||||
AddPopupMenuActions.location,
|
||||
),
|
||||
(Icons.poll_outlined, l10n.startPoll, AddPopupMenuActions.poll),
|
||||
if (mobile)
|
||||
(
|
||||
Icons.videocam_outlined,
|
||||
l10n.recordAVideo,
|
||||
AddPopupMenuActions.videoCamera,
|
||||
),
|
||||
if (mobile)
|
||||
(
|
||||
Icons.camera_alt_outlined,
|
||||
l10n.takeAPhoto,
|
||||
AddPopupMenuActions.photoCamera,
|
||||
),
|
||||
(Icons.image_outlined, l10n.openGallery, AddPopupMenuActions.media),
|
||||
(Icons.attachment_outlined, l10n.sendFile, AddPopupMenuActions.file),
|
||||
];
|
||||
if (items.isEmpty) return const SizedBox.shrink();
|
||||
|
||||
final rows = <List<(IconData, String, AddPopupMenuActions)>>[];
|
||||
for (var i = 0; i < items.length; i += 3) {
|
||||
rows.add(items.sublist(i, i + 3 > items.length ? items.length : i + 3));
|
||||
}
|
||||
|
||||
return ClipRRect(
|
||||
borderRadius: const BorderRadius.vertical(top: Radius.circular(20)),
|
||||
child: AnimatedSize(
|
||||
duration: FluffyThemes.animationDuration,
|
||||
curve: FluffyThemes.animationCurve,
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: controller.showAttachmentPicker
|
||||
? Material(
|
||||
color: theme.colorScheme.surfaceContainer,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(12, 6, 12, 12),
|
||||
child: Column(
|
||||
mainAxisSize: .min,
|
||||
children: [
|
||||
Container(
|
||||
width: 32,
|
||||
height: _handleSize,
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.outlineVariant,
|
||||
borderRadius: BorderRadius.circular(_handleSize / 2),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Column(
|
||||
mainAxisSize: .min,
|
||||
children: [
|
||||
for (final (i, row) in rows.indexed) ...[
|
||||
if (i > 0) const SizedBox(height: _itemSpacing),
|
||||
Row(
|
||||
children: [
|
||||
for (final item in row) ...[
|
||||
if (row.indexOf(item) > 0)
|
||||
const SizedBox(width: _itemSpacing),
|
||||
Expanded(
|
||||
child: AspectRatio(
|
||||
aspectRatio: 1,
|
||||
child: _AttachmentItem(
|
||||
icon: item.$1,
|
||||
label: item.$2,
|
||||
onTap: () {
|
||||
controller.hideAttachmentPicker();
|
||||
controller
|
||||
.onAddPopupMenuButtonSelected(
|
||||
item.$3,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
if (row.length < 3)
|
||||
for (var i = 0; i < 3 - row.length; i++) ...[
|
||||
const SizedBox(width: _itemSpacing),
|
||||
const Expanded(child: SizedBox()),
|
||||
],
|
||||
],
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _AttachmentItem extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final String label;
|
||||
final VoidCallback onTap;
|
||||
|
||||
const _AttachmentItem({
|
||||
required this.icon,
|
||||
required this.label,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
return Material(
|
||||
color: theme.colorScheme.secondaryContainer,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(icon, size: 30, color: theme.colorScheme.onSecondaryContainer),
|
||||
const SizedBox(height: 8),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Text(
|
||||
label,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.center,
|
||||
style: theme.textTheme.labelMedium?.copyWith(
|
||||
color: theme.colorScheme.onSecondaryContainer,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@ import 'package:tatchat/pages/chat/encryption_info.dart';
|
||||
import 'package:tatchat/pages/chat/events/message.dart';
|
||||
import 'package:tatchat/pages/chat/seen_by_row.dart';
|
||||
import 'package:tatchat/pages/chat/typing_indicators.dart';
|
||||
import 'package:tatchat/utils/account_config.dart';
|
||||
import 'package:tatchat/utils/matrix_sdk_extensions/filtered_timeline_extension.dart';
|
||||
import 'package:tatchat/utils/platform_infos.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
@@ -53,8 +52,7 @@ class ChatEventList extends StatelessWidget {
|
||||
thisEventsKeyMap[events[i].eventId] = i;
|
||||
}
|
||||
|
||||
final hasWallpaper =
|
||||
controller.room.client.applicationAccountConfig.wallpaperUrl != null;
|
||||
const hasWallpaper = true;
|
||||
|
||||
return SelectionArea(
|
||||
child: MediaQuery(
|
||||
|
||||
@@ -141,102 +141,10 @@ class ChatInputRow extends StatelessWidget {
|
||||
alignment: Alignment.center,
|
||||
decoration: const BoxDecoration(),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
child: PopupMenuButton<AddPopupMenuActions>(
|
||||
useRootNavigator: true,
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.add_circle_outline),
|
||||
iconColor: theme.colorScheme.onPrimaryContainer,
|
||||
onSelected: controller.onAddPopupMenuButtonSelected,
|
||||
itemBuilder: (BuildContext context) => [
|
||||
if (PlatformInfos.isMobile)
|
||||
PopupMenuItem(
|
||||
value: AddPopupMenuActions.location,
|
||||
child: ListTile(
|
||||
leading: CircleAvatar(
|
||||
backgroundColor:
|
||||
theme.colorScheme.onPrimaryContainer,
|
||||
foregroundColor:
|
||||
theme.colorScheme.primaryContainer,
|
||||
child: const Icon(Icons.gps_fixed_outlined),
|
||||
),
|
||||
title: Text(L10n.of(context).shareLocation),
|
||||
contentPadding: const EdgeInsets.all(0),
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: AddPopupMenuActions.poll,
|
||||
child: ListTile(
|
||||
leading: CircleAvatar(
|
||||
backgroundColor:
|
||||
theme.colorScheme.onPrimaryContainer,
|
||||
foregroundColor:
|
||||
theme.colorScheme.primaryContainer,
|
||||
child: const Icon(Icons.poll_outlined),
|
||||
),
|
||||
title: Text(L10n.of(context).startPoll),
|
||||
contentPadding: const EdgeInsets.all(0),
|
||||
),
|
||||
),
|
||||
PopupMenuDivider(),
|
||||
if (PlatformInfos.isMobile) ...[
|
||||
PopupMenuItem(
|
||||
value: AddPopupMenuActions.videoCamera,
|
||||
child: ListTile(
|
||||
leading: CircleAvatar(
|
||||
backgroundColor:
|
||||
theme.colorScheme.onPrimaryContainer,
|
||||
foregroundColor:
|
||||
theme.colorScheme.primaryContainer,
|
||||
child: const Icon(Icons.videocam_outlined),
|
||||
),
|
||||
title: Text(L10n.of(context).recordAVideo),
|
||||
contentPadding: const EdgeInsets.all(0),
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: AddPopupMenuActions.photoCamera,
|
||||
child: ListTile(
|
||||
leading: CircleAvatar(
|
||||
backgroundColor:
|
||||
theme.colorScheme.onPrimaryContainer,
|
||||
foregroundColor:
|
||||
theme.colorScheme.primaryContainer,
|
||||
child: const Icon(Icons.camera_alt_outlined),
|
||||
),
|
||||
title: Text(L10n.of(context).takeAPhoto),
|
||||
contentPadding: const EdgeInsets.all(0),
|
||||
),
|
||||
),
|
||||
PopupMenuDivider(),
|
||||
],
|
||||
PopupMenuItem(
|
||||
value: AddPopupMenuActions.media,
|
||||
child: ListTile(
|
||||
leading: CircleAvatar(
|
||||
backgroundColor:
|
||||
theme.colorScheme.onPrimaryContainer,
|
||||
foregroundColor:
|
||||
theme.colorScheme.primaryContainer,
|
||||
child: const Icon(Icons.image_outlined),
|
||||
),
|
||||
title: Text(L10n.of(context).openGallery),
|
||||
contentPadding: const EdgeInsets.all(0),
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: AddPopupMenuActions.file,
|
||||
child: ListTile(
|
||||
leading: CircleAvatar(
|
||||
backgroundColor:
|
||||
theme.colorScheme.onPrimaryContainer,
|
||||
foregroundColor:
|
||||
theme.colorScheme.primaryContainer,
|
||||
child: const Icon(Icons.attachment_outlined),
|
||||
),
|
||||
title: Text(L10n.of(context).sendFile),
|
||||
contentPadding: const EdgeInsets.all(0),
|
||||
),
|
||||
),
|
||||
],
|
||||
color: theme.colorScheme.onPrimaryContainer,
|
||||
onPressed: controller.attachmentPickerAction,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
|
||||
@@ -27,6 +27,7 @@ import 'package:matrix/matrix.dart';
|
||||
|
||||
import '../../utils/matrix_sdk_extensions/room_extension.dart';
|
||||
import '../../utils/stream_extension.dart';
|
||||
import 'chat_attachment_picker.dart';
|
||||
import 'chat_emoji_picker.dart';
|
||||
import 'chat_input_row.dart';
|
||||
|
||||
@@ -57,6 +58,7 @@ class ChatView extends StatelessWidget {
|
||||
canPop:
|
||||
controller.selectedEvents.isEmpty &&
|
||||
!controller.showEmojiPicker &&
|
||||
!controller.showAttachmentPicker &&
|
||||
controller.activeThreadId == null,
|
||||
onPopInvokedWithResult: (pop, _) async {
|
||||
if (pop) return;
|
||||
@@ -64,6 +66,8 @@ class ChatView extends StatelessWidget {
|
||||
controller.clearSelectedEvents();
|
||||
} else if (controller.showEmojiPicker) {
|
||||
controller.emojiPickerAction();
|
||||
} else if (controller.showAttachmentPicker) {
|
||||
controller.attachmentPickerAction();
|
||||
} else if (controller.activeThreadId != null) {
|
||||
controller.closeThread();
|
||||
}
|
||||
@@ -104,8 +108,9 @@ class ChatView extends StatelessWidget {
|
||||
backgroundColor: controller.selectedEvents.isEmpty
|
||||
? controller.activeThreadId != null
|
||||
? theme.colorScheme.secondaryContainer
|
||||
: theme.colorScheme.surface.withAlpha(240)
|
||||
: theme.colorScheme.surface
|
||||
: theme.colorScheme.tertiaryContainer,
|
||||
surfaceTintColor: Colors.transparent,
|
||||
automaticallyImplyLeading: false,
|
||||
leading: controller.selectMode
|
||||
? IconButton(
|
||||
@@ -347,25 +352,38 @@ class ChatView extends StatelessWidget {
|
||||
top: false,
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
if (accountConfig.wallpaperUrl != null)
|
||||
Opacity(
|
||||
opacity: accountConfig.wallpaperOpacity ?? 0.5,
|
||||
child: ImageFiltered(
|
||||
imageFilter: ui.ImageFilter.blur(
|
||||
sigmaX: accountConfig.wallpaperBlur ?? 0.0,
|
||||
sigmaY: accountConfig.wallpaperBlur ?? 0.0,
|
||||
),
|
||||
child: MxcImage(
|
||||
cacheKey: accountConfig.wallpaperUrl.toString(),
|
||||
uri: accountConfig.wallpaperUrl,
|
||||
fit: BoxFit.cover,
|
||||
height: MediaQuery.sizeOf(context).height,
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
isThumbnail: false,
|
||||
placeholder: (_) => Container(),
|
||||
),
|
||||
Opacity(
|
||||
opacity: accountConfig.wallpaperUrl != null
|
||||
? accountConfig.wallpaperOpacity ?? 0.5
|
||||
: 0.3,
|
||||
child: ImageFiltered(
|
||||
imageFilter: ui.ImageFilter.blur(
|
||||
sigmaX: accountConfig.wallpaperUrl != null
|
||||
? accountConfig.wallpaperBlur ?? 0.0
|
||||
: 0.0,
|
||||
sigmaY: accountConfig.wallpaperUrl != null
|
||||
? accountConfig.wallpaperBlur ?? 0.0
|
||||
: 0.0,
|
||||
),
|
||||
child: accountConfig.wallpaperUrl != null
|
||||
? MxcImage(
|
||||
cacheKey: accountConfig.wallpaperUrl
|
||||
.toString(),
|
||||
uri: accountConfig.wallpaperUrl,
|
||||
fit: BoxFit.cover,
|
||||
height: MediaQuery.sizeOf(context).height,
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
isThumbnail: false,
|
||||
placeholder: (_) => Container(),
|
||||
)
|
||||
: Image.asset(
|
||||
'assets/logo/background.png',
|
||||
fit: BoxFit.cover,
|
||||
height: MediaQuery.sizeOf(context).height,
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: controller.clearSingleSelectedEvent,
|
||||
child: ChatEventList(controller: controller),
|
||||
@@ -472,6 +490,9 @@ class ChatView extends StatelessWidget {
|
||||
children: [
|
||||
ReplyDisplay(controller),
|
||||
ChatInputRow(controller),
|
||||
ChatAttachmentPicker(
|
||||
controller,
|
||||
),
|
||||
ChatEmojiPicker(controller),
|
||||
],
|
||||
),
|
||||
|
||||
86
lib/pages/chat/edit_media_caption_dialog.dart
Normal file
@@ -0,0 +1,86 @@
|
||||
// SPDX-FileCopyrightText: 2019-Present Christian Kußowski
|
||||
// SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
import 'package:tatchat/config/setting_keys.dart';
|
||||
import 'package:tatchat/l10n/l10n.dart';
|
||||
import 'package:tatchat/utils/platform_infos.dart';
|
||||
import 'package:tatchat/widgets/adaptive_dialogs/adaptive_dialog_action.dart';
|
||||
import 'package:tatchat/widgets/adaptive_dialogs/dialog_text_field.dart';
|
||||
|
||||
Future<String?> showEditMediaCaptionDialog(
|
||||
BuildContext context, {
|
||||
required String initialCaption,
|
||||
}) => showDialog<String>(
|
||||
context: context,
|
||||
builder: (context) => EditMediaCaptionDialog(initialCaption: initialCaption),
|
||||
);
|
||||
|
||||
class EditMediaCaptionDialog extends StatefulWidget {
|
||||
final String initialCaption;
|
||||
|
||||
const EditMediaCaptionDialog({super.key, required this.initialCaption});
|
||||
|
||||
@override
|
||||
State<EditMediaCaptionDialog> createState() => _EditMediaCaptionDialogState();
|
||||
}
|
||||
|
||||
class _EditMediaCaptionDialogState extends State<EditMediaCaptionDialog> {
|
||||
late final TextEditingController _controller = TextEditingController(
|
||||
text: widget.initialCaption,
|
||||
);
|
||||
late final FocusNode _focusNode = FocusNode();
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_focusNode.dispose();
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isMobile = PlatformInfos.isMobile;
|
||||
final l10n = L10n.of(context);
|
||||
return AlertDialog.adaptive(
|
||||
title: Text(l10n.editCaption),
|
||||
insetPadding: isMobile
|
||||
? const EdgeInsets.all(8.0)
|
||||
: const EdgeInsets.symmetric(horizontal: 40, vertical: 24),
|
||||
constraints: isMobile
|
||||
? const BoxConstraints(
|
||||
maxWidth: double.infinity,
|
||||
maxHeight: double.infinity,
|
||||
)
|
||||
: null,
|
||||
content: SizedBox(
|
||||
width: 512,
|
||||
height: isMobile ? MediaQuery.sizeOf(context).height * 0.7 : null,
|
||||
child: DialogTextField(
|
||||
controller: _controller,
|
||||
focusNode: _focusNode,
|
||||
hintText: l10n.captionHint,
|
||||
labelText: l10n.optionalMessage,
|
||||
keyboardType: TextInputType.multiline,
|
||||
minLines: isMobile ? 8 : 3,
|
||||
maxLines: isMobile ? null : 8,
|
||||
maxLength: AppSettings.textMessageMaxLength.value,
|
||||
counterText: '',
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
AdaptiveDialogAction(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: Text(l10n.cancel),
|
||||
),
|
||||
AdaptiveDialogAction(
|
||||
autofocus: true,
|
||||
onPressed: () => Navigator.of(context).pop(_controller.text.trim()),
|
||||
child: Text(l10n.save),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -48,8 +48,6 @@ class ImageBubble extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
|
||||
var borderRadius =
|
||||
this.borderRadius ?? BorderRadius.circular(AppConfig.borderRadius);
|
||||
|
||||
@@ -70,14 +68,7 @@ class ImageBubble extends StatelessWidget {
|
||||
Material(
|
||||
color: Colors.transparent,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: borderRadius,
|
||||
side: BorderSide(
|
||||
color: event.messageType == MessageTypes.Sticker
|
||||
? Colors.transparent
|
||||
: theme.dividerColor,
|
||||
),
|
||||
),
|
||||
shape: RoundedRectangleBorder(borderRadius: borderRadius),
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: borderRadius,
|
||||
|
||||
@@ -22,9 +22,9 @@ class MapBubble extends StatelessWidget {
|
||||
const MapBubble({
|
||||
required this.latitude,
|
||||
required this.longitude,
|
||||
this.zoom = 14.0,
|
||||
this.width = 400,
|
||||
this.height = 400,
|
||||
this.zoom = 16.0,
|
||||
this.width = 350,
|
||||
this.height = 350,
|
||||
this.radius = 10.0,
|
||||
this.onTap,
|
||||
super.key,
|
||||
|
||||
@@ -3,28 +3,42 @@
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import 'dart:typed_data';
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
import 'package:async/async.dart' show Result;
|
||||
import 'package:crop_image/crop_image.dart';
|
||||
import 'package:cross_file/cross_file.dart';
|
||||
import 'package:cupertino_ui/cupertino_ui.dart';
|
||||
import 'package:html/parser.dart' show parseFragment;
|
||||
import 'package:markdown/markdown.dart' show markdownToHtml;
|
||||
import 'package:markdown/markdown.dart' show ExtensionSet, markdownToHtml;
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
import 'package:matrix/matrix.dart' hide Result;
|
||||
import 'package:mime/mime.dart';
|
||||
import 'package:tatchat/config/app_config.dart';
|
||||
import 'package:tatchat/config/setting_keys.dart';
|
||||
import 'package:tatchat/l10n/l10n.dart';
|
||||
import 'package:tatchat/pages/chat/image_edit_geometry.dart';
|
||||
import 'package:tatchat/pages/chat/trust_user_key_dialog.dart';
|
||||
import 'package:tatchat/utils/matrix_sdk_extensions/matrix_file_extension.dart';
|
||||
import 'package:tatchat/utils/other_party_can_receive.dart';
|
||||
import 'package:tatchat/utils/platform_infos.dart';
|
||||
import 'package:tatchat/utils/show_scaffold_dialog.dart';
|
||||
import 'package:tatchat/utils/size_string.dart';
|
||||
import 'package:tatchat/utils/start_push_foreground_service.dart';
|
||||
import 'package:tatchat/widgets/adaptive_dialogs/adaptive_dialog_action.dart';
|
||||
import 'package:tatchat/widgets/adaptive_dialogs/dialog_text_field.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
import 'package:matrix/matrix.dart' hide Result;
|
||||
import 'package:mime/mime.dart';
|
||||
|
||||
import '../../utils/resize_video.dart';
|
||||
|
||||
/// Opens the crop/draw/rotate image editor with [bytes] and returns the edited
|
||||
/// PNG bytes, or null if the user cancelled or made no changes.
|
||||
Future<Uint8List?> editImageBytes(BuildContext context, Uint8List bytes) =>
|
||||
showScaffoldDialog<Uint8List?>(
|
||||
context: context,
|
||||
builder: (_) => _ImageEditPage(bytes: bytes),
|
||||
);
|
||||
|
||||
class SendFileDialog extends StatefulWidget {
|
||||
final Room room;
|
||||
final List<XFile> files;
|
||||
@@ -53,11 +67,31 @@ class SendFileDialogState extends State<SendFileDialog> {
|
||||
final TextEditingController _labelTextController = TextEditingController();
|
||||
final FocusNode _labelFocusNode = FocusNode();
|
||||
|
||||
/// Mutable working copy of [SendFileDialog.files].
|
||||
/// Mutable working copy of [SendFileDialog.files]. Editing an image replaces
|
||||
/// its entry with a new [XFile] whose bytes, mimetype and filename extension
|
||||
/// all reflect the edit result (always PNG). Keeping bytes + mimetype in one
|
||||
/// object avoids drift between the preview, the upload and the extension.
|
||||
late final List<XFile> _files = List<XFile>.of(widget.files);
|
||||
|
||||
void _editLabel() {
|
||||
_labelFocusNode.requestFocus();
|
||||
Future<void> _editImage(int index) async {
|
||||
final bytes = await _files[index].readAsBytes();
|
||||
if (!mounted) return;
|
||||
final result = await showScaffoldDialog<Uint8List?>(
|
||||
context: context,
|
||||
builder: (_) => _ImageEditPage(bytes: bytes),
|
||||
);
|
||||
if (!mounted || result == null) return;
|
||||
final original = _files[index];
|
||||
final dot = original.name.lastIndexOf('.');
|
||||
final baseName = dot > 0 ? original.name.substring(0, dot) : original.name;
|
||||
setState(() {
|
||||
_files[index] = XFile.fromData(
|
||||
result,
|
||||
mimeType: 'image/png',
|
||||
name: '$baseName.png',
|
||||
length: result.length,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _send(String? uniqueFileType) async {
|
||||
@@ -133,7 +167,10 @@ class SendFileDialogState extends State<SendFileDialog> {
|
||||
? null
|
||||
: () {
|
||||
final extra = <String, Object>{'body': label};
|
||||
final html = markdownToHtml(label);
|
||||
final html = markdownToHtml(
|
||||
label,
|
||||
extensionSet: ExtensionSet.gitHubFlavored,
|
||||
);
|
||||
if (parseFragment(html).text != label) {
|
||||
extra['format'] = 'org.matrix.custom.html';
|
||||
extra['formatted_body'] = html;
|
||||
@@ -335,15 +372,13 @@ class SendFileDialogState extends State<SendFileDialog> {
|
||||
color: Colors.black54,
|
||||
shape: const CircleBorder(),
|
||||
child: IconButton(
|
||||
tooltip: L10n.of(
|
||||
context,
|
||||
).optionalMessage,
|
||||
tooltip: L10n.of(context).editImage,
|
||||
icon: const Icon(
|
||||
Icons.edit_outlined,
|
||||
color: Colors.white,
|
||||
size: 20,
|
||||
),
|
||||
onPressed: _editLabel,
|
||||
onPressed: () => _editImage(i),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -500,3 +535,712 @@ extension on ScaffoldMessengerState {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
enum _EditMode { crop, draw }
|
||||
|
||||
/// The crop (a normalized rectangle held by [CropController]), the rotation
|
||||
/// (quarter turns) and the drawn strokes are only composited into a single
|
||||
/// full-resolution bitmap when the user saves.
|
||||
///
|
||||
/// Returns the edited image bytes (PNG) via [Navigator.pop], or null if the user
|
||||
/// cancelled or made no changes (in which case the original file is kept).
|
||||
class _ImageEditPage extends StatefulWidget {
|
||||
final Uint8List bytes;
|
||||
|
||||
const _ImageEditPage({required this.bytes});
|
||||
|
||||
@override
|
||||
State<_ImageEditPage> createState() => _ImageEditPageState();
|
||||
}
|
||||
|
||||
class _ImageEditPageState extends State<_ImageEditPage> {
|
||||
static const List<Color> _palette = [
|
||||
Colors.red,
|
||||
Colors.orange,
|
||||
Colors.yellow,
|
||||
Colors.green,
|
||||
Colors.blue,
|
||||
Colors.purple,
|
||||
Colors.black,
|
||||
Colors.white,
|
||||
];
|
||||
|
||||
static const Rect _fullCrop = Rect.fromLTWH(0, 0, 1, 1);
|
||||
|
||||
final CropController _cropController = CropController();
|
||||
|
||||
/// Source image, decoded once at full resolution. Never mutated.
|
||||
ui.Image? _image;
|
||||
Object? _decodeError;
|
||||
|
||||
_EditMode _mode = _EditMode.crop;
|
||||
|
||||
/// Clockwise quarter turns applied on top of the crop. Kept separate from the
|
||||
/// crop controller so the crop rectangle always stays in the un-rotated image
|
||||
/// coordinate space, which keeps all stroke math rotation-free.
|
||||
int _quarterTurns = 0;
|
||||
|
||||
/// Strokes, stored in source-image pixel coordinates (crop- and
|
||||
/// rotation-independent) so they stay anchored to the image content.
|
||||
final List<_Stroke> _strokes = [];
|
||||
Color _color = Colors.red;
|
||||
double _strokeWidth = 4.0;
|
||||
bool _eraser = false;
|
||||
bool _saving = false;
|
||||
|
||||
/// View transform for the draw surface (two-finger pinch to zoom). Drawing
|
||||
/// happens with one finger; two fingers zoom via [InteractiveViewer].
|
||||
final TransformationController _drawTransform = TransformationController();
|
||||
|
||||
/// Horizontal mirror (flip), applied together with rotation at save time.
|
||||
bool _mirror = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_decode();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_cropController.dispose();
|
||||
_drawTransform.dispose();
|
||||
// Note: [_image] is intentionally not disposed here. A save may still be
|
||||
// rasterizing from it asynchronously when this page is popped; the engine's
|
||||
// finalizer reclaims the decoded image once it is no longer referenced.
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Future<void> _decode() async {
|
||||
try {
|
||||
final codec = await ui.instantiateImageCodec(widget.bytes);
|
||||
final frame = await codec.getNextFrame();
|
||||
if (!mounted) {
|
||||
frame.image.dispose();
|
||||
return;
|
||||
}
|
||||
setState(() => _image = frame.image);
|
||||
} catch (e, s) {
|
||||
Logs().w('Unable to decode image for editing', e, s);
|
||||
if (mounted) setState(() => _decodeError = e);
|
||||
}
|
||||
}
|
||||
|
||||
Rect _cropRectPx(ui.Image image) {
|
||||
final c = _cropController.crop;
|
||||
return Rect.fromLTRB(
|
||||
c.left * image.width,
|
||||
c.top * image.height,
|
||||
c.right * image.width,
|
||||
c.bottom * image.height,
|
||||
);
|
||||
}
|
||||
|
||||
bool get _hasEdits =>
|
||||
_strokes.isNotEmpty ||
|
||||
_quarterTurns % 4 != 0 ||
|
||||
_mirror ||
|
||||
_cropController.crop != _fullCrop;
|
||||
|
||||
void _rotate(int direction) {
|
||||
if (_saving) return;
|
||||
setState(() => _quarterTurns += direction);
|
||||
}
|
||||
|
||||
void _toggleMirror() {
|
||||
if (_saving) return;
|
||||
setState(() => _mirror = !_mirror);
|
||||
}
|
||||
|
||||
/// Returns a horizontally mirrored copy of [image] (lossless, axis-aligned).
|
||||
Future<ui.Image> _flippedHorizontally(ui.Image image) {
|
||||
final recorder = ui.PictureRecorder();
|
||||
final canvas = Canvas(recorder);
|
||||
canvas.translate(image.width.toDouble(), 0);
|
||||
canvas.scale(-1, 1);
|
||||
canvas.drawImage(image, Offset.zero, Paint());
|
||||
return recorder.endRecording().toImage(image.width, image.height);
|
||||
}
|
||||
|
||||
/// Composites the current edits into a single full-resolution PNG.
|
||||
Future<Uint8List?> _compose(ui.Image image) async {
|
||||
// 1. Bake strokes onto the full-resolution image (only if there are any).
|
||||
var painted = image;
|
||||
if (_strokes.isNotEmpty) {
|
||||
final recorder = ui.PictureRecorder();
|
||||
final canvas = Canvas(recorder);
|
||||
final size = Size(image.width.toDouble(), image.height.toDouble());
|
||||
canvas.drawImage(image, Offset.zero, Paint());
|
||||
_StrokePainter(
|
||||
strokes: _strokes,
|
||||
sourceRect: Offset.zero & size,
|
||||
).paint(canvas, size);
|
||||
painted = await recorder.endRecording().toImage(
|
||||
image.width,
|
||||
image.height,
|
||||
);
|
||||
}
|
||||
|
||||
// 2. Crop (without rotation — the crop rect lives in the un-rotated frame).
|
||||
final cropped = await CropController.getCroppedBitmap(
|
||||
crop: _cropController.crop,
|
||||
rotation: CropRotation.up,
|
||||
image: painted,
|
||||
);
|
||||
if (!identical(painted, image)) painted.dispose();
|
||||
|
||||
// 3. Mirror, then rotation — both lossless and in the same order as the
|
||||
// on-screen preview (flip inside, rotation outside).
|
||||
var staged = cropped;
|
||||
if (_mirror) {
|
||||
staged = await _flippedHorizontally(cropped);
|
||||
cropped.dispose();
|
||||
}
|
||||
|
||||
final rotation = imageEditorRotationForQuarterTurns(_quarterTurns);
|
||||
var output = staged;
|
||||
if (rotation != CropRotation.up) {
|
||||
output = await CropController.getCroppedBitmap(
|
||||
crop: _fullCrop,
|
||||
rotation: rotation,
|
||||
image: staged,
|
||||
);
|
||||
staged.dispose();
|
||||
}
|
||||
|
||||
// 4. Encode to PNG.
|
||||
final data = await output.toByteData(format: ui.ImageByteFormat.png);
|
||||
output.dispose();
|
||||
return data?.buffer.asUint8List();
|
||||
}
|
||||
|
||||
Future<void> _save() async {
|
||||
if (_saving) return;
|
||||
final navigator = Navigator.of(context);
|
||||
final messenger = ScaffoldMessenger.of(context);
|
||||
final image = _image;
|
||||
// Nothing was changed: keep the original file untouched (pop with null).
|
||||
if (image == null || !_hasEdits) {
|
||||
navigator.pop();
|
||||
return;
|
||||
}
|
||||
setState(() => _saving = true);
|
||||
try {
|
||||
final result = await _compose(image);
|
||||
if (!mounted) return;
|
||||
navigator.pop(result);
|
||||
} catch (e, s) {
|
||||
Logs().w('Unable to save edited image', e, s);
|
||||
if (!mounted) return;
|
||||
setState(() => _saving = false);
|
||||
messenger.showSnackBar(SnackBar(content: Text(e.toString())));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = L10n.of(context);
|
||||
final theme = Theme.of(context);
|
||||
final image = _image;
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(l10n.editImage),
|
||||
actions: [
|
||||
if (_saving)
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: Center(
|
||||
child: SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator.adaptive(strokeWidth: 2),
|
||||
),
|
||||
),
|
||||
)
|
||||
else
|
||||
IconButton(
|
||||
tooltip: l10n.save,
|
||||
icon: const Icon(Icons.check),
|
||||
onPressed: image == null ? null : _save,
|
||||
),
|
||||
],
|
||||
bottom: image == null
|
||||
? null
|
||||
: PreferredSize(
|
||||
preferredSize: const Size.fromHeight(48),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8.0),
|
||||
child: SegmentedButton<_EditMode>(
|
||||
segments: [
|
||||
ButtonSegment(
|
||||
value: _EditMode.crop,
|
||||
icon: const Icon(Icons.crop),
|
||||
label: Text(l10n.crop),
|
||||
),
|
||||
ButtonSegment(
|
||||
value: _EditMode.draw,
|
||||
icon: const Icon(Icons.brush_outlined),
|
||||
label: Text(l10n.draw),
|
||||
),
|
||||
],
|
||||
selected: {_mode},
|
||||
onSelectionChanged: _saving
|
||||
? null
|
||||
: (s) => setState(() {
|
||||
_mode = s.first;
|
||||
// Start each draw session at the un-zoomed fit.
|
||||
// Gesture-state (active stroke, active pointers,
|
||||
// multi-touch lock) lives inside [_DrawSurface] and
|
||||
// is reset automatically because the widget is
|
||||
// recreated whenever the user switches back.
|
||||
_drawTransform.value = Matrix4.identity();
|
||||
}),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
body: _decodeError != null
|
||||
? Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(32.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(Icons.broken_image_outlined, size: 64),
|
||||
const SizedBox(height: 16),
|
||||
Text(l10n.oopsSomethingWentWrong),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: image == null
|
||||
? const Center(child: CircularProgressIndicator.adaptive())
|
||||
: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
// Inset from the screen edges so dragging crop handles or
|
||||
// drawing near the border doesn't trigger the system back-
|
||||
// swipe gesture.
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 20.0,
|
||||
vertical: 12.0,
|
||||
),
|
||||
child: RotatedBox(
|
||||
quarterTurns: _quarterTurns,
|
||||
child: Transform.flip(
|
||||
flipX: _mirror,
|
||||
child: _mode == _EditMode.crop
|
||||
? CropImage(
|
||||
controller: _cropController,
|
||||
// Decode a separate image from the original
|
||||
// bytes for the crop widget. Sharing our
|
||||
// [_image] via UiImageProvider is unsafe: when
|
||||
// CropImage is unmounted (switching to draw),
|
||||
// its Image widget disposes the underlying
|
||||
// ui.Image — which would be our [_image],
|
||||
// breaking draw mode and save.
|
||||
image: Image.memory(widget.bytes),
|
||||
overlayPainter: _strokes.isEmpty
|
||||
? null
|
||||
: _StrokePainter(
|
||||
strokes: _strokes,
|
||||
sourceRect:
|
||||
Offset.zero &
|
||||
Size(
|
||||
image.width.toDouble(),
|
||||
image.height.toDouble(),
|
||||
),
|
||||
),
|
||||
)
|
||||
: _DrawSurface(
|
||||
image: image,
|
||||
cropPx: _cropRectPx(image),
|
||||
strokes: _strokes,
|
||||
color: _color,
|
||||
strokeWidth: _strokeWidth,
|
||||
eraser: _eraser,
|
||||
transformController: _drawTransform,
|
||||
onStrokesChanged: () => setState(() {}),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SafeArea(
|
||||
top: false,
|
||||
child: _mode == _EditMode.crop
|
||||
? Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
IconButton(
|
||||
tooltip: l10n.rotateLeft,
|
||||
icon: const Icon(Icons.rotate_left),
|
||||
onPressed: () => _rotate(-1),
|
||||
),
|
||||
IconButton(
|
||||
tooltip: l10n.rotateRight,
|
||||
icon: const Icon(Icons.rotate_right),
|
||||
onPressed: () => _rotate(1),
|
||||
),
|
||||
IconButton(
|
||||
tooltip: l10n.mirror,
|
||||
isSelected: _mirror,
|
||||
icon: const Icon(Icons.flip),
|
||||
onPressed: _toggleMirror,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
IconButton(
|
||||
tooltip: l10n.draw,
|
||||
isSelected: !_eraser,
|
||||
icon: const Icon(Icons.brush_outlined),
|
||||
selectedIcon: const Icon(Icons.brush),
|
||||
onPressed: () =>
|
||||
setState(() => _eraser = false),
|
||||
),
|
||||
IconButton(
|
||||
tooltip: l10n.eraser,
|
||||
isSelected: _eraser,
|
||||
icon: const Icon(
|
||||
Icons.cleaning_services_outlined,
|
||||
),
|
||||
selectedIcon: const Icon(
|
||||
Icons.cleaning_services,
|
||||
),
|
||||
onPressed: () =>
|
||||
setState(() => _eraser = true),
|
||||
),
|
||||
Expanded(
|
||||
child: Slider(
|
||||
min: 1,
|
||||
max: 30,
|
||||
value: _strokeWidth,
|
||||
onChanged: (v) =>
|
||||
setState(() => _strokeWidth = v),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
tooltip: l10n.undo,
|
||||
icon: const Icon(Icons.undo),
|
||||
onPressed: _strokes.isEmpty
|
||||
? null
|
||||
: () => setState(_strokes.removeLast),
|
||||
),
|
||||
IconButton(
|
||||
tooltip: l10n.clear,
|
||||
icon: const Icon(Icons.delete_outline),
|
||||
onPressed: _strokes.isEmpty
|
||||
? null
|
||||
: () => setState(_strokes.clear),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 48,
|
||||
child: ListView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8.0,
|
||||
),
|
||||
children: [
|
||||
for (final color in _palette)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 4.0,
|
||||
),
|
||||
child: GestureDetector(
|
||||
onTap: () => setState(() {
|
||||
_color = color;
|
||||
_eraser = false;
|
||||
}),
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 32,
|
||||
margin: const EdgeInsets.symmetric(
|
||||
vertical: 8.0,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: color,
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color: !_eraser && _color == color
|
||||
? theme.colorScheme.primary
|
||||
: Colors.grey,
|
||||
width: !_eraser && _color == color
|
||||
? 3
|
||||
: 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Freehand drawing surface with pinch-to-zoom.
|
||||
///
|
||||
/// This is a widget class (not a helper method on the parent state) so it gets
|
||||
/// its own [BuildContext] and its own rebuild boundary — a pointer move only
|
||||
/// invalidates this subtree, not the whole editor page.
|
||||
///
|
||||
/// Persistent editor state (the stroke list, current colour/width/eraser flag,
|
||||
/// zoom transform) lives on the parent and is passed in as props; only the
|
||||
/// pure gesture state (active stroke, currently-down pointers, multi-touch
|
||||
/// lock) lives inside this widget. [onStrokesChanged] is called whenever a
|
||||
/// stroke is added or discarded so the parent can rebuild consumers like the
|
||||
/// undo/clear button enable state and the crop overlay preview.
|
||||
class _DrawSurface extends StatefulWidget {
|
||||
final ui.Image image;
|
||||
final Rect cropPx;
|
||||
final List<_Stroke> strokes;
|
||||
final Color color;
|
||||
final double strokeWidth;
|
||||
final bool eraser;
|
||||
final TransformationController transformController;
|
||||
final VoidCallback onStrokesChanged;
|
||||
|
||||
const _DrawSurface({
|
||||
required this.image,
|
||||
required this.cropPx,
|
||||
required this.strokes,
|
||||
required this.color,
|
||||
required this.strokeWidth,
|
||||
required this.eraser,
|
||||
required this.transformController,
|
||||
required this.onStrokesChanged,
|
||||
});
|
||||
|
||||
@override
|
||||
State<_DrawSurface> createState() => _DrawSurfaceState();
|
||||
}
|
||||
|
||||
class _DrawSurfaceState extends State<_DrawSurface> {
|
||||
/// The stroke the current one-finger gesture is drawing, or null when no
|
||||
/// stroke is active (e.g. during a two-finger zoom). Held by reference so a
|
||||
/// stroke can be fully discarded if the gesture turns into a pinch.
|
||||
_Stroke? _activeStroke;
|
||||
|
||||
/// Currently active (touching) pointer ids on the draw surface.
|
||||
final Set<int> _pointers = {};
|
||||
|
||||
/// True once a second finger has touched, until all fingers lift again. While
|
||||
/// set, drawing is suppressed so a pinch never draws — not at its start and
|
||||
/// not when lifting back down to one finger on release.
|
||||
bool _multiTouch = false;
|
||||
|
||||
/// Removes a lifted pointer. Once all fingers are up, the multi-touch lock is
|
||||
/// released so a fresh single touch can draw again.
|
||||
void _endPointer(int pointer) {
|
||||
_pointers.remove(pointer);
|
||||
if (_pointers.isEmpty) {
|
||||
setState(() {
|
||||
_multiTouch = false;
|
||||
_activeStroke = null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cropPx = widget.cropPx;
|
||||
return Center(
|
||||
child: AspectRatio(
|
||||
aspectRatio: cropPx.width / cropPx.height,
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final size = Size(constraints.maxWidth, constraints.maxHeight);
|
||||
// Map a pointer position (viewport pixels) to source-image pixels,
|
||||
// going through the current zoom transform first.
|
||||
Offset toImagePx(Offset viewportPoint) => imageEditorLocalToImagePx(
|
||||
widget.transformController.toScene(viewportPoint),
|
||||
size,
|
||||
cropPx,
|
||||
);
|
||||
// Drawing is driven from raw pointer events (not InteractiveViewer's
|
||||
// gesture phases) so the real finger count decides draw vs. zoom.
|
||||
// The Listener is passive: it never enters the gesture arena, so
|
||||
// InteractiveViewer below still handles the two-finger pinch.
|
||||
return Listener(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onPointerDown: (e) {
|
||||
_pointers.add(e.pointer);
|
||||
if (_pointers.length >= 2) {
|
||||
// A pinch: this gesture is a zoom. Drop any stroke it started
|
||||
// and block drawing until every finger has lifted again.
|
||||
_multiTouch = true;
|
||||
final active = _activeStroke;
|
||||
if (active != null) {
|
||||
widget.strokes.remove(active);
|
||||
setState(() => _activeStroke = null);
|
||||
widget.onStrokesChanged();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (_multiTouch) return;
|
||||
final stroke = _Stroke(
|
||||
color: widget.color,
|
||||
width: widget.strokeWidth * (cropPx.width / size.width),
|
||||
eraser: widget.eraser,
|
||||
points: [toImagePx(e.localPosition)],
|
||||
);
|
||||
widget.strokes.add(stroke);
|
||||
setState(() => _activeStroke = stroke);
|
||||
widget.onStrokesChanged();
|
||||
},
|
||||
onPointerMove: (e) {
|
||||
final active = _activeStroke;
|
||||
if (active == null || _multiTouch || _pointers.length != 1) {
|
||||
return;
|
||||
}
|
||||
setState(() => active.points.add(toImagePx(e.localPosition)));
|
||||
},
|
||||
onPointerUp: (e) => _endPointer(e.pointer),
|
||||
onPointerCancel: (e) => _endPointer(e.pointer),
|
||||
child: InteractiveViewer(
|
||||
transformationController: widget.transformController,
|
||||
// One finger draws (via the Listener); two fingers pinch-zoom.
|
||||
panEnabled: false,
|
||||
minScale: 1,
|
||||
maxScale: 8,
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
CustomPaint(
|
||||
painter: _CroppedImagePainter(
|
||||
image: widget.image,
|
||||
sourceRect: cropPx,
|
||||
),
|
||||
),
|
||||
CustomPaint(
|
||||
painter: _StrokePainter(
|
||||
strokes: widget.strokes,
|
||||
sourceRect: cropPx,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _Stroke {
|
||||
final Color color;
|
||||
|
||||
/// Stroke width, in source-image pixels.
|
||||
final double width;
|
||||
final bool eraser;
|
||||
|
||||
/// Points, in source-image pixel coordinates.
|
||||
final List<Offset> points;
|
||||
|
||||
_Stroke({
|
||||
required this.color,
|
||||
required this.width,
|
||||
required this.eraser,
|
||||
required this.points,
|
||||
});
|
||||
}
|
||||
|
||||
/// Paints the [sourceRect] region (in image pixels) of [image] to fill the
|
||||
/// canvas. Only repaints when the image or the crop changes, so freehand
|
||||
/// drawing doesn't continuously re-rasterize the background.
|
||||
class _CroppedImagePainter extends CustomPainter {
|
||||
final ui.Image image;
|
||||
final Rect sourceRect;
|
||||
|
||||
const _CroppedImagePainter({required this.image, required this.sourceRect});
|
||||
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
canvas.drawImageRect(
|
||||
image,
|
||||
sourceRect,
|
||||
Offset.zero & size,
|
||||
Paint()..filterQuality = FilterQuality.high,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldRepaint(covariant _CroppedImagePainter oldDelegate) =>
|
||||
oldDelegate.image != image || oldDelegate.sourceRect != sourceRect;
|
||||
}
|
||||
|
||||
/// Paints freehand [strokes] (stored in source-image pixel coordinates) onto a
|
||||
/// canvas that shows the image region [sourceRect] scaled to fill the canvas.
|
||||
class _StrokePainter extends CustomPainter {
|
||||
final List<_Stroke> strokes;
|
||||
final Rect sourceRect;
|
||||
|
||||
const _StrokePainter({required this.strokes, required this.sourceRect});
|
||||
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
if (strokes.isEmpty) return;
|
||||
final scale = size.width / sourceRect.width;
|
||||
// saveLayer so eraser strokes (BlendMode.clear) only erase prior strokes
|
||||
// within this layer, not whatever is painted below it.
|
||||
canvas.saveLayer(Offset.zero & size, Paint());
|
||||
canvas.translate(-sourceRect.left * scale, -sourceRect.top * scale);
|
||||
canvas.scale(scale);
|
||||
for (final stroke in strokes) {
|
||||
if (stroke.points.isEmpty) continue;
|
||||
final paint = Paint()
|
||||
..strokeWidth = stroke.width
|
||||
..strokeCap = StrokeCap.round
|
||||
..strokeJoin = StrokeJoin.round
|
||||
..style = PaintingStyle.stroke;
|
||||
if (stroke.eraser) {
|
||||
paint
|
||||
..color = const Color(0xFF000000)
|
||||
..blendMode = BlendMode.clear;
|
||||
} else {
|
||||
paint.color = stroke.color;
|
||||
}
|
||||
// A single point (a tap) renders as a dot.
|
||||
if (stroke.points.length == 1) {
|
||||
canvas.drawCircle(
|
||||
stroke.points.first,
|
||||
stroke.width / 2,
|
||||
Paint()
|
||||
..color = paint.color
|
||||
..blendMode = paint.blendMode
|
||||
..style = PaintingStyle.fill,
|
||||
);
|
||||
continue;
|
||||
}
|
||||
final path = Path()
|
||||
..moveTo(stroke.points.first.dx, stroke.points.first.dy);
|
||||
for (final p in stroke.points.skip(1)) {
|
||||
path.lineTo(p.dx, p.dy);
|
||||
}
|
||||
canvas.drawPath(path, paint);
|
||||
}
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldRepaint(covariant _StrokePainter oldDelegate) => true;
|
||||
}
|
||||
|
||||
@@ -7,23 +7,6 @@ import 'dart:async';
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:cross_file/cross_file.dart';
|
||||
import 'package:tatchat/config/app_config.dart';
|
||||
import 'package:tatchat/l10n/l10n.dart';
|
||||
import 'package:tatchat/pages/chat_list/chat_list_view.dart';
|
||||
import 'package:tatchat/pages/chat_list/tabs/home_tab.dart';
|
||||
import 'package:tatchat/utils/error_reporter.dart';
|
||||
import 'package:tatchat/utils/localized_exception_extension.dart';
|
||||
import 'package:tatchat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
||||
import 'package:tatchat/utils/matrix_sdk_extensions/room_extension.dart';
|
||||
import 'package:tatchat/utils/platform_infos.dart';
|
||||
import 'package:tatchat/utils/show_scaffold_dialog.dart';
|
||||
import 'package:tatchat/utils/show_update_snackbar.dart';
|
||||
import 'package:tatchat/widgets/adaptive_dialogs/show_modal_action_popup.dart';
|
||||
import 'package:tatchat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
||||
import 'package:tatchat/widgets/adaptive_dialogs/show_text_input_dialog.dart';
|
||||
import 'package:tatchat/widgets/avatar.dart';
|
||||
import 'package:tatchat/widgets/future_loading_dialog.dart';
|
||||
import 'package:tatchat/widgets/share_scaffold_dialog.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_callkit_incoming/entities/entities.dart';
|
||||
import 'package:flutter_callkit_incoming/flutter_callkit_incoming.dart';
|
||||
@@ -33,6 +16,23 @@ import 'package:material_ui/material_ui.dart';
|
||||
import 'package:matrix/matrix.dart' as sdk;
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:receive_sharing_intent/receive_sharing_intent.dart';
|
||||
import 'package:tatchat/config/app_config.dart';
|
||||
import 'package:tatchat/l10n/l10n.dart';
|
||||
import 'package:tatchat/pages/chat_list/chat_list_view.dart';
|
||||
import 'package:tatchat/pages/chat_list/tabs/home_tab.dart';
|
||||
import 'package:tatchat/utils/error_reporter.dart';
|
||||
import 'package:tatchat/utils/localized_exception_extension.dart';
|
||||
import 'package:tatchat/utils/matrix_sdk_extensions/client_presence_extension.dart';
|
||||
import 'package:tatchat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
||||
import 'package:tatchat/utils/matrix_sdk_extensions/room_extension.dart';
|
||||
import 'package:tatchat/utils/platform_infos.dart';
|
||||
import 'package:tatchat/utils/show_scaffold_dialog.dart';
|
||||
import 'package:tatchat/utils/show_update_snackbar.dart';
|
||||
import 'package:tatchat/widgets/adaptive_dialogs/show_modal_action_popup.dart';
|
||||
import 'package:tatchat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
||||
import 'package:tatchat/widgets/adaptive_dialogs/show_text_input_dialog.dart';
|
||||
import 'package:tatchat/widgets/future_loading_dialog.dart';
|
||||
import 'package:tatchat/widgets/share_scaffold_dialog.dart';
|
||||
|
||||
import '../../../utils/account_bundles.dart';
|
||||
import '../../config/setting_keys.dart';
|
||||
@@ -63,11 +63,16 @@ class ChatList extends StatefulWidget {
|
||||
final String? activeSpace;
|
||||
final bool displayNavigationRail;
|
||||
|
||||
/// Whether the navigation sidebar drawer is available (e.g. hidden inside
|
||||
/// the settings column).
|
||||
final bool sideMenuEnabled;
|
||||
|
||||
const ChatList({
|
||||
super.key,
|
||||
required this.activeChat,
|
||||
this.activeSpace,
|
||||
this.displayNavigationRail = false,
|
||||
this.sideMenuEnabled = true,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -76,6 +81,10 @@ class ChatList extends StatefulWidget {
|
||||
|
||||
class ChatListController extends State<ChatList>
|
||||
with TickerProviderStateMixin, RouteAware {
|
||||
/// Scaffold state of the chat list, used to open the navigation sidebar
|
||||
/// (drawer) from the hamburger menus.
|
||||
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
StreamSubscription? _intentDataStreamSubscription;
|
||||
|
||||
StreamSubscription? _intentFileStreamSubscription;
|
||||
@@ -505,21 +514,7 @@ class ChatListController extends State<ChatList>
|
||||
BuildContext posContext, [
|
||||
Room? space,
|
||||
]) async {
|
||||
final overlay =
|
||||
Overlay.of(posContext).context.findRenderObject() as RenderBox;
|
||||
|
||||
final button = posContext.findRenderObject() as RenderBox;
|
||||
|
||||
final position = RelativeRect.fromRect(
|
||||
Rect.fromPoints(
|
||||
button.localToGlobal(const Offset(0, -65), ancestor: overlay),
|
||||
button.localToGlobal(
|
||||
button.size.bottomRight(Offset.zero) + const Offset(-50, 0),
|
||||
ancestor: overlay,
|
||||
),
|
||||
),
|
||||
Offset.zero & overlay.size,
|
||||
);
|
||||
final l10n = L10n.of(posContext);
|
||||
|
||||
final spacesWithPowerLevels = room.client.rooms
|
||||
.where(
|
||||
@@ -530,206 +525,94 @@ class ChatListController extends State<ChatList>
|
||||
)
|
||||
.toList();
|
||||
|
||||
var action = await showMenu<ChatContextAction>(
|
||||
final action = await showModalActionPopup<ChatContextAction>(
|
||||
context: posContext,
|
||||
position: position,
|
||||
items: [
|
||||
cancelLabel: l10n.cancel,
|
||||
actions: [
|
||||
if (space != null)
|
||||
PopupMenuItem(
|
||||
AdaptiveModalAction(
|
||||
value: ChatContextAction.goToSpace,
|
||||
child: Row(
|
||||
mainAxisSize: .min,
|
||||
children: [
|
||||
Avatar(
|
||||
mxContent: space.avatar,
|
||||
size: Avatar.defaultSize / 2,
|
||||
name: space.getLocalizedDisplayname(),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
L10n.of(context).goToSpace(space.getLocalizedDisplayname()),
|
||||
),
|
||||
],
|
||||
),
|
||||
label: l10n.goToSpace(space.getLocalizedDisplayname()),
|
||||
icon: const Icon(Icons.workspaces_outlined),
|
||||
),
|
||||
if (room.membership == Membership.join) ...[
|
||||
PopupMenuItem(
|
||||
AdaptiveModalAction(
|
||||
value: ChatContextAction.mute,
|
||||
child: Row(
|
||||
mainAxisSize: .min,
|
||||
children: [
|
||||
Icon(
|
||||
room.pushRuleState == PushRuleState.notify
|
||||
? Icons.notifications_off_outlined
|
||||
: Icons.notifications_off,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
room.pushRuleState == PushRuleState.notify
|
||||
? L10n.of(context).muteChat
|
||||
: L10n.of(context).unmuteChat,
|
||||
),
|
||||
],
|
||||
label: room.pushRuleState == PushRuleState.notify
|
||||
? l10n.muteChat
|
||||
: l10n.unmuteChat,
|
||||
icon: Icon(
|
||||
room.pushRuleState == PushRuleState.notify
|
||||
? Icons.notifications_off_outlined
|
||||
: Icons.notifications_off,
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
AdaptiveModalAction(
|
||||
value: ChatContextAction.markUnread,
|
||||
child: Row(
|
||||
mainAxisSize: .min,
|
||||
children: [
|
||||
Icon(
|
||||
room.markedUnread
|
||||
? Icons.mark_as_unread
|
||||
: Icons.mark_as_unread_outlined,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
room.markedUnread
|
||||
? L10n.of(context).markAsRead
|
||||
: L10n.of(context).markAsUnread,
|
||||
),
|
||||
],
|
||||
label: room.markedUnread ? l10n.markAsRead : l10n.markAsUnread,
|
||||
icon: Icon(
|
||||
room.markedUnread
|
||||
? Icons.mark_as_unread
|
||||
: Icons.mark_as_unread_outlined,
|
||||
),
|
||||
),
|
||||
if (!room.isLowPriority)
|
||||
PopupMenuItem(
|
||||
AdaptiveModalAction(
|
||||
value: ChatContextAction.favorite,
|
||||
child: Row(
|
||||
mainAxisSize: .min,
|
||||
children: [
|
||||
Icon(
|
||||
room.isFavourite ? Icons.push_pin : Icons.push_pin_outlined,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
room.isFavourite
|
||||
? L10n.of(context).unpin
|
||||
: L10n.of(context).pin,
|
||||
),
|
||||
],
|
||||
label: room.isFavourite ? l10n.unpin : l10n.pin,
|
||||
icon: Icon(
|
||||
room.isFavourite ? Icons.push_pin : Icons.push_pin_outlined,
|
||||
),
|
||||
),
|
||||
if (!room.isFavourite)
|
||||
AdaptiveModalAction(
|
||||
value: ChatContextAction.lowPriority,
|
||||
label: room.isLowPriority
|
||||
? l10n.unsetLowPriority
|
||||
: l10n.setLowPriority,
|
||||
icon: Icon(
|
||||
room.isLowPriority
|
||||
? Icons.low_priority
|
||||
: Icons.low_priority_outlined,
|
||||
),
|
||||
),
|
||||
if (activeTag == null)
|
||||
AdaptiveModalAction(
|
||||
value: ChatContextAction.addTag,
|
||||
label: l10n.addTag,
|
||||
icon: const Icon(Icons.bookmark_add_outlined),
|
||||
)
|
||||
else
|
||||
AdaptiveModalAction(
|
||||
value: ChatContextAction.removeTag,
|
||||
label: l10n.removeTag,
|
||||
icon: const Icon(Icons.bookmark_remove_outlined),
|
||||
),
|
||||
if (spacesWithPowerLevels.isNotEmpty)
|
||||
AdaptiveModalAction(
|
||||
value: ChatContextAction.addToSpace,
|
||||
label: l10n.addToSpace,
|
||||
icon: const Icon(Icons.group_work_outlined),
|
||||
),
|
||||
],
|
||||
PopupMenuItem(
|
||||
AdaptiveModalAction(
|
||||
value: ChatContextAction.leave,
|
||||
child: Row(
|
||||
mainAxisSize: .min,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.delete_outlined,
|
||||
color: Theme.of(context).colorScheme.onErrorContainer,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
room.membership == Membership.invite
|
||||
? L10n.of(context).delete
|
||||
: L10n.of(context).leave,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onErrorContainer,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
label: room.membership == Membership.invite
|
||||
? l10n.delete
|
||||
: l10n.leave,
|
||||
icon: const Icon(Icons.delete_outlined),
|
||||
isDestructive: true,
|
||||
),
|
||||
if (room.membership == Membership.invite)
|
||||
PopupMenuItem(
|
||||
AdaptiveModalAction(
|
||||
value: ChatContextAction.block,
|
||||
child: Row(
|
||||
mainAxisSize: .min,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.block_outlined,
|
||||
color: Theme.of(context).colorScheme.onErrorContainer,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
L10n.of(context).block,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onErrorContainer,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (room.membership == Membership.join)
|
||||
PopupMenuItem(
|
||||
value: ChatContextAction.showMore,
|
||||
child: Row(
|
||||
mainAxisSize: .min,
|
||||
children: [
|
||||
Icon(Icons.adaptive.more_outlined),
|
||||
const SizedBox(width: 12),
|
||||
Text(L10n.of(context).more),
|
||||
],
|
||||
),
|
||||
label: l10n.block,
|
||||
icon: const Icon(Icons.block_outlined),
|
||||
isDestructive: true,
|
||||
),
|
||||
],
|
||||
);
|
||||
if (!posContext.mounted || !mounted) return;
|
||||
if (action == ChatContextAction.showMore) {
|
||||
action = await showMenu<ChatContextAction>(
|
||||
context: posContext,
|
||||
position: position,
|
||||
items: [
|
||||
if (!room.isFavourite)
|
||||
PopupMenuItem(
|
||||
value: ChatContextAction.lowPriority,
|
||||
child: Row(
|
||||
mainAxisSize: .min,
|
||||
children: [
|
||||
Icon(
|
||||
room.isLowPriority
|
||||
? Icons.low_priority
|
||||
: Icons.low_priority_outlined,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
room.isLowPriority
|
||||
? L10n.of(context).unsetLowPriority
|
||||
: L10n.of(context).setLowPriority,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (activeTag == null)
|
||||
PopupMenuItem(
|
||||
value: ChatContextAction.addTag,
|
||||
child: Row(
|
||||
mainAxisSize: .min,
|
||||
children: [
|
||||
Icon(Icons.bookmark_add_outlined),
|
||||
const SizedBox(width: 12),
|
||||
Text(L10n.of(context).addTag),
|
||||
],
|
||||
),
|
||||
)
|
||||
else
|
||||
PopupMenuItem(
|
||||
value: ChatContextAction.removeTag,
|
||||
child: Row(
|
||||
mainAxisSize: .min,
|
||||
children: [
|
||||
Icon(Icons.bookmark_remove_outlined),
|
||||
const SizedBox(width: 12),
|
||||
Text(L10n.of(context).removeTag),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (spacesWithPowerLevels.isNotEmpty)
|
||||
PopupMenuItem(
|
||||
value: ChatContextAction.addToSpace,
|
||||
child: Row(
|
||||
mainAxisSize: .min,
|
||||
children: [
|
||||
const Icon(Icons.group_work_outlined),
|
||||
const SizedBox(width: 12),
|
||||
Text(L10n.of(context).addToSpace),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
if (action == null) return;
|
||||
if (!mounted) return;
|
||||
@@ -856,8 +739,6 @@ class ChatListController extends State<ChatList>
|
||||
future: () => room.removeTag(activeTag!),
|
||||
);
|
||||
return;
|
||||
case ChatContextAction.showMore:
|
||||
throw ('Should not be handled!');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -900,11 +781,7 @@ class ChatListController extends State<ChatList>
|
||||
if (!mounted) return;
|
||||
await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => client.setPresence(
|
||||
client.userID!,
|
||||
PresenceType.online,
|
||||
statusMsg: input,
|
||||
),
|
||||
future: () => client.setStatusMessage(input),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1109,7 +986,8 @@ class ChatListController extends State<ChatList>
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => ChatListView(this);
|
||||
Widget build(BuildContext context) =>
|
||||
ChatListView(this, sideMenuEnabled: widget.sideMenuEnabled);
|
||||
|
||||
Future<void> dehydrate() => Matrix.of(context).dehydrateAction(context);
|
||||
}
|
||||
@@ -1127,5 +1005,4 @@ enum ChatContextAction {
|
||||
leave,
|
||||
addToSpace,
|
||||
block,
|
||||
showMore,
|
||||
}
|
||||
|
||||
@@ -73,10 +73,15 @@ class ChatListItem extends StatelessWidget {
|
||||
final space = this.space;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
child: Material(
|
||||
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
||||
side: BorderSide(
|
||||
color: theme.colorScheme.surfaceContainer,
|
||||
width: 1.5,
|
||||
),
|
||||
), clipBehavior: Clip.hardEdge,
|
||||
color: backgroundColor,
|
||||
child: FutureBuilder(
|
||||
future: room.name.isEmpty ? room.loadHeroUsers() : null,
|
||||
|
||||
@@ -15,11 +15,16 @@ import 'package:tatchat/pages/chat_list/tabs/murals_tab.dart';
|
||||
import 'package:tatchat/pages/chat_list/tabs/spaces_tab.dart';
|
||||
|
||||
import 'chat_list_body.dart';
|
||||
import 'sidebar.dart';
|
||||
|
||||
class ChatListView extends StatelessWidget {
|
||||
final ChatListController controller;
|
||||
|
||||
const ChatListView(this.controller, {super.key});
|
||||
/// Whether the navigation sidebar (drawer) is available, e.g. hidden inside
|
||||
/// the settings column.
|
||||
final bool sideMenuEnabled;
|
||||
|
||||
const ChatListView(this.controller, {super.key, this.sideMenuEnabled = true});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -45,9 +50,24 @@ class ChatListView extends StatelessWidget {
|
||||
ChatTopTabBar(
|
||||
currentTab: homeTab,
|
||||
onTabSelected: controller.setHomeTab,
|
||||
onMenuPressed: sideMenuEnabled
|
||||
? () => controller.scaffoldKey.currentState?.openDrawer()
|
||||
: null,
|
||||
),
|
||||
Expanded(
|
||||
child: Scaffold(
|
||||
key: controller.scaffoldKey,
|
||||
drawer: sideMenuEnabled
|
||||
? Drawer(
|
||||
width: FluffyThemes.sidebarWidth,
|
||||
child: Sidebar(controller),
|
||||
)
|
||||
: null,
|
||||
// Avoid accidentally opening the drawer when swiping at the
|
||||
// edge of the chat column.
|
||||
drawerEdgeDragWidth: isColumnMode || !sideMenuEnabled
|
||||
? 0
|
||||
: null,
|
||||
body: SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
@@ -74,7 +94,7 @@ class ChatListView extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
floatingActionButton: !controller.isSearchMode && !isColumnMode
|
||||
floatingActionButton: !controller.isSearchMode
|
||||
? const StartChatFab()
|
||||
: const SizedBox.shrink(),
|
||||
bottomNavigationBar: isColumnMode
|
||||
|
||||
@@ -4,238 +4,46 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import 'package:async/async.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
import 'package:matrix/matrix.dart' hide Result;
|
||||
import 'package:tatchat/l10n/l10n.dart';
|
||||
import 'package:tatchat/widgets/avatar.dart';
|
||||
import 'package:tatchat/widgets/matrix.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
import 'package:matrix/matrix.dart' hide Result;
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
import 'package:tatchat/widgets/self_profile_dialog.dart';
|
||||
|
||||
import 'package:tatchat/utils/tatu_share.dart';
|
||||
import 'chat_list.dart';
|
||||
|
||||
/// The header avatar of the active account. Tapping it opens the own profile
|
||||
/// dialog. Account switching and the former avatar popup actions live in the
|
||||
/// navigation drawer (Sidebar).
|
||||
class ClientChooserButton extends StatelessWidget {
|
||||
final ChatListController controller;
|
||||
|
||||
const ClientChooserButton(this.controller, {super.key});
|
||||
|
||||
List<PopupMenuEntry<Object>> _bundleMenuItems(BuildContext context) {
|
||||
final matrix = Matrix.of(context);
|
||||
final bundles = matrix.accountBundles.keys.toList()
|
||||
..sort(
|
||||
(a, b) => a!.isValidMatrixIdStrict() == b!.isValidMatrixIdStrict()
|
||||
? 0
|
||||
: a.isValidMatrixIdStrict() && !b.isValidMatrixIdStrict()
|
||||
? -1
|
||||
: 1,
|
||||
);
|
||||
return <PopupMenuEntry<Object>>[
|
||||
PopupMenuItem(
|
||||
value: SettingsAction.newGroup,
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.group_add_outlined),
|
||||
const SizedBox(width: 18),
|
||||
Text(L10n.of(context).createGroup),
|
||||
],
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: SettingsAction.setStatus,
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.edit_outlined),
|
||||
const SizedBox(width: 18),
|
||||
Text(L10n.of(context).setStatus),
|
||||
],
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: SettingsAction.invite,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.adaptive.share_outlined),
|
||||
const SizedBox(width: 18),
|
||||
Text(L10n.of(context).inviteContact),
|
||||
],
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: SettingsAction.archive,
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.archive_outlined),
|
||||
const SizedBox(width: 18),
|
||||
Text(L10n.of(context).archive),
|
||||
],
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: SettingsAction.settings,
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.settings_outlined),
|
||||
const SizedBox(width: 18),
|
||||
Text(L10n.of(context).settings),
|
||||
],
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: SettingsAction.support,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.favorite, color: Colors.red),
|
||||
const SizedBox(width: 18),
|
||||
Text(L10n.of(context).supportFluffyChat),
|
||||
],
|
||||
),
|
||||
),
|
||||
const PopupMenuDivider(),
|
||||
for (final bundle in bundles) ...[
|
||||
if (matrix.accountBundles[bundle]!.length != 1 ||
|
||||
matrix.accountBundles[bundle]!.single!.userID != bundle)
|
||||
PopupMenuItem(
|
||||
value: null,
|
||||
child: Column(
|
||||
crossAxisAlignment: .start,
|
||||
mainAxisSize: .min,
|
||||
children: [
|
||||
Text(
|
||||
bundle!,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).textTheme.titleMedium!.color,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
],
|
||||
),
|
||||
),
|
||||
...matrix.accountBundles[bundle]!
|
||||
.whereType<Client>()
|
||||
.where((client) => client.isLogged())
|
||||
.map(
|
||||
(client) => PopupMenuItem(
|
||||
value: client,
|
||||
child: FutureBuilder<Profile?>(
|
||||
future: client.fetchOwnProfile(),
|
||||
builder: (context, snapshot) {
|
||||
final displayname =
|
||||
snapshot.data?.displayName ?? client.userID!.localpart!;
|
||||
return Row(
|
||||
key: ValueKey('switch_account_$displayname'),
|
||||
children: [
|
||||
Avatar(
|
||||
mxContent: snapshot.data?.avatarUrl,
|
||||
name: displayname,
|
||||
size: 32,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Text(
|
||||
displayname,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.edit_outlined),
|
||||
onPressed: () => controller.editBundlesForAccount(
|
||||
client.userID,
|
||||
bundle,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
PopupMenuItem(
|
||||
value: SettingsAction.addAccount,
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.person_add_outlined),
|
||||
const SizedBox(width: 18),
|
||||
Text(L10n.of(context).addAccount),
|
||||
],
|
||||
),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final matrix = Matrix.of(context);
|
||||
final client = Result(() => matrix.client).asValue?.value;
|
||||
|
||||
var clientCount = 0;
|
||||
matrix.accountBundles.forEach((key, value) => clientCount += value.length);
|
||||
return FutureBuilder<Profile>(
|
||||
future: client?.isLogged() == true ? client?.fetchOwnProfile() : null,
|
||||
builder: (context, snapshot) => Material(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
borderRadius: BorderRadius.circular(99),
|
||||
color: Colors.transparent,
|
||||
child: PopupMenuButton<Object>(
|
||||
key: Key('accounts_and_settings_buttons'),
|
||||
tooltip: L10n.of(context).accountsAndSettings,
|
||||
onSelected: (o) => _clientSelected(o, context),
|
||||
itemBuilder: _bundleMenuItems,
|
||||
icon: Avatar(
|
||||
mxContent: snapshot.data?.avatarUrl,
|
||||
name: snapshot.data?.displayName ?? client?.userID?.localpart,
|
||||
size: 32,
|
||||
child: Tooltip(
|
||||
message: L10n.of(context).accountsAndSettings,
|
||||
child: InkWell(
|
||||
key: const Key('accounts_and_settings_buttons'),
|
||||
onTap: () => showSelfProfileDialog(context),
|
||||
child: Avatar(
|
||||
mxContent: snapshot.data?.avatarUrl,
|
||||
name: snapshot.data?.displayName ?? client?.userID?.localpart,
|
||||
size: 32,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _clientSelected(Object object, BuildContext context) async {
|
||||
if (object is Client) {
|
||||
controller.setActiveClient(object);
|
||||
} else if (object is String) {
|
||||
controller.setActiveBundle(object);
|
||||
} else if (object is SettingsAction) {
|
||||
switch (object) {
|
||||
case SettingsAction.addAccount:
|
||||
if (!context.mounted) return;
|
||||
context.go('/rooms/settings/addaccount');
|
||||
break;
|
||||
case SettingsAction.newGroup:
|
||||
context.go('/rooms/newgroup');
|
||||
break;
|
||||
case SettingsAction.invite:
|
||||
TatuShare.shareInviteLink(context);
|
||||
break;
|
||||
case SettingsAction.support:
|
||||
launchUrlString(
|
||||
'https://ko-fi.com/post/How-can-I-support-FluffyChat-J2G325WE6I',
|
||||
);
|
||||
break;
|
||||
case SettingsAction.settings:
|
||||
context.go('/rooms/settings');
|
||||
break;
|
||||
case SettingsAction.archive:
|
||||
context.go('/rooms/archive');
|
||||
break;
|
||||
case SettingsAction.setStatus:
|
||||
controller.setStatus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum SettingsAction {
|
||||
addAccount,
|
||||
newGroup,
|
||||
setStatus,
|
||||
invite,
|
||||
support,
|
||||
settings,
|
||||
archive,
|
||||
}
|
||||
|
||||
184
lib/pages/chat_list/mural_list_item.dart
Normal file
@@ -0,0 +1,184 @@
|
||||
// SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:tatchat/config/app_config.dart';
|
||||
import 'package:tatchat/l10n/l10n.dart';
|
||||
import 'package:tatchat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
||||
import 'package:tatchat/widgets/avatar.dart';
|
||||
|
||||
/// A row that represents a mural in the murals list.
|
||||
///
|
||||
/// The first line shows the circular avatar, the mural name, the creator and
|
||||
/// the number of subscribers. The second line is reserved for the description.
|
||||
/// All colors are taken from the app theme, mirroring the regular chat list
|
||||
/// rows.
|
||||
class MuralListItem extends StatelessWidget {
|
||||
final Room room;
|
||||
final bool activeChat;
|
||||
final void Function() onTap;
|
||||
final void Function(BuildContext context)? onLongPress;
|
||||
final Uri? displayAvatar;
|
||||
final String? displayAvatarName;
|
||||
final String? description;
|
||||
final String? creatorName;
|
||||
|
||||
const MuralListItem(
|
||||
this.room, {
|
||||
this.activeChat = false,
|
||||
required this.onTap,
|
||||
this.onLongPress,
|
||||
this.displayAvatar,
|
||||
this.displayAvatarName,
|
||||
this.description,
|
||||
this.creatorName,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final l10n = L10n.of(context);
|
||||
final displayname = room.getLocalizedDisplayname(MatrixLocals(l10n));
|
||||
final isMuted = room.pushRuleState != PushRuleState.notify;
|
||||
final backgroundColor = activeChat
|
||||
? theme.colorScheme.secondaryContainer
|
||||
: theme.colorScheme.surface;
|
||||
final description = this.description;
|
||||
final creatorName = this.creatorName;
|
||||
final followers = room.summary.mJoinedMemberCount ?? 0;
|
||||
final mutedStyle = theme.textTheme.bodySmall?.copyWith(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
);
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
child: Material(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
||||
side: BorderSide(
|
||||
color: theme.colorScheme.surfaceContainer,
|
||||
width: 1.5,
|
||||
),
|
||||
),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
color: backgroundColor,
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
onLongPress: onLongPress == null
|
||||
? null
|
||||
: () => onLongPress?.call(context),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Avatar(
|
||||
mxContent: displayAvatar ?? room.avatar,
|
||||
name: displayAvatarName ?? displayname,
|
||||
size: Avatar.defaultSize,
|
||||
shapeBorder: const CircleBorder(),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Text(
|
||||
displayname,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (isMuted)
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(left: 4),
|
||||
child: Icon(
|
||||
Icons.notifications_off_outlined,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
if (room.isFavourite)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 4),
|
||||
child: Icon(
|
||||
Icons.push_pin,
|
||||
size: 16,
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
if (creatorName != null &&
|
||||
creatorName.isNotEmpty) ...[
|
||||
// const SizedBox(width: 12),
|
||||
Flexible(
|
||||
flex: 1,
|
||||
child: Text(
|
||||
'${l10n.by} $creatorName',
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: mutedStyle?.copyWith(
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
const Spacer(),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.group_outlined,
|
||||
size: 16,
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
const SizedBox(width: 2),
|
||||
Text(
|
||||
l10n.countFollowers(followers),
|
||||
style: mutedStyle,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (description != null && description.isNotEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: Text(
|
||||
description,
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -4,11 +4,10 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import 'package:badges/badges.dart';
|
||||
import 'package:tatchat/config/app_config.dart';
|
||||
import 'package:tatchat/widgets/hover_builder.dart';
|
||||
import 'package:tatchat/widgets/unread_rooms_badge.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:tatchat/widgets/hover_builder.dart';
|
||||
import 'package:tatchat/widgets/unread_rooms_badge.dart';
|
||||
|
||||
import '../../config/themes.dart';
|
||||
|
||||
@@ -33,7 +32,7 @@ class NaviRailItem extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
|
||||
final borderRadius = BorderRadius.circular(AppConfig.borderRadius);
|
||||
final borderRadius = BorderRadius.circular(1000);
|
||||
final icon = isSelected ? selectedIcon ?? this.icon : this.icon;
|
||||
final unreadBadgeFilter = this.unreadBadgeFilter;
|
||||
return HoverBuilder(
|
||||
@@ -73,7 +72,7 @@ class NaviRailItem extends StatelessWidget {
|
||||
borderRadius: borderRadius,
|
||||
color: isSelected
|
||||
? theme.colorScheme.secondaryContainer
|
||||
: Colors.transparent,
|
||||
: theme.colorScheme.surfaceContainerHighest,
|
||||
child: Tooltip(
|
||||
message: toolTip,
|
||||
child: InkWell(
|
||||
|
||||
309
lib/pages/chat_list/sidebar.dart
Normal file
@@ -0,0 +1,309 @@
|
||||
// SPDX-FileCopyrightText: 2019-Present Christian Kußowski
|
||||
// SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
import 'package:matrix/matrix.dart' hide Result;
|
||||
import 'package:tatchat/config/themes.dart';
|
||||
import 'package:tatchat/l10n/l10n.dart';
|
||||
import 'package:tatchat/utils/tatu_share.dart';
|
||||
import 'package:tatchat/widgets/avatar.dart';
|
||||
import 'package:tatchat/widgets/matrix.dart';
|
||||
|
||||
import 'chat_list.dart';
|
||||
|
||||
/// Left navigation sidebar shown in column mode. It hosts the actions that
|
||||
/// used to live in the avatar popup menu plus the account switcher.
|
||||
class Sidebar extends StatelessWidget {
|
||||
final ChatListController controller;
|
||||
|
||||
const Sidebar(this.controller, {super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
return Material(
|
||||
color: theme.colorScheme.surface,
|
||||
child: SafeArea(
|
||||
bottom: false,
|
||||
child: SizedBox(
|
||||
width: FluffyThemes.sidebarWidth,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 4,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
ColorFiltered(
|
||||
colorFilter: ColorFilter.mode(
|
||||
theme.colorScheme.primary,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
child: Image.asset(
|
||||
'./assets/logo/mini/logo_mini.png',
|
||||
width: 58,
|
||||
height: 58,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Text(
|
||||
'TatuChat',
|
||||
style: theme.textTheme.titleLarge?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: theme.colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
IconButton(
|
||||
tooltip: L10n.of(context).close,
|
||||
icon: const Icon(Icons.close),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Divider(color: theme.colorScheme.outlineVariant, height: 1),
|
||||
Expanded(child: _AccountSection(controller)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _AccountSection extends StatelessWidget {
|
||||
final ChatListController controller;
|
||||
|
||||
const _AccountSection(this.controller);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final matrix = Matrix.of(context);
|
||||
final bundles = matrix.accountBundles;
|
||||
return ListView(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 8),
|
||||
children: [
|
||||
_ActionTile(
|
||||
icon: Icons.group_add_outlined,
|
||||
label: L10n.of(context).createGroup,
|
||||
onTap: () => context.go('/rooms/newgroup'),
|
||||
),
|
||||
_ActionTile(
|
||||
icon: Icons.edit_outlined,
|
||||
label: L10n.of(context).setStatus,
|
||||
onTap: controller.setStatus,
|
||||
),
|
||||
_ActionTile(
|
||||
icon: Icons.adaptive.share_outlined,
|
||||
label: L10n.of(context).inviteContact,
|
||||
onTap: () => TatuShare.shareInviteLink(context),
|
||||
),
|
||||
_ActionTile(
|
||||
icon: Icons.archive_outlined,
|
||||
label: L10n.of(context).archive,
|
||||
onTap: () => context.go('/rooms/archive'),
|
||||
),
|
||||
_ActionTile(
|
||||
icon: Icons.apps_outlined,
|
||||
label: L10n.of(context).apps,
|
||||
onTap: () => context.go('/rooms/apps'),
|
||||
),
|
||||
_ActionTile(
|
||||
icon: Icons.settings_outlined,
|
||||
label: L10n.of(context).settings,
|
||||
onTap: () => context.go('/rooms/settings'),
|
||||
),
|
||||
const Divider(),
|
||||
for (final bundle in bundles.keys) ...[
|
||||
if (bundles[bundle]!.length != 1 ||
|
||||
bundles[bundle]!.single!.userID != bundle)
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(12, 12, 12, 4),
|
||||
child: Text(
|
||||
bundle!,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
...bundles[bundle]!
|
||||
.whereType<Client>()
|
||||
.where((client) => client.isLogged())
|
||||
.map(
|
||||
(client) => _AccountTile(
|
||||
client: client,
|
||||
controller: controller,
|
||||
bundle: bundle,
|
||||
),
|
||||
),
|
||||
],
|
||||
_AddAccountTile(onTap: () => context.go('/rooms/settings/addaccount')),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _ActionTile extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final Color? iconColor;
|
||||
final String label;
|
||||
final VoidCallback onTap;
|
||||
|
||||
const _ActionTile({
|
||||
required this.icon,
|
||||
this.iconColor,
|
||||
required this.label,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
icon,
|
||||
size: 22,
|
||||
color: iconColor ?? theme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Text(
|
||||
label,
|
||||
style: theme.textTheme.bodyLarge?.copyWith(
|
||||
color: theme.colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _AccountTile extends StatelessWidget {
|
||||
final Client client;
|
||||
final ChatListController controller;
|
||||
final String? bundle;
|
||||
|
||||
const _AccountTile({
|
||||
required this.client,
|
||||
required this.controller,
|
||||
required this.bundle,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final matrix = Matrix.of(context);
|
||||
final isActive = client == matrix.client;
|
||||
return FutureBuilder<Profile?>(
|
||||
future: client.fetchOwnProfile(),
|
||||
builder: (context, snapshot) {
|
||||
final displayname =
|
||||
snapshot.data?.displayName ?? client.userID?.localpart ?? '';
|
||||
return InkWell(
|
||||
onTap: () => controller.setActiveClient(client),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Container(
|
||||
margin: const EdgeInsets.symmetric(vertical: 2),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: isActive
|
||||
? theme.colorScheme.primary.withValues(alpha: 0.08)
|
||||
: null,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Avatar(
|
||||
mxContent: snapshot.data?.avatarUrl,
|
||||
name: displayname,
|
||||
size: 30,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Text(
|
||||
displayname,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
color: theme.colorScheme.onSurface,
|
||||
fontWeight: isActive ? FontWeight.w600 : null,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
SizedBox(
|
||||
width: 32,
|
||||
height: 32,
|
||||
child: isActive
|
||||
? Icon(
|
||||
Icons.check_circle,
|
||||
size: 20,
|
||||
color: theme.colorScheme.primary,
|
||||
)
|
||||
: IconButton(
|
||||
icon: const Icon(Icons.edit_outlined, size: 18),
|
||||
tooltip: L10n.of(context).editBundlesForAccount,
|
||||
onPressed: () => controller.editBundlesForAccount(
|
||||
client.userID,
|
||||
bundle,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _AddAccountTile extends StatelessWidget {
|
||||
final VoidCallback onTap;
|
||||
|
||||
const _AddAccountTile({required this.onTap});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.person_add_outlined,
|
||||
size: 22,
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Text(
|
||||
L10n.of(context).addAccount,
|
||||
style: theme.textTheme.bodyLarge?.copyWith(
|
||||
color: theme.colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import 'package:tatchat/utils/matrix_sdk_extensions/room_extension.dart';
|
||||
import 'package:tatchat/utils/stream_extension.dart';
|
||||
import 'package:tatchat/utils/string_color.dart';
|
||||
import 'package:tatchat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
||||
import 'package:tatchat/widgets/adaptive_dialogs/show_modal_action_popup.dart';
|
||||
import 'package:tatchat/widgets/avatar.dart';
|
||||
import 'package:tatchat/widgets/future_loading_dialog.dart';
|
||||
import 'package:tatchat/widgets/hover_builder.dart';
|
||||
@@ -219,108 +220,50 @@ class _SpaceViewState extends State<SpaceView> {
|
||||
final space = client.getRoomById(widget.spaceId);
|
||||
final room = client.getRoomById(roomId);
|
||||
if (space == null) return;
|
||||
final overlay =
|
||||
Overlay.of(posContext).context.findRenderObject() as RenderBox;
|
||||
final l10n = L10n.of(posContext);
|
||||
|
||||
final button = posContext.findRenderObject() as RenderBox;
|
||||
|
||||
final position = RelativeRect.fromRect(
|
||||
Rect.fromPoints(
|
||||
button.localToGlobal(const Offset(0, -65), ancestor: overlay),
|
||||
button.localToGlobal(
|
||||
button.size.bottomRight(Offset.zero) + const Offset(-50, 0),
|
||||
ancestor: overlay,
|
||||
),
|
||||
),
|
||||
Offset.zero & overlay.size,
|
||||
);
|
||||
|
||||
final action = await showMenu<SpaceChildAction>(
|
||||
final action = await showModalActionPopup<SpaceChildAction>(
|
||||
context: posContext,
|
||||
position: position,
|
||||
items: [
|
||||
cancelLabel: l10n.cancel,
|
||||
actions: [
|
||||
if (room != null && room.membership == Membership.join) ...[
|
||||
PopupMenuItem(
|
||||
AdaptiveModalAction(
|
||||
value: room.pushRuleState == PushRuleState.notify
|
||||
? SpaceChildAction.mute
|
||||
: SpaceChildAction.unmute,
|
||||
child: Row(
|
||||
mainAxisSize: .min,
|
||||
children: [
|
||||
Icon(
|
||||
room.pushRuleState == PushRuleState.notify
|
||||
? Icons.notifications_off_outlined
|
||||
: Icons.notifications_on_outlined,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
room.pushRuleState == PushRuleState.notify
|
||||
? L10n.of(context).muteChat
|
||||
: L10n.of(context).unmuteChat,
|
||||
),
|
||||
],
|
||||
label: room.pushRuleState == PushRuleState.notify
|
||||
? l10n.muteChat
|
||||
: l10n.unmuteChat,
|
||||
icon: Icon(
|
||||
room.pushRuleState == PushRuleState.notify
|
||||
? Icons.notifications_off_outlined
|
||||
: Icons.notifications_on_outlined,
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
AdaptiveModalAction(
|
||||
value: room.markedUnread
|
||||
? SpaceChildAction.markAsRead
|
||||
: SpaceChildAction.markAsUnread,
|
||||
child: Row(
|
||||
mainAxisSize: .min,
|
||||
children: [
|
||||
Icon(
|
||||
room.markedUnread
|
||||
? Icons.mark_as_unread
|
||||
: Icons.mark_as_unread_outlined,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
room.isUnread
|
||||
? L10n.of(context).markAsRead
|
||||
: L10n.of(context).markAsUnread,
|
||||
),
|
||||
],
|
||||
label: room.isUnread ? l10n.markAsRead : l10n.markAsUnread,
|
||||
icon: Icon(
|
||||
room.markedUnread
|
||||
? Icons.mark_as_unread
|
||||
: Icons.mark_as_unread_outlined,
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
AdaptiveModalAction(
|
||||
value: SpaceChildAction.leave,
|
||||
child: Row(
|
||||
mainAxisSize: .min,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.delete_outlined,
|
||||
color: Theme.of(context).colorScheme.onErrorContainer,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
L10n.of(context).leave,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onErrorContainer,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
label: l10n.leave,
|
||||
icon: const Icon(Icons.delete_outlined),
|
||||
isDestructive: true,
|
||||
),
|
||||
],
|
||||
if (space.canChangeStateEvent(EventTypes.SpaceChild) == true)
|
||||
PopupMenuItem(
|
||||
AdaptiveModalAction(
|
||||
value: SpaceChildAction.removeFromSpace,
|
||||
child: Row(
|
||||
mainAxisSize: .min,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.remove,
|
||||
color: Theme.of(context).colorScheme.onErrorContainer,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
L10n.of(context).removeFromSpace,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onErrorContainer,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
label: l10n.removeFromSpace,
|
||||
icon: const Icon(Icons.remove),
|
||||
isDestructive: true,
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -432,71 +375,43 @@ class _SpaceViewState extends State<SpaceView> {
|
||||
theme.colorScheme.onPrimaryContainer,
|
||||
),
|
||||
),
|
||||
suffixIcon: PopupMenuButton<SpaceActions>(
|
||||
icon: Avatar(
|
||||
size: avatarSize,
|
||||
mxContent: room.avatar,
|
||||
name: displayname,
|
||||
shapeBorder: RoundedSuperellipseBorder(
|
||||
side: BorderSide(
|
||||
width: 1,
|
||||
color: theme.dividerColor,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppConfig.spaceBorderRadius,
|
||||
),
|
||||
),
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppConfig.spaceBorderRadius,
|
||||
),
|
||||
),
|
||||
useRootNavigator: true,
|
||||
onSelected: _onSpaceAction,
|
||||
itemBuilder: (context) => [
|
||||
if (isAdmin)
|
||||
PopupMenuItem(
|
||||
value: SpaceActions.addChild,
|
||||
child: ListTile(
|
||||
leading: Icon(Icons.edit_square),
|
||||
title: Text(
|
||||
L10n.of(
|
||||
context,
|
||||
).addChatOrSubSpace,
|
||||
),
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: SpaceActions.settings,
|
||||
child: ListTile(
|
||||
leading: Icon(
|
||||
Icons.settings_outlined,
|
||||
),
|
||||
title: Text(
|
||||
L10n.of(context).settings,
|
||||
),
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: SpaceActions.leave,
|
||||
child: ListTile(
|
||||
leading: Icon(Icons.delete_outlined),
|
||||
title: Text(L10n.of(context).leave),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
if (isAdmin)
|
||||
IconButton.filledTonal(
|
||||
tooltip: L10n.of(context).addChatOrSubSpace,
|
||||
onPressed: () => context.go(
|
||||
'/rooms/newgroup?space_id=${widget.spaceId}',
|
||||
PopupMenuButton<SpaceActions>(
|
||||
tooltip: L10n.of(context).settings,
|
||||
useRootNavigator: true,
|
||||
onSelected: _onSpaceAction,
|
||||
itemBuilder: (context) => [
|
||||
if (isAdmin)
|
||||
PopupMenuItem(
|
||||
value: SpaceActions.addChild,
|
||||
child: ListTile(
|
||||
leading: Icon(Icons.add_circle_outline_rounded),
|
||||
title: Text(
|
||||
L10n.of(context).addChatOrSubSpace,
|
||||
),
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: SpaceActions.settings,
|
||||
child: ListTile(
|
||||
leading: Icon(Icons.settings_outlined,),
|
||||
title: Text(L10n.of(context).settings),
|
||||
),
|
||||
),
|
||||
icon: const Icon(Icons.add),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: SpaceActions.leave,
|
||||
child: ListTile(
|
||||
leading: Icon(Icons.delete_outlined,color: theme.colorScheme.error ),
|
||||
title: Text(L10n.of(context).leave, style: TextStyle(color: theme.colorScheme.error),),
|
||||
),
|
||||
),
|
||||
],
|
||||
icon: const Icon(Icons.settings_outlined),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -729,21 +644,6 @@ class _SpaceViewState extends State<SpaceView> {
|
||||
bottom: 12,
|
||||
child: Row(
|
||||
children: [
|
||||
Avatar(
|
||||
mxContent: avatar,
|
||||
name: displayname,
|
||||
size: 56,
|
||||
shapeBorder: RoundedSuperellipseBorder(
|
||||
side: BorderSide(
|
||||
width: 2,
|
||||
color: theme.colorScheme.surface,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppConfig.spaceBorderRadius,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Text(
|
||||
displayname,
|
||||
|
||||