mirror of
https://github.com/formbricks/formbricks.git
synced 2026-04-19 11:11:05 -05:00
fix: android sdk segment bug
This commit is contained in:
@@ -18,12 +18,6 @@ data class LanguageDetail(
|
||||
@SerializedName("projectId") val projectId: String
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class SurveyRecaptcha(
|
||||
@SerializedName("enabled") val enabled: Boolean,
|
||||
@SerializedName("threshold") val threshold: Double
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class Survey(
|
||||
@SerializedName("id") val id: String,
|
||||
@@ -37,5 +31,4 @@ data class Survey(
|
||||
@SerializedName("segment") val segment: Segment?,
|
||||
@SerializedName("styling") val styling: Styling?,
|
||||
@SerializedName("languages") val languages: List<SurveyLanguage>?,
|
||||
@SerializedName("recaptcha") val recaptcha: SurveyRecaptcha?
|
||||
)
|
||||
@@ -17,31 +17,6 @@ struct SurveyLanguage: Codable {
|
||||
}
|
||||
}
|
||||
|
||||
struct SurveyRecaptcha: Codable {
|
||||
let enabled: Bool
|
||||
let threshold: Double
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case enabled
|
||||
case threshold
|
||||
}
|
||||
|
||||
// Optional: enforce range at decode time
|
||||
init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
self.enabled = try container.decode(Bool.self, forKey: .enabled)
|
||||
let value = try container.decode(Double.self, forKey: .threshold)
|
||||
guard (0.1...0.9).contains(value) else {
|
||||
throw DecodingError.dataCorruptedError(
|
||||
forKey: .threshold,
|
||||
in: container,
|
||||
debugDescription: "threshold must be between 0.1 and 0.9"
|
||||
)
|
||||
}
|
||||
self.threshold = value
|
||||
}
|
||||
}
|
||||
|
||||
struct LanguageDetail: Codable {
|
||||
let id: String
|
||||
let code: String
|
||||
@@ -61,5 +36,4 @@ struct Survey: Codable {
|
||||
let segment: Segment?
|
||||
let styling: Styling?
|
||||
let languages: [SurveyLanguage]?
|
||||
let recaptcha: SurveyRecaptcha?
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user