diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index b9b6207..cf64422 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -27,7 +27,7 @@ jobs: KEYSTORE_CONTENT: ${{ secrets.KEYSTORE_CONTENT }} - 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 --dart-define=GIT_COMMIT=${{ github.sha }}" + 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 }}" env: KEYSTORE_PATH: ../../keystore.jks KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} @@ -36,4 +36,4 @@ jobs: uses: actions/upload-artifact@v6 with: name: APK - path: build/app/outputs/flutter-apk/app-release.apk + path: build/app/outputs/flutter-apk/app-arm64-v8a-release.apk diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index d9c7c9d..fa4a0a1 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -27,22 +27,26 @@ ref.read(MyController.provider.notifier).helperMethod() We use an object oriented style for controllers, where `provider` is a static member on the controller class. E.g. ```dart -class MyController extends AsyncNotifier { - final SomeInputType input; - MyController(this.input); - +class MyController(final SomeInputType input) + extends AsyncNotifier { @override Future build() async { return input.foo; } static final provider = - AsyncNotifierProvider.family( - AuthorController.new, - ); + AsyncNotifierProvider.family( + MyController.new, + ); } ``` +#### `watch` vs `read` + +Only use `ref.watch` in a `build` method, where you want to rebuild when the value changes. Everywhere else, like callbacks, `useEffect`, and methods on a controller, use `ref.read`. + +Use `.select` to narrow down what you depend on, e.g. `ref.watch(RoomsController.provider.select((rooms) => rooms[roomId]))`. + Providers which are not controllers, e.g. they expose no data, only methods, should instead live in `lib/helpers/`. For an example, see `lib/helpers/launch_helper.dart`. Other, non-provider helpers, like extensions or helper methods can also go in `lib/helpers/`. ### Don't use StatefulWidgets ([Flutter Hooks](https://pub.dev/packages/flutter_hooks)) @@ -61,6 +65,36 @@ When possible, use immutable collections instead of the mutable equivalent. For When possible, we prefer not to create global variables or methods. You can usually replace a global variable with a Riverpod controller, and a global method with an extension method. +I'm also not a big fan of unneeded private methods or variables, but this is contextual. + +### Modern Dart syntax + +We try to use newer Dart language features where they make code shorter: + +- Primary constructors for classes, including widgets, e.g. `class const MemberList(final String roomId, {super.key}) extends HookConsumerWidget`. +- Dot shorthands wherever the type can be inferred, e.g. `.new(...)`, `padding: .all(8)`, `relationType == .reply`. +- Patterns and switch expressions over null checks and casts, e.g. `if (event.content case MessageContent(:final body?))` rather than checking `is` then using `!`. + +### Prefer `map` over inline `for` loops + +When building a list (or set, or map) from another collection, use `.map`, `.expand` and friends rather than a `for` inside the collection literal: + +```dart +// Prefer +children: rooms.map((room) => RoomTile(room)).toList(), + +// Over +children: [for (final room in rooms) RoomTile(room)], +``` + +Regular `for` statements are fine for logic that doesn't just build a collection. + +### Async values and errors + +When rendering an `AsyncValue`, use the `betterWhen` extension, which shows our standard loading and error widgets, or a switch expression if you need more control (e.g. `AsyncData(:final value) || AsyncLoading(:final value?)` to keep showing old data while reloading). + +For futures started from the UI that nothing awaits, like button presses, add `.onError(showError)` so failures are shown to the user instead of being lost. + ## LLM/AI Assisted Contributions LLM generated code is NOT allowed. All contributions should be written by humans. Using LLMs for interacting with others, e.g. for Comments, PRs, etc, is also not allowed. diff --git a/README.md b/README.md index da4a6cb..a0c111d 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,5 @@ # Nexus Client -> [!WARNING] -> Nexus Client is still in development, and doesn't support everything needed for daily use. - ## Description A simple and user-friendly Matrix client made with Flutter and a Gomuks backend. @@ -13,113 +10,13 @@ A simple and user-friendly Matrix client made with Flutter and a Gomuks backend. | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------: | | ![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) | -## Progress - -- [x] Platform Support - - [x] Linux - - [x] Notifications through UnifiedPush - - [x] Windows - - [ ] Background notifications - - [x] Android - - [x] Notifications through UnifiedPush - - [x] Notifications through FCM - - [x] MacOS - - [x] Unsigned .ipa - - [ ] App Store - - [ ] Background notifications - - [x] iOS - - [x] Unsigned .ipa - - [ ] App Store - - [ ] Background notifications - - [ ] Web (may not be possible) -- [x] Login (via OAuth) -- [x] Rooms / Spaces - - [x] Displaying and choosing - - [x] Reading, showing unread - - [x] Mark as read button on rooms and spaces - - [ ] Searching - - [ ] Creating (Rooms, Spaces, and DMs) - - [x] Joining - - [x] Parse vias - - [x] Using a text/uri/link - - [x] Plain text - - [x] `matrix:` Uri - - [x] Matrix.to link - - [ ] From space - - [ ] From directory - - [x] Leaving - - [x] Subspaces -- [x] Messages - - [x] Encryption - - [x] Restoring crypto identity from a recovery passphrase/key - - [x] Sending - - [x] Plain text - - [x] HTML/Markdown - - [x] Replies - - [x] Choose ping on/off - - [x] Per message profiles - - [x] Attachments - - [ ] Commands with [MSC4391](https://github.com/matrix-org/matrix-spec-proposals/pull/4391) - - [x] Tags - - [x] Users - - [x] Rooms - - [x] Emojis - - [ ] Custom emojis/stickers - - [ ] GIFs using Gomuks' GIF proxies - - [x] Receiving - - [x] Plain text - - [x] Per message profiles - - [x] HTML - - [x] URL Previews - - [x] Replies - - [x] Viewing - - [x] Jump to original message - - [x] Edits - - [x] Attachments - - [x] Unencrypted - - [x] Encrypted - - [x] Blurhashing - - [ ] Downloading attachments - - [x] Opening attachments in their own view - - [ ] Polls - - [x] Mentions - - [x] Users - - [x] Clickable - - [x] Rooms - - [x] Clickable - - [x] Matrix URIs - - [x] Matrix.to links - - [x] Events - - [x] Custom emojis/stickers - - [x] History loading - - [x] Editing - - [x] Deleting -- [x] Reactions -- [x] Pins - - [x] Displaying - - [x] Pinning/Unpinning -- [ ] Threads -- [x] Profile popouts - - [x] Working actions -- [x] Copy link to: - - [x] Room - - [x] Space - - [x] Message -- [ ] Reporting - - [x] Events - - [ ] Rooms -- [x] Member list - - [x] Sort by power level - - [ ] Colors based off of power level -- [x] Notifications using UnifiedPush ([#35](https://git.federated.nexus/Nexus/nexus/issues/35)) -- [x] Notifications page -- [ ] Group calls using [MSC4195](https://github.com/matrix-org/matrix-spec-proposals/pull/4195) -- [ ] Invites -- [x] Settings - ## Try it out -If you want to try out Nexus, grab one of the following artifacts from CI: +If you want to try out Nexus, download the [latest release](https://git.federated.nexus/Nexus/nexus/releases/latest). + +### Nightly Builds + +For the newest changes, grab one of the following nightly artifacts, built by CI from the latest commit on `main`. - [Android APK](https://nightly.link/Henry-Hiles/nexus/workflows/android/main/APK.zip) - [Unsigned iOS IPA](https://nightly.link/Henry-Hiles/nexus/workflows/ios/main/Nexus.ipa.zip) @@ -128,7 +25,7 @@ If you want to try out Nexus, grab one of the following artifacts from CI: Or, use one of the below methods: -### Flatpak +### Nightly Flatpak Repo Make sure Flatpak is set up on your system, then run: @@ -149,6 +46,12 @@ 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.0.0"; +``` + Then import the module and enable it in your NixOS configuration: ```nix @@ -232,12 +135,6 @@ dart scripts/generate.dart > export CPATH="$(clang -v 2>&1 | grep "Selected GCC installation" | rev | cut -d' ' -f1 | rev)/include" > ``` -Build webcrypto: - -```sh -flutter pub run webcrypto:setup -``` - Build generated files, and watch for new changes: ```sh @@ -256,7 +153,7 @@ Development instructions can be found in [DEVELOPMENT.md](./DEVELOPMENT.md). Join the [Nexus Client Matrix room](https://matrix.to/#/#nexus:federated.nexus) for questions or help with developing or using Nexus Client. -# Credits +## Credits 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! diff --git a/altstore-source.json b/altstore-source.json deleted file mode 100644 index 4471fb6..0000000 --- a/altstore-source.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "Nexus", - "identifier": "nexus.federated.nexus.source", - "subtitle": "Nexus for iOS", - "description": "Nexus iOS builds for AltStore and SideStore.", - "iconURL": "https://git.federated.nexus/Nexus/nexus/raw/branch/main/assets/icon.png", - "website": "https://git.federated.nexus/Nexus/nexus", - "apps": [ - { - "name": "Nexus", - "bundleIdentifier": "nexus.federated.nexus", - "developerName": "Nexus", - "subtitle": "A Matrix client", - "localizedDescription": "Nexus for iOS. Unsigned builds, resigned at install by AltStore/SideStore.", - "iconURL": "https://git.federated.nexus/Nexus/nexus/raw/branch/main/assets/icon.png", - "category": "social", - "screenshots": [], - "versions": [] - } - ], - "news": [] -} diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index d4dbebe..b471fb4 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -51,6 +51,16 @@ + + + +