Skip to content

Commit 4645ac8

Browse files
Merge pull request #524 from H7GhosT/fix/premium-message-transcribe-audio
Add premium alert when trying to transcribe audio
2 parents 2c86665 + 47664e2 commit 4645ac8

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

src/components/audio.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ import {_tgico} from '../helpers/tgico';
4242
import Icon from './icon';
4343
import setCurrentTime from '../helpers/dom/setCurrentTime';
4444
import makeError from '../helpers/makeError';
45+
import {hideToast, toastNew} from './toast';
46+
import anchorCallback from '../helpers/dom/anchorCallback';
47+
import PopupPremium from './popups/premium';
48+
4549

4650
const UNMOUNT_PRELOADER = true;
4751

@@ -209,6 +213,16 @@ async function wrapVoiceMessage(audioEl: AudioElement) {
209213
if(message.pFlags.is_outgoing) {
210214
return;
211215
}
216+
if(!rootScope.getPremium()) {
217+
toastNew({
218+
langPackKey: 'AudioAndVideoTranscription.PremiumAlert',
219+
langPackArguments: [anchorCallback(() => {
220+
hideToast();
221+
PopupPremium.show({feature: 'voice_to_text'});
222+
})]
223+
});
224+
return;
225+
}
212226

213227
audioEl.transcriptionState = 1;
214228
!speechRecognitionLoader.parentElement && speechRecognitionDiv.append(speechRecognitionLoader);

src/components/chat/bubbleParts/roundVideoBubble.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ export function wrapRoundVideoBubble({
201201
async function showAudio() {
202202
if(!rootScope.getPremium()) {
203203
toastNew({
204-
langPackKey: 'RoundVideoTranscription.PremiumAlert',
204+
langPackKey: 'AudioAndVideoTranscription.PremiumAlert',
205205
langPackArguments: [anchorCallback(() => {
206206
hideToast();
207207
PopupPremium.show({feature: 'voice_to_text'});

src/lang.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3462,7 +3462,7 @@ const lang = {
34623462
'EnableDarkMode': 'Enable Dark Mode',
34633463
'DisableDarkMode': 'Disable Dark Mode',
34643464
'DisableAnimations': 'Disable Animations',
3465-
'RoundVideoTranscription.PremiumAlert': 'Subscribe to Telegram Premium to unlock video and audio transcription. [Read More]()',
3465+
'AudioAndVideoTranscription.PremiumAlert': 'Subscribe to Telegram Premium to unlock video and audio transcription. [Read More]()',
34663466
'Chat.Search.JoinedChannels': 'Channels you joined',
34673467
'Chat.Search.NothingFound': 'Nothing interesting here yet...',
34683468
'UnknownBotUsers': 'Unknown users',

src/scripts/out/langPack.strings

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2999,7 +2999,7 @@
29992999
"EnableDarkMode" = "Enable Dark Mode";
30003000
"DisableDarkMode" = "Disable Dark Mode";
30013001
"DisableAnimations" = "Disable Animations";
3002-
"RoundVideoTranscription.PremiumAlert" = "Subscribe to Telegram Premium to unlock video and audio transcription. [Read More]()";
3002+
"AudioAndVideoTranscription.PremiumAlert" = "Subscribe to Telegram Premium to unlock video and audio transcription. [Read More]()";
30033003
"Chat.Search.JoinedChannels" = "Channels you joined";
30043004
"Chat.Search.NothingFound" = "Nothing interesting here yet...";
30053005
"UnknownBotUsers" = "Unknown users";

0 commit comments

Comments
 (0)