fix(content): 성인 콘텐츠 설정 동기화와 국가별 인증 분기를 적용한다
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import Foundation
|
||||
|
||||
struct UpdateContentPreferenceResponse: Decodable {
|
||||
let isAdultContentVisible: Bool
|
||||
let contentType: ContentType
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case isAdultContentVisible
|
||||
case contentType
|
||||
}
|
||||
|
||||
init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
|
||||
isAdultContentVisible = try container.decodeIfPresent(Bool.self, forKey: .isAdultContentVisible) ?? true
|
||||
|
||||
let rawContentType =
|
||||
try container
|
||||
.decodeIfPresent(String.self, forKey: .contentType)?
|
||||
.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
.uppercased()
|
||||
contentType = ContentType(rawValue: rawContentType ?? "") ?? .ALL
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user