mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-06-02 21:39:36 +00:00
Allow for the use of an User API Key as fallback
The DeepL fallback is reinstated if the user has put in their own API Key
This commit is contained in:
parent
b4a1b09864
commit
643ad75506
|
@ -87,7 +87,6 @@
|
|||
9F7D93942980063100EE6B7A /* AppAccount in Frameworks */ = {isa = PBXBuildFile; productRef = 9F7D93932980063100EE6B7A /* AppAccount */; };
|
||||
9F7D939A29805DBD00EE6B7A /* AccountSettingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F7D939929805DBD00EE6B7A /* AccountSettingView.swift */; };
|
||||
9FA6FD6229C04A8800E2312C /* TranslationSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FA6FD6129C04A8800E2312C /* TranslationSettingsView.swift */; };
|
||||
9FAD85832971BF7200496AB1 /* Secret.plist in Resources */ = {isa = PBXBuildFile; fileRef = 9FAD85822971BF7200496AB1 /* Secret.plist */; };
|
||||
9FAD858B29743F7400496AB1 /* ShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FAD858A29743F7400496AB1 /* ShareViewController.swift */; };
|
||||
9FAD858E29743F7400496AB1 /* (null) in Resources */ = {isa = PBXBuildFile; };
|
||||
9FAD859229743F7400496AB1 /* IceCubesShareExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 9FAD858829743F7400496AB1 /* IceCubesShareExtension.appex */; platformFilters = (ios, maccatalyst, ); settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
|
@ -271,7 +270,6 @@
|
|||
9F7D939529800B0300EE6B7A /* IceCubesApp-release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "IceCubesApp-release.xcconfig"; sourceTree = "<group>"; };
|
||||
9F7D939929805DBD00EE6B7A /* AccountSettingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountSettingView.swift; sourceTree = "<group>"; };
|
||||
9FA6FD6129C04A8800E2312C /* TranslationSettingsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TranslationSettingsView.swift; sourceTree = "<group>"; };
|
||||
9FAD85822971BF7200496AB1 /* Secret.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Secret.plist; sourceTree = "<group>"; };
|
||||
9FAD858829743F7400496AB1 /* IceCubesShareExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = IceCubesShareExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9FAD858A29743F7400496AB1 /* ShareViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareViewController.swift; sourceTree = "<group>"; };
|
||||
9FAD858F29743F7400496AB1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
|
@ -602,7 +600,6 @@
|
|||
9FAE4AC8293774FF00772766 /* Info.plist */,
|
||||
9F398AB429360A5800A889F2 /* App */,
|
||||
9F398AB529360A6100A889F2 /* Resources */,
|
||||
9FAD85822971BF7200496AB1 /* Secret.plist */,
|
||||
);
|
||||
path = IceCubesApp;
|
||||
sourceTree = "<group>";
|
||||
|
@ -960,7 +957,6 @@
|
|||
9F18801829AE477F00D85459 /* favorite.wav in Resources */,
|
||||
9F24EEB829360C330042359D /* Preview Assets.xcassets in Resources */,
|
||||
069709A8298C87B5006E4CB5 /* OpenDyslexic-Regular.otf in Resources */,
|
||||
9FAD85832971BF7200496AB1 /* Secret.plist in Resources */,
|
||||
9F18801229AE477F00D85459 /* tabSelection.wav in Resources */,
|
||||
9F18801429AE477F00D85459 /* bookmark.wav in Resources */,
|
||||
9F18801629AE477F00D85459 /* refresh.wav in Resources */,
|
||||
|
|
|
@ -110,6 +110,9 @@ struct TranslationSettingsView: View {
|
|||
{
|
||||
Section {
|
||||
Text("settings.translation.api-key-still-stored")
|
||||
if preferences.preferredTranslationType == .useServerIfPossible {
|
||||
Text("It can however still be used as a fallback for your instance's translation service.")
|
||||
}
|
||||
Button(role: .destructive) {
|
||||
withAnimation {
|
||||
writeNewValue(value: "")
|
||||
|
|
|
@ -32513,6 +32513,20 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"It can however still be used as a fallback for your instance's translation service." : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
"de" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Er kann aber auch als Fallback für den Übersetzungsservice deiner Instanz dienen."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Key" : {
|
||||
"extractionState" : "manual"
|
||||
},
|
||||
"list.edit.isExclusive" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
|
|
|
@ -40,6 +40,7 @@ import SwiftUI
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
var deeplTranslationError = false
|
||||
var instanceTranslationError = false
|
||||
|
||||
|
@ -318,13 +319,19 @@ import SwiftUI
|
|||
isLoadingTranslation = true
|
||||
}
|
||||
if preferredTranslationType != .useDeepl {
|
||||
let translation: Translation? = try? await client.post(endpoint: Statuses.translate(id: finalStatus.id,
|
||||
let translation: Translation? = try? await client.post(endpoint: Statuses.translate(id: finalStatus.id,
|
||||
lang: userLang))
|
||||
withAnimation {
|
||||
self.translation = translation
|
||||
isLoadingTranslation = false
|
||||
}
|
||||
|
||||
if translation == nil {
|
||||
await translateWithDeepL(userLang: userLang)
|
||||
} else {
|
||||
withAnimation {
|
||||
self.translation = translation
|
||||
isLoadingTranslation = false
|
||||
}
|
||||
}
|
||||
|
||||
if self.translation == nil {
|
||||
instanceTranslationError = true
|
||||
}
|
||||
} else {
|
||||
|
@ -356,7 +363,7 @@ import SwiftUI
|
|||
}
|
||||
|
||||
private var userAPIKey: String? {
|
||||
DeepLUserAPIHandler.readKeyIfAllowed()
|
||||
DeepLUserAPIHandler.readKey()
|
||||
}
|
||||
|
||||
func updatePreferredTranslation() {
|
||||
|
|
Loading…
Reference in a new issue