2022-09-10 19:46:05 +02:00
|
|
|
//
|
|
|
|
// InstanceURL.swift
|
|
|
|
// LiTranslate
|
|
|
|
//
|
|
|
|
// Created by Viktor Kalyniuk on 22.08.2022.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
class InstanceURL: ObservableObject {
|
|
|
|
@AppStorage(Keys.libreTranslateDefaultURL) var defaultURL: Links.LibreTranslateMirrors = Links.LibreTranslateMirrors.de
|
|
|
|
@AppStorage(Keys.libreTranslateSelfHostURL) var selfHostURL: String = ""
|
2023-08-23 12:06:15 +02:00
|
|
|
@AppStorage(Keys.libreTranslateSelfHostKey) var selfHostKey: String = ""
|
2022-09-10 19:46:05 +02:00
|
|
|
|
|
|
|
func getURL() -> String {
|
|
|
|
if selfHostURL.isEmpty {
|
|
|
|
return defaultURL.rawValue
|
|
|
|
}
|
|
|
|
|
|
|
|
return selfHostURL
|
|
|
|
}
|
2023-08-23 12:06:15 +02:00
|
|
|
|
|
|
|
func getKey() -> String {
|
|
|
|
return selfHostKey
|
|
|
|
}
|
2022-09-10 19:46:05 +02:00
|
|
|
}
|