mirror of
https://github.com/block/buzz.git
synced 2026-10-28 21:11:48 +00:00
Age-check errors previously blocked Buzz startup. Normal app startup now proceeds immediately; only a valid under-18 response from the current launch request can restrict access. Age check enforcement remains disabled at compile time by default. Builds can opt in with `--dart-define=BUZZ_AGE_GATING_ENABLED=true`. --------- Signed-off-by: Tom Brow <tomb@block.xyz>
14 lines
673 B
Swift
14 lines
673 B
Swift
import Foundation
|
|
|
|
/// Converts Apple's age gates to the inclusive upper age used by Flutter.
|
|
public enum BuzzAgeSignalPayload {
|
|
/// Apple's upper bound is the gate the person is under; nil means unbounded.
|
|
public static func sharing(exclusiveUpperBound: Int?, lowerBound: Int? = nil) -> [String: Any] {
|
|
// Buzz requests only the 18-year gate. Unexpected bounds are not evidence
|
|
// of minority; never subtract an unvalidated integer (including Int.min).
|
|
let validLower = lowerBound.map { $0 >= 0 && $0 < 18 } ?? true
|
|
let ageUpper: Any = exclusiveUpperBound == 18 && validLower ? 17 : NSNull()
|
|
return ["status": "signal", "ageUpper": ageUpper]
|
|
}
|
|
}
|