docs: add contrib docs

This commit is contained in:
Infi 2024-06-08 20:53:31 +02:00
parent 2d1092d513
commit b4ceb2d19e
14 changed files with 6007 additions and 0 deletions

35
.github/workflows/docs.yml vendored Normal file
View File

@ -0,0 +1,35 @@
name: Build documentation
on:
push:
branches: ["dev"]
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write # To push a branch
pages: write # To push to a GitHub Pages site
id-token: write # To update the deployment status
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v4.0.0
with:
run_install: |
- recursive: true
cwd: docs
- name: Build Book
run: |
cd docs
pnpm build
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "docs/dist"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

21
docs/.gitignore vendored Normal file
View File

@ -0,0 +1,21 @@
# build output
dist/
# generated types
.astro/
# dependencies
node_modules/
# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# environment variables
.env
.env.production
# macOS-specific files
.DS_Store

35
docs/astro.config.mjs Normal file
View File

@ -0,0 +1,35 @@
import { defineConfig } from "astro/config"
import starlight from "@astrojs/starlight"
// https://astro.build/config
export default defineConfig({
integrations: [
starlight({
title: "Revolt on Android Technical Documentation",
social: {
github: "https://github.com/revoltchat/android",
},
sidebar: [
{
label: "Contributing",
items: [
// Each item here is one entry in the navigation menu.
{
label: "Guidelines",
link: "/contributing/guidelines",
},
{
label: "Setup",
link: "/contributing/setup",
},
],
},
/* {
label: "Reference",
autogenerate: { directory: "reference" },
}, */
],
customCss: ["./src/styles/custom.css"],
}),
],
})

20
docs/package.json Normal file
View File

@ -0,0 +1,20 @@
{
"name": "android-docs",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro check && astro build",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"@astrojs/starlight": "^0.24.0",
"astro": "^4.8.6",
"sharp": "^0.32.5",
"@astrojs/check": "^0.7.0",
"typescript": "^5.4.5"
},
"packageManager": "pnpm@9.1.1+sha256.9551e803dcb7a1839fdf5416153a844060c7bce013218ce823410532504ac10b"
}

5655
docs/pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff

1
docs/public/favicon.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128"><path fill-rule="evenodd" d="M81 36 64 0 47 36l-1 2-9-10a6 6 0 0 0-9 9l10 10h-2L0 64l36 17h2L28 91a6 6 0 1 0 9 9l9-10 1 2 17 36 17-36v-2l9 10a6 6 0 1 0 9-9l-9-9 2-1 36-17-36-17-2-1 9-9a6 6 0 1 0-9-9l-9 10v-2Zm-17 2-2 5c-4 8-11 15-19 19l-5 2 5 2c8 4 15 11 19 19l2 5 2-5c4-8 11-15 19-19l5-2-5-2c-8-4-15-11-19-19l-2-5Z" clip-rule="evenodd"/><path d="M118 19a6 6 0 0 0-9-9l-3 3a6 6 0 1 0 9 9l3-3Zm-96 4c-2 2-6 2-9 0l-3-3a6 6 0 1 1 9-9l3 3c3 2 3 6 0 9Zm0 82c-2-2-6-2-9 0l-3 3a6 6 0 1 0 9 9l3-3c3-2 3-6 0-9Zm96 4a6 6 0 0 1-9 9l-3-3a6 6 0 1 1 9-9l3 3Z"/><style>path{fill:#000}@media (prefers-color-scheme:dark){path{fill:#fff}}</style></svg>

After

Width:  |  Height:  |  Size: 696 B

BIN
docs/src/assets/phone.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 KiB

View File

@ -0,0 +1,6 @@
import { defineCollection } from 'astro:content';
import { docsSchema } from '@astrojs/starlight/schema';
export const collections = {
docs: defineCollection({ schema: docsSchema() }),
};

View File

@ -0,0 +1,52 @@
---
title: Contribution Guidelines
description: Read the guidelines before setting out to contribute to Revolt on Android.
template: doc
---
This page contains the guidelines for contributing to Revolt on Android. These guidelines are important to ensure that your contribution is accepted and merged into the main codebase.
:::danger
Make sure you read these guidelines _before starting to contribute_ to Revolt on Android.
If you do not follow these guidelines, your contribution may be rejected!
:::
## Before You Start
- Make sure you have read the [Code of Conduct](https://github.com/revoltchat/.github/blob/master/.github/CODE_OF_CONDUCT.md) before contributing. You must follow it at all times.
Before you start contributing, you first need to know what to contribute. Based on that, you must make a decision:
:::tip[Translation]
If you want to contribute to translations, you can do so by visiting [Weblate](https://translate.revolt.chat/projects/revolt/android/).
:::
#### I want to fix a bug
If you are fixing a bug, you must follow these guidelines:
- Make sure the bug is reproducible and affects a wide variety of users.
- The root cause of the bug must be the Android app itself, not the server or the API.
- The root cause of the bug must be the Android app itself, not the device or the Android version.
#### I want to add a feature
**All features must be discussed with the app's maintainer before you start working on them!** If you are adding a feature, you must follow these guidelines:
- The feature must be useful to a wide variety of users.
- UI/UX is centrally managed by Revolt's design team. Make sure your feature aligns closely with the current design as well as [Material 3](https://m3.material.io/).
- If you need any new UI, you are recommended to request a design from the design team and implement it as per the design. If your UI/UX is not up to the mark, your PR may be rejected by the design team.
- The feature must not be a duplicate of an existing feature.
- ~~The feature must not be a part of the [Roadmap](#)~~ (To be published).
## In General, ...
- Use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) for your commit messages. This helps in generating changelogs and tracking changes.
- Make sure your code is easy to understand. You need not document every line of code, but if something is not immediately obvious to a seasoned Android developer, you should add a comment.
- Make sure your code is well-formatted. You can use Android Studio's built-in code formatter to format your code.
- Make sure your code 'fits in' with the rest of the codebase.
- Make sure your code is well-tested. You should write unit tests for your code if applicable.
## If you came this far...
Let's get started! You may continue to the [Development Setup](/contributing/setup) guide to set up your development environment.

View File

@ -0,0 +1,135 @@
---
title: Setting up your Development Environment
description: A guide to setting up your development environment for Revolt on Android.
template: doc
---
This page contains the guidelines for setting up your development environment for Revolt on Android. These guidelines are important to ensure that your development environment is set up correctly and you can start contributing to the project.
If you want to compile the app for yourself, you can also follow these guidelines, however you may not need Android Studio and it may be possible to build the app using the command line, out of the scope of this guide.
:::danger
It may be tempting to skip some of these steps, but make sure you follow them to ensure that your development environment is set up correctly.
:::
import { Tabs, TabItem, Steps } from "@astrojs/starlight/components"
<Steps>
1. Download the Git version control system.
<Tabs syncKey="os">
<TabItem label="Windows" icon="seti:windows">
```powershell
winget install --id Git.Git -e --source winget
```
</TabItem>
<TabItem label="macOS" icon="apple">
Using [Homebrew](https://brew.sh):
```zsh
brew install git
```
</TabItem>
<TabItem label="Linux" icon="linux">
Using your package manager. For example, on Ubuntu:
```sh
sudo apt install git
```
</TabItem>
</Tabs>
2. Download Android Studio.
<Tabs syncKey="os">
<TabItem label="Windows" icon="seti:windows">
```powershell
winget install --id Google.AndroidStudio -e --source winget
```
</TabItem>
<TabItem label="macOS" icon="apple">
From the [official website](https://developer.android.com/studio).
</TabItem>
<TabItem label="Linux" icon="linux">
Look for Android Studio in your package manager.
Alternatively, from [Flathub](https://flathub.org/apps/com.google.AndroidStudio) or the [official website](https://developer.android.com/studio).
</TabItem>
</Tabs>
3. Clone the repository.
```sh
git clone https://github.com/revoltchat/android.git
```
4. Open the project in Android Studio.
5. Install the required dependencies.
- Android SDK, latest version
- Android NDK, latest version
You can install these from the SDK Manager in Android Studio.
6. Copy the `revoltbuild.properties.example` file to `revoltbuild.properties` and fill in the required values.
```sh
cp revoltbuild.properties.example revoltbuild.properties
```
The `revoltbuild.properties` file contains the following properties:
| Property | Description |
| ------------------------ | ---------------------------------------------- |
| `sentry.dsn` | Sentry DSN for error reporting |
| `sentry.upload_mappings` | Whether to upload obf. maps to Sentry |
| `build.debug.app_name` | The name of the app in debug builds, arbitrary |
| `build.flavour_id` | Leave as `ZZUU` |
7. Copy the `sentry.properties.example` file to `sentry.properties` and fill in the required values.
```sh
cp sentry.properties.example sentry.properties
```
The `sentry.properties` file contains the following properties:
| Property | Description |
| ------------------ | -------------------------------------------------------- |
| `defaults.url` | The URL of the Sentry instance |
| `defaults.project` | The project ID in Sentry |
| `defaults.org` | The organization ID in Sentry |
| `auth.token` | The authentication token for Sentry, used to upload maps |
You can get these values from the Sentry dashboard.
8. Build the project.
You can build the project by clicking on the 'Run' button in Android Studio.
If asked, build the `:app` module.
9. **You're all set!** You can now start contributing to Revolt on Android.
</Steps>

View File

@ -0,0 +1,13 @@
---
title: Revolt on Android &mdash; Technical Documentation
description: A guide to getting started with Revolt on Android.
template: splash
hero:
image:
file: ../../assets/phone.png
actions:
- text: Contribution Guidelines
link: /contributing/guidelines
icon: right-arrow
variant: primary
---

2
docs/src/env.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
/// <reference path="../.astro/types.d.ts" />
/// <reference types="astro/client" />

View File

@ -0,0 +1,29 @@
/* Dark mode colours. */
:root {
--sl-color-accent-low: #460910;
--sl-color-accent: #c60032;
--sl-color-accent-high: #feb1b0;
--sl-color-white: #ffffff;
--sl-color-gray-1: #f4ebec;
--sl-color-gray-2: #cabfc0;
--sl-color-gray-3: #998688;
--sl-color-gray-4: #655355;
--sl-color-gray-5: #443335;
--sl-color-gray-6: #312224;
--sl-color-black: #1d1617;
}
/* Light mode colours. */
:root[data-theme="light"] {
--sl-color-accent-low: #ffc7c5;
--sl-color-accent: #c90033;
--sl-color-accent-high: #640014;
--sl-color-white: #1d1617;
--sl-color-gray-1: #312224;
--sl-color-gray-2: #443335;
--sl-color-gray-3: #655355;
--sl-color-gray-4: #998688;
--sl-color-gray-5: #cabfc0;
--sl-color-gray-6: #f4ebec;
--sl-color-gray-7: #f9f5f5;
--sl-color-black: #ffffff;
}

3
docs/tsconfig.json Normal file
View File

@ -0,0 +1,3 @@
{
"extends": "astro/tsconfigs/strict"
}