mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Add OS acknowledgements to iOS app
This commit is contained in:
parent
05709ee31a
commit
c0c61f311f
@ -18,7 +18,10 @@ class WriteFreelyModel: ObservableObject {
|
||||
@Published var isPresentingSettingsView: Bool = false
|
||||
#endif
|
||||
|
||||
// swiftlint:disable line_length
|
||||
let helpURL = URL(string: "https://discuss.write.as/c/help/5")!
|
||||
let licensesURL = URL(string: "https://github.com/writeas/writefreely-swiftui-multiplatform/tree/main/Shared/Resources/Licenses")!
|
||||
// swiftlint:enable line_length
|
||||
|
||||
private var client: WFClient?
|
||||
private let defaults = UserDefaults.standard
|
||||
@ -349,7 +352,6 @@ private extension WriteFreelyModel {
|
||||
kSecAttrAccount as String: username ?? "anonymous",
|
||||
kSecAttrService as String: server
|
||||
]
|
||||
|
||||
let status = SecItemAdd(query as CFDictionary, nil)
|
||||
guard status == errSecDuplicateItem || status == errSecSuccess else {
|
||||
fatalError("Error storing in Keychain with OSStatus: \(status)")
|
||||
@ -362,7 +364,6 @@ private extension WriteFreelyModel {
|
||||
kSecAttrAccount as String: username ?? "anonymous",
|
||||
kSecAttrService as String: server
|
||||
]
|
||||
|
||||
let status = SecItemDelete(query as CFDictionary)
|
||||
guard status == errSecSuccess || status == errSecItemNotFound else {
|
||||
fatalError("Error deleting from Keychain with OSStatus: \(status)")
|
||||
@ -378,23 +379,19 @@ private extension WriteFreelyModel {
|
||||
kSecReturnAttributes as String: true,
|
||||
kSecReturnData as String: true
|
||||
]
|
||||
|
||||
var secItem: CFTypeRef?
|
||||
let status = SecItemCopyMatching(query as CFDictionary, &secItem)
|
||||
guard status != errSecItemNotFound else {
|
||||
return nil
|
||||
}
|
||||
|
||||
guard status == errSecSuccess else {
|
||||
fatalError("Error fetching from Keychain with OSStatus: \(status)")
|
||||
}
|
||||
|
||||
guard let existingSecItem = secItem as? [String: Any],
|
||||
let tokenData = existingSecItem[kSecValueData as String] as? Data,
|
||||
let token = String(data: tokenData, encoding: .utf8) else {
|
||||
return nil
|
||||
}
|
||||
|
||||
return token
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,28 @@ struct SettingsView: View {
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
Section(header: Text("Acknowledgements")) {
|
||||
VStack {
|
||||
VStack(alignment: .leading) {
|
||||
Text("This application makes use of the following open-source projects:")
|
||||
.padding(.bottom)
|
||||
Text("• Lora typeface")
|
||||
.padding(.leading)
|
||||
Text("• Open Sans typeface")
|
||||
.padding(.leading)
|
||||
Text("• Hack typeface")
|
||||
.padding(.leading)
|
||||
}
|
||||
.padding(.bottom)
|
||||
.foregroundColor(.secondary)
|
||||
HStack {
|
||||
Spacer()
|
||||
Link("View the licenses", destination: model.licensesURL)
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
}
|
||||
// .preferredColorScheme(preferences.selectedColorScheme) // See PreferencesModel for info.
|
||||
|
Loading…
Reference in New Issue
Block a user