49 lines
1.4 KiB
Swift
49 lines
1.4 KiB
Swift
//
|
||
// AgreementPage.swift
|
||
// suixinkan
|
||
//
|
||
|
||
import Foundation
|
||
|
||
/// 协议和说明页面枚举,描述设置中心可打开的 H5 页面。
|
||
enum AgreementPage: Hashable, Identifiable {
|
||
case about
|
||
case userAgreement
|
||
case privacyPolicy
|
||
case walletUserNotice
|
||
case walletPrivacy
|
||
|
||
var id: String { title }
|
||
|
||
/// 页面导航标题。
|
||
var title: String {
|
||
switch self {
|
||
case .about: "关于我们"
|
||
case .userAgreement: "用户协议"
|
||
case .privacyPolicy: "隐私政策"
|
||
case .walletUserNotice: "钱包用户须知"
|
||
case .walletPrivacy: "钱包隐私政策"
|
||
}
|
||
}
|
||
|
||
/// 页面对应的 H5 地址。
|
||
var url: URL {
|
||
let path = switch self {
|
||
case .about: "/h5/app/about-us"
|
||
case .userAgreement: "/h5/app/user-agreement"
|
||
case .privacyPolicy: "/h5/app/privacy-policy"
|
||
case .walletUserNotice: "/h5/app/wallet-user-notice"
|
||
case .walletPrivacy: "/h5/app/wallet-privacy"
|
||
}
|
||
return APIEnvironment.current.baseURL.appending(path: path)
|
||
}
|
||
}
|
||
|
||
/// 设置展示策略,集中处理版本号等纯展示逻辑。
|
||
enum SettingsDisplayPolicy {
|
||
/// 生成页面显示的版本号。
|
||
nonisolated static func versionText(infoDictionary: [String: Any]? = Bundle.main.infoDictionary) -> String {
|
||
AppClientInfo.appVersion(infoDictionary: infoDictionary)
|
||
}
|
||
}
|