mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 13:25:12 +00:00
chore(electron): add telemetry events for enabling meetings (#11327)
fix AF-2436
This commit is contained in:
@@ -7,6 +7,7 @@ import { WorkbenchService } from '@affine/core/modules/workbench';
|
||||
import { DebugLogger } from '@affine/debug';
|
||||
import { apis, events } from '@affine/electron-api';
|
||||
import { i18nTime } from '@affine/i18n';
|
||||
import track from '@affine/track';
|
||||
import type { AttachmentBlockModel } from '@blocksuite/affine/model';
|
||||
import { Text } from '@blocksuite/affine/store';
|
||||
import type { BlobEngine } from '@blocksuite/affine/sync';
|
||||
@@ -114,9 +115,18 @@ export function setupRecordingEvents(frameworkProvider: FrameworkProvider) {
|
||||
using audioAttachment = workspace.scope
|
||||
.get(AudioAttachmentService)
|
||||
.get(model);
|
||||
audioAttachment?.obj.transcribe().catch(err => {
|
||||
logger.error('Failed to transcribe recording', err);
|
||||
});
|
||||
audioAttachment?.obj
|
||||
.transcribe()
|
||||
.then(() => {
|
||||
track.doc.editor.audioBlock.transcribeRecording({
|
||||
type: 'Meeting record',
|
||||
method: 'success',
|
||||
option: 'Auto transcribing',
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
logger.error('Failed to transcribe recording', err);
|
||||
});
|
||||
} else {
|
||||
throw new Error('No attachment model found');
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { appIconMap } from '@affine/core/utils';
|
||||
import { encodeRawBufferToOpus } from '@affine/core/utils/webm-encoding';
|
||||
import { apis, events } from '@affine/electron-api';
|
||||
import { useI18n } from '@affine/i18n';
|
||||
import track from '@affine/track';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
|
||||
import * as styles from './styles.css';
|
||||
@@ -81,12 +82,20 @@ export function Recording() {
|
||||
|
||||
const handleDismiss = useAsyncCallback(async () => {
|
||||
await apis?.popup?.dismissCurrentRecording();
|
||||
}, []);
|
||||
track.popup.$.recordingBar.dismissRecording({
|
||||
type: 'Meeting record',
|
||||
appName: status?.appName || 'System Audio',
|
||||
});
|
||||
}, [status]);
|
||||
|
||||
const handleStopRecording = useAsyncCallback(async () => {
|
||||
if (!status) {
|
||||
return;
|
||||
}
|
||||
track.popup.$.recordingBar.finishRecording({
|
||||
type: 'Meeting record',
|
||||
appName: status.appName || 'System Audio',
|
||||
});
|
||||
await apis?.recording?.stopRecording(status.id);
|
||||
}, [status]);
|
||||
|
||||
@@ -130,6 +139,12 @@ export function Recording() {
|
||||
useEffect(() => {
|
||||
// allow processing stopped event in tray menu as well:
|
||||
return events?.recording.onRecordingStatusChanged(status => {
|
||||
if (status?.status === 'new') {
|
||||
track.popup.$.recordingBar.toggleRecordingBar({
|
||||
type: 'Meeting record',
|
||||
appName: status.appName || 'System Audio',
|
||||
});
|
||||
}
|
||||
if (status?.status === 'stopped') {
|
||||
handleProcessStoppedRecording();
|
||||
}
|
||||
@@ -140,6 +155,10 @@ export function Recording() {
|
||||
if (!status) {
|
||||
return;
|
||||
}
|
||||
track.popup.$.recordingBar.startRecording({
|
||||
type: 'Meeting record',
|
||||
appName: status.appName || 'System Audio',
|
||||
});
|
||||
await apis?.recording?.startRecording(status.appGroupId);
|
||||
}, [status]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user