Skip to content

Commit ee13b36

Browse files
refactor: Remove ChatGPT (#1802)
2 parents 79387eb + 15d28e2 commit ee13b36

20 files changed

+30
-378
lines changed

Mail/Views/AI Writer/AIModel.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ extension AIModel {
9999
}
100100
let response = try await mailboxManager.apiFetcher.aiCreateConversation(
101101
messages: conversation,
102-
engine: UserDefaults.shared.aiEngine,
103102
mailbox: mailboxManager.mailbox
104103
)
105104
handleAIResponse(response)
@@ -130,7 +129,6 @@ extension AIModel {
130129
let response = try await mailboxManager.apiFetcher.aiShortcut(
131130
contextId: contextId,
132131
shortcut: shortcut,
133-
engine: UserDefaults.shared.aiEngine,
134132
mailbox: mailboxManager.mailbox
135133
)
136134
handleAIResponse(response)
@@ -165,7 +163,6 @@ extension AIModel {
165163
let response = try await mailboxManager.apiFetcher.aiShortcutAndRecreateConversation(
166164
shortcut: shortcut,
167165
messages: conversation,
168-
engine: UserDefaults.shared.aiEngine,
169166
mailbox: mailboxManager.mailbox
170167
)
171168
handleAIResponse(response)
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Infomaniak Mail - iOS App
3-
Copyright (C) 2022 Infomaniak Network SA
3+
Copyright (C) 2024 Infomaniak Network SA
44

55
This program is free software: you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by
@@ -16,22 +16,20 @@
1616
along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*/
1818

19+
import DesignSystem
1920
import MailResources
2021
import SwiftUI
2122

22-
struct SettingsAIEngineOptionView: View {
23+
struct AIEngineLabel: View {
2324
var body: some View {
24-
ScrollView {
25-
VStack(alignment: .leading, spacing: 0) {
26-
SettingsSectionTitleView(title: MailResourcesStrings.Localizable.settingsAiEngineDescription)
27-
AIEngineOptionView(matomoCategory: .settingsAIEngine)
28-
}
25+
HStack(spacing: IKPadding.mini) {
26+
Text(MailResourcesStrings.Localizable.aiGenerationTitlePrompt)
27+
.foregroundStyle(MailResourcesAsset.textPrimaryColor)
28+
MailResourcesAsset.aiLogo.swiftUIImage
2929
}
30-
.background(MailResourcesAsset.backgroundColor.swiftUIColor)
31-
.navigationTitle(MailResourcesStrings.Localizable.aiPromptTitle)
3230
}
3331
}
3432

3533
#Preview {
36-
SettingsAIEngineOptionView()
34+
AIEngineLabel()
3735
}

Mail/Views/AI Writer/Prompt/AIEngineOptionButton.swift

Lines changed: 0 additions & 57 deletions
This file was deleted.

Mail/Views/AI Writer/Prompt/AIPromptView.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ struct AIPromptView: View {
3636
// The focus is done thanks to UIKit, this allows the keyboard to appear more quickly
3737
@State private var hasFocusedEditor = false
3838
@State private var prompt = ""
39-
@ModalState(context: ContextKeys.aiAlert) private var isShowingAIEngineChoice = false
4039
@State private var placeholderProposition = Constants.aiPromptExamples.randomElement() ?? MailResourcesStrings.Localizable
4140
.aiPromptExample1
4241

@@ -89,7 +88,7 @@ struct AIPromptView: View {
8988
}
9089

9190
HStack {
92-
AIEngineOptionButton(isShowingAIEngineChoice: $isShowingAIEngineChoice)
91+
AIEngineLabel()
9392

9493
Spacer()
9594

@@ -119,9 +118,6 @@ struct AIPromptView: View {
119118
matomo.track(eventWithCategory: .aiWriter, name: "dismissPromptWithoutGenerating")
120119
}
121120
}
122-
.sheet(isPresented: $isShowingAIEngineChoice) {
123-
PromptAIEngineOptionView()
124-
}
125121
.matomoView(view: ["AI", "Prompt"])
126122
}
127123
}

Mail/Views/AI Writer/Prompt/PromptAIEngineOptionView.swift

Lines changed: 0 additions & 56 deletions
This file was deleted.

Mail/Views/Settings/General/AIEngineOptionView.swift

Lines changed: 0 additions & 62 deletions
This file was deleted.

Mail/Views/Settings/SettingsView.swift

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import SwiftUI
3131
struct SettingsView: View {
3232
@InjectService private var accountManager: AccountManager
3333
@InjectService private var appLockHelper: AppLockHelper
34-
@InjectService private var featureFlagsManageable: FeatureFlagsManageable
3534
@InjectService private var platformDetector: PlatformDetectable
3635
@InjectService private var myKSuiteStore: MyKSuiteStore
3736
@LazyInjectService private var matomo: MatomoUtils
@@ -40,7 +39,6 @@ struct SettingsView: View {
4039

4140
@EnvironmentObject private var mainViewState: MainViewState
4241

43-
@AppStorage(UserDefaults.shared.key(.aiEngine)) private var aiEngine = DefaultPreferences.aiEngine
4442
@AppStorage(UserDefaults.shared.key(.threadDensity)) private var density = DefaultPreferences.threadDensity
4543
@AppStorage(UserDefaults.shared.key(.theme)) private var theme = DefaultPreferences.theme
4644
@AppStorage(UserDefaults.shared.key(.accentColor)) private var accentColor = DefaultPreferences.accentColor
@@ -147,14 +145,6 @@ struct SettingsView: View {
147145
.buttonStyle(.plain)
148146
}
149147

150-
// MARK: AI Writer
151-
152-
if featureFlagsManageable.isEnabled(.aiMailComposer) {
153-
SettingsSubMenuCell(title: MailResourcesStrings.Localizable.aiPromptTitle, subtitle: aiEngine.title) {
154-
SettingsAIEngineOptionView()
155-
}
156-
}
157-
158148
// MARK: Auto Advance
159149

160150
SettingsSubMenuCell(

MailCore/API/MailApiFetcher/MailApiFetchable.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,17 +137,16 @@ public protocol MailApiExtendedFetchable {
137137
}
138138

139139
public protocol MailApiAIFetchable {
140-
func aiCreateConversation(messages: [AIMessage], output: AIOutputFormat, engine: AIEngine, mailbox: Mailbox) async throws
140+
func aiCreateConversation(messages: [AIMessage], output: AIOutputFormat, mailbox: Mailbox) async throws
141141
-> AIConversationResponse
142142

143-
func aiShortcut(contextId: String, shortcut: AIShortcutAction, engine: AIEngine, mailbox: Mailbox) async throws
143+
func aiShortcut(contextId: String, shortcut: AIShortcutAction, mailbox: Mailbox) async throws
144144
-> AIShortcutResponse
145145

146146
func aiShortcutAndRecreateConversation(
147147
shortcut: AIShortcutAction,
148148
messages: [AIMessage],
149149
output: AIOutputFormat,
150-
engine: AIEngine,
151150
mailbox: Mailbox
152151
) async throws
153152
-> AIShortcutResponse

MailCore/API/MailApiFetcher/MailApiFetcher+AI.swift

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,40 +42,36 @@ public extension MailApiFetcher {
4242
func aiCreateConversation(
4343
messages: [AIMessage],
4444
output: AIOutputFormat = .mail,
45-
engine: AIEngine,
4645
mailbox: Mailbox
4746
) async throws -> AIConversationResponse {
4847
try await perform(request: authenticatedAIRequest(
4948
.ai(mailbox: mailbox),
5049
method: .post,
51-
parameters: AIConversationRequest(messages: messages, output: output, engine: engine)
50+
parameters: AIConversationRequest(messages: messages, output: output)
5251
))
5352
}
5453

5554
func aiShortcut(
5655
contextId: String,
5756
shortcut: AIShortcutAction,
58-
engine: AIEngine,
5957
mailbox: Mailbox
6058
) async throws -> AIShortcutResponse {
6159
try await perform(request: authenticatedRequest(
6260
.aiShortcut(contextId: contextId, shortcut: shortcut.apiName, mailbox: mailbox),
63-
method: .patch,
64-
parameters: AIShortcutRequest(engine: engine)
61+
method: .patch
6562
))
6663
}
6764

6865
func aiShortcutAndRecreateConversation(
6966
shortcut: AIShortcutAction,
7067
messages: [AIMessage],
7168
output: AIOutputFormat = .mail,
72-
engine: AIEngine,
7369
mailbox: Mailbox
7470
) async throws -> AIShortcutResponse {
7571
try await perform(request: authenticatedAIRequest(
7672
.aiShortcut(shortcut: shortcut.apiName, mailbox: mailbox),
7773
method: .post,
78-
parameters: AIConversationRequest(messages: messages, output: output, engine: engine)
74+
parameters: AIConversationRequest(messages: messages, output: output)
7975
))
8076
}
8177
}

0 commit comments

Comments
 (0)