Initial publishable release

This commit is contained in:
James Babcock committed 2026-04-26 23:07:54 -07:00
commit 6e442e7faa
120 files changed
+750769

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
import { Utils } from "@nativescript/core";
declare const com: any;
function getContext(): android.content.Context {
const context = Utils.android.getApplicationContext();
if (!context) throw new Error("Android application context unavailable");
return context;
}
function createIntent(action: string, text?: string): android.content.Intent {
const context = getContext();
const intent = new android.content.Intent(context, com.faceclaw.app.FaceclawForegroundService.class);
intent.setAction(action);
if (text) {
intent.putExtra(com.faceclaw.app.FaceclawForegroundService.EXTRA_TEXT, text);
}
return intent;
}
export function startForegroundNotification(text: string): void {
if (!global.isAndroid) return;
const context = getContext();
const intent = createIntent(com.faceclaw.app.FaceclawForegroundService.ACTION_START, text);
androidx.core.content.ContextCompat.startForegroundService(context, intent);
}
export function updateForegroundNotification(text: string): void {
if (!global.isAndroid) return;
const context = getContext();
context.startService(createIntent(com.faceclaw.app.FaceclawForegroundService.ACTION_UPDATE, text));
}
export function stopForegroundNotification(): void {
if (!global.isAndroid) return;
const context = getContext();
context.startService(createIntent(com.faceclaw.app.FaceclawForegroundService.ACTION_STOP));
}