diff --git a/.forgejo/workflows/bump-libmpv.yml b/.forgejo/workflows/bump-libmpv.yml new file mode 100644 index 0000000..71a3865 --- /dev/null +++ b/.forgejo/workflows/bump-libmpv.yml @@ -0,0 +1,24 @@ +name: "Bump the Windows build's libmpv" + +on: + schedule: + - cron: "0 6 * * 1" + workflow_dispatch: + +jobs: + bump-libmpv: + runs-on: ["small", "debian-13-x86_64"] + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Lix GHA Installer Action + uses: samueldr/lix-gha-installer-action@v2026-02-22 + with: + extra_nix_config: experimental-features = nix-command flakes flake-self-attrs + + - name: Open a PR if there's a newer libmpv build + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: nix run .#bump-libmpv diff --git a/.forgejo/workflows/e2e.yml b/.forgejo/workflows/e2e.yml index 134143b..14d96d2 100644 --- a/.forgejo/workflows/e2e.yml +++ b/.forgejo/workflows/e2e.yml @@ -1,14 +1,14 @@ name: "End-to-end tests" on: - push: - branches: ["main"] + schedule: + - cron: "0 6 * * 1" pull_request: workflow_dispatch: jobs: e2e: - runs-on: ["large", "debian-13-x86_64"] + runs-on: ["large-mem", "debian-13-x86_64"] steps: - name: Checkout repository diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index cf64422..5cb03be 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -15,6 +15,7 @@ jobs: uses: actions/checkout@v6 with: submodules: recursive + fetch-depth: 0 - name: Lix GHA Installer Action uses: samueldr/lix-gha-installer-action@v2026-02-22 @@ -26,8 +27,30 @@ jobs: env: KEYSTORE_CONTENT: ${{ secrets.KEYSTORE_CONTENT }} + # The NDK's path ends up in the native libraries' build IDs, so put it where F-Droid has it. + # It's copied rather than linked, as clang finds its headers from its resolved location. + - name: Set up Android SDK + run: | + ndk=$(nix develop --command printenv ANDROID_NDK_HOME) + sudo mkdir -p /opt/android-sdk/ndk + sudo chown -R "$USER" /opt/android-sdk + for entry in "${ndk%/ndk/*}"/*; do + [[ $entry == */ndk ]] || ln -s "$entry" /opt/android-sdk/ + done + cp -rL "$ndk" /opt/android-sdk/ndk/ + - name: Build app - run: nix develop --command bash -c "flutter pub get && dart scripts/generate.dart && flutter pub run build_runner build && flutter build apk --target-platform android-arm64 --split-per-abi --dart-define=GIT_COMMIT=${{ github.sha }}" + run: | + export PUB_CACHE=$PWD/.pub-cache + export GOTOOLCHAIN=go$(sed -n -E 's/^toolchain go([0-9.]+)$/\1/p' gomuks/go.mod) + nix develop --command bash -c ' + set -e + export ANDROID_HOME=/opt/android-sdk ANDROID_SDK_ROOT=/opt/android-sdk ANDROID_NDK_HOME=/opt/android-sdk/ndk/${ANDROID_NDK_HOME##*/} + flutter pub get --enforce-lockfile + bash scripts/build_avif_native.sh + dart scripts/generate.dart + flutter pub run build_runner build + flutter build apk --target-platform android-arm64 --split-per-abi --dart-define=GIT_COMMIT=$GITHUB_SHA' env: KEYSTORE_PATH: ../../keystore.jks KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index 28344ea..662cff6 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -19,7 +19,7 @@ jobs: - name: Set up Flutter uses: subosito/flutter-action@v2 with: - flutter-version: 3.47.4 + flutter-version-file: pubspec.yaml - name: Set up Go uses: actions/setup-go@v6 diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index b56f16f..5437318 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -19,7 +19,7 @@ jobs: - name: Set up Flutter uses: subosito/flutter-action@v2 with: - flutter-version: 3.47.4 + flutter-version-file: pubspec.yaml - name: Set up Go uses: actions/setup-go@v6 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index db339b9..79032d5 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -19,7 +19,7 @@ jobs: - name: Set up Flutter uses: subosito/flutter-action@v2 with: - flutter-version: 3.47.4 + flutter-version-file: pubspec.yaml - name: Set up Go uses: actions/setup-go@v6 @@ -36,7 +36,7 @@ jobs: - name: Go build run: | cd gomuks/pkg/ffi - go build -tags goolm,sqlite_fts5 -o ../../../libgomuks.dll -buildmode=c-shared + go build -tags sqlite_fts5 -o ../../../libgomuks.dll -buildmode=c-shared - name: Build with Flutter run: | @@ -45,6 +45,17 @@ jobs: flutter pub run build_runner build flutter build windows --dart-define=GIT_COMMIT=${{ github.sha }} + # better_player plays videos with libmpv, but doesn't bundle it + - name: Download libmpv + shell: powershell + run: | + $archive = "$env:RUNNER_TEMP\mpv.7z" + Invoke-WebRequest "https://github.com/shinchiro/mpv-winbuild-cmake/releases/download/20261111/mpv-dev-x86_64-20261111-git-bcde6b93cc.7z" -OutFile $archive + if ((Get-FileHash $archive -Algorithm SHA256).Hash -ne "273c079b11ea5575822f972756f4c9a71149a5c10130353abeb8586738938452") { + throw "libmpv checksum mismatch" + } + 7z e $archive libmpv-2.dll -obuild/windows/x64/runner/Release + - name: Copy MinGW runtime DLLs shell: msys2 {0} run: | diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index fa4a0a1..0f73f6a 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -12,6 +12,16 @@ You can run the following command to update the Gomuks submodule: git submodule update --remote ``` +## Releasing + +To make a release, run the following command with the new version, either `X.Y.Z` or a pre-release like `X.Y.Z-alpha1`: + +```sh +scripts/release.sh 1.2.0 +``` + +This sets the version in `pubspec.yaml` (along with the Android version code), the Windows installer, the AppStream metainfo and the README, then commits and tags it. Push it with the command it prints, then attach the artifacts from the tag's CI run to the release. + ## Code Style See [Effective Dart: Style](https://dart.dev/effective-dart/style) for general rules. There are some extra rules detailed below: diff --git a/README.md b/README.md index d00041a..4fd61e4 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,9 @@ A simple and user-friendly Matrix client made with Flutter and a Gomuks backend. ## Screenshots -| Dark Mode | Light Mode | -| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------: | -| ![Screenshot of Nexus Client in dark mode, showing users talking, with a sidebar showing rooms and spaces, and another sidebar showing members](./assets/screenshotDark.png) | ![The same screenshot as above, but in light mode](./assets/screenshotLight.png) | +| Dark Mode | Light Mode | +| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------: | +| ![Screenshot of Nexus Client in dark mode, showing users talking, with a sidebar showing rooms and spaces, and another sidebar showing members](./assets/screenshots/desktop-dark.png) | ![The same screenshot as above, but in light mode](./assets/screenshots/desktop-light.png) | ## Try it out @@ -49,7 +49,7 @@ nexus = { This tracks the latest commit on `main`. To stay on a release instead, pin the input to its tag: ```nix -url = "git+https://git.federated.nexus/Nexus/nexus?ref=refs/tags/v1.1.0"; +url = "git+https://git.federated.nexus/Nexus/nexus?ref=refs/tags/v1.1.3"; ``` Then import the module and enable it in your NixOS configuration: @@ -75,7 +75,7 @@ This installs Nexus system-wide. With `enableNotifications`, it also installs KU #### Linux - On NixOS: Either use direnv and `direnv allow`, or `nix develop` -- On other distros: Install Flutter, Go, Git, Libclang, Libass, MPV, and Glibc. Do not use any Snap packages, they cause various compilation issues. +- On other distros: Install Flutter, Go, Git, Libclang, MPV, GStreamer (with its base, good and libav plugins), and Glibc. Do not use any Snap packages, they cause various compilation issues. #### Windows @@ -83,12 +83,11 @@ You will need: - Flutter - Git -- Libass -- MPV - Go - Visual Studio 2022 (Desktop development with C++) - [MSYS2/MinGW-w64 GCC](https://www.msys2.org/) (for CGO) - [LLVM/Clang + libclang](https://clang.llvm.org/get_started.html) (for `ffigen`) +- `libmpv-2.dll`, for playing videos, next to `nexus.exe` (CI uses a build from [mpv-winbuild-cmake](https://github.com/shinchiro/mpv-winbuild-cmake/releases)) On Windows, make sure these are available in your shell `PATH`: @@ -157,3 +156,6 @@ Join the [Nexus Client Matrix room](https://matrix.to/#/#nexus:federated.nexus) Thank you Hylke Bons (https://planetpeanut.studio) for making the amazing icon for Nexus! Thank you Tulir Asokan for making [Gomuks](https://github.com/gomuks/gomuks), and helping us integrate it into Nexus! +Thank you [Feline Build Services](https://felinebuildservices.org/) for providing CI for the Nexus Forgejo repo! + +The Nexus icon, including its source files in `assets/` and the platform app icons generated from them, is © Hylke Bons. The screenshots are © Henry Hiles. Both are licensed under [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/). diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 9c0d96c..35d2638 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -16,7 +16,7 @@ if (keystorePropertiesFile.exists()) { android { namespace = "nexus.federated.nexus" - compileSdk = 36 + compileSdk = 37 ndkVersion = flutter.ndkVersion compileOptions { @@ -57,9 +57,14 @@ android { } } + dependenciesInfo { + includeInApk = false + } + buildTypes { release { - signingConfig = signingConfigs.getByName("release") + // Unsigned without a keystore, e.g. for F-Droid, which signs it itself + signingConfig = signingConfigs.getByName("release").takeIf { it.storeFile != null } } debug { diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 7378547..7638ad6 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,7 +1,13 @@ - + - - + + + @@ -20,7 +26,7 @@ (FLUTTER_VIEW_ID) ?: return - view.post { view.rootWindowInsets?.let(view::onApplyWindowInsets) } + view.post { view.requestApplyInsets() } } } diff --git a/android/gradle.properties b/android/gradle.properties index 1551eb0..440f99f 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -5,3 +5,5 @@ android.enableJetifier=true android.builtInKotlin=false # This newDsl flag was added automatically by Flutter migrator android.newDsl=false +# Leaves proprietary Google Play services out of the location plugin +location.playServices=false diff --git a/assets/bundled/federated_nexus.svg b/assets/bundled/federated_nexus.svg new file mode 100644 index 0000000..0effd9a --- /dev/null +++ b/assets/bundled/federated_nexus.svg @@ -0,0 +1,150 @@ + + + + diff --git a/assets/bundled/matrix.svg b/assets/bundled/matrix.svg new file mode 100644 index 0000000..bfe705e --- /dev/null +++ b/assets/bundled/matrix.svg @@ -0,0 +1,11 @@ + + + + + diff --git a/assets/screenshotDark.png b/assets/screenshotDark.png deleted file mode 100644 index 48be6e5..0000000 Binary files a/assets/screenshotDark.png and /dev/null differ diff --git a/assets/screenshotLight.png b/assets/screenshotLight.png deleted file mode 100644 index 5aae7a0..0000000 Binary files a/assets/screenshotLight.png and /dev/null differ diff --git a/assets/screenshots/desktop-dark.png b/assets/screenshots/desktop-dark.png new file mode 100644 index 0000000..e9753bd Binary files /dev/null and b/assets/screenshots/desktop-dark.png differ diff --git a/assets/screenshots/desktop-light.png b/assets/screenshots/desktop-light.png new file mode 100644 index 0000000..2d5c876 Binary files /dev/null and b/assets/screenshots/desktop-light.png differ diff --git a/fastlane/metadata/android/en-US/full_description.txt b/fastlane/metadata/android/en-US/full_description.txt new file mode 100644 index 0000000..e310d29 --- /dev/null +++ b/fastlane/metadata/android/en-US/full_description.txt @@ -0,0 +1,10 @@ +

Nexus is a simple and user-friendly client for Matrix, the open and decentralized chat network. It's made with Flutter, with gomuks handling the Matrix side.

+ +

Features include:

+
    +
  • Spaces, threads, replies and reactions
  • +
  • End-to-end encryption, with verification and recovery keys
  • +
  • Polls, location sharing, and custom emoji and sticker packs
  • +
  • Multiple accounts
  • +
  • Notifications through UnifiedPush, or Firebase Cloud Messaging
  • +
diff --git a/fastlane/metadata/android/en-US/images/icon.png b/fastlane/metadata/android/en-US/images/icon.png new file mode 100644 index 0000000..6b1b81c Binary files /dev/null and b/fastlane/metadata/android/en-US/images/icon.png differ diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png new file mode 100644 index 0000000..c6688a0 Binary files /dev/null and b/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png differ diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png new file mode 100644 index 0000000..1d4ff07 Binary files /dev/null and b/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png differ diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png new file mode 100644 index 0000000..f969bf1 Binary files /dev/null and b/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png differ diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/4.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/4.png new file mode 100644 index 0000000..82915b6 Binary files /dev/null and b/fastlane/metadata/android/en-US/images/phoneScreenshots/4.png differ diff --git a/fastlane/metadata/android/en-US/short_description.txt b/fastlane/metadata/android/en-US/short_description.txt new file mode 100644 index 0000000..570387a --- /dev/null +++ b/fastlane/metadata/android/en-US/short_description.txt @@ -0,0 +1 @@ +A simple and user-friendly Matrix client diff --git a/fastlane/metadata/android/en-US/title.txt b/fastlane/metadata/android/en-US/title.txt new file mode 100644 index 0000000..755a6d7 --- /dev/null +++ b/fastlane/metadata/android/en-US/title.txt @@ -0,0 +1 @@ +Nexus diff --git a/flake.lock b/flake.lock index 13a4db7..b6443af 100644 --- a/flake.lock +++ b/flake.lock @@ -29,16 +29,16 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1794353021, - "narHash": "sha256-9eu1PH9znI34Sn5c0YCUMFUyU+D4BL+6+VqwgaU4YAI=", - "ref": "v26.11.0-alpha.1", - "rev": "38fb7897bb53805414f09e5262e297d1e800f01c", - "revCount": 8131, + "lastModified": 1794436491, + "narHash": "sha256-1Gbe5ys68lljaWtwn8Z4RhkUnWDfw8AaHQJDKVzzmVA=", + "ref": "ea3beb628a3cab6fbc4142b725c9edb043846eb6", + "rev": "ea3beb628a3cab6fbc4142b725c9edb043846eb6", + "revCount": 8146, "type": "git", "url": "https://forgejo.ellis.link/Continuwuation/Continuwuity" }, "original": { - "ref": "v26.11.0-alpha.1", + "ref": "ea3beb628a3cab6fbc4142b725c9edb043846eb6", "type": "git", "url": "https://forgejo.ellis.link/Continuwuation/Continuwuity" } diff --git a/flake.nix b/flake.nix index f5a2651..2ee3373 100644 --- a/flake.nix +++ b/flake.nix @@ -9,9 +9,9 @@ url = "github:neobrain/nix2flatpak"; inputs.nixpkgs.follows = "nixpkgs"; }; - # TEMPORARY: the e2e tests against Continuwuity from the forge, till the update gets into unstable + # TEMPORARY: the e2e tests against Continuwuity from the forge, till there's a new full release in nixpkgs continuwuity = { - url = "git+https://forgejo.ellis.link/Continuwuation/Continuwuity?ref=v26.11.0-alpha.1"; + url = "git+https://forgejo.ellis.link/Continuwuation/Continuwuity?ref=ea3beb628a3cab6fbc4142b725c9edb043846eb6"; inputs.nixpkgs.follows = "nixpkgs"; }; }; diff --git a/gomuks b/gomuks index 94d91fb..2a76e97 160000 --- a/gomuks +++ b/gomuks @@ -1 +1 @@ -Subproject commit 94d91fbbb70b1519f545f3ec1ae523a6ee965e23 +Subproject commit 2a76e97eb3e955ec14775ce4027ed446865ed7fa diff --git a/hook/build.dart b/hook/build.dart index 8726642..2181e8a 100644 --- a/hook/build.dart +++ b/hook/build.dart @@ -64,10 +64,14 @@ Future main(List args) => build(args, (input, output) async { final targetNdkApi = codeConfig.android.targetNdkApi; + // Treats empty variables as unset, since e.g. F-Droid sets ANDROID_NDK_HOME to "" without an NDK + String? env(String name) => switch (Platform.environment[name]) { + "" => null, + final value => value, + }; + Future findNdkFromSdk() async { - final androidHome = - Platform.environment["ANDROID_HOME"] ?? - Platform.environment["ANDROID_SDK_ROOT"]; + final androidHome = env("ANDROID_HOME") ?? env("ANDROID_SDK_ROOT"); if (androidHome == null) return null; final ndkDir = Directory(join(androidHome, "ndk")); @@ -78,9 +82,9 @@ Future main(List args) => build(args, (input, output) async { } final ndkHome = - Platform.environment["ANDROID_NDK_HOME"] ?? - Platform.environment["ANDROID_NDK_ROOT"] ?? - Platform.environment["NDK_HOME"] ?? + env("ANDROID_NDK_HOME") ?? + env("ANDROID_NDK_ROOT") ?? + env("NDK_HOME") ?? await findNdkFromSdk(); if (ndkHome == null) { @@ -91,8 +95,7 @@ Future main(List args) => build(args, (input, output) async { // TODO: Someone please give me a way to detect host architecture so I can change this final hostTag = - Platform.environment["ANDROID_HOST_TAG"] ?? - "${Platform.operatingSystem}-x86_64"; + env("ANDROID_HOST_TAG") ?? "${Platform.operatingSystem}-x86_64"; final ccTriple = switch (targetArch) { Architecture.arm64 => "aarch64-linux-android", Architecture.arm => "armv7a-linux-androideabi", @@ -120,7 +123,6 @@ Future main(List args) => build(args, (input, output) async { final tags = [ "sqlite_fts5", - "goolm", // goheif/dav1d is not supported on Android or iOS, would need to be fixed upstream "noheic", ].join(","); diff --git a/integration_test/helpers/pump_until.dart b/integration_test/helpers/pump_until.dart index 5ae8358..95c4944 100644 --- a/integration_test/helpers/pump_until.dart +++ b/integration_test/helpers/pump_until.dart @@ -10,9 +10,23 @@ extension PumpUntil on WidgetTester { Future pumpUntil(Finder finder) async { const timeout = Duration(seconds: 30); - String textsIn(Finder finder) => widgetList( - find.descendant(of: finder, matching: find.byType(Text)), - ).map((text) => text.data).nonNulls.join("\n"); + String textsIn(Finder finder) => + widgetList( + find.descendant( + of: finder, + matching: find.byWidgetPredicate( + (widget) => widget is Text || widget is SelectableText, + ), + ), + ) + .map( + (widget) => switch (widget) { + Text(:final data) || SelectableText(:final data) => data, + _ => null, + }, + ) + .nonNulls + .join("\n"); final stopwatch = Stopwatch()..start(); while (stopwatch.elapsed < timeout) { diff --git a/integration_test/helpers/test_app.dart b/integration_test/helpers/test_app.dart index d6724c0..27e3027 100644 --- a/integration_test/helpers/test_app.dart +++ b/integration_test/helpers/test_app.dart @@ -1,7 +1,6 @@ import "package:app_links_platform_interface/app_links_platform_interface.dart"; import "package:flutter_test/flutter_test.dart"; import "package:material_ui/material_ui.dart"; -import "package:media_kit/media_kit.dart"; import "package:nexus/controllers/active_account.dart"; import "package:nexus/main.dart" as nexus; import "package:nexus/widgets/account_scope.dart"; @@ -22,7 +21,6 @@ class TestApp(final String username, final String password) { void setUp() { nexus.isInBackground = false; - MediaKit.ensureInitialized(); AppLinksPlatform.instance = fakes.links; UrlLauncherPlatform.instance = fakes.launcher; diff --git a/integration_test/screenshots/avatars/SOURCES.md b/integration_test/screenshots/avatars/SOURCES.md new file mode 100644 index 0000000..e6094db --- /dev/null +++ b/integration_test/screenshots/avatars/SOURCES.md @@ -0,0 +1,22 @@ +# Screenshot avatars + +Avatars for the people, rooms and spaces in the screenshots, cropped from photos on Wikimedia Commons and Public Domain Pictures that are in the public domain or CC0, so they need no attribution. + +| File | License | Source | +| ---------------------- | ------------- | -------------------------------------------------------------------------------------------------------- | +| pumpkin.webp | Public domain | https://commons.wikimedia.org/wiki/File:Cucurbita_2011_G1.jpg | +| orange.webp | Public domain | https://commons.wikimedia.org/wiki/File:Orange-fruit-2.jpg | +| log-1.webp | CC0 | https://commons.wikimedia.org/wiki/File:Tabby_cat_with_blue_eyes-3336579.jpg (tinted green) | +| strudel.webp | CC0 | https://commons.wikimedia.org/wiki/File:Strudel-de-maca-2.png | +| opal.webp | Public domain | https://commons.wikimedia.org/wiki/File:Opal_6.jpg | +| cinnamon.webp | CC0 | https://commons.wikimedia.org/wiki/File:Cassia_bark_(2).jpg | +| green-tea.webp | CC0 | https://www.publicdomainpictures.net/en/view-image.php?image=165622&picture=hot-green-tea-with-heart-art | +| development.webp | CC0 | https://commons.wikimedia.org/wiki/File:Code_on_computer_monitor_(Unsplash).jpg | +| fediverse.webp | Public domain | https://commons.wikimedia.org/wiki/File:Blackeyegalaxy.jpg | +| flutter-devs.webp | CC0 | https://commons.wikimedia.org/wiki/File:Anna%27s_Hummingbird_Feeding.jpg | +| linux-mobile.webp | CC0 | https://commons.wikimedia.org/wiki/File:Gentoo_penguin_with_a_feather_in_its_beak.jpg | +| matrix-community.webp | Public domain | https://commons.wikimedia.org/wiki/File:Earth_at_Night,_Asia_(8270740728).jpg | +| off-topic.webp | CC0 | https://commons.wikimedia.org/wiki/File:Coffee_cup_surrounded_by_coffee_beans.jpg | +| open-source-games.webp | Public domain | https://commons.wikimedia.org/wiki/File:LodgeNet-Nintendo-N64-Controller.jpg | +| rust.webp | CC0 | https://commons.wikimedia.org/wiki/File:Carcinus_maenas_146434844.jpg | +| self-hosting.webp | CC0 | https://commons.wikimedia.org/wiki/File:Legrand_S.A._server_rack.jpg | diff --git a/integration_test/screenshots/avatars/cinnamon.webp b/integration_test/screenshots/avatars/cinnamon.webp new file mode 100644 index 0000000..8520f24 Binary files /dev/null and b/integration_test/screenshots/avatars/cinnamon.webp differ diff --git a/integration_test/screenshots/avatars/development.webp b/integration_test/screenshots/avatars/development.webp new file mode 100644 index 0000000..21a47b1 Binary files /dev/null and b/integration_test/screenshots/avatars/development.webp differ diff --git a/integration_test/screenshots/avatars/fediverse.webp b/integration_test/screenshots/avatars/fediverse.webp new file mode 100644 index 0000000..8952d99 Binary files /dev/null and b/integration_test/screenshots/avatars/fediverse.webp differ diff --git a/integration_test/screenshots/avatars/flutter-devs.webp b/integration_test/screenshots/avatars/flutter-devs.webp new file mode 100644 index 0000000..79634a2 Binary files /dev/null and b/integration_test/screenshots/avatars/flutter-devs.webp differ diff --git a/integration_test/screenshots/avatars/green-tea.webp b/integration_test/screenshots/avatars/green-tea.webp new file mode 100644 index 0000000..d58801c Binary files /dev/null and b/integration_test/screenshots/avatars/green-tea.webp differ diff --git a/integration_test/screenshots/avatars/linux-mobile.webp b/integration_test/screenshots/avatars/linux-mobile.webp new file mode 100644 index 0000000..8a525bd Binary files /dev/null and b/integration_test/screenshots/avatars/linux-mobile.webp differ diff --git a/integration_test/screenshots/avatars/log-1.webp b/integration_test/screenshots/avatars/log-1.webp new file mode 100644 index 0000000..e954d0c Binary files /dev/null and b/integration_test/screenshots/avatars/log-1.webp differ diff --git a/integration_test/screenshots/avatars/matrix-community.webp b/integration_test/screenshots/avatars/matrix-community.webp new file mode 100644 index 0000000..2e58828 Binary files /dev/null and b/integration_test/screenshots/avatars/matrix-community.webp differ diff --git a/integration_test/screenshots/avatars/off-topic.webp b/integration_test/screenshots/avatars/off-topic.webp new file mode 100644 index 0000000..ea9ec17 Binary files /dev/null and b/integration_test/screenshots/avatars/off-topic.webp differ diff --git a/integration_test/screenshots/avatars/opal.webp b/integration_test/screenshots/avatars/opal.webp new file mode 100644 index 0000000..807223f Binary files /dev/null and b/integration_test/screenshots/avatars/opal.webp differ diff --git a/integration_test/screenshots/avatars/open-source-games.webp b/integration_test/screenshots/avatars/open-source-games.webp new file mode 100644 index 0000000..3b92ac7 Binary files /dev/null and b/integration_test/screenshots/avatars/open-source-games.webp differ diff --git a/integration_test/screenshots/avatars/orange.webp b/integration_test/screenshots/avatars/orange.webp new file mode 100644 index 0000000..1f9c199 Binary files /dev/null and b/integration_test/screenshots/avatars/orange.webp differ diff --git a/integration_test/screenshots/avatars/pumpkin.webp b/integration_test/screenshots/avatars/pumpkin.webp new file mode 100644 index 0000000..d300ec9 Binary files /dev/null and b/integration_test/screenshots/avatars/pumpkin.webp differ diff --git a/integration_test/screenshots/avatars/quadradical.webp b/integration_test/screenshots/avatars/quadradical.webp new file mode 100644 index 0000000..79e26c1 Binary files /dev/null and b/integration_test/screenshots/avatars/quadradical.webp differ diff --git a/integration_test/screenshots/avatars/rust.webp b/integration_test/screenshots/avatars/rust.webp new file mode 100644 index 0000000..5089187 Binary files /dev/null and b/integration_test/screenshots/avatars/rust.webp differ diff --git a/integration_test/screenshots/avatars/self-hosting.webp b/integration_test/screenshots/avatars/self-hosting.webp new file mode 100644 index 0000000..30535e9 Binary files /dev/null and b/integration_test/screenshots/avatars/self-hosting.webp differ diff --git a/integration_test/screenshots/avatars/strudel.webp b/integration_test/screenshots/avatars/strudel.webp new file mode 100644 index 0000000..e69e842 Binary files /dev/null and b/integration_test/screenshots/avatars/strudel.webp differ diff --git a/integration_test/screenshots/screenshot_data.dart b/integration_test/screenshots/screenshot_data.dart new file mode 100644 index 0000000..fbabe4b --- /dev/null +++ b/integration_test/screenshots/screenshot_data.dart @@ -0,0 +1,365 @@ +import "dart:convert"; + +import "package:collection/collection.dart"; +import "package:fast_immutable_collections/fast_immutable_collections.dart"; +import "package:nexus/models/client_state.dart"; +import "package:nexus/models/room.dart"; +import "package:nexus/models/space_edge.dart"; + +/// What the screenshots show: the Nexus space, with its room mid-conversation. +/// Rooms are written as gomuks reports them. +class ScreenshotData(final DateTime now) { + static const me = "@quadradical:federated.nexus"; + static const bot = "@nexusbot:federated.nexus"; + static const alice = "@alice:example.org"; + static const pumpkin = "@pumpkin:example.org"; + static const strudel = "@strudel:example.org"; + static const opal = "@opal:example.org"; + static const greenTea = "@greentea:example.org"; + + static const nexusSpace = "!nexus-space:federated.nexus"; + static const nexusRoom = "!nexus-client:federated.nexus"; + + /// Nexus' own avatar, the app icon. Every other `mxc://screenshots/` is + /// a file in avatars/, see avatars/SOURCES.md. + static const nexusAvatar = "mxc://screenshots/nexus"; + static const myAvatar = "mxc://screenshots/quadradical.webp"; + static const issueUrl = "https://git.federated.nexus/Nexus/nexus/issues/174"; + static const commitUrl = + "https://git.federated.nexus/Nexus/nexus/commit/41f5225420"; + + static const topic = + "A simple and user-friendly Matrix client made with Flutter and a Gomuks backend."; + + /// The users shown, with their power level in the Nexus room. Those without + /// an avatar get Nexus' fallback. Everyone but QuadRadical and NexusBot is + /// made up, on example.org so as not to be anyone real. + static const users = IListConst([ + (id: me, name: "QuadRadical", powerLevel: 100, avatar: myAvatar), + (id: alice, name: "Alice", powerLevel: 100, avatar: null), + (id: bot, name: "NexusBot", powerLevel: 50, avatar: nexusAvatar), + ( + id: pumpkin, + name: "Pumpkin", + powerLevel: 0, + avatar: "mxc://screenshots/pumpkin.webp", + ), + ( + id: strudel, + name: "Strudel", + powerLevel: 0, + avatar: "mxc://screenshots/strudel.webp", + ), + ( + id: opal, + name: "Opal", + powerLevel: 0, + avatar: "mxc://screenshots/opal.webp", + ), + ( + id: "@orange:example.org", + name: "Orange", + powerLevel: 0, + avatar: "mxc://screenshots/orange.webp", + ), + ( + id: "@log1:example.org", + name: "log(1)", + powerLevel: 0, + avatar: "mxc://screenshots/log-1.webp", + ), + ( + id: greenTea, + name: "Green Tea", + powerLevel: 0, + avatar: "mxc://screenshots/green-tea.webp", + ), + ( + id: "@cinnamon:example.org", + name: "Cinnamon", + powerLevel: 0, + avatar: "mxc://screenshots/cinnamon.webp", + ), + ]); + + /// The Nexus space's other rooms + static const otherRooms = IListConst([ + (name: "Off-topic", unread: 3), + (name: "Development", unread: 0), + ]); + + /// Spaces shown in the rail besides Nexus, so it doesn't look empty + static const otherSpaces = IListConst([ + "Matrix Community", + "Flutter Devs", + "Linux Mobile", + "Rust", + "Open Source Games", + "Fediverse", + "Self-Hosting", + ]); + + static const clientState = ClientState( + isInitialized: true, + isLoggedIn: true, + isVerified: true, + userId: me, + deviceId: "SCREENSHOTS", + homeserverUrl: "https://federated.nexus", + ); + + static final IList topLevelSpaces = .new([ + nexusSpace, + ...otherSpaces.map(_roomId), + ]); + + static final IMap> spaceEdges = .new({ + nexusSpace: .new( + [ + nexusRoom, + ...otherRooms.map((room) => _roomId(room.name)), + ].map((id) => .new(childId: id)), + ), + }); + + /// The rooms, with the Nexus room's state already fetched so it isn't + /// requested + late final IMap rooms = { + nexusSpace: _room(nexusSpace, "Nexus Client", topic: topic), + nexusRoom: _room( + nexusRoom, + "Nexus Client", + topic: topic, + lastEvent: timeline.last, + extra: { + "timeline": timeline + .map( + (event) => { + "timeline_rowid": event["rowid"], + "event_rowid": event["rowid"], + }, + ) + .toList(), + "events": [...nexusState, ...timeline], + "state": _stateIndex(nexusState), + "receipts": { + timeline.last["event_id"]: [ + _receipt(strudel, timeline.last), + _receipt(greenTea, timeline.last), + ], + timeline[timeline.length - 2]["event_id"]: [ + _receipt(opal, timeline[timeline.length - 2]), + ], + }, + "has_more": false, + }, + ).copyWith(hasFetchedState: true, hasFetchedMembers: true), + for (final room in otherRooms) + _roomId(room.name): _room( + _roomId(room.name), + room.name, + avatar: _avatarOfRoom(room.name), + unread: room.unread, + ), + for (final space in otherSpaces) + _roomId(space): _room( + _roomId(space), + space, + avatar: _avatarOfRoom(space), + ), + }.lock; + + /// The Nexus room's state: who's in it, and their power levels + late final List> nexusState = [ + _event(me, "m.room.power_levels", { + "users": Map.fromEntries( + users.map((user) => .new(user.id, user.powerLevel)), + ), + "users_default": 0, + "events_default": 0, + "state_default": 50, + }, key: ""), + ...users.map( + (user) => _event(user.id, "m.room.member", { + "membership": "join", + "displayname": user.name, + "avatar_url": ?user.avatar, + }, key: user.id), + ), + ]; + + late final List> timeline = [ + _message( + alice, + 35, + "the screenshots in the readme are pretty out of date btw", + ), + _message( + me, + 32, + "Should I:\n" + "1. just take screenshots on a few devices, and redo them whenever the " + "UI changes\n" + "or\n" + "2. overengineer a test that makes them automatically, in a fake room\n" + "I think the answer is 2 :p", + html: + "Should I:" + "
  1. just take screenshots on a few devices, and redo them " + "whenever the UI changes
" + "or" + '
  1. overengineer a test that makes them ' + "automatically, in a fake room
