Skip to content

Commit 2d33779

Browse files
noahchengGit Sync Plugin
authored andcommitted
[iOS] Add AI Transcriber entry to the Demo
1 parent 7c58ba5 commit 2d33779

4 files changed

Lines changed: 51 additions & 1 deletion

File tree

application/App-UIKit/AppDelegate.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
7777
DispatchQueue.main.async {
7878
TUICallKit.createInstance().enableFloatWindow(enable: SettingsConfig.share.floatWindow)
7979
TUICallKit.createInstance().enableIncomingBanner(enable: SettingsConfig.share.enableIncomingBanner)
80+
TUICallKit.createInstance().enableAITranscriber(enable: SettingsConfig.share.enableAITranscriber)
8081
}
8182
}
8283
}

application/App-UIKit/Call/CallSettings/SettingsConfig.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class SettingsConfig {
2828
var floatWindow: Bool = true
2929
var enableVirtualBackground: Bool = true
3030
var enableIncomingBanner: Bool = true
31+
var enableAITranscriber: Bool = true
3132
var intRoomId: UInt32 = 0
3233
var strRoomId: String = ""
3334
var timeout: Int = 30

application/App-UIKit/Call/CallSettings/SettingsViewController.swift

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,14 @@ class SettingsViewController: UIViewController, UITextFieldDelegate {
9898
}
9999
return customSwitchView
100100
}()
101+
private lazy var aiTranscriberSwitchView: SettingsCustomSwitchView = {
102+
let customSwitchView = SettingsCustomSwitchView(title: ("EnableAITranscriber").localized,
103+
isOn: SettingsConfig.share.enableAITranscriber)
104+
customSwitchView.switchValueChanged = { [weak self] isOn in
105+
self?.aiTranscriberSwitchClick(isOn)
106+
}
107+
return customSwitchView
108+
}()
101109
#endif
102110
private let callSettingContentView: UIView = {
103111
let view = UIView(frame: .zero)
@@ -350,6 +358,7 @@ class SettingsViewController: UIViewController, UITextFieldDelegate {
350358
#if canImport(TUICallKit_Swift)
351359
scrollContentView.addSubview(virtualBackgroundSwitchView)
352360
scrollContentView.addSubview(incomingBannerSwitchView)
361+
scrollContentView.addSubview(aiTranscriberSwitchView)
353362
#endif
354363

355364
scrollContentView.addSubview(callSettingContentView)
@@ -471,9 +480,15 @@ class SettingsViewController: UIViewController, UITextFieldDelegate {
471480
make.top.equalTo(virtualBackgroundSwitchView.snp.bottom).offset(20)
472481
make.height.equalTo(20)
473482
}
483+
aiTranscriberSwitchView.snp.makeConstraints { make in
484+
make.leading.equalToSuperview()
485+
make.trailing.equalToSuperview()
486+
make.top.equalTo(incomingBannerSwitchView.snp.bottom).offset(20)
487+
make.height.equalTo(20)
488+
}
474489
callSettingContentView.snp.makeConstraints { make in
475490
make.leading.trailing.equalToSuperview()
476-
make.top.equalTo(incomingBannerSwitchView.snp.bottom).offset(20)
491+
make.top.equalTo(aiTranscriberSwitchView.snp.bottom).offset(20)
477492
make.height.equalTo(30)
478493
}
479494
#elseif canImport(TUICallKit)
@@ -739,6 +754,10 @@ class SettingsViewController: UIViewController, UITextFieldDelegate {
739754
SettingsConfig.share.enableIncomingBanner = isOn
740755
TUICallKit.createInstance().enableIncomingBanner(enable: isOn)
741756
}
757+
private func aiTranscriberSwitchClick(_ isOn: Bool) {
758+
SettingsConfig.share.enableAITranscriber = isOn
759+
TUICallKit.createInstance().enableAITranscriber(enable: isOn)
760+
}
742761
#endif
743762

744763
@objc private func resolutionModeSegmentClick(_ sender: UISegmentedControl) {

application/App-UIKit/Resource/Localized/Localized.xcstrings

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,35 @@
541541
}
542542
}
543543
},
544+
"EnableAITranscriber": {
545+
"extractionState": "manual",
546+
"localizations": {
547+
"ar": {
548+
"stringUnit": {
549+
"state": "translated",
550+
"value": "النسخ بالذكاء الاصطناعي"
551+
}
552+
},
553+
"en": {
554+
"stringUnit": {
555+
"state": "translated",
556+
"value": "AI Transcriber"
557+
}
558+
},
559+
"zh-Hans": {
560+
"stringUnit": {
561+
"state": "translated",
562+
"value": "AI转录"
563+
}
564+
},
565+
"ja": {
566+
"stringUnit": {
567+
"state": "translated",
568+
"value": "AI文字起こし"
569+
}
570+
}
571+
}
572+
},
544573
"EnableVirtualBackground": {
545574
"extractionState": "manual",
546575
"localizations": {

0 commit comments

Comments
 (0)