Skip to content

Commit

Permalink
Update readme & contributing guide & language stuff (#2071)
Browse files Browse the repository at this point in the history
* updates

* keep common errors

* fix selector being empty for english

* sort by label

* update contributing

* update ndk and docs

* Update CONTRIBUTING.md
  • Loading branch information
utkubakir committed Feb 9, 2024
1 parent 177b2a2 commit 2dc233f
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 24 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/mobile-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ jobs:
# - name: Cache NDK
# uses: actions/cache@v3
# with:
# path: ${{ env.ANDROID_HOME }}/ndk/23.1.7779620
# key: ndk-23.1.7779620
# path: ${{ env.ANDROID_HOME }}/ndk/26.1.10909125
# key: ndk-26.1.10909125
#
# - name: Install NDK
# run: echo "y" | sudo ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install "ndk;23.1.7779620"
# run: echo "y" | sudo ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install "ndk;26.1.10909125"
#
# - name: Cache Gradle
# uses: gradle/gradle-build-action@v2
Expand All @@ -106,7 +106,7 @@ jobs:
# arch: x86_64
# api-level: 30
# target: google_apis
# ndk: 23.1.7779620
# ndk: 26.1.10909125
# ram-size: 4096M
# emulator-boot-timeout: 12000
# force-avd-creation: false
Expand All @@ -126,7 +126,7 @@ jobs:
# arch: x86_64
# api-level: 30
# target: google_apis
# ndk: 23.1.7779620
# ndk: 26.1.10909125
# ram-size: 4096M
# emulator-boot-timeout: 12000
# force-avd-creation: false
Expand Down
28 changes: 18 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ To make changes locally, follow these steps:
1. Clone the repository: `git clone https://github.com/spacedriveapp/spacedrive`
2. Navigate to the project directory: `cd spacedrive`
3. Configure your system environment for Spacedrive development
1. For Linux users, run: `./scripts/setup.sh`
> This [script](https://github.com/spacedriveapp/spacedrive/blob/main/scripts/setup.sh#L133) will check if Rust and pnpm are installed then proceed to install Clang, NASM, LLVM, libvips, Gstreamer's Plugins, FFmpeg, Perl, [Tauri essentials](https://tauri.app/v1/guides/getting-started/prerequisites/#setting-up-linux) and any other required dependencies for Spacedrive to build.
2. For macOS users, run: `./scripts/setup.sh`
> This [script](https://github.com/spacedriveapp/spacedrive/blob/main/scripts/setup.sh#L108) will check if Rust, pnpm and Xcode are installed and proceed to use Homebrew to install NASM, [Tauri essentials](https://tauri.app/v1/guides/getting-started/prerequisites/#setting-up-macos) and install any other required dependencies for Spacedrive to build.
3. For Windows users, run in PowerShell: `.\scripts\setup.ps1`
> This [script](https://github.com/spacedriveapp/spacedrive/blob/main/scripts/setup.ps1#L81) will install pnpm, LLVM, FFmpeg, C++ build tools, NASM, Rust + Cargo, Rust tools, Edge Webview 2, Strawberry Perl, [Tauri essentials](https://tauri.app/v1/guides/getting-started/prerequisites/#setting-up-windows) and any other required dependencies for Spacedrive to build.
1. For Linux users, run: `./scripts/setup.sh`
> This [script](https://github.com/spacedriveapp/spacedrive/blob/main/scripts/setup.sh#L133) will check if Rust and pnpm are installed then proceed to install Clang, NASM, LLVM, libvips, Gstreamer's Plugins, FFmpeg, Perl, [Tauri essentials](https://tauri.app/v1/guides/getting-started/prerequisites/#setting-up-linux) and any other required dependencies for Spacedrive to build.
2. For macOS users, run: `./scripts/setup.sh`
> This [script](https://github.com/spacedriveapp/spacedrive/blob/main/scripts/setup.sh#L108) will check if Rust, pnpm and Xcode are installed and proceed to use Homebrew to install NASM, [Tauri essentials](https://tauri.app/v1/guides/getting-started/prerequisites/#setting-up-macos) and install any other required dependencies for Spacedrive to build.
3. For Windows users, run in PowerShell: `.\scripts\setup.ps1`
> This [script](https://github.com/spacedriveapp/spacedrive/blob/main/scripts/setup.ps1#L81) will install pnpm, LLVM, FFmpeg, C++ build tools, NASM, Rust + Cargo, Rust tools, Edge Webview 2, Strawberry Perl, [Tauri essentials](https://tauri.app/v1/guides/getting-started/prerequisites/#setting-up-windows) and any other required dependencies for Spacedrive to build.
4. Install dependencies: `pnpm i`
5. Prepare the build: `pnpm prep` (This will run all necessary codegen and build required dependencies)

Expand Down Expand Up @@ -89,11 +89,19 @@ To run the mobile app:
- Install [Android Studio](https://developer.android.com/studio) for Android and [Xcode](https://apps.apple.com/au/app/xcode/id497799835) for iOS development.
- Run `./scripts/setup.sh mobile`
- This will set up most of the dependencies required to build the mobile app.
- Make sure you have [NDK 23.1.7779620 and CMake](https://developer.android.com/studio/projects/install-ndk#default-version) installed in Android Studio.
- Make sure you have [NDK 26.1.10909125 and CMake](https://developer.android.com/studio/projects/install-ndk#default-version) installed in Android Studio.
- Run the following commands:
- `pnpm android` (runs on Android Emulator)
- `pnpm ios` (runs on iOS Emulator)
- `pnpm start` (runs the metro bundler)
- `pnpm mobile android` (runs on Android Emulator)
- In order to have locations working on Android, you must run the following command once the application has been installed for the first time. Otherwise, locations will not work.
- `adb shell appops set --uid com.spacedrive.app MANAGE_EXTERNAL_STORAGE allow`
- Run the following commands to access the logs from `sd-core`.
- `adb shell`
- Then `run-as com.spacedrive.app` to access the app's directory on device.
- Run `cd files/logs` and then select the logs with the timestamp of when you ran the app. Ex: `sd.log.2023-11-28`.
- You can view the logs using `tail -f [log-name]`. Ex: `tail -f sd.log.2023-11-28`.
- `pnpm mobile ios` (runs on iOS Emulator)
- `xcrun simctl launch --console booted com.spacedrive.app` allows you to view the console output of the iOS app from `tracing`. However, the application must be built in `debug` mode for this.
- `pnpm mobile start` (runs the metro bundler only)

##### AppImage

Expand Down
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,28 @@ This project is using what I'm calling the **"PRRTT"** stack (Prisma, Rust, Reac
- `desktop`: A [Tauri](https://tauri.app) app.
- `mobile`: A [React Native](https://reactnative.dev/) app.
- `web`: A [React](https://reactjs.org) webapp.
- `landing`: A [React](https://reactjs.org) app using Vite SSR & Vite pages.
- `landing`: A [React](https://reactjs.org) app using [Next.js](https://nextjs.org).
- `server`: A [Rust](https://www.rust-lang.org) server for the webapp. (planned)
- `cli`: A [Rust](https://www.rust-lang.org) command line interface. (planned)
- `storybook`: A [React](https://reactjs.org) storybook for the UI components.

### Core:

- `core`: The [Rust](https://www.rust-lang.org) core, referred to internally as `sdcore`. Contains filesystem, database and networking logic. Can be deployed in a variety of host applications.
- `crates`: Shared Rust libraries used by the core and other Rust applications.

### Interface:

- `interface`: The complete user interface in React (used by apps `desktop`, `web`)

### Packages:

- `assets`: Shared assets (images, fonts, etc).
- `client`: A [TypeScript](https://www.typescriptlang.org/) client library to handle dataflow via RPC between UI and the Rust core.
- `ui`: A [React](https://reactjs.org) Shared component library.
- `interface`: The complete user interface in React (used by apps `desktop`, `web` and `landing`)
- `config`: `eslint` configurations (includes `eslint-config-next`, `eslint-config-prettier` and all `tsconfig.json` configs used throughout the monorepo).
- `ui`: A [React](https://reactjs.org) Shared component library.

- `macos`: A [Swift](https://developer.apple.com/swift/) Native binary for MacOS system extensions.
- `macos`: A [Swift](https://developer.apple.com/swift/) Native binary for MacOS system extensions (planned).
- `ios`: A [Swift](https://developer.apple.com/swift/) Native binary (planned).
- `windows`: A [C#](https://docs.microsoft.com/en-us/dotnet/csharp/) Native binary (planned).
- `android`: A [Kotlin](https://kotlinlang.org/) Native binary (planned).
15 changes: 12 additions & 3 deletions docs/developers/prerequisites/environment-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,18 @@ To run mobile app
1. Install [Android Studio](https://developer.android.com/studio) for Android and [Xcode](https://apps.apple.com/au/app/xcode/id497799835) for IOS development
2. `./scripts/setup.sh mobile`
_The should setup most of the dependencies for the mobile app to build._
3. You must also ensure you have [NDK 23.1.7779620 and CMake](https://developer.android.com/studio/projects/install-ndk#default-version) in Android Studio
4. `pnpm mobile android` - runs on Android Emulator
5. `pnpm mobile ios` - runs on iOS Emulator
3. You must also ensure you have [NDK 26.1.10909125 and CMake](https://developer.android.com/studio/projects/install-ndk#default-version) in Android Studio
4. `pnpm mobile android` (runs on Android Emulator)
- In order to have locations working on Android, you must run the following command once the application has been installed for the first time. Otherwise, locations will not work.
- `adb shell appops set --uid com.spacedrive.app MANAGE_EXTERNAL_STORAGE allow`
- Run the following commands to access the logs from `sd-core`.
- `adb shell`
- Then `run-as com.spacedrive.app` to access the app's directory on device.
- Run `cd files/logs` and then select the logs with the timestamp of when you ran the app. Ex: `sd.log.2023-11-28`.
- You can view the logs using `cat [log-name]`. Ex: `cat sd.log.2023-11-28`.
5. `pnpm mobile ios` (runs on iOS Emulator)
- `xcrun simctl launch --console booted com.spacedrive.app` allows you to view the console output of the iOS app from `tracing`. However, the application must be built in `debug` mode for this.
6. `pnpm mobile start` (runs the metro bundler only)

### Troubleshooting

Expand Down
7 changes: 6 additions & 1 deletion interface/app/$libraryId/settings/client/general.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const NodeSettingLabel = tw.div`mb-1 text-xs font-medium`;
// https://doc.rust-lang.org/std/u16/index.html
const u16 = z.number().min(0).max(65_535);

// Unsorted list of languages available in the app.
// Make sure to add new languages to this list and to `project.inlang/settings.json`
const LANGUAGE_OPTIONS = [
{ value: 'en', label: 'English' },
{ value: 'de', label: 'Deutsch' },
Expand All @@ -35,6 +37,9 @@ const LANGUAGE_OPTIONS = [
{ value: 'zh-TW', label: '中文(繁體)' }
];

// Sort the languages by their label
LANGUAGE_OPTIONS.sort((a, b) => a.label.localeCompare(b.label));

export const Component = () => {
const node = useBridgeQuery(['nodeState']);
const platform = usePlatform();
Expand Down Expand Up @@ -202,7 +207,7 @@ export const Component = () => {
<Setting mini title={t('language')} description={t('language_description')}>
<div className="flex h-[30px] gap-2">
<Select
value={i18n.language}
value={i18n.resolvedLanguage || i18n.language || 'en'}
onChange={(e) => {
i18n.changeLanguage(e);
// add "i18nextLng" key to localStorage and set it to the selected language
Expand Down
1 change: 0 additions & 1 deletion packages/test-files
Submodule test-files deleted from 146fbb

0 comments on commit 2dc233f

Please sign in to comment.