mirror of
https://github.com/Ferrite-iOS/Ferrite.git
synced 2026-04-04 00:40:50 +00:00
Fix how default actions are picked and add in default app actions as options for both debrid and magnet defaults. Kodi shows the action choice sheet with the DisclosureGroup dropped down. The new Kodi server framework also wasn't implemented in the Kodi wrapper. Fix that. Finally, add some iOS 14 fixes and repair the autocorrect search setting to actually work. Signed-off-by: kingbri <bdashore3@proton.me>
36 lines
894 B
Swift
36 lines
894 B
Swift
//
|
|
// CodableWrapper.swift
|
|
// Ferrite
|
|
//
|
|
// Created by Brian Dashore on 3/20/23.
|
|
//
|
|
// From https://forums.swift.org/t/rawrepresentable-conformance-leads-to-crash/51912/4
|
|
// Prevents recursion when using Codable with RawRepresentable without needing manual conformance
|
|
|
|
import Foundation
|
|
|
|
struct CodableWrapper<Value: Codable> {
|
|
var value: Value
|
|
}
|
|
|
|
extension CodableWrapper: RawRepresentable {
|
|
var rawValue: String {
|
|
guard
|
|
let data = try? JSONEncoder().encode(value),
|
|
let string = String(data: data, encoding: .utf8)
|
|
else {
|
|
return ""
|
|
}
|
|
return string
|
|
}
|
|
|
|
init?(rawValue: String) {
|
|
guard
|
|
let data = rawValue.data(using: .utf8),
|
|
let decoded = try? JSONDecoder().decode(Value.self, from: data)
|
|
else {
|
|
return nil
|
|
}
|
|
value = decoded
|
|
}
|
|
}
|