Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d85152660 | ||
|
|
a4a984e2b2 | ||
|
|
ee767e040a | ||
|
|
5fa192dff5 | ||
|
|
293bcb9a08 | ||
|
|
45e9b34407 | ||
|
|
8dff6487a8 | ||
|
|
4cf505245c | ||
|
|
978fb6d364 | ||
|
|
be56cec972 | ||
|
|
03cc1ba034 | ||
|
|
dd0f459bb3 | ||
|
|
6a10ccb740 | ||
|
|
94276fc41e | ||
|
|
96ebe2e243 | ||
|
|
41b542f499 | ||
|
|
76d2a4fc48 | ||
|
|
77de5d8d92 | ||
|
|
15212d40c2 | ||
|
|
b58224f393 | ||
|
|
f9a869116c | ||
|
|
77b86e5611 | ||
|
|
4b800a710e | ||
|
|
4ca5721098 | ||
|
|
64cc6fefd5 | ||
|
|
ae6dda4883 | ||
|
|
cea2abd328 | ||
|
|
eaea0cddee | ||
|
|
b94c7f4920 | ||
|
|
42ab82e712 | ||
|
|
f5b5aab0cc | ||
|
|
81b88ae30d | ||
|
|
54931026fb | ||
|
|
2344d48020 | ||
|
|
4f7bb91fb8 | ||
|
|
a96e6b7c16 | ||
|
|
126a8e821f | ||
|
|
b5141b2632 | ||
|
|
61f0787d8f | ||
|
|
054faea80e | ||
|
|
fcb2e7c298 | ||
|
|
a5293813a0 | ||
|
|
27878c449e | ||
|
|
9a01d75437 | ||
|
|
14695aee16 | ||
|
|
7870ed7dcd | ||
|
|
76eeaf9eb5 | ||
|
|
7dfbcd97dc | ||
|
|
4060099226 | ||
|
|
f9f0a6ee08 | ||
|
|
061c23af2c | ||
|
|
3208e83ce8 | ||
|
|
821a00e621 | ||
|
|
8d17b440ba | ||
|
|
149aee1604 | ||
|
|
9199da2cb2 | ||
|
|
29a1778141 | ||
|
|
47c4408835 | ||
|
|
5e9a3f4511 | ||
|
|
4379d293ec | ||
|
|
d2451d46ef | ||
|
|
b01888fcfb | ||
|
|
9436ce938a | ||
|
|
b843c642e1 | ||
|
|
93fd29bdd0 | ||
|
|
02ece55c02 | ||
|
|
d73385b6a4 | ||
|
|
ef2a4d0e00 | ||
|
|
d539a29e8f | ||
|
|
1499d3e09b | ||
|
|
8cfaebf43d | ||
|
|
38d13f3135 | ||
|
|
83c4f180b4 | ||
|
|
a1914a1415 | ||
|
|
e9f95d8c89 | ||
|
|
40a660249c | ||
|
|
14a270c7b6 | ||
|
|
d39ea8fd4d | ||
|
|
88818aea09 | ||
|
|
3aec019348 | ||
|
|
8e01c0fa7d | ||
|
|
5e98458257 | ||
|
|
1209e29078 | ||
|
|
a3743c9b37 | ||
|
|
fe96b6c61e | ||
|
|
eabbff2972 | ||
|
|
157788fa5c | ||
|
|
e89f63e382 | ||
|
|
1105b51c24 | ||
|
|
c9cf77d05a | ||
|
|
8315898d00 | ||
|
|
f61a9e9094 | ||
|
|
f7cb61cf57 | ||
|
|
407e4fa2a0 | ||
|
|
7093dd1a51 | ||
|
|
f78cd854c8 | ||
|
|
44725b5bf6 | ||
|
|
894552e1b6 | ||
|
|
2695cf99a1 | ||
|
|
62317fa294 | ||
|
|
b492e59c90 | ||
|
|
86e529db36 | ||
|
|
a9248d0645 | ||
|
|
0d6f853775 | ||
|
|
841018451d | ||
|
|
15d3176a0b | ||
|
|
67e55bc931 | ||
|
|
8d3265732e | ||
|
|
15eab9f75c | ||
|
|
ca6d0c1a51 | ||
|
|
edac1da85c | ||
|
|
48ee4615d1 | ||
|
|
631a3d4666 | ||
|
|
0a325d2dc7 | ||
|
|
32e76391ef | ||
|
|
57af29796e | ||
|
|
d87a9fd7e7 | ||
|
|
6396281b9c | ||
|
|
cac8afab9e | ||
|
|
39c11965ca | ||
|
|
2f45dc30a1 | ||
|
|
0b85606f98 | ||
|
|
2b3183eb38 | ||
|
|
810436f3bb | ||
|
|
c51911383f | ||
|
|
a0ea5d987c | ||
|
|
b7b470ca1c | ||
|
|
63acc477e5 | ||
|
|
aebc742384 | ||
|
|
37856cef75 | ||
|
|
240ae3345f | ||
|
|
8b314ef21f | ||
|
|
604f1adc0b | ||
|
|
05d55bf845 | ||
|
|
393f62e5f0 | ||
|
|
a12cdac763 | ||
|
|
5da72c3710 | ||
|
|
73b6e5a2dc | ||
|
|
9930131571 | ||
|
|
8f8114b8d7 | ||
|
|
cfd92e587a | ||
|
|
e6aa9b1d84 | ||
|
|
e625044648 | ||
|
|
f28daf7668 |
No files matched your search
@@ -12,6 +12,7 @@ libgles2-mesa-dev
|
||||
libgl1
|
||||
libgl1-mesa-dri
|
||||
libglvnd0
|
||||
libgtk-3-dev
|
||||
libx11-6
|
||||
libx11-dev
|
||||
libxext6
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
name: Netlify
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: netlify-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Site
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install Packages
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mapfile -t packages < .github/apt/web-packages.txt
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y "${packages[@]}" tcl
|
||||
|
||||
- name: Set Up Emscripten
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git clone --depth 1 https://github.com/emscripten-core/emsdk.git "$HOME/emsdk"
|
||||
"$HOME/emsdk/emsdk" install latest
|
||||
"$HOME/emsdk/emsdk" activate latest
|
||||
echo "EMSDK=$HOME/emsdk" >> "$GITHUB_ENV"
|
||||
echo "EM_CONFIG=$HOME/emsdk/.emscripten" >> "$GITHUB_ENV"
|
||||
echo "$HOME/emsdk" >> "$GITHUB_PATH"
|
||||
echo "$HOME/emsdk/upstream/emscripten" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Build Site
|
||||
run: |
|
||||
set -euo pipefail
|
||||
make site
|
||||
test -f build/site/index.html
|
||||
test -f build/site/build/web/index.html
|
||||
test -f build/site/build/web/index.js
|
||||
test -f build/site/build/web/index.wasm
|
||||
|
||||
- name: Upload Site Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: inbe-site
|
||||
path: build/site
|
||||
if-no-files-found: error
|
||||
|
||||
deploy-preview:
|
||||
name: Deploy Preview
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: github.event_name == 'pull_request'
|
||||
|
||||
steps:
|
||||
- name: Download Site Artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: inbe-site
|
||||
path: build/site
|
||||
|
||||
- name: Install Netlify CLI
|
||||
run: npm install --global netlify-cli
|
||||
|
||||
- name: Deploy Preview To Netlify
|
||||
run: |
|
||||
set -euo pipefail
|
||||
auth_token="$(printf '%s' "$NETLIFY_AUTH_TOKEN" | tr -d '\r\n')"
|
||||
site_id="$(printf '%s' "$NETLIFY_SITE_ID" | tr -d '\r\n')"
|
||||
netlify deploy \
|
||||
--dir build/site \
|
||||
--alias "pr-${{ github.event.pull_request.number }}" \
|
||||
--message "Preview ${{ github.event.pull_request.number }}" \
|
||||
--auth "$auth_token" \
|
||||
--site "$site_id"
|
||||
env:
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
|
||||
deploy-production:
|
||||
name: Deploy Production
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
|
||||
|
||||
steps:
|
||||
- name: Download Site Artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: inbe-site
|
||||
path: build/site
|
||||
|
||||
- name: Install Netlify CLI
|
||||
run: npm install --global netlify-cli
|
||||
|
||||
- name: Deploy Production To Netlify
|
||||
run: |
|
||||
set -euo pipefail
|
||||
auth_token="$(printf '%s' "$NETLIFY_AUTH_TOKEN" | tr -d '\r\n')"
|
||||
site_id="$(printf '%s' "$NETLIFY_SITE_ID" | tr -d '\r\n')"
|
||||
netlify deploy \
|
||||
--dir build/site \
|
||||
--prod \
|
||||
--message "Production ${{ github.sha }}" \
|
||||
--auth "$auth_token" \
|
||||
--site "$site_id"
|
||||
env:
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
@@ -0,0 +1,96 @@
|
||||
name: Publish OpenStore
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
changelog:
|
||||
description: Changelog text for the OpenStore revision
|
||||
required: false
|
||||
default: ""
|
||||
channel:
|
||||
description: OpenStore channel
|
||||
required: false
|
||||
default: focal
|
||||
release:
|
||||
types: [published]
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 90
|
||||
|
||||
env:
|
||||
OPENSTORE_API_KEY: ${{ secrets.OPENSTORE_API_KEY }}
|
||||
OPENSTORE_APP_ID: inbe
|
||||
OPENSTORE_CHANNEL: ${{ github.event.inputs.channel || 'focal' }}
|
||||
CHANGELOG: ${{ github.event.inputs.changelog || github.event.release.name || github.event.release.tag_name || '' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install build dependencies
|
||||
run: |
|
||||
sudo dpkg --add-architecture arm64
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
binutils-aarch64-linux-gnu \
|
||||
ccache \
|
||||
click \
|
||||
cmake \
|
||||
curl \
|
||||
gcc-aarch64-linux-gnu \
|
||||
jq \
|
||||
make \
|
||||
patchelf \
|
||||
pkg-config \
|
||||
tcl \
|
||||
zlib1g-dev \
|
||||
libcurl4-openssl-dev:arm64 \
|
||||
libdrm-dev:arm64 \
|
||||
libegl-dev:arm64 \
|
||||
libgbm-dev:arm64 \
|
||||
libgles-dev:arm64 \
|
||||
libsdl2-dev:arm64 \
|
||||
libssl-dev:arm64 \
|
||||
zlib1g-dev:arm64
|
||||
|
||||
- name: Build Click package
|
||||
run: |
|
||||
set -euo pipefail
|
||||
export AARCH64_CC=aarch64-linux-gnu-gcc
|
||||
export AARCH64_AR=aarch64-linux-gnu-ar
|
||||
export AARCH64_RANLIB=aarch64-linux-gnu-ranlib
|
||||
export AARCH64_PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/share/pkgconfig
|
||||
export PKG_CONFIG_LIBDIR="$AARCH64_PKG_CONFIG_PATH"
|
||||
export AARCH64_RAY_SDL_CFLAGS="$(pkg-config --cflags sdl2)"
|
||||
export AARCH64_RAY_SDL_LDLIBS="$(pkg-config --libs sdl2)"
|
||||
export AARCH64_RAY_GL_CFLAGS="$(pkg-config --cflags libdrm gbm egl glesv2)"
|
||||
export AARCH64_RAY_GL_LDLIBS="$(pkg-config --libs libdrm gbm egl glesv2)"
|
||||
export AARCH64_RAY_CFLAGS="$AARCH64_RAY_SDL_CFLAGS $AARCH64_RAY_GL_CFLAGS"
|
||||
export AARCH64_RAY_LDLIBS="$AARCH64_RAY_SDL_LDLIBS $AARCH64_RAY_GL_LDLIBS"
|
||||
export AARCH64_RAY_SDL_INCLUDE_DIR=/usr/include/SDL2
|
||||
export AARCH64_FLINT_CURL_CFLAGS="$(pkg-config --cflags libcurl)"
|
||||
export AARCH64_FLINT_CURL_LDLIBS="$(pkg-config --libs libcurl)"
|
||||
export AARCH64_CLICK_RUNTIME_LIBS="/usr/lib/aarch64-linux-gnu/libSDL2-2.0.so.0 /usr/lib/aarch64-linux-gnu/libcurl.so.4 /usr/lib/aarch64-linux-gnu/libssl.so.3 /usr/lib/aarch64-linux-gnu/libcrypto.so.3 /usr/lib/aarch64-linux-gnu/libdrm.so.2 /usr/lib/aarch64-linux-gnu/libgbm.so.1 /usr/lib/aarch64-linux-gnu/libEGL.so.1 /usr/lib/aarch64-linux-gnu/libGLESv2.so.2 /usr/lib/aarch64-linux-gnu/libz.so.1"
|
||||
make CLICK_ARCH=arm64 click
|
||||
|
||||
- name: Show package contents
|
||||
run: |
|
||||
set -euo pipefail
|
||||
click_file="$(ls -t build/dist/click/*.click | head -1)"
|
||||
echo "Built $click_file"
|
||||
dpkg-deb --contents "$click_file" | grep -E 'manifest.json|inbe.png|metainfo|inbe.desktop'
|
||||
|
||||
- name: Publish to OpenStore
|
||||
run: |
|
||||
set -euo pipefail
|
||||
click_file="$(ls -t build/dist/click/*.click | head -1)"
|
||||
scripts/publish-openstore.sh "$click_file"
|
||||
@@ -169,7 +169,7 @@ jobs:
|
||||
|
||||
build-linux:
|
||||
name: Build Linux
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
needs: test
|
||||
env:
|
||||
APT_CACHE_DIR: /tmp/apt-cache
|
||||
@@ -229,6 +229,37 @@ jobs:
|
||||
find build/dist/linux -maxdepth 1 -type f -name '*.AppImage' -exec cp {} build/release/linux/ \;
|
||||
test -n "$(find build/release/linux -type f -print -quit)"
|
||||
|
||||
- name: Smoke Test Linux AppImage
|
||||
env:
|
||||
APPIMAGE_EXTRACT_AND_RUN: "1"
|
||||
DISPLAY: ":99"
|
||||
run: |
|
||||
set -euo pipefail
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y xvfb x11-utils
|
||||
appimage="$(find build/release/linux -maxdepth 1 -type f -name '*.AppImage' | head -n 1)"
|
||||
chmod +x "$appimage"
|
||||
Xvfb "$DISPLAY" -screen 0 800x600x24 >/tmp/inbe-xvfb.log 2>&1 &
|
||||
xvfb_pid=$!
|
||||
trap 'kill "$app_pid" "$xvfb_pid" >/dev/null 2>&1 || true' EXIT
|
||||
sleep 2
|
||||
"$appimage" >/tmp/inbe-appimage.log 2>&1 &
|
||||
app_pid=$!
|
||||
for _ in $(seq 1 30); do
|
||||
if xwininfo -tree -root | grep -q 'Inner Breeze'; then
|
||||
exit 0
|
||||
fi
|
||||
if ! kill -0 "$app_pid" >/dev/null 2>&1; then
|
||||
echo "AppImage exited before opening a window"
|
||||
cat /tmp/inbe-appimage.log || true
|
||||
exit 1
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
echo "AppImage did not open an X11 window within 30 seconds"
|
||||
cat /tmp/inbe-appimage.log || true
|
||||
exit 1
|
||||
|
||||
- name: Upload Linux Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
@@ -236,6 +267,39 @@ jobs:
|
||||
path: build/release/linux/*
|
||||
if-no-files-found: error
|
||||
|
||||
build-freebsd:
|
||||
name: Build FreeBSD Package
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Build FreeBSD .pkg
|
||||
uses: vmactions/freebsd-vm@v1
|
||||
with:
|
||||
release: "14.3"
|
||||
usesh: true
|
||||
prepare: |
|
||||
pkg install -y gmake cmake pkgconf sdl2 gtk3 curl sqlite3 mesa-libs libdrm hicolor-icon-theme desktop-file-utils
|
||||
run: |
|
||||
set -eu
|
||||
gmake package-freebsd
|
||||
mkdir -p build/release/freebsd
|
||||
find build/dist/freebsd -maxdepth 1 -type f -name '*.pkg' -exec cp {} build/release/freebsd/ \;
|
||||
test -n "$(find build/release/freebsd -type f -print -quit)"
|
||||
|
||||
- name: Upload FreeBSD Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-freebsd
|
||||
path: build/release/freebsd/*
|
||||
if-no-files-found: error
|
||||
|
||||
build-windows:
|
||||
name: Build Windows
|
||||
runs-on: ubuntu-latest
|
||||
@@ -264,7 +328,7 @@ jobs:
|
||||
path: |
|
||||
vendor-builds/windows
|
||||
vendor-builds/sqlite
|
||||
key: windows-vendor-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('Makefile', 'vendor/raylib/src/**', 'vendor/curl/**', 'vendor/sqlite/**') }}
|
||||
key: windows-vendor-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('Makefile', 'vendor/flint/mk/**', 'vendor/flint/scripts/prepare-raylib-source.sh', 'vendor/flint/tools/generate-flint-compat.sh', 'vendor/flint/vendor/raylib/src/**', 'vendor/flint/vendor/curl/**', 'vendor/sqlite/**') }}
|
||||
restore-keys: |
|
||||
windows-vendor-${{ runner.os }}-${{ runner.arch }}-
|
||||
|
||||
@@ -340,7 +404,7 @@ jobs:
|
||||
path: |
|
||||
droid/app/.cxx
|
||||
droid/app/build/intermediates/cxx
|
||||
key: android-native-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('droid/app/src/main/cpp/CMakeLists.txt', 'droid/app/build.gradle', 'src/**/*.c', 'src/**/*.h', 'flint/src/**/*.c', 'flint/include/**/*.h', 'vendor/raylib/src/**') }}
|
||||
key: android-native-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('droid/app/src/main/cpp/CMakeLists.txt', 'droid/app/build.gradle', 'src/**/*.c', 'src/**/*.h', 'flint/src/**/*.c', 'flint/include/**/*.h', 'vendor/flint/vendor/raylib/src/**') }}
|
||||
restore-keys: |
|
||||
android-native-${{ runner.os }}-${{ runner.arch }}-
|
||||
|
||||
@@ -362,7 +426,7 @@ jobs:
|
||||
- name: Copy Android Assets
|
||||
run: ./scripts/copy-android-assets.sh
|
||||
|
||||
- name: Build Android APK
|
||||
- name: Build Android APK and AAB
|
||||
env:
|
||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
@@ -374,7 +438,13 @@ jobs:
|
||||
-Pkeystore.alias="$KEY_ALIAS" \
|
||||
-Pkeystore.password="$KEYSTORE_PASSWORD" \
|
||||
--stacktrace
|
||||
./droid/gradlew -p droid bundleRelease \
|
||||
-Pkeystore.path="$HOME/.android/inbe-release.keystore" \
|
||||
-Pkeystore.alias="$KEY_ALIAS" \
|
||||
-Pkeystore.password="$KEYSTORE_PASSWORD" \
|
||||
--stacktrace
|
||||
make android-copy-release-apks
|
||||
make android-copy-bundle
|
||||
|
||||
- name: Collect Android Release Files
|
||||
run: |
|
||||
@@ -386,6 +456,12 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
cp "build/android/inbe-$VERSION.apk" build/release/android/
|
||||
aab="$(find droid/app/build/outputs/bundle/release build/android -type f -name '*.aab' | head -n 1)"
|
||||
if [ -z "$aab" ]; then
|
||||
echo "No release AAB was produced"
|
||||
exit 1
|
||||
fi
|
||||
cp "$aab" "build/release/android/inbe-$VERSION.aab"
|
||||
|
||||
- name: Upload Android Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
@@ -401,8 +477,13 @@ jobs:
|
||||
- build-web
|
||||
- build-chrome-extension
|
||||
- build-linux
|
||||
- build-freebsd
|
||||
- build-windows
|
||||
- build-android
|
||||
outputs:
|
||||
tag_pushed: ${{ steps.tag_version.outputs.tag_pushed }}
|
||||
tag_name: ${{ steps.tag_version.outputs.tag_name }}
|
||||
version: ${{ steps.tag_version.outputs.version }}
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
@@ -432,6 +513,8 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
TAG="v$VERSION"
|
||||
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
||||
echo "tag_name=$TAG" >> "$GITHUB_OUTPUT"
|
||||
if git rev-parse "$TAG" >/dev/null 2>&1; then
|
||||
echo "Tag $TAG exists, skipping release"
|
||||
echo "tag_pushed=false" >> "$GITHUB_OUTPUT"
|
||||
@@ -441,7 +524,6 @@ jobs:
|
||||
git tag -a "$TAG" -m "Release $VERSION"
|
||||
git push origin "$TAG"
|
||||
echo "tag_pushed=true" >> "$GITHUB_OUTPUT"
|
||||
echo "tag_name=$TAG" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Create GitHub Release
|
||||
@@ -454,3 +536,259 @@ jobs:
|
||||
draft: false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
publish-itch:
|
||||
name: Publish itch.io
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build-web
|
||||
- release
|
||||
if: needs.release.outputs.tag_pushed == 'true'
|
||||
env:
|
||||
BUTLER_API_KEY: ${{ secrets.ITCH_API_KEY }}
|
||||
|
||||
steps:
|
||||
- name: Check itch.io Secret
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [ -z "${BUTLER_API_KEY:-}" ]; then
|
||||
echo "ITCH_API_KEY secret is required to publish itch.io"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Download Release Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: release-*
|
||||
path: build/release
|
||||
merge-multiple: true
|
||||
|
||||
- name: Install Butler
|
||||
run: |
|
||||
set -euo pipefail
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y unzip
|
||||
curl -fsSL \
|
||||
https://broth.itch.zone/butler/linux-amd64/LATEST/archive/default \
|
||||
-o "$RUNNER_TEMP/butler.zip"
|
||||
mkdir -p "$RUNNER_TEMP/butler"
|
||||
unzip -q "$RUNNER_TEMP/butler.zip" -d "$RUNNER_TEMP/butler"
|
||||
chmod +x "$RUNNER_TEMP/butler/butler"
|
||||
echo "$RUNNER_TEMP/butler" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Check Butler
|
||||
run: |
|
||||
set -euo pipefail
|
||||
butler version
|
||||
|
||||
- name: Publish Release Builds to itch.io
|
||||
run: |
|
||||
set -euo pipefail
|
||||
VERSION="${{ needs.release.outputs.version }}"
|
||||
|
||||
web_zip="build/release/inbe-web.zip"
|
||||
android_apk="build/release/inbe-$VERSION.apk"
|
||||
windows_zip="build/release/inbe-windows.zip"
|
||||
linux_appimage="build/release/inbe-linux-x86_64.AppImage"
|
||||
|
||||
test -f "$web_zip"
|
||||
test -f "$android_apk"
|
||||
test -f "$windows_zip"
|
||||
test -f "$linux_appimage"
|
||||
|
||||
mkdir -p build/itch/inbe-web
|
||||
unzip -q "$web_zip" -d build/itch/inbe-web
|
||||
|
||||
butler_push() {
|
||||
local target="$1"
|
||||
local channel="$2"
|
||||
local attempt
|
||||
local log_file
|
||||
log_file="$(mktemp)"
|
||||
|
||||
for attempt in 1 2 3 4 5 6; do
|
||||
if butler push "$target" "waozi/inbe:$channel" --userversion "$VERSION" 2>&1 | tee "$log_file"; then
|
||||
rm -f "$log_file"
|
||||
return 0
|
||||
fi
|
||||
if ! grep -q "latest build is still processing" "$log_file"; then
|
||||
rm -f "$log_file"
|
||||
return 1
|
||||
fi
|
||||
echo "itch.io channel $channel is still processing; retrying in 60s ($attempt/6)"
|
||||
sleep 60
|
||||
done
|
||||
|
||||
rm -f "$log_file"
|
||||
echo "itch.io channel $channel was still processing after retries"
|
||||
return 1
|
||||
}
|
||||
|
||||
butler_push build/itch/inbe-web html5
|
||||
butler_push "$android_apk" android
|
||||
butler_push "$windows_zip" windows
|
||||
butler_push "$linux_appimage" linux
|
||||
|
||||
publish-google-play:
|
||||
name: Publish Google Play Production
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build-android
|
||||
- release
|
||||
if: needs.release.outputs.tag_pushed == 'true'
|
||||
|
||||
steps:
|
||||
- name: Check Google Play Secret
|
||||
env:
|
||||
PLAY_STORE_JSON_KEY: ${{ secrets.PLAY_STORE_JSON_KEY }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [ -z "${PLAY_STORE_JSON_KEY:-}" ]; then
|
||||
echo "PLAY_STORE_JSON_KEY secret is required to publish Google Play"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Download Android Release Artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: release-android
|
||||
path: build/release/android
|
||||
|
||||
- name: Publish AAB to Google Play Production
|
||||
uses: r0adkll/upload-google-play@v1
|
||||
with:
|
||||
serviceAccountJsonPlainText: ${{ secrets.PLAY_STORE_JSON_KEY }}
|
||||
packageName: xyz.waozi.inbe
|
||||
releaseFiles: build/release/android/*.aab
|
||||
track: production
|
||||
status: completed
|
||||
|
||||
publish-amazon:
|
||||
name: Publish Amazon Appstore
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build-android
|
||||
- release
|
||||
if: needs.release.outputs.tag_pushed == 'true'
|
||||
env:
|
||||
AMAZON_CLIENT_ID: ${{ secrets.AMAZON_CLIENT_ID }}
|
||||
AMAZON_CLIENT_SECRET: ${{ secrets.AMAZON_CLIENT_SECRET }}
|
||||
AMAZON_APP_ID: ${{ secrets.AMAZON_APP_ID }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check Amazon Appstore Secrets
|
||||
run: |
|
||||
set -euo pipefail
|
||||
for name in AMAZON_CLIENT_ID AMAZON_CLIENT_SECRET AMAZON_APP_ID; do
|
||||
if [ -z "${!name:-}" ]; then
|
||||
echo "$name secret is required to publish Amazon Appstore"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
- name: Download Android Release Artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: release-android
|
||||
path: build/release/android
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '24'
|
||||
|
||||
- name: Upload AAB to Amazon Appstore
|
||||
env:
|
||||
AMAZON_RELEASE_FILE: build/release/android/inbe-${{ needs.release.outputs.version }}.aab
|
||||
run: node scripts/upload-amazon-appstore.mjs
|
||||
|
||||
publish-chrome-web-store:
|
||||
name: Publish Chrome Web Store
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build-chrome-extension
|
||||
- release
|
||||
if: needs.release.outputs.tag_pushed == 'true'
|
||||
|
||||
steps:
|
||||
- name: Check Chrome Web Store Secrets
|
||||
env:
|
||||
CHROME_CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }}
|
||||
CHROME_CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }}
|
||||
CHROME_REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [ -z "${CHROME_CLIENT_ID:-}" ]; then
|
||||
echo "CHROME_CLIENT_ID secret is required to publish Chrome Web Store"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${CHROME_CLIENT_SECRET:-}" ]; then
|
||||
echo "CHROME_CLIENT_SECRET secret is required to publish Chrome Web Store"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${CHROME_REFRESH_TOKEN:-}" ]; then
|
||||
echo "CHROME_REFRESH_TOKEN secret is required to publish Chrome Web Store"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Download Chrome Extension Artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: release-chrome-web-store
|
||||
path: build/release/chrome-web-store
|
||||
|
||||
- name: Publish Chrome Extension
|
||||
env:
|
||||
CHROME_CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }}
|
||||
CHROME_CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }}
|
||||
CHROME_REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }}
|
||||
CHROME_EXTENSION_ID: lballhghblaenelehneigekpofgcaifa
|
||||
CHROME_EXTENSION_ZIP: build/release/chrome-web-store/inbe-chrome-web-store.zip
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
token_response="$(curl --fail --silent --show-error \
|
||||
--request POST \
|
||||
--data-urlencode "client_id=${CHROME_CLIENT_ID}" \
|
||||
--data-urlencode "client_secret=${CHROME_CLIENT_SECRET}" \
|
||||
--data-urlencode "refresh_token=${CHROME_REFRESH_TOKEN}" \
|
||||
--data-urlencode "grant_type=refresh_token" \
|
||||
https://oauth2.googleapis.com/token)"
|
||||
|
||||
access_token="$(python3 -c 'import json, sys; print(json.load(sys.stdin)["access_token"])' <<< "$token_response")"
|
||||
|
||||
upload_response="$(curl --fail --silent --show-error \
|
||||
--request PUT \
|
||||
--header "Authorization: Bearer ${access_token}" \
|
||||
--header "x-goog-api-version: 2" \
|
||||
--upload-file "${CHROME_EXTENSION_ZIP}" \
|
||||
"https://www.googleapis.com/upload/chromewebstore/v1.1/items/${CHROME_EXTENSION_ID}")"
|
||||
|
||||
python3 - "$upload_response" <<'PY'
|
||||
import json
|
||||
import sys
|
||||
|
||||
response = json.loads(sys.argv[1])
|
||||
if response.get("uploadState") != "SUCCESS":
|
||||
print(json.dumps(response, indent=2), file=sys.stderr)
|
||||
raise SystemExit("Chrome Web Store upload failed")
|
||||
PY
|
||||
|
||||
publish_response="$(curl --fail --silent --show-error \
|
||||
--request POST \
|
||||
--header "Authorization: Bearer ${access_token}" \
|
||||
--header "x-goog-api-version: 2" \
|
||||
"https://www.googleapis.com/chromewebstore/v1.1/items/${CHROME_EXTENSION_ID}/publish")"
|
||||
|
||||
python3 - "$publish_response" <<'PY'
|
||||
import json
|
||||
import sys
|
||||
|
||||
response = json.loads(sys.argv[1])
|
||||
if "OK" not in response.get("status", []):
|
||||
print(json.dumps(response, indent=2), file=sys.stderr)
|
||||
raise SystemExit("Chrome Web Store publish failed")
|
||||
PY
|
||||
@@ -51,6 +51,7 @@ Captures/
|
||||
Thumbs.db
|
||||
*.bak
|
||||
*.swp
|
||||
*.core
|
||||
|
||||
local.properties
|
||||
*.o
|
||||
|
||||
@@ -1,21 +1,9 @@
|
||||
[submodule "vendor/raylib"]
|
||||
path = vendor/raylib
|
||||
url = https://github.com/raysan5/raylib.git
|
||||
[submodule "vendor/rini"]
|
||||
path = vendor/rini
|
||||
url = https://github.com/raysan5/rini.git
|
||||
[submodule "vendor/otfchop"]
|
||||
path = vendor/otfchop
|
||||
url = https://github.com/waozixyz/otfchop
|
||||
[submodule "vendor/sqlite"]
|
||||
path = vendor/sqlite
|
||||
url = https://github.com/sqlite/sqlite
|
||||
[submodule "vendor/liboqs"]
|
||||
path = vendor/liboqs
|
||||
url = https://github.com/open-quantum-safe/liboqs.git
|
||||
[submodule "vendor/curl"]
|
||||
path = vendor/curl
|
||||
url = https://github.com/curl/curl.git
|
||||
[submodule "vendor/flint"]
|
||||
path = vendor/flint
|
||||
url = [email protected]:waozixyz/flint.git
|
||||
@@ -1,4 +1,165 @@
|
||||
# Changelog
|
||||
## [1.8.4] - 2026-07-11
|
||||
### Changed
|
||||
- Reworked Profile configuration navigation to use a full-width dropdown instead of the tab bar.
|
||||
- Updated sidebar return behavior for Profile and Settings flows.
|
||||
- Updated Flint profile widgets and profile picture assets, including sidebar profile image sizing and picker scrolling.
|
||||
|
||||
## [1.8.3] - 2026-07-10
|
||||
### Changed
|
||||
- Improved ui in practice screen
|
||||
|
||||
## [1.8.2] - 2026-07-09
|
||||
### Changed
|
||||
- improved desktop experience
|
||||
- add system themes
|
||||
|
||||
## [1.8.1] - 2026-07-03
|
||||
### Fixed
|
||||
- storage settings for android 17+
|
||||
|
||||
## [1.8.0] - 2026-07-02
|
||||
### Changed
|
||||
- upgrade to sync protocol v3
|
||||
- ui fixes
|
||||
|
||||
## [1.7.12] - 2026-07-01
|
||||
### Changed
|
||||
- fix web
|
||||
- deduplicate code
|
||||
|
||||
## [1.7.11] - 2026-07-01
|
||||
### Addded
|
||||
- add more banners
|
||||
|
||||
## [1.7.10] - 2026-07-01
|
||||
### Changed
|
||||
- updated whm banner
|
||||
|
||||
## [1.7.9] - 2026-07-01
|
||||
### Fixed
|
||||
- improve sync review
|
||||
|
||||
## [1.7.8] - 2026-07-01
|
||||
### Changed
|
||||
- Redesign the Practice home screen around carousel-style practice cards with explicit start, manual, configure, and music actions.
|
||||
- Move meditation music configuration into a shared practice music panel with per-practice enablement and track selection.
|
||||
|
||||
## [1.7.7] - 2026-07-01
|
||||
### Changed
|
||||
- Move habit tracking overview out of Profile and into the Habits tab with direct day toggles, reorder controls, and local view persistence.
|
||||
- Rework Settings into an overview page with section title bars and shared return/title bar UI.
|
||||
|
||||
## [1.7.6] - 2026-06-30
|
||||
### Added
|
||||
- habit overview
|
||||
|
||||
## [1.7.5] - 2026-06-29
|
||||
### Fixed
|
||||
- Fix Android 15 relaunch freeze.
|
||||
- Code cleanup
|
||||
|
||||
## [1.7.4] - 2026-06-29
|
||||
### Fixed
|
||||
- Clean up practice stats, friend removal, sync review, and Android inset handling.
|
||||
|
||||
## [1.7.3] - 2026-06-29
|
||||
### Fixed
|
||||
- bottom inset in practice
|
||||
|
||||
### Changed
|
||||
- Improve habit management
|
||||
|
||||
## [1.7.2] - 2026-06-29
|
||||
### Added
|
||||
- Add local `make install` target.
|
||||
- Add Profile controls for habit ordering and practice visibility.
|
||||
|
||||
### Changed
|
||||
- Move sync status into the Data view and simplify the habits add option.
|
||||
- Clean up the README.
|
||||
|
||||
## [1.7.1] - 2026-06-28
|
||||
### Changed
|
||||
- Move shared Lyra sync protocol code into Flint and simplify Inbe sync client wiring.
|
||||
|
||||
## [1.7.0] - 2026-06-28
|
||||
### Changed
|
||||
- Rework Android safe-area handling to use one native inset path with stable bottom navigation spacing.
|
||||
- Move leaderboard stats to synced source data, with local current-user rows shown immediately.
|
||||
|
||||
### Fixed
|
||||
- Fix profile/friend sync freshness, leaderboard empty states, modal input capture, pet asset embedding, and wrapped text previews.
|
||||
|
||||
## [1.6.6] - 2026-06-28
|
||||
### Changed
|
||||
- updated the practice screen ui/ux
|
||||
|
||||
## [1.6.5] - 2026-06-28
|
||||
### Fixed
|
||||
- Repair habit-day sync for zero-count completions.
|
||||
- Require liboqs at build time for every sync-enabled target.
|
||||
|
||||
## [1.6.4] - 2026-06-27
|
||||
### Changed
|
||||
- Move meditation duration selection into practice configuration with custom time support.
|
||||
- Add centered in-session meditation add-time controls.
|
||||
- Use Flint-managed liboqs, LibreSSL, and curl build paths.
|
||||
|
||||
### Fixed
|
||||
- Fix Android native build to use Flint's liboqs submodule.
|
||||
|
||||
## [1.6.3] - 2026-06-27
|
||||
### Changed
|
||||
- Improve theme, habit, and localization UI polish
|
||||
|
||||
## [1.6.2] - 2026-06-27
|
||||
### Changed
|
||||
- Improve sun salutation
|
||||
|
||||
## [1.6.1] - 2026-06-27
|
||||
### Changed
|
||||
- Improved notification in session
|
||||
- Standardized settings screen1
|
||||
|
||||
## [1.6.0] - 2026-06-26
|
||||
### Added
|
||||
- Sun Salutation practice with Yoga habit sync support.
|
||||
|
||||
### Changed
|
||||
- Improve sync reliability and review handling.
|
||||
|
||||
## [1.5.9] - 2026-06-26
|
||||
### Fixed
|
||||
- Android session notification and wakelock for screen-locked playback
|
||||
|
||||
## [1.5.8] - 2026-06-25
|
||||
### Fixed
|
||||
- Background play for meditation practice
|
||||
|
||||
## [1.5.7] - 2026-06-25
|
||||
- Fix test music
|
||||
|
||||
## [1.5.6] - 2026-06-24
|
||||
### Fixed
|
||||
- Modal button issue
|
||||
|
||||
## [1.5.5] - 2026-06-24
|
||||
### Fixed
|
||||
- modal capture bug
|
||||
- fix sync diff
|
||||
|
||||
## [1.5.4] - 2026-06-24
|
||||
### Changed
|
||||
- Use Flint-managed modal handling so modal dialogs block background input consistently.
|
||||
- Add optional sync account aliases, with compact public ID display and full ID reveal modal.
|
||||
- Make sync state tracking more robust with snapshot hash checks and review flow for unresolved differences.
|
||||
- Use Flint's built-in font chopping pipeline and verify multilingual locale glyph coverage.
|
||||
|
||||
## [1.5.3] - 2026-06-23
|
||||
### Fixed
|
||||
- modal issues
|
||||
|
||||
## [1.5.2] - 2026-06-23
|
||||
### Changed
|
||||
- let you disable screen transitions
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
include Makefile
|
||||
@@ -1,88 +1,174 @@
|
||||
# Inner Breeze
|
||||
|
||||
Inner Breeze is a free, open-source practice app for breathing, meditation, and habit tracking.
|
||||
Inner Breeze is a free, open-source app for breathing, meditation, and habit tracking.
|
||||
|
||||
## Features
|
||||
## Build
|
||||
|
||||
- Guided practice sessions with visual and audio cues
|
||||
- Mind, Yoga, and Fitness organization for habits and practice views
|
||||
- Configurable breathing sessions and meditation timers
|
||||
- Habit tracking with session history
|
||||
- Local SQLite storage with import/export support
|
||||
- Theme customization with light and dark variants
|
||||
- Touch-optimized UI for desktop and mobile
|
||||
|
||||
## Building
|
||||
|
||||
inbe uses [raylib](https://github.com/raysan5/raylib) and requires a Nix development environment.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- [Nix](https://nixos.org/download.html) with flakes enabled
|
||||
- For Android builds: Java 17+ JDK
|
||||
|
||||
### Native Build
|
||||
Build with the system toolchain and project Makefile:
|
||||
|
||||
```bash
|
||||
# Enter the development shell
|
||||
nix develop
|
||||
|
||||
# Build for your current platform
|
||||
make native
|
||||
|
||||
# Run
|
||||
make run
|
||||
```
|
||||
|
||||
### Cross-Platform Builds
|
||||
On FreeBSD, use GNU Make:
|
||||
|
||||
```bash
|
||||
gmake native
|
||||
gmake run
|
||||
```
|
||||
|
||||
Native binaries are written to `build/bin/<platform>/`, for example
|
||||
`build/bin/freebsd/inbe-freebsd-x86_64` on FreeBSD.
|
||||
|
||||
Install into the system prefix:
|
||||
|
||||
```bash
|
||||
make install
|
||||
```
|
||||
|
||||
By default this installs the binary, desktop entry, icon, and AppStream
|
||||
metadata under `/usr/local`. Use `DESTDIR` for staged/package installs, or
|
||||
`PREFIX` to choose another install root.
|
||||
|
||||
Install for only the current user:
|
||||
|
||||
```bash
|
||||
make install-user
|
||||
```
|
||||
|
||||
This installs under `~/.local`, including the desktop entry and icon.
|
||||
|
||||
## FreeBSD Package
|
||||
|
||||
Build a native FreeBSD package from inside the repo:
|
||||
|
||||
```bash
|
||||
gmake package-freebsd
|
||||
```
|
||||
|
||||
The package is written to `build/dist/freebsd/`, for example:
|
||||
|
||||
```bash
|
||||
build/dist/freebsd/inbe-1.8.3-freebsd-x86_64.pkg
|
||||
```
|
||||
|
||||
Install it with FreeBSD `pkg`:
|
||||
|
||||
```bash
|
||||
sudo pkg install -y ./build/dist/freebsd/inbe-1.8.3-freebsd-x86_64.pkg
|
||||
```
|
||||
|
||||
The package installs the `inbe` command plus desktop integration for menus such
|
||||
as Xfce: `Inner Breeze` appears from the `.desktop` file, uses the bundled icon,
|
||||
and includes AppStream metadata.
|
||||
|
||||
## Other Targets
|
||||
|
||||
General:
|
||||
|
||||
```bash
|
||||
make test
|
||||
make dist
|
||||
make clean
|
||||
```
|
||||
|
||||
Native desktop:
|
||||
|
||||
```bash
|
||||
make native
|
||||
make run
|
||||
make install-user
|
||||
make uninstall
|
||||
```
|
||||
|
||||
FreeBSD:
|
||||
|
||||
```bash
|
||||
gmake package-freebsd
|
||||
```
|
||||
|
||||
Android:
|
||||
|
||||
```bash
|
||||
# Android debug APK
|
||||
make android-debug
|
||||
|
||||
# Android release APK
|
||||
make android-release PASSWORD=your-keystore-password
|
||||
make android-release
|
||||
make android-bundle
|
||||
```
|
||||
|
||||
### Android Emulator Testing
|
||||
|
||||
For automated testing with camera notch (cutout) support:
|
||||
Web:
|
||||
|
||||
```bash
|
||||
# Enter the development shell and run everything automatically
|
||||
nix develop
|
||||
./scripts/emulator.sh # Creates and launches the test AVD
|
||||
make android-install # Builds, installs, and launches the app
|
||||
make web
|
||||
make site
|
||||
make chrome-web-store
|
||||
```
|
||||
|
||||
This single script handles:
|
||||
- AVD creation (if missing)
|
||||
- Emulator launch
|
||||
- APK build
|
||||
- App installation and launch
|
||||
Linux:
|
||||
|
||||
The AVD is configured with:
|
||||
- **Device**: Pixel 6 (punch-hole camera style)
|
||||
- **Display**: 1080×2400 @ 420dpi
|
||||
- **RAM**: 4GB with hardware acceleration
|
||||
- **Cutout**: Punch-hole camera for testing window insets
|
||||
```bash
|
||||
make appimage
|
||||
```
|
||||
|
||||
### Platform-Specific Notes
|
||||
Ubuntu Touch:
|
||||
|
||||
- **Linux**: Requires SDL2 runtime libraries
|
||||
- **Windows**: Standalone executable, no dependencies
|
||||
- **Android**: Requires Android NDK in the development shell
|
||||
- **Web**: Requires Emscripten toolchain
|
||||
```bash
|
||||
make click
|
||||
```
|
||||
|
||||
## Project Structure
|
||||
Windows:
|
||||
|
||||
- `src/` - Inbe application code
|
||||
- `vendor/` - external third-party dependencies
|
||||
- `vendor/flint/` - first-party UI/runtime support code used directly by Inbe
|
||||
- `wasm4/` - Standalone WASM-4 version
|
||||
- `assets/` - Images and sounds
|
||||
- `droid/` - Android build configuration
|
||||
```bash
|
||||
make windows
|
||||
```
|
||||
|
||||
Common outputs:
|
||||
|
||||
- `make native` builds `build/bin/<platform>/inbe-<platform>-<arch>`.
|
||||
- `make appimage` builds a Linux AppImage under `build/dist/linux/`.
|
||||
- `make web` builds and smoke-tests the web app, then writes `build/dist/inbe-web.zip`.
|
||||
- `make windows` builds 64-bit and 32-bit Windows binaries and writes a zip under `build/dist/windows/`.
|
||||
- `make click` builds the Ubuntu Touch Click package under `build/dist/click/`.
|
||||
- `make dist` builds release artifacts; Android release targets require `PASSWORD`.
|
||||
|
||||
## Android
|
||||
|
||||
Build a debug APK:
|
||||
|
||||
```bash
|
||||
make android-debug
|
||||
```
|
||||
|
||||
Create and launch an Android 17/API 37.1 AVD for Pixel storage testing:
|
||||
|
||||
```bash
|
||||
ANDROID_API=37.1 bash scripts/create-avd.sh inbe-android-37-1
|
||||
AVD_NAME=inbe-android-37-1 bash scripts/emulator.sh
|
||||
```
|
||||
|
||||
Android 17 system images are listed by Google as `android-37.0`,
|
||||
`android-37.1`, and `android-CinnamonBun`. The repo AVD script supports the
|
||||
16 KB page-size image types such as `google_apis_playstore_ps16k`.
|
||||
|
||||
Native Android storage must use the app's private internal data directory from
|
||||
`ANativeActivity->internalDataPath`, not the process working directory. Inbe's
|
||||
SQLite database lives under that app-private root and is removed when the app is
|
||||
uninstalled.
|
||||
|
||||
## Project Layout
|
||||
|
||||
- `src/` - app code
|
||||
- `assets/` - images, fonts, and sounds
|
||||
- `locales/` - translations
|
||||
- `droid/` - Android project
|
||||
- `site/` - website
|
||||
- `vendor/flint/` - Flint UI/runtime submodule
|
||||
|
||||
## Notes
|
||||
|
||||
Inbe stores app data locally in SQLite. Optional sync can mirror user-owned
|
||||
data through a Lyra-compatible sync server.
|
||||
|
||||
## License
|
||||
|
||||
MIT - see [LICENSE](LICENSE)
|
||||
MIT. See [LICENSE](LICENSE).
|
||||
|
After Width: | Height: | Size: 995 B |
|
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 98 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 163 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 9.4 KiB |
|
Before Width: | Height: | Size: 249 B |
|
Before Width: | Height: | Size: 235 B |
|
Before Width: | Height: | Size: 323 B |
|
Before Width: | Height: | Size: 265 B |
|
Before Width: | Height: | Size: 294 B |
|
Before Width: | Height: | Size: 236 B |
|
Before Width: | Height: | Size: 305 B |
|
Before Width: | Height: | Size: 328 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 907 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 990 B |
|
After Width: | Height: | Size: 934 B |
|
After Width: | Height: | Size: 961 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 295 B |
|
Before Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 230 KiB |
|
Before Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 59 KiB |
|
After Width: | Height: | Size: 58 KiB |
@@ -35,8 +35,8 @@ android {
|
||||
defaultConfig {
|
||||
minSdk 21
|
||||
targetSdk 35
|
||||
versionCode 48
|
||||
versionName "1.5.2"
|
||||
versionCode 79
|
||||
versionName "1.8.4"
|
||||
}
|
||||
|
||||
|
||||
@@ -61,12 +61,8 @@ android {
|
||||
abi {
|
||||
enable true
|
||||
reset()
|
||||
def selectedAbis = (project.findProperty('inbe.abis') ?: 'arm64-v8a,armeabi-v7a,x86,x86_64')
|
||||
.split(',')
|
||||
.collect { it.trim() }
|
||||
.findAll { it.length() > 0 }
|
||||
include(*selectedAbis)
|
||||
universalApk !project.hasProperty('inbe.abis')
|
||||
include 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'
|
||||
universalApk true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
|
||||
<application
|
||||
android:hasCode="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
@@ -10,8 +12,9 @@
|
||||
android:roundIcon="@mipmap/ic_launcher_round">
|
||||
<activity
|
||||
android:name="xyz.waozi.inbe.MainActivity"
|
||||
android:configChanges="keyboardHidden|uiMode"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize|smallestScreenSize|uiMode"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@android:style/Theme.DeviceDefault.NoActionBar"
|
||||
android:windowLayoutInDisplayCutoutMode="never">
|
||||
<meta-data
|
||||
@@ -32,5 +35,10 @@
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths" />
|
||||
</provider>
|
||||
|
||||
<service
|
||||
android:name="xyz.waozi.inbe.SessionForegroundService"
|
||||
android:exported="false"
|
||||
android:foregroundServiceType="mediaPlayback" />
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -2,14 +2,17 @@ cmake_minimum_required(VERSION 3.22)
|
||||
project(Inbe C)
|
||||
|
||||
find_program(CCACHE_PROGRAM ccache)
|
||||
if(CCACHE_PROGRAM)
|
||||
if(CCACHE_PROGRAM AND EXISTS "${CCACHE_PROGRAM}")
|
||||
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
|
||||
else()
|
||||
set(CMAKE_C_COMPILER_LAUNCHER "")
|
||||
set(CMAKE_C_COMPILER_LAUNCHER "" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
set(REPO_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../../../..")
|
||||
set(SRC_DIR "${REPO_ROOT}/src")
|
||||
set(RAYLIB_DIR "${REPO_ROOT}/vendor/raylib/src")
|
||||
set(FLINT_DIR "${REPO_ROOT}/vendor/flint")
|
||||
set(RAYLIB_DIR "${FLINT_DIR}/vendor/raylib/src")
|
||||
set(SQLITE_DIR "${REPO_ROOT}/vendor/sqlite")
|
||||
set(SQLITE_BUILD_DIR "${CMAKE_BINARY_DIR}/sqlite")
|
||||
set(SQLITE_AMALGAMATION_C "${SQLITE_BUILD_DIR}/sqlite3.c")
|
||||
@@ -18,16 +21,37 @@ set(NATIVE_APP_GLUE_DIR "${ANDROID_NDK}/sources/android/native_app_glue")
|
||||
set(OQS_BUILD_ONLY_LIB ON CACHE BOOL "" FORCE)
|
||||
set(OQS_USE_OPENSSL OFF CACHE BOOL "" FORCE)
|
||||
set(OQS_MINIMAL_BUILD "SIG_ml_dsa_44" CACHE STRING "" FORCE)
|
||||
add_subdirectory("${REPO_ROOT}/vendor/liboqs" "${CMAKE_BINARY_DIR}/liboqs")
|
||||
file(GLOB FLINT_SOURCES CONFIGURE_DEPENDS "${FLINT_DIR}/src/*.c" "${FLINT_DIR}/src/ui/*.c")
|
||||
list(REMOVE_ITEM FLINT_SOURCES "${FLINT_DIR}/src/flint_file_dialog.c")
|
||||
set(OQS_DIST_BUILD OFF CACHE BOOL "" FORCE)
|
||||
set(OQS_OPT_TARGET generic CACHE STRING "" FORCE)
|
||||
foreach(oqs_x86_feature
|
||||
ADX AES AVX AVX2 AVX512 AVX512BW AVX512DQ AVX512F
|
||||
BMI1 BMI2 FMA PCLMULQDQ POPCNT SSE SSE2 SSE3 VPCLMULQDQ)
|
||||
set(OQS_USE_${oqs_x86_feature}_INSTRUCTIONS OFF CACHE BOOL "" FORCE)
|
||||
endforeach()
|
||||
add_subdirectory("${FLINT_DIR}/vendor/liboqs" "${CMAKE_BINARY_DIR}/liboqs")
|
||||
if(NOT TARGET oqs)
|
||||
message(FATAL_ERROR "Inbe Android builds require liboqs for sync account crypto")
|
||||
endif()
|
||||
file(GLOB_RECURSE FLINT_SOURCES CONFIGURE_DEPENDS "${FLINT_DIR}/src/*.c")
|
||||
list(REMOVE_ITEM FLINT_SOURCES "${FLINT_DIR}/src/file_dialog/file_dialog.c")
|
||||
file(GLOB INBE_LOCALE_ASSETS RELATIVE "${REPO_ROOT}" CONFIGURE_DEPENDS "${REPO_ROOT}/locales/*.txt")
|
||||
file(GLOB INBE_SOUND_ASSETS RELATIVE "${REPO_ROOT}" CONFIGURE_DEPENDS "${REPO_ROOT}/assets/sounds/*.ogg")
|
||||
file(GLOB INBE_PRACTICE_BANNER_ASSETS RELATIVE "${REPO_ROOT}" CONFIGURE_DEPENDS "${REPO_ROOT}/assets/practices/*/banner.png")
|
||||
set(INBE_EMBEDDED_INPUTS
|
||||
${INBE_LOCALE_ASSETS}
|
||||
assets/practices/whm/1.jpg
|
||||
assets/practices/whm/2.jpg
|
||||
assets/practices/meditation/1.jpg
|
||||
assets/practices/whm/1.png
|
||||
assets/practices/whm/2.png
|
||||
assets/practices/meditation/1.png
|
||||
assets/pet/egg1.png
|
||||
${INBE_PRACTICE_BANNER_ASSETS}
|
||||
assets/practices/sunsalutation/pos_0001.png
|
||||
assets/practices/sunsalutation/pos_0002.png
|
||||
assets/practices/sunsalutation/pos_0003.png
|
||||
assets/practices/sunsalutation/pos_0004.png
|
||||
assets/practices/sunsalutation/pos_0005.png
|
||||
assets/practices/sunsalutation/pos_0006.png
|
||||
assets/practices/sunsalutation/pos_0007.png
|
||||
assets/practices/sunsalutation/pos_0008.png
|
||||
assets/fonts/locales.png
|
||||
assets/fonts/locales.dat
|
||||
${INBE_SOUND_ASSETS}
|
||||
@@ -95,7 +119,9 @@ target_include_directories(raylib PUBLIC
|
||||
add_library(main SHARED
|
||||
"${SRC_DIR}/main.c"
|
||||
"${SRC_DIR}/core/breath_engine.c"
|
||||
"${SRC_DIR}/app/app_sync.c"
|
||||
"${SRC_DIR}/app/app.c"
|
||||
"${SRC_DIR}/app/app_nav.c"
|
||||
"${SRC_DIR}/app/app_settings.c"
|
||||
"${SRC_DIR}/app/device_preferences.c"
|
||||
"${SRC_DIR}/practices/practice_registry.c"
|
||||
@@ -107,15 +133,22 @@ add_library(main SHARED
|
||||
"${SRC_DIR}/practices/meditation/meditation_session.c"
|
||||
"${SRC_DIR}/practices/meditation/meditation_manual.c"
|
||||
"${SRC_DIR}/practices/meditation/meditation_config.c"
|
||||
"${SRC_DIR}/practices/sun_salutation/sun_salutation_practice.c"
|
||||
"${SRC_DIR}/practices/sun_salutation/sun_salutation_session.c"
|
||||
"${SRC_DIR}/screens/habits_screen.c"
|
||||
"${SRC_DIR}/screens/statistics_screen.c"
|
||||
"${SRC_DIR}/screens/habits/edit.c"
|
||||
"${SRC_DIR}/screens/habits/session.c"
|
||||
"${SRC_DIR}/screens/profile_screen.c"
|
||||
"${SRC_DIR}/screens/profile_social.c"
|
||||
"${SRC_DIR}/screens/pet_screen.c"
|
||||
"${SRC_DIR}/practices/meditation/meditation_music.c"
|
||||
"${SRC_DIR}/storage/data.c"
|
||||
"${SRC_DIR}/storage/db.c"
|
||||
"${SRC_DIR}/storage/import.c"
|
||||
"${SRC_DIR}/storage/storage.c"
|
||||
"${SRC_DIR}/storage/storage_sessions.c"
|
||||
"${SRC_DIR}/storage/sync_review.c"
|
||||
"${SRC_DIR}/storage/sync_account.c"
|
||||
"${SRC_DIR}/storage/sync_client.c"
|
||||
"${SRC_DIR}/third_party/miniz.c"
|
||||
@@ -128,8 +161,11 @@ add_library(main SHARED
|
||||
"${SRC_DIR}/screens/language_screen.c"
|
||||
"${SRC_DIR}/screens/manual_screen.c"
|
||||
"${SRC_DIR}/screens/settings/settings_screen.c"
|
||||
"${SRC_DIR}/screens/settings/settings_ui.c"
|
||||
"${SRC_DIR}/screens/settings/settings_device.c"
|
||||
"${SRC_DIR}/screens/settings/settings_session.c"
|
||||
"${SRC_DIR}/screens/settings/settings_theme.c"
|
||||
"${SRC_DIR}/screens/settings/settings_about.c"
|
||||
"${SRC_DIR}/screens/settings/settings_data.c"
|
||||
"${SRC_DIR}/screens/settings/settings_sync_account.c"
|
||||
"${INBE_EMBEDDED_ASSETS_C}"
|
||||
@@ -141,6 +177,8 @@ add_library(main SHARED
|
||||
)
|
||||
|
||||
target_include_directories(main PRIVATE
|
||||
"${FLINT_DIR}/include"
|
||||
"${FLINT_DIR}/src"
|
||||
"${SRC_DIR}"
|
||||
"${SRC_DIR}/app"
|
||||
"${SRC_DIR}/core"
|
||||
@@ -149,11 +187,11 @@ target_include_directories(main PRIVATE
|
||||
"${SRC_DIR}/practices"
|
||||
"${SRC_DIR}/practices/whm"
|
||||
"${SRC_DIR}/practices/meditation"
|
||||
"${SRC_DIR}/practices/sun_salutation"
|
||||
"${SRC_DIR}/storage"
|
||||
"${SRC_DIR}/platform/android"
|
||||
"${SRC_DIR}/third_party"
|
||||
"${NATIVE_APP_GLUE_DIR}"
|
||||
"${FLINT_DIR}/include"
|
||||
"${SQLITE_BUILD_DIR}"
|
||||
)
|
||||
|
||||
@@ -168,8 +206,8 @@ target_compile_definitions(main PRIVATE
|
||||
MG_ENABLE_POSIX_FS=0
|
||||
SUPPORT_MODULE_RAUDIO=1
|
||||
SUPPORT_FILEFORMAT_OGG=1
|
||||
FLINT_EMBEDDED_ONLY=1
|
||||
INBE_HAS_LIBOQS=1
|
||||
UI_EMBEDDED_ONLY=1
|
||||
HAS_LIBOQS=1
|
||||
)
|
||||
|
||||
target_compile_options(main PRIVATE
|
||||
@@ -183,6 +221,7 @@ target_link_options(main PRIVATE
|
||||
-Wl,--gc-sections
|
||||
-Wl,--strip-all
|
||||
-Wl,-z,max-page-size=16384
|
||||
-Wl,-z,common-page-size=16384
|
||||
-Wl,--wrap=fopen
|
||||
)
|
||||
|
||||
|
||||
@@ -14,30 +14,25 @@ import android.graphics.Insets;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.PowerManager;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import android.view.DisplayCutout;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.WindowInsets;
|
||||
import android.view.WindowInsetsController;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import androidx.core.view.WindowCompat;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.URI;
|
||||
import java.net.UnknownHostException;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.SecureRandom;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
|
||||
public class MainActivity extends NativeActivity {
|
||||
private static final String TAG = "InbeMainActivity";
|
||||
@@ -50,14 +45,13 @@ public class MainActivity extends NativeActivity {
|
||||
System.loadLibrary("main");
|
||||
}
|
||||
|
||||
// [status_bar, nav_bar, cutout_left, cutout_top, cutout_right, cutout_bottom]
|
||||
// [status_bar, nav_bar, cutouts] mirrored in native.
|
||||
private final int[] cachedInsets = new int[6];
|
||||
private boolean insetsInitialized = false;
|
||||
private PowerManager.WakeLock wakeLock = null;
|
||||
private boolean activityPaused = false;
|
||||
private boolean windowFocused = true;
|
||||
private boolean backgroundExecutionActive = false;
|
||||
private boolean autoPausedForLifecycle = false;
|
||||
private boolean notificationPermissionRequestInFlight = false;
|
||||
private int lastDeleteRepeatCount = -1;
|
||||
|
||||
private native void nativeSetInsets(int status, int nav,
|
||||
@@ -79,14 +73,17 @@ public class MainActivity extends NativeActivity {
|
||||
private native void nativeTextInputEnter();
|
||||
private native void nativeInvalidateGraphicsResources();
|
||||
|
||||
private void requestDownloadNotificationPermissionIfNeeded() {
|
||||
private void requestNotificationPermissionIfNeeded() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU &&
|
||||
checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) {
|
||||
checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED &&
|
||||
!notificationPermissionRequestInFlight) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU &&
|
||||
checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) {
|
||||
checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED &&
|
||||
!notificationPermissionRequestInFlight) {
|
||||
notificationPermissionRequestInFlight = true;
|
||||
requestPermissions(new String[] { Manifest.permission.POST_NOTIFICATIONS },
|
||||
REQUEST_POST_NOTIFICATIONS);
|
||||
}
|
||||
@@ -95,8 +92,19 @@ public class MainActivity extends NativeActivity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
if (requestCode == REQUEST_POST_NOTIFICATIONS) {
|
||||
notificationPermissionRequestInFlight = false;
|
||||
boolean granted = grantResults.length > 0 &&
|
||||
grantResults[0] == PackageManager.PERMISSION_GRANTED;
|
||||
Log.d(TAG, "Notification permission result: granted=" + granted);
|
||||
}
|
||||
}
|
||||
|
||||
private NotificationManager getDownloadNotificationManager() {
|
||||
requestDownloadNotificationPermissionIfNeeded();
|
||||
requestNotificationPermissionIfNeeded();
|
||||
NotificationManager manager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
if (manager != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
NotificationChannel channel = new NotificationChannel(
|
||||
@@ -292,224 +300,11 @@ public class MainActivity extends NativeActivity {
|
||||
}
|
||||
|
||||
public String syncHttpRequest(String method, String urlText, String body, String[] headers) {
|
||||
HttpURLConnection connection = null;
|
||||
int status = 0;
|
||||
|
||||
try {
|
||||
byte[] bodyBytes = body != null ? body.getBytes(StandardCharsets.UTF_8) : new byte[0];
|
||||
connection = (HttpURLConnection)new URL(urlText).openConnection();
|
||||
connection.setInstanceFollowRedirects(false);
|
||||
connection.setConnectTimeout(15000);
|
||||
connection.setReadTimeout(30000);
|
||||
connection.setRequestMethod(method);
|
||||
connection.setRequestProperty("User-Agent", "inbe-sync/1");
|
||||
if (headers != null) {
|
||||
for (String header : headers) {
|
||||
if (header == null) continue;
|
||||
int colon = header.indexOf(':');
|
||||
if (colon <= 0) continue;
|
||||
String key = header.substring(0, colon).trim();
|
||||
String value = header.substring(colon + 1).trim();
|
||||
if (!key.isEmpty()) {
|
||||
connection.setRequestProperty(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ("POST".equals(method) || "DELETE".equals(method)) {
|
||||
connection.setDoOutput(true);
|
||||
connection.setFixedLengthStreamingMode(bodyBytes.length);
|
||||
try (OutputStream output = connection.getOutputStream()) {
|
||||
output.write(bodyBytes);
|
||||
}
|
||||
}
|
||||
|
||||
status = connection.getResponseCode();
|
||||
InputStream stream = status >= 400 ? connection.getErrorStream() : connection.getInputStream();
|
||||
String response = "";
|
||||
if (stream != null) {
|
||||
try (InputStream input = stream) {
|
||||
byte[] bytes = readAllBytesCompat(input);
|
||||
response = new String(bytes, StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
return status + "\n" + response;
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Sync HTTP request failed", e);
|
||||
return status + "\n" + (e.getMessage() != null ? e.getMessage() : "request failed");
|
||||
} finally {
|
||||
if (connection != null) {
|
||||
connection.disconnect();
|
||||
}
|
||||
}
|
||||
return SyncNetwork.httpRequest(TAG, method, urlText, body, headers);
|
||||
}
|
||||
|
||||
public String syncWebSocketWait(String urlText, String[] headers) {
|
||||
Socket socket = null;
|
||||
|
||||
try {
|
||||
URI url = new URI(urlText);
|
||||
String protocol = url.getScheme();
|
||||
boolean secure = "wss".equals(protocol);
|
||||
int port = url.getPort();
|
||||
String path = url.getRawPath();
|
||||
if (path == null || path.isEmpty()) path = "/";
|
||||
if (url.getRawQuery() != null && !url.getRawQuery().isEmpty()) {
|
||||
path += "?" + url.getRawQuery();
|
||||
}
|
||||
if (port <= 0) port = secure ? 443 : 80;
|
||||
if (!secure && !"ws".equals(protocol)) {
|
||||
return "0\ninvalid websocket url";
|
||||
}
|
||||
|
||||
socket = secure
|
||||
? SSLSocketFactory.getDefault().createSocket(url.getHost(), port)
|
||||
: new Socket(url.getHost(), port);
|
||||
socket.setTcpNoDelay(true);
|
||||
|
||||
byte[] keyBytes = new byte[16];
|
||||
new SecureRandom().nextBytes(keyBytes);
|
||||
String key = Base64.encodeToString(keyBytes, Base64.NO_WRAP);
|
||||
|
||||
StringBuilder request = new StringBuilder();
|
||||
request.append("GET ").append(path).append(" HTTP/1.1\r\n");
|
||||
request.append("Host: ").append(url.getHost());
|
||||
if ((secure && port != 443) || (!secure && port != 80)) {
|
||||
request.append(":").append(port);
|
||||
}
|
||||
request.append("\r\n");
|
||||
request.append("Upgrade: websocket\r\n");
|
||||
request.append("Connection: Upgrade\r\n");
|
||||
request.append("Sec-WebSocket-Version: 13\r\n");
|
||||
request.append("Sec-WebSocket-Key: ").append(key).append("\r\n");
|
||||
request.append("User-Agent: inbe-sync/1\r\n");
|
||||
if (headers != null) {
|
||||
for (String header : headers) {
|
||||
if (header != null && !header.isEmpty()) {
|
||||
request.append(header).append("\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
request.append("\r\n");
|
||||
socket.getOutputStream().write(request.toString().getBytes(StandardCharsets.US_ASCII));
|
||||
socket.getOutputStream().flush();
|
||||
|
||||
String statusLine = readAsciiLine(socket);
|
||||
int status = parseHttpStatus(statusLine);
|
||||
while (true) {
|
||||
String line = readAsciiLine(socket);
|
||||
if (line == null || line.isEmpty()) break;
|
||||
}
|
||||
if (status != 101) {
|
||||
return status + "\nwebsocket upgrade failed";
|
||||
}
|
||||
Log.i(TAG, "Sync WebSocket connected");
|
||||
|
||||
while (true) {
|
||||
String message = readWebSocketText(socket);
|
||||
if (message == null) {
|
||||
return "0\nwebsocket closed";
|
||||
}
|
||||
if (message.contains("\"type\":\"sync_changed\"")) {
|
||||
return "101\n" + message;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "WebSocket wait failed", e);
|
||||
return "0\n" + (e.getMessage() != null ? e.getMessage() : "websocket failed");
|
||||
} finally {
|
||||
if (socket != null) {
|
||||
try {
|
||||
socket.close();
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int parseHttpStatus(String statusLine) {
|
||||
if (statusLine == null) return 0;
|
||||
String[] parts = statusLine.split(" ", 3);
|
||||
if (parts.length < 2) return 0;
|
||||
try {
|
||||
return Integer.parseInt(parts[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private static String readAsciiLine(Socket socket) throws java.io.IOException {
|
||||
StringBuilder line = new StringBuilder();
|
||||
while (true) {
|
||||
int b = socket.getInputStream().read();
|
||||
if (b < 0) {
|
||||
return line.length() > 0 ? line.toString() : null;
|
||||
}
|
||||
if (b == '\n') break;
|
||||
if (b != '\r') line.append((char)b);
|
||||
}
|
||||
return line.toString();
|
||||
}
|
||||
|
||||
private static String readWebSocketText(Socket socket) throws java.io.IOException {
|
||||
int b0 = socket.getInputStream().read();
|
||||
int b1 = socket.getInputStream().read();
|
||||
if (b0 < 0 || b1 < 0) return null;
|
||||
|
||||
int opcode = b0 & 0x0f;
|
||||
boolean masked = (b1 & 0x80) != 0;
|
||||
long length = b1 & 0x7f;
|
||||
if (length == 126) {
|
||||
length = ((long)readByte(socket) << 8) | readByte(socket);
|
||||
} else if (length == 127) {
|
||||
length = 0;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
length = (length << 8) | readByte(socket);
|
||||
}
|
||||
}
|
||||
if (length < 0 || length > 1024 * 1024) {
|
||||
throw new java.io.IOException("websocket frame too large");
|
||||
}
|
||||
|
||||
byte[] mask = null;
|
||||
if (masked) {
|
||||
mask = readExact(socket, 4);
|
||||
}
|
||||
byte[] payload = readExact(socket, (int)length);
|
||||
if (masked) {
|
||||
for (int i = 0; i < payload.length; i++) {
|
||||
payload[i] = (byte)(payload[i] ^ mask[i % 4]);
|
||||
}
|
||||
}
|
||||
if (opcode == 8) return null;
|
||||
if (opcode != 1) return "";
|
||||
return new String(payload, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
private static int readByte(Socket socket) throws java.io.IOException {
|
||||
int b = socket.getInputStream().read();
|
||||
if (b < 0) throw new java.io.IOException("unexpected eof");
|
||||
return b;
|
||||
}
|
||||
|
||||
private static byte[] readExact(Socket socket, int count) throws java.io.IOException {
|
||||
byte[] data = new byte[count];
|
||||
int offset = 0;
|
||||
while (offset < count) {
|
||||
int read = socket.getInputStream().read(data, offset, count - offset);
|
||||
if (read < 0) throw new java.io.IOException("unexpected eof");
|
||||
offset += read;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
private static byte[] readAllBytesCompat(InputStream input) throws java.io.IOException {
|
||||
byte[] buffer = new byte[8192];
|
||||
int read;
|
||||
java.io.ByteArrayOutputStream output = new java.io.ByteArrayOutputStream();
|
||||
while ((read = input.read(buffer)) != -1) {
|
||||
output.write(buffer, 0, read);
|
||||
}
|
||||
return output.toByteArray();
|
||||
return SyncNetwork.webSocketWait(TAG, urlText, headers);
|
||||
}
|
||||
|
||||
public void openImportPicker(final String mimeTypesCsv) {
|
||||
@@ -592,31 +387,26 @@ public class MainActivity extends NativeActivity {
|
||||
}
|
||||
|
||||
public void acquireWakeLock() {
|
||||
Log.d(TAG, "acquireWakeLock called - wakeLock=" + wakeLock);
|
||||
if (wakeLock == null) {
|
||||
Log.d(TAG, "Creating new PARTIAL_WAKE_LOCK");
|
||||
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
||||
wakeLock = pm.newWakeLock(
|
||||
PowerManager.PARTIAL_WAKE_LOCK,
|
||||
"inbe:meditation_session"
|
||||
);
|
||||
wakeLock.acquire();
|
||||
Log.d(TAG, "Wake lock acquired successfully - held=" + wakeLock.isHeld());
|
||||
Log.d(TAG, "Starting session foreground service");
|
||||
requestNotificationPermissionIfNeeded();
|
||||
Intent intent = new Intent(this, SessionForegroundService.class);
|
||||
intent.setAction(SessionForegroundService.ACTION_START);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
startForegroundService(intent);
|
||||
} else {
|
||||
Log.d(TAG, "Wake lock already exists - held=" + wakeLock.isHeld());
|
||||
startService(intent);
|
||||
}
|
||||
}
|
||||
|
||||
public void releaseWakeLock() {
|
||||
Log.d(TAG, "releaseWakeLock called - wakeLock=" + wakeLock);
|
||||
if (wakeLock != null && wakeLock.isHeld()) {
|
||||
Log.d(TAG, "Releasing wake lock - was held=" + wakeLock.isHeld());
|
||||
wakeLock.release();
|
||||
Log.d(TAG, "Wake lock released successfully");
|
||||
wakeLock = null;
|
||||
} else {
|
||||
Log.d(TAG, "Wake lock not held - wakeLock=" + wakeLock + " isHeld=" + (wakeLock != null ? wakeLock.isHeld() : "null"));
|
||||
}
|
||||
Log.d(TAG, "Stopping session foreground service");
|
||||
Intent intent = new Intent(this, SessionForegroundService.class);
|
||||
intent.setAction(SessionForegroundService.ACTION_STOP);
|
||||
startService(intent);
|
||||
}
|
||||
|
||||
public void updateSessionNotification(final String statusText) {
|
||||
SessionForegroundService.updateStatus(statusText == null ? "" : statusText);
|
||||
}
|
||||
|
||||
public void keepScreenOn() {
|
||||
@@ -641,7 +431,9 @@ public class MainActivity extends NativeActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
configureSystemBars();
|
||||
super.onCreate(savedInstanceState);
|
||||
configureSystemBars();
|
||||
|
||||
synchronized (cachedInsets) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
@@ -660,10 +452,55 @@ public class MainActivity extends NativeActivity {
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
nativeInvalidateGraphicsResources();
|
||||
configureSystemBars();
|
||||
pushDeviceConfiguration();
|
||||
requestInsetRefresh();
|
||||
}
|
||||
|
||||
private void configureSystemBars() {
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||
|
||||
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
WindowManager.LayoutParams attrs = getWindow().getAttributes();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
attrs.layoutInDisplayCutoutMode =
|
||||
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
|
||||
} else {
|
||||
attrs.layoutInDisplayCutoutMode =
|
||||
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
|
||||
}
|
||||
getWindow().setAttributes(attrs);
|
||||
}
|
||||
|
||||
int flags = getWindow().getDecorView().getSystemUiVisibility();
|
||||
flags |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
|
||||
flags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
|
||||
flags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
|
||||
flags &= ~View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
|
||||
flags &= ~View.SYSTEM_UI_FLAG_FULLSCREEN;
|
||||
flags &= ~View.SYSTEM_UI_FLAG_IMMERSIVE;
|
||||
flags &= ~View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
flags &= ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
||||
}
|
||||
getWindow().getDecorView().setSystemUiVisibility(flags);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
WindowInsetsController controller = getWindow().getInsetsController();
|
||||
if (controller != null) {
|
||||
controller.hide(WindowInsets.Type.statusBars());
|
||||
controller.show(WindowInsets.Type.navigationBars());
|
||||
}
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q &&
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.VANILLA_ICE_CREAM) {
|
||||
getWindow().setNavigationBarContrastEnforced(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void pushDeviceConfiguration() {
|
||||
Configuration config = getResources().getConfiguration();
|
||||
int nightMask = config.uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||
@@ -730,38 +567,9 @@ public class MainActivity extends NativeActivity {
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
fallbackForOldPhones();
|
||||
}
|
||||
}
|
||||
|
||||
private void fallbackForOldPhones() {
|
||||
int statusBarHeight = 0;
|
||||
int navBarHeight = 0;
|
||||
|
||||
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
|
||||
if (resourceId > 0) {
|
||||
statusBarHeight = getResources().getDimensionPixelSize(resourceId);
|
||||
}
|
||||
|
||||
int navResourceId = getResources().getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
if (navResourceId > 0) {
|
||||
navBarHeight = getResources().getDimensionPixelSize(navResourceId);
|
||||
}
|
||||
|
||||
synchronized (cachedInsets) {
|
||||
cachedInsets[0] = statusBarHeight;
|
||||
cachedInsets[1] = navBarHeight;
|
||||
cachedInsets[2] = 0;
|
||||
cachedInsets[3] = 0;
|
||||
cachedInsets[4] = 0;
|
||||
cachedInsets[5] = 0;
|
||||
}
|
||||
|
||||
insetsInitialized = true;
|
||||
nativeSetInsets(statusBarHeight, navBarHeight, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
private void updateInsets(WindowInsets insets) {
|
||||
if (insets == null) return;
|
||||
|
||||
@@ -770,7 +578,8 @@ public class MainActivity extends NativeActivity {
|
||||
int navBar = 0;
|
||||
int cLeft = 0, cTop = 0, cRight = 0, cBottom = 0;
|
||||
|
||||
// System bar calculations
|
||||
// Inbe owns a single edge-to-edge native surface. Java reports the
|
||||
// system bar insets; native applies them once against the real GL surface.
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
Insets systemBars = insets.getInsetsIgnoringVisibility(WindowInsets.Type.systemBars());
|
||||
statusBar = systemBars.top;
|
||||
@@ -779,7 +588,6 @@ public class MainActivity extends NativeActivity {
|
||||
statusBar = insets.getSystemWindowInsetTop();
|
||||
navBar = insets.getSystemWindowInsetBottom();
|
||||
}
|
||||
|
||||
// Display cutout calculations
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
DisplayCutout cutout = insets.getDisplayCutout();
|
||||
@@ -800,7 +608,6 @@ public class MainActivity extends NativeActivity {
|
||||
cachedInsets[5] = cBottom;
|
||||
}
|
||||
|
||||
insetsInitialized = true;
|
||||
nativeSetInsets(statusBar, navBar, cLeft, cTop, cRight, cBottom);
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -822,7 +629,7 @@ public class MainActivity extends NativeActivity {
|
||||
|
||||
private void syncLifecycleState(String reason) {
|
||||
int playInBackground = nativeGetPlayInBackground();
|
||||
boolean shouldRunInBackground = playInBackground != 0 && (activityPaused || !windowFocused);
|
||||
boolean shouldRunInBackground = playInBackground != 0 && activityPaused;
|
||||
|
||||
Log.d(TAG, reason + ": play_in_background=" + playInBackground
|
||||
+ " activityPaused=" + activityPaused
|
||||
@@ -858,15 +665,29 @@ public class MainActivity extends NativeActivity {
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
activityPaused = false;
|
||||
configureSystemBars();
|
||||
nativeInvalidateGraphicsResources();
|
||||
requestInsetRefresh();
|
||||
syncLifecycleState("onResume");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
setIntent(intent);
|
||||
configureSystemBars();
|
||||
requestInsetRefresh();
|
||||
syncLifecycleState("onNewIntent");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
super.onWindowFocusChanged(hasFocus);
|
||||
windowFocused = hasFocus;
|
||||
if (hasFocus) {
|
||||
configureSystemBars();
|
||||
requestInsetRefresh();
|
||||
}
|
||||
syncLifecycleState("onWindowFocusChanged");
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
package xyz.waozi.inbe;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ServiceInfo;
|
||||
import android.os.Build;
|
||||
import android.os.IBinder;
|
||||
import android.os.PowerManager;
|
||||
import android.util.Log;
|
||||
|
||||
public class SessionForegroundService extends Service {
|
||||
public static final String ACTION_START = "xyz.waozi.inbe.action.START_SESSION_FOREGROUND";
|
||||
public static final String ACTION_STOP = "xyz.waozi.inbe.action.STOP_SESSION_FOREGROUND";
|
||||
private static final String TAG = "InbeSessionService";
|
||||
private static final String CHANNEL_ID = "active_session";
|
||||
private static final int NOTIFICATION_ID = 3001;
|
||||
private static String currentStatusText = "";
|
||||
private static SessionForegroundService activeService = null;
|
||||
|
||||
private PowerManager.WakeLock wakeLock = null;
|
||||
private boolean foregroundActive = false;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
activeService = this;
|
||||
ensureNotificationChannel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
String action = intent != null ? intent.getAction() : ACTION_START;
|
||||
|
||||
if (ACTION_STOP.equals(action)) {
|
||||
stopSession();
|
||||
return START_NOT_STICKY;
|
||||
}
|
||||
startSession();
|
||||
return START_NOT_STICKY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
releaseWakeLock();
|
||||
clearForeground();
|
||||
if (activeService == this) {
|
||||
activeService = null;
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private void startSession() {
|
||||
currentStatusText = "";
|
||||
Notification notification = buildNotification();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
startForeground(
|
||||
NOTIFICATION_ID,
|
||||
notification,
|
||||
ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK
|
||||
);
|
||||
} else {
|
||||
startForeground(NOTIFICATION_ID, notification);
|
||||
}
|
||||
foregroundActive = true;
|
||||
acquireWakeLock();
|
||||
Log.d(TAG, "Session foreground service started");
|
||||
}
|
||||
|
||||
private void stopSession() {
|
||||
currentStatusText = "";
|
||||
releaseWakeLock();
|
||||
clearForeground();
|
||||
stopSelf();
|
||||
Log.d(TAG, "Session foreground service stopped");
|
||||
}
|
||||
|
||||
public static void updateStatus(String statusText) {
|
||||
currentStatusText = statusText != null ? statusText : "";
|
||||
|
||||
SessionForegroundService service = activeService;
|
||||
if (service == null) {
|
||||
return;
|
||||
}
|
||||
if (!service.foregroundActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
NotificationManager manager =
|
||||
(NotificationManager)service.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
if (manager != null) {
|
||||
manager.notify(NOTIFICATION_ID, service.buildNotification());
|
||||
}
|
||||
}
|
||||
|
||||
private void stopForegroundCompat() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
stopForeground(STOP_FOREGROUND_REMOVE);
|
||||
} else {
|
||||
stopForeground(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void clearForeground() {
|
||||
foregroundActive = false;
|
||||
stopForegroundCompat();
|
||||
cancelNotification();
|
||||
}
|
||||
|
||||
private void cancelNotification() {
|
||||
NotificationManager manager =
|
||||
(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
if (manager != null) {
|
||||
manager.cancel(NOTIFICATION_ID);
|
||||
}
|
||||
}
|
||||
|
||||
private void acquireWakeLock() {
|
||||
if (wakeLock != null && wakeLock.isHeld()) {
|
||||
return;
|
||||
}
|
||||
|
||||
PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
|
||||
if (pm == null) {
|
||||
Log.e(TAG, "PowerManager unavailable; cannot acquire wakelock");
|
||||
return;
|
||||
}
|
||||
|
||||
wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "inbe:active_session");
|
||||
wakeLock.setReferenceCounted(false);
|
||||
wakeLock.acquire();
|
||||
Log.d(TAG, "Session wakelock acquired");
|
||||
}
|
||||
|
||||
private void releaseWakeLock() {
|
||||
if (wakeLock != null && wakeLock.isHeld()) {
|
||||
wakeLock.release();
|
||||
Log.d(TAG, "Session wakelock released");
|
||||
}
|
||||
wakeLock = null;
|
||||
}
|
||||
|
||||
private Notification buildNotification() {
|
||||
Intent launchIntent = new Intent(this, MainActivity.class);
|
||||
launchIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
int pendingFlags = PendingIntent.FLAG_UPDATE_CURRENT;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
pendingFlags |= PendingIntent.FLAG_IMMUTABLE;
|
||||
}
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, launchIntent, pendingFlags);
|
||||
|
||||
Notification.Builder builder = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||
? new Notification.Builder(this, CHANNEL_ID)
|
||||
: new Notification.Builder(this);
|
||||
|
||||
CharSequence title = getApplicationInfo().loadLabel(getPackageManager());
|
||||
builder.setSmallIcon(android.R.drawable.ic_media_play)
|
||||
.setContentTitle(title)
|
||||
.setContentText(currentStatusText)
|
||||
.setContentIntent(pendingIntent)
|
||||
.setOngoing(true)
|
||||
.setOnlyAlertOnce(true)
|
||||
.setShowWhen(false);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
builder.setCategory(Notification.CATEGORY_TRANSPORT)
|
||||
.setVisibility(Notification.VISIBILITY_PUBLIC);
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
private void ensureNotificationChannel() {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
return;
|
||||
}
|
||||
|
||||
NotificationManager manager =
|
||||
(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
if (manager == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
NotificationChannel channel = new NotificationChannel(
|
||||
CHANNEL_ID,
|
||||
getApplicationInfo().loadLabel(getPackageManager()),
|
||||
NotificationManager.IMPORTANCE_LOW
|
||||
);
|
||||
manager.createNotificationChannel(channel);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,240 @@
|
||||
package xyz.waozi.inbe;
|
||||
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.Socket;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.SecureRandom;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
|
||||
final class SyncNetwork {
|
||||
private SyncNetwork() {
|
||||
}
|
||||
|
||||
static String httpRequest(String logTag, String method, String urlText, String body,
|
||||
String[] headers) {
|
||||
HttpURLConnection connection = null;
|
||||
int status = 0;
|
||||
|
||||
try {
|
||||
byte[] bodyBytes = body != null ? body.getBytes(StandardCharsets.UTF_8) : new byte[0];
|
||||
connection = (HttpURLConnection)new URL(urlText).openConnection();
|
||||
connection.setInstanceFollowRedirects(false);
|
||||
connection.setConnectTimeout(15000);
|
||||
connection.setReadTimeout(30000);
|
||||
connection.setRequestMethod(method);
|
||||
connection.setRequestProperty("User-Agent", "inbe-sync/1");
|
||||
if (headers != null) {
|
||||
for (String header : headers) {
|
||||
if (header == null) continue;
|
||||
int colon = header.indexOf(':');
|
||||
if (colon <= 0) continue;
|
||||
String key = header.substring(0, colon).trim();
|
||||
String value = header.substring(colon + 1).trim();
|
||||
if (!key.isEmpty()) {
|
||||
connection.setRequestProperty(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bodyBytes.length > 0) {
|
||||
connection.setDoOutput(true);
|
||||
connection.setFixedLengthStreamingMode(bodyBytes.length);
|
||||
try (OutputStream output = connection.getOutputStream()) {
|
||||
output.write(bodyBytes);
|
||||
}
|
||||
}
|
||||
|
||||
status = connection.getResponseCode();
|
||||
InputStream stream = status >= 400 ? connection.getErrorStream() : connection.getInputStream();
|
||||
String response = "";
|
||||
if (stream != null) {
|
||||
try (InputStream input = stream) {
|
||||
byte[] bytes = readAllBytesCompat(input);
|
||||
response = new String(bytes, StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
return status + "\n" + response;
|
||||
} catch (Exception e) {
|
||||
Log.e(logTag, "Sync HTTP request failed", e);
|
||||
return status + "\n" + (e.getMessage() != null ? e.getMessage() : "request failed");
|
||||
} finally {
|
||||
if (connection != null) {
|
||||
connection.disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static String webSocketWait(String logTag, String urlText, String[] headers) {
|
||||
Socket socket = null;
|
||||
|
||||
try {
|
||||
URI url = new URI(urlText);
|
||||
String protocol = url.getScheme();
|
||||
boolean secure = "wss".equals(protocol);
|
||||
int port = url.getPort();
|
||||
String path = url.getRawPath();
|
||||
if (path == null || path.isEmpty()) path = "/";
|
||||
if (url.getRawQuery() != null && !url.getRawQuery().isEmpty()) {
|
||||
path += "?" + url.getRawQuery();
|
||||
}
|
||||
if (port <= 0) port = secure ? 443 : 80;
|
||||
if (!secure && !"ws".equals(protocol)) {
|
||||
return "0\ninvalid websocket url";
|
||||
}
|
||||
|
||||
socket = secure
|
||||
? SSLSocketFactory.getDefault().createSocket(url.getHost(), port)
|
||||
: new Socket(url.getHost(), port);
|
||||
socket.setTcpNoDelay(true);
|
||||
|
||||
byte[] keyBytes = new byte[16];
|
||||
new SecureRandom().nextBytes(keyBytes);
|
||||
String key = Base64.encodeToString(keyBytes, Base64.NO_WRAP);
|
||||
|
||||
StringBuilder request = new StringBuilder();
|
||||
request.append("GET ").append(path).append(" HTTP/1.1\r\n");
|
||||
request.append("Host: ").append(url.getHost());
|
||||
if ((secure && port != 443) || (!secure && port != 80)) {
|
||||
request.append(":").append(port);
|
||||
}
|
||||
request.append("\r\n");
|
||||
request.append("Upgrade: websocket\r\n");
|
||||
request.append("Connection: Upgrade\r\n");
|
||||
request.append("Sec-WebSocket-Version: 13\r\n");
|
||||
request.append("Sec-WebSocket-Key: ").append(key).append("\r\n");
|
||||
request.append("User-Agent: inbe-sync/1\r\n");
|
||||
if (headers != null) {
|
||||
for (String header : headers) {
|
||||
if (header != null && !header.isEmpty()) {
|
||||
request.append(header).append("\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
request.append("\r\n");
|
||||
socket.getOutputStream().write(request.toString().getBytes(StandardCharsets.US_ASCII));
|
||||
socket.getOutputStream().flush();
|
||||
|
||||
String statusLine = readAsciiLine(socket);
|
||||
int status = parseHttpStatus(statusLine);
|
||||
while (true) {
|
||||
String line = readAsciiLine(socket);
|
||||
if (line == null || line.isEmpty()) break;
|
||||
}
|
||||
if (status != 101) {
|
||||
return status + "\nwebsocket upgrade failed";
|
||||
}
|
||||
Log.i(logTag, "Sync WebSocket connected");
|
||||
|
||||
while (true) {
|
||||
String message = readWebSocketText(socket);
|
||||
if (message == null) {
|
||||
return "0\nwebsocket closed";
|
||||
}
|
||||
if (message.contains("\"type\":\"sync_changed\"")) {
|
||||
return "101\n" + message;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.w(logTag, "WebSocket wait failed", e);
|
||||
return "0\n" + (e.getMessage() != null ? e.getMessage() : "websocket failed");
|
||||
} finally {
|
||||
if (socket != null) {
|
||||
try {
|
||||
socket.close();
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int parseHttpStatus(String statusLine) {
|
||||
if (statusLine == null) return 0;
|
||||
String[] parts = statusLine.split(" ", 3);
|
||||
if (parts.length < 2) return 0;
|
||||
try {
|
||||
return Integer.parseInt(parts[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private static String readAsciiLine(Socket socket) throws java.io.IOException {
|
||||
StringBuilder line = new StringBuilder();
|
||||
while (true) {
|
||||
int b = socket.getInputStream().read();
|
||||
if (b < 0) {
|
||||
return line.length() > 0 ? line.toString() : null;
|
||||
}
|
||||
if (b == '\n') break;
|
||||
if (b != '\r') line.append((char)b);
|
||||
}
|
||||
return line.toString();
|
||||
}
|
||||
|
||||
private static String readWebSocketText(Socket socket) throws java.io.IOException {
|
||||
int b0 = socket.getInputStream().read();
|
||||
int b1 = socket.getInputStream().read();
|
||||
if (b0 < 0 || b1 < 0) return null;
|
||||
|
||||
int opcode = b0 & 0x0f;
|
||||
boolean masked = (b1 & 0x80) != 0;
|
||||
long length = b1 & 0x7f;
|
||||
if (length == 126) {
|
||||
length = ((long)readByte(socket) << 8) | readByte(socket);
|
||||
} else if (length == 127) {
|
||||
length = 0;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
length = (length << 8) | readByte(socket);
|
||||
}
|
||||
}
|
||||
if (length < 0 || length > 1024 * 1024) {
|
||||
throw new java.io.IOException("websocket frame too large");
|
||||
}
|
||||
|
||||
byte[] mask = null;
|
||||
if (masked) {
|
||||
mask = readExact(socket, 4);
|
||||
}
|
||||
byte[] payload = readExact(socket, (int)length);
|
||||
if (masked) {
|
||||
for (int i = 0; i < payload.length; i++) {
|
||||
payload[i] = (byte)(payload[i] ^ mask[i % 4]);
|
||||
}
|
||||
}
|
||||
if (opcode == 8) return null;
|
||||
if (opcode != 1) return "";
|
||||
return new String(payload, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
private static int readByte(Socket socket) throws java.io.IOException {
|
||||
int b = socket.getInputStream().read();
|
||||
if (b < 0) throw new java.io.IOException("unexpected eof");
|
||||
return b;
|
||||
}
|
||||
|
||||
private static byte[] readExact(Socket socket, int count) throws java.io.IOException {
|
||||
byte[] data = new byte[count];
|
||||
int offset = 0;
|
||||
while (offset < count) {
|
||||
int read = socket.getInputStream().read(data, offset, count - offset);
|
||||
if (read < 0) throw new java.io.IOException("unexpected eof");
|
||||
offset += read;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
private static byte[] readAllBytesCompat(InputStream input) throws java.io.IOException {
|
||||
byte[] buffer = new byte[8192];
|
||||
int read;
|
||||
java.io.ByteArrayOutputStream output = new java.io.ByteArrayOutputStream();
|
||||
while ((read = input.read(buffer)) != -1) {
|
||||
output.write(buffer, 0, read);
|
||||
}
|
||||
return output.toByteArray();
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 515 B After Width: | Height: | Size: 511 B |
|
Before Width: | Height: | Size: 515 B After Width: | Height: | Size: 511 B |
|
Before Width: | Height: | Size: 383 B After Width: | Height: | Size: 386 B |
|
Before Width: | Height: | Size: 383 B After Width: | Height: | Size: 386 B |
|
Before Width: | Height: | Size: 577 B After Width: | Height: | Size: 559 B |
|
Before Width: | Height: | Size: 577 B After Width: | Height: | Size: 559 B |
|
Before Width: | Height: | Size: 652 B After Width: | Height: | Size: 657 B |
|
Before Width: | Height: | Size: 652 B After Width: | Height: | Size: 657 B |
|
Before Width: | Height: | Size: 720 B After Width: | Height: | Size: 720 B |
|
Before Width: | Height: | Size: 720 B After Width: | Height: | Size: 720 B |
@@ -1,3 +1,3 @@
|
||||
plugins {
|
||||
id 'com.android.application' version '8.4.2' apply false
|
||||
id 'com.android.application' version '8.5.1' apply false
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
### Fixed
|
||||
- Icon button fallback system - buttons now render with procedural graphics when asset images fail to load (prevents empty buttons on devices with asset loading issues)
|
||||
- Added UIIconType system for icon identification and fallback rendering
|
||||
- Updated all icon button functions to support fallback graphics (ui_draw_icon_btn, ui_draw_icon_btn_padded, ui_draw_icon_link, ui_draw_nav_button, ui_draw_nav_button_expand)
|
||||
- Updated all icon button functions to support fallback graphics (DrawUIIconBtn, DrawUIPaddedIconBtn, DrawUIIconLink, ui_draw_nav_button, ui_draw_nav_button_expand)
|
||||
@@ -0,0 +1,3 @@
|
||||
Fixed
|
||||
---
|
||||
- modal issues
|
||||
@@ -0,0 +1,6 @@
|
||||
Changed
|
||||
---
|
||||
- Use Flint-managed modal handling so modal dialogs block background input consistently.
|
||||
- Add optional sync account aliases, with compact public ID display and full ID reveal modal.
|
||||
- Make sync state tracking more robust with snapshot hash checks and review flow for unresolved differences.
|
||||
- Use Flint's built-in font chopping pipeline and verify multilingual locale glyph coverage.
|
||||
@@ -0,0 +1,3 @@
|
||||
Fixed
|
||||
---
|
||||
- modal capture bug
|
||||
@@ -0,0 +1,3 @@
|
||||
Fixed
|
||||
---
|
||||
- Modal button issue
|
||||
@@ -0,0 +1 @@
|
||||
- Fix test music
|
||||
@@ -0,0 +1,3 @@
|
||||
Fixed
|
||||
---
|
||||
- Background play for meditation practice
|
||||
@@ -0,0 +1,3 @@
|
||||
Fixed
|
||||
---
|
||||
- Android session notification and wakelock for screen-locked playback
|
||||
@@ -0,0 +1,6 @@
|
||||
Added
|
||||
---
|
||||
- Sun Salutation practice with Yoga habit sync support.
|
||||
Changed
|
||||
---
|
||||
- Improve sync reliability and review handling.
|
||||
@@ -0,0 +1,2 @@
|
||||
- Improved notification in session
|
||||
- Standardized settings screen1
|
||||
@@ -0,0 +1 @@
|
||||
- Improve sun salutation
|
||||
@@ -0,0 +1 @@
|
||||
- Improve theme, habit, and localization UI polish
|
||||
@@ -0,0 +1,4 @@
|
||||
- Move meditation duration selection into practice configuration with custom time support.
|
||||
- Add centered in-session meditation add-time controls.
|
||||
- Use Flint-managed liboqs, LibreSSL, and curl build paths.
|
||||
- Fix Android native build to use Flint's liboqs submodule.
|
||||
@@ -0,0 +1,4 @@
|
||||
Fixed
|
||||
---
|
||||
- Repair habit-day sync for zero-count completions.
|
||||
- Require liboqs at build time for every sync-enabled target.
|
||||
@@ -0,0 +1,3 @@
|
||||
Changed
|
||||
---
|
||||
- updated the practice screen ui/ux
|
||||
@@ -0,0 +1,7 @@
|
||||
Changed
|
||||
---
|
||||
- Rework Android safe-area handling to use one native inset path with stable bottom navigation spacing.
|
||||
- Move leaderboard stats to synced source data, with local current-user rows shown immediately.
|
||||
Fixed
|
||||
---
|
||||
- Fix profile/friend sync freshness, leaderboard empty states, modal input capture, pet asset embedding, and wrapped text previews.
|
||||
@@ -0,0 +1,3 @@
|
||||
Changed
|
||||
---
|
||||
- Move shared Lyra sync protocol code into Flint and simplify Inbe sync client wiring.
|
||||
@@ -0,0 +1,8 @@
|
||||
Added
|
||||
---
|
||||
- Add local `make install` target.
|
||||
- Add Profile controls for habit ordering and practice visibility.
|
||||
Changed
|
||||
---
|
||||
- Move sync status into the Data view and simplify the habits add option.
|
||||
- Clean up the README.
|
||||
@@ -0,0 +1,3 @@
|
||||
Changed
|
||||
---
|
||||
- Improve habit management
|
||||
@@ -0,0 +1,3 @@
|
||||
Fixed
|
||||
---
|
||||
- bottom inset in practice
|
||||
@@ -0,0 +1,3 @@
|
||||
Fixed
|
||||
---
|
||||
- Android lanuch bug
|
||||
@@ -0,0 +1,3 @@
|
||||
Added
|
||||
---
|
||||
- habit overview
|
||||
@@ -0,0 +1,4 @@
|
||||
Changed
|
||||
---
|
||||
- Move habit tracking overview out of Profile and into the Habits tab with direct day toggles, reorder controls, and local view persistence.
|
||||
- Rework Settings into an overview page with section title bars and shared return/title bar UI.
|
||||
@@ -0,0 +1,4 @@
|
||||
Changed
|
||||
---
|
||||
- Redesign the Practice home screen around carousel-style practice cards with explicit start, manual, configure, and music actions.
|
||||
- Move meditation music configuration into a shared practice music panel with per-practice enablement and track selection.
|
||||
@@ -0,0 +1,3 @@
|
||||
Fixed
|
||||
---
|
||||
- improve sync review
|
||||
@@ -0,0 +1 @@
|
||||
- updated whm banner
|
||||
@@ -0,0 +1,3 @@
|
||||
Addded
|
||||
---
|
||||
- add more banners
|
||||
@@ -0,0 +1,4 @@
|
||||
Changed
|
||||
---
|
||||
- fix web
|
||||
- deduplicate code
|
||||
@@ -0,0 +1,4 @@
|
||||
Changed
|
||||
---
|
||||
- improved desktop experience
|
||||
- add system themes
|
||||
@@ -0,0 +1,3 @@
|
||||
Changed
|
||||
---
|
||||
- Improved ui in practice screen
|
||||
@@ -0,0 +1,5 @@
|
||||
Changed
|
||||
---
|
||||
- Reworked Profile configuration navigation to use a full-width dropdown instead of the tab bar.
|
||||
- Updated sidebar return behavior for Profile and Settings flows.
|
||||
- Updated Flint profile widgets and profile picture assets, including sidebar profile image sizing and picker scrolling.
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -1,44 +0,0 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1779560665,
|
||||
"narHash": "sha256-tpyBcxPpcQb8ukyNF7DoCwfSY3VPsxHoYwj00Cayv5o=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "64c08a7ca051951c8eae34e3e3cb1e202fe36786",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-sdl2": {
|
||||
"locked": {
|
||||
"lastModified": 1751274312,
|
||||
"narHash": "sha256-/bVBlRpECLVzjV19t5KMdMFWSwKLtb5RyXdjz3LJT+g=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "50ab793786d9de88ee30ec4e4c24fb4236fc2674",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-24.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-sdl2": "nixpkgs-sdl2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
@@ -1,319 +0,0 @@
|
||||
{
|
||||
description = "Waozi raylib cross-build environment";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
nixpkgs-sdl2.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, nixpkgs-sdl2 }:
|
||||
let
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
];
|
||||
|
||||
forAllSystems = nixpkgs.lib.genAttrs systems;
|
||||
|
||||
mkPkgs = system: import nixpkgs {
|
||||
inherit system;
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
allowUnsupportedSystem = true;
|
||||
android_sdk.accept_license = true;
|
||||
};
|
||||
};
|
||||
|
||||
mkShell = system:
|
||||
let
|
||||
pkgs = mkPkgs system;
|
||||
sdl2Pkgs = import nixpkgs-sdl2 {
|
||||
inherit system;
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
allowUnsupportedSystem = true;
|
||||
};
|
||||
};
|
||||
aarch64Pkgs = pkgs.pkgsCross.aarch64-multiplatform;
|
||||
|
||||
windowsCrossEnabled = system == "x86_64-linux";
|
||||
|
||||
mingwPkgs = import nixpkgs {
|
||||
inherit system;
|
||||
crossSystem = { config = "x86_64-w64-mingw32"; };
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
allowUnsupportedSystem = true;
|
||||
};
|
||||
};
|
||||
|
||||
mingw32Pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
crossSystem = { config = "i686-w64-mingw32"; };
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
allowUnsupportedSystem = true;
|
||||
};
|
||||
};
|
||||
|
||||
mcfgthreads = pkgs.pkgsCross.mingwW64.windows.mcfgthreads;
|
||||
mcfgthreads32 = pkgs.pkgsCross.mingw32.windows.mcfgthreads;
|
||||
|
||||
androidComposition = pkgs.androidenv.composeAndroidPackages {
|
||||
cmdLineToolsVersion = "11.0";
|
||||
buildToolsVersions = [ "34.0.0" ];
|
||||
platformVersions = [ "34" "35" ];
|
||||
includeNDK = true;
|
||||
ndkVersions = [ "28.2.13676358" ];
|
||||
cmakeVersions = [ "3.22.1" ];
|
||||
includeEmulator = true;
|
||||
includeSystemImages = true;
|
||||
systemImageTypes = [ "google_apis_playstore" "default" ];
|
||||
abiVersions = [ "arm64-v8a" "x86_64" ];
|
||||
};
|
||||
|
||||
sdk = androidComposition.androidsdk;
|
||||
ndkPath = "${sdk}/libexec/android-sdk/ndk-bundle";
|
||||
|
||||
pkgConfigPath = pkgs.lib.makeSearchPath "lib/pkgconfig" [
|
||||
sdl2Pkgs.SDL2.dev
|
||||
pkgs.curl.dev
|
||||
pkgs.openssl.dev
|
||||
pkgs.libdrm.dev
|
||||
pkgs.libgbm
|
||||
pkgs.libglvnd.dev
|
||||
];
|
||||
|
||||
aarch64PkgConfigPath = pkgs.lib.makeSearchPath "lib/pkgconfig" [
|
||||
aarch64Pkgs.SDL2.dev
|
||||
aarch64Pkgs.curl.dev
|
||||
aarch64Pkgs.openssl.dev
|
||||
aarch64Pkgs.libdrm.dev
|
||||
aarch64Pkgs.libgbm
|
||||
aarch64Pkgs.libglvnd.dev
|
||||
aarch64Pkgs.zlib.dev
|
||||
];
|
||||
|
||||
windowsTargetPkgs = pkgs.lib.optionals windowsCrossEnabled [
|
||||
mingwPkgs.buildPackages.gcc
|
||||
mingwPkgs.windows.mingw_w64
|
||||
mcfgthreads
|
||||
mingw32Pkgs.buildPackages.gcc
|
||||
mingw32Pkgs.windows.mingw_w64
|
||||
mcfgthreads32
|
||||
];
|
||||
|
||||
linuxdeployPluginAppImage = pkgs.stdenvNoCC.mkDerivation {
|
||||
pname = "linuxdeploy-plugin-appimage";
|
||||
version = "1-alpha-20250213-1";
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/1-alpha-20250213-1/linuxdeploy-plugin-appimage-x86_64.AppImage";
|
||||
hash = "sha256-mS1QKiSOFKsYVEjd9vbn0lVYy4TUYjw1TDrzUMJfzLM=";
|
||||
};
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
cp "$src" linuxdeploy-plugin-appimage.AppImage
|
||||
chmod +x linuxdeploy-plugin-appimage.AppImage
|
||||
./linuxdeploy-plugin-appimage.AppImage --appimage-extract >/dev/null
|
||||
|
||||
mkdir -p "$out/bin"
|
||||
cp squashfs-root/AppRun "$out/bin/linuxdeploy-plugin-appimage"
|
||||
chmod +x "$out/bin/linuxdeploy-plugin-appimage"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
|
||||
appimagetool = pkgs.stdenvNoCC.mkDerivation {
|
||||
pname = "appimagetool";
|
||||
version = "continuous";
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage";
|
||||
hash = "sha256-uQ9KixiWdUX9p4pEWydoChZC8e+UiM7Si2U5jyvnrdI=";
|
||||
};
|
||||
|
||||
extracted = pkgs.appimageTools.extract {
|
||||
pname = "appimagetool";
|
||||
version = "continuous";
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage";
|
||||
hash = "sha256-uQ9KixiWdUX9p4pEWydoChZC8e+UiM7Si2U5jyvnrdI=";
|
||||
};
|
||||
};
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p "$out/bin"
|
||||
cat > "$out/bin/appimagetool" <<EOF
|
||||
#!${pkgs.runtimeShell}
|
||||
exec "$extracted/AppRun" "\$@"
|
||||
EOF
|
||||
chmod +x "$out/bin/appimagetool"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
|
||||
windowsProfile = pkgs.lib.optionalString windowsCrossEnabled ''
|
||||
export WIN_CC="x86_64-w64-mingw32-gcc"
|
||||
export WIN_CXX="x86_64-w64-mingw32-g++"
|
||||
export WIN_AR="x86_64-w64-mingw32-ar"
|
||||
export WIN_RANLIB="x86_64-w64-mingw32-ranlib"
|
||||
export WIN_WINDRES="x86_64-w64-mingw32-windres"
|
||||
export WIN_STRIP="x86_64-w64-mingw32-strip"
|
||||
|
||||
export WIN32_CC="i686-w64-mingw32-gcc"
|
||||
export WIN32_CXX="i686-w64-mingw32-g++"
|
||||
export WIN32_AR="i686-w64-mingw32-ar"
|
||||
export WIN32_RANLIB="i686-w64-mingw32-ranlib"
|
||||
export WIN32_WINDRES="i686-w64-mingw32-windres"
|
||||
export WIN32_STRIP="i686-w64-mingw32-strip"
|
||||
|
||||
export MCFGTHREADS="${mcfgthreads}"
|
||||
export WIN32_MCFGTHREADS="${mcfgthreads32}"
|
||||
export CPATH="$MCFGTHREADS/include:$CPATH"
|
||||
export LIBRARY_PATH="$MCFGTHREADS/lib:$LIBRARY_PATH"
|
||||
export LDFLAGS="-L$MCFGTHREADS/lib $LDFLAGS"
|
||||
'';
|
||||
in
|
||||
(pkgs.buildFHSEnv {
|
||||
name = "ray-waozi-env";
|
||||
extraOutputsToInstall = [ "dev" ];
|
||||
|
||||
targetPkgs = pkgs: with pkgs; [
|
||||
sdl2Pkgs.SDL2
|
||||
sdl2Pkgs.SDL2.dev
|
||||
butler
|
||||
binutils
|
||||
ubports-click
|
||||
ccache
|
||||
cmake
|
||||
curl
|
||||
curl.dev
|
||||
emscripten
|
||||
gcc
|
||||
git-lfs
|
||||
gnumake
|
||||
gradle
|
||||
imagemagick
|
||||
jdk17
|
||||
libxml2
|
||||
libdrm
|
||||
libdrm.dev
|
||||
libgbm
|
||||
libglvnd
|
||||
libglvnd.dev
|
||||
alsa-lib
|
||||
appimagetool
|
||||
libpulseaudio
|
||||
linuxdeploy
|
||||
linuxdeployPluginAppImage
|
||||
mesa
|
||||
ncurses
|
||||
ninja
|
||||
openssl
|
||||
openssl.dev
|
||||
patchelf
|
||||
pkg-config
|
||||
pipewire
|
||||
rsync
|
||||
xvfb-run
|
||||
zlib
|
||||
zip
|
||||
aarch64Pkgs.stdenv.cc
|
||||
aarch64Pkgs.SDL2
|
||||
aarch64Pkgs.SDL2.dev
|
||||
aarch64Pkgs.curl
|
||||
aarch64Pkgs.curl.dev
|
||||
aarch64Pkgs.openssl
|
||||
aarch64Pkgs.openssl.dev
|
||||
aarch64Pkgs.libdrm
|
||||
aarch64Pkgs.libdrm.dev
|
||||
aarch64Pkgs.libgbm
|
||||
aarch64Pkgs.libglvnd
|
||||
aarch64Pkgs.libglvnd.dev
|
||||
aarch64Pkgs.zlib
|
||||
aarch64Pkgs.zlib.dev
|
||||
] ++ windowsTargetPkgs;
|
||||
|
||||
profile = ''
|
||||
export JAVA_HOME="${pkgs.jdk17.home}"
|
||||
export OPENSSL_INCLUDE_DIR="${pkgs.openssl.dev}/include"
|
||||
export OPENSSL_SSL_LIBRARY="${pkgs.openssl.out}/lib/libssl.so"
|
||||
export OPENSSL_CRYPTO_LIBRARY="${pkgs.openssl.out}/lib/libcrypto.so"
|
||||
|
||||
# Android SDK - override any system ANDROID_HOME
|
||||
export ANDROID_HOME="${sdk}/libexec/android-sdk"
|
||||
export ANDROID_SDK_ROOT="${sdk}/libexec/android-sdk"
|
||||
export ANDROID_NDK_ROOT="${ndkPath}"
|
||||
export CCACHE_DIR="$PWD/.ccache"
|
||||
export CCACHE_BASEDIR="$PWD"
|
||||
export CCACHE_COMPRESS=1
|
||||
|
||||
export PKG_CONFIG_PATH="/usr/lib64/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig:${pkgConfigPath}:$PKG_CONFIG_PATH"
|
||||
|
||||
export RAY_PKGS="sdl2 libdrm gbm egl glesv2"
|
||||
export RAY_SDL_CFLAGS="$(pkg-config --cflags sdl2)"
|
||||
export RAY_SDL_LDLIBS="$(pkg-config --libs sdl2)"
|
||||
export RAY_GL_CFLAGS="$(pkg-config --cflags libdrm gbm egl glesv2)"
|
||||
export RAY_GL_LDLIBS="$(pkg-config --libs libdrm gbm egl glesv2)"
|
||||
export RAY_CFLAGS="$RAY_SDL_CFLAGS $RAY_GL_CFLAGS"
|
||||
export RAY_LDLIBS="$RAY_SDL_LDLIBS $RAY_GL_LDLIBS"
|
||||
export RAY_SDL_INCLUDE_DIR="$(pkg-config --variable=includedir sdl2 | sed 's,/SDL2$,,')"
|
||||
|
||||
export RAY_RAYLIB_CONFIG="-DSUPPORT_SCREEN_CAPTURE=0 -DSUPPORT_COMPRESSION_API=0 -DSUPPORT_AUTOMATION_EVENTS=0 -DSUPPORT_CLIPBOARD_IMAGE=0 -DSUPPORT_FILEFORMAT_BMP=0 -DSUPPORT_FILEFORMAT_GIF=0 -DSUPPORT_FILEFORMAT_QOI=0 -DSUPPORT_FILEFORMAT_DDS=0 -DSUPPORT_FILEFORMAT_TTF=0"
|
||||
|
||||
export PATH="$ANDROID_HOME/cmdline-tools/11.0/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/emulator:$PATH"
|
||||
|
||||
export WEB_CC="emcc"
|
||||
export WEB_AR="emar"
|
||||
export WEB_RANLIB="emranlib"
|
||||
|
||||
export LINUXDEPLOY="linuxdeploy"
|
||||
|
||||
export AARCH64_CC="${aarch64Pkgs.stdenv.cc}/bin/${aarch64Pkgs.stdenv.cc.targetPrefix}cc"
|
||||
export AARCH64_AR="${aarch64Pkgs.stdenv.cc.bintools.bintools}/bin/${aarch64Pkgs.stdenv.cc.targetPrefix}ar"
|
||||
export AARCH64_RANLIB="${aarch64Pkgs.stdenv.cc.bintools.bintools}/bin/${aarch64Pkgs.stdenv.cc.targetPrefix}ranlib"
|
||||
export AARCH64_PKG_CONFIG_PATH="${aarch64PkgConfigPath}"
|
||||
export AARCH64_RAY_SDL_CFLAGS="-D_GNU_SOURCE=1 -D_REENTRANT -I${aarch64Pkgs.SDL2.dev}/include -I${aarch64Pkgs.SDL2.dev}/include/SDL2"
|
||||
export AARCH64_RAY_SDL_LDLIBS="-L${aarch64Pkgs.SDL2}/lib -lSDL2"
|
||||
export AARCH64_RAY_GL_CFLAGS="-I${aarch64Pkgs.libdrm.dev}/include -I${aarch64Pkgs.libdrm.dev}/include/libdrm -I${aarch64Pkgs.libgbm}/include -I${aarch64Pkgs.libglvnd.dev}/include"
|
||||
export AARCH64_RAY_GL_LDLIBS="-L${aarch64Pkgs.libdrm}/lib -L${aarch64Pkgs.libgbm}/lib -L${aarch64Pkgs.libglvnd}/lib -ldrm -lgbm -lEGL -lGLESv2"
|
||||
export AARCH64_RAY_CFLAGS="$AARCH64_RAY_SDL_CFLAGS $AARCH64_RAY_GL_CFLAGS"
|
||||
export AARCH64_RAY_LDLIBS="$AARCH64_RAY_SDL_LDLIBS $AARCH64_RAY_GL_LDLIBS"
|
||||
export AARCH64_RAY_SDL_INCLUDE_DIR="${aarch64Pkgs.SDL2.dev}/include"
|
||||
export AARCH64_FLINT_CURL_CFLAGS="$(PKG_CONFIG_PATH="$AARCH64_PKG_CONFIG_PATH" pkg-config --cflags libcurl)"
|
||||
export AARCH64_FLINT_CURL_LDLIBS="$(PKG_CONFIG_PATH="$AARCH64_PKG_CONFIG_PATH" pkg-config --libs libcurl)"
|
||||
export AARCH64_CLICK_RUNTIME_LIBS="${aarch64Pkgs.SDL2}/lib/libSDL2-2.0.so.0 ${aarch64Pkgs.curl.out}/lib/libcurl.so.4 ${aarch64Pkgs.openssl.out}/lib/libssl.so.3 ${aarch64Pkgs.openssl.out}/lib/libcrypto.so.3 ${aarch64Pkgs.libdrm}/lib/libdrm.so.2 ${aarch64Pkgs.libgbm}/lib/libgbm.so.1 ${aarch64Pkgs.libglvnd}/lib/libEGL.so.1 ${aarch64Pkgs.libglvnd}/lib/libGLESv2.so.2 ${aarch64Pkgs.zlib}/lib/libz.so.1"
|
||||
|
||||
${windowsProfile}
|
||||
|
||||
for project in inbe; do
|
||||
if [ -d "$project/droid" ]; then
|
||||
android_local_sdk="$ANDROID_SDK_ROOT"
|
||||
if [ -d /mnt/storage/Android/Sdk/ndk/28.2.13676358 ]; then
|
||||
android_local_sdk="/mnt/storage/Android/Sdk"
|
||||
fi
|
||||
cat > "$project/droid/local.properties" <<EOF
|
||||
sdk.dir=$android_local_sdk
|
||||
cmake.dir=$android_local_sdk/cmake/3.22.1
|
||||
EOF
|
||||
fi
|
||||
done
|
||||
'';
|
||||
}).env;
|
||||
in {
|
||||
devShells = forAllSystems (system: {
|
||||
default = mkShell system;
|
||||
});
|
||||
};
|
||||
}
|
||||