Add OperatingArea and PilotCertification modules with live push readiness.
Migrate operating area and pilot certification from home placeholders, extend Live with playback and push readiness flows, and add pilot certificate OSS upload. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -9,6 +9,18 @@ import Foundation
|
||||
|
||||
/// 表单校验工具,承接排队设置等页面的通用数字和金额格式校验。
|
||||
enum AppFormValidator {
|
||||
/// 规范化大陆手机号,去除所有空白字符。
|
||||
static func normalizedPhoneNumber(_ value: String) -> String {
|
||||
value.filter { !$0.isWhitespace }
|
||||
}
|
||||
|
||||
/// 校验大陆 11 位手机号基础号段。
|
||||
static func isValidMainlandPhoneNumber(_ value: String) -> Bool {
|
||||
let phone = normalizedPhoneNumber(value)
|
||||
guard phone.count == 11, phone.first == "1" else { return false }
|
||||
return phone.allSatisfy(\.isNumber)
|
||||
}
|
||||
|
||||
/// 校验整数文本在指定范围内。
|
||||
static func rangedInteger(_ text: String, name: String, range: ClosedRange<Int>) throws -> Int {
|
||||
let trimmed = text.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
|
||||
Reference in New Issue
Block a user