forked from Blendman974/faceclaw
Add symbolic math and graphing tools, dual-microphone audio processing, live captions, translation, speaker diarization, sentiment analysis, and searchable conversation history. Extend Android voice and BLE support for microphone control, recording, transcoding, and on-device speaker identification, with coverage for calculator and microphone workflows.
25 lines
869 B
TypeScript
25 lines
869 B
TypeScript
import { EventData, NavigatedData, Page } from "@nativescript/core";
|
|
|
|
import { ConversationViewModel } from "./conversation-view-model";
|
|
|
|
type ConversationContext = { sessionId?: number } | undefined;
|
|
|
|
export function navigatingTo(args: NavigatedData): void {
|
|
const page = args.object as Page;
|
|
let model = page.bindingContext as ConversationViewModel | undefined;
|
|
if (!model) {
|
|
const context = args.context as ConversationContext;
|
|
model = new ConversationViewModel(context?.sessionId ?? 0);
|
|
page.bindingContext = model;
|
|
}
|
|
model.reload();
|
|
}
|
|
|
|
export function unloaded(args: EventData): void {
|
|
const page = args.object as Page;
|
|
const model = page.bindingContext as ConversationViewModel | undefined;
|
|
// The page has no forward navigation, so unloaded means it's going away:
|
|
// stop playback and release the MediaPlayer.
|
|
model?.dispose();
|
|
}
|