Release 1.9.16
This commit is contained in:
1 parent
adea75fae4
commit
665174edaa
35 files changed
+694
-382
No files matched your search
@@ -1,4 +1,11 @@
|
||||
# Changelog
|
||||
## [1.9.16] - 2026-08-29
|
||||
### Changed
|
||||
- Sync now speaks Ksync protocol v5 compatibility mode while keeping existing secure synced data usable.
|
||||
|
||||
### Fixed
|
||||
- Fixed web sync key import stability in Firefox.
|
||||
|
||||
## [1.9.15] - 2026-08-29
|
||||
### Fixed
|
||||
- Fixed a web startup stability issue that could affect browser smoke checks after reload.
|
||||
|
||||
@@ -1521,7 +1521,7 @@ android-bundle:
|
||||
|
||||
android-copy-debug-apks: | $(ANDROID_BUILD_DIR)
|
||||
@found=0; \
|
||||
for apk in droid/app/build/outputs/apk/debug/*.apk; do \
|
||||
for apk in droid/app/build/outputs/apk/*/debug/*.apk droid/app/build/outputs/apk/debug/*.apk; do \
|
||||
if [ -f "$$apk" ]; then \
|
||||
cp "$$apk" "$(ANDROID_BUILD_DIR)/$$(basename "$$apk")"; \
|
||||
found=1; \
|
||||
@@ -1534,7 +1534,7 @@ android-copy-debug-apks: | $(ANDROID_BUILD_DIR)
|
||||
|
||||
android-copy-release-apks: | $(ANDROID_BUILD_DIR)
|
||||
@found=0; \
|
||||
for apk in droid/app/build/outputs/apk/release/*.apk; do \
|
||||
for apk in droid/app/build/outputs/apk/*/release/*.apk droid/app/build/outputs/apk/release/*.apk; do \
|
||||
if [ -f "$$apk" ]; then \
|
||||
cp "$$apk" "$(ANDROID_BUILD_DIR)/$$(basename "$$apk")"; \
|
||||
found=1; \
|
||||
@@ -1548,8 +1548,8 @@ android-copy-release-apks: | $(ANDROID_BUILD_DIR)
|
||||
echo "Could not read INBE_VERSION_STRING from $(VERSION_FILE)"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
universal="$$(find droid/app/build/outputs/apk/release -maxdepth 1 -name '*universal*release*.apk' | head -n 1)"; \
|
||||
if [ -z "$$universal" ]; then universal="$$(find droid/app/build/outputs/apk/release -maxdepth 1 -name '*release*.apk' | head -n 1)"; fi; \
|
||||
universal="$$(find droid/app/build/outputs/apk -path '*/release/*' -name '*universal*release*.apk' | head -n 1)"; \
|
||||
if [ -z "$$universal" ]; then universal="$$(find droid/app/build/outputs/apk -path '*/release/*' -name '*release*.apk' | head -n 1)"; fi; \
|
||||
if [ -z "$$universal" ]; then \
|
||||
echo "No release APK was available for versioned copy"; \
|
||||
exit 1; \
|
||||
@@ -1557,9 +1557,7 @@ android-copy-release-apks: | $(ANDROID_BUILD_DIR)
|
||||
cp "$$universal" "$(ANDROID_BUILD_DIR)/$(APP_NAME)-$(APP_VERSION).apk"; \
|
||||
cp "$$universal" "$(ANDROID_BUILD_DIR)/$(APP_NAME)-latest.apk"; \
|
||||
for abi in arm64-v8a armeabi-v7a x86 x86_64; do \
|
||||
split="droid/app/build/outputs/apk/release/app-$$abi-release.apk"; \
|
||||
if [ ! -f "$$split" ]; then split="droid/app/build/outputs/apk/release/app-$$abi-release-unsigned.apk"; fi; \
|
||||
if [ ! -f "$$split" ]; then split="$$(find droid/app/build/outputs/apk/release -maxdepth 1 -name "app-$$abi-release*.apk" | head -n 1)"; fi; \
|
||||
split="$$(find droid/app/build/outputs/apk -path '*/release/*' -name "app-*$$abi-release*.apk" | head -n 1)"; \
|
||||
if [ -z "$$split" ] || [ ! -f "$$split" ]; then \
|
||||
echo "No release APK was produced for ABI $$abi"; \
|
||||
exit 1; \
|
||||
@@ -1569,7 +1567,7 @@ android-copy-release-apks: | $(ANDROID_BUILD_DIR)
|
||||
|
||||
android-copy-bundle: | $(ANDROID_BUILD_DIR)
|
||||
@found=0; \
|
||||
for bundle in droid/app/build/outputs/bundle/release/*.aab; do \
|
||||
for bundle in droid/app/build/outputs/bundle/*Release/*.aab droid/app/build/outputs/bundle/release/*.aab; do \
|
||||
if [ -f "$$bundle" ]; then \
|
||||
cp "$$bundle" "$(ANDROID_BUILD_DIR)/$$(basename "$$bundle")"; \
|
||||
found=1; \
|
||||
@@ -1583,12 +1581,12 @@ android-copy-bundle: | $(ANDROID_BUILD_DIR)
|
||||
android-install: android-debug
|
||||
ADB='$(ADB)' sh scripts/android-install-apk.sh \
|
||||
"$(ANDROID_APP_ID)" "$(ANDROID_ACTIVITY)" \
|
||||
droid/app/build/outputs/apk/debug debug
|
||||
droid/app/build/outputs/apk debug
|
||||
|
||||
android-install-release: android-release
|
||||
ADB='$(ADB)' sh scripts/android-install-apk.sh \
|
||||
"$(ANDROID_APP_ID)" "$(ANDROID_ACTIVITY)" \
|
||||
droid/app/build/outputs/apk/release release
|
||||
droid/app/build/outputs/apk release
|
||||
|
||||
android-avd:
|
||||
@if [ "$(UNAME_S)" = "FreeBSD" ]; then \
|
||||
|
||||
@@ -1,29 +1,76 @@
|
||||
<p align="center">
|
||||
<img src="assets/app/readme-banner.png" alt="Inner Breeze" width="100%">
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://play.google.com/store/apps/details?id=xyz.waozi.inbe">
|
||||
<img src="assets/app/badge-google-play.svg" alt="Get it on Google Play" height="56">
|
||||
</a>
|
||||
<a href="https://f-droid.org/packages/xyz.waozi.inbe/">
|
||||
<img src="assets/app/badge-f-droid.svg" alt="Get it on F-Droid" height="56">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
# Inner Breeze
|
||||
|
||||
Inner Breeze is a free, open-source app for breathing, meditation, and habit tracking.
|
||||
Inner Breeze is a free, open-source practice app for breathing, meditation, and
|
||||
habit tracking. It works offline, stores data locally in SQLite, and can
|
||||
optionally sync user-owned data through a Ksync-compatible sync server.
|
||||
|
||||
## Features
|
||||
|
||||
- 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
|
||||
- Local import and export support
|
||||
- Theme customization with light and dark variants
|
||||
|
||||
## Build
|
||||
|
||||
Build with the system toolchain and project Makefile:
|
||||
Initialize the submodules once:
|
||||
|
||||
```bash
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
Build and run the desktop app:
|
||||
|
||||
```bash
|
||||
make native
|
||||
make run
|
||||
```
|
||||
|
||||
Run the terminal backend with one command:
|
||||
Run the terminal backend:
|
||||
|
||||
```bash
|
||||
make tui
|
||||
```
|
||||
|
||||
On FreeBSD, use GNU Make:
|
||||
Build Android artifacts:
|
||||
|
||||
```bash
|
||||
gmake native
|
||||
gmake run
|
||||
make android-debug
|
||||
PASSWORD=your-keystore-password make android-release
|
||||
PASSWORD=your-keystore-password make android-bundle
|
||||
```
|
||||
|
||||
Build the web app:
|
||||
|
||||
```bash
|
||||
make web
|
||||
make site
|
||||
```
|
||||
|
||||
Run the test suite:
|
||||
|
||||
```bash
|
||||
make test
|
||||
```
|
||||
|
||||
Native binaries are written to `build/bin/<platform>/`. Release artifacts are
|
||||
written under `build/dist/`.
|
||||
|
||||
To debug Inbe against the root Kryon checkout instead of the vendored
|
||||
submodule, override `KRYON_DIR`:
|
||||
|
||||
@@ -31,172 +78,10 @@ submodule, override `KRYON_DIR`:
|
||||
make run KRYON_DIR=../kryon
|
||||
```
|
||||
|
||||
On FreeBSD:
|
||||
|
||||
```bash
|
||||
gmake run KRYON_DIR=../kryon
|
||||
```
|
||||
|
||||
Use this only for local debugging. Permanent Kryon fixes should be committed in
|
||||
the root Kryon repository and then brought into Inbe by updating
|
||||
`vendor/kryon`.
|
||||
|
||||
Native binaries are written to `build/bin/<platform>/`, for example
|
||||
`build/bin/freebsd/inbe-freebsd-x86_64` on FreeBSD.
|
||||
|
||||
Install into the system prefix:
|
||||
|
||||
```bash
|
||||
make install
|
||||
```
|
||||
|
||||
By default this installs the binary, desktop entry, icon, and AppStream
|
||||
metadata under `/usr/local`. Use `DESTDIR` for staged/package installs, or
|
||||
`PREFIX` to choose another install root.
|
||||
|
||||
Install for only the current user:
|
||||
|
||||
```bash
|
||||
make install-user
|
||||
```
|
||||
|
||||
This installs under `~/.local`, including the desktop entry and icon.
|
||||
|
||||
## FreeBSD Package
|
||||
|
||||
Build a native FreeBSD package from inside the repo:
|
||||
|
||||
```bash
|
||||
gmake package-freebsd
|
||||
```
|
||||
|
||||
The package is written to `build/dist/freebsd/`, for example:
|
||||
|
||||
```bash
|
||||
build/dist/freebsd/inbe-1.8.3-freebsd-x86_64.pkg
|
||||
```
|
||||
|
||||
Install it with FreeBSD `pkg`:
|
||||
|
||||
```bash
|
||||
sudo pkg install -y ./build/dist/freebsd/inbe-1.8.3-freebsd-x86_64.pkg
|
||||
```
|
||||
|
||||
The package installs the `inbe` command plus desktop integration for menus such
|
||||
as Xfce: `Inner Breeze` appears from the `.desktop` file, uses the bundled icon,
|
||||
and includes AppStream metadata.
|
||||
|
||||
## Other Targets
|
||||
|
||||
General:
|
||||
|
||||
```bash
|
||||
make test
|
||||
make dist
|
||||
make clean
|
||||
```
|
||||
|
||||
Native desktop:
|
||||
|
||||
```bash
|
||||
make native
|
||||
make run
|
||||
make install-user
|
||||
make uninstall
|
||||
```
|
||||
|
||||
FreeBSD:
|
||||
|
||||
```bash
|
||||
gmake package-freebsd
|
||||
```
|
||||
|
||||
Android:
|
||||
|
||||
```bash
|
||||
make android-debug
|
||||
make android-release
|
||||
make android-bundle
|
||||
```
|
||||
|
||||
Web:
|
||||
|
||||
```bash
|
||||
make web
|
||||
make site
|
||||
make chrome-web-store
|
||||
make firefox-addons
|
||||
```
|
||||
|
||||
Firefox add-on source-review build:
|
||||
|
||||
```bash
|
||||
sh scripts/build-firefox-addons-source.sh
|
||||
```
|
||||
|
||||
The Firefox reviewer build script creates `build/dist/inbe-firefox-addons.zip`
|
||||
and runs Mozilla `addons-linter`. Environment requirements and step-by-step
|
||||
reviewer notes are documented in `packaging/firefox-addons/README.md`.
|
||||
|
||||
Firefox source upload zip:
|
||||
|
||||
```bash
|
||||
make firefox-addons-source-zip
|
||||
```
|
||||
|
||||
This creates `build/dist/inbe-firefox-addons-source.zip`.
|
||||
|
||||
Linux:
|
||||
|
||||
```bash
|
||||
make appimage
|
||||
```
|
||||
|
||||
Ubuntu Touch:
|
||||
|
||||
```bash
|
||||
make click
|
||||
```
|
||||
|
||||
Windows:
|
||||
|
||||
```bash
|
||||
make windows
|
||||
```
|
||||
|
||||
Common outputs:
|
||||
|
||||
- `make native` builds `build/bin/<platform>/inbe-<platform>-<arch>`.
|
||||
- `make appimage` builds a Linux AppImage under `build/dist/linux/`.
|
||||
- `make web` builds and smoke-tests the web app, then writes `build/dist/inbe-web.zip`.
|
||||
- `make windows` builds 64-bit and 32-bit Windows binaries and writes a zip under `build/dist/windows/`.
|
||||
- `make click` builds the Ubuntu Touch Click package under `build/dist/click/`.
|
||||
- `make dist` builds release artifacts; Android release targets require `PASSWORD`.
|
||||
|
||||
## Android
|
||||
|
||||
Build a debug APK:
|
||||
|
||||
```bash
|
||||
make android-debug
|
||||
```
|
||||
|
||||
Create and launch an Android 17/API 37.1 AVD for Pixel storage testing:
|
||||
|
||||
```bash
|
||||
ANDROID_API=37.1 bash scripts/create-avd.sh inbe-android-37-1
|
||||
AVD_NAME=inbe-android-37-1 bash scripts/emulator.sh
|
||||
```
|
||||
|
||||
Android 17 system images are listed by Google as `android-37.0`,
|
||||
`android-37.1`, and `android-CinnamonBun`. The repo AVD script supports the
|
||||
16 KB page-size image types such as `google_apis_playstore_ps16k`.
|
||||
|
||||
Native Android storage must use the app's private internal data directory from
|
||||
`ANativeActivity->internalDataPath`, not the process working directory. Inbe's
|
||||
SQLite database lives under that app-private root and is removed when the app is
|
||||
uninstalled.
|
||||
|
||||
## Project Layout
|
||||
|
||||
- `src/` - app code
|
||||
@@ -206,11 +91,6 @@ uninstalled.
|
||||
- `site/` - website
|
||||
- `vendor/kryon/` - Kryon UI/runtime submodule
|
||||
|
||||
## Notes
|
||||
|
||||
Inbe stores app data locally in SQLite. Optional sync can mirror user-owned
|
||||
data through a Ksync-compatible sync server.
|
||||
|
||||
## Support
|
||||
|
||||
Monero:
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="246" height="72" viewBox="0 0 246 72" role="img" aria-label="Get it on F-Droid">
|
||||
<rect x="1" y="1" width="244" height="70" rx="8" fill="#070707" stroke="#242424" stroke-width="2"/>
|
||||
<rect x="26" y="25" width="34" height="26" rx="5" fill="#8abf17"/>
|
||||
<rect x="32" y="16" width="22" height="13" rx="4" fill="#8abf17"/>
|
||||
<line x1="34" y1="17" x2="28" y2="9" stroke="#8abf17" stroke-width="3" stroke-linecap="round"/>
|
||||
<line x1="52" y1="17" x2="58" y2="9" stroke="#8abf17" stroke-width="3" stroke-linecap="round"/>
|
||||
<circle cx="36" cy="37" r="3" fill="#ffffff"/>
|
||||
<circle cx="50" cy="37" r="3" fill="#ffffff"/>
|
||||
<rect x="32" y="51" width="8" height="6" rx="2" fill="#8abf17"/>
|
||||
<rect x="46" y="51" width="8" height="6" rx="2" fill="#8abf17"/>
|
||||
<text x="78" y="28" fill="#f7f7f7" font-family="Arial, Helvetica, sans-serif" font-size="12" font-weight="700" letter-spacing=".5">GET IT ON</text>
|
||||
<text x="78" y="51" fill="#ffffff" font-family="Arial, Helvetica, sans-serif" font-size="28" font-weight="700">F-Droid</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,9 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="246" height="72" viewBox="0 0 246 72" role="img" aria-label="Get it on Google Play">
|
||||
<rect x="1" y="1" width="244" height="70" rx="8" fill="#070707" stroke="#242424" stroke-width="2"/>
|
||||
<path d="M30 18 L30 54 L58 36 Z" fill="#34a853"/>
|
||||
<path d="M30 18 L45 36 L30 54 Z" fill="#4285f4"/>
|
||||
<path d="M45 36 L58 36 L50 27 Z" fill="#fbbc04"/>
|
||||
<path d="M45 36 L58 36 L50 45 Z" fill="#ea4335"/>
|
||||
<text x="78" y="28" fill="#f7f7f7" font-family="Arial, Helvetica, sans-serif" font-size="12" font-weight="700" letter-spacing=".5">GET IT ON</text>
|
||||
<text x="78" y="51" fill="#ffffff" font-family="Arial, Helvetica, sans-serif" font-size="25" font-weight="700">Google Play</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 731 B |
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
+27
-3
@@ -3,6 +3,16 @@ plugins {
|
||||
id 'org.jetbrains.kotlin.android'
|
||||
}
|
||||
|
||||
def hasGplayFirebaseConfig = file("src/gplay/google-services.json").exists()
|
||||
if (hasGplayFirebaseConfig) {
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
tasks.configureEach { task ->
|
||||
if (task.name.startsWith("processFdroid") && task.name.endsWith("GoogleServices")) {
|
||||
task.enabled = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
namespace 'xyz.waozi.inbe'
|
||||
compileSdk 36
|
||||
@@ -37,10 +47,11 @@ android {
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
applicationId "xyz.waozi.inbe"
|
||||
minSdk 21
|
||||
targetSdk 36
|
||||
versionCode 117
|
||||
versionName "1.9.15"
|
||||
versionCode 118
|
||||
versionName "1.9.16"
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
if (System.getProperty('os.name').toLowerCase().contains('freebsd')) {
|
||||
@@ -50,6 +61,17 @@ android {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flavorDimensions "channel"
|
||||
productFlavors {
|
||||
fdroid {
|
||||
dimension "channel"
|
||||
}
|
||||
gplay {
|
||||
dimension "channel"
|
||||
minSdk 23
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
buildTypes {
|
||||
@@ -98,6 +120,8 @@ gradle.taskGraph.whenReady { taskGraph ->
|
||||
|
||||
dependencies {
|
||||
implementation 'androidx.core:core:1.12.0'
|
||||
implementation 'org.unifiedpush.android:connector:3.3.3-rc1'
|
||||
implementation 'androidx.health.connect:connect-client:1.1.0'
|
||||
fdroidImplementation 'org.unifiedpush.android:connector:3.3.3-rc1'
|
||||
gplayImplementation platform('com.google.firebase:firebase-bom:34.18.0')
|
||||
gplayImplementation 'com.google.firebase:firebase-messaging'
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<application>
|
||||
<service
|
||||
android:name="xyz.waozi.inbe.PushServiceImpl"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="org.unifiedpush.android.connector.PUSH_EVENT" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,91 @@
|
||||
package xyz.waozi.inbe;
|
||||
|
||||
import android.widget.Toast;
|
||||
import org.json.JSONObject;
|
||||
|
||||
final class PaymentBridge {
|
||||
private static final String KSYNC_BASE_URL = "https://api.waozi.xyz";
|
||||
|
||||
private PaymentBridge() {}
|
||||
|
||||
static String channel() {
|
||||
return "monero";
|
||||
}
|
||||
|
||||
static void purchaseTokens(final MainActivity activity, final String productId,
|
||||
final String accountId, final String authToken) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
String body = "{\"app_id\":\"inbe\",\"product_id\":\"" + jsonEscape(productId) + "\"}";
|
||||
String response = SyncNetwork.httpRequest("INBE_PAYMENTS", "POST",
|
||||
KSYNC_BASE_URL + "/api/v1/tokens/purchases/monero/invoices",
|
||||
body, authHeaders(authToken));
|
||||
final Invoice invoice = parseInvoice(response);
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (invoice.ok) {
|
||||
Toast.makeText(activity,
|
||||
"Send " + invoice.atomicAmount + " atomic XMR to " + invoice.address,
|
||||
Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
Toast.makeText(activity, invoice.message, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
showToast(activity, "Monero invoice failed");
|
||||
}
|
||||
}
|
||||
}, "inbe-monero-token-invoice").start();
|
||||
}
|
||||
|
||||
private static String[] authHeaders(String authToken) {
|
||||
return new String[] {
|
||||
"Content-Type: application/json",
|
||||
"Authorization: Bearer " + (authToken != null ? authToken : "")
|
||||
};
|
||||
}
|
||||
|
||||
private static Invoice parseInvoice(String response) throws Exception {
|
||||
int newline = response.indexOf('\n');
|
||||
int status = newline > 0 ? Integer.parseInt(response.substring(0, newline).trim()) : 0;
|
||||
String body = newline >= 0 ? response.substring(newline + 1) : "";
|
||||
if (status < 200 || status >= 300) {
|
||||
return new Invoice(false, "Monero invoice unavailable", "", 0);
|
||||
}
|
||||
JSONObject json = new JSONObject(body);
|
||||
return new Invoice(true, "", json.optString("address", ""),
|
||||
json.optLong("atomic_amount", 0));
|
||||
}
|
||||
|
||||
private static void showToast(final MainActivity activity, final String message) {
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(activity, message, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static String jsonEscape(String value) {
|
||||
if (value == null) return "";
|
||||
return value.replace("\\", "\\\\").replace("\"", "\\\"");
|
||||
}
|
||||
|
||||
private static final class Invoice {
|
||||
final boolean ok;
|
||||
final String message;
|
||||
final String address;
|
||||
final long atomicAmount;
|
||||
|
||||
Invoice(boolean ok, String message, String address, long atomicAmount) {
|
||||
this.ok = ok;
|
||||
this.message = message;
|
||||
this.address = address;
|
||||
this.atomicAmount = atomicAmount;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package xyz.waozi.inbe;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.widget.Toast;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.unifiedpush.android.connector.UnifiedPush;
|
||||
|
||||
final class PushBridge {
|
||||
private PushBridge() {}
|
||||
|
||||
static boolean isRegistered(MainActivity activity) {
|
||||
return PushServiceImpl.getEndpoint(activity) != null;
|
||||
}
|
||||
|
||||
static String[] getDistributors(MainActivity activity) {
|
||||
List<String> distributors = UnifiedPush.getDistributors(activity);
|
||||
return distributors.toArray(new String[0]);
|
||||
}
|
||||
|
||||
static String[] getDistributorLabels(MainActivity activity) {
|
||||
PackageManager pm = activity.getPackageManager();
|
||||
List<String> labels = new ArrayList<>();
|
||||
for (String pkg : UnifiedPush.getDistributors(activity)) {
|
||||
try {
|
||||
labels.add(pm.getApplicationLabel(pm.getApplicationInfo(pkg, 0)).toString());
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
labels.add(pkg);
|
||||
}
|
||||
}
|
||||
return labels.toArray(new String[0]);
|
||||
}
|
||||
|
||||
static String[] getDistributorIcons(MainActivity activity) {
|
||||
PackageManager pm = activity.getPackageManager();
|
||||
File dir = new File(activity.getCacheDir(), "push-icons");
|
||||
if (!dir.exists()) {
|
||||
dir.mkdirs();
|
||||
}
|
||||
List<String> paths = new ArrayList<>();
|
||||
List<String> distributors = UnifiedPush.getDistributors(activity);
|
||||
for (int i = 0; i < distributors.size(); i++) {
|
||||
File out = new File(dir, "icon_" + i + ".png");
|
||||
try {
|
||||
Drawable drawable = pm.getApplicationIcon(distributors.get(i));
|
||||
Bitmap bmp = Bitmap.createBitmap(96, 96, Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(bmp);
|
||||
drawable.setBounds(0, 0, 96, 96);
|
||||
drawable.draw(canvas);
|
||||
FileOutputStream fos = new FileOutputStream(out);
|
||||
bmp.compress(Bitmap.CompressFormat.PNG, 100, fos);
|
||||
fos.close();
|
||||
paths.add(out.getAbsolutePath());
|
||||
} catch (Exception e) {
|
||||
paths.add("");
|
||||
}
|
||||
}
|
||||
return paths.toArray(new String[0]);
|
||||
}
|
||||
|
||||
static void configureWith(final MainActivity activity, final String pkg) {
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
UnifiedPush.saveDistributor(activity, pkg);
|
||||
UnifiedPush.register(activity, "inbe", "Inner Breeze", null);
|
||||
Toast.makeText(activity, "Push: registering with " + pkg, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void configure(final MainActivity activity) {
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!UnifiedPush.getDistributors(activity).isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Toast.makeText(activity, "Install a UnifiedPush distributor (e.g. Sunup)", Toast.LENGTH_LONG).show();
|
||||
try {
|
||||
activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(
|
||||
"https://f-droid.org/en/packages/org.unifiedpush.distributor.sunup/")));
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
+7
-30
@@ -5,29 +5,15 @@ import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
import org.unifiedpush.android.connector.FailedReason;
|
||||
import org.unifiedpush.android.connector.PushService;
|
||||
import org.unifiedpush.android.connector.data.PublicKeySet;
|
||||
import org.unifiedpush.android.connector.data.PushEndpoint;
|
||||
import org.unifiedpush.android.connector.data.PushMessage;
|
||||
import org.unifiedpush.android.connector.data.PublicKeySet;
|
||||
|
||||
/**
|
||||
* UnifiedPush message entry point (unifiedpush.org, spec AND_3.1.0).
|
||||
*
|
||||
* The user installs any distributor -- Sunup from F-Droid
|
||||
* (org.unifiedpush.distributor.sunup), ntfy, NextPush, ... -- and this app
|
||||
* receives pushes without Google services. The distributor starts this
|
||||
* service directly, so it works while the native app is not running.
|
||||
*
|
||||
* Message protocol (v1): the pushed bytes are UTF-8 text; the first line is
|
||||
* the notification title, the rest is the body. Cleartext only -- keep
|
||||
* payloads under the ~3993-byte spec limit; encryption is a follow-up.
|
||||
*/
|
||||
public class PushServiceImpl extends PushService {
|
||||
private static final String TAG = "INBE_PUSH";
|
||||
private static final String PREFS = "inbe_push";
|
||||
@@ -53,15 +39,10 @@ public class PushServiceImpl extends PushService {
|
||||
@Override
|
||||
public void onNewEndpoint(PushEndpoint endpoint, String instance) {
|
||||
Log.d(TAG, "new endpoint (temporary=" + endpoint.getTemporary() + ")");
|
||||
SharedPreferences.Editor e = prefs().edit()
|
||||
.putString(PREF_ENDPOINT, endpoint.getUrl());
|
||||
// Encrypted distributors (Sunup/Mozilla) require RFC8291 aes128gcm
|
||||
// payloads: the sender encrypts with these keys, and the connector
|
||||
// decrypts on receipt. Stored so the sync server can use them.
|
||||
SharedPreferences.Editor e = prefs().edit().putString(PREF_ENDPOINT, endpoint.getUrl());
|
||||
PublicKeySet keys = endpoint.getPubKeySet();
|
||||
if (keys != null) {
|
||||
e.putString(PREF_AUTH, keys.getAuth())
|
||||
.putString(PREF_P256DH, keys.getPubKey());
|
||||
e.putString(PREF_AUTH, keys.getAuth()).putString(PREF_P256DH, keys.getPubKey());
|
||||
} else {
|
||||
e.remove(PREF_AUTH).remove(PREF_P256DH);
|
||||
}
|
||||
@@ -80,8 +61,7 @@ public class PushServiceImpl extends PushService {
|
||||
}
|
||||
|
||||
public static String getEndpoint(Context context) {
|
||||
return context.getSharedPreferences(PREFS, Context.MODE_PRIVATE)
|
||||
.getString(PREF_ENDPOINT, null);
|
||||
return context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).getString(PREF_ENDPOINT, null);
|
||||
}
|
||||
|
||||
private SharedPreferences prefs() {
|
||||
@@ -90,12 +70,9 @@ public class PushServiceImpl extends PushService {
|
||||
|
||||
private void showNotification(String title, String body) {
|
||||
NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
if (nm == null)
|
||||
return;
|
||||
if (Build.VERSION.SDK_INT >= 26 &&
|
||||
nm.getNotificationChannel(CHANNEL_ID) == null) {
|
||||
nm.createNotificationChannel(new NotificationChannel(CHANNEL_ID,
|
||||
"Push messages", NotificationManager.IMPORTANCE_DEFAULT));
|
||||
if (nm == null) return;
|
||||
if (Build.VERSION.SDK_INT >= 26 && nm.getNotificationChannel(CHANNEL_ID) == null) {
|
||||
nm.createNotificationChannel(new NotificationChannel(CHANNEL_ID, "Push messages", NotificationManager.IMPORTANCE_DEFAULT));
|
||||
}
|
||||
PendingIntent pi = PendingIntent.getActivity(this, 0,
|
||||
getPackageManager().getLaunchIntentForPackage(getPackageName()),
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<application>
|
||||
<service
|
||||
android:name="xyz.waozi.inbe.FcmPushService"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,19 @@
|
||||
package xyz.waozi.inbe;
|
||||
|
||||
import android.util.Log;
|
||||
import com.google.firebase.messaging.FirebaseMessagingService;
|
||||
import com.google.firebase.messaging.RemoteMessage;
|
||||
|
||||
public class FcmPushService extends FirebaseMessagingService {
|
||||
private static final String TAG = "INBE_FCM";
|
||||
|
||||
@Override
|
||||
public void onNewToken(String token) {
|
||||
Log.d(TAG, "new FCM token");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageReceived(RemoteMessage message) {
|
||||
Log.d(TAG, "FCM message received");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package xyz.waozi.inbe;
|
||||
|
||||
import android.widget.Toast;
|
||||
|
||||
final class PaymentBridge {
|
||||
private PaymentBridge() {}
|
||||
|
||||
static String channel() {
|
||||
return "disabled";
|
||||
}
|
||||
|
||||
static void purchaseTokens(final MainActivity activity, final String productId,
|
||||
final String accountId, final String authToken) {
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(activity, "Token purchases are not available in this build.", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package xyz.waozi.inbe;
|
||||
|
||||
import android.widget.Toast;
|
||||
import com.google.firebase.messaging.FirebaseMessaging;
|
||||
|
||||
final class PushBridge {
|
||||
private static String lastToken;
|
||||
|
||||
private PushBridge() {}
|
||||
|
||||
static boolean isRegistered(MainActivity activity) {
|
||||
return lastToken != null && !lastToken.isEmpty();
|
||||
}
|
||||
|
||||
static String[] getDistributors(MainActivity activity) {
|
||||
return new String[] {"fcm"};
|
||||
}
|
||||
|
||||
static String[] getDistributorLabels(MainActivity activity) {
|
||||
return new String[] {"Google notifications"};
|
||||
}
|
||||
|
||||
static String[] getDistributorIcons(MainActivity activity) {
|
||||
return new String[] {""};
|
||||
}
|
||||
|
||||
static void configureWith(MainActivity activity, String pkg) {
|
||||
configure(activity);
|
||||
}
|
||||
|
||||
static void configure(final MainActivity activity) {
|
||||
try {
|
||||
FirebaseMessaging.getInstance().getToken()
|
||||
.addOnSuccessListener(token -> {
|
||||
lastToken = token;
|
||||
Toast.makeText(activity, "Google notifications enabled", Toast.LENGTH_SHORT).show();
|
||||
})
|
||||
.addOnFailureListener(error ->
|
||||
Toast.makeText(activity, "Google notifications unavailable", Toast.LENGTH_LONG).show());
|
||||
} catch (IllegalStateException e) {
|
||||
Toast.makeText(activity, "Google notifications unavailable", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -95,12 +95,5 @@
|
||||
android:name="xyz.waozi.inbe.SessionForegroundService"
|
||||
android:exported="false"
|
||||
android:foregroundServiceType="mediaPlayback" />
|
||||
<service
|
||||
android:name="xyz.waozi.inbe.PushServiceImpl"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="org.unifiedpush.android.connector.PUSH_EVENT" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -12,19 +12,12 @@ import android.content.pm.PackageManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Insets;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.widget.Toast;
|
||||
import android.app.AlertDialog;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.unifiedpush.android.connector.UnifiedPush;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
@@ -41,8 +34,6 @@ import android.view.WindowInsetsController;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import androidx.core.view.WindowCompat;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
@@ -657,96 +648,38 @@ public class MainActivity extends NativeActivity {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from native settings: set up UnifiedPush. With no distributor
|
||||
* installed, offer Sunup on F-Droid; with several, let the user pick.
|
||||
*/
|
||||
public boolean isUnifiedPushRegistered() {
|
||||
return PushServiceImpl.getEndpoint(this) != null;
|
||||
return PushBridge.isRegistered(this);
|
||||
}
|
||||
|
||||
public String[] getUnifiedPushDistributors() {
|
||||
final List<String> distributors = UnifiedPush.getDistributors(this);
|
||||
return distributors.toArray(new String[0]);
|
||||
return PushBridge.getDistributors(this);
|
||||
}
|
||||
|
||||
public String[] getUnifiedPushDistributorLabels() {
|
||||
PackageManager pm = getPackageManager();
|
||||
List<String> labels = new ArrayList<>();
|
||||
for (String pkg : UnifiedPush.getDistributors(this)) {
|
||||
try {
|
||||
labels.add(pm.getApplicationLabel(
|
||||
pm.getApplicationInfo(pkg, 0)).toString());
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
labels.add(pkg);
|
||||
}
|
||||
}
|
||||
return labels.toArray(new String[0]);
|
||||
return PushBridge.getDistributorLabels(this);
|
||||
}
|
||||
|
||||
public String[] getUnifiedPushDistributorIcons() {
|
||||
PackageManager pm = getPackageManager();
|
||||
File dir = new File(getCacheDir(), "push-icons");
|
||||
if (!dir.exists()) {
|
||||
dir.mkdirs();
|
||||
}
|
||||
List<String> paths = new ArrayList<>();
|
||||
List<String> distributors = UnifiedPush.getDistributors(this);
|
||||
for (int i = 0; i < distributors.size(); i++) {
|
||||
File out = new File(dir, "icon_" + i + ".png");
|
||||
try {
|
||||
Drawable drawable = pm.getApplicationIcon(distributors.get(i));
|
||||
Bitmap bmp = Bitmap.createBitmap(96, 96, Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(bmp);
|
||||
drawable.setBounds(0, 0, 96, 96);
|
||||
drawable.draw(canvas);
|
||||
FileOutputStream fos = new FileOutputStream(out);
|
||||
bmp.compress(Bitmap.CompressFormat.PNG, 100, fos);
|
||||
fos.close();
|
||||
paths.add(out.getAbsolutePath());
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "icon export failed for " + distributors.get(i), e);
|
||||
paths.add("");
|
||||
}
|
||||
}
|
||||
return paths.toArray(new String[0]);
|
||||
return PushBridge.getDistributorIcons(this);
|
||||
}
|
||||
|
||||
public void configureUnifiedPushWith(final String pkg) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
requestNotificationPermissionIfNeeded();
|
||||
UnifiedPush.saveDistributor(MainActivity.this, pkg);
|
||||
UnifiedPush.register(MainActivity.this, "inbe", "Inner Breeze", null);
|
||||
Toast.makeText(MainActivity.this,
|
||||
"Push: registering with " + pkg,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
requestNotificationPermissionIfNeeded();
|
||||
PushBridge.configureWith(this, pkg);
|
||||
}
|
||||
|
||||
public void configureUnifiedPush() {
|
||||
// Called via JNI from the native render thread; toasts, dialogs and
|
||||
// permission requests need the UI thread's Looper. Only reached when
|
||||
// no distributor is installed at all.
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!UnifiedPush.getDistributors(MainActivity.this).isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Toast.makeText(MainActivity.this,
|
||||
"Install a UnifiedPush distributor (e.g. Sunup)",
|
||||
Toast.LENGTH_LONG).show();
|
||||
try {
|
||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(
|
||||
"https://f-droid.org/en/packages/org.unifiedpush.distributor.sunup/")));
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "no activity to open F-Droid");
|
||||
}
|
||||
}
|
||||
});
|
||||
requestNotificationPermissionIfNeeded();
|
||||
PushBridge.configure(this);
|
||||
}
|
||||
|
||||
public String paymentChannel() {
|
||||
return PaymentBridge.channel();
|
||||
}
|
||||
|
||||
public void purchaseTokens(final String productId, final String accountId, final String authToken) {
|
||||
PaymentBridge.purchaseTokens(this, productId, accountId, authToken);
|
||||
}
|
||||
|
||||
public void acquireWakeLock() {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
plugins {
|
||||
id 'com.android.application' version '8.9.1' apply false
|
||||
id 'org.jetbrains.kotlin.android' version '2.3.0' apply false
|
||||
id 'com.google.gms.google-services' version '4.5.0' apply false
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
Fixed
|
||||
---
|
||||
- Fixed web sync key import stability in Firefox.
|
||||
@@ -1,5 +1,5 @@
|
||||
Package: inbe.waozi
|
||||
Version: 1.9.15
|
||||
Version: 1.9.16
|
||||
Architecture: arm64
|
||||
Maintainer: Waozi <[email protected]>
|
||||
Click-Version: 0.4
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<binary>inbe</binary>
|
||||
</provides>
|
||||
<releases>
|
||||
<release version="1.9.15" date="2026-08-29"/>
|
||||
<release version="1.9.16" date="2026-08-29"/>
|
||||
</releases>
|
||||
<content_rating type="oars-1.1"/>
|
||||
</component>
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "inbe",
|
||||
"title": "Inner Breeze",
|
||||
"version": "1.9.15",
|
||||
"version": "1.9.16",
|
||||
"architecture": "arm64",
|
||||
"framework": "ubuntu-sdk-20.04",
|
||||
"description": "Syncable breathing, meditation, and habit practice app.",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"manifest_version": 3,
|
||||
"name": "Inner Breeze",
|
||||
"short_name": "Inbe",
|
||||
"version": "1.9.15",
|
||||
"version": "1.9.16",
|
||||
"description": "Breathing, meditation, habit tracking, and encrypted sync.",
|
||||
"permissions": [
|
||||
"contextMenus"
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<binary>inbe</binary>
|
||||
</provides>
|
||||
<releases>
|
||||
<release version="1.9.15" date="2026-08-29"/>
|
||||
<release version="1.9.16" date="2026-08-29"/>
|
||||
</releases>
|
||||
<content_rating type="oars-1.1"/>
|
||||
</component>
|
||||
@@ -22,7 +22,7 @@
|
||||
<binary>inbe</binary>
|
||||
</provides>
|
||||
<releases>
|
||||
<release version="1.9.15" date="2026-08-29"/>
|
||||
<release version="1.9.16" date="2026-08-29"/>
|
||||
</releases>
|
||||
<content_rating type="oars-1.1"/>
|
||||
</component>
|
||||
@@ -43,15 +43,24 @@ ABI=$(adb_run shell getprop ro.product.cpu.abi 2>&1 | tr -d '\r' | head -n 1) ||
|
||||
}
|
||||
[ -n "$ABI" ] || fail "device ABI is empty."
|
||||
|
||||
APK="$APK_DIR/app-$ABI-$VARIANT.apk"
|
||||
APK=""
|
||||
for candidate in \
|
||||
"$APK_DIR"/*/"$VARIANT"/app-*-"$ABI"-"$VARIANT".apk \
|
||||
"$APK_DIR"/app-*-"$ABI"-"$VARIANT".apk \
|
||||
"$APK_DIR"/*/"$VARIANT"/app-"$ABI"-"$VARIANT".apk \
|
||||
"$APK_DIR"/app-"$ABI"-"$VARIANT".apk \
|
||||
"$APK_DIR"/*/"$VARIANT"/app-*-"$VARIANT".apk \
|
||||
"$APK_DIR"/app-"$VARIANT".apk; do
|
||||
if [ -f "$candidate" ]; then
|
||||
APK=$candidate
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ ! -f "$APK" ]; then
|
||||
APK="$APK_DIR/app-$VARIANT.apk"
|
||||
fi
|
||||
if [ ! -f "$APK" ]; then
|
||||
echo "Expected ABI APK: $APK_DIR/app-$ABI-$VARIANT.apk" >&2
|
||||
echo "Expected fallback: $APK_DIR/app-$VARIANT.apk" >&2
|
||||
echo "Expected ABI APK below: $APK_DIR/*/$VARIANT/app-*-$ABI-$VARIANT.apk" >&2
|
||||
echo "Expected fallback below: $APK_DIR/*/$VARIANT/app-*-$VARIANT.apk" >&2
|
||||
echo "Available APKs:" >&2
|
||||
ls -1 "$APK_DIR"/*.apk >&2 2>/dev/null || true
|
||||
find "$APK_DIR" -type f -name '*.apk' -print >&2 2>/dev/null || true
|
||||
fail "no installable $VARIANT APK for device ABI '$ABI'."
|
||||
fi
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 191 KiB |
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"slug": "inner-breeze",
|
||||
"name": "Inner Breeze",
|
||||
"summary": "Breathing, meditation, and habit practice flows across mobile and web.",
|
||||
"repository": {
|
||||
"platform": "github",
|
||||
"url": "https://github.com/waozixyz/inbe",
|
||||
"owner": "waozixyz",
|
||||
"name": "inbe"
|
||||
},
|
||||
"homepage": "https://inbe.waozi.xyz",
|
||||
"banner": "showcase/banner.png",
|
||||
"tags": ["wellness", "habits", "mobile", "web"],
|
||||
"featured": true
|
||||
}
|
||||
@@ -30,8 +30,6 @@ EM_JS(void, inbe_web_extension_break_now_js, (int break_type), {
|
||||
});
|
||||
|
||||
static KsyncAccount web_test_source_account;
|
||||
static KsyncAccount web_test_imported_account;
|
||||
static char web_test_account_body[KSYNC_ACCOUNT_EXPORT_TEXT_SIZE];
|
||||
static uint8_t web_test_public_key[1312];
|
||||
static uint8_t web_test_private_key[2560];
|
||||
static int web_test_sync_key_import_status;
|
||||
@@ -485,26 +483,17 @@ int
|
||||
app_web_test_sync_key_state(void)
|
||||
{
|
||||
KsyncAccount *source = &web_test_source_account;
|
||||
const char *value;
|
||||
|
||||
data_init();
|
||||
if(web_test_sync_key_import_status != 1)
|
||||
return web_test_sync_key_import_status;
|
||||
if(!HasKsyncAccountValues(source))
|
||||
return -10;
|
||||
value = storage_get_setting_text("sync_public_id");
|
||||
if(value == NULL)
|
||||
return -11;
|
||||
if(strcmp(source->public_id, value) != 0)
|
||||
if(!storage_setting_text_equals("sync_public_id", source->public_id))
|
||||
return -12;
|
||||
value = storage_get_setting_text("sync_public_key");
|
||||
if(value == NULL)
|
||||
return -13;
|
||||
if(strcmp(source->public_key_hex, value) != 0)
|
||||
if(!storage_setting_text_equals("sync_public_key", source->public_key_hex))
|
||||
return -14;
|
||||
value = storage_get_setting_text("sync_private_key");
|
||||
if(value == NULL)
|
||||
return -15;
|
||||
if(strcmp(source->private_key_hex, value) != 0)
|
||||
if(!storage_setting_text_equals("sync_private_key", source->private_key_hex))
|
||||
return -16;
|
||||
return 1;
|
||||
}
|
||||
@@ -514,31 +503,19 @@ void
|
||||
app_web_test_import_sync_key(void)
|
||||
{
|
||||
KsyncAccount *source = &web_test_source_account;
|
||||
KsyncAccount *imported = &web_test_imported_account;
|
||||
char *body = web_test_account_body;
|
||||
|
||||
web_test_sync_key_import_status = 0;
|
||||
data_init();
|
||||
memset(imported, 0, sizeof(*imported));
|
||||
memset(body, 0, sizeof(web_test_account_body));
|
||||
|
||||
web_test_make_sync_account(source);
|
||||
if(!HasKsyncAccountValues(source)) {
|
||||
web_test_sync_key_import_status = -1;
|
||||
return;
|
||||
}
|
||||
if(!ExportKsyncAccountText(source, body, sizeof(web_test_account_body))) {
|
||||
web_test_sync_key_import_status = -2;
|
||||
return;
|
||||
}
|
||||
if(!ParseKsyncAccountText(body, imported)) {
|
||||
web_test_sync_key_import_status = -3;
|
||||
return;
|
||||
}
|
||||
storage_settings_begin_write();
|
||||
storage_set_setting_text("sync_public_id", imported->public_id);
|
||||
storage_set_setting_text("sync_public_key", imported->public_key_hex);
|
||||
storage_set_setting_text("sync_private_key", imported->private_key_hex);
|
||||
storage_set_setting_text("sync_public_id", source->public_id);
|
||||
storage_set_setting_text("sync_public_key", source->public_key_hex);
|
||||
storage_set_setting_text("sync_private_key", source->private_key_hex);
|
||||
storage_set_setting_text("sync_account_alias", "");
|
||||
storage_set_sync_server_connected(0);
|
||||
storage_settings_end_write();
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
|
||||
#define INBE_VERSION_MAJOR 1
|
||||
#define INBE_VERSION_MINOR 9
|
||||
#define INBE_VERSION_PATCH 15
|
||||
#define INBE_VERSION_STRING "1.9.15"
|
||||
#define INBE_VERSION_PATCH 16
|
||||
#define INBE_VERSION_STRING "1.9.16"
|
||||
|
||||
#endif
|
||||
+25
-1
@@ -567,6 +567,26 @@ storage_get_setting_text(const char *key)
|
||||
return g_storage.text_value[0] != '\0' ? g_storage.text_value : NULL;
|
||||
}
|
||||
|
||||
int
|
||||
storage_setting_text_equals(const char *key, const char *value)
|
||||
{
|
||||
sqlite3_stmt *stmt = NULL;
|
||||
int ok = 0;
|
||||
|
||||
if(g_storage.db == NULL || key == NULL || value == NULL)
|
||||
return 0;
|
||||
if(sqlite3_prepare_v2(g_storage.db,
|
||||
"SELECT 1 FROM settings WHERE user_id=?1 AND key=?2 AND value=?3",
|
||||
-1, &stmt, NULL) != SQLITE_OK)
|
||||
return 0;
|
||||
bind_text(stmt, 1, g_storage.user_id);
|
||||
bind_text(stmt, 2, key);
|
||||
bind_text(stmt, 3, value);
|
||||
ok = sqlite3_step(stmt) == SQLITE_ROW;
|
||||
sqlite3_finalize(stmt);
|
||||
return ok;
|
||||
}
|
||||
|
||||
int
|
||||
storage_list_settings(void (*callback)(const char *key, const char *value, void *user),
|
||||
void *user)
|
||||
@@ -1212,8 +1232,12 @@ storage_build_sync_payload_json(const char *user_id_hash, const char *public_key
|
||||
json.ok = 1;
|
||||
json_append(&json, "{");
|
||||
json_appendf(&json, "\"protocol_version\":%d,", INBE_SYNC_PROTOCOL_VERSION);
|
||||
json_append(&json, "\"app_id\":\"inbe\",");
|
||||
json_append(&json, "\"client_capabilities\":[\"v4-encrypted-records\","
|
||||
"\"v4-dual-write-transition\"],");
|
||||
"\"v4-dual-write-transition\","
|
||||
"\"v5-dual-read\","
|
||||
"\"v5-legacy-encrypted-collections\"],");
|
||||
json_append(&json, "\"include_legacy_data\":true,");
|
||||
json_append_key_string(&json, "user_id_hash", user_id_hash);
|
||||
json_append(&json, ",");
|
||||
json_append_key_string(&json, "client_id", storage_sync_client_id());
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
enum {
|
||||
INBE_STORAGE_PATH_SIZE = 512,
|
||||
INBE_STORAGE_ID_SIZE = 64,
|
||||
INBE_SYNC_PROTOCOL_VERSION = 4
|
||||
INBE_SYNC_PROTOCOL_VERSION = 5
|
||||
};
|
||||
|
||||
typedef struct InbeStorageSessionCheckin {
|
||||
@@ -74,6 +74,7 @@ const char *storage_db_path(void);
|
||||
int storage_get_setting_int(const char *key, int fallback);
|
||||
int storage_list_settings(void (*callback)(const char *key, const char *value, void *user), void *user);
|
||||
const char *storage_get_setting_text(const char *key);
|
||||
int storage_setting_text_equals(const char *key, const char *value);
|
||||
void storage_set_setting_int(const char *key, int value);
|
||||
void storage_set_setting_text(const char *key, const char *value);
|
||||
void storage_settings_begin_write(void);
|
||||
|
||||
+187
-4
@@ -457,11 +457,17 @@ test_sync_payload_includes_v4_encrypted_shadow_records(void)
|
||||
habits_save(&habits);
|
||||
|
||||
payload = storage_build_sync_payload_json("test-public-id", "test-public-key");
|
||||
check_true("v4 protocol in sync payload",
|
||||
payload != NULL && strstr(payload, "\"protocol_version\":4") != NULL);
|
||||
check_true("v4 client capabilities in sync payload",
|
||||
check_true("v5 protocol in sync payload",
|
||||
payload != NULL && strstr(payload, "\"protocol_version\":5") != NULL);
|
||||
check_true("inbe app id in sync payload",
|
||||
payload != NULL && strstr(payload, "\"app_id\":\"inbe\"") != NULL);
|
||||
check_true("v5 legacy data opt-in in sync payload",
|
||||
payload != NULL && strstr(payload, "\"include_legacy_data\":true") != NULL);
|
||||
check_true("v5 compatibility capabilities in sync payload",
|
||||
payload != NULL && strstr(payload, "\"client_capabilities\"") != NULL &&
|
||||
strstr(payload, "v4-encrypted-records") != NULL);
|
||||
strstr(payload, "v4-encrypted-records") != NULL &&
|
||||
strstr(payload, "v5-dual-read") != NULL &&
|
||||
strstr(payload, "v5-legacy-encrypted-collections") != NULL);
|
||||
count = storage_json_array_count_path(payload, "$.encrypted_records");
|
||||
check_true("v4 encrypted shadow records present", count > 0);
|
||||
check_true("first encrypted collection",
|
||||
@@ -545,6 +551,182 @@ test_sync_payload_includes_v4_encrypted_shadow_records(void)
|
||||
remove_tree(root);
|
||||
}
|
||||
|
||||
static void
|
||||
seed_versioned_sync_account(const char *root, int encrypted_shadow_complete)
|
||||
{
|
||||
char db_path[512];
|
||||
sqlite3 *db = NULL;
|
||||
char *err = NULL;
|
||||
const char *sql =
|
||||
"DELETE FROM sync_outbox;"
|
||||
"DELETE FROM session_rounds;"
|
||||
"DELETE FROM sessions;"
|
||||
"DELETE FROM habit_days;"
|
||||
"DELETE FROM habits;"
|
||||
"INSERT INTO habits(id,user_id,name,color_r,color_g,color_b,sync_mode,"
|
||||
"sync_activity,counter_enabled,sort_order,deleted_at,updated_at) "
|
||||
"VALUES('release-hydrate',(SELECT id FROM users LIMIT 1),'Hydrate',"
|
||||
"42,133,180,1,1,1,10,0,1781902800);"
|
||||
"INSERT INTO habit_days(habit_id,local_date,completed,count,session_count,updated_at) "
|
||||
"VALUES('release-hydrate',20260829,1,5,0,1781902800);"
|
||||
"INSERT INTO sessions(id,user_id,started_at,local_date,topic,activity,source,"
|
||||
"imported_at,rounds_hash,mood_before,mood_after,energy,stress,note,tags,"
|
||||
"deleted_at,updated_at) "
|
||||
"VALUES('release-session',(SELECT id FROM users LIMIT 1),1781902800,20260829,"
|
||||
"0,1,'release-fixture',1781902800,12345,2,4,3,1,'migrated cleanly',"
|
||||
"'morning',0,1781902920);"
|
||||
"INSERT INTO session_rounds(session_id,round_index,seconds) "
|
||||
"VALUES('release-session',0,45);"
|
||||
"INSERT OR REPLACE INTO meta(key,value) VALUES('sync_last_server_version','300');"
|
||||
"INSERT OR REPLACE INTO meta(key,value) VALUES('sync_full_upload_done','1');"
|
||||
"INSERT OR REPLACE INTO meta(key,value) VALUES('sync_backfill_v2_done','1');"
|
||||
"INSERT OR REPLACE INTO meta(key,value) VALUES('sync_last_upload_at','1781902920');";
|
||||
|
||||
make_path(db_path, sizeof(db_path), root, "inbe.db");
|
||||
check_true("open versioned sync fixture db", sqlite3_open(db_path, &db) == SQLITE_OK);
|
||||
if(db == NULL)
|
||||
return;
|
||||
check_true("seed versioned sync fixture rows",
|
||||
sqlite3_exec(db, sql, NULL, NULL, &err) == SQLITE_OK);
|
||||
if(err != NULL) {
|
||||
fprintf(stderr, "SQL error: %s\n", err);
|
||||
sqlite3_free(err);
|
||||
err = NULL;
|
||||
}
|
||||
if(encrypted_shadow_complete) {
|
||||
check_true("mark versioned v4 encrypted shadow complete",
|
||||
sqlite3_exec(db,
|
||||
"INSERT OR REPLACE INTO meta(key,value) "
|
||||
"VALUES('sync_encrypted_shadow_v4_complete_v2','1');"
|
||||
"INSERT OR REPLACE INTO meta(key,value) "
|
||||
"VALUES('sync_encrypted_shadow_v4_legacy_seen_v2','1');"
|
||||
"INSERT OR REPLACE INTO meta(key,value) "
|
||||
"VALUES('sync_encrypted_shadow_v4_queued_v2','1');",
|
||||
NULL, NULL, &err) == SQLITE_OK);
|
||||
if(err != NULL) {
|
||||
fprintf(stderr, "SQL error: %s\n", err);
|
||||
sqlite3_free(err);
|
||||
}
|
||||
} else {
|
||||
check_true("clear versioned encrypted shadow markers",
|
||||
sqlite3_exec(db,
|
||||
"DELETE FROM meta WHERE key IN ("
|
||||
"'sync_encrypted_shadow_v4_complete_v2',"
|
||||
"'sync_encrypted_shadow_v4_legacy_seen_v2',"
|
||||
"'sync_encrypted_shadow_v4_queued_v2',"
|
||||
"'sync_encrypted_shadow_v4_total_v2');",
|
||||
NULL, NULL, &err) == SQLITE_OK);
|
||||
if(err != NULL) {
|
||||
fprintf(stderr, "SQL error: %s\n", err);
|
||||
sqlite3_free(err);
|
||||
}
|
||||
}
|
||||
sqlite3_close(db);
|
||||
}
|
||||
|
||||
static void
|
||||
assert_versioned_fixture_displayed(const char *label)
|
||||
{
|
||||
InbeHabits habits;
|
||||
|
||||
memset(&habits, 0, sizeof(habits));
|
||||
check_true(label, storage_habits_load(&habits));
|
||||
check_true("versioned Hydrate habit is displayable",
|
||||
find_habit_ci(&habits, "Hydrate") != NULL);
|
||||
check_int("versioned habit count", storage_habit_count(), 1);
|
||||
check_int("versioned session count", storage_session_count(), 1);
|
||||
habits_free(&habits);
|
||||
}
|
||||
|
||||
static void
|
||||
test_sync_migration_matrix_keeps_release_data_displayable(void)
|
||||
{
|
||||
char root[512];
|
||||
char private_key[5121];
|
||||
char *payload;
|
||||
InbeStorageSyncStatus status;
|
||||
|
||||
fill_test_private_key(private_key);
|
||||
|
||||
make_clean_root(root, sizeof(root), "sync-migration-v3-fixture");
|
||||
check_true("init v3 release fixture db", storage_init(root));
|
||||
storage_set_setting_text("sync_public_id", "test-public-id");
|
||||
storage_set_setting_text("sync_public_key", "test-public-key");
|
||||
storage_set_setting_text("sync_private_key", private_key);
|
||||
storage_close();
|
||||
seed_versioned_sync_account(root, 0);
|
||||
check_true("open migrated v3 release fixture db", storage_init(root));
|
||||
assert_versioned_fixture_displayed("load migrated v3 release fixture habits");
|
||||
payload = storage_build_sync_payload_json("test-public-id", "test-public-key");
|
||||
check_true("migrated v3 payload stays on v5",
|
||||
payload != NULL && strstr(payload, "\"protocol_version\":5") != NULL);
|
||||
check_true("migrated v3 payload registers inbe",
|
||||
payload != NULL && strstr(payload, "\"app_id\":\"inbe\"") != NULL);
|
||||
check_true("migrated v3 payload queues encrypted shadow",
|
||||
storage_json_array_count_path(payload, "$.encrypted_records") > 0);
|
||||
storage_free_sync_payload_json(payload);
|
||||
storage_close();
|
||||
remove_tree(root);
|
||||
|
||||
make_clean_root(root, sizeof(root), "sync-migration-v4-fixture");
|
||||
check_true("init v4 release fixture db", storage_init(root));
|
||||
storage_set_setting_text("sync_public_id", "test-public-id");
|
||||
storage_set_setting_text("sync_public_key", "test-public-key");
|
||||
storage_set_setting_text("sync_private_key", private_key);
|
||||
storage_close();
|
||||
seed_versioned_sync_account(root, 1);
|
||||
check_true("open migrated v4 release fixture db", storage_init(root));
|
||||
assert_versioned_fixture_displayed("load migrated v4 release fixture habits");
|
||||
memset(&status, 0, sizeof(status));
|
||||
check_true("load migrated v4 sync status", storage_sync_status(&status));
|
||||
check_int("migrated v4 secure migration complete", status.secure_migration_pending, 0);
|
||||
payload = storage_build_sync_payload_json("test-public-id", "test-public-key");
|
||||
check_true("migrated v4 payload registers inbe",
|
||||
payload != NULL && strstr(payload, "\"app_id\":\"inbe\"") != NULL);
|
||||
check_int("migrated v4 does not rerun encrypted migration",
|
||||
storage_json_array_count_path(payload, "$.encrypted_records"), 0);
|
||||
storage_free_sync_payload_json(payload);
|
||||
storage_close();
|
||||
remove_tree(root);
|
||||
|
||||
make_clean_root(root, sizeof(root), "sync-migration-v5-fixture");
|
||||
check_true("init v5 release fixture db", storage_init(root));
|
||||
check_true("apply v5 release fixture snapshot",
|
||||
storage_apply_sync_response_json(
|
||||
"{\"protocol_version\":5,\"latest_protocol\":5,\"status\":\"ok\","
|
||||
"\"server_version\":500,\"server_clock\":500,"
|
||||
"\"server_state_hash\":\"v5fixture\","
|
||||
"\"changes_complete\":true,\"full_snapshot_required\":false,"
|
||||
"\"changes\":{\"habits\":[{\"id\":\"release-hydrate\","
|
||||
"\"name\":\"Hydrate\",\"color_r\":42,\"color_g\":133,"
|
||||
"\"color_b\":180,\"sync_mode\":1,\"sync_activity\":1,"
|
||||
"\"counter_enabled\":1,\"sort_order\":10,\"deleted_at\":0,"
|
||||
"\"updated_at\":\"2026-08-29T12:00:00Z\"}],"
|
||||
"\"habit_days\":[{\"habit_id\":\"release-hydrate\","
|
||||
"\"local_date\":20260829,\"completed\":true,\"count\":5,"
|
||||
"\"updated_at\":\"2026-08-29T12:00:00Z\"}],"
|
||||
"\"sessions\":[{\"id\":\"release-session\","
|
||||
"\"started_at\":\"2026-08-29T12:00:00Z\","
|
||||
"\"local_date\":20260829,\"topic\":\"0\",\"activity\":1,"
|
||||
"\"source\":\"release-fixture\",\"rounds_hash\":\"12345\","
|
||||
"\"deleted_at\":0,\"updated_at\":\"2026-08-29T12:02:00Z\","
|
||||
"\"rounds\":[{\"round_index\":0,\"breaths\":0,"
|
||||
"\"hold_seconds\":45}]}],\"meditation_logs\":[],"
|
||||
"\"social_cache\":[],\"encrypted_records\":[]}}"));
|
||||
assert_versioned_fixture_displayed("load migrated v5 release fixture habits");
|
||||
memset(&status, 0, sizeof(status));
|
||||
check_true("load v5 fixture sync status", storage_sync_status(&status));
|
||||
check_int("v5 fixture latest protocol", status.latest_protocol, 5);
|
||||
check_int("v5 fixture has no protocol upgrade warning",
|
||||
status.protocol_upgrade_available, 0);
|
||||
payload = storage_build_sync_payload_json("test-public-id", "test-public-key");
|
||||
check_true("v5 fixture payload registers inbe",
|
||||
payload != NULL && strstr(payload, "\"app_id\":\"inbe\"") != NULL);
|
||||
storage_free_sync_payload_json(payload);
|
||||
storage_close();
|
||||
remove_tree(root);
|
||||
}
|
||||
|
||||
static void
|
||||
test_sync_payload_batches_large_outbox(void)
|
||||
{
|
||||
@@ -2322,6 +2504,7 @@ main(void)
|
||||
test_sync_payload_excludes_local_settings();
|
||||
test_sync_payload_includes_queued_current_edits();
|
||||
test_sync_payload_includes_v4_encrypted_shadow_records();
|
||||
test_sync_migration_matrix_keeps_release_data_displayable();
|
||||
test_sync_payload_batches_large_outbox();
|
||||
test_sync_outbox_preserves_edits_after_snapshot();
|
||||
test_sync_apply_preserves_counter_counts();
|
||||
|
||||
@@ -755,8 +755,10 @@ test_sync_payload_includes_v2_ops(void)
|
||||
1);
|
||||
|
||||
payload = storage_build_sync_payload_json("test-public-id", "test-public-key");
|
||||
check_contains("v4 payload protocol", payload, "\"protocol_version\":4");
|
||||
check_contains("v4 payload capabilities", payload, "\"client_capabilities\"");
|
||||
check_contains("v5 payload protocol", payload, "\"protocol_version\":5");
|
||||
check_contains("v5 payload app id", payload, "\"app_id\":\"inbe\"");
|
||||
check_contains("v5 payload capabilities", payload, "\"client_capabilities\"");
|
||||
check_contains("v5 payload legacy data opt-in", payload, "\"include_legacy_data\":true");
|
||||
check_contains("v2 payload client clock", payload, "\"client_clock\":0");
|
||||
check_contains("v2 payload ops array", payload, "\"ops\":[");
|
||||
check_contains("v2 payload habit op", payload, "\"entity_type\":\"habit\"");
|
||||
@@ -783,7 +785,7 @@ test_normal_response_records_server_hash(void)
|
||||
const char *response = "{"
|
||||
"\"server_version\":5,"
|
||||
"\"server_clock\":77,"
|
||||
"\"latest_protocol\":4,"
|
||||
"\"latest_protocol\":5,"
|
||||
"\"server_state_hash\":\"normal-hash-001\","
|
||||
"\"account_alias\":\"waozi\","
|
||||
"\"changes\":{\"habits\":[],\"habit_days\":[],"
|
||||
@@ -820,7 +822,7 @@ test_latest_protocol_warning_targets_current_client_only(void)
|
||||
const char *response = "{"
|
||||
"\"server_version\":6,"
|
||||
"\"server_clock\":78,"
|
||||
"\"latest_protocol\":5,"
|
||||
"\"latest_protocol\":6,"
|
||||
"\"changes\":{\"habits\":[],\"habit_days\":[],"
|
||||
"\"sessions\":[],\"meditation_logs\":[]}"
|
||||
"}";
|
||||
@@ -829,7 +831,7 @@ test_latest_protocol_warning_targets_current_client_only(void)
|
||||
check_true("init latest protocol db", storage_init(root));
|
||||
check_true("apply newer protocol response", storage_apply_sync_response_json(response));
|
||||
check_true("newer protocol loads status", storage_sync_status(&status));
|
||||
check_int("newer protocol recorded", status.latest_protocol, 5);
|
||||
check_int("newer protocol recorded", status.latest_protocol, 6);
|
||||
check_true("newer protocol warns current client", status.protocol_upgrade_available);
|
||||
|
||||
storage_close();
|
||||
|
||||
+4
-4
@@ -6,8 +6,8 @@ IDI_APP_ICON ICON "inbe.ico"
|
||||
IDI_NOTIFICATION_ICON ICON "inbe.ico"
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,9,15,0
|
||||
PRODUCTVERSION 1,9,15,0
|
||||
FILEVERSION 1,9,16,0
|
||||
PRODUCTVERSION 1,9,16,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -24,11 +24,11 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "waozi"
|
||||
VALUE "FileDescription", "Inner Breeze"
|
||||
VALUE "FileVersion", "1.9.15"
|
||||
VALUE "FileVersion", "1.9.16"
|
||||
VALUE "InternalName", "inbe"
|
||||
VALUE "OriginalFilename", "inbe-windows-x86_64.exe"
|
||||
VALUE "ProductName", "Inner Breeze"
|
||||
VALUE "ProductVersion", "1.9.15"
|
||||
VALUE "ProductVersion", "1.9.16"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
Reference in new issue
Block a user