forked from TelegramMessenger/Telegram-iOS
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
323 changed files
with
9,954 additions
and
3,492 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
129 changes: 0 additions & 129 deletions
129
Nicegram/NGTranslate/Sources/SpeechToText/GoogleSpeechToTextProcessor.swift
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
Nicegram/NGTranslate/Sources/SpeechToText/TgSpeechToTextManager.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import FeatSpeechToText | ||
import Foundation | ||
import Postbox | ||
import SwiftSignalKit | ||
import TelegramCore | ||
|
||
@available(iOS 13.0, *) | ||
public class TgSpeechToTextManager { | ||
|
||
// MARK: - Dependencies | ||
|
||
private let convertSpeechToTextUseCase: ConvertSpeechToTextUseCase | ||
private let mediaBox: MediaBox | ||
|
||
// MARK: - Lifecycle | ||
|
||
public init(mediaBox: MediaBox) { | ||
self.convertSpeechToTextUseCase = SpeechToTextContainer.shared.convertSpeechToTextUseCase() | ||
self.mediaBox = mediaBox | ||
} | ||
} | ||
|
||
@available(iOS 13.0, *) | ||
public extension TgSpeechToTextManager { | ||
func convertSpeechToText( | ||
mediaFile: TelegramMediaFile | ||
) async -> ConvertSpeechToTextResult { | ||
await withCheckedContinuation { continuation in | ||
let _ = (mediaBox.resourceData(mediaFile.resource) | ||
|> take(1)).start { data in | ||
let url = URL( | ||
fileURLWithPath: data.path | ||
) | ||
|
||
Task { | ||
let result = await self.convertSpeechToTextUseCase( | ||
url: url | ||
) | ||
continuation.resume(returning: result) | ||
} | ||
} | ||
} | ||
} | ||
} |
146 changes: 0 additions & 146 deletions
146
Nicegram/NGTranslate/Sources/SpeechToText/TgVoiceToTextProcessor.swift
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.