" + "I think the answer is 2 :p", + reactions: {"2️⃣": 3}, + ), + _message(pumpkin, 30, "2, obviously"), + // Linked only in the HTML, so the body has no link to preview + _message( + bot, + 29, + "[Nexus/nexus] Issue opened: #174 Automatic scripts to make screenshots " + "for different pages and viewports by Henry-Hiles", + html: + '[Nexus/nexus] Issue opened: #174 Automatic ' + "scripts to make screenshots for different pages and viewports " + "by Henry-Hiles", + ), + _message( + bot, + 7, + "[Nexus/nexus] Henry-Hiles pushed 1 commit to main: $commitUrl: " + "update screenshots - Henry-Hiles", + html: + "[Nexus/nexus] Henry-Hiles pushed 1 commit to main:
" + '41f5225: update screenshots - Henry-Hiles', + reactions: {"🚀": 3}, + ), + _message( + pumpkin, + 5, + "they're generated now?? let's gooo", + reactions: {"🎉": 2, "❤️": 1}, + ), + ]; + + /// The link preview shown under NexusBot's message + static const urlPreview = { + "og:title": "update screenshots · 41f5225420", + "og:description": + "nexus - A simple and user-friendly Matrix client made with Flutter " + "and a Gomuks backend.", + }; + + int _rowId = 0; + + /// An event in the Nexus room + Map _event( + String sender, + String type, + Map content, { + String? key, + int minutesAgo = 60, + Map reactions = const {}, + }) { + final rowId = ++_rowId; + return { + "rowid": rowId, + "timeline_rowid": rowId, + "room_id": nexusRoom, + "event_id": "\$screenshots-$rowId", + "sender": sender, + "type": type, + "state_key": ?key, + "timestamp": now + .subtract(.new(minutes: minutesAgo)) + .millisecondsSinceEpoch, + "content": content, + "reactions": reactions, + }; + } + + Map _message( + String sender, + int minutesAgo, + String body, { + String? html, + Map reactions = const {}, + }) => _event( + sender, + "m.room.message", + { + "msgtype": sender == bot ? "m.notice" : "m.text", + "body": body, + if (html != null) ...{ + "format": "org.matrix.custom.html", + "formatted_body": html, + }, + }, + minutesAgo: minutesAgo, + reactions: reactions, + ); + + Map _receipt(String userId, Map event) => { + "user_id": userId, + "event_id": event["event_id"], + "room_id": nexusRoom, + "timestamp": event["timestamp"], + }; + + /// A room, with [extra] JSON besides its metadata + Room _room( + String id, + String name, { + String avatar = nexusAvatar, + String? topic, + int unread = 0, + Map? lastEvent, + Map extra = const {}, + }) => .fromJson( + // Round-tripped, so the JSON has the types gomuks' decoded JSON would + jsonDecode( + jsonEncode({ + "meta": { + "room_id": id, + "name": name, + "avatar": avatar, + "topic": ?topic, + "has_member_list": true, + "preview_event_rowid": lastEvent?["rowid"] ?? 0, + "sorting_timestamp": + lastEvent?["timestamp"] ?? + now.subtract(const .new(hours: 1)).millisecondsSinceEpoch, + "unread_highlights": 0, + "unread_notifications": 0, + "unread_messages": unread, + }, + ...extra, + }), + ), + ); + + static Map> _stateIndex( + List> state, + ) => state + .groupListsBy((event) => event["type"] as String) + .map( + (type, events) => .new( + type, + Map.fromEntries( + events.map( + (event) => + .new(event["state_key"] as String, event["rowid"] as int), + ), + ), + ), + ); + + static String _avatarOfRoom(String name) => + "mxc://screenshots/${_slug(name)}.webp"; + + static String _slug(String name) => + name.toLowerCase().replaceAll(RegExp("[^a-z]+"), "-"); + + static String _roomId(String name) => "!${_slug(name)}:federated.nexus"; +} diff --git a/integration_test/screenshots/screenshot_fakes.dart b/integration_test/screenshots/screenshot_fakes.dart new file mode 100644 index 0000000..23ef76f --- /dev/null +++ b/integration_test/screenshots/screenshot_fakes.dart @@ -0,0 +1,62 @@ +import "dart:io"; +import "dart:ui" as ui; + +import "package:flutter/rendering.dart"; +import "package:flutter_test/flutter_test.dart"; +import "package:nexus/controllers/client.dart"; + +import "screenshot_data.dart"; + +/// Answers the commands the screenshotted screens send to gomuks, so the +/// screenshots don't need gomuks or a homeserver. +class FakeClientController() extends ClientController { + this : super(null); + + @override + Future build() async => 0; + + @override + Future sendCommand( + String command, [ + Map request = const {}, + ]) async => switch (command) { + "get_url_preview" => ScreenshotData.urlPreview, + "download_media" => {"path": _mediaPath(request["mxc"])}, + "get_related_events" => [], + "mark_read" || "set_typing" => null, + _ => throw UnimplementedError("The screenshots can't answer $command"), + }; + + /// The file for [mxc], from avatars/ beside this file + static String _mediaPath(String mxc) { + final file = File(switch (mxc) { + ScreenshotData.nexusAvatar => "assets/mobile.png", + _ => + "integration_test/screenshots/avatars/" + "${Uri.parse(mxc).pathSegments.last}", + }); + if (!file.existsSync()) throw StateError("No screenshot media for $mxc"); + return file.absolute.path; + } +} + +extension Screenshot on WidgetTester { + /// Saves what the app currently shows to [path], as a PNG. + Future screenshot(String path) async { + // Lets images finish decoding and animations settle + for (var frame = 0; frame < 20; frame++) { + await runAsync(() => .delayed(const .new(milliseconds: 50))); + await pump(const .new(milliseconds: 50)); + } + + final renderView = binding.renderViews.single; + final layer = renderView.debugLayer! as OffsetLayer; + final bytes = await runAsync(() async { + final image = await layer.toImage(Offset.zero & view.physicalSize); + return image.toByteData(format: ui.ImageByteFormat.png); + }); + + await File(path).create(recursive: true); + await File(path).writeAsBytes(bytes!.buffer.asUint8List()); + } +} diff --git a/integration_test/screenshots/screenshots_test.dart b/integration_test/screenshots/screenshots_test.dart new file mode 100644 index 0000000..29ed0bd --- /dev/null +++ b/integration_test/screenshots/screenshots_test.dart @@ -0,0 +1,142 @@ +import "dart:convert"; + +import "package:flutter_test/flutter_test.dart"; +import "package:integration_test/integration_test.dart"; +import "package:material_ui/material_ui.dart"; +import "package:nexus/controllers/client.dart"; +import "package:nexus/controllers/client_state.dart"; +import "package:nexus/controllers/gomuks_listener.dart"; +import "package:nexus/controllers/init_complete.dart"; +import "package:nexus/controllers/key.dart"; +import "package:nexus/controllers/member_list_opened.dart"; +import "package:nexus/controllers/rooms.dart"; +import "package:nexus/controllers/settings.dart"; +import "package:nexus/controllers/space_edges.dart"; +import "package:nexus/controllers/top_level_spaces.dart"; +import "package:nexus/main.dart" as nexus; +import "package:nexus/models/account.dart"; +import "package:nexus/widgets/account_scope.dart"; +import "package:shared_preferences_platform_interface/in_memory_shared_preferences_async.dart"; +import "package:shared_preferences_platform_interface/shared_preferences_async_platform_interface.dart"; + +import "../helpers/pump_until.dart"; +import "screenshot_data.dart"; +import "screenshot_fakes.dart"; + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + // Where the screenshots are saved, set by `nix run .#screenshots` + const outputDirectory = String.fromEnvironment( + "SCREENSHOTS_DIR", + defaultValue: "build/screenshots", + ); + const accountId = "screenshots"; + + final data = ScreenshotData(.now()); + + setUpAll(() => nexus.isInBackground = false); + + /// Opens Nexus at the Nexus room, as a [size] window at [pixelRatio], + /// pretending to be a phone if [mobile]. + Future open( + WidgetTester tester, { + required ThemeMode theme, + required Size size, + required double pixelRatio, + required bool mobile, + }) async { + tester.view.physicalSize = size; + tester.view.devicePixelRatio = pixelRatio; + addTearDown(tester.view.reset); + + SharedPreferencesAsyncPlatform.instance = + InMemorySharedPreferencesAsync.withData({ + KeyController.accountsKey: json.encode([ + Account( + id: accountId, + userId: ScreenshotData.me, + displayName: "QuadRadical", + avatar: .parse(ScreenshotData.myAvatar), + ), + ]), + KeyController.activeAccountKey: accountId, + MemberListOpenedController.key: true, + "$accountId/${KeyController.spaceKey}": ScreenshotData.nexusSpace, + "$accountId/${KeyController.roomKey}": ScreenshotData.nexusRoom, + }); + + await tester.pumpWidget( + AccountScope( + initialAccountId: accountId, + retry: (_, _) => null, + overrides: [ + ClientController.provider.overrideWith(FakeClientController.new), + // Never starts gomuks; the state below is what it would sync + GomuksListenerController.provider.overrideWithBuild((_, _) {}), + ClientStateController.provider.overrideWithBuild( + (_, _) => ScreenshotData.clientState, + ), + InitCompleteController.provider.overrideWithBuild((_, _) => true), + RoomsController.provider.overrideWithBuild((_, _) => data.rooms), + TopLevelSpacesController.provider.overrideWithBuild( + (_, _) => ScreenshotData.topLevelSpaces, + ), + SpaceEdgesController.provider.overrideWithBuild( + (_, _) => ScreenshotData.spaceEdges, + ), + SettingsController.provider.overrideWithBuild( + (_, _) => .new( + theme: theme, + useDynamicTheming: false, + linuxMobileMode: mobile, + ), + ), + ], + child: nexus.App(), + ), + ); + + await tester.pumpUntil(find.text("they're generated now?? let's gooo")); + + // Focused on desktop, which would show a cursor + FocusManager.instance.primaryFocus?.unfocus(); + } + + for (final theme in [ThemeMode.dark, ThemeMode.light]) { + testWidgets("desktop, ${theme.name}", (tester) async { + await open( + tester, + theme: theme, + size: const .new(1920, 1080), + pixelRatio: 1, + mobile: false, + ); + + await tester.pumpUntil(find.text("Strudel")); + + await tester.screenshot("$outputDirectory/desktop-${theme.name}.png"); + }); + + testWidgets("phone, ${theme.name}", (tester) async { + await open( + tester, + theme: theme, + size: const .new(1080, 2340), + pixelRatio: 3, + mobile: true, + ); + + await tester.screenshot("$outputDirectory/phone-chat-${theme.name}.png"); + + await tester.tap( + find.byTooltip( + const DefaultMaterialLocalizations().openAppDrawerTooltip, + ), + ); + await tester.pumpUntil(find.text("Off-topic")); + + await tester.screenshot("$outputDirectory/phone-rooms-${theme.name}.png"); + }); + } +} diff --git a/ios/Flutter/Debug.xcconfig b/ios/Flutter/Debug.xcconfig index ec97fc6..592ceee 100644 --- a/ios/Flutter/Debug.xcconfig +++ b/ios/Flutter/Debug.xcconfig @@ -1,2 +1 @@ -#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Generated.xcconfig" diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig index c4855bf..592ceee 100644 --- a/ios/Flutter/Release.xcconfig +++ b/ios/Flutter/Release.xcconfig @@ -1,2 +1 @@ -#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Generated.xcconfig" diff --git a/ios/Podfile b/ios/Podfile deleted file mode 100644 index 620e46e..0000000 --- a/ios/Podfile +++ /dev/null @@ -1,43 +0,0 @@ -# Uncomment this line to define a global platform for your project -# platform :ios, '13.0' - -# CocoaPods analytics sends network stats synchronously affecting flutter build latency. -ENV['COCOAPODS_DISABLE_STATS'] = 'true' - -project 'Runner', { - 'Debug' => :debug, - 'Profile' => :release, - 'Release' => :release, -} - -def flutter_root - generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) - unless File.exist?(generated_xcode_build_settings_path) - raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" - end - - File.foreach(generated_xcode_build_settings_path) do |line| - matches = line.match(/FLUTTER_ROOT\=(.*)/) - return matches[1].strip if matches - end - raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" -end - -require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) - -flutter_ios_podfile_setup - -target 'Runner' do - use_frameworks! - - flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) - target 'RunnerTests' do - inherit! :search_paths - end -end - -post_install do |installer| - installer.pods_project.targets.each do |target| - flutter_additional_ios_build_settings(target) - end -end diff --git a/ios/Podfile.lock b/ios/Podfile.lock deleted file mode 100644 index b29d5cb..0000000 --- a/ios/Podfile.lock +++ /dev/null @@ -1,28 +0,0 @@ -PODS: - - Flutter (1.0.0) - - media_kit_libs_ios_video (1.0.4): - - Flutter - - media_kit_video (0.0.1): - - Flutter - -DEPENDENCIES: - - Flutter (from `Flutter`) - - media_kit_libs_ios_video (from `.symlinks/plugins/media_kit_libs_ios_video/ios`) - - media_kit_video (from `.symlinks/plugins/media_kit_video/ios`) - -EXTERNAL SOURCES: - Flutter: - :path: Flutter - media_kit_libs_ios_video: - :path: ".symlinks/plugins/media_kit_libs_ios_video/ios" - media_kit_video: - :path: ".symlinks/plugins/media_kit_video/ios" - -SPEC CHECKSUMS: - Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467 - media_kit_libs_ios_video: 5a18affdb97d1f5d466dc79988b13eff6c5e2854 - media_kit_video: 1746e198cb697d1ffb734b1d05ec429d1fcd1474 - -PODFILE CHECKSUM: 3c63482e143d1b91d2d2560aee9fb04ecc74ac7e - -COCOAPODS: 1.17.0 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 065d08b..1612bb0 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -8,13 +8,11 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; - 2ADFEE6C745FFB2100CC9AFD /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8156A45F510382D558AED93A /* Pods_RunnerTests.framework */; }; 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 7884E8682EC3CC0700C636F2 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7884E8672EC3CC0400C636F2 /* SceneDelegate.swift */; }; 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; - 88D55A5F1C7625122EBEE29D /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 82F9A3759658343C81A0EA4C /* Pods_Runner.framework */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; @@ -46,19 +44,14 @@ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 22DE4310DAFBE211CDF700B1 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 363A89F6FA09BCCBDED440CE /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 63516CF65A79A5DDDE64B0D1 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7884E8672EC3CC0400C636F2 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; - 8156A45F510382D558AED93A /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 82F9A3759658343C81A0EA4C /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -66,9 +59,6 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - AEB96D8976BD46D6860C7041 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; - B8B599FDB72E4713FB7B5A44 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; - FE5E4162842555A83F8A7FD7 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -76,7 +66,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 2ADFEE6C745FFB2100CC9AFD /* Pods_RunnerTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -85,27 +74,12 @@ buildActionMask = 2147483647; files = ( 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */, - 88D55A5F1C7625122EBEE29D /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 1CFFAE23B502BCCEB2B191A3 /* Pods */ = { - isa = PBXGroup; - children = ( - AEB96D8976BD46D6860C7041 /* Pods-Runner.debug.xcconfig */, - 363A89F6FA09BCCBDED440CE /* Pods-Runner.release.xcconfig */, - 22DE4310DAFBE211CDF700B1 /* Pods-Runner.profile.xcconfig */, - B8B599FDB72E4713FB7B5A44 /* Pods-RunnerTests.debug.xcconfig */, - FE5E4162842555A83F8A7FD7 /* Pods-RunnerTests.release.xcconfig */, - 63516CF65A79A5DDDE64B0D1 /* Pods-RunnerTests.profile.xcconfig */, - ); - name = Pods; - path = Pods; - sourceTree = ""; - }; 331C8082294A63A400263BE5 /* RunnerTests */ = { isa = PBXGroup; children = ( @@ -114,15 +88,6 @@ path = RunnerTests; sourceTree = ""; }; - 594EB1F65336CF9C7958F6FA /* Frameworks */ = { - isa = PBXGroup; - children = ( - 82F9A3759658343C81A0EA4C /* Pods_Runner.framework */, - 8156A45F510382D558AED93A /* Pods_RunnerTests.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -142,8 +107,6 @@ 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, 331C8082294A63A400263BE5 /* RunnerTests */, - 1CFFAE23B502BCCEB2B191A3 /* Pods */, - 594EB1F65336CF9C7958F6FA /* Frameworks */, ); sourceTree = ""; }; @@ -179,7 +142,6 @@ isa = PBXNativeTarget; buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; buildPhases = ( - EE82EC529EB6C0F1FA480659 /* [CP] Check Pods Manifest.lock */, 331C807D294A63A400263BE5 /* Sources */, 331C807F294A63A400263BE5 /* Resources */, 8C0A36760DA8B873D8F6DDCE /* Frameworks */, @@ -198,14 +160,12 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 0830C6758DA3ECA81FB12386 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - 1D165FDFB9D0D939B041966D /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -283,45 +243,6 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 0830C6758DA3ECA81FB12386 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - 1D165FDFB9D0D939B041966D /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -353,28 +274,6 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; - EE82EC529EB6C0F1FA480659 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -502,7 +401,6 @@ }; 331C8088294A63A400263BE5 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = B8B599FDB72E4713FB7B5A44 /* Pods-RunnerTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; @@ -520,7 +418,6 @@ }; 331C8089294A63A400263BE5 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = FE5E4162842555A83F8A7FD7 /* Pods-RunnerTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; @@ -536,7 +433,6 @@ }; 331C808A294A63A400263BE5 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 63516CF65A79A5DDDE64B0D1 /* Pods-RunnerTests.profile.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; diff --git a/ios/Runner.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcworkspace/contents.xcworkspacedata index 21a3cc1..1d526a1 100644 --- a/ios/Runner.xcworkspace/contents.xcworkspacedata +++ b/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -4,7 +4,4 @@ - - diff --git a/lib/controllers/author.dart b/lib/controllers/author.dart index f9c9167..0b783f0 100644 --- a/lib/controllers/author.dart +++ b/lib/controllers/author.dart @@ -2,27 +2,30 @@ import "dart:async"; import "package:flutter_riverpod/flutter_riverpod.dart"; import "package:nexus/controllers/user.dart"; +import "package:nexus/models/configs/author.dart"; import "package:nexus/models/content/membership.dart"; -import "package:nexus/models/event.dart"; -class AuthorController(final Event event) +class AuthorController(final AuthorConfig config) extends AsyncNotifier { @override Future build() async { final member = await ref.watch( - UserController.provider(.new(roomId: event.roomId, userId: event.sender)) - .future, + UserController.provider( + .new(roomId: config.roomId, userId: config.userId), + ).future, ); return .new( status: member.status, - avatarUrl: event.pmp?.avatarUrl ?? member.avatarUrl, - displayName: event.pmp?.displayName ?? member.displayName, + avatarUrl: config.avatarUrl ?? member.avatarUrl, + displayName: config.displayName ?? member.displayName, ); } static final provider = - AsyncNotifierProvider.family( - AuthorController.new, - ); + AsyncNotifierProvider.family< + AuthorController, + MembershipContent, + AuthorConfig + >(AuthorController.new); } diff --git a/lib/controllers/banned_warning_dismissed.dart b/lib/controllers/banned_warning_dismissed.dart new file mode 100644 index 0000000..b080d38 --- /dev/null +++ b/lib/controllers/banned_warning_dismissed.dart @@ -0,0 +1,20 @@ +import "package:flutter_riverpod/flutter_riverpod.dart"; +import "package:nexus/controllers/shared_prefs.dart"; + +class BannedWarningDismissedController extends AsyncNotifier { + static const String key = "bannedWarningDismissed"; + + @override + Future build() async => + await ref.watch(SharedPrefsController.provider).getBool(key) ?? false; + + Future set(bool value) async { + state = .data(value); + await ref.read(SharedPrefsController.provider).setBool(key, value); + } + + static final provider = + AsyncNotifierProvider( + BannedWarningDismissedController.new, + ); +} diff --git a/lib/controllers/client.dart b/lib/controllers/client.dart index e6afa3b..3a1ac6c 100644 --- a/lib/controllers/client.dart +++ b/lib/controllers/client.dart @@ -221,7 +221,10 @@ class ClientController(final String? accountId) extends AsyncNotifier { : .fromJson(response["notification"]); } - Future _sendCommand( + /// Sends [command] to gomuks, returning its decoded response. Overridable so + /// that tests can answer commands without gomuks. + @protected + Future sendCommand( String command, [ Map data = const {}, ]) => callGomuksMethod(data, (handle, data, callback) { @@ -238,18 +241,18 @@ class ClientController(final String? accountId) extends AsyncNotifier { }); Future redactEvent(RedactEventRequest report) => - _sendCommand("redact_event", report.toJson()); + sendCommand("redact_event", report.toJson()); /// Null for gomuks' own commands that don't reply. Future sendMessage(SendMessageRequest request) async => - switch (await _sendCommand("send_message", request.toJson())) { + switch (await sendCommand("send_message", request.toJson())) { final Map json => .fromJson(json), _ => null, }; /// The MSC4391 definitions of gomuks' own commands. Future> getCommandDefinitions() async => - switch (await _sendCommand("get_command_definitions")) { + switch (await sendCommand("get_command_definitions")) { final List definitions => .new( definitions.whereType>().map( BotCommandDescriptionContent.fromJson, @@ -259,27 +262,27 @@ class ClientController(final String? accountId) extends AsyncNotifier { }; Future sendEvent(SendEventRequest request) async => - Event.fromJson(await _sendCommand("send_event", request.toJson())); + Event.fromJson(await sendCommand("send_event", request.toJson())); Future setState(SetStateRequest request) async => - await _sendCommand("set_state", request.toJson()); + await sendCommand("set_state", request.toJson()); - Future pauseSync() => _sendCommand("pause_sync"); - Future resumeSync() => _sendCommand("resume_sync"); + Future pauseSync() => sendCommand("pause_sync"); + Future resumeSync() => sendCommand("resume_sync"); Future verify(String recoveryKey) => - _sendCommand("verify", {"recovery_key": recoveryKey}); + sendCommand("verify", {"recovery_key": recoveryKey}); Future generateRecoveryKey(String passphrase) async => .fromJson( - await _sendCommand("generate_recovery_key", {"passphrase": passphrase}), + await sendCommand("generate_recovery_key", {"passphrase": passphrase}), ); Future resetEncryption(RecoveryKey key) => - _sendCommand("reset_encryption", key.toJson()); + sendCommand("reset_encryption", key.toJson()); Future getCrossSigningResetUrl(Uri homeserver) async { const action = "org.matrix.cross_signing_reset"; - final oauth = (await _sendCommand("get_login_flows", { + final oauth = (await sendCommand("get_login_flows", { "homeserver_url": homeserver.toString(), }))["oauth"]; @@ -297,33 +300,33 @@ class ClientController(final String? accountId) extends AsyncNotifier { } Future joinRoom(JoinRoomRequest request) async => - (await _sendCommand("join_room", request.toJson()))["room_id"]; + (await sendCommand("join_room", request.toJson()))["room_id"]; Future knockRoom(JoinRoomRequest request) async => - (await _sendCommand("knock_room", request.toJson()))["room_id"]; + (await sendCommand("knock_room", request.toJson()))["room_id"]; Future createRoom(CreateRoomRequest request) async => - (await _sendCommand("create_room", request.toJson()))["room_id"]; + (await sendCommand("create_room", request.toJson()))["room_id"]; Future getSpaceHierarchy( GetSpaceHierarchyRequest request, ) async => - .fromJson(await _sendCommand("get_space_hierarchy", request.toJson())); + .fromJson(await sendCommand("get_space_hierarchy", request.toJson())); Future getRoomDirectory( GetRoomDirectoryRequest request, ) async => - .fromJson(await _sendCommand("get_room_directory", request.toJson())); + .fromJson(await sendCommand("get_room_directory", request.toJson())); Future getRoomSummary(JoinRoomRequest request) async => - .fromJson(await _sendCommand("get_room_summary", request.toJson())); + .fromJson(await sendCommand("get_room_summary", request.toJson())); Future leaveRoom(String roomId) => - _sendCommand("leave_room", {"room_id": roomId}); + sendCommand("leave_room", {"room_id": roomId}); Future> getRoomState(GetRoomStateRequest request) async { Future getState(GetRoomStateRequest request) async => - (await _sendCommand("get_room_state", request.toJson())) as List?; + (await sendCommand("get_room_state", request.toJson())) as List?; final response = await getState(request); return .new( @@ -336,7 +339,7 @@ class ClientController(final String? accountId) extends AsyncNotifier { Future> getSpecificRoomState( GetSpecificRoomStateRequest request, ) async => .new( - ((await _sendCommand("get_specific_room_state", request.toJson())) + ((await sendCommand("get_specific_room_state", request.toJson())) as List? ?? []) .map((event) => .fromJson(event)), @@ -346,48 +349,48 @@ class ClientController(final String? accountId) extends AsyncNotifier { GetRelatedEventsRequest request, ) async { final response = - (await _sendCommand("get_related_events", request.toJson())) as List?; + (await sendCommand("get_related_events", request.toJson())) as List?; return .new(response?.map((event) => .fromJson(event))); } Future getMentions(GetMentionsRequest request) async => - .fromJson(await _sendCommand("get_mentions", request.toJson())); + .fromJson(await sendCommand("get_mentions", request.toJson())); Future getEvent(GetEventRequest request) async { - final json = await _sendCommand("get_event", request.toJson()); + final json = await sendCommand("get_event", request.toJson()); return json == null ? null : .fromJson(json); } Future getUrlPreview(Uri url) async => - .fromJson(await _sendCommand("get_url_preview", {"url": url.toString()})); + .fromJson(await sendCommand("get_url_preview", {"url": url.toString()})); Future paginate(PaginateRequest request) async => - .fromJson(await _sendCommand("paginate", request.toJson())); + .fromJson(await sendCommand("paginate", request.toJson())); Future getThreads(GetThreadsRequest request) async => - .fromJson(await _sendCommand("get_threads", request.toJson())); + .fromJson(await sendCommand("get_threads", request.toJson())); Future paginateManual(PaginateManualRequest request) async => - .fromJson(await _sendCommand("paginate_manual", request.toJson())); + .fromJson(await sendCommand("paginate_manual", request.toJson())); Future searchLocal(SearchRequest request) async => - .fromJson(await _sendCommand("search_local", request.toJson())); + .fromJson(await sendCommand("search_local", request.toJson())); Future searchServer(SearchRequest request) async => - .fromJson(await _sendCommand("search_server", request.toJson())); + .fromJson(await sendCommand("search_server", request.toJson())); Future getEventContext(GetEventContextRequest request) async => - .fromJson(await _sendCommand("get_event_context", request.toJson())); + .fromJson(await sendCommand("get_event_context", request.toJson())); Future getProfile(String userId) async { try { - return .fromJson(await _sendCommand("get_profile", {"user_id": userId})); + return .fromJson(await sendCommand("get_profile", {"user_id": userId})); } catch (_) { return .new(profile: .new(id: userId)); } } - Future setProfileField(String field, Object? value) => _sendCommand( + Future setProfileField(String field, Object? value) => sendCommand( "set_profile_field", { "field": field, @@ -397,28 +400,28 @@ class ClientController(final String? accountId) extends AsyncNotifier { ); Future reportEvent(ReportRequest request) => - _sendCommand("report_event", request.toJson()); + sendCommand("report_event", request.toJson()); Future setMembership(SetMembershipRequest request) => - _sendCommand("set_membership", request.toJson()); + sendCommand("set_membership", request.toJson()); Future setAccountData(SetAccountDataRequest request) => - _sendCommand("set_account_data", request.toJson()); + sendCommand("set_account_data", request.toJson()); Future updatePushRule(UpdatePushRuleRequest request) => - _sendCommand("update_push_rule", request.toJson()); + sendCommand("update_push_rule", request.toJson()); Future registerPusher(RegisterPusherRequest request) => - _sendCommand("register_homeserver_push", request.toJson()); + sendCommand("register_homeserver_push", request.toJson()); Future deregisterPusher(DeregisterPusherRequest request) => - _sendCommand("register_homeserver_push", { + sendCommand("register_homeserver_push", { ...request.toJson(), "kind": null, }); Future uploadMedia(UploadMediaRequest request) async => - .fromJson(await _sendCommand("upload_media", request.toJson())); + .fromJson(await sendCommand("upload_media", request.toJson())); Future downloadMedia(DownloadMediaRequest request) async { if (accountId == null && @@ -427,13 +430,13 @@ class ClientController(final String? accountId) extends AsyncNotifier { } return .new( - (await _sendCommand("download_media", request.toJson()))["path"], + (await sendCommand("download_media", request.toJson()))["path"], ); } - Future logout() => _sendCommand("logout"); + Future logout() => sendCommand("logout"); - Future setTyping(String roomId, Duration timeout) => _sendCommand( + Future setTyping(String roomId, Duration timeout) => sendCommand( "set_typing", {"room_id": roomId, "timeout": timeout.inMilliseconds}, ); @@ -462,7 +465,7 @@ class ClientController(final String? accountId) extends AsyncNotifier { ref.read(SettingsController.provider).value?.readReceipts == .showAndSend; - await _sendCommand("mark_read", { + await sendCommand("mark_read", { "room_id": room.metadata!.id, "receipt_type": sendPublic ? "m.read" : "m.read.private", "event_id": event.eventId, @@ -471,44 +474,44 @@ class ClientController(final String? accountId) extends AsyncNotifier { } Future registerClient(OAuthRegisterClientRequest request) async => - (await _sendCommand( + (await sendCommand( "oauth_register_client", request.toJson(), ))["client_id"]; Future getAuthUrl(OAuthGetAuthUrl request) async => .fromJson( - await _sendCommand("oauth_get_authorization_url", request.toJson()), + await sendCommand("oauth_get_authorization_url", request.toJson()), ); Future exchangeToken(OAuthExchangeTokenRequest request) async => - await _sendCommand("oauth_exchange_token", request.toJson()); + await sendCommand("oauth_exchange_token", request.toJson()); Future> getMutualRooms(String userId) async => IList( - ((await _sendCommand("get_mutual_rooms", {"user_id": userId}))["joined"] + ((await sendCommand("get_mutual_rooms", {"user_id": userId}))["joined"] as List?) ?.cast(), ); Future> getLocalAliases(String roomId) async => IList( - ((await _sendCommand("get_local_aliases", {"room_id": roomId}))["aliases"] + ((await sendCommand("get_local_aliases", {"room_id": roomId}))["aliases"] as List?) ?.cast(), ); Future createAlias(String roomId, String alias) => - _sendCommand("create_alias", {"room_id": roomId, "alias": alias}); + sendCommand("create_alias", {"room_id": roomId, "alias": alias}); Future deleteAlias(String alias) => - _sendCommand("delete_alias", {"alias": alias}); + sendCommand("delete_alias", {"alias": alias}); Future getRoomPublished(String roomId) async => - (await _sendCommand("get_room_visibility", { + (await sendCommand("get_room_visibility", { "room_id": roomId, }))["visibility"] == "public"; - Future setRoomPublished(String roomId, bool published) => _sendCommand( + Future setRoomPublished(String roomId, bool published) => sendCommand( "publish_room", {"room_id": roomId, "visibility": published ? "public" : "private"}, ); @@ -517,7 +520,7 @@ class ClientController(final String? accountId) extends AsyncNotifier { String roomId, String version, { ISet additionalCreators = const .empty(), - }) async => (await _sendCommand("upgrade_room", { + }) async => (await sendCommand("upgrade_room", { "room_id": roomId, "new_version": version, if (additionalCreators.isNotEmpty) @@ -527,7 +530,7 @@ class ClientController(final String? accountId) extends AsyncNotifier { /// The room [alias] points to, or null if it doesn't exist. Future resolveAlias(String alias) async { try { - return (await _sendCommand("resolve_alias", {"alias": alias}))["room_id"]; + return (await sendCommand("resolve_alias", {"alias": alias}))["room_id"]; } on GomuksException catch (error) { if (error.statusCode == 404) return null; rethrow; @@ -535,14 +538,14 @@ class ClientController(final String? accountId) extends AsyncNotifier { } Future getSpecVersions() async => - .fromJson(await _sendCommand("get_versions")); + .fromJson(await sendCommand("get_versions")); Future getCapabilities() async => - .fromJson((await _sendCommand("get_capabilities"))["capabilities"]); + .fromJson((await sendCommand("get_capabilities"))["capabilities"]); Future discoverHomeserver(Uri homeserver) async { try { - final response = await _sendCommand("discover_homeserver", { + final response = await sendCommand("discover_homeserver", { "user_id": "@fake-user:${homeserver.authority}", }); return Uri.parse(response["m.homeserver"]?["base_url"]); diff --git a/lib/controllers/clock.dart b/lib/controllers/clock.dart new file mode 100644 index 0000000..f9fe690 --- /dev/null +++ b/lib/controllers/clock.dart @@ -0,0 +1,20 @@ +import "dart:async"; + +import "package:flutter_riverpod/flutter_riverpod.dart"; + +class ClockController extends Notifier { + @override + DateTime build() { + final timer = Timer.periodic( + const .new(seconds: 30), + (_) => state = .now(), + ); + ref.onDispose(timer.cancel); + return .now(); + } + + static final provider = + NotifierProvider.autoDispose( + ClockController.new, + ); +} diff --git a/lib/controllers/room_chat.dart b/lib/controllers/room_chat.dart index 773f30d..2a53a0d 100644 --- a/lib/controllers/room_chat.dart +++ b/lib/controllers/room_chat.dart @@ -295,6 +295,7 @@ class RoomChatController(final ChatParams info) : null, ), ); + if (!ref.mounted) return; if (response.events.isEmpty) { state = .data(chat); @@ -333,6 +334,7 @@ class RoomChatController(final ChatParams info) : chat!.historicalData!.start, ), ); + if (!ref.mounted) return; ref .read(RoomsController.provider.notifier) @@ -345,6 +347,7 @@ class RoomChatController(final ChatParams info) final rootRowId = direction == .backward ? await threadRootBefore(paginationResponse) : null; + if (!ref.mounted) return; final eventRowIds = [ ?rootRowId, ...(direction == .forward @@ -383,6 +386,7 @@ class RoomChatController(final ChatParams info) ); } } catch (_) { + if (!ref.mounted) return; state = .data(chat); rethrow; } diff --git a/lib/helpers/current_location_helper.dart b/lib/helpers/current_location_helper.dart index dbdb9e8..06f22d8 100644 --- a/lib/helpers/current_location_helper.dart +++ b/lib/helpers/current_location_helper.dart @@ -2,7 +2,7 @@ import "dart:async"; import "dart:io"; import "package:flutter_riverpod/flutter_riverpod.dart"; -import "package:geolocator/geolocator.dart"; +import "package:location/location.dart"; import "package:latlong2/latlong.dart"; import "package:nexus/controllers/portal.dart"; import "package:nexus/models/location_exception.dart"; @@ -13,7 +13,7 @@ class CurrentLocationHelper(final Ref ref) { /// The user's location and its accuracy in meters, or null if [askPermission] /// is off and they haven't allowed it. Future<(LatLng, double?)?> get({required bool askPermission}) async { - // geolocator talks to GeoClue directly, which Flatpak's sandbox blocks, so + // location talks to GeoClue directly, which Flatpak's sandbox blocks, so // Linux uses the location portal, which also asks the user for permission if (Platform.isLinux) { // The portal can't say whether it's allowed without asking @@ -40,40 +40,36 @@ class CurrentLocationHelper(final Ref ref) { } } - if (!await Geolocator.isLocationServiceEnabled()) { + final location = Location.instance; + if (!await location.serviceEnabled()) { if (!askPermission) return null; throw LocationException.servicesOff; } - var permission = await Geolocator.checkPermission(); + var permission = await location.hasPermission(); if (permission == .denied && askPermission) { - permission = await Geolocator.requestPermission(); + permission = await location.requestPermission(); } if (permission == .denied || permission == .deniedForever) { if (!askPermission) return null; throw LocationException.denied; } - Position? position; + LocationData? data; try { - position = await Geolocator.getCurrentPosition( - locationSettings: Platform.isAndroid - // Play services' location can hang without Google, like on microG, - // so this uses Android's own, as other apps do - ? AndroidSettings(forceLocationManager: true, timeLimit: _timeLimit) - : const LocationSettings(timeLimit: _timeLimit), - ); + data = await location.getLocation().timeout(_timeLimit); } on TimeoutException { // A fix can take long indoors, but another app may have a recent one - position = await Geolocator.getLastKnownPosition( - forceAndroidLocationManager: true, + data = await location.getLastKnownLocation().onError( + (_, _) => throw LocationException.failed, ); } catch (_) { throw LocationException.failed; } - if (position == null) throw LocationException.timedOut; - return (LatLng(position.latitude, position.longitude), position.accuracy); + if (data == null) throw LocationException.timedOut; + + return (LatLng(data.latitude, data.longitude), data.accuracy); } static final provider = Provider( diff --git a/lib/helpers/hooks/chat_scroll.dart b/lib/helpers/hooks/chat_scroll.dart index 84b4043..77d688a 100644 --- a/lib/helpers/hooks/chat_scroll.dart +++ b/lib/helpers/hooks/chat_scroll.dart @@ -162,6 +162,8 @@ final class ChatScroll({ await paginate(.forward); } + if (!hookContext.mounted || !scrollController.hasClients) return; + if (!isHistorical && position.extentBefore <= 0) await markRead(); if (controllerData.isLoading == false && diff --git a/lib/helpers/launch_helper.dart b/lib/helpers/launch_helper.dart index 89c7015..82f1806 100644 --- a/lib/helpers/launch_helper.dart +++ b/lib/helpers/launch_helper.dart @@ -1,17 +1,30 @@ import "package:flutter/services.dart"; import "package:flutter_riverpod/flutter_riverpod.dart"; +import "package:material_ui/material_ui.dart"; +import "package:nexus/helpers/extensions/show_error_snack_bar.dart"; +import "package:nexus/main.dart"; import "package:url_launcher/url_launcher.dart" as ul; class LaunchHelper(Ref ref) { Future launchUrl(Uri url, {bool useWebview = false}) async { - try { - return await ul.launchUrl( - url, - mode: useWebview ? .inAppBrowserView : .externalApplication, + final launched = await ul + .launchUrl( + url, + mode: useWebview ? .inAppBrowserView : .externalApplication, + ) + .catchError((_) => false, test: (error) => error is PlatformException); + + if (navigatorKey.currentContext case final context? + when !launched && context.mounted) { + ScaffoldMessenger.of(context).showErrorSnackBar( + "Couldn't open $url. Is there a browser installed?", + action: ( + label: "Copy link", + onPressed: () => Clipboard.setData(.new(text: url.toString())), + ), ); - } on PlatformException catch (_) { - return false; } + return launched; } static final provider = Provider(LaunchHelper.new); diff --git a/lib/helpers/mxc_image.dart b/lib/helpers/mxc_image.dart index 4013397..d82d485 100644 --- a/lib/helpers/mxc_image.dart +++ b/lib/helpers/mxc_image.dart @@ -1,6 +1,7 @@ import "dart:async"; import "dart:io"; import "dart:isolate"; +import "dart:typed_data"; import "dart:ui" as ui; import "package:avif_native/avif_native.dart"; @@ -20,20 +21,28 @@ class MxcImage(final WidgetRef ref, final DownloadMediaRequest request) MultiFrameImageStreamCompleter(codec: _loadAsync(decode), scale: 1.0); Future _loadAsync(ImageDecoderCallback decode) async { - final file = await ref - .read(ClientController.provider.notifier) - .downloadMedia(request); - final bytes = await File(file.path).readAsBytes(); + try { + final file = await ref + .read(ClientController.provider.notifier) + .downloadMedia(request); + final bytes = await File(file.path).readAsBytes(); - // Flutter can't decode AVIF on Linux/Windows (or older Android/iOS), so we do it ourselves - if (String.fromCharCodes(bytes.skip(4).take(8)) - case "ftypavif" || "ftypavis") { - return AvifCodec(await Isolate.run(() => decodeAvif(bytes))); + // Flutter can't decode AVIF on Linux/Windows (or older Android/iOS), so we do it ourselves + if (String.fromCharCodes(bytes.skip(4).take(8)) + case "ftypavif" || "ftypavis") { + return AvifCodec(await _decodeAvifInIsolate(bytes)); + } + + return await decode(await .fromUint8List(bytes)); + } catch (_) { + scheduleMicrotask(() => PaintingBinding.instance.imageCache.evict(this)); + rethrow; } - - return decode(await .fromUint8List(bytes)); } + static Future _decodeAvifInIsolate(Uint8List bytes) => + Isolate.run(() => decodeAvif(bytes)); + @override bool operator ==(Object other) => other is MxcImage && other.request == request; diff --git a/lib/main.dart b/lib/main.dart index 590c74d..299e95a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -4,7 +4,6 @@ import "package:dynamic_color/dynamic_color.dart"; import "package:flutter/foundation.dart"; import "package:flutter_riverpod/flutter_riverpod.dart"; import "package:material_emoji_picker/material_emoji_picker.dart"; -import "package:media_kit/media_kit.dart"; import "package:nexus/controllers/active_account.dart"; import "package:nexus/controllers/client.dart"; import "package:nexus/controllers/client_state.dart"; @@ -46,7 +45,11 @@ New Value: ${newValue is AsyncData ? newValue.value : newValue} } void showError(Object error, [StackTrace? stackTrace]) { - if (error.toString().contains("'_nextFrame != null': is not true.")) { + // Harmless Flutter race in animated images (the assert in debug, a null check in release) + if (error.toString().contains("'_nextFrame != null': is not true.") || + stackTrace.toString().contains( + "MultiFrameImageStreamCompleter._handleAppFrame", + )) { return; } @@ -65,7 +68,6 @@ void showError(Object error, [StackTrace? stackTrace]) { void main(List args) async { WidgetsFlutterBinding.ensureInitialized(); - MediaKit.ensureInitialized(); LicenseRegistry.addLicense(() => .fromIterable(fontLicenses)); diff --git a/lib/models/configs/author.dart b/lib/models/configs/author.dart new file mode 100644 index 0000000..a3a15e9 --- /dev/null +++ b/lib/models/configs/author.dart @@ -0,0 +1,19 @@ +import "package:freezed_annotation/freezed_annotation.dart"; +import "package:nexus/models/event.dart"; + +part "author.freezed.dart"; + +@freezed +class const AuthorConfig({ + required final String roomId, + required final String userId, + final Uri? avatarUrl, + final String? displayName, +}) with _$AuthorConfig { + factory AuthorConfig.fromEvent(Event event) => .new( + roomId: event.roomId, + userId: event.sender, + avatarUrl: event.pmp?.avatarUrl, + displayName: event.pmp?.displayName, + ); +} diff --git a/lib/models/homeserver.dart b/lib/models/homeserver.dart index 5504941..ca1a271 100644 --- a/lib/models/homeserver.dart +++ b/lib/models/homeserver.dart @@ -1,4 +1,5 @@ import "package:freezed_annotation/freezed_annotation.dart"; +import "package:material_ui/material_ui.dart"; part "homeserver.freezed.dart"; @@ -7,5 +8,5 @@ class const Homeserver({ required final String name, required final String description, required final Uri url, - required final String iconUrl, + required final Widget icon, }) with _$Homeserver; diff --git a/lib/widgets/account_scope.dart b/lib/widgets/account_scope.dart index 3f89b4b..ff8db09 100644 --- a/lib/widgets/account_scope.dart +++ b/lib/widgets/account_scope.dart @@ -1,5 +1,6 @@ import "package:flutter_hooks/flutter_hooks.dart"; import "package:flutter_riverpod/flutter_riverpod.dart"; +import "package:flutter_riverpod/misc.dart"; import "package:material_ui/material_ui.dart"; import "package:nexus/controllers/active_account.dart"; import "package:nexus/controllers/notification_request.dart"; @@ -11,6 +12,9 @@ class const AccountScope({ required final Widget child, final List? observers, final Duration? Function(int retryCount, Object error)? retry, + + /// Applied to each account's scope, after its own, e.g. for test fakes + final List overrides = const [], super.key, }) extends HookWidget { @override @@ -34,6 +38,7 @@ class const AccountScope({ NotificationRequestController.provider.overrideWithBuild( (_, _) => active.value.notificationRowId, ), + ...overrides, ], child: child, ); diff --git a/lib/widgets/avatars/avatar_or_hash.dart b/lib/widgets/avatars/avatar_or_hash.dart index bdaf657..bb14c78 100644 --- a/lib/widgets/avatars/avatar_or_hash.dart +++ b/lib/widgets/avatars/avatar_or_hash.dart @@ -12,9 +12,18 @@ final class const AvatarOrHash( }) extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { + final color = ColorHash(title).color; final box = ColoredBox( - color: ColorHash(title).color, - child: Center(child: Icon(Icons.person, size: dimension / 2)), + color: color, + child: Center( + child: Icon( + Icons.person, + size: dimension / 2, + color: ThemeData.estimateBrightnessForColor(color) == .dark + ? Colors.white + : Colors.black, + ), + ), ); return SizedBox( diff --git a/lib/widgets/common/sync_status_banner.dart b/lib/widgets/common/sync_status_banner.dart index 4199866..0eccff3 100644 --- a/lib/widgets/common/sync_status_banner.dart +++ b/lib/widgets/common/sync_status_banner.dart @@ -1,5 +1,6 @@ import "package:hooks_riverpod/hooks_riverpod.dart"; import "package:material_ui/material_ui.dart"; +import "package:nexus/controllers/clock.dart"; import "package:nexus/controllers/sync_status.dart"; import "package:nexus/widgets/common/error_dialog.dart"; import "package:timeago/timeago.dart"; @@ -38,7 +39,7 @@ class const SyncStatusBanner({super.key}) extends ConsumerWidget { ?status.error, if (status.errorCount > 0) "Failed attempts: ${status.errorCount}.", if (status.lastSync case final lastSync?) - "Last synced ${format(lastSync)}.", + "Last synced ${format(lastSync, clock: ref.watch(ClockController.provider))}.", ]; return AnimatedSize( diff --git a/lib/widgets/common/timestamp.dart b/lib/widgets/common/timestamp.dart index bc9db74..2f7a2fc 100644 --- a/lib/widgets/common/timestamp.dart +++ b/lib/widgets/common/timestamp.dart @@ -1,13 +1,15 @@ +import "package:hooks_riverpod/hooks_riverpod.dart"; import "package:material_ui/material_ui.dart"; +import "package:nexus/controllers/clock.dart"; import "package:timeago/timeago.dart"; class const Timestamp(final DateTime timestamp, {super.key}) - extends StatelessWidget { + extends ConsumerWidget { @override - Widget build(BuildContext context) => Tooltip( + Widget build(BuildContext context, WidgetRef ref) => Tooltip( message: timestamp.toString(), child: Text( - format(timestamp), + format(timestamp, clock: ref.watch(ClockController.provider)), maxLines: 1, overflow: .ellipsis, style: Theme.of(context).textTheme.labelSmall diff --git a/lib/widgets/composer/composer.dart b/lib/widgets/composer/composer.dart index 4c3caf6..3b722e0 100644 --- a/lib/widgets/composer/composer.dart +++ b/lib/widgets/composer/composer.dart @@ -33,6 +33,8 @@ import "package:nexus/controllers/power_level.dart"; import "package:nexus/controllers/image_packs.dart"; import "package:nexus/models/content/image_pack.dart"; import "package:nexus/models/content/message.dart"; +import "package:nexus/widgets/renderers/message_media.dart"; +import "package:nexus/helpers/extensions/is_media.dart"; import "package:nexus/models/content/poll_start.dart"; import "package:nexus/models/image_pack.dart"; import "package:nexus/widgets/emoji/mxc_emoji.dart"; @@ -482,19 +484,47 @@ class const Composer( if (attachment != null) Card( margin: .only(bottom: 8), - child: ListTile( - leading: attachment.$2 == null - ? SizedBox( + child: Column( + children: [ + ListTile( + leading: switch (attachment.$2) { + null => SizedBox( width: 16, height: 16, child: CircularProgressIndicator(), - ) - : Icon(Icons.file_copy), - title: Text(attachment.$1), - trailing: IconButton( - onPressed: () => ref.invalidate(attachmentProvider), - icon: Icon(Icons.close), - ), + ), + ImageMessageContent() => Icon(Icons.image), + VideoMessageContent() => Icon(Icons.movie), + AudioMessageContent() => Icon(Icons.audiotrack), + _ => Icon(Icons.file_copy), + }, + title: Text(attachment.$1), + trailing: IconButton( + onPressed: () => ref.invalidate(attachmentProvider), + icon: Icon(Icons.close), + ), + ), + AnimatedSize( + duration: Durations.short4, + alignment: .topCenter, + child: switch (attachment.$2) { + final content? + when content is! FileMessageContent && + content.isMedia => + Padding( + padding: EdgeInsets.all(12).copyWith(top: 0), + child: Align( + alignment: .centerLeft, + child: ConstrainedBox( + constraints: .loose(.square(300)), + child: MessageMedia(content), + ), + ), + ), + _ => SizedBox(width: .infinity), + }, + ), + ], ), ), AnimatedSize( @@ -804,6 +834,21 @@ class const Composer( controller.addTag(id: id, name: name); node?.requestFocus(); }, + insertText: (text) { + final end = + controller.selection.baseOffset; + controller + ..dismissOverlay() + ..value = controller.value.replaced( + .new( + start: + end - query.value.length - 1, + end: end, + ), + "$text ", + ); + node?.requestFocus(); + }, ), controller: controller, onSearch: (newQuery, newTriggerCharacter) { diff --git a/lib/widgets/composer/overlays/emoji_overlay.dart b/lib/widgets/composer/overlays/emoji_overlay.dart index bb4b88f..6f9c15f 100644 --- a/lib/widgets/composer/overlays/emoji_overlay.dart +++ b/lib/widgets/composer/overlays/emoji_overlay.dart @@ -12,6 +12,7 @@ class const EmojiOverlay( required final String roomId, required final void Function({required String id, required String name}) addTag, + required final void Function(String text) insertText, super.key, }) extends ConsumerWidget { @override @@ -38,19 +39,19 @@ class const EmojiOverlay( ), title: Text(emoji.aliases.first), subtitle: Text(emoji.description), - onTap: () => addTag( - id: emoji.value.startsWith("mxc://") - ? ImagePack.emojiMarkdown( + onTap: () => emoji.value.startsWith("mxc://") + ? addTag( + id: ImagePack.emojiMarkdown( emoji.aliases.first, emoji.value, description: switch (emoji.data) { PackImage(:final body) => body, _ => null, }, - ) - : emoji.value, - name: emoji.aliases.first, - ), + ), + name: emoji.aliases.first, + ) + : insertText(emoji.value), ), ) .toList(), diff --git a/lib/widgets/composer/overlays/tagger_overlay.dart b/lib/widgets/composer/overlays/tagger_overlay.dart index f760e01..e32a328 100644 --- a/lib/widgets/composer/overlays/tagger_overlay.dart +++ b/lib/widgets/composer/overlays/tagger_overlay.dart @@ -10,6 +10,7 @@ class const TaggerOverlay( required final String roomId, required final void Function({required String id, required String name}) addTag, + required final void Function(String text) insertText, required final String? triggerCharacter, super.key, }) extends ConsumerWidget { @@ -27,7 +28,12 @@ class const TaggerOverlay( child: switch (triggerCharacter) { "@" => UserOverlay(query, roomId: roomId, addTag: addTag), "#" => RoomOverlay(query, addTag: addTag), - ":" => EmojiOverlay(query, roomId: roomId, addTag: addTag), + ":" => EmojiOverlay( + query, + roomId: roomId, + addTag: addTag, + insertText: insertText, + ), _ => Loading(), }, diff --git a/lib/widgets/composer/overlays/user_overlay.dart b/lib/widgets/composer/overlays/user_overlay.dart index eec15f5..845fb3a 100644 --- a/lib/widgets/composer/overlays/user_overlay.dart +++ b/lib/widgets/composer/overlays/user_overlay.dart @@ -41,7 +41,7 @@ class const UserOverlay( title: Text(displayName ?? member.stateKey!.localpart), subtitle: Text(member.stateKey!), onTap: () => addTag( - id: "[@$displayName](matrix:u/${member.stateKey!.substring(1)})", + id: "[@${displayName ?? member.stateKey!.localpart}](matrix:u/${member.stateKey!.substring(1)})", name: member.stateKey!.localpart, ), ), diff --git a/lib/widgets/lazy_loading/message_avatar.dart b/lib/widgets/lazy_loading/message_avatar.dart index 95f987f..80a1101 100644 --- a/lib/widgets/lazy_loading/message_avatar.dart +++ b/lib/widgets/lazy_loading/message_avatar.dart @@ -13,7 +13,7 @@ class const MessageAvatar( }) extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) => - switch (ref.watch(AuthorController.provider(event))) { + switch (ref.watch(AuthorController.provider(.fromEvent(event)))) { AsyncData(:final value) || AsyncLoading(:final value?) => InkWell( onTap: () => context.showUserPopover(event.sender, roomId: event.roomId), diff --git a/lib/widgets/lazy_loading/message_displayname.dart b/lib/widgets/lazy_loading/message_displayname.dart index d7c91bd..0f68ac5 100644 --- a/lib/widgets/lazy_loading/message_displayname.dart +++ b/lib/widgets/lazy_loading/message_displayname.dart @@ -18,7 +18,7 @@ class const MessageDisplayname( Widget build(BuildContext context, WidgetRef ref) { final color = ref.displaynameColor(event.roomId, event.sender); - return switch (ref.watch(AuthorController.provider(event))) { + return switch (ref.watch(AuthorController.provider(.fromEvent(event)))) { AsyncData(:final MembershipContent? value) || AsyncLoading(:final value) || AsyncError(:final value) => InkWell( diff --git a/lib/widgets/pages/select_server.dart b/lib/widgets/pages/select_server.dart index a44e4b8..a3102e6 100644 --- a/lib/widgets/pages/select_server.dart +++ b/lib/widgets/pages/select_server.dart @@ -48,7 +48,7 @@ class const SelectServerPage({super.key}) extends HookConsumerWidget { Future tryLogin(Uri url) async { final OAuthAuthCodeResponse codeResponse; try { - codeResponse = await ref.watch( + codeResponse = await ref.read( AuthUrlController.provider(url).future, ); } on GomuksException catch (error) { @@ -190,31 +190,34 @@ class const SelectServerPage({super.key}) extends HookConsumerWidget { name: "Matrix.org", description: "The Matrix.org Foundation offers the matrix.org homeserver as an easy entry point for anyone wanting to try out Matrix.", url: .https("matrix.org"), - iconUrl: - "https://raw.githubusercontent.com/element-hq/logos/refs/heads/master/matrix/matrix-favicon${Theme.brightnessOf(context) == Brightness.dark ? "-white" : ""}.png", + icon: SvgPicture.asset( + "assets/bundled/matrix.svg", + colorFilter: .mode(theme.colorScheme.onSurface, .srcIn), + ), ), .new( name: "Federated Nexus", description: "Federated Nexus is a community resource hosting multiple FOSS (especially federated) services, including Matrix and Forgejo. By the same developers who made Nexus client.", url: .https("federated.nexus"), - iconUrl: "https://federated.nexus/images/icon.png", + icon: SvgPicture.asset( + "assets/bundled/federated_nexus.svg", + ), ), // TODO: Add back unredacted when they have MAS, find where new favicon is // .new( // name: "Unredacted", // description: "Unredacted is a 501(c)(3) non-profit organization that builds Internet infrastructure and services to help people evade censorship and protect their right to privacy.", // url: .https("unredacted.org", "services/si/matrix"), - // iconUrl: "https://unredacted.org/favicon.ico", + // icon: Image.network("https://unredacted.org/favicon.ico"), // ), ].map( (homeserver) => Card( child: ListTile( enabled: !isLoading.value, title: Text(homeserver.name), - leading: Image.network( - homeserver.iconUrl, - errorBuilder: (_, _, _) => SizedBox.shrink(), - height: 32, + leading: SizedBox.square( + dimension: 32, + child: homeserver.icon, ), subtitle: Text(homeserver.description), onTap: isLoading.value diff --git a/lib/widgets/players/audio.dart b/lib/widgets/players/audio.dart index 898e89b..f29955b 100644 --- a/lib/widgets/players/audio.dart +++ b/lib/widgets/players/audio.dart @@ -1,9 +1,9 @@ import "dart:async"; +import "package:audioplayers/audioplayers.dart" as audioplayers; import "package:material_ui/material_ui.dart"; import "package:flutter_hooks/flutter_hooks.dart"; import "package:hooks_riverpod/hooks_riverpod.dart"; -import "package:media_kit/media_kit.dart"; import "package:nexus/controllers/client.dart"; import "package:nexus/helpers/extensions/save_attachment.dart"; import "package:nexus/models/info/audio.dart"; @@ -18,10 +18,9 @@ class const AudioPlayer( }) extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final player = useMemoized( - () => Player(configuration: .new(bufferSize: 128 * 1024 * 1024)), - ); + final player = useMemoized(audioplayers.AudioPlayer.new); final loaded = useState(false); + final unsupported = useState(false); useEffect(() { scheduleMicrotask(() async { @@ -29,35 +28,84 @@ class const AudioPlayer( .read(ClientController.provider.notifier) .downloadMedia(.new(mxc: uri, encrypted: encrypted)); if (!context.mounted) return; - await player.open(Media(audio.path), play: false); + // Keeps the audio loaded after it finishes, so it can be replayed + await player.setReleaseMode(.stop); + try { + // AVFoundation needs the format, since gomuks caches files without an extension + await player.setSource( + audioplayers.DeviceFileSource(audio.path, mimeType: info?.mimeType), + ); + } on Exception catch (_) { + // The platform can't play this format, like Ogg on Apple platforms or MIDI on Linux + if (context.mounted) unsupported.value = true; + return; + } if (context.mounted) loaded.value = true; }); return player.dispose; }, []); + final state = + useStream( + player.onPlayerStateChanged, + initialData: player.state, + ).data ?? + player.state; + final position = + useStream(player.onPositionChanged, initialData: Duration.zero).data ?? + Duration.zero; + final duration = + useStream(player.onDurationChanged, initialData: Duration.zero).data ?? + Duration.zero; + final playing = state == .playing; + + final downloadButton = IconButton( + onPressed: () => context.saveAttachment( + ref, + uri, + encrypted: encrypted, + filename: filename, + ), + tooltip: "Download", + icon: Icon(Icons.download), + ); + return Card( color: Theme.of(context).colorScheme.surfaceContainerHigh, child: Padding( padding: .symmetric(horizontal: 8), - child: PlayerControls( - player, - loading: !loaded.value, - size: info?.size, - actions: .new([ - SizedBox(width: 4), - IconButton( - onPressed: () => context.saveAttachment( - ref, - uri, - encrypted: encrypted, - filename: filename, + child: unsupported.value + ? Row( + children: [ + Padding( + padding: .all(12), + child: Icon( + Icons.music_off, + color: Theme.of(context).colorScheme.error, + ), + ), + Expanded( + child: Text( + "Can't play this audio format", + style: Theme.of(context).textTheme.bodySmall?.copyWith( + color: Theme.of(context).colorScheme.error, + ), + ), + ), + downloadButton, + ], + ) + : PlayerControls( + playing: playing, + position: position, + duration: duration, + onPlayPause: playing ? player.pause : player.resume, + onSeek: player.seek, + loading: !loaded.value, + size: info?.size, + actions: .new([SizedBox(width: 4), downloadButton]), ), - tooltip: "Download", - icon: Icon(Icons.download), - ), - ]), - ), ), ); } diff --git a/lib/widgets/players/player_controls.dart b/lib/widgets/players/player_controls.dart index 6f54afa..53a8c5b 100644 --- a/lib/widgets/players/player_controls.dart +++ b/lib/widgets/players/player_controls.dart @@ -1,39 +1,25 @@ import "dart:math"; import "package:fast_immutable_collections/fast_immutable_collections.dart"; -import "package:flutter_hooks/flutter_hooks.dart"; import "package:material_ui/material_ui.dart"; -import "package:media_kit/media_kit.dart"; import "package:nexus/helpers/extensions/size_to_string.dart"; -/// Play/pause, position and seeking controls for a media_kit [Player]. -class const PlayerControls( - final Player player, { +/// Play/pause, position and seeking controls, for any player. +class const PlayerControls({ + required final bool playing, + required final Duration position, + required final Duration duration, + required final VoidCallback onPlayPause, + required final ValueChanged onSeek, final bool loading = false, + final bool buffering = false, final Color? color, final int? size, final IList actions = const .empty(), super.key, -}) extends HookWidget { +}) extends StatelessWidget { @override Widget build(BuildContext context) { - final playing = useStream( - player.stream.playing, - initialData: player.state.playing, - ).requireData; - final buffering = useStream( - player.stream.buffering, - initialData: player.state.buffering, - ).requireData; - final position = useStream( - player.stream.position, - initialData: player.state.position, - ).requireData; - final duration = useStream( - player.stream.duration, - initialData: player.state.duration, - ).requireData; - String format(Duration duration) { final minutes = duration.inMinutes .remainder(60) @@ -61,7 +47,7 @@ class const PlayerControls( child: CircularProgressIndicator(padding: .all(12), color: color), ) : IconButton( - onPressed: player.playOrPause, + onPressed: onPlayPause, color: color, tooltip: playing ? "Pause" : "Play", icon: Icon(playing ? Icons.pause_circle : Icons.play_circle), @@ -73,7 +59,7 @@ class const PlayerControls( value: min(position.inMilliseconds.toDouble(), max), onChanged: loading ? null - : (value) => player.seek(.new(milliseconds: value.toInt())), + : (value) => onSeek(.new(milliseconds: value.toInt())), ); return LayoutBuilder( diff --git a/lib/widgets/players/video.dart b/lib/widgets/players/video.dart index 9a4bd26..053041a 100644 --- a/lib/widgets/players/video.dart +++ b/lib/widgets/players/video.dart @@ -1,13 +1,14 @@ import "dart:async"; +import "package:better_player/better_player.dart"; import "package:material_ui/material_ui.dart"; import "package:hooks_riverpod/hooks_riverpod.dart"; import "package:nexus/controllers/client.dart"; import "package:nexus/helpers/extensions/save_attachment.dart"; +import "package:mime/mime.dart"; import "package:nexus/models/info/video.dart"; +import "package:nexus/widgets/common/error_dialog.dart"; import "package:flutter_hooks/flutter_hooks.dart"; -import "package:media_kit/media_kit.dart"; -import "package:media_kit_video/media_kit_video.dart"; import "package:nexus/widgets/players/player_controls.dart"; class const VideoPlayer( @@ -19,11 +20,163 @@ class const VideoPlayer( }) extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final player = useMemoized( - () => Player(configuration: .new(bufferSize: 128 * 1024 * 1024)), - ); - final controller = useMemoized(() => VideoController(player)); + final aspectRatio = switch (info) { + VideoInfo(:final width?, :final height?) when width > 0 && height > 0 => + width / height, + _ => 16 / 9, + }; + final loaded = useState(false); + final controller = useMemoized( + () => BetterPlayerController( + PlayerConfiguration( + aspectRatio: aspectRatio, + fit: .contain, + controlsConfiguration: PlayerControlsConfiguration( + playerTheme: .custom, + customControlsBuilder: (controller, _) => HookBuilder( + builder: (context) { + final isLoaded = useValueListenable(loaded); + final value = useState(controller.videoPlayerValue); + useEffect(() { + void listener() => value.value = controller.videoPlayerValue; + controller.addVideoListener(listener); + return () => controller.removeVideoListener(listener); + }, [controller]); + + final playing = value.value?.isPlaying ?? false; + final ready = isLoaded && (value.value?.initialized ?? false); + final error = value.value?.errorDescription; + + // better_player doesn't use material_ui, so this Material is needed. + return Material( + type: .transparency, + child: Stack( + children: [ + Positioned.fill( + child: GestureDetector( + behavior: .opaque, + onTap: ready + ? playing + ? controller.pause + : controller.play + : null, + ), + ), + if (error != null) + Positioned.fill( + child: ColoredBox( + color: Colors.black54, + child: Center( + child: Column( + mainAxisSize: .min, + children: [ + Padding( + padding: .all(12), + child: Icon( + Icons.videocam_off, + color: Theme.of(context) + .colorScheme + .error, + ), + ), + Flexible( + child: Text( + "Can't play this video", + style: Theme.of(context) + .textTheme + .bodySmall + ?.copyWith( + color: Theme.of(context) + .colorScheme + .error, + ), + ), + ), + TextButton( + onPressed: () => showDialog( + context: context, + builder: (_) => ErrorDialog(error, null), + ), + child: Text("Show Error"), + ), + ], + ), + ), + ), + ), + Positioned( + top: 4, + right: 4, + child: IconButton( + onPressed: () => context.saveAttachment( + ref, + uri, + encrypted: encrypted, + filename: filename, + ), + color: Colors.white, + style: IconButton.styleFrom( + backgroundColor: Colors.black38, + ), + tooltip: "Download", + icon: Icon(Icons.download), + ), + ), + if (error == null) + Positioned( + left: 0, + right: 0, + bottom: 0, + child: DecoratedBox( + decoration: const BoxDecoration( + gradient: LinearGradient( + begin: .bottomCenter, + end: .topCenter, + colors: [Colors.black54, Colors.transparent], + ), + ), + child: Padding( + padding: const .only(left: 4, right: 4, top: 16), + child: PlayerControls( + playing: playing, + buffering: value.value?.isBuffering ?? false, + position: value.value?.position ?? .zero, + duration: value.value?.duration ?? .zero, + onPlayPause: playing + ? controller.pause + : controller.play, + onSeek: controller.seekTo, + loading: !ready, + size: info?.size, + color: Colors.white, + actions: .new([ + IconButton( + onPressed: controller.toggleFullScreen, + color: Colors.white, + tooltip: controller.isFullScreen + ? "Exit fullscreen" + : "Fullscreen", + icon: Icon( + controller.isFullScreen + ? Icons.fullscreen_exit + : Icons.fullscreen, + ), + ), + ]), + ), + ), + ), + ), + ], + ), + ); + }, + ), + ), + ), + ), + ); useEffect(() { scheduleMicrotask(() async { @@ -31,109 +184,31 @@ class const VideoPlayer( .read(ClientController.provider.notifier) .downloadMedia(.new(mxc: uri, encrypted: encrypted)); if (!context.mounted) return; - await player.open(Media(video.path), play: false); + await controller.setupDataSource( + .file( + video.path, + videoExtension: switch (info?.mimeType) { + final mimeType? => extensionFromMime(mimeType), + null => null, + }, + ), + ); + // better_player's mpv backend (Linux and Windows) starts playing as + // soon as it loads a file, despite autoPlay being off + await controller.pause(); if (context.mounted) loaded.value = true; }); - return player.dispose; + return null; }, []); - final controls = useCallback( - (VideoState _) => - // Until media_kit moves to material_ui, this Material is needed. - Material( - type: .transparency, - child: ValueListenableBuilder( - valueListenable: loaded, - builder: (_, loaded, _) => Stack( - children: [ - Positioned.fill( - child: GestureDetector( - behavior: .opaque, - onTap: loaded ? player.playOrPause : null, - ), - ), - Positioned( - top: 4, - right: 4, - child: IconButton( - onPressed: () => context.saveAttachment( - ref, - uri, - encrypted: encrypted, - filename: filename, - ), - color: Colors.white, - style: IconButton.styleFrom( - backgroundColor: Colors.black38, - ), - tooltip: "Download", - icon: Icon(Icons.download), - ), - ), - Positioned( - left: 0, - right: 0, - bottom: 0, - child: DecoratedBox( - decoration: const BoxDecoration( - gradient: LinearGradient( - begin: .bottomCenter, - end: .topCenter, - colors: [Colors.black54, Colors.transparent], - ), - ), - child: Padding( - padding: const .only(left: 4, right: 4, top: 16), - child: PlayerControls( - player, - loading: !loaded, - size: info?.size, - color: Colors.white, - actions: .new([ - Builder( - builder: (context) { - final fullscreen = isFullscreen(context); - - return IconButton( - onPressed: () => toggleFullscreen(context), - color: Colors.white, - tooltip: fullscreen - ? "Exit fullscreen" - : "Fullscreen", - icon: Icon( - fullscreen - ? Icons.fullscreen_exit - : Icons.fullscreen, - ), - ); - }, - ), - ]), - ), - ), - ), - ), - ], - ), - ), - ), - [uri, encrypted, filename, info], - ); - - final aspectRatio = switch (info) { - VideoInfo(:final width?, :final height?) when width > 0 && height > 0 => - width / height, - _ => 16 / 9, - }; - return ConstrainedBox( constraints: const .new(maxHeight: 300), child: AspectRatio( aspectRatio: aspectRatio, child: ClipRRect( borderRadius: .circular(12), - child: Video(controller: controller, controls: controls), + child: BetterPlayer(controller: controller), ), ), ); diff --git a/lib/widgets/renderers/event.dart b/lib/widgets/renderers/event.dart index 4e14fad..228abf6 100644 --- a/lib/widgets/renderers/event.dart +++ b/lib/widgets/renderers/event.dart @@ -525,10 +525,12 @@ class const EventRenderer( child: Row( spacing: 4, children: [ - Text( - event.sendError!, - style: theme.textTheme.labelSmall?.copyWith( - color: theme.colorScheme.error, + Flexible( + child: Text( + event.sendError!, + style: theme.textTheme.labelSmall?.copyWith( + color: theme.colorScheme.error, + ), ), ), InkWell( diff --git a/lib/widgets/renderers/message.dart b/lib/widgets/renderers/message.dart index 40ee5e7..655fc0d 100644 --- a/lib/widgets/renderers/message.dart +++ b/lib/widgets/renderers/message.dart @@ -12,7 +12,6 @@ import "package:nexus/models/location.dart"; import "package:nexus/models/content/poll_start.dart"; import "package:nexus/models/content/sticker.dart"; import "package:nexus/models/event.dart"; -import "package:nexus/widgets/renderers/file_card.dart"; import "package:nexus/widgets/html/html.dart"; import "package:nexus/widgets/lazy_loading/message_avatar.dart"; import "package:nexus/widgets/lazy_loading/message_displayname.dart"; @@ -24,8 +23,8 @@ import "package:nexus/widgets/reactions/reaction_row.dart"; import "package:nexus/widgets/common/timestamp.dart"; import "package:nexus/widgets/renderers/url_preview.dart"; import "package:nexus/widgets/renderers/event_preview.dart"; -import "package:nexus/widgets/players/video.dart"; -import "package:nexus/widgets/players/audio.dart"; +import "package:nexus/widgets/renderers/message_media.dart"; +import "package:nexus/helpers/extensions/is_media.dart"; import "package:nexus/widgets/renderers/poll.dart"; import "package:nexus/widgets/threads/thread_summary.dart"; @@ -125,63 +124,10 @@ class const MessageRenderer( ), if (!textOnly) ...[ - if (event.content - case ImageMessageContent(:final url) || - FileMessageContent(:final url) || - VideoMessageContent(:final url) || - AudioMessageContent(:final url)) + if (content.isMedia) ConstrainedBox( constraints: .loose(.square(500)), - child: switch (event.content) { - VideoMessageContent( - :final info, - :final file, - :final filename, - :final body, - ) => - VideoPlayer( - url, - info, - encrypted: file != null, - filename: filename ?? body, - ), - AudioMessageContent( - :final info, - :final file, - :final filename, - :final body, - ) => - AudioPlayer( - url, - info, - encrypted: file != null, - filename: filename ?? body, - ), - FileMessageContent( - :final info, - :final filename, - :final file, - ) => - FileCard( - url, - info, - filename: filename, - encrypted: file != null, - ), - ImageMessageContent( - :final info, - :final file, - :final filename, - :final body, - ) => - MessageImage( - url, - info: info, - encrypted: file != null, - filename: filename ?? body, - ), - _ => SizedBox.shrink(), - }, + child: MessageMedia(content), ), if (event.lastEditRowId != 0) @@ -197,12 +143,18 @@ class const MessageRenderer( UnknownMessageContent(:final body) => body == null ? Text("This message is redacted", style: errorStyle) - : Wrap( - spacing: 8, - children: [ - Text("Unknown message type:", style: errorStyle), - Text(body), - ], + : Text.rich( + TextSpan( + children: [ + TextSpan( + text: "Unknown message type: ", + style: errorStyle, + ), + TextSpan(text: body), + ], + ), + maxLines: maxLines, + overflow: maxLines == null ? null : .ellipsis, ), }, _ => throw Exception("This is impossible"), diff --git a/lib/widgets/renderers/message_media.dart b/lib/widgets/renderers/message_media.dart new file mode 100644 index 0000000..1f7e6b9 --- /dev/null +++ b/lib/widgets/renderers/message_media.dart @@ -0,0 +1,55 @@ +import "package:material_ui/material_ui.dart"; +import "package:nexus/models/content/message.dart"; +import "package:nexus/widgets/players/audio.dart"; +import "package:nexus/widgets/players/video.dart"; +import "package:nexus/widgets/renderers/file_card.dart"; +import "package:nexus/widgets/renderers/message_image.dart"; + +final class const MessageMedia(final MessageContent content, {super.key}) + extends StatelessWidget { + @override + Widget build(BuildContext context) => switch (content) { + VideoMessageContent( + :final url, + :final info, + :final file, + :final filename, + :final body, + ) => + VideoPlayer( + url, + info, + encrypted: file != null, + filename: filename ?? body, + ), + AudioMessageContent( + :final url, + :final info, + :final file, + :final filename, + :final body, + ) => + AudioPlayer( + url, + info, + encrypted: file != null, + filename: filename ?? body, + ), + FileMessageContent(:final url, :final info, :final filename, :final file) => + FileCard(url, info, filename: filename, encrypted: file != null), + ImageMessageContent( + :final url, + :final info, + :final file, + :final filename, + :final body, + ) => + MessageImage( + url, + info: info, + encrypted: file != null, + filename: filename ?? body, + ), + _ => SizedBox.shrink(), + }; +} diff --git a/lib/widgets/room_chat/banned_warning_dialog.dart b/lib/widgets/room_chat/banned_warning_dialog.dart new file mode 100644 index 0000000..5beeaae --- /dev/null +++ b/lib/widgets/room_chat/banned_warning_dialog.dart @@ -0,0 +1,21 @@ +import "package:material_ui/material_ui.dart"; + +class const BannedWarningDialog({super.key}) extends StatelessWidget { + @override + Widget build(BuildContext context) => AlertDialog( + title: Text("View Banned Members?"), + content: Text( + "Banned members may have offensive or abusive display names and avatars.", + ), + actions: [ + TextButton( + onPressed: () => Navigator.of(context).pop(false), + child: Text("Cancel"), + ), + TextButton( + onPressed: () => Navigator.of(context).pop(true), + child: Text("Continue and don't show again"), + ), + ], + ); +} diff --git a/lib/widgets/room_chat/member_list.dart b/lib/widgets/room_chat/member_list.dart index bf86b9c..a967075 100644 --- a/lib/widgets/room_chat/member_list.dart +++ b/lib/widgets/room_chat/member_list.dart @@ -4,6 +4,7 @@ import "package:flutter_hooks/flutter_hooks.dart"; import "package:hooks_riverpod/hooks_riverpod.dart"; import "package:m3e_buttons/m3e_buttons.dart"; import "package:m3e_card_list/m3e_card_list.dart"; +import "package:nexus/controllers/banned_warning_dismissed.dart"; import "package:nexus/controllers/members_by_status.dart"; import "package:nexus/controllers/members_grouped.dart"; import "package:nexus/helpers/extensions/get_localpart.dart"; @@ -13,6 +14,7 @@ import "package:nexus/models/content/membership.dart"; import "package:nexus/models/membership_status.dart"; import "package:nexus/widgets/avatars/avatar_or_hash.dart"; import "package:nexus/widgets/common/divider_text.dart"; +import "package:nexus/widgets/room_chat/banned_warning_dialog.dart"; import "package:nexus/widgets/common/error_dialog.dart"; import "package:nexus/widgets/common/loading.dart"; @@ -40,8 +42,26 @@ class const MemberList(final String roomId, {super.key}) padding: .all(8), child: M3EToggleButtonGroup( selectedIndex: statusIndex.value, - onSelectedIndexChanged: (index) => - statusIndex.value = index ?? statusIndex.value, + onSelectedIndexChanged: (index) async { + if (index == null) return; + if (options.values.toIList()[index] == .ban && + !await ref.read( + BannedWarningDismissedController.provider.future, + )) { + if (!context.mounted) return; + final confirmed = await showDialog( + context: context, + builder: (_) => BannedWarningDialog(), + ); + if (confirmed != true) return; + await ref + .read( + BannedWarningDismissedController.provider.notifier, + ) + .set(true); + } + statusIndex.value = index; + }, actions: options .mapTo( (name, value) => M3EToggleButtonGroupAction( diff --git a/lib/widgets/room_chat/room_chat.dart b/lib/widgets/room_chat/room_chat.dart index 929be84..8a29c38 100644 --- a/lib/widgets/room_chat/room_chat.dart +++ b/lib/widgets/room_chat/room_chat.dart @@ -20,6 +20,7 @@ import "package:nexus/widgets/threads/threads_drawer.dart"; import "package:nexus/widgets/room_chat/chat_body.dart"; import "package:nexus/helpers/extensions/build_event_options.dart"; import "package:nexus/controllers/jump_request.dart"; +import "package:nexus/main.dart"; final class const RoomChat({ required final String? roomId, @@ -202,10 +203,14 @@ final class const RoomChat({ isDesktop: isDesktop, onOpenDrawer: Scaffold.of(context).openDrawer, onOpenMemberList: (thisContext) { + if (!showMembersByDefault) { + return Scaffold.of(thisContext).openEndDrawer(); + } + ref .read(MemberListOpenedController.provider.notifier) - .set(!memberListOpened); - Scaffold.of(thisContext).openEndDrawer(); + .set(!memberListOpened) + .onError(showError); }, onOpenPinnedMessagesList: Scaffold.of(middleContext) .openEndDrawer, diff --git a/lib/widgets/users/user_span.dart b/lib/widgets/users/user_span.dart index c131a82..d8a305c 100644 --- a/lib/widgets/users/user_span.dart +++ b/lib/widgets/users/user_span.dart @@ -10,28 +10,32 @@ import "package:nexus/models/event.dart"; /// A user's [name] in text, opening their popover when tapped. Unlike a widget /// in text, it wraps and ellipsizes with the rest of it. -class UserSpan extends TextSpan { - UserSpan( - BuildContext context, - String name, { - required String userId, - required TapGestureRecognizer recognizer, - String? roomId, - super.style, - super.children, - }) : super( - text: name, - recognizer: recognizer - ..onTapUp = (details) { - if (!context.mounted) return; - context.showUserPopover( - userId, - roomId: roomId, - anchor: context.globalRectAt(details.globalPosition), - ); - }, - ); +// Can't be const, since it sets the recognizer's onTapUp +// ignore: prefer_const_constructors_in_immutables +class UserSpan( + BuildContext context, + String name, { + required String userId, + required TapGestureRecognizer recognizer, + String? roomId, + super.style, + super.children, +}) extends TextSpan { + this + : super( + text: name, + recognizer: recognizer + ..onTapUp = (details) { + if (!context.mounted) return; + + context.showUserPopover( + userId, + roomId: roomId, + anchor: context.globalRectAt(details.globalPosition), + ); + }, + ); factory UserSpan.sender( BuildContext context, @@ -43,7 +47,7 @@ class UserSpan extends TextSpan { return UserSpan( context, - ref.watch(AuthorController.provider(event)).value?.displayName ?? + ref.watch(AuthorController.provider(.fromEvent(event))).value?.displayName ?? event.sender.localpart, userId: event.sender, roomId: event.roomId, diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index 077376d..955bc02 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -7,10 +7,11 @@ #include "generated_plugin_registrant.h" #include +#include +#include #include #include -#include -#include +#include #include #include @@ -18,18 +19,21 @@ void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) app_links_linux_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "AppLinksPluginLinux"); app_links_plugin_linux_register_with_registrar(app_links_linux_registrar); + g_autoptr(FlPluginRegistrar) audioplayers_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "AudioplayersLinuxPlugin"); + audioplayers_linux_plugin_register_with_registrar(audioplayers_linux_registrar); + g_autoptr(FlPluginRegistrar) better_player_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "BetterPlayerLinuxPlugin"); + better_player_linux_plugin_register_with_registrar(better_player_linux_registrar); g_autoptr(FlPluginRegistrar) dynamic_color_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin"); dynamic_color_plugin_register_with_registrar(dynamic_color_registrar); g_autoptr(FlPluginRegistrar) file_selector_linux_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin"); file_selector_plugin_register_with_registrar(file_selector_linux_registrar); - g_autoptr(FlPluginRegistrar) media_kit_libs_linux_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "MediaKitLibsLinuxPlugin"); - media_kit_libs_linux_plugin_register_with_registrar(media_kit_libs_linux_registrar); - g_autoptr(FlPluginRegistrar) media_kit_video_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "MediaKitVideoPlugin"); - media_kit_video_plugin_register_with_registrar(media_kit_video_registrar); + g_autoptr(FlPluginRegistrar) location_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "LocationPlugin"); + location_plugin_register_with_registrar(location_registrar); g_autoptr(FlPluginRegistrar) pasteboard_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "PasteboardPlugin"); pasteboard_plugin_register_with_registrar(pasteboard_registrar); diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 89cfca2..c41bfb1 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -4,10 +4,11 @@ list(APPEND FLUTTER_PLUGIN_LIST app_links_linux + audioplayers_linux + better_player_linux dynamic_color file_selector_linux - media_kit_libs_linux - media_kit_video + location pasteboard url_launcher_linux ) diff --git a/linux/nexus.federated.nexus.metainfo.xml b/linux/nexus.federated.nexus.metainfo.xml new file mode 100644 index 0000000..53c738c --- /dev/null +++ b/linux/nexus.federated.nexus.metainfo.xml @@ -0,0 +1,78 @@ + + + nexus.federated.nexus + CC0-1.0 + GPL-3.0-only + + Nexus + A simple and user-friendly Matrix client + + QuadRadical + + + +

+ Nexus is a simple and user-friendly client for Matrix, the open and + decentralized chat network. It's made with Flutter, with gomuks handling + the Matrix side. +

+

Features include:

+
    +
  • Spaces, threads, replies and reactions
  • +
  • End-to-end encryption, with verification and recovery keys
  • +
  • Polls, location sharing, and custom emoji and sticker packs
  • +
  • Multiple accounts
  • +
  • Notifications through UnifiedPush
  • +
  • Layouts for phones and desktops, including Linux phones
  • +
+
+ + nexus.federated.nexus.desktop + + https://git.federated.nexus/Nexus/nexus + https://git.federated.nexus/Nexus/nexus/issues + https://git.federated.nexus/Nexus/nexus + + + + + Chatting in a room, with its members + https://git.federated.nexus/Nexus/nexus/raw/branch/main/assets/screenshots/desktop-light.png + + + The same, in dark mode + https://git.federated.nexus/Nexus/nexus/raw/branch/main/assets/screenshots/desktop-dark.png + + + Chatting on a phone + https://git.federated.nexus/Nexus/nexus/raw/branch/main/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png + + + Spaces and rooms on a phone + https://git.federated.nexus/Nexus/nexus/raw/branch/main/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png + + + + + 360 + + + keyboard + pointing + touch + + + + intense + intense + + + + + + + + + + +
diff --git a/linux/nix/build_env.nix b/linux/nix/build_env.nix index cac5fbd..8883959 100644 --- a/linux/nix/build_env.nix +++ b/linux/nix/build_env.nix @@ -5,26 +5,60 @@ with pkgs; [ stdenv.cc + # webcrypto's build hook runs CMake with the Unix Makefiles generator + gnumake go git + ffmpeg-headless libGL (flutter.override { + # audioplayers plays audio through GStreamer extraPkgConfigPackages = [ - mpv-unwrapped - libass + gst_all_1.gstreamer + gst_all_1.gst-plugins-base ]; }) ] ++ lib.optionals pkgs.stdenv.isLinux [ wayland - # nativeapi includes XInput2.h, which needs these, but xi.pc only lists them privately - libxext - libxfixes (callPackage ./pkg/hook_pkg_config.nix { }) ]; env = lib.optionalAttrs pkgs.stdenv.isLinux { - LD_LIBRARY_PATH = "./build/native_assets/linux:${lib.makeLibraryPath [ pkgs.zlib ]}"; + # nativeapi includes XInput2.h and GTK's Wayland headers, which need these, but xi.pc and gdk-3.0.pc + # only list them privately, so its hook's pkg-config doesn't return them. Hooks only get NIX_ variables. + "NIX_CFLAGS_COMPILE_${pkgs.stdenv.cc.suffixSalt}" = + lib.concatMapStringsSep " " (pkg: "-isystem ${lib.getDev pkg}/include") + ( + with pkgs; + [ + libxext + libxfixes + wayland + ] + ); + # better_player loads libmpv at runtime to play videos + LD_LIBRARY_PATH = "./build/native_assets/linux:${ + lib.makeLibraryPath [ + pkgs.zlib + pkgs.mpv-unwrapped + ] + }"; + # audioplayers links GStreamer by name only, without its library directory + LIBRARY_PATH = lib.makeLibraryPath [ + pkgs.gst_all_1.gstreamer + pkgs.gst_all_1.gst-plugins-base + pkgs.glib + ]; + GST_PLUGIN_SYSTEM_PATH_1_0 = lib.makeSearchPathOutput "lib" "lib/gstreamer-1.0" ( + with pkgs.gst_all_1; + [ + gstreamer + gst-plugins-base + gst-plugins-good + gst-libav + ] + ); }; } diff --git a/linux/nix/bump_libmpv.sh b/linux/nix/bump_libmpv.sh new file mode 100644 index 0000000..02a74f1 --- /dev/null +++ b/linux/nix/bump_libmpv.sh @@ -0,0 +1,60 @@ +# shellcheck shell=bash + +# Opens a PR bumping the libmpv build that the Windows CI downloads, if +# mpv-winbuild-cmake has published a newer one. Run it from the repo root, with +# TOKEN set to a Forgejo token that can push branches and open PRs. + +# Checked first, so that nothing is pushed if the PR can't be opened +: "${TOKEN:?needs a Forgejo token}" +: "${GITHUB_SERVER_URL:?is set by Forgejo Actions}" +: "${GITHUB_REPOSITORY:?is set by Forgejo Actions}" +: "${GITHUB_REF_NAME:?is set by Forgejo Actions}" + +workflow=.github/workflows/windows.yml +current_url=$(grep -oE 'https://github\.com/shinchiro/mpv-winbuild-cmake/releases/download/[^"]+\.7z' "$workflow") +current_hash=$(grep -oE -- '-ne "[0-9a-f]{64}"' "$workflow" | grep -oE '[0-9a-f]{64}') + +release=$(curl -fsSL https://api.github.com/repos/shinchiro/mpv-winbuild-cmake/releases/latest) +tag=$(jq -r .tag_name <<<"$release") +url=$(jq -r '.assets[] | select(.name | test("^mpv-dev-x86_64-[0-9]{8}-git-[0-9a-f]+\\.7z$")) | .browser_download_url' <<<"$release") + +if [ -z "$url" ]; then + echo "Release $tag has no x86_64 libmpv archive" >&2 + exit 1 +fi +if [ "$url" = "$current_url" ]; then + echo "libmpv is up to date ($tag)" + exit 0 +fi + +branch="bump-libmpv-$tag" +if git ls-remote --exit-code --heads origin "$branch" >/dev/null; then + echo "$branch already exists, so its PR should already be open" + exit 0 +fi + +archive=$(mktemp) +curl -fsSL "$url" -o "$archive" +hash=$(sha256sum "$archive" | cut -d " " -f 1) +rm "$archive" + +sed -i "s|$current_url|$url|; s|$current_hash|$hash|" "$workflow" + +git config user.name "Forgejo Actions" +git config user.email "forgejo-actions@noreply.git.federated.nexus" +git switch -c "$branch" +git commit -am "bump libmpv to $tag" +git push origin "$branch" + +curl -fsS -X POST "$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY/pulls" \ + -H "Authorization: token $TOKEN" \ + -H "Content-Type: application/json" \ + -d "$(jq -n \ + --arg head "$branch" \ + --arg base "$GITHUB_REF_NAME" \ + --arg title "Bump libmpv to $tag" \ + --arg body "Updates the libmpv build that the Windows CI bundles to [$tag](https://github.com/shinchiro/mpv-winbuild-cmake/releases/tag/$tag)." \ + '{head: $head, base: $base, title: $title, body: $body}')" \ + >/dev/null + +echo "Opened a PR bumping libmpv to $tag" diff --git a/linux/nix/default.nix b/linux/nix/default.nix index 3d3b395..8f09dbc 100644 --- a/linux/nix/default.nix +++ b/linux/nix/default.nix @@ -30,7 +30,14 @@ appName = "Nexus"; developer = "QuadRadical"; appId = "nexus.federated.nexus"; - package = default; + # The runtime's GStreamer gets loaded instead of ours, and it can't + # load our plugins, so keep wrapGAppsHook from pointing it at them + package = default.overrideAttrs (old: { + postInstall = '' + unset GST_PLUGIN_SYSTEM_PATH_1_0 + '' + + old.postInstall; + }); runtime = "org.gnome.Platform/51"; permissions = { share = [ "network" ]; @@ -58,31 +65,40 @@ apps = let buildEnv = import ./build_env.nix { inherit pkgs lib; }; + testEnv = buildEnv.env // { + DBUS_SESSION_CONFIG = "${pkgs.dbus}/share/dbus-1/session.conf"; + }; e2e = pkgs.writeShellApplication { name = "nexus-e2e"; runtimeInputs = buildEnv.packages ++ (with pkgs; [ # TEMPORARY: matrix-continuwuity, once the local fixes are released - inputs.continuwuity.packages.${system}.default + (inputs.continuwuity.packages.${system}.default.overrideAttrs { doCheck = false; }) curl dbus ]); - runtimeEnv = buildEnv.env; + runtimeEnv = testEnv; text = builtins.readFile ./e2e.sh; }; - in - { - e2e = { - type = "app"; - program = lib.getExe e2e; + screenshots = pkgs.writeShellApplication { + name = "nexus-screenshots"; + runtimeInputs = + buildEnv.packages + ++ (with pkgs; [ + dbus + oxipng + pngquant + ]); + runtimeEnv = testEnv; + text = builtins.readFile ./screenshots.sh; }; - e2e-headless = { - type = "app"; - program = lib.getExe ( + headless = + program: + lib.getExe ( pkgs.writeShellApplication { - name = "nexus-e2e-headless"; + name = "${lib.getName program}-headless"; runtimeInputs = [ pkgs.cage ]; runtimeEnv = { WLR_BACKENDS = "headless"; @@ -94,10 +110,43 @@ XDG_RUNTIME_DIR="''${XDG_RUNTIME_DIR:-$(mktemp -d)}" export XDG_RUNTIME_DIR - exec cage -- ${lib.getExe e2e} "$@" + exec cage -- ${lib.getExe program} "$@" ''; } ); + in + { + e2e = { + type = "app"; + program = lib.getExe e2e; + }; + + bump-libmpv = { + type = "app"; + program = lib.getExe ( + pkgs.writeShellApplication { + name = "nexus-bump-libmpv"; + runtimeInputs = with pkgs; [ + coreutils + curl + git + gnugrep + gnused + jq + ]; + text = builtins.readFile ./bump_libmpv.sh; + } + ); + }; + + e2e-headless = { + type = "app"; + program = headless e2e; + }; + + screenshots = { + type = "app"; + program = headless screenshots; }; }; }; diff --git a/linux/nix/devshell.nix b/linux/nix/devshell.nix index cc2223e..1f02b67 100644 --- a/linux/nix/devshell.nix +++ b/linux/nix/devshell.nix @@ -1,5 +1,6 @@ { pkgs, lib }: let + ndkVersion = "28.2.13676358"; android = pkgs.androidenv.composeAndroidPackages { toolsVersion = "26.1.1"; platformToolsVersion = "37.0.1"; @@ -12,18 +13,29 @@ let "34" "35" "36" + "37.0" ]; abiVersions = [ "armeabi-v7a" "arm64-v8a" ]; includeNDK = true; - ndkVersions = [ "28.2.13676358" ]; + ndkVersions = [ ndkVersion ]; }; buildEnv = import ./build_env.nix { inherit pkgs lib; }; in pkgs.mkShell { - packages = buildEnv.packages ++ [ android.platform-tools ]; + packages = + buildEnv.packages + ++ [ android.platform-tools ] + # For scripts/build_avif_native.sh + ++ (with pkgs; [ + cmake + jq + meson + ninja + python3 + ]); env = rec { @@ -31,6 +43,7 @@ pkgs.mkShell { ANDROID_HOME = "${android.androidsdk}/libexec/android-sdk"; ANDROID_SDK_ROOT = ANDROID_HOME; + ANDROID_NDK_HOME = "${ANDROID_HOME}/ndk/${ndkVersion}"; JAVA_HOME = pkgs.jdk21; GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${ANDROID_HOME}/build-tools/36.0.0/aapt2"; diff --git a/linux/nix/e2e.sh b/linux/nix/e2e.sh index 6cc9f09..6a7a426 100755 --- a/linux/nix/e2e.sh +++ b/linux/nix/e2e.sh @@ -64,14 +64,22 @@ done GOCACHE="$(go env GOCACHE)" export GOCACHE +# shellcheck disable=SC2329 +run_flutter_test() { + export DBUS_SESSION_BUS_ADDRESS="${DBUS_SESSION_BUS_ADDRESS%%;*}" + flutter test "$@" -d linux +} +export -f run_flutter_test + status=0 for file in "${files[@]}"; do name="$(basename "$file" .dart)" mkdir -p "$work/$name/data" "$work/$name/cache" + XDG_DATA_HOME="$work/$name/data" XDG_CACHE_HOME="$work/$name/cache" \ - dbus-run-session -- \ - flutter test "$file" -d linux \ + dbus-run-session --config-file="$DBUS_SESSION_CONFIG" -- \ + bash -c 'run_flutter_test "$@"' -- "$file" \ --dart-define="NEXUS_E2E_HOMESERVER=$homeserver" "${flutter_args[@]}" || status=$? done -exit "$status" +exit "$status" \ No newline at end of file diff --git a/linux/nix/pkg/avif_native.nix b/linux/nix/pkg/avif_native.nix index 59a5b96..64dcb81 100644 --- a/linux/nix/pkg/avif_native.nix +++ b/linux/nix/pkg/avif_native.nix @@ -1,24 +1,11 @@ # avif_native's build hook downloads its prebuilt library, which the sandbox -# can't do, so bundle it and point the manifest at the local copy instead +# can't do, so build it from source against nixpkgs' libavif, and point the +# manifest at it { stdenv, - fetchurl, + libavif, jq, }: -let - artifacts = { - x86_64-linux = { - arch = "x64"; - sha256 = "fa36210bc95b70abd14c20fd626204f57d0ef947297e9ff8ee66855c01e2c17f"; - }; - aarch64-linux = { - arch = "arm64"; - sha256 = "163487e98b5eee0676be0dc8d3f60b5e0e5b67191a8a0a2abb5c8fad14a3a506"; - }; - }; - inherit (artifacts.${stdenv.hostPlatform.system}) arch sha256; - key = "linux-${arch}-decode-dav1d"; -in { version, src, ... }: stdenv.mkDerivation { pname = "avif_native"; @@ -26,24 +13,23 @@ stdenv.mkDerivation { inherit (src) passthru; nativeBuildInputs = [ jq ]; + buildInputs = [ libavif ]; - library = fetchurl { - url = "https://github.com/Zhangw1998/avif_native/releases/download/native-v0.2.0/${key}-libavif_native.so.gz"; - inherit sha256; - }; + buildPhase = '' + $CC -shared -fPIC src/avif_shim.c -lavif -o native/libavif_native.so + ''; - # The hook checksums the library, so it must stay byte-identical + # The hook checksums the library, so it mustn't change after it's hashed dontFixup = true; + # Nexus only decodes, with dav1d, see hooks.user_defines in pubspec.yaml installPhase = '' - runHook preInstall - cp -r . $out - chmod -R u+w $out - gunzip -c $library > $out/native/libavif_native.so - jq '.artifacts["${key}"].path = "libavif_native.so"' \ - native/manifest.json > $out/native/manifest.json - - runHook postInstall + jq --arg hash "$(sha256sum native/libavif_native.so | cut -d " " -f 1)" \ + '.artifacts |= with_entries( + if .key | test("^linux-.*-decode-dav1d$") + then .value += { path: "libavif_native.so", librarySha256: $hash } + else . end + )' native/manifest.json > $out/native/manifest.json ''; } diff --git a/linux/nix/pkg/default.nix b/linux/nix/pkg/default.nix index 76e8983..0bd7728 100644 --- a/linux/nix/pkg/default.nix +++ b/linux/nix/pkg/default.nix @@ -2,7 +2,8 @@ lib, callPackage, mpv-unwrapped, - libass, + gst_all_1, + ffmpeg-headless, libxext, libxfixes, libclang, @@ -39,8 +40,12 @@ flutter.buildFlutterApplication { nativeBuildInputs = [ (callPackage ./hook_pkg_config.nix { }) ]; buildInputs = [ - mpv-unwrapped - libass + # audioplayers plays audio through GStreamer, and wrapGAppsHook adds + # these plugins to the wrapper's GST_PLUGIN_SYSTEM_PATH_1_0 + gst_all_1.gstreamer + gst_all_1.gst-plugins-base + gst_all_1.gst-plugins-good + gst_all_1.gst-libav # nativeapi includes XInput2.h, which needs these, but xi.pc only lists them privately libxext libxfixes @@ -54,27 +59,34 @@ flutter.buildFlutterApplication { gitHashes = { linkify = "sha256-TpMD6+0zyY6i9l+6d8ErnVufmepCv362rCtnbOht/z4="; + location = "sha256-RL+l46pBhv75xP7ASJuazyYoi9vI35TSYAV11mkjAwY="; fab_m3e = "sha256-5V9m6yY0jimx2gh7lQHYg4HDKQ4Wrl0ATmBhw5DkQMI="; fluttertagger = "sha256-tHUNU2+fBPkq5UK5YRi3SWs1zF2PIPz6RgSbwignU/I="; m3e_design = "sha256-5V9m6yY0jimx2gh7lQHYg4HDKQ4Wrl0ATmBhw5DkQMI="; native_toolchain_cmake = "sha256-/drnHZebmTnsCnHgC1xmlAe+U4PSrjw5Sm9axicuTrY="; navigation_rail_m3e = "sha256-5V9m6yY0jimx2gh7lQHYg4HDKQ4Wrl0ATmBhw5DkQMI="; + pasteboard = "sha256-J3yray5n7XwVXMcOsvQ5+OvADEK2lPMeYniGg+yR704="; unifiedpush_linux = "sha256-KQKyBPL2ORK9O89C4K3RHGve/lvFaU1vIjSDnj6+bj4="; unifiedpush_platform_interface = "sha256-KQKyBPL2ORK9O89C4K3RHGve/lvFaU1vIjSDnj6+bj4="; - webcrypto = "sha256-YHyCMVmroxj047r6KLrk5gMbAGwZ5fZvCSOaX5p49uI="; xdg_desktop_portal = "sha256-8GgiXHGv+wy6hJgj/rZxbymMitNVmdDLAnedZm9STSc="; }; postInstall = '' install -D assets/bundled/icon.svg $out/share/icons/hicolor/scalable/apps/nexus.svg install -Dm755 linux/*.desktop -t $out/share/applications + install -Dm644 linux/*.metainfo.xml -t $out/share/metainfo install -Dm644 linux/*.service -t $out/share/dbus-1/services + # better_player loads libmpv at runtime to play videos + # gomuks uses ffmpeg and ffprobe for video thumbnails and metadata wrapProgram $out/bin/nexus \ - --suffix LD_LIBRARY_PATH : $out/app/nexus/lib + --suffix LD_LIBRARY_PATH : $out/app/nexus/lib \ + --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ mpv-unwrapped ]} \ + --prefix PATH : ${lib.makeBinPath [ ffmpeg-headless ]} ''; meta = { description = "A simple and user-friendly Matrix client"; + license = lib.licenses.gpl3Only; mainProgram = "nexus"; platforms = lib.platforms.unix; diff --git a/linux/nix/pkg/gomuks.nix b/linux/nix/pkg/gomuks.nix index da3bf3d..dc9f9ac 100644 --- a/linux/nix/pkg/gomuks.nix +++ b/linux/nix/pkg/gomuks.nix @@ -17,12 +17,12 @@ buildGoModule ( src = "${src}/gomuks"; - vendorHash = "sha256-feW1rw74GsRx0fkqGLZk6PeR6bUkIt9JnjvirOAThcI="; + vendorHash = "sha256-MJu9qN1NhUkjF3MAz+ejVMY9dxg8yxMBqCCHzPh9RHc="; buildPhase = '' runHook preBuild - go build -buildmode=c-shared -o ${filename} -tags goolm,noheic,sqlite_fts5 ./pkg/ffi + go build -buildmode=c-shared -o ${filename} -tags noheic,sqlite_fts5 ./pkg/ffi runHook postBuild ''; diff --git a/linux/nix/screenshots.sh b/linux/nix/screenshots.sh new file mode 100644 index 0000000..f3dced6 --- /dev/null +++ b/linux/nix/screenshots.sh @@ -0,0 +1,30 @@ +# shellcheck shell=bash + +# Regenerates the README, AppStream and Fastlane screenshots, from +# integration_test/screenshots. Run it from the repo root. + +work="$(mktemp -d)" +# shellcheck disable=SC2329 # Run by the trap +cleanup() { rm -rf "$work"; } +trap cleanup EXIT + +GOCACHE="$(go env GOCACHE)" +export GOCACHE + +XDG_DATA_HOME="$work/data" XDG_CACHE_HOME="$work/cache" \ + dbus-run-session --config-file="$DBUS_SESSION_CONFIG" -- \ + flutter test integration_test/screenshots/screenshots_test.dart -d linux \ + --dart-define="SCREENSHOTS_DIR=$work/out" "$@" + +for shot in "$work"/out/*.png; do + pngquant --quality 65-95 --speed 1 --strip --force --ext .png "$shot" + oxipng --quiet --opt 4 --strip safe "$shot" +done + +install -Dm644 "$work"/out/desktop-*.png -t assets/screenshots + +phone=fastlane/metadata/android/en-US/images/phoneScreenshots +install -Dm644 "$work/out/phone-chat-light.png" "$phone/1.png" +install -Dm644 "$work/out/phone-chat-dark.png" "$phone/2.png" +install -Dm644 "$work/out/phone-rooms-light.png" "$phone/3.png" +install -Dm644 "$work/out/phone-rooms-dark.png" "$phone/4.png" diff --git a/linux/runner/my_application.cc b/linux/runner/my_application.cc index f5795d0..defa773 100644 --- a/linux/runner/my_application.cc +++ b/linux/runner/my_application.cc @@ -1,5 +1,6 @@ #include "my_application.h" +#include #include #include @@ -301,6 +302,9 @@ static void my_application_startup( G_APPLICATION_CLASS( my_application_parent_class) ->startup(application); + + // mpv hates normal locales + setlocale(LC_NUMERIC, "C"); } static void my_application_shutdown( diff --git a/macos/Flutter/Flutter-Debug.xcconfig b/macos/Flutter/Flutter-Debug.xcconfig index 4b81f9b..c2efd0b 100644 --- a/macos/Flutter/Flutter-Debug.xcconfig +++ b/macos/Flutter/Flutter-Debug.xcconfig @@ -1,2 +1 @@ -#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/macos/Flutter/Flutter-Release.xcconfig b/macos/Flutter/Flutter-Release.xcconfig index 5caa9d1..c2efd0b 100644 --- a/macos/Flutter/Flutter-Release.xcconfig +++ b/macos/Flutter/Flutter-Release.xcconfig @@ -1,2 +1 @@ -#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 88181b0..662a521 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -6,12 +6,12 @@ import FlutterMacOS import Foundation import app_links +import audioplayers_darwin +import better_player_macos import dynamic_color import file_selector_macos import flutter_local_notifications -import geolocator_apple -import media_kit_libs_macos_video -import media_kit_video +import location import package_info_plus import pasteboard import shared_preferences_foundation @@ -20,12 +20,12 @@ import wakelock_plus func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { AppLinksMacosPlugin.register(with: registry.registrar(forPlugin: "AppLinksMacosPlugin")) + AudioplayersDarwinPlugin.register(with: registry.registrar(forPlugin: "AudioplayersDarwinPlugin")) + BetterPlayerPlugin.register(with: registry.registrar(forPlugin: "BetterPlayerPlugin")) DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin")) FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin")) - GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin")) - MediaKitLibsMacosVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitLibsMacosVideoPlugin")) - MediaKitVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitVideoPlugin")) + LocationPlugin.register(with: registry.registrar(forPlugin: "LocationPlugin")) FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) PasteboardPlugin.register(with: registry.registrar(forPlugin: "PasteboardPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) diff --git a/macos/Podfile b/macos/Podfile deleted file mode 100644 index 65543e2..0000000 --- a/macos/Podfile +++ /dev/null @@ -1,42 +0,0 @@ -platform :osx, '13.0' - -# CocoaPods analytics sends network stats synchronously affecting flutter build latency. -ENV['COCOAPODS_DISABLE_STATS'] = 'true' - -project 'Runner', { - 'Debug' => :debug, - 'Profile' => :release, - 'Release' => :release, -} - -def flutter_root - generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) - unless File.exist?(generated_xcode_build_settings_path) - raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" - end - - File.foreach(generated_xcode_build_settings_path) do |line| - matches = line.match(/FLUTTER_ROOT\=(.*)/) - return matches[1].strip if matches - end - raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" -end - -require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) - -flutter_macos_podfile_setup - -target 'Runner' do - use_frameworks! - - flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) - target 'RunnerTests' do - inherit! :search_paths - end -end - -post_install do |installer| - installer.pods_project.targets.each do |target| - flutter_additional_macos_build_settings(target) - end -end diff --git a/macos/Podfile.lock b/macos/Podfile.lock deleted file mode 100644 index 08cb773..0000000 --- a/macos/Podfile.lock +++ /dev/null @@ -1,28 +0,0 @@ -PODS: - - FlutterMacOS (1.0.0) - - media_kit_libs_macos_video (1.0.4): - - FlutterMacOS - - media_kit_video (0.0.1): - - FlutterMacOS - -DEPENDENCIES: - - FlutterMacOS (from `Flutter/ephemeral`) - - media_kit_libs_macos_video (from `Flutter/ephemeral/.symlinks/plugins/media_kit_libs_macos_video/macos`) - - media_kit_video (from `Flutter/ephemeral/.symlinks/plugins/media_kit_video/macos`) - -EXTERNAL SOURCES: - FlutterMacOS: - :path: Flutter/ephemeral - media_kit_libs_macos_video: - :path: Flutter/ephemeral/.symlinks/plugins/media_kit_libs_macos_video/macos - media_kit_video: - :path: Flutter/ephemeral/.symlinks/plugins/media_kit_video/macos - -SPEC CHECKSUMS: - FlutterMacOS: d0db08ddef1a9af05a5ec4b724367152bb0500b1 - media_kit_libs_macos_video: 85a23e549b5f480e72cae3e5634b5514bc692f65 - media_kit_video: fa6564e3799a0a28bff39442334817088b7ca758 - -PODFILE CHECKSUM: 54d867c82ac51cbd61b565781b9fada492027009 - -COCOAPODS: 1.17.0 diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index fa18d44..cc638f9 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -27,9 +27,7 @@ 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; - 34AEA7295333B7F48CD3BE4C /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D76F30AE9CCFCA04C354BD4C /* Pods_RunnerTests.framework */; }; 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; - BAF79690465DBAC1A1E19D28 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 70FD05041ACDA7E801BB9823 /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -63,7 +61,6 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 18EDDEF1FB58EC56ABDA1BEB /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; @@ -80,16 +77,9 @@ 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; - 5099E6191AE87E21D356D9C8 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; - 6D9F8F8BBED102075ECF1DF9 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; - 70FD05041ACDA7E801BB9823 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; - 8F5ECEC7BF9DD35CB3E7196E /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; - 9DDE815F827B87E2C55DF94C /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; - CBD1D9203BEE9731F981EEF8 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; - D76F30AE9CCFCA04C354BD4C /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -97,7 +87,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 34AEA7295333B7F48CD3BE4C /* Pods_RunnerTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -106,7 +95,6 @@ buildActionMask = 2147483647; files = ( 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */, - BAF79690465DBAC1A1E19D28 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -139,8 +127,6 @@ 33CEB47122A05771004F2AC0 /* Flutter */, 331C80D6294CF71000263BE5 /* RunnerTests */, 33CC10EE2044A3C60003C045 /* Products */, - D73912EC22F37F3D000D13A0 /* Frameworks */, - FC780AF47288088B9004ACE2 /* Pods */, ); sourceTree = ""; }; @@ -189,29 +175,6 @@ path = Runner; sourceTree = ""; }; - D73912EC22F37F3D000D13A0 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 70FD05041ACDA7E801BB9823 /* Pods_Runner.framework */, - D76F30AE9CCFCA04C354BD4C /* Pods_RunnerTests.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - FC780AF47288088B9004ACE2 /* Pods */ = { - isa = PBXGroup; - children = ( - 6D9F8F8BBED102075ECF1DF9 /* Pods-Runner.debug.xcconfig */, - 9DDE815F827B87E2C55DF94C /* Pods-Runner.release.xcconfig */, - CBD1D9203BEE9731F981EEF8 /* Pods-Runner.profile.xcconfig */, - 18EDDEF1FB58EC56ABDA1BEB /* Pods-RunnerTests.debug.xcconfig */, - 8F5ECEC7BF9DD35CB3E7196E /* Pods-RunnerTests.release.xcconfig */, - 5099E6191AE87E21D356D9C8 /* Pods-RunnerTests.profile.xcconfig */, - ); - name = Pods; - path = Pods; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -219,7 +182,6 @@ isa = PBXNativeTarget; buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; buildPhases = ( - C413A8A75594D2165C9D56BD /* [CP] Check Pods Manifest.lock */, 331C80D1294CF70F00263BE5 /* Sources */, 331C80D2294CF70F00263BE5 /* Frameworks */, 331C80D3294CF70F00263BE5 /* Resources */, @@ -238,13 +200,11 @@ isa = PBXNativeTarget; buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 446C82D5FE82BD05F78EDA6A /* [CP] Check Pods Manifest.lock */, 33CC10E92044A3C60003C045 /* Sources */, 33CC10EA2044A3C60003C045 /* Frameworks */, 33CC10EB2044A3C60003C045 /* Resources */, 33CC110E2044A8840003C045 /* Bundle Framework */, 3399D490228B24CF009A79C7 /* ShellScript */, - C4D158541D7059C07D3CA9B3 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -371,67 +331,6 @@ shellPath = /bin/sh; shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; }; - 446C82D5FE82BD05F78EDA6A /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - C413A8A75594D2165C9D56BD /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - C4D158541D7059C07D3CA9B3 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -483,7 +382,6 @@ /* Begin XCBuildConfiguration section */ 331C80DB294CF71000263BE5 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 18EDDEF1FB58EC56ABDA1BEB /* Pods-RunnerTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; @@ -498,7 +396,6 @@ }; 331C80DC294CF71000263BE5 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 8F5ECEC7BF9DD35CB3E7196E /* Pods-RunnerTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; @@ -513,7 +410,6 @@ }; 331C80DD294CF71000263BE5 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 5099E6191AE87E21D356D9C8 /* Pods-RunnerTests.profile.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; diff --git a/macos/Runner.xcworkspace/contents.xcworkspacedata b/macos/Runner.xcworkspace/contents.xcworkspacedata index 21a3cc1..1d526a1 100644 --- a/macos/Runner.xcworkspace/contents.xcworkspacedata +++ b/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -4,7 +4,4 @@ - - diff --git a/pubspec.lock b/pubspec.lock index 0d6edce..d5b2431 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -53,10 +53,10 @@ packages: dependency: transitive description: name: app_links_linux - sha256: "9ccb5802085a1e57bb07b6256fd1d61a78c7ec104944d4965e62938b4fefd9cb" + sha256: "734aa57a2f65d1b35c3643384ccfbe668730157a08479bfa488e10a9da847853" url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "1.0.5" app_links_platform_interface: dependency: "direct dev" description: @@ -77,10 +77,10 @@ packages: dependency: transitive description: name: archive - sha256: de5ac590b8155e4e676088d714bd41ea620449a6adc0f7950c5073874b287ddb + sha256: "2fda90592c0afd219c5e285618a98da835cd10df38372666093d25dfe457a2d0" url: "https://pub.dev" source: hosted - version: "4.6.0" + version: "4.7.1" args: dependency: transitive description: @@ -97,6 +97,62 @@ packages: url: "https://pub.dev" source: hosted version: "2.13.1" + audioplayers: + dependency: "direct main" + description: + name: audioplayers + sha256: "2ba4bb2944baacbdd5372ff8254a8e7feb8c10d7739545e392f5605a8f618745" + url: "https://pub.dev" + source: hosted + version: "6.8.1" + audioplayers_android: + dependency: transitive + description: + name: audioplayers_android + sha256: f5ff5b15620fbab8cb0849e9636c48e2b96c3f0f71723bbbe2ad3c761b205f05 + url: "https://pub.dev" + source: hosted + version: "5.3.0" + audioplayers_darwin: + dependency: transitive + description: + name: audioplayers_darwin + sha256: "1ca553add991384ecf421b9569da850f3ab2472ffb83f6970b0416365abc51be" + url: "https://pub.dev" + source: hosted + version: "6.5.0" + audioplayers_linux: + dependency: transitive + description: + name: audioplayers_linux + sha256: "15178b726b7cdee5364d0463c8d445630c4e0fb7d26612b73c767e7d25de9417" + url: "https://pub.dev" + source: hosted + version: "4.3.0" + audioplayers_platform_interface: + dependency: transitive + description: + name: audioplayers_platform_interface + sha256: "765f6f0e6dca55cb471c9483fc77700564b3484d19198aca4ebb5147c6c85acb" + url: "https://pub.dev" + source: hosted + version: "7.2.0" + audioplayers_web: + dependency: transitive + description: + name: audioplayers_web + sha256: ae1e0103c865a03e273f6d13d97b93f5595eac09915729cd5e37ef96e2857319 + url: "https://pub.dev" + source: hosted + version: "5.3.0" + audioplayers_windows: + dependency: transitive + description: + name: audioplayers_windows + sha256: a70ae82bba2dfcb6eb03dd4815d737a2d46d33ea5a96a03f535cfcaac490e413 + url: "https://pub.dev" + source: hosted + version: "4.4.1" avif_native: dependency: "direct main" description: @@ -105,6 +161,70 @@ packages: url: "https://pub.dev" source: hosted version: "0.2.0" + better_player: + dependency: "direct main" + description: + name: better_player + sha256: f9b928eec81622f33457a5019a02c79d102dffe54b432baa43bb3400d31439e1 + url: "https://pub.dev" + source: hosted + version: "1.38.0" + better_player_android: + dependency: transitive + description: + name: better_player_android + sha256: "2c7df9bfb1e7fa69c86d3bb91a1825bba30292968307724fa51869bc3a0bb75d" + url: "https://pub.dev" + source: hosted + version: "1.13.2" + better_player_ios: + dependency: transitive + description: + name: better_player_ios + sha256: "4b9c08690374aa84b15ba88ab5d6b695cda618fb895b445a6a4186c220599c84" + url: "https://pub.dev" + source: hosted + version: "1.15.0" + better_player_linux: + dependency: transitive + description: + name: better_player_linux + sha256: "97d9eb16a587df4d714c1906ef2c49b825c1483e7d4c9050d63e696e26998f6e" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + better_player_macos: + dependency: transitive + description: + name: better_player_macos + sha256: "90f6fc0e354b034043850661a7c4e39ac34261ff7cc21c2895ea7bded126d15c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + better_player_platform_interface: + dependency: transitive + description: + name: better_player_platform_interface + sha256: e5218199dd12ffe6f43c01d5cdeecad0b53125926f8da8c3f4b90136d8b55ec1 + url: "https://pub.dev" + source: hosted + version: "1.8.0" + better_player_web: + dependency: transitive + description: + name: better_player_web + sha256: d7b365221f7724f22d3fef7840e45af2493a784e2429a30e980f807bcb7c9539 + url: "https://pub.dev" + source: hosted + version: "1.6.1" + better_player_windows: + dependency: transitive + description: + name: better_player_windows + sha256: eddc817dce6af08e74de456ad711ffd987a641c45f73998cbe9ccbf6ab5ebf22 + url: "https://pub.dev" + source: hosted + version: "1.5.1" boolean_selector: dependency: transitive description: @@ -213,18 +333,18 @@ packages: dependency: transitive description: name: cnativeapi - sha256: "3c9e30d513cdc8ecb116f3017308f2480828c766e45aa00083c3d15d621e5d57" + sha256: c43703998995e132b0656d2b8a95ed2bedc6b22ccee2c827bcdc075e0330e319 url: "https://pub.dev" source: hosted - version: "0.5.8" + version: "0.5.10" code_assets: dependency: "direct main" description: name: code_assets - sha256: "828110d598123b5ea96c00c9f3c72105bf79f8ee36c20a39b26209ade421ec57" + sha256: "1ef22a0be3af9370bd9481ac76db114db92bfe75d5ca2b2d7bc911764478a4d9" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.2.0" collection: dependency: "direct main" description: @@ -273,6 +393,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.2" + cupertino_icons: + dependency: transitive + description: + name: cupertino_icons + sha256: b7cc2390aac296c083bea762859413eb1cf5b630c70e0c7e4d831018f762a8b2 + url: "https://pub.dev" + source: hosted + version: "2.0.0" cupertino_ui: dependency: transitive description: @@ -480,18 +608,18 @@ packages: dependency: "direct main" description: name: flutter_file_dialog - sha256: "5d270d69b6a5fdf45bdb88ebcf590e073dd89dfb45526ac83a64524ba57303b5" + sha256: "3765fca2a6babe983730a3105e9d652d852fe463c44bb7713344f11bec40d393" url: "https://pub.dev" source: hosted - version: "3.3.3" + version: "3.3.6" flutter_hooks: dependency: "direct main" description: name: flutter_hooks - sha256: "8ae1f090e5f4ef5cfa6670ce1ab5dddadd33f3533a7f9ba19d9f958aa2a89f42" + sha256: b4f6eb8f13fc92523023a47d4a2e541b17827535334941f9a974f10da0797a7e url: "https://pub.dev" source: hosted - version: "0.21.3+1" + version: "0.21.4" flutter_launcher_icons: dependency: "direct dev" description: @@ -512,42 +640,42 @@ packages: dependency: "direct main" description: name: flutter_local_notifications - sha256: fd5fc8966a8b34337ac182dc394f3506139b69d8138d4e9e174a13d6468adcd4 + sha256: "7d37d69ded3028af4f22531a0097a3baa478a384dff2e23e873707c93df3b704" url: "https://pub.dev" source: hosted - version: "22.3.3" + version: "23.0.3" flutter_local_notifications_linux: dependency: transitive description: name: flutter_local_notifications_linux - sha256: "3b89a4bf095fa5f8a99beeabf982c5bd506c3ad25e7b9e61da945e994dc5b615" + sha256: bcbcf3c15e33b6866805092308f5f6ef27e1191874f6a92ef59213a0812a79a2 url: "https://pub.dev" source: hosted - version: "8.0.2" + version: "9.0.0" flutter_local_notifications_platform_interface: dependency: transitive description: name: flutter_local_notifications_platform_interface - sha256: "43c3761d916c9bd3d5c7ebbc44d82f4990329840c0c5d62ad5260cc1b5d399bd" + sha256: "4a49db4ce3d633ebc85c85b5fa959572600ec10bd097419c454579444308a0a0" url: "https://pub.dev" source: hosted - version: "12.2.0" + version: "13.0.0" flutter_local_notifications_web: dependency: transitive description: name: flutter_local_notifications_web - sha256: "516afaf97a2d1e67a036c6617321b00d205d72f7a67b6eccf936cd565f985878" + sha256: ef117694fbfcd82308ab0e324cfc9282fa50c192e24ec54a58173ae327ebc544 url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "2.0.0" flutter_local_notifications_windows: dependency: transitive description: name: flutter_local_notifications_windows - sha256: "6f43bdd03b171b7a90f22647506fea33e2bb12294b7c7c7a3d690e960a382945" + sha256: "8e80ac29433c71e267493b397457e3a8430c5c1d9c76bb58a6971c016cdba3d7" url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "4.0.1" flutter_localizations: dependency: "direct main" description: flutter @@ -573,18 +701,18 @@ packages: dependency: "direct main" description: name: flutter_riverpod - sha256: "2b7f9d2a3c730ac1a98221b420cef966b990fca7ab546ede324642ca57a533e3" + sha256: "2ae1a93a868ae5f2d5358f521a4bfae0da7a3bfe77a60515ab5c28953b50557f" url: "https://pub.dev" source: hosted - version: "3.4.3" + version: "3.5.0" flutter_svg: dependency: "direct main" description: name: flutter_svg - sha256: "100c19dcc4ff60083e95a44a6f44f3a1bb887d353c5d86f6a9b688aa3cb46236" + sha256: "4565a66f0a968f2e1ab4197854686990258aadab9572eb80a7655053a01dc302" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.5.0" flutter_test: dependency: "direct dev" description: flutter @@ -633,70 +761,6 @@ packages: description: flutter source: sdk version: "0.0.0" - geoclue: - dependency: transitive - description: - name: geoclue - sha256: c2a998c77474fc57aa00c6baa2928e58f4b267649057a1c76738656e9dbd2a7f - url: "https://pub.dev" - source: hosted - version: "0.1.1" - geolocator: - dependency: "direct main" - description: - name: geolocator - sha256: "2b3bc0f7320d5a5fa02f8209ffcf1aaa7c2cabb7b2bedbc0cfeb5ff2778b8b09" - url: "https://pub.dev" - source: hosted - version: "14.1.2" - geolocator_android: - dependency: transitive - description: - name: geolocator_android - sha256: e67583809a1fab5f4a2255902978e2bc095ace9451fde0d9624e54facd0a5c22 - url: "https://pub.dev" - source: hosted - version: "5.2.1" - geolocator_apple: - dependency: transitive - description: - name: geolocator_apple - sha256: a1e177f3081089724f2095856aeb96eb8d7d1c59e425aed8dd4de7aa2c11ab66 - url: "https://pub.dev" - source: hosted - version: "2.4.3" - geolocator_linux: - dependency: transitive - description: - name: geolocator_linux - sha256: "3da7420f11c3496511a5bd3c18fd67b88e5659f12e46b7ce00a788f6996e850a" - url: "https://pub.dev" - source: hosted - version: "0.2.6" - geolocator_platform_interface: - dependency: transitive - description: - name: geolocator_platform_interface - sha256: e012af6b7e2674e7500237ab11e44ac9119e87fd0105e7bb55cde1750e8e5d80 - url: "https://pub.dev" - source: hosted - version: "4.4.1" - geolocator_web: - dependency: transitive - description: - name: geolocator_web - sha256: "19e485a0f8d6a88abcf9c53cba3a4105e14b7435ed8ac1c108c067b938fe8429" - url: "https://pub.dev" - source: hosted - version: "4.1.4" - geolocator_windows: - dependency: transitive - description: - name: geolocator_windows - sha256: "175435404d20278ffd220de83c2ca293b73db95eafbdc8131fe8609be1421eb6" - url: "https://pub.dev" - source: hosted - version: "0.2.5" glob: dependency: transitive description: @@ -713,14 +777,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.2" - gsettings: - dependency: transitive - description: - name: gsettings - sha256: "1b0ce661f5436d2db1e51f3c4295a49849f03d304003a7ba177d01e3a858249c" - url: "https://pub.dev" - source: hosted - version: "0.2.8" hooks: dependency: "direct main" description: @@ -733,10 +789,10 @@ packages: dependency: "direct main" description: name: hooks_riverpod - sha256: d58e1e14aa112ca9c56d54effb7d0d717b2d3f96dad3cdd1fce16f8740450700 + sha256: bfafc8ca13e33e191fd3c3c2e920eed08918ef669e0b4df253b401fa78f82f47 url: "https://pub.dev" source: hosted - version: "3.4.3" + version: "3.5.0" html: dependency: "direct main" description: @@ -781,10 +837,10 @@ packages: dependency: transitive description: name: image - sha256: "89ed75b2f8231fe676808c5564f9590d728024ded7ac782a7ed8474f1c95b72a" + sha256: bc13f61f0f5cb77936e78ae5dae3800f442718dac5d2bc4654f03c239230ed0c url: "https://pub.dev" source: hosted - version: "4.12.0" + version: "4.13.1" image_picker: dependency: "direct main" description: @@ -813,10 +869,10 @@ packages: dependency: transitive description: name: image_picker_ios - sha256: b8f508306db2bf71141aba2de4ec13456338bf01e13f034bd2594f341a5f8eb2 + sha256: a4aeafbe049ad99882059f186862de6fd5296c708c5805277f6f684165268af1 url: "https://pub.dev" source: hosted - version: "0.8.13+14" + version: "0.8.13+16" image_picker_linux: dependency: transitive description: @@ -874,10 +930,18 @@ packages: dependency: transitive description: name: jni - sha256: d8df6dab6847855512fe44dd9032b0bbe34dda7bf7597e41d30750879779813f + sha256: "19764f78f6b9e0d40f6395b04649d1046eb57f5ccf05afce50cc63e5a82777b0" url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.2.1" + jni_flutter: + dependency: transitive + description: + name: jni_flutter + sha256: "586594ad345b403bda8a794b0b8a9e34298238b86c2a7d7f15160b092fe9ef3d" + url: "https://pub.dev" + source: hosted + version: "1.1.0" jni_util: dependency: transitive description: @@ -959,6 +1023,31 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.1" + location: + dependency: "direct main" + description: + path: "packages/location" + ref: "feat/optional-play-services" + resolved-ref: "1a2602a9f7b07906a1191730d5435f4b695547d3" + url: "https://github.com/Henry-Hiles/flutterlocation" + source: git + version: "10.2.0" + location_platform_interface: + dependency: transitive + description: + name: location_platform_interface + sha256: a47b6d790eeb7308147293aedec0efb3b62d9f1b10899679be04f91cff664821 + url: "https://pub.dev" + source: hosted + version: "7.1.0" + location_web: + dependency: transitive + description: + name: location_web + sha256: da3812c65ca683c6180790838f551de10122a4887ffbd569360c9cb2d85859b7 + url: "https://pub.dev" + source: hosted + version: "7.0.1" logging: dependency: transitive description: @@ -1028,10 +1117,10 @@ packages: dependency: "direct main" description: name: material_ui - sha256: feb289df1e5f9ed9522f9fe3d909432a7f7bc76943f16abad09f80a16cd25196 + sha256: a6b19012df437a356cbc01f8ea22a105e07194c47c9a6009da0032a0ce35c4ab url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.11.1" measure_size: dependency: "direct main" description: @@ -1040,70 +1129,6 @@ packages: url: "https://pub.dev" source: hosted version: "5.0.2" - media_kit: - dependency: "direct main" - description: - name: media_kit - sha256: ae9e79597500c7ad6083a3c7b7b7544ddabfceacce7ae5c9709b0ec16a5d6643 - url: "https://pub.dev" - source: hosted - version: "1.2.6" - media_kit_libs_android_video: - dependency: transitive - description: - name: media_kit_libs_android_video - sha256: "3f6274e5ab2de512c286a25c327288601ee445ed8ac319e0ef0b66148bd8f76c" - url: "https://pub.dev" - source: hosted - version: "1.3.8" - media_kit_libs_ios_video: - dependency: transitive - description: - name: media_kit_libs_ios_video - sha256: b5382994eb37a4564c368386c154ad70ba0cc78dacdd3fb0cd9f30db6d837991 - url: "https://pub.dev" - source: hosted - version: "1.1.4" - media_kit_libs_linux: - dependency: transitive - description: - name: media_kit_libs_linux - sha256: "2b473399a49ec94452c4d4ae51cfc0f6585074398d74216092bf3d54aac37ecf" - url: "https://pub.dev" - source: hosted - version: "1.2.1" - media_kit_libs_macos_video: - dependency: transitive - description: - name: media_kit_libs_macos_video - sha256: f26aa1452b665df288e360393758f84b911f70ffb3878032e1aabba23aa1032d - url: "https://pub.dev" - source: hosted - version: "1.1.4" - media_kit_libs_video: - dependency: "direct main" - description: - name: media_kit_libs_video - sha256: "2b235b5dac79c6020e01eef5022c6cc85fedc0df1738aadc6ea489daa12a92a9" - url: "https://pub.dev" - source: hosted - version: "1.0.7" - media_kit_libs_windows_video: - dependency: transitive - description: - name: media_kit_libs_windows_video - sha256: dff76da2778729ab650229e6b4ec6ec111eb5151431002cbd7ea304ff1f112ab - url: "https://pub.dev" - source: hosted - version: "1.0.11" - media_kit_video: - dependency: "direct main" - description: - name: media_kit_video - sha256: afaa509e7b7e0bf247557a3a740cde903a52c34ace9810f94500e127bd7b043d - url: "https://pub.dev" - source: hosted - version: "2.0.1" meta: dependency: transitive description: @@ -1148,10 +1173,10 @@ packages: dependency: transitive description: name: native_toolchain_c - sha256: "90eaad8059ebc2004a63810a4696ea9acdb02473e47ed3b6b3bafb100ac77e31" + sha256: "120b6fc66acd8a5ddeaeb1e59b78836bb3ec9919bd9d9dfb1e2401985710c2c0" url: "https://pub.dev" source: hosted - version: "0.19.5" + version: "0.19.6" native_toolchain_cmake: dependency: "direct overridden" description: @@ -1165,18 +1190,18 @@ packages: dependency: transitive description: name: nativeapi - sha256: "87b0912bde3c9b7e0649c5e12047baf2bf179d3844a9b984313e897872120267" + sha256: "118045bb549cb6fabad472a3a22a537e7310bbf20097350f5027808b4a5853ce" url: "https://pub.dev" source: hosted - version: "0.5.8" + version: "0.5.10" nativeapi_flutter: dependency: transitive description: name: nativeapi_flutter - sha256: b62a42b8a86538119ba67b8eab8328eb89d69ac4a2142d623d08ac163faa9cd8 + sha256: "357a405c69212f5157da1bd3be183a53c2b841d0de0eb51f4a3947913712aec4" url: "https://pub.dev" source: hosted - version: "0.5.8" + version: "0.5.10" navigation_rail_m3e: dependency: "direct main" description: @@ -1190,10 +1215,10 @@ packages: dependency: transitive description: name: objective_c - sha256: "5c80c2ad6e2c0397de5db38c6d653e69616a3397e13aa7633bf39eb668f2041b" + sha256: c965d264fd4b0b4dd402dce9d049b70656bf98d3ca108b9bc55d2544ceadbe5e url: "https://pub.dev" source: hosted - version: "9.6.2" + version: "9.6.4" package_config: dependency: transitive description: @@ -1221,11 +1246,12 @@ packages: pasteboard: dependency: "direct main" description: - name: pasteboard - sha256: e0535da36124e6f2ca9d17424102ce5de34e72acc39f05a1d942b974b48e5eea - url: "https://pub.dev" - source: hosted - version: "0.6.0" + path: "packages/pasteboard" + ref: HEAD + resolved-ref: e79a0ecc741b80575f38465c02eba9c553e12479 + url: "https://github.com/Henry-Hiles/flutter-plugins" + source: git + version: "0.6.1" path: dependency: "direct main" description: @@ -1254,10 +1280,10 @@ packages: dependency: transitive description: name: path_provider_android - sha256: "149441ca6e4f38193b2e004c0ca6376a3d11f51fa5a77552d8bd4d2b0c0912ba" + sha256: "69cbd515a62b94d32a7944f086b2f82b4ac40a1d45bebfc00813a430ab2dabcd" url: "https://pub.dev" source: hosted - version: "2.2.23" + version: "2.3.1" path_provider_foundation: dependency: transitive description: @@ -1382,34 +1408,26 @@ packages: dependency: transitive description: name: riverpod - sha256: "484dfc873ea4c4f4240e5635444fa066f87b07862b7279ebd004a2b71fba4b7a" + sha256: "24cbce92e87088cae0dd06caac3876c0b3abfd084901e7a93a3254d6daf4937d" url: "https://pub.dev" source: hosted - version: "3.4.3" + version: "3.5.0" riverpod_analyzer_utils: dependency: transitive description: name: riverpod_analyzer_utils - sha256: bb13cb3985815840cc103eda1027158358c5fdc00f308fc6f76574d0594107af + sha256: a9ac757dd927b8b52ee4d3c5f8b7ecba523e140a8df916a88d5d54fef5bff72f url: "https://pub.dev" source: hosted - version: "1.0.0-dev.12" + version: "1.0.0" riverpod_lint: dependency: "direct dev" description: name: riverpod_lint - sha256: "215cb3cd54a97e09bc3512535fa4e8bedd3bf2a06dc2ae015ac8e0050fc71bd1" + sha256: "948ad74ce14bac286be014483891fb65a5584a353b0f77dd7d493a8f7880cd41" url: "https://pub.dev" source: hosted - version: "3.1.9" - safe_local_storage: - dependency: transitive - description: - name: safe_local_storage - sha256: "76288b689a3e1fddccb377177feed85d73fdfc64c9c3c52991e2d9aba35c4857" - url: "https://pub.dev" - source: hosted - version: "2.0.7" + version: "3.2.0" shared_preferences: dependency: "direct main" description: @@ -1422,18 +1440,18 @@ packages: dependency: transitive description: name: shared_preferences_android - sha256: "33b38b07d9ac7d16aff0426c61418752fd3e7a8c7dc8be786c875d6ce673b002" + sha256: "137dedccacb394b8f470d6c9b435ffc3d33faaa6ce2949c4f54a61007d64396d" url: "https://pub.dev" source: hosted - version: "2.5.4" + version: "2.5.5" shared_preferences_foundation: dependency: transitive description: name: shared_preferences_foundation - sha256: "4e396ac6f8751ab7d2d6e27f22f32c8350b07006028d534f5221503382f1fa69" + sha256: "89435cb71ecb1ad1bf29ef73a381f871a06f433d4182b7e2ba7243b02b2c544b" url: "https://pub.dev" source: hosted - version: "2.6.1" + version: "2.6.2" shared_preferences_linux: dependency: transitive description: @@ -1443,7 +1461,7 @@ packages: source: hosted version: "2.4.1" shared_preferences_platform_interface: - dependency: transitive + dependency: "direct dev" description: name: shared_preferences_platform_interface sha256: "649dc798a33931919ea356c4305c2d1f81619ea6e92244070b520187b5140ef9" @@ -1579,10 +1597,10 @@ packages: dependency: transitive description: name: synchronized - sha256: b3d516dbd3757ff2a458735e4f6cbac9ff261f576f6e87bcb17feabb39e657c5 + sha256: a77637ebe1460f3b48cac89a790d2eb634f0a8593cab0d3f340c6db174ba9b94 url: "https://pub.dev" source: hosted - version: "3.5.0" + version: "3.6.1+1" term_glyph: dependency: transitive description: @@ -1681,22 +1699,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.0" - universal_platform: - dependency: transitive - description: - name: universal_platform - sha256: "64e16458a0ea9b99260ceb5467a214c1f298d647c659af1bff6d3bf82536b1ec" - url: "https://pub.dev" - source: hosted - version: "1.1.0" - uri_parser: - dependency: transitive - description: - name: uri_parser - sha256: "051c62e5f693de98ca9f130ee707f8916e2266945565926be3ff20659f7853ce" - url: "https://pub.dev" - source: hosted - version: "3.0.2" url_launcher: dependency: "direct main" description: @@ -1709,10 +1711,10 @@ packages: dependency: transitive description: name: url_launcher_android - sha256: "611e87fb320b70d1dd721dc46af89c98aceccea9b31fde49e084591414e0c610" + sha256: b8073b1e5173d63afe1a18985a75896d72f759d3bc1817eb1ae8d26e8527cceb url: "https://pub.dev" source: hosted - version: "6.3.33" + version: "6.3.35" url_launcher_ios: dependency: transitive description: @@ -1773,18 +1775,18 @@ packages: dependency: transitive description: name: vector_graphics - sha256: "82885f6ac633044e7a4e4d8d745724a67aa0dc50af5d8a81ec29379f63c29035" + sha256: "06081e4f2d8f17c306aa58989520694b463ad411bc7c7b93e76afa3e41ca17ac" url: "https://pub.dev" source: hosted - version: "1.2.6" + version: "1.3.1" vector_graphics_codec: dependency: transitive description: name: vector_graphics_codec - sha256: "99fd9fbd34d9f9a32efd7b6a6aae14125d8237b10403b422a6a6dfeac2806146" + sha256: "023f3afd1b08d040406e7ccc324f5173c04762a59e374f29d04cef00a4940742" url: "https://pub.dev" source: hosted - version: "1.1.13" + version: "1.2.0" vector_graphics_compiler: dependency: transitive description: @@ -1801,6 +1803,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.4.4" + visibility_detector: + dependency: transitive + description: + name: visibility_detector + sha256: dd5cc11e13494f432d15939c3aa8ae76844c42b723398643ce9addb88a5ed420 + url: "https://pub.dev" + source: hosted + version: "0.4.0+2" vm_service: dependency: transitive description: @@ -1860,12 +1870,11 @@ packages: webcrypto: dependency: "direct overridden" description: - path: "." - ref: HEAD - resolved-ref: "0e9924f1ff0f485af87da12e7d0f259e41f3cbc5" - url: "https://github.com/google/webcrypto.dart" - source: git - version: "0.6.2-wip" + name: webcrypto + sha256: bdfa2b11696f2bac02834649d9e07d24a5154e527feec21ed1bdf81b31f982df + url: "https://pub.dev" + source: hosted + version: "0.6.2" webdriver: dependency: transitive description: @@ -1948,5 +1957,5 @@ packages: source: hosted version: "2.2.4" sdks: - dart: ">=3.13.3 <4.0.0" - flutter: ">=3.47.0" + dart: "3.13.3" + flutter: "3.47.4" diff --git a/pubspec.yaml b/pubspec.yaml index b375cf2..dd21cb7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: nexus description: "A simple and user-friendly Matrix client" -version: 1.1.0 +version: 1.1.3+101030999 publish_to: none flutter: @@ -16,14 +16,13 @@ flutter: uses-material-design: true environment: - sdk: ^3.13.3 + sdk: 3.13.3 + flutter: 3.47.4 dependency_overrides: dynamic_color: 2.1.0 - code_assets: 2.1.0 # webcrypto requires ^1.0.0, but works with 2.x - webcrypto: - git: - url: https://github.com/google/webcrypto.dart # Uses build hooks and fixes macOS x86_64, unreleased + code_assets: 2.2.0 # webcrypto requires ^1.0.0, but works with 2.x + webcrypto: 0.6.2 native_toolchain_cmake: git: url: https://github.com/rainyl/native_toolchain_cmake # Fixes native aarch64 linux builds, unreleased @@ -45,6 +44,10 @@ dependency_overrides: url: https://codeberg.org/Henry-Hiles/flutter-connector ref: quad/nexus path: unifiedpush_platform_interface + pasteboard: + git: + url: https://github.com/Henry-Hiles/flutter-plugins # FileTransfer portal support on Linux, unreleased + path: packages/pasteboard linkify: git: url: https://github.com/appelladev/linkify @@ -55,8 +58,8 @@ dependencies: sdk: flutter flutter_localizations: sdk: flutter - flutter_riverpod: 3.4.3 - hooks_riverpod: 3.4.3 + flutter_riverpod: 3.5.0 + hooks_riverpod: 3.5.0 intl: 0.20.3 fast_immutable_collections: 11.2.1 path_provider: 2.1.6 @@ -69,16 +72,16 @@ dependencies: window_manager: 0.6.0 color_hash: 1.0.1 flutter_widget_from_html_core: 0.18.0-beta.1 - flutter_svg: 2.3.2 + flutter_svg: 2.5.0 json_annotation: 4.12.0 shared_preferences: 2.5.6 fluttertagger: git: url: https://github.com/Henry-Hiles/fluttertagger # Fixes the last tag search being dropped from formattedText - flutter_hooks: 0.21.3+1 + flutter_hooks: 0.21.4 ffi: 2.2.0 hooks: 2.2.0 - code_assets: 2.1.0 + code_assets: 2.2.0 ffigen: 23.0.0 timeago: 3.7.1 http: 1.6.0 @@ -86,9 +89,6 @@ dependencies: html: 0.15.7 flutter_blurhash: 0.9.1 super_sliver_list: 0.4.1 - media_kit: 1.2.6 - media_kit_video: 2.0.1 - media_kit_libs_video: 1.0.7 measure_size: 5.0.2 m3e_buttons: 1.0.4 m3e_design: 0.2.1 @@ -101,11 +101,11 @@ dependencies: package_info_plus: 10.2.2 app_links: 7.2.2 file_selector: 1.1.0 - material_ui: 1.9.0 + material_ui: 1.11.1 multi_state_switch: 1.1.0 unifiedpush: 6.2.0 unifiedpush_storage_shared_preferences: 1.0.0 - flutter_local_notifications: 22.3.3 + flutter_local_notifications: 23.0.3 timezone: 0.11.2 material_emoji_picker: 2.0.1+1 material_adaptive_sheets: 1.0.0 @@ -114,12 +114,18 @@ dependencies: url: https://github.com/Henry-Hiles/xdg_desktop_portal.dart ref: quad/nexus pasteboard: 0.6.0 - flutter_file_dialog: 3.3.3 + flutter_file_dialog: 3.3.6 mime: 2.1.0 avif_native: 0.2.0 flutter_map: 8.3.2 latlong2: 0.10.1 - geolocator: 14.1.2 + location: + git: + url: https://github.com/Henry-Hiles/flutterlocation # Adds an option to leave out proprietary Google Play services, unreleased + ref: feat/optional-play-services + path: packages/location + better_player: 1.38.0 + audioplayers: 6.8.1 dev_dependencies: flutter_test: sdk: flutter @@ -127,10 +133,11 @@ dev_dependencies: sdk: flutter app_links_platform_interface: 2.0.4 url_launcher_platform_interface: 2.3.2 + shared_preferences_platform_interface: 2.4.2 build_runner: 2.17.1 flutter_lints: 6.0.0 freezed: 4.0.3 - riverpod_lint: 3.1.9 + riverpod_lint: 3.2.0 flutter_launcher_icons: 0.14.4 json_serializable: 6.15.2 diff --git a/scripts/build_avif_native.sh b/scripts/build_avif_native.sh new file mode 100644 index 0000000..e94f87c --- /dev/null +++ b/scripts/build_avif_native.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -euo pipefail + +cd "${PUB_CACHE:-$HOME/.pub-cache}"/hosted/pub.dev/avif_native-* + +bash tool/native/build_unix.sh android-arm64 decode-dav1d + +library=dist/android-arm64/decode-dav1d/libavif_native.so +jq --arg path "../$library" --arg hash "$(sha256sum "$library" | cut -d " " -f 1)" \ + '.artifacts["android-arm64-decode-dav1d"] |= {path: $path, librarySha256: $hash, fileName}' \ + native/manifest.json > manifest.json +mv manifest.json native/manifest.json diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100755 index 0000000..01e2683 --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +set -euo pipefail + +version=${1:?usage: $0 , e.g. 1.2.0 or 1.2.0-beta1} +[[ $version =~ ^([0-9]+)\.([0-9]{1,2})\.([0-9]{1,2})(-[a-z]+([0-9]{1,3}))?$ ]] || + { echo "invalid version: $version" >&2; exit 1; } +prerelease=${BASH_REMATCH[5]:-} + +code=$((10#${BASH_REMATCH[1]} * 100000000 + 10#${BASH_REMATCH[2]} * 1000000 + 10#${BASH_REMATCH[3]} * 10000 + 10#${prerelease:-999})) + +cd "$(dirname "$0")/.." +git diff --quiet HEAD || { echo "commit or stash your changes first" >&2; exit 1; } +! git rev-parse -q --verify "refs/tags/v$version" > /dev/null || { echo "v$version already exists" >&2; exit 1; } + +sed -i "s/^version: .*/version: $version+$code/" pubspec.yaml +sed -i "s/^AppVersion=.*/AppVersion=$version/" windows/installer.iss +if [[ $prerelease ]]; then + release="" +else + release="" + sed -i "s|refs/tags/v[^\"]*\"|refs/tags/v$version\"|" README.md +fi +sed -i "s|^\( *\)|&\n\1 $release|" linux/nexus.federated.nexus.metainfo.xml + +git commit -qam "prepare v$version" +git tag "v$version" +echo "Tagged v$version ($code). Push with: git push origin HEAD v$version" diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 8df32b4..b63c950 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -7,27 +7,27 @@ #include "generated_plugin_registrant.h" #include +#include +#include #include #include -#include -#include -#include +#include #include #include void RegisterPlugins(flutter::PluginRegistry* registry) { AppLinksPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("AppLinksPluginCApi")); + AudioplayersWindowsPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("AudioplayersWindowsPlugin")); + BetterPlayerWindowsPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("BetterPlayerWindowsPlugin")); DynamicColorPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("DynamicColorPluginCApi")); FileSelectorWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("FileSelectorWindows")); - GeolocatorWindowsRegisterWithRegistrar( - registry->GetRegistrarForPlugin("GeolocatorWindows")); - MediaKitLibsWindowsVideoPluginCApiRegisterWithRegistrar( - registry->GetRegistrarForPlugin("MediaKitLibsWindowsVideoPluginCApi")); - MediaKitVideoPluginCApiRegisterWithRegistrar( - registry->GetRegistrarForPlugin("MediaKitVideoPluginCApi")); + LocationPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("LocationPlugin")); PasteboardPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("PasteboardPlugin")); UrlLauncherWindowsRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 3435f5e..b6e3eef 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -4,11 +4,11 @@ list(APPEND FLUTTER_PLUGIN_LIST app_links + audioplayers_windows + better_player_windows dynamic_color file_selector_windows - geolocator_windows - media_kit_libs_windows_video - media_kit_video + location pasteboard url_launcher_windows ) diff --git a/windows/installer.iss b/windows/installer.iss index 47741c8..e1a08c0 100644 --- a/windows/installer.iss +++ b/windows/installer.iss @@ -1,6 +1,6 @@ [Setup] AppName=Nexus -AppVersion=1.1.0 +AppVersion=1.1.3 DefaultDirName={pf}\Nexus DefaultGroupName=Nexus OutputDir=dist