mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-22 00:37:05 +08:00
chore(electron): add telemetry events for enabling meetings (#11327)
fix AF-2436
This commit is contained in:
@@ -14,6 +14,7 @@ import { GlobalDialogService } from '@affine/core/modules/dialogs';
|
||||
import type { AudioAttachmentBlock } from '@affine/core/modules/media/entities/audio-attachment-block';
|
||||
import { AudioAttachmentService } from '@affine/core/modules/media/services/audio-attachment';
|
||||
import { Trans, useI18n } from '@affine/i18n';
|
||||
import track from '@affine/track';
|
||||
import type { AttachmentBlockModel } from '@blocksuite/affine/model';
|
||||
import { useLiveData, useService } from '@toeverything/infra';
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
@@ -71,6 +72,11 @@ const AttachmentAudioPlayer = ({ block }: { block: AudioAttachmentBlock }) => {
|
||||
|
||||
if (transcribed) {
|
||||
block.expanded$.setValue(!expanded);
|
||||
track.doc.editor.audioBlock.openTranscribeNotes({
|
||||
type: 'Meeting record',
|
||||
method: 'success',
|
||||
option: expanded ? 'off' : 'on',
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -87,6 +93,10 @@ const AttachmentAudioPlayer = ({ block }: { block: AudioAttachmentBlock }) => {
|
||||
globalDialogService.open('sign-in', {});
|
||||
},
|
||||
});
|
||||
track.doc.editor.audioBlock.openTranscribeNotes({
|
||||
type: 'Meeting record',
|
||||
method: 'not signed in',
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -108,8 +118,17 @@ const AttachmentAudioPlayer = ({ block }: { block: AudioAttachmentBlock }) => {
|
||||
variant: 'primary',
|
||||
},
|
||||
});
|
||||
track.doc.editor.audioBlock.openTranscribeNotes({
|
||||
type: 'Meeting record',
|
||||
method: 'not owner',
|
||||
});
|
||||
} else {
|
||||
await block.transcribe();
|
||||
track.doc.editor.audioBlock.transcribeRecording({
|
||||
type: 'Meeting record',
|
||||
method: 'success',
|
||||
option: 'handle transcribing',
|
||||
});
|
||||
}
|
||||
}, [
|
||||
enableAi,
|
||||
|
||||
@@ -15,6 +15,7 @@ import { useAsyncCallback } from '@affine/core/components/hooks/affine-async-hoo
|
||||
import { MeetingSettingsService } from '@affine/core/modules/media/services/meeting-settings';
|
||||
import type { MeetingSettingsSchema } from '@affine/electron/main/shared-state-schema';
|
||||
import { useI18n } from '@affine/i18n';
|
||||
import track from '@affine/track';
|
||||
import {
|
||||
ArrowRightSmallIcon,
|
||||
DoneIcon,
|
||||
@@ -106,6 +107,10 @@ export const MeetingsSettings = () => {
|
||||
const handleEnabledChange = useAsyncCallback(
|
||||
async (checked: boolean) => {
|
||||
try {
|
||||
track.$.settingsPanel.meetings.toggleMeetingFeatureFlag({
|
||||
option: checked ? 'on' : 'off',
|
||||
type: 'Meeting record',
|
||||
});
|
||||
await meetingSettingsService.setEnabled(checked);
|
||||
} catch {
|
||||
confirmModal.openConfirmModal({
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { encodeAudioBlobToOpus } from '@affine/core/utils/webm-encoding';
|
||||
import { DebugLogger } from '@affine/debug';
|
||||
import { AiJobStatus } from '@affine/graphql';
|
||||
import track from '@affine/track';
|
||||
import {
|
||||
type AttachmentBlockModel,
|
||||
TranscriptionBlockFlavour,
|
||||
@@ -142,6 +143,10 @@ export class AudioAttachmentBlock extends Entity<AttachmentBlockModel> {
|
||||
this.fillTranscriptionResult(status.result);
|
||||
}
|
||||
} catch (error) {
|
||||
track.doc.editor.audioBlock.transcribeRecording({
|
||||
type: 'Meeting record',
|
||||
method: 'fail',
|
||||
});
|
||||
logger.error('Error transcribing audio:', error);
|
||||
throw error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user