59 lines
1.5 KiB
Objective-C
59 lines
1.5 KiB
Objective-C
//
|
|
// KBVoiceToTextManager.m
|
|
// keyBoard
|
|
//
|
|
// Created by Mac on 2026/1/26.
|
|
//
|
|
|
|
#import "KBVoiceToTextManager.h"
|
|
#import "KBVoiceInputBar.h"
|
|
#import "KBLocalizationManager.h"
|
|
|
|
@interface KBVoiceToTextManager () <KBVoiceInputBarDelegate>
|
|
|
|
@property(nonatomic, weak) KBVoiceInputBar *inputBar;
|
|
|
|
@end
|
|
|
|
@implementation KBVoiceToTextManager
|
|
|
|
- (instancetype)initWithInputBar:(KBVoiceInputBar *)inputBar {
|
|
self = [super init];
|
|
if (self) {
|
|
_inputBar = inputBar;
|
|
_inputBar.delegate = self;
|
|
}
|
|
return self;
|
|
}
|
|
|
|
#pragma mark - KBVoiceInputBarDelegate
|
|
|
|
- (void)voiceInputBarDidBeginRecording:(KBVoiceInputBar *)inputBar {
|
|
inputBar.statusText = KBLocalized(@"Voice Recording...");
|
|
|
|
if ([self.delegate respondsToSelector:@selector
|
|
(voiceToTextManagerDidBeginRecording:)]) {
|
|
[self.delegate voiceToTextManagerDidBeginRecording:self];
|
|
}
|
|
}
|
|
|
|
- (void)voiceInputBarDidEndRecording:(KBVoiceInputBar *)inputBar {
|
|
inputBar.statusText = KBLocalized(@"Voice Recording Ended");
|
|
|
|
if ([self.delegate respondsToSelector:@selector
|
|
(voiceToTextManagerDidEndRecording:)]) {
|
|
[self.delegate voiceToTextManagerDidEndRecording:self];
|
|
}
|
|
}
|
|
|
|
- (void)voiceInputBarDidCancelRecording:(KBVoiceInputBar *)inputBar {
|
|
inputBar.statusText = KBLocalized(@"Voice Cancelled");
|
|
|
|
if ([self.delegate respondsToSelector:@selector
|
|
(voiceToTextManagerDidCancelRecording:)]) {
|
|
[self.delegate voiceToTextManagerDidCancelRecording:self];
|
|
}
|
|
}
|
|
|
|
@end
|