Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
cddac728b1 | ||
|
|
cc92f494e3 | ||
|
|
fd3d10521a | ||
|
|
351c1334c6 | ||
|
|
414a6ea198 | ||
|
|
aebb706eac | ||
|
|
3ff584355c | ||
|
|
4d7538f46e | ||
|
|
b5d1fa617a | ||
|
|
c700c5a616 | ||
|
|
285a93fa58 | ||
|
|
92777d5425 | ||
|
|
05170a2846 | ||
|
|
c34ad06050 | ||
|
|
3cef21ab54 | ||
|
|
1b0a50e248 | ||
|
|
a6616d3cb2 | ||
|
|
0cf6f436e1 | ||
|
|
06358b5bfb | ||
|
|
201dced542 | ||
|
|
c580bc28ed | ||
|
|
7b0ecd1e13 | ||
|
|
53fdc50827 | ||
|
|
0fb6e98993 | ||
|
|
2a95e1652f | ||
|
|
9a04b9893b | ||
|
|
4b093aef18 | ||
|
|
9f0a136689 | ||
|
|
78507b44eb | ||
|
|
7b7fb07717 | ||
|
|
0f34ddc97d | ||
|
|
c679b11b73 | ||
|
|
82ccb092c2 | ||
|
|
8bbbfe0be0 | ||
|
|
ee89a9623a | ||
|
|
df91739754 | ||
|
|
5fadbcacea | ||
|
|
c0912d29f0 | ||
|
|
a6648a51d1 | ||
|
|
37cee8b105 | ||
|
|
c766b84796 | ||
|
|
663ad10fba | ||
|
|
1072d38690 | ||
|
|
fd1ac9403b | ||
|
|
43286f23c9 | ||
|
|
c2f63faee6 | ||
|
|
081357578b | ||
|
|
a047d036f3 | ||
|
|
cdd14267f2 | ||
|
|
6ab4bd6e61 | ||
|
|
376c2ee40b | ||
|
|
779699ac43 | ||
|
|
ce01d33aac | ||
|
|
807aa54166 | ||
|
|
96de9c2492 | ||
|
|
117e75c158 | ||
|
|
8f556fd5a5 | ||
|
|
2807328b00 | ||
|
|
77c4078b9f | ||
|
|
ed4f1f4d82 | ||
|
|
41aab988cb | ||
|
|
04c8ea1e82 | ||
|
|
ef325ed4af | ||
|
|
0ce5f1ecd5 | ||
|
|
57a93fb1a2 | ||
|
|
3fac68a0c5 | ||
|
|
194c98327e | ||
|
|
1ece2a38f4 | ||
|
|
8d5fa97bc4 | ||
|
|
f5488096d4 | ||
|
|
200be33406 | ||
|
|
c83544e512 | ||
|
|
26b3845a01 | ||
|
|
6928984362 | ||
|
|
bebdbbbd38 | ||
|
|
f5e643b096 | ||
|
|
513c2822ae | ||
|
|
7170bdef0b | ||
|
|
75e01ce333 | ||
|
|
92dc51e7a8 | ||
|
|
a8c3ec5166 | ||
|
|
bd42b9f151 | ||
|
|
22e7a9eafc | ||
|
|
4b90c5a079 | ||
|
|
9f08f2ad4b | ||
|
|
e9e2862b13 | ||
|
|
d50369a777 | ||
|
|
896b122c9f | ||
|
|
5feb0c44fe | ||
|
|
95b6553a6f | ||
|
|
c4d2a92448 | ||
|
|
61bd0a9ea4 | ||
|
|
89de246311 | ||
|
|
c169a4c6ad | ||
|
|
861ca9ad2e | ||
|
|
cda90a0617 | ||
|
|
9d49f9ce57 | ||
|
|
30fc4584c3 | ||
|
|
cf593bf554 | ||
|
|
c0f2939c9f | ||
|
|
ea800cd672 | ||
|
|
76ea43832c | ||
|
|
c50d857cba | ||
|
|
09c87a8d9a | ||
|
|
ea8604392b | ||
|
|
c02d6ae02a | ||
|
|
12637cc7ef | ||
|
|
f4c753b2f4 | ||
|
|
9a231007f1 | ||
|
|
1ad4e8ee78 | ||
|
|
ed1993bff8 | ||
|
|
7ff89fd78b | ||
|
|
801f49d470 | ||
|
|
7bf9c1859d | ||
|
|
689d08eefa | ||
|
|
60eb87f5f1 | ||
|
|
784d14ac2e | ||
|
|
4db5c1dcf7 | ||
|
|
4eb7b5f19b | ||
|
|
b07aeced88 | ||
|
|
8eb52b6515 | ||
|
|
1d219ca706 | ||
|
|
6f6b7a09e1 | ||
|
|
c39d54b42a | ||
|
|
4a83138cb7 | ||
|
|
0fbd274f4d | ||
|
|
1f21d4d3af | ||
|
|
d92c06a0b4 | ||
|
|
e416d9419a | ||
|
|
5157746aca | ||
|
|
4993ad48e4 | ||
|
|
efd8de98cd | ||
|
|
a5729306ae | ||
|
|
d6373dab29 | ||
|
|
91a250a9be | ||
|
|
22d2b0916d | ||
|
|
6a1d83f8f8 |
No files matched your search
@@ -0,0 +1 @@
|
||||
unpackaged_assets/**/*.ogg filter=lfs diff=lfs merge=lfs -text
|
||||
@@ -0,0 +1,22 @@
|
||||
build-essential
|
||||
ca-certificates
|
||||
curl
|
||||
libcurl4-openssl-dev
|
||||
libdrm-dev
|
||||
libdrm2
|
||||
libegl1-mesa-dev
|
||||
libegl1
|
||||
libgbm-dev
|
||||
libgbm1
|
||||
libgles2-mesa-dev
|
||||
libgl1
|
||||
libgl1-mesa-dri
|
||||
libglvnd0
|
||||
libx11-6
|
||||
libx11-dev
|
||||
libxext6
|
||||
libsdl2-2.0-0
|
||||
libsdl2-dev
|
||||
patchelf
|
||||
pkg-config
|
||||
zip
|
||||
@@ -0,0 +1,2 @@
|
||||
build-essential
|
||||
zlib1g-dev
|
||||
@@ -0,0 +1,3 @@
|
||||
build-essential
|
||||
zlib1g-dev
|
||||
zip
|
||||
@@ -0,0 +1,5 @@
|
||||
build-essential
|
||||
gcc-mingw-w64-i686-win32
|
||||
gcc-mingw-w64-x86-64-win32
|
||||
zlib1g-dev
|
||||
zip
|
||||
@@ -1,103 +0,0 @@
|
||||
name: Android Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Build Release APK
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '21'
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v3
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x droid/gradlew
|
||||
|
||||
- name: Create keystore directory
|
||||
run: mkdir -p ~/.android
|
||||
|
||||
- name: Decode Keystore
|
||||
env:
|
||||
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
|
||||
run: |
|
||||
echo "$KEYSTORE_BASE64" | base64 -d > ~/.android/inbe-release.keystore
|
||||
echo "Keystore decoded successfully"
|
||||
|
||||
- name: Copy Assets to Android Project
|
||||
run: ./scripts/copy-android-assets.sh
|
||||
|
||||
- name: Build Release APK
|
||||
working-directory: ./droid
|
||||
env:
|
||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
||||
run: |
|
||||
./gradlew assembleRelease \
|
||||
-Pkeystore.password="$KEYSTORE_PASSWORD" \
|
||||
-Pkeystore.path="/home/runner/.android/inbe-release.keystore" \
|
||||
--stacktrace
|
||||
|
||||
- name: Rename APK
|
||||
run: |
|
||||
VERSION=$(grep "versionName" droid/app/build.gradle | awk '{print $2}' | tr -d '"')
|
||||
find droid/app/build/outputs/apk/release -name "*-universal-release.apk" -exec cp {} inbe-$VERSION.apk \; 2>/dev/null || true
|
||||
|
||||
- name: Upload APK to Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-apk
|
||||
path: inbe-*.apk
|
||||
if-no-files-found: warn
|
||||
|
||||
- name: Create and Push Tag (if new version)
|
||||
id: tag_version
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||
run: |
|
||||
VERSION=$(grep "versionName" droid/app/build.gradle | awk '{print $2}' | tr -d '"')
|
||||
TAG="v$VERSION"
|
||||
if git rev-parse "$TAG" >/dev/null 2>&1; then
|
||||
echo "Tag $TAG exists, skipping"
|
||||
echo "tag_pushed=false" >> $GITHUB_OUTPUT
|
||||
else
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
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
|
||||
if: steps.tag_version.outputs.tag_pushed == 'true'
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: ${{ steps.tag_version.outputs.tag_name }}
|
||||
files: inbe-*.apk
|
||||
generate_release_notes: true
|
||||
draft: false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -0,0 +1,104 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
APT_CACHE_DIR: /tmp/apt-cache
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cache Test apt packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.APT_CACHE_DIR }}
|
||||
key: test-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/test-packages.txt') }}
|
||||
restore-keys: |
|
||||
test-apt-${{ runner.os }}-${{ runner.arch }}-
|
||||
|
||||
- name: Install Test Dependencies
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mapfile -t packages < .github/apt/test-packages.txt
|
||||
mkdir -p "$APT_CACHE_DIR/partial"
|
||||
sudo apt-get update
|
||||
sudo apt-get \
|
||||
-o Dir::Cache::archives="$APT_CACHE_DIR" \
|
||||
install -y "${packages[@]}"
|
||||
sudo chown -R "$USER:$USER" "$APT_CACHE_DIR"
|
||||
|
||||
- name: Run Tests
|
||||
run: make test
|
||||
|
||||
build-chrome-extension:
|
||||
name: Build Chrome Extension
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
env:
|
||||
APT_CACHE_DIR: /tmp/apt-cache
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cache Web apt packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.APT_CACHE_DIR }}
|
||||
key: web-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/web-packages.txt') }}
|
||||
restore-keys: |
|
||||
web-apt-${{ runner.os }}-${{ runner.arch }}-
|
||||
|
||||
- name: Install Web Dependencies
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mapfile -t packages < .github/apt/web-packages.txt
|
||||
mkdir -p "$APT_CACHE_DIR/partial"
|
||||
sudo apt-get update
|
||||
sudo apt-get \
|
||||
-o Dir::Cache::archives="$APT_CACHE_DIR" \
|
||||
install -y "${packages[@]}"
|
||||
sudo chown -R "$USER:$USER" "$APT_CACHE_DIR"
|
||||
|
||||
- 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 Chrome Extension ZIP
|
||||
run: |
|
||||
set -euo pipefail
|
||||
make package-unpackaged-assets
|
||||
make chrome-web-store
|
||||
test -f build/dist/inbe-chrome-web-store.zip
|
||||
@@ -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,559 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
APT_CACHE_DIR: /tmp/apt-cache
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cache Test apt packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.APT_CACHE_DIR }}
|
||||
key: test-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/test-packages.txt') }}
|
||||
restore-keys: |
|
||||
test-apt-${{ runner.os }}-${{ runner.arch }}-
|
||||
|
||||
- name: Install Test Dependencies
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mapfile -t packages < .github/apt/test-packages.txt
|
||||
mkdir -p "$APT_CACHE_DIR/partial"
|
||||
sudo apt-get update
|
||||
sudo apt-get \
|
||||
-o Dir::Cache::archives="$APT_CACHE_DIR" \
|
||||
install -y "${packages[@]}"
|
||||
sudo chown -R "$USER:$USER" "$APT_CACHE_DIR"
|
||||
|
||||
- name: Run Tests
|
||||
run: make test
|
||||
|
||||
build-web:
|
||||
name: Build Web
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
env:
|
||||
APT_CACHE_DIR: /tmp/apt-cache
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cache Web apt packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.APT_CACHE_DIR }}
|
||||
key: web-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/web-packages.txt') }}
|
||||
restore-keys: |
|
||||
web-apt-${{ runner.os }}-${{ runner.arch }}-
|
||||
|
||||
- name: Install Web Dependencies
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mapfile -t packages < .github/apt/web-packages.txt
|
||||
mkdir -p "$APT_CACHE_DIR/partial"
|
||||
sudo apt-get update
|
||||
sudo apt-get \
|
||||
-o Dir::Cache::archives="$APT_CACHE_DIR" \
|
||||
install -y "${packages[@]}"
|
||||
sudo chown -R "$USER:$USER" "$APT_CACHE_DIR"
|
||||
|
||||
- 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 Web ZIP
|
||||
run: |
|
||||
set -euo pipefail
|
||||
make package-unpackaged-assets
|
||||
make web
|
||||
mkdir -p build/release/web
|
||||
cp build/dist/inbe-web.zip build/release/web/
|
||||
|
||||
- name: Upload Web Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-web
|
||||
path: build/release/web/*
|
||||
if-no-files-found: error
|
||||
|
||||
build-chrome-extension:
|
||||
name: Build Chrome Extension
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
env:
|
||||
APT_CACHE_DIR: /tmp/apt-cache
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cache Web apt packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.APT_CACHE_DIR }}
|
||||
key: web-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/web-packages.txt') }}
|
||||
restore-keys: |
|
||||
web-apt-${{ runner.os }}-${{ runner.arch }}-
|
||||
|
||||
- name: Install Web Dependencies
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mapfile -t packages < .github/apt/web-packages.txt
|
||||
mkdir -p "$APT_CACHE_DIR/partial"
|
||||
sudo apt-get update
|
||||
sudo apt-get \
|
||||
-o Dir::Cache::archives="$APT_CACHE_DIR" \
|
||||
install -y "${packages[@]}"
|
||||
sudo chown -R "$USER:$USER" "$APT_CACHE_DIR"
|
||||
|
||||
- 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 Chrome Extension ZIP
|
||||
run: |
|
||||
set -euo pipefail
|
||||
make package-unpackaged-assets
|
||||
make chrome-web-store
|
||||
mkdir -p build/release/chrome-web-store
|
||||
cp build/dist/inbe-chrome-web-store.zip build/release/chrome-web-store/
|
||||
|
||||
- name: Upload Chrome Extension Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-chrome-web-store
|
||||
path: build/release/chrome-web-store/*
|
||||
if-no-files-found: error
|
||||
|
||||
build-linux:
|
||||
name: Build Linux
|
||||
runs-on: ubuntu-22.04
|
||||
needs: test
|
||||
env:
|
||||
APT_CACHE_DIR: /tmp/apt-cache
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cache Linux apt packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.APT_CACHE_DIR }}
|
||||
key: linux-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/linux-packages.txt') }}
|
||||
restore-keys: |
|
||||
linux-apt-${{ runner.os }}-${{ runner.arch }}-
|
||||
|
||||
- name: Install Linux Dependencies
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mapfile -t packages < .github/apt/linux-packages.txt
|
||||
mkdir -p "$APT_CACHE_DIR/partial"
|
||||
sudo apt-get update
|
||||
sudo apt-get \
|
||||
-o Dir::Cache::archives="$APT_CACHE_DIR" \
|
||||
install -y "${packages[@]}"
|
||||
sudo chown -R "$USER:$USER" "$APT_CACHE_DIR"
|
||||
|
||||
- name: Install AppImage Tools
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p "$HOME/.local/bin"
|
||||
curl -L -o "$HOME/.local/bin/linuxdeploy" \
|
||||
https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
|
||||
curl -L -o "$HOME/.local/bin/linuxdeploy-plugin-appimage" \
|
||||
https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/1-alpha-20250213-1/linuxdeploy-plugin-appimage-x86_64.AppImage
|
||||
curl -L -o "$HOME/.local/bin/appimagetool" \
|
||||
https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
|
||||
chmod +x "$HOME/.local/bin/linuxdeploy" "$HOME/.local/bin/linuxdeploy-plugin-appimage" "$HOME/.local/bin/appimagetool"
|
||||
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Build Linux AppImage
|
||||
env:
|
||||
APPIMAGE_EXTRACT_AND_RUN: "1"
|
||||
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
|
||||
run: |
|
||||
set -euo pipefail
|
||||
RAY_SDL_INCLUDE_DIR="$(pkg-config --variable=includedir sdl2 | sed 's,/SDL2$,,')"
|
||||
RAY_CFLAGS="$(pkg-config --cflags sdl2 libdrm gbm egl glesv2)"
|
||||
RAY_LDLIBS="$(pkg-config --libs sdl2 libdrm gbm egl glesv2)"
|
||||
RAY_SDL_LDLIBS="$(pkg-config --libs sdl2)"
|
||||
export RAY_SDL_INCLUDE_DIR RAY_CFLAGS RAY_LDLIBS RAY_SDL_LDLIBS
|
||||
make appimage
|
||||
mkdir -p build/release/linux
|
||||
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:
|
||||
name: release-linux
|
||||
path: build/release/linux/*
|
||||
if-no-files-found: error
|
||||
|
||||
build-windows:
|
||||
name: Build Windows
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
env:
|
||||
APT_CACHE_DIR: /tmp/apt-cache
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cache Windows apt packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.APT_CACHE_DIR }}
|
||||
key: windows-apt-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/apt/windows-packages.txt') }}
|
||||
restore-keys: |
|
||||
windows-apt-${{ runner.os }}-${{ runner.arch }}-
|
||||
|
||||
- name: Cache Windows vendor builds
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
vendor-builds/windows
|
||||
vendor-builds/sqlite
|
||||
key: windows-vendor-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('Makefile', 'vendor/flint/vendor/raylib/src/**', 'vendor/curl/**', 'vendor/sqlite/**') }}
|
||||
restore-keys: |
|
||||
windows-vendor-${{ runner.os }}-${{ runner.arch }}-
|
||||
|
||||
- name: Install Windows Dependencies
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mapfile -t packages < .github/apt/windows-packages.txt
|
||||
mkdir -p "$APT_CACHE_DIR/partial"
|
||||
sudo apt-get update
|
||||
sudo apt-get \
|
||||
-o Dir::Cache::archives="$APT_CACHE_DIR" \
|
||||
install -y "${packages[@]}"
|
||||
sudo chown -R "$USER:$USER" "$APT_CACHE_DIR"
|
||||
if [ -x /usr/bin/x86_64-w64-mingw32-gcc-win32 ]; then
|
||||
sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-win32
|
||||
fi
|
||||
if [ -x /usr/bin/i686-w64-mingw32-gcc-win32 ]; then
|
||||
sudo update-alternatives --set i686-w64-mingw32-gcc /usr/bin/i686-w64-mingw32-gcc-win32
|
||||
fi
|
||||
|
||||
- name: Build Windows ZIP
|
||||
run: |
|
||||
set -euo pipefail
|
||||
make windows
|
||||
mkdir -p build/release/windows
|
||||
find build/dist/windows -maxdepth 1 -type f -name '*.zip' -exec cp {} build/release/windows/ \;
|
||||
test -n "$(find build/release/windows -type f -print -quit)"
|
||||
|
||||
- name: Upload Windows Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-windows
|
||||
path: build/release/windows/*
|
||||
if-no-files-found: error
|
||||
|
||||
build-android:
|
||||
name: Build Android
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '21'
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v3
|
||||
|
||||
- name: Cache Android SDK packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
${{ env.ANDROID_HOME }}/platforms/android-35
|
||||
${{ env.ANDROID_HOME }}/build-tools/34.0.0
|
||||
${{ env.ANDROID_HOME }}/ndk/25.1.8937393
|
||||
${{ env.ANDROID_HOME }}/ndk/28.2.13676358
|
||||
${{ env.ANDROID_HOME }}/cmake/3.22.1
|
||||
key: android-sdk-${{ runner.os }}-${{ runner.arch }}-api35-bt34-ndk25-ndk28-cmake322
|
||||
restore-keys: |
|
||||
android-sdk-${{ runner.os }}-${{ runner.arch }}-
|
||||
|
||||
- name: Cache Android native build
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
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/flint/vendor/raylib/src/**') }}
|
||||
restore-keys: |
|
||||
android-native-${{ runner.os }}-${{ runner.arch }}-
|
||||
|
||||
- name: Install Android SDK Components
|
||||
run: |
|
||||
set -euo pipefail
|
||||
SDKMANAGER="$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager"
|
||||
yes | "$SDKMANAGER" --licenses >/dev/null || true
|
||||
"$SDKMANAGER" "platforms;android-35" "build-tools;34.0.0" "ndk;25.1.8937393" "cmake;3.22.1"
|
||||
|
||||
- name: Prepare Android signing key
|
||||
env:
|
||||
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p ~/.android
|
||||
echo "$KEYSTORE_BASE64" | base64 -d > ~/.android/inbe-release.keystore
|
||||
|
||||
- name: Copy Android Assets
|
||||
run: ./scripts/copy-android-assets.sh
|
||||
|
||||
- name: Build Android APK
|
||||
env:
|
||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
chmod +x droid/gradlew
|
||||
./droid/gradlew -p droid assembleRelease \
|
||||
-Pkeystore.path="$HOME/.android/inbe-release.keystore" \
|
||||
-Pkeystore.alias="$KEY_ALIAS" \
|
||||
-Pkeystore.password="$KEYSTORE_PASSWORD" \
|
||||
--stacktrace
|
||||
make android-copy-release-apks
|
||||
|
||||
- name: Collect Android Release Files
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p build/release/android
|
||||
VERSION=$(sed -n 's/^#define INBE_VERSION_STRING "\([^"]*\)".*/\1/p' src/core/version.h)
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "Could not read INBE_VERSION_STRING"
|
||||
exit 1
|
||||
fi
|
||||
cp "build/android/inbe-$VERSION.apk" build/release/android/
|
||||
|
||||
- name: Upload Android Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-android
|
||||
path: build/release/android/*
|
||||
if-no-files-found: error
|
||||
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build-web
|
||||
- build-chrome-extension
|
||||
- build-linux
|
||||
- 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
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download Release Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: release-*
|
||||
path: build/release
|
||||
merge-multiple: true
|
||||
|
||||
- name: Verify Release Artifacts
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test -n "$(find build/release -type f -print -quit)"
|
||||
|
||||
- name: Create and Push Tag If Version Is New
|
||||
id: tag_version
|
||||
run: |
|
||||
set -euo pipefail
|
||||
VERSION=$(sed -n 's/^#define INBE_VERSION_STRING "\([^"]*\)".*/\1/p' src/core/version.h)
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "Could not read INBE_VERSION_STRING"
|
||||
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"
|
||||
else
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git tag -a "$TAG" -m "Release $VERSION"
|
||||
git push origin "$TAG"
|
||||
echo "tag_pushed=true" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Create GitHub Release
|
||||
if: steps.tag_version.outputs.tag_pushed == 'true'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ steps.tag_version.outputs.tag_name }}
|
||||
files: build/release/*
|
||||
generate_release_notes: true
|
||||
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 build/itch/inbe-web waozi/inbe:html5 --userversion "$VERSION"
|
||||
butler push "$android_apk" waozi/inbe:android --userversion "$VERSION"
|
||||
butler push "$windows_zip" waozi/inbe:windows --userversion "$VERSION"
|
||||
butler push "$linux_appimage" waozi/inbe:linux --userversion "$VERSION"
|
||||
@@ -10,14 +10,18 @@
|
||||
.codex/
|
||||
.agents/
|
||||
.cache/
|
||||
.ccache
|
||||
*.wasm
|
||||
build/
|
||||
tmp/
|
||||
vendor-builds/
|
||||
node_modules
|
||||
*.nix-defexpr
|
||||
*.npm
|
||||
*.nix-profile
|
||||
.claude.json
|
||||
.bash_history
|
||||
.env
|
||||
|
||||
|
||||
*.exe
|
||||
@@ -26,6 +30,8 @@ node_modules
|
||||
/main
|
||||
!droid/app/src/main
|
||||
droid/app/src/main/assets
|
||||
droid/*.apk
|
||||
droid/*.aab
|
||||
|
||||
.direnv/
|
||||
.node-repl-history
|
||||
@@ -51,3 +57,5 @@ local.properties
|
||||
*.9
|
||||
*.8
|
||||
*.a
|
||||
|
||||
/pro/
|
||||
@@ -1,12 +1,15 @@
|
||||
[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/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 = https://github.com/waozixyz/flint
|
||||
[submodule "vendor/otfchop"]
|
||||
path = vendor/otfchop
|
||||
url = https://github.com/waozixyz/otfchop
|
||||
url = git@github.com:waozixyz/flint.git
|
||||
@@ -1,4 +1,204 @@
|
||||
# Changelog
|
||||
## [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
|
||||
- added theme modal
|
||||
|
||||
## [1.5.1] - 2026-06-22
|
||||
### Fixed
|
||||
- icon scaling
|
||||
- fix inset bug
|
||||
### Added
|
||||
- toggle background music
|
||||
|
||||
## [1.5.0] - 2026-06-22
|
||||
### Changed
|
||||
- New logo
|
||||
- improve tabbar ui
|
||||
### Fixed
|
||||
- sync issues
|
||||
|
||||
## [1.4.11] - 2026-06-21
|
||||
### Added
|
||||
- tab bar mode for habits and exercises
|
||||
### Changed
|
||||
- fix ut click file
|
||||
|
||||
## [1.4.10] - 2026-06-21
|
||||
### Added
|
||||
- Added guide to habits page
|
||||
### Changed
|
||||
- fix orientation issues
|
||||
|
||||
## [1.4.9] - 2026-06-21
|
||||
### Fixed
|
||||
- Fix Practice startup, manual navigation, configuration scrolling, and sync backfill issues.
|
||||
- Add skip feature to on screen guide
|
||||
|
||||
## [1.4.8] - 2026-06-21
|
||||
### Changed
|
||||
- Fixed start screen
|
||||
- Fixed schema on first sync
|
||||
|
||||
## [1.4.7] - 2026-06-21
|
||||
### Changed
|
||||
- Rework Practice into Manual, start, and configuration tabs with a new localized first-run guide.
|
||||
- Simplify Meditation's manual to one page and make bottom navigation more compact.
|
||||
|
||||
## [1.4.6] - 2026-06-20
|
||||
### Changed
|
||||
- Move habit weekly, monthly, statistics, and edit views into icon tabs under the habit selector.
|
||||
- Improve Flint form, modal, tab, and scrollbar widgets for measured layouts and cleaner scrolling.
|
||||
|
||||
### Fixed
|
||||
- Prevent habit info modal text from overlapping the OK button.
|
||||
|
||||
## [1.4.5] - 2026-06-20
|
||||
### Changed
|
||||
- Fix spacing issues and translations
|
||||
|
||||
## [1.4.4] - 2026-06-20
|
||||
### Added
|
||||
- Add Russian localization.
|
||||
- Add a habit stats view with streak, recent activity, weekday, and linked-practice diagrams.
|
||||
- Add optional in-session volume controls, hidden by default.
|
||||
- Add Mint and Cobalt themes.
|
||||
|
||||
### Changed
|
||||
- Use one canonical pixel font atlas with Flint-managed DPI scaling and cleaner title sizing.
|
||||
- Simplify habit counting so multiple counts are opt-in and independent of linked practices.
|
||||
- Improve habit weekly/calendar spacing, mobile calendar touch feedback, and theme picker ordering.
|
||||
- Reorganize repeated screen UI into reusable Flint helpers.
|
||||
|
||||
### Fixed
|
||||
- Build the Ubuntu Touch Click package with the OpenStore package id
|
||||
- Refactor code base
|
||||
- Sync habit multiple-count settings correctly across clients and preserve queued local habit edits.
|
||||
- Preserve linked session day behavior while hiding redundant count badges.
|
||||
|
||||
## [1.4.3] - 2026-06-20
|
||||
### Fixed
|
||||
- Refresh expired native sync auth tokens before sending queued changes.
|
||||
- Require first-time meditation users to continue through the tutorial before starting.
|
||||
|
||||
## [1.4.2] - 2026-06-20
|
||||
### Fixed
|
||||
- Improve sync auth, websocket reconnects, and queued habit/session updates.
|
||||
- Reduce SQLite-related UI flicker and speed up bulk import sync queueing.
|
||||
- Fixed dropdown menus so temporary option lists cannot crash theme/device selection.
|
||||
- Fixed Linux test and release builds to link against the vendored curl library path.
|
||||
|
||||
## [1.4.1] - 2026-06-19
|
||||
### Changed
|
||||
- Improve account management
|
||||
|
||||
## [1.4.0] - 2026-06-19
|
||||
### Added
|
||||
- optional sync client, offline account creation
|
||||
- simplify tutorial
|
||||
|
||||
## [1.3.6] - 2026-06-18
|
||||
### Fixed
|
||||
- Fixed Tickmate `.db` imports so zero-based months map correctly and long habit histories load without dropping later dates.
|
||||
|
||||
## [1.3.5] - 2026-06-18
|
||||
### Fixed
|
||||
- Improved Android data import for `.db` backups, weekly habit rows, and import conflict handling.
|
||||
|
||||
## [1.3.4] - 2026-06-18
|
||||
### Changed
|
||||
- Reorganized WHM and Meditation into practice-owned modules for cleaner code boundaries.
|
||||
- Split the meditation manual into an image intro page and a shorter music/gong setup page.
|
||||
- Expanded release automation to build Web, Linux AppImage, Windows, APK, and AAB artifacts after tests pass.
|
||||
|
||||
## [1.3.3] - 2026-06-17
|
||||
### Fixed
|
||||
- Import now restores habits, habit sync settings, and optionally app settings from Inbe SQLite exports.
|
||||
|
||||
## [1.3.2] - 2026-06-17
|
||||
### Fixed
|
||||
- Unified scroll containers so content stays out of scrollbar tracks and scroll positions clamp cleanly at the bottom.
|
||||
- Android meditation audio downloads now show a localized network-permission/connectivity modal when the host cannot be resolved.
|
||||
- Windows builds now support runtime meditation audio downloads.
|
||||
|
||||
## [1.3.1] - 2026-06-17
|
||||
### Fixed
|
||||
- Fixed Android orientation resizing and habit import merging by name.
|
||||
|
||||
## [1.3.0] - 2026-06-14
|
||||
### Added
|
||||
- Implemented 1-bit habit tracker synced with practice data
|
||||
- Habit editing, custom colors, sync options, and deletion.
|
||||
- Add monochrome theme
|
||||
- Add simple meditation exercise with background music
|
||||
|
||||
## [1.2.6] - 2026-06-12
|
||||
### Fixed
|
||||
- Import now replaces only matching session files from the ZIP and never removes local sessions missing from the import.
|
||||
- Fixed web scaling behavior.
|
||||
|
||||
## [1.2.5] - 2026-06-12
|
||||
### Added
|
||||
- BTC address for donations
|
||||
|
||||
## [1.2.4] - 2026-06-11
|
||||
### Fixed
|
||||
- Android sessions continue correctly when the notification shade causes focus loss with background playback enabled.
|
||||
- Android safe-area insets now offset the viewport at the top instead of creating bottom-only padding.
|
||||
- Progressive start speed defaults to 3, normal speed defaults to 6, and the start speed editor preview animates at the exact selected speed.
|
||||
- Dropdown menu text is clipped cleanly while scrolling.
|
||||
|
||||
## [1.2.3] - 2026-06-10
|
||||
### Fixed
|
||||
- History editing now scrolls to the active field once and keeps 16px Unifont row text aligned without clipping.
|
||||
|
||||
## [1.2.2] - 2026-06-10
|
||||
### Fixed
|
||||
- Android touch targets now align correctly on devices with navigation bar window insets.
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
# Inner Breeze
|
||||
|
||||
Inner Breeze - A free, open-source guided breathing meditation app based on the Wim Hof method.
|
||||
Inner Breeze is a free, open-source practice app for breathing, meditation, and habit tracking.
|
||||
|
||||
## Features
|
||||
|
||||
- Guided breathing sessions with visual and audio cues
|
||||
- Configurable breath counts and hold times
|
||||
- Session history with local storage
|
||||
- 8 color themes (Forest, Ocean, Sky, Sunset, Lavender - each with light/dark variants)
|
||||
- Sound effects (breath in/out, bell)
|
||||
- Fullscreen mode with proper DPI scaling
|
||||
- Touch-optimized UI for mobile devices
|
||||
- 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
|
||||
|
||||
@@ -27,29 +27,34 @@ inbe uses [raylib](https://github.com/raysan5/raylib) and requires a Nix develop
|
||||
# Enter the development shell
|
||||
nix develop
|
||||
|
||||
# Build for your current platform (Linux x86_64/aarch64)
|
||||
make
|
||||
# Build for your current platform
|
||||
make native
|
||||
|
||||
# Run
|
||||
./build/linux/inbe-linux-$(uname -m)
|
||||
make run
|
||||
```
|
||||
|
||||
### Cross-Platform Builds
|
||||
|
||||
```bash
|
||||
# Linux (both architectures)
|
||||
make linux
|
||||
# Android debug APK
|
||||
make android-debug
|
||||
|
||||
# Windows (from Linux)
|
||||
make windows
|
||||
|
||||
# Android APK
|
||||
make android
|
||||
|
||||
# WebAssembly
|
||||
make web
|
||||
# Android release APK
|
||||
make android-release PASSWORD=your-keystore-password
|
||||
```
|
||||
|
||||
## Release Automation
|
||||
|
||||
GitHub Actions builds release artifacts for web, Linux, Windows, Android, and
|
||||
the Chrome extension. When a new version tag is created by the release workflow,
|
||||
the web, Android, Windows, and Linux builds are also published to itch.io.
|
||||
|
||||
Required repository secrets:
|
||||
|
||||
- `ITCH_API_KEY` - itch.io Butler API key for publishing `waozi/inbe:html5`,
|
||||
`waozi/inbe:android`, `waozi/inbe:windows`, and `waozi/inbe:linux`
|
||||
|
||||
### Android Emulator Testing
|
||||
|
||||
For automated testing with camera notch (cutout) support:
|
||||
@@ -57,7 +62,8 @@ For automated testing with camera notch (cutout) support:
|
||||
```bash
|
||||
# Enter the development shell and run everything automatically
|
||||
nix develop
|
||||
./scripts/emulator.sh # Creates AVD, launches emulator, builds & runs app
|
||||
./scripts/emulator.sh # Creates and launches the test AVD
|
||||
make android-install # Builds, installs, and launches the app
|
||||
```
|
||||
|
||||
This single script handles:
|
||||
@@ -81,12 +87,24 @@ The AVD is configured with:
|
||||
|
||||
## Project Structure
|
||||
|
||||
- `src/` - Main application code (raylib frontend)
|
||||
- `libinbe/` - Core meditation logic (platform-agnostic)
|
||||
- `src/` - Inbe application code
|
||||
- `vendor/` - external third-party dependencies
|
||||
- `vendor/flint/` - **git submodule** for first-party UI/runtime support code used directly by Inbe
|
||||
- `wasm4/` - Standalone WASM-4 version
|
||||
- `assets/` - Images and sounds
|
||||
- `themes/` - Color theme definitions
|
||||
- `droid/` - Android build configuration
|
||||
- `vendor/raylib/` - raylib submodule
|
||||
|
||||
## Flint submodule workflow
|
||||
|
||||
`vendor/flint` is a source submodule (not a one-off copied sync). To update Inbe after a Flint change:
|
||||
|
||||
1. Push changes in the Flint repo.
|
||||
2. In Inbe, update the submodule pointer:
|
||||
- `git submodule update --init --recursive vendor/flint`
|
||||
- `git -C vendor/flint pull`
|
||||
3. Commit Inbe with the updated `vendor/flint` submodule reference.
|
||||
|
||||
When updating other projects that vendor Flint as a submodule, this keeps UI behavior and API docs aligned.
|
||||
|
||||
## License
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 100 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
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 |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 3.0 KiB |
@@ -1,72 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="utf-8" />
|
||||
<head>
|
||||
<title>Inner Breeze - All Builds</title>
|
||||
<link href="/style.css" rel="stylesheet" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="Inner Breeze - All available builds and implementations.">
|
||||
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="web-assets/icons/favicon-32x32.png">
|
||||
<meta name="theme-color" content="#5566aa">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="content">
|
||||
<section>
|
||||
<h1>All Builds</h1>
|
||||
<p><a href="/">← Back to Inner Breeze</a></p>
|
||||
</section>
|
||||
<section>
|
||||
<div class="platform-section">
|
||||
<div class="platform-header">
|
||||
<img src="/web-assets/icons/ray.png" alt="raylib"/>
|
||||
<div>
|
||||
<strong><a href="https://raylib.com">Raylib</a></strong>
|
||||
<p>A C library for video game programming - the primary implementation.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="downloads-grid">
|
||||
<a href="/build/web/index.html" class="download-item">Web (WASM)</a>
|
||||
<a href="/build/linux/inbe-linux.tar.gz" class="download-item">Linux</a>
|
||||
<a href="/build/windows/inbe-windows.zip" class="download-item">Windows</a>
|
||||
<a href="/build/android/inbe-latest.apk" class="download-item">Android APK</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="platform-section">
|
||||
<div class="platform-header">
|
||||
<img src="/web-assets/icons/wasm4.png" alt="wasm4"/>
|
||||
<div>
|
||||
<strong><a href="https://wasm4.org">WASM-4</a></strong>
|
||||
<p>A tiny fantasy console that runs WebAssembly cartridges.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="downloads-grid">
|
||||
<a href="/wasm4/build/index.html" class="download-item">Web</a>
|
||||
<a href="/wasm4/build/cart.wasm" class="download-item">cart.wasm</a>
|
||||
<a href="/wasm4/build/inbe-windows.zip" class="download-item">Windows</a>
|
||||
<a href="/wasm4/build/inbe-linux.tar.gz" class="download-item">Linux</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="platform-section">
|
||||
<div class="platform-header">
|
||||
<img src="/web-assets/icons/uxn.png" alt="uxn"/>
|
||||
<div>
|
||||
<strong><a href="https://100r.co/site/uxn.html">Uxn</a></strong>
|
||||
<p>A small virtual computer; <code>.rom</code> runs in a Uxn emulator.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="downloads-grid">
|
||||
<a href="/uxn/index.html" class="download-item">Web</a>
|
||||
<a href="/uxn/inbe.rom" class="download-item">inbe.rom</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<footer>
|
||||
<p>© 2026 <a href="https://waozi.xyz">Waozi</a> | <a href="/privacy.html">Privacy Policy</a></p>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -5,7 +5,7 @@ plugins {
|
||||
android {
|
||||
namespace 'xyz.waozi.inbe'
|
||||
compileSdk 35
|
||||
ndkVersion "25.1.8937393"
|
||||
ndkVersion "28.2.13676358"
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
@@ -18,7 +18,8 @@ android {
|
||||
keystoreProps.load(new FileInputStream(keystorePropsFile))
|
||||
}
|
||||
|
||||
def getKeystorePath = { -> keystoreProps['keystore.path'] ?: System.getenv("HOME") + "/.android/inbe-release.keystore" }
|
||||
def getKeystorePath = { -> project.findProperty('keystore.path') ?: keystoreProps['keystore.path'] ?: System.getenv("HOME") + "/.android/flint-release.keystore" }
|
||||
def getKeystoreAlias = { -> project.findProperty('keystore.alias') ?: keystoreProps['keystore.alias'] ?: "inbe-key" }
|
||||
|
||||
def releasePassword = project.findProperty('keystore.password') ?: ""
|
||||
|
||||
@@ -26,16 +27,16 @@ android {
|
||||
release {
|
||||
storeFile getKeystorePath() ? file(getKeystorePath()) : null
|
||||
storePassword releasePassword
|
||||
keyAlias "inbe-key"
|
||||
keyAlias getKeystoreAlias()
|
||||
keyPassword releasePassword
|
||||
}
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
minSdk 19
|
||||
minSdk 21
|
||||
targetSdk 35
|
||||
versionCode 23
|
||||
versionName "1.2.2"
|
||||
versionCode 58
|
||||
versionName "1.6.2"
|
||||
}
|
||||
|
||||
|
||||
@@ -60,14 +61,24 @@ android {
|
||||
abi {
|
||||
enable true
|
||||
reset()
|
||||
include 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'
|
||||
universalApk true
|
||||
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')
|
||||
}
|
||||
}
|
||||
|
||||
dependenciesInfo {
|
||||
includeInApk = false
|
||||
}
|
||||
|
||||
packaging {
|
||||
jniLibs {
|
||||
useLegacyPackaging = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gradle.taskGraph.whenReady { taskGraph ->
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<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"
|
||||
@@ -9,9 +12,8 @@
|
||||
android:roundIcon="@mipmap/ic_launcher_round">
|
||||
<activity
|
||||
android:name="xyz.waozi.inbe.MainActivity"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
android:configChanges="keyboardHidden|uiMode"
|
||||
android:exported="true"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@android:style/Theme.DeviceDefault.NoActionBar"
|
||||
android:windowLayoutInDisplayCutoutMode="never">
|
||||
<meta-data
|
||||
@@ -32,5 +34,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>
|
||||
@@ -1,14 +1,70 @@
|
||||
cmake_minimum_required(VERSION 3.22)
|
||||
project(Inbe C)
|
||||
|
||||
find_program(CCACHE_PROGRAM ccache)
|
||||
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(LIBINBE_DIR "${REPO_ROOT}/libinbe")
|
||||
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")
|
||||
set(SQLITE_AMALGAMATION_H "${SQLITE_BUILD_DIR}/sqlite3.h")
|
||||
set(NATIVE_APP_GLUE_DIR "${ANDROID_NDK}/sources/android/native_app_glue")
|
||||
file(GLOB FLINT_SOURCES CONFIGURE_DEPENDS "${FLINT_DIR}/src/*.c")
|
||||
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")
|
||||
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")
|
||||
set(INBE_EMBEDDED_INPUTS
|
||||
${INBE_LOCALE_ASSETS}
|
||||
assets/practices/whm/1.jpg
|
||||
assets/practices/whm/2.jpg
|
||||
assets/practices/meditation/1.jpg
|
||||
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}
|
||||
)
|
||||
set(INBE_EMBEDDED_DEPS)
|
||||
foreach(asset ${INBE_EMBEDDED_INPUTS})
|
||||
list(APPEND INBE_EMBEDDED_DEPS "${REPO_ROOT}/${asset}")
|
||||
endforeach()
|
||||
set(INBE_EMBEDDED_ASSETS_C "${CMAKE_BINARY_DIR}/inbe_embedded_assets.c")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${INBE_EMBEDDED_ASSETS_C}"
|
||||
COMMAND sh "${FLINT_DIR}/scripts/embed-assets.sh" "${INBE_EMBEDDED_ASSETS_C}" ${INBE_EMBEDDED_INPUTS}
|
||||
DEPENDS "${FLINT_DIR}/scripts/embed-assets.sh" ${INBE_EMBEDDED_DEPS}
|
||||
WORKING_DIRECTORY "${REPO_ROOT}"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${SQLITE_AMALGAMATION_C}" "${SQLITE_AMALGAMATION_H}"
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${SQLITE_BUILD_DIR}"
|
||||
COMMAND sh -c "cd '${SQLITE_BUILD_DIR}' && '${SQLITE_DIR}/configure'"
|
||||
COMMAND make -C "${SQLITE_BUILD_DIR}" sqlite3.c sqlite3.h
|
||||
DEPENDS "${SQLITE_DIR}/configure" "${SQLITE_DIR}/manifest"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
add_library(raylib STATIC
|
||||
"${RAYLIB_DIR}/rcore.c"
|
||||
@@ -47,48 +103,74 @@ target_include_directories(raylib PUBLIC
|
||||
"${NATIVE_APP_GLUE_DIR}"
|
||||
)
|
||||
|
||||
add_library(inbe STATIC
|
||||
"${LIBINBE_DIR}/inbe.c"
|
||||
)
|
||||
|
||||
target_include_directories(inbe PUBLIC
|
||||
"${LIBINBE_DIR}"
|
||||
)
|
||||
|
||||
add_library(flint STATIC ${FLINT_SOURCES})
|
||||
|
||||
target_include_directories(flint PUBLIC
|
||||
"${FLINT_DIR}/include"
|
||||
"${RAYLIB_DIR}"
|
||||
)
|
||||
|
||||
add_library(main SHARED
|
||||
"${SRC_DIR}/main.c"
|
||||
"${SRC_DIR}/app.c"
|
||||
"${SRC_DIR}/app_session.c"
|
||||
"${SRC_DIR}/locale.c"
|
||||
"${SRC_DIR}/theme_meta.c"
|
||||
"${SRC_DIR}/theme.c"
|
||||
"${SRC_DIR}/data.c"
|
||||
"${SRC_DIR}/miniz.c"
|
||||
"${SRC_DIR}/android/android_import.c"
|
||||
"${SRC_DIR}/android/android_share.c"
|
||||
"${SRC_DIR}/tabs/history_tab.c"
|
||||
"${SRC_DIR}/tabs/language_tab.c"
|
||||
"${SRC_DIR}/tabs/manual_tab.c"
|
||||
"${SRC_DIR}/tabs/settings_tab.c"
|
||||
"${SRC_DIR}/android/android_insets.c"
|
||||
"${SRC_DIR}/android/android_wakelock.c"
|
||||
"${SRC_DIR}/android/android_timer.c"
|
||||
"${SRC_DIR}/core/breath_engine.c"
|
||||
"${SRC_DIR}/app/app.c"
|
||||
"${SRC_DIR}/app/app_settings.c"
|
||||
"${SRC_DIR}/app/device_preferences.c"
|
||||
"${SRC_DIR}/practices/practice_registry.c"
|
||||
"${SRC_DIR}/practices/whm/whm_practice.c"
|
||||
"${SRC_DIR}/practices/whm/whm_session.c"
|
||||
"${SRC_DIR}/practices/whm/whm_manual.c"
|
||||
"${SRC_DIR}/practices/whm/whm_config.c"
|
||||
"${SRC_DIR}/practices/meditation/meditation_practice.c"
|
||||
"${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}/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/sync_review.c"
|
||||
"${SRC_DIR}/storage/sync_account.c"
|
||||
"${SRC_DIR}/storage/sync_client.c"
|
||||
"${SRC_DIR}/third_party/miniz.c"
|
||||
"${SQLITE_AMALGAMATION_C}"
|
||||
"${SRC_DIR}/platform/android/android_device.c"
|
||||
"${SRC_DIR}/platform/android/android_import.c"
|
||||
"${SRC_DIR}/platform/android/android_runtime_assets.c"
|
||||
"${SRC_DIR}/platform/android/android_share.c"
|
||||
"${SRC_DIR}/screens/practice_screen.c"
|
||||
"${SRC_DIR}/screens/language_screen.c"
|
||||
"${SRC_DIR}/screens/manual_screen.c"
|
||||
"${SRC_DIR}/screens/settings/settings_screen.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_data.c"
|
||||
"${SRC_DIR}/screens/settings/settings_sync_account.c"
|
||||
"${INBE_EMBEDDED_ASSETS_C}"
|
||||
${FLINT_SOURCES}
|
||||
"${SRC_DIR}/platform/android/android_insets.c"
|
||||
"${SRC_DIR}/platform/android/android_wakelock.c"
|
||||
"${SRC_DIR}/platform/android/android_timer.c"
|
||||
"${NATIVE_APP_GLUE_DIR}/android_native_app_glue.c"
|
||||
)
|
||||
|
||||
target_include_directories(main PRIVATE
|
||||
"${SRC_DIR}"
|
||||
"${SRC_DIR}/android"
|
||||
"${SRC_DIR}/app"
|
||||
"${SRC_DIR}/core"
|
||||
"${SRC_DIR}/screens"
|
||||
"${SRC_DIR}/screens/settings"
|
||||
"${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}"
|
||||
"${LIBINBE_DIR}"
|
||||
"${FLINT_DIR}/include"
|
||||
"${SQLITE_BUILD_DIR}"
|
||||
)
|
||||
|
||||
target_compile_definitions(main PRIVATE
|
||||
@@ -102,6 +184,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
|
||||
)
|
||||
|
||||
target_compile_options(main PRIVATE
|
||||
@@ -114,13 +198,13 @@ target_compile_options(main PRIVATE
|
||||
target_link_options(main PRIVATE
|
||||
-Wl,--gc-sections
|
||||
-Wl,--strip-all
|
||||
-Wl,-z,max-page-size=16384
|
||||
-Wl,--wrap=fopen
|
||||
)
|
||||
|
||||
target_link_libraries(main
|
||||
raylib
|
||||
inbe
|
||||
flint
|
||||
oqs
|
||||
android
|
||||
log
|
||||
OpenSLES
|
||||
|
||||
@@ -1,26 +1,49 @@
|
||||
package xyz.waozi.inbe;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.NativeActivity;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
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.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
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";
|
||||
private static final int REQUEST_IMPORT_ZIP = 1001;
|
||||
private static final int REQUEST_POST_NOTIFICATIONS = 1002;
|
||||
private static final String DOWNLOAD_CHANNEL_ID = "runtime_downloads";
|
||||
private static final int DOWNLOAD_NOTIFICATION_ID = 2001;
|
||||
|
||||
static {
|
||||
System.loadLibrary("main");
|
||||
@@ -29,20 +52,480 @@ public class MainActivity extends NativeActivity {
|
||||
// [status_bar, nav_bar, cutout_left, cutout_top, cutout_right, cutout_bottom]
|
||||
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,
|
||||
int cutoutLeft, int cutoutTop, int cutoutRight, int cutoutBottom);
|
||||
private native void nativeSetSystemDark(int dark);
|
||||
private native void nativeSetOrientation(int orientation);
|
||||
private native void nativeWakeLockReady();
|
||||
private native void nativeTimerActivate();
|
||||
private native void nativeTimerDeactivate();
|
||||
private native void nativeSetBackgroundActive(boolean active);
|
||||
private native int nativeGetPlayInBackground();
|
||||
private native void nativePauseSession();
|
||||
private native int nativePauseSession();
|
||||
private native void nativeResumeSession();
|
||||
private native void nativeImportSelectedFile(String path);
|
||||
private native void nativeImportCancelled();
|
||||
private native void nativeRuntimeAssetDownloadSucceeded(long handle, long bytes, int httpStatus);
|
||||
private native void nativeRuntimeAssetDownloadProgress(long handle, long bytes, long totalBytes);
|
||||
private native void nativeRuntimeAssetDownloadFailed(long handle, int httpStatus, String error);
|
||||
private native void nativeTextInputCommit(int codepoint);
|
||||
private native void nativeTextInputBackspace();
|
||||
private native void nativeTextInputEnter();
|
||||
private native void nativeInvalidateGraphicsResources();
|
||||
|
||||
public void openImportPicker() {
|
||||
private void requestNotificationPermissionIfNeeded() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU &&
|
||||
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 &&
|
||||
!notificationPermissionRequestInFlight) {
|
||||
notificationPermissionRequestInFlight = true;
|
||||
requestPermissions(new String[] { Manifest.permission.POST_NOTIFICATIONS },
|
||||
REQUEST_POST_NOTIFICATIONS);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@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() {
|
||||
requestNotificationPermissionIfNeeded();
|
||||
NotificationManager manager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
if (manager != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
NotificationChannel channel = new NotificationChannel(
|
||||
DOWNLOAD_CHANNEL_ID,
|
||||
"Downloads",
|
||||
NotificationManager.IMPORTANCE_LOW
|
||||
);
|
||||
manager.createNotificationChannel(channel);
|
||||
}
|
||||
return manager;
|
||||
}
|
||||
|
||||
private void showDownloadNotification(NotificationManager manager, long written, long total) {
|
||||
if (manager == null) return;
|
||||
|
||||
Notification.Builder builder = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||
? new Notification.Builder(this, DOWNLOAD_CHANNEL_ID)
|
||||
: new Notification.Builder(this);
|
||||
builder.setSmallIcon(android.R.drawable.stat_sys_download)
|
||||
.setContentTitle("Downloading audio")
|
||||
.setOngoing(true)
|
||||
.setOnlyAlertOnce(true);
|
||||
if (total > 0) {
|
||||
int progress = (int)Math.max(0, Math.min(100, (written * 100) / total));
|
||||
builder.setProgress(100, progress, false)
|
||||
.setContentText(progress + "%");
|
||||
} else {
|
||||
builder.setProgress(0, 0, true);
|
||||
}
|
||||
manager.notify(DOWNLOAD_NOTIFICATION_ID, builder.build());
|
||||
}
|
||||
|
||||
private void clearDownloadNotification(NotificationManager manager) {
|
||||
if (manager != null) {
|
||||
manager.cancel(DOWNLOAD_NOTIFICATION_ID);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSoftKeyboardVisible(final boolean visible) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
View view = getWindow() != null ? getWindow().getDecorView() : null;
|
||||
if (imm == null || view == null) return;
|
||||
|
||||
if (visible) {
|
||||
view.requestFocus();
|
||||
imm.showSoftInput(view, InputMethodManager.SHOW_FORCED);
|
||||
} else {
|
||||
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
if (event != null && event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
int keyCode = event.getKeyCode();
|
||||
if (keyCode == KeyEvent.KEYCODE_DEL) {
|
||||
int repeatCount = event.getRepeatCount();
|
||||
int deleteCount = lastDeleteRepeatCount < 0
|
||||
? 1
|
||||
: Math.max(1, repeatCount - lastDeleteRepeatCount);
|
||||
lastDeleteRepeatCount = repeatCount;
|
||||
for (int i = 0; i < deleteCount; i++) {
|
||||
nativeTextInputBackspace();
|
||||
}
|
||||
} else if (keyCode == KeyEvent.KEYCODE_ENTER ||
|
||||
keyCode == KeyEvent.KEYCODE_NUMPAD_ENTER) {
|
||||
lastDeleteRepeatCount = -1;
|
||||
nativeTextInputEnter();
|
||||
} else {
|
||||
lastDeleteRepeatCount = -1;
|
||||
int unicode = event.getUnicodeChar();
|
||||
if (unicode >= 32) {
|
||||
nativeTextInputCommit(unicode);
|
||||
}
|
||||
}
|
||||
} else if (event != null && event.getAction() == KeyEvent.ACTION_UP) {
|
||||
if (event.getKeyCode() == KeyEvent.KEYCODE_DEL) {
|
||||
lastDeleteRepeatCount = -1;
|
||||
}
|
||||
} else if (event != null && event.getAction() == KeyEvent.ACTION_MULTIPLE &&
|
||||
event.getCharacters() != null) {
|
||||
lastDeleteRepeatCount = -1;
|
||||
String chars = event.getCharacters();
|
||||
for (int i = 0; i < chars.length();) {
|
||||
int codepoint = chars.codePointAt(i);
|
||||
if (codepoint >= 32) {
|
||||
nativeTextInputCommit(codepoint);
|
||||
}
|
||||
i += Character.charCount(codepoint);
|
||||
}
|
||||
}
|
||||
return super.dispatchKeyEvent(event);
|
||||
}
|
||||
|
||||
public void applyOrientationMode(final int mode) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int requested = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
|
||||
switch (mode) {
|
||||
case 1:
|
||||
requested = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
|
||||
break;
|
||||
case 2:
|
||||
requested = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
|
||||
break;
|
||||
case 3:
|
||||
requested = ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR;
|
||||
break;
|
||||
default:
|
||||
requested = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
|
||||
break;
|
||||
}
|
||||
setRequestedOrientation(requested);
|
||||
pushDeviceConfiguration();
|
||||
requestInsetRefresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void startRuntimeAssetDownload(final String url, final String path, final long handle) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
HttpURLConnection connection = null;
|
||||
int status = 0;
|
||||
long written = 0;
|
||||
long total = 0;
|
||||
long lastNotify = 0;
|
||||
File outputFile = new File(path);
|
||||
File parent = outputFile.getParentFile();
|
||||
NotificationManager notificationManager = getDownloadNotificationManager();
|
||||
|
||||
try {
|
||||
if (parent != null && !parent.exists() && !parent.mkdirs()) {
|
||||
nativeRuntimeAssetDownloadFailed(handle, status, "failed to create download directory");
|
||||
return;
|
||||
}
|
||||
|
||||
connection = (HttpURLConnection) new URL(url).openConnection();
|
||||
connection.setInstanceFollowRedirects(true);
|
||||
connection.setConnectTimeout(15000);
|
||||
connection.setReadTimeout(30000);
|
||||
connection.setRequestProperty("User-Agent", "flint-runtime-assets/1");
|
||||
status = connection.getResponseCode();
|
||||
|
||||
if (status < 200 || status >= 300) {
|
||||
outputFile.delete();
|
||||
nativeRuntimeAssetDownloadFailed(handle, status, "HTTP " + status);
|
||||
return;
|
||||
}
|
||||
|
||||
total = connection.getContentLengthLong();
|
||||
nativeRuntimeAssetDownloadProgress(handle, written, total);
|
||||
showDownloadNotification(notificationManager, written, total);
|
||||
|
||||
try (InputStream input = connection.getInputStream();
|
||||
FileOutputStream output = new FileOutputStream(outputFile)) {
|
||||
byte[] buffer = new byte[32768];
|
||||
int read;
|
||||
while ((read = input.read(buffer)) != -1) {
|
||||
output.write(buffer, 0, read);
|
||||
written += read;
|
||||
nativeRuntimeAssetDownloadProgress(handle, written, total);
|
||||
long now = android.os.SystemClock.uptimeMillis();
|
||||
if (now - lastNotify > 250 || (total > 0 && written >= total)) {
|
||||
showDownloadNotification(notificationManager, written, total);
|
||||
lastNotify = now;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nativeRuntimeAssetDownloadSucceeded(handle, written, status);
|
||||
} catch (UnknownHostException | SocketException | SocketTimeoutException e) {
|
||||
outputFile.delete();
|
||||
nativeRuntimeAssetDownloadFailed(handle, status, "NETWORK_UNAVAILABLE");
|
||||
} catch (Exception e) {
|
||||
outputFile.delete();
|
||||
nativeRuntimeAssetDownloadFailed(handle, status, e.getMessage());
|
||||
} finally {
|
||||
clearDownloadNotification(notificationManager);
|
||||
if (connection != null) {
|
||||
connection.disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
}, "inbe-runtime-asset-download").start();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
public void openImportPicker(final String mimeTypesCsv) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -50,11 +533,10 @@ public class MainActivity extends NativeActivity {
|
||||
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
intent.setType("*/*");
|
||||
intent.putExtra(Intent.EXTRA_MIME_TYPES, new String[] {
|
||||
"application/zip",
|
||||
"application/octet-stream",
|
||||
"application/x-zip-compressed"
|
||||
});
|
||||
String[] mimeTypes = parseMimeTypes(mimeTypesCsv);
|
||||
if (mimeTypes.length > 0) {
|
||||
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes);
|
||||
}
|
||||
startActivityForResult(intent, REQUEST_IMPORT_ZIP);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Failed to open import picker", e);
|
||||
@@ -64,6 +546,22 @@ public class MainActivity extends NativeActivity {
|
||||
});
|
||||
}
|
||||
|
||||
private static String[] parseMimeTypes(String mimeTypesCsv) {
|
||||
if (mimeTypesCsv == null || mimeTypesCsv.trim().isEmpty()) {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
String[] raw = mimeTypesCsv.split(",");
|
||||
java.util.ArrayList<String> result = new java.util.ArrayList<>();
|
||||
for (String mimeType : raw) {
|
||||
String trimmed = mimeType.trim();
|
||||
if (!trimmed.isEmpty()) {
|
||||
result.add(trimmed);
|
||||
}
|
||||
}
|
||||
return result.toArray(new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
@@ -77,7 +575,7 @@ public class MainActivity extends NativeActivity {
|
||||
|
||||
Uri uri = data.getData();
|
||||
File importDir = new File(getCacheDir(), "imports");
|
||||
File importFile = new File(importDir, "inbe-import.zip");
|
||||
File importFile = new File(importDir, "inbe-import");
|
||||
|
||||
try {
|
||||
if (!importDir.exists() && !importDir.mkdirs()) {
|
||||
@@ -107,31 +605,27 @@ 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);
|
||||
stopService(intent);
|
||||
}
|
||||
|
||||
public void updateSessionNotification(final String statusText) {
|
||||
if (statusText == null || statusText.isEmpty()) return;
|
||||
SessionForegroundService.updateStatus(statusText);
|
||||
}
|
||||
|
||||
public void keepScreenOn() {
|
||||
@@ -165,9 +659,49 @@ public class MainActivity extends NativeActivity {
|
||||
}
|
||||
|
||||
setupInsetsListener();
|
||||
pushDeviceConfiguration();
|
||||
|
||||
// Notify native code that activity is ready for wake lock
|
||||
nativeWakeLockReady();
|
||||
requestNotificationPermissionIfNeeded();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
nativeInvalidateGraphicsResources();
|
||||
pushDeviceConfiguration();
|
||||
requestInsetRefresh();
|
||||
}
|
||||
|
||||
private void pushDeviceConfiguration() {
|
||||
Configuration config = getResources().getConfiguration();
|
||||
int nightMask = config.uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||
int dark = nightMask == Configuration.UI_MODE_NIGHT_YES ? 1 : 0;
|
||||
int orientation = 0;
|
||||
|
||||
if (config.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||
orientation = 1;
|
||||
} else if (config.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
orientation = 2;
|
||||
}
|
||||
|
||||
nativeSetSystemDark(dark);
|
||||
nativeSetOrientation(orientation);
|
||||
}
|
||||
|
||||
private void requestInsetRefresh() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
final View decorView = getWindow().getDecorView();
|
||||
decorView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
decorView.requestApplyInsets();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void setupInsetsListener() {
|
||||
@@ -296,36 +830,54 @@ public class MainActivity extends NativeActivity {
|
||||
return result;
|
||||
}
|
||||
|
||||
private void syncLifecycleState(String reason) {
|
||||
int playInBackground = nativeGetPlayInBackground();
|
||||
boolean shouldRunInBackground = playInBackground != 0 && (activityPaused || !windowFocused);
|
||||
|
||||
Log.d(TAG, reason + ": play_in_background=" + playInBackground
|
||||
+ " activityPaused=" + activityPaused
|
||||
+ " windowFocused=" + windowFocused
|
||||
+ " backgroundActive=" + backgroundExecutionActive);
|
||||
|
||||
if (backgroundExecutionActive != shouldRunInBackground) {
|
||||
nativeSetBackgroundActive(shouldRunInBackground);
|
||||
backgroundExecutionActive = shouldRunInBackground;
|
||||
}
|
||||
|
||||
if (playInBackground == 0) {
|
||||
if (activityPaused && !autoPausedForLifecycle) {
|
||||
autoPausedForLifecycle = nativePauseSession() != 0;
|
||||
} else if (!activityPaused && autoPausedForLifecycle) {
|
||||
nativeResumeSession();
|
||||
autoPausedForLifecycle = false;
|
||||
}
|
||||
} else if (autoPausedForLifecycle) {
|
||||
nativeResumeSession();
|
||||
autoPausedForLifecycle = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
int playInBackground = nativeGetPlayInBackground();
|
||||
Log.d(TAG, "onPause: play_in_background = " + playInBackground);
|
||||
if (playInBackground == 0) {
|
||||
// Auto-pause if play in background is disabled
|
||||
Log.d(TAG, "onPause: Auto-pausing session (play in background disabled)");
|
||||
nativePauseSession();
|
||||
} else {
|
||||
// Continue in background
|
||||
Log.d(TAG, "onPause: Continuing in background (play in background enabled)");
|
||||
nativeTimerActivate();
|
||||
}
|
||||
activityPaused = true;
|
||||
syncLifecycleState("onPause");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
int playInBackground = nativeGetPlayInBackground();
|
||||
Log.d(TAG, "onResume: play_in_background = " + playInBackground);
|
||||
if (playInBackground == 0) {
|
||||
// Auto-resume if play in background is disabled
|
||||
Log.d(TAG, "onResume: Auto-resuming session (play in background disabled)");
|
||||
nativeResumeSession();
|
||||
} else {
|
||||
// Just deactivate timer (session continued in background)
|
||||
Log.d(TAG, "onResume: Deactivating background timer");
|
||||
nativeTimerDeactivate();
|
||||
}
|
||||
activityPaused = false;
|
||||
nativeInvalidateGraphicsResources();
|
||||
requestInsetRefresh();
|
||||
syncLifecycleState("onResume");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
super.onWindowFocusChanged(hasFocus);
|
||||
windowFocused = hasFocus;
|
||||
syncLifecycleState("onWindowFocusChanged");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
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;
|
||||
|
||||
@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();
|
||||
stopForegroundCompat();
|
||||
if (activeService == this) {
|
||||
activeService = null;
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private void startSession() {
|
||||
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);
|
||||
}
|
||||
acquireWakeLock();
|
||||
Log.d(TAG, "Session foreground service started");
|
||||
}
|
||||
|
||||
private void stopSession() {
|
||||
releaseWakeLock();
|
||||
stopForegroundCompat();
|
||||
stopSelf();
|
||||
Log.d(TAG, "Session foreground service stopped");
|
||||
}
|
||||
|
||||
public static void updateStatus(String statusText) {
|
||||
if (statusText != null && !statusText.isEmpty()) {
|
||||
currentStatusText = statusText;
|
||||
}
|
||||
|
||||
SessionForegroundService service = activeService;
|
||||
if (service == null) {
|
||||
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 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);
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,40 @@ import java.io.FileOutputStream;
|
||||
public class ShareHelper {
|
||||
private static final String TAG = "InbeShare";
|
||||
|
||||
public static void shareFile(Activity activity, byte[] data, String filename, String mimeType, String chooserTitle) {
|
||||
if (activity == null || data == null) return;
|
||||
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
File cacheFile = new File(activity.getCacheDir(), filename);
|
||||
FileOutputStream fos = new FileOutputStream(cacheFile);
|
||||
fos.write(data);
|
||||
fos.close();
|
||||
|
||||
Uri contentUri = FileProvider.getUriForFile(
|
||||
activity,
|
||||
"xyz.waozi.inbe.fileprovider",
|
||||
cacheFile
|
||||
);
|
||||
|
||||
Intent sendIntent = new Intent(Intent.ACTION_SEND);
|
||||
sendIntent.setType(mimeType != null ? mimeType : "application/octet-stream");
|
||||
sendIntent.putExtra(Intent.EXTRA_STREAM, contentUri);
|
||||
sendIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
|
||||
Intent shareIntent = Intent.createChooser(sendIntent, chooserTitle);
|
||||
activity.startActivity(shareIntent);
|
||||
|
||||
Log.i(TAG, "Share sheet shown");
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Share failed", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void shareZipFile(Activity activity, byte[] zipData, String filename, String chooserTitle) {
|
||||
if (activity == null || zipData == null) return;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#E2EEFC" />
|
||||
<solid android:color="#87CEEB" />
|
||||
</shape>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 9.7 KiB |
|
After Width: | Height: | Size: 9.7 KiB |
|
Before Width: | Height: | Size: 638 B After Width: | Height: | Size: 515 B |
|
Before Width: | Height: | Size: 638 B After Width: | Height: | Size: 515 B |
|
Before Width: | Height: | Size: 554 B After Width: | Height: | Size: 383 B |
|
Before Width: | Height: | Size: 554 B After Width: | Height: | Size: 383 B |
|
Before Width: | Height: | Size: 670 B After Width: | Height: | Size: 577 B |
|
Before Width: | Height: | Size: 670 B After Width: | Height: | Size: 577 B |
|
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 652 B |
|
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 652 B |
|
Before Width: | Height: | Size: 670 B After Width: | Height: | Size: 720 B |
|
Before Width: | Height: | Size: 670 B After Width: | Height: | Size: 720 B |
@@ -1,7 +0,0 @@
|
||||
Initial release
|
||||
|
||||
• Breathing exercise tutorial with 5 steps
|
||||
• Configurable settings: speed, rounds, breaths, pause duration
|
||||
• Session history tracking and statistics
|
||||
• Support for Linux, Windows, Android, and WebAssembly
|
||||
• Dark theme with customizable colors
|
||||
@@ -1,2 +1,5 @@
|
||||
android.useAndroidX=true
|
||||
android.suppressUnsupportedCompileSdk=35
|
||||
org.gradle.caching=true
|
||||
org.gradle.parallel=true
|
||||
android.nativeBuildCache.enabled=true
|
||||
@@ -1,12 +1,10 @@
|
||||
Eine freie, quelloffene App für geführte Atemmeditation nach der Wim-Hof-Methode.
|
||||
Eine freie, quelloffene App für Atmung, Meditation und Gewohnheiten.
|
||||
|
||||
Funktionen:
|
||||
- Geführte Atemsitzungen mit visuellen und akustischen Hinweisen
|
||||
- Anpassbare Atemanzahl und Haltezeiten
|
||||
- Sitzungsverlauf mit lokaler Speicherung
|
||||
- 8 Farbthemen (Forest, Ocean, Sky, Sunset, Lavender - jeweils hell/dunkel)
|
||||
- Soundeffekte (Einatmen/Ausatmen, Glocke)
|
||||
- Vollbildmodus mit korrekter DPI-Skalierung
|
||||
- Touch-optimierte Oberfläche für Mobilgeräte
|
||||
|
||||
Verfügbare Plattformen: Linux, Windows, Android, WebAssembly.
|
||||
- Geführte Übungen mit visuellen und akustischen Hinweisen
|
||||
- Mind, Yoga und Fitness für verschiedene Übungsroutinen
|
||||
- Anpassbare Atemsitzungen, Meditationstimer und Zähler
|
||||
- Gewohnheitstracking mit Verlauf und verknüpften Übungszahlen
|
||||
- Optionale Synchronisierung von Gewohnheiten, Sitzungen und Fortschritt
|
||||
- Lokale Speicherung mit Import und Export
|
||||
- Anpassbare Designs mit hellen und dunklen Varianten
|
||||
@@ -1 +1 @@
|
||||
Eine freie, quelloffene Atemmeditations-App nach der Wim-Hof-Methode.
|
||||
Atmung, Meditation und Gewohnheiten mit Synchronisierung.
|
||||
@@ -0,0 +1,2 @@
|
||||
### Fixed
|
||||
- History editing now scrolls to the active field once and keeps 16px Unifont row text aligned without clipping.
|
||||
@@ -0,0 +1,5 @@
|
||||
### Fixed
|
||||
- Android sessions continue correctly when the notification shade causes focus loss with background playback enabled.
|
||||
- Android safe-area insets now offset the viewport at the top instead of creating bottom-only padding.
|
||||
- Progressive start speed defaults to 3, normal speed defaults to 6, and the start speed editor preview animates at the exact selected speed.
|
||||
- Dropdown menu text is clipped cleanly while scrolling.
|
||||
@@ -0,0 +1,2 @@
|
||||
### Added
|
||||
- BTC address for donations
|
||||
@@ -0,0 +1,3 @@
|
||||
### Fixed
|
||||
- Import now replaces only matching session files from the ZIP and never removes local sessions missing from the import.
|
||||
- Fixed web scaling behavior.
|
||||
@@ -0,0 +1,6 @@
|
||||
### Added
|
||||
- Habit tracking with default Mind, Yoga, and Fitness habits.
|
||||
- Habit editing, custom colors, sync options, and deletion.
|
||||
- Practice tabs with configurable themes.
|
||||
### Changed
|
||||
- App theme now follows the active practice theme globally.
|
||||
@@ -0,0 +1,2 @@
|
||||
### Fixed
|
||||
- Fixed Android orientation changes so forced landscape and portrait resize the app viewport correctly.
|
||||
@@ -0,0 +1,3 @@
|
||||
### Fixed
|
||||
- Unified scroll containers so content stays out of scrollbar tracks and scroll positions clamp cleanly at the bottom.
|
||||
- Android meditation audio downloads now show a localized network-permission/connectivity modal when the host cannot be resolved.
|
||||
@@ -0,0 +1,3 @@
|
||||
Fixed
|
||||
---
|
||||
- Import now restores habits, habit sync settings, and optionally app settings from Inbe SQLite exports.
|
||||
@@ -0,0 +1,3 @@
|
||||
### Changed
|
||||
- Reorganized WHM and Meditation into practice-owned modules for cleaner code boundaries.
|
||||
- Split the meditation manual into an image intro page and a shorter music/gong setup page.
|
||||
@@ -0,0 +1,2 @@
|
||||
### Fixed
|
||||
- Improved Android data import for `.db` backups, weekly habit rows, and import conflict handling.
|
||||
@@ -0,0 +1,2 @@
|
||||
### Fixed
|
||||
- Fixed Tickmate `.db` imports so zero-based months map correctly and long habit histories load without dropping later dates.
|
||||
@@ -0,0 +1,2 @@
|
||||
### Added
|
||||
- optional sync client, offline account creation
|
||||
@@ -0,0 +1,2 @@
|
||||
### Changed
|
||||
- Improve account management
|
||||
@@ -0,0 +1,3 @@
|
||||
### Fixed
|
||||
- Improve sync auth, websocket reconnects, and queued habit/session updates.
|
||||
- Reduce SQLite-related UI flicker and speed up bulk import sync queueing.
|
||||
@@ -0,0 +1,3 @@
|
||||
### Fixed
|
||||
- Refresh expired native sync auth tokens before sending queued changes.
|
||||
- Require first-time meditation users to continue through the tutorial before starting.
|
||||
@@ -0,0 +1,3 @@
|
||||
### Fixed
|
||||
- Build the Ubuntu Touch Click package with the OpenStore package id and review-compatible control metadata.
|
||||
- Omit Click AppStream metadata by default to avoid OpenStore revision import failures.
|
||||
@@ -0,0 +1,2 @@
|
||||
### Changed
|
||||
- Fix spacing issues and translations
|
||||
@@ -0,0 +1,4 @@
|
||||
### Changed
|
||||
- Add a responsive Flint sidebar, configurable bottom navigation, and independent Statistics screen.
|
||||
### Fixed
|
||||
- Preserve queued local habit counter settings when applying sync responses.
|
||||
@@ -0,0 +1,3 @@
|
||||
### Changed
|
||||
- Rework Practice into Manual, start, and configuration tabs with a new localized first-run guide.
|
||||
- Simplify Meditation's manual to one page and make bottom navigation more compact.
|
||||
@@ -0,0 +1,2 @@
|
||||
### Changed
|
||||
- Fixed start screen
|
||||
@@ -0,0 +1,2 @@
|
||||
### Fixed
|
||||
- Fix Practice startup, manual navigation, configuration scrolling, and sync backfill issues.
|
||||
@@ -0,0 +1,4 @@
|
||||
### Added
|
||||
- Added guide to habits page
|
||||
### Changed
|
||||
- fix orientation issues
|
||||
@@ -0,0 +1,4 @@
|
||||
### Added
|
||||
- tab bar mode for habits and exercises
|
||||
### Changed
|
||||
- fix ut click file
|
||||
@@ -0,0 +1,3 @@
|
||||
### Changed
|
||||
- New logo
|
||||
- improve tabbar ui
|
||||
@@ -0,0 +1,3 @@
|
||||
Fixed
|
||||
---
|
||||
- icon scaling
|
||||
@@ -0,0 +1,4 @@
|
||||
Changed
|
||||
---
|
||||
- let you disable screen transitions
|
||||
- added theme modal
|
||||
@@ -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
|
||||
@@ -1,12 +1,10 @@
|
||||
A free, open-source guided breathing meditation app based on the Wim Hof method.
|
||||
A free, open-source practice app for breathing, meditation, and habit tracking.
|
||||
|
||||
Features:
|
||||
- Guided breathing sessions with visual and audio cues
|
||||
- Configurable breath counts and hold times
|
||||
- Session history with local storage
|
||||
- 8 color themes (Forest, Ocean, Sky, Sunset, Lavender - each with light/dark variants)
|
||||
- Sound effects (breath in/out, bell)
|
||||
- Fullscreen mode with proper DPI scaling
|
||||
- Touch-optimized UI for mobile devices
|
||||
|
||||
Available platforms: Linux, Windows, Android, WebAssembly.
|
||||
- Guided practice sessions with visual and audio cues
|
||||
- Mind, Yoga, and Fitness organization for different practice routines
|
||||
- Customizable breathing sessions, meditation timers, and habit counters
|
||||
- Habit tracking with session history and linked practice counts
|
||||
- Optional sync for habits, sessions, and practice progress
|
||||
- Local storage with import/export support
|
||||
- Theme customization with light and dark variants
|
||||
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 157 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 187 KiB After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 79 KiB |