v0.2.3: true ticking countdown via a tiny native module (no deps)
Some checks failed
build-apk / build (push) Has been cancelled
Some checks failed
build-apk / build (push) Has been cancelled
Replaces the static status notification with a native Android chronometer that counts DOWN to the session end — the system ticks it every second with zero app CPU/battery, visible without opening the app. - modules/bbp-notify: a ~50-line local Expo module using only NotificationCompat (setWhen + setUsesChronometer + setChronometerCountDown + ongoing). Zero third-party dependencies, no Firebase — fits the de-Googled ethos. Verified: autolinks + Kotlin compiles. - sessionStatus.ts uses it when present, else falls back to the expo-notifications static expiry-time notification. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
b9bd6bd1c6
commit
d0f31d5278
103 changed files with 204 additions and 14 deletions
31
app/modules/bbp-notify/index.ts
Normal file
31
app/modules/bbp-notify/index.ts
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import { Platform } from 'react-native';
|
||||
import { requireOptionalNativeModule } from 'expo-modules-core';
|
||||
|
||||
interface BbpNotifyNative {
|
||||
/** Post/replace an ongoing notification with a native chronometer counting down to endTimeMillis. */
|
||||
showCountdown(title: string, body: string, endTimeMillis: number): Promise<void>;
|
||||
/** Remove the countdown notification. */
|
||||
clear(): Promise<void>;
|
||||
}
|
||||
|
||||
// Android-only, and only present in a build that includes the native module
|
||||
// (returns null in Expo Go / other platforms — callers degrade gracefully).
|
||||
const native =
|
||||
Platform.OS === 'android'
|
||||
? (requireOptionalNativeModule('BbpNotify') as BbpNotifyNative | null)
|
||||
: null;
|
||||
|
||||
/** True when the native ticking-countdown module is available. */
|
||||
export const hasNativeCountdown = native != null;
|
||||
|
||||
export async function showCountdown(
|
||||
title: string,
|
||||
body: string,
|
||||
endTimeMillis: number,
|
||||
): Promise<void> {
|
||||
await native?.showCountdown(title, body, endTimeMillis);
|
||||
}
|
||||
|
||||
export async function clearCountdown(): Promise<void> {
|
||||
await native?.clear();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue