diff --git a/apps/ios/ItemAtlas.xcodeproj/project.pbxproj b/apps/ios/ItemAtlas.xcodeproj/project.pbxproj index 87cb483..96f099a 100644 --- a/apps/ios/ItemAtlas.xcodeproj/project.pbxproj +++ b/apps/ios/ItemAtlas.xcodeproj/project.pbxproj @@ -117,7 +117,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 3; GENERATE_INFOPLIST_FILE = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ATLAS_API_BASE_URL = "https://api-atlas.tutudog.com"; @@ -138,7 +138,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 3; GENERATE_INFOPLIST_FILE = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ATLAS_API_BASE_URL = "https://api-atlas.tutudog.com"; diff --git a/apps/ios/ItemAtlas/Account.swift b/apps/ios/ItemAtlas/Account.swift index 92ad3be..e721987 100644 --- a/apps/ios/ItemAtlas/Account.swift +++ b/apps/ios/ItemAtlas/Account.swift @@ -63,9 +63,24 @@ private final class NoRedirects: NSObject, URLSessionTaskDelegate { @MainActor @Observable final class AtlasAccount { + enum SignInProgress { + case connecting + case authenticating + case finishing + + var title: String { + switch self { + case .connecting: "正在连接…" + case .authenticating: "等待登录…" + case .finishing: "正在完成登录…" + } + } + } + + private static let identityTimeout: TimeInterval = 15 private(set) var signedIn = false - private(set) var working = false - var error: String? + private(set) var signInProgress: SignInProgress? + private(set) var error: String? private let configuration = try? AtlasEndpoints() private let http: URLSession private var tokens: SessionTokens? @@ -89,10 +104,10 @@ final class AtlasAccount { } func signIn() async { - guard !working else { return } - working = true + guard signInProgress == nil else { return } + signInProgress = .connecting error = nil - defer { working = false } + defer { signInProgress = nil } do { guard let configuration else { throw AtlasError("登录服务地址未配置。") } let discovery = try await discover(configuration) @@ -110,7 +125,9 @@ final class AtlasAccount { ] guard let authorizationURL = url.url else { throw AtlasError("登录地址无效。") } // Ephemeral browser sessions let a different person sign in after switching accounts. + signInProgress = .authenticating let callback = try await browser.authenticate(authorizationURL) + signInProgress = .finishing let result = URLComponents(url: callback, resolvingAgainstBaseURL: false) let parameters = result?.queryItems ?? [] guard result?.scheme == AtlasEndpoints.scheme, result?.host == nil, @@ -125,6 +142,8 @@ final class AtlasAccount { ]) try save(grant, configuration: configuration) } catch ASWebAuthenticationSessionError.canceledLogin { + } catch is URLError { + error = "暂时连不上登录服务。请检查网络后重试。" } catch { self.error = error.localizedDescription } @@ -200,7 +219,9 @@ final class AtlasAccount { private func discover(_ configuration: AtlasEndpoints) async throws -> OIDCMetadata { if let metadata { return metadata } - let (body, response) = try await http.data(from: configuration.issuer.appending(path: ".well-known/openid-configuration")) + let request = URLRequest(url: configuration.issuer.appending(path: ".well-known/openid-configuration"), + timeoutInterval: Self.identityTimeout) + let (body, response) = try await http.data(for: request) guard (response as? HTTPURLResponse)?.statusCode == 200, let result = try? JSONDecoder().decode(OIDCMetadata.self, from: body), result.issuer == configuration.issuer, Self.sameOrigin(result.authorization_endpoint, result.issuer), Self.sameOrigin(result.token_endpoint, result.issuer), @@ -244,7 +265,7 @@ final class AtlasAccount { private static func form(_ url: URL, _ parameters: [String: String]) -> URLRequest { var form = URLComponents() form.queryItems = parameters.map { URLQueryItem(name: $0.key, value: $0.value) } - var request = URLRequest(url: url) + var request = URLRequest(url: url, timeoutInterval: identityTimeout) request.httpMethod = "POST" request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") request.httpBody = Data((form.percentEncodedQuery ?? "").replacingOccurrences(of: "+", with: "%2B").utf8) diff --git a/apps/ios/ItemAtlas/Assets.xcassets/WelcomeDrawer.imageset/Contents.json b/apps/ios/ItemAtlas/Assets.xcassets/WelcomeDrawer.imageset/Contents.json new file mode 100644 index 0000000..8687f3a --- /dev/null +++ b/apps/ios/ItemAtlas/Assets.xcassets/WelcomeDrawer.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "WelcomeDrawer.jpg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/apps/ios/ItemAtlas/Assets.xcassets/WelcomeDrawer.imageset/WelcomeDrawer.jpg b/apps/ios/ItemAtlas/Assets.xcassets/WelcomeDrawer.imageset/WelcomeDrawer.jpg new file mode 100644 index 0000000..e46ebfc Binary files /dev/null and b/apps/ios/ItemAtlas/Assets.xcassets/WelcomeDrawer.imageset/WelcomeDrawer.jpg differ diff --git a/apps/ios/ItemAtlas/ItemAtlasApp.swift b/apps/ios/ItemAtlas/ItemAtlasApp.swift index 4f77470..4c346dc 100644 --- a/apps/ios/ItemAtlas/ItemAtlasApp.swift +++ b/apps/ios/ItemAtlas/ItemAtlasApp.swift @@ -10,29 +10,7 @@ struct ItemAtlasApp: App { if account.signedIn { SpacesView(account: account) } else { - VStack(spacing: 18) { - Spacer() - Image("BrandMark") - .resizable().frame(width: 76, height: 76) - .clipShape(.rect(cornerRadius: 17)) - .accessibilityHidden(true) - Text("见物").font(.largeTitle.bold()) - Text("记下家里的东西和它们的位置。").foregroundStyle(.secondary) - Spacer() - Button { - Task { await account.signIn() } - } label: { - if account.working { ProgressView().frame(maxWidth: .infinity) } - else { Text("登录").frame(maxWidth: .infinity) } - } - .buttonStyle(.borderedProminent) - .controlSize(.large) - .disabled(account.working) - if let error = account.error { - Text(error).font(.footnote).foregroundStyle(.red) - } - } - .padding(28) + WelcomeView(account: account) } } .tint(.atlasBlue) diff --git a/apps/ios/ItemAtlas/WelcomeView.swift b/apps/ios/ItemAtlas/WelcomeView.swift new file mode 100644 index 0000000..b490419 --- /dev/null +++ b/apps/ios/ItemAtlas/WelcomeView.swift @@ -0,0 +1,181 @@ +import SwiftUI + +struct WelcomeView: View { + let account: AtlasAccount + @Environment(\.colorScheme) private var colorScheme + @ScaledMetric(relativeTo: .largeTitle) private var headlineSize = 38.0 + @State private var showingGuide = false + @AccessibilityFocusState private var errorFocused: Bool + + private var canvas: Color { + colorScheme == .dark ? Color(uiColor: .systemBackground) : Color(red: 0.976, green: 0.969, blue: 0.951) + } + + var body: some View { + ScrollView { + VStack(alignment: .leading, spacing: 22) { + HStack(spacing: 9) { + Image("BrandMark") + .resizable() + .frame(width: 32, height: 32) + .clipShape(.rect(cornerRadius: 8)) + .accessibilityHidden(true) + Text("见物") + .font(.headline) + } + + VStack(alignment: .leading, spacing: 9) { + Text("放在哪里,\n一找就知道。") + .font(.system(size: headlineSize, weight: .bold)) + .accessibilityAddTraits(.isHeader) + Text("记下家里的东西和位置,下次需要时,搜一下就能找到。") + .font(.subheadline) + .foregroundStyle(.primary.opacity(0.72)) + } + + Color.atlasBlue.opacity(0.08) + .aspectRatio(1.9, contentMode: .fit) + .overlay { + GeometryReader { geometry in + Image("WelcomeDrawer") + .resizable() + .scaledToFill() + .frame(width: geometry.size.width, height: geometry.size.height) + } + } + .clipShape(.rect(cornerRadius: 21)) + .accessibilityHidden(true) + + VStack(alignment: .leading, spacing: 13) { + WelcomeFeature(symbol: "magnifyingglass", title: "搜名字就能找", + detail: "从房间到抽屉,顺着位置就能拿到。") + Divider().padding(.leading, 50) + WelcomeFeature(symbol: "square.and.pencil", title: "一次记几件", + detail: "把整理时记下的话变成草稿,核对后再保存。") + Divider().padding(.leading, 50) + WelcomeFeature(symbol: "person.2", title: "和家人一起找", + detail: "用邀请码加入同一个空间。") + } + } + .fixedSize(horizontal: false, vertical: true) + .frame(maxWidth: 472, alignment: .leading) + .padding(.horizontal, 24) + .padding(.top, 12) + .padding(.bottom, 20) + .frame(maxWidth: .infinity) + } + .safeAreaInset(edge: .bottom, spacing: 0) { + actions + } + .background(canvas.ignoresSafeArea()) + .sheet(isPresented: $showingGuide) { + WelcomeGuide() + } + .onChange(of: account.error) { _, error in + if error != nil { errorFocused = true } + } + } + + private var actions: some View { + VStack(spacing: 5) { + if let error = account.error { + Label(error, systemImage: "exclamationmark.circle") + .font(.footnote) + .foregroundStyle(.primary) + .frame(maxWidth: .infinity, alignment: .leading) + .padding(12) + .background(.thinMaterial, in: .rect(cornerRadius: 12)) + .accessibilityFocused($errorFocused) + .padding(.bottom, 4) + } + + Button { + Task { await account.signIn() } + } label: { + HStack(spacing: 9) { + if let progress = account.signInProgress { + ProgressView().tint(.white).accessibilityHidden(true) + Text(progress.title) + } else { + Text(account.error == nil ? "登录我的空间" : "重试登录") + Image(systemName: "arrow.right") + .font(.subheadline.weight(.semibold)) + .accessibilityHidden(true) + } + } + .font(.body.weight(.semibold)) + .frame(maxWidth: .infinity, minHeight: 29) + } + .buttonStyle(.borderedProminent) + .buttonBorderShape(.roundedRectangle(radius: 15)) + .controlSize(.large) + .disabled(account.signInProgress != nil) + + Button("看看怎么用") { showingGuide = true } + .font(.subheadline.weight(.semibold)) + .frame(minHeight: 44) + .disabled(account.signInProgress != nil) + } + .frame(maxWidth: 472) + .padding(.horizontal, 24) + .padding(.top, 10) + .frame(maxWidth: .infinity) + .background(canvas) + .overlay(alignment: .top) { Divider() } + } +} + +private struct WelcomeFeature: View { + let symbol: String + let title: String + let detail: String + @Environment(\.colorScheme) private var colorScheme + + private var iconColor: Color { + colorScheme == .dark ? Color(red: 0.58, green: 0.67, blue: 1) : .atlasBlue + } + + var body: some View { + HStack(alignment: .top, spacing: 12) { + Image(systemName: symbol) + .font(.system(size: 17, weight: .medium)) + .foregroundStyle(iconColor) + .frame(width: 38, height: 38) + .background(iconColor.opacity(0.12), in: .rect(cornerRadius: 12)) + .accessibilityHidden(true) + VStack(alignment: .leading, spacing: 3) { + Text(title).font(.subheadline.weight(.semibold)) + Text(detail).font(.footnote).foregroundStyle(.primary.opacity(0.72)) + } + } + .accessibilityElement(children: .combine) + } +} + +private struct WelcomeGuide: View { + @Environment(\.dismiss) private var dismiss + + var body: some View { + NavigationStack { + ScrollView { + VStack(alignment: .leading, spacing: 24) { + WelcomeFeature(symbol: "tray", title: "整理时记下位置", + detail: "给常用物品写下名称和位置。一次整理了好几件,也可以先生成草稿,再逐件核对。") + WelcomeFeature(symbol: "magnifyingglass", title: "需要时搜一下", + detail: "可以搜物品的名字,也可以搜平时的叫法。结果会显示它放在哪个房间、哪层柜子。") + WelcomeFeature(symbol: "person.2", title: "跟家人用同一个空间", + detail: "登录后可以新建自己的空间,也可以用邀请码加入家人的空间。") + } + .frame(maxWidth: .infinity, alignment: .leading) + .padding(24) + } + .navigationTitle("怎么用见物") + .navigationBarTitleDisplayMode(.inline) + .toolbar { + ToolbarItem(placement: .confirmationAction) { + Button("完成") { dismiss() } + } + } + } + } +} diff --git a/apps/ios/README.md b/apps/ios/README.md index 6e2f49d..53cf2c6 100644 --- a/apps/ios/README.md +++ b/apps/ios/README.md @@ -4,7 +4,9 @@ ## 登录与空间 -启动后进入登录。登录由系统浏览器打开 Keycloak,授权码通过 `com.tutudog.itematlas:/oauth2/callback` 返回,使用 S256 PKCE。App 把会话凭证保存在设备钥匙串。物品、位置与收藏由服务端按账号和空间返回。首次登录可新建空间或使用邀请码。新空间显示空状态,旧演示文件留在原设备上,不会写入账户。 +未登录时展示首页和使用说明,两者都可以离线查看。点「登录我的空间」后,App 显示连接和完成登录的状态,随后进入当前账号的空间。取消会回到首页,连接失败可重试。 + +登录用 iOS 系统认证窗口打开 Keycloak,授权码通过 `com.tutudog.itematlas:/oauth2/callback` 返回,使用 S256 PKCE。App 把会话凭证保存在设备钥匙串。物品、位置与收藏由服务端按账号和空间返回。首次登录可新建空间或使用邀请码,新空间显示空状态。 [首页与登录设计](../../docs/ui/ios-welcome.md) 构建时可用 `ATLAS_API_BASE_URL` 和 `ATLAS_OIDC_ISSUER` 覆盖默认 HTTPS 地址。新环境须先登记 `atlas-ios` 原生客户端和精确回调,配套 issuer、audience 和服务端校验。参见 [身份和图片部署](../../docs/deployment/identity-and-media.md)。 如果点登录时提示服务请求失败,先检查 [公网解析、登录发现地址和网关](../../docs/deployment/identity-and-media.md#ios-公网连通性验收)。 diff --git a/deploy/public/README.md b/deploy/public/README.md index 8054d82..5a84e21 100644 --- a/deploy/public/README.md +++ b/deploy/public/README.md @@ -17,6 +17,13 @@ python3 deploy/public/prepare-secrets.py "$ATLAS_SECRET_DIR" \ 这些文件用于初始化。已有环境的 Keycloak realm、账号和数据库密码由运行中的服务维护。备份与恢复时,以当前数据库、图片桶和现用 Secret 为准。 ```sh +theme=deploy/public/keycloak/jianwu/login +kubectl -n item-atlas-public create configmap atlas-public-login-theme \ + --from-file="$theme/theme.properties" --from-file="$theme/messages/messages_zh_CN.properties" \ + --from-file="$theme/messages/messages_en.properties" --from-file="$theme/resources/css/jianwu.css" \ + --from-file=brand.png=apps/ios/ItemAtlas/Assets.xcassets/BrandMark.imageset/BrandMark.png \ + --dry-run=client -o yaml | kubectl -n item-atlas-public apply --server-side \ + --field-manager=item-atlas-login-theme -f - kubectl -n item-atlas-public apply -f deploy/public/base.yaml kubectl -n item-atlas-public rollout status deployment/atlas-keycloak --timeout=5m helm upgrade --install item-atlas deploy/helm/item-atlas -n item-atlas-public \ @@ -26,6 +33,8 @@ helm upgrade --install item-atlas deploy/helm/item-atlas -n item-atlas-public \ `ATLAS_PUBLISHED_SHA` 取已成功发布镜像的 Drone 构建标识。公网预览使用同一 Helm chart。初次建立该环境时,运行上述 Helm 命令并验收,再配置公网域名。切换版本前先记录当前修订和三个镜像摘要。 +`jianwu` 主题继承 Keycloak 26.8.2 的 `keycloak.v2` 登录表单。首次导入会给 `atlas-ios` 设置 Login theme。已有 realm 在管理端打开 Clients → atlas-ios → Settings → Login theme,选择 `jianwu`。更新主题文件后重启 Keycloak Deployment 以刷新缓存。单副本重启期间登录入口会短暂中断。先检查主题文件和回调,再验收登录。遇到显示问题可把该客户端的 Login theme 恢复为默认。 [Keycloak 主题](https://www.keycloak.org/ui-customization/themes) + ## 转发和验收 在集群里用 FRP 客户端直连 `svc/item-atlas-gateway` 和 `svc/atlas-keycloak`。将 `frpc.toml.template` 渲染为受控文件,其中两条 STCP 各用独立密钥。云端 visitor 使用匹配的名称和密钥,只监听 Nginx 容器可达的私有网桥,由 systemd 管理。 diff --git a/deploy/public/base.yaml b/deploy/public/base.yaml index 8ee8206..127cd32 100644 --- a/deploy/public/base.yaml +++ b/deploy/public/base.yaml @@ -126,7 +126,7 @@ spec: - secretRef: {name: atlas-public-keycloak} resources: requests: {cpu: 125m, memory: 384Mi} - limits: {cpu: '1', memory: 672Mi} + limits: {cpu: '1', memory: 768Mi} startupProbe: httpGet: {path: /health/started, port: management} periodSeconds: 5 @@ -137,6 +137,16 @@ spec: timeoutSeconds: 3 volumeMounts: - {name: realm, mountPath: /opt/keycloak/data/import, readOnly: true} + - {name: login-theme, mountPath: /opt/keycloak/themes/jianwu/login, readOnly: true} volumes: - name: realm secret: {secretName: atlas-public-realm} + - name: login-theme + configMap: + name: atlas-public-login-theme + items: + - {key: theme.properties, path: theme.properties} + - {key: messages_zh_CN.properties, path: messages/messages_zh_CN.properties} + - {key: messages_en.properties, path: messages/messages_en.properties} + - {key: jianwu.css, path: resources/css/jianwu.css} + - {key: brand.png, path: resources/img/brand.png} diff --git a/deploy/public/keycloak/jianwu/login/messages/messages_en.properties b/deploy/public/keycloak/jianwu/login/messages/messages_en.properties new file mode 100644 index 0000000..9869de5 --- /dev/null +++ b/deploy/public/keycloak/jianwu/login/messages/messages_en.properties @@ -0,0 +1,3 @@ +loginTitle=Item Atlas +loginTitleHtml=Item Atlas +loginAccountTitle=Sign in to your space diff --git a/deploy/public/keycloak/jianwu/login/messages/messages_zh_CN.properties b/deploy/public/keycloak/jianwu/login/messages/messages_zh_CN.properties new file mode 100644 index 0000000..6919a7a --- /dev/null +++ b/deploy/public/keycloak/jianwu/login/messages/messages_zh_CN.properties @@ -0,0 +1,3 @@ +loginTitle=见物 +loginTitleHtml=见物 +loginAccountTitle=登录我的空间 diff --git a/deploy/public/keycloak/jianwu/login/resources/css/jianwu.css b/deploy/public/keycloak/jianwu/login/resources/css/jianwu.css new file mode 100644 index 0000000..83218f8 --- /dev/null +++ b/deploy/public/keycloak/jianwu/login/resources/css/jianwu.css @@ -0,0 +1,104 @@ +:root { + --jianwu-canvas: #f9f7f2; + --jianwu-panel: #fff; + --jianwu-ink: #192239; + --jianwu-line: #d3d8e3; + --jianwu-blue: #304fd0; + --jianwu-blue-hover: #233eb4; + --jianwu-focus: #304fd0; +} + +.pf-v5-theme-dark { + --jianwu-canvas: #151821; + --jianwu-panel: #202633; + --jianwu-ink: #f4f6fb; + --jianwu-line: #555e71; + --jianwu-focus: #adc0ff; +} + +.login-pf body#keycloak-bg, +body#keycloak-bg .pf-v5-c-login { + background: var(--jianwu-canvas); + color: var(--jianwu-ink); + font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; +} + +body#keycloak-bg .pf-v5-c-login__container { + width: min(calc(100% - 36px), 420px); + margin-inline: auto; + padding-block: clamp(24px, 7vh, 64px); + grid-template-columns: minmax(0, 1fr); + align-content: start; +} + +body#keycloak-bg #kc-header { + margin: 0 0 18px; + padding: 0; +} + +body#keycloak-bg #kc-header-wrapper { + display: flex; + align-items: center; + gap: 10px; + color: var(--jianwu-ink) !important; + font-size: 18px; + font-weight: 650; + letter-spacing: 0; + text-align: start; + text-transform: none; +} + +body#keycloak-bg #kc-header-wrapper::before { + content: ""; + flex: 0 0 34px; + height: 34px; + border-radius: 9px; + background: url("../img/brand.png") center / cover; +} + +body#keycloak-bg .pf-v5-c-login__main { + min-width: 0; + overflow: hidden; + border: 1px solid var(--jianwu-line); + border-radius: 22px; + background: var(--jianwu-panel); + color: var(--jianwu-ink); + box-shadow: none; +} + +body#keycloak-bg .pf-v5-c-login__main-header { + padding: 22px 20px 14px; + border-top: 0; +} + +body#keycloak-bg #kc-page-title { + font-size: 1.45rem; + font-weight: 700; + line-height: 1.35; +} + +body#keycloak-bg .pf-v5-c-login__main-body { + padding: 0 20px 24px; +} + +#kc-form-login .pf-v5-c-form-control { + --pf-v5-c-form-control--FontSize: 1rem; +} + +#kc-form-login :is(input:not([type="hidden"]), button) { + min-height: 44px; +} + +#kc-form-login .pf-v5-c-button.pf-m-primary { + --pf-v5-c-button--m-primary--BackgroundColor: var(--jianwu-blue); + --pf-v5-c-button--m-primary--hover--BackgroundColor: var(--jianwu-blue-hover); + --pf-v5-c-button--m-primary--focus--BackgroundColor: var(--jianwu-blue-hover); + --pf-v5-c-button--m-primary--active--BackgroundColor: var(--jianwu-blue-hover); + border-radius: 12px; + font-weight: 650; +} + +#kc-form-login :is(input, button):focus-visible { + outline: 2px solid var(--jianwu-focus); + outline-offset: 2px; +} diff --git a/deploy/public/keycloak/jianwu/login/theme.properties b/deploy/public/keycloak/jianwu/login/theme.properties new file mode 100644 index 0000000..96e93ed --- /dev/null +++ b/deploy/public/keycloak/jianwu/login/theme.properties @@ -0,0 +1,3 @@ +parent=keycloak.v2 +import=common/keycloak +styles=css/styles.css css/jianwu.css diff --git a/deploy/public/prepare-secrets.py b/deploy/public/prepare-secrets.py index ff35d76..b07e20d 100644 --- a/deploy/public/prepare-secrets.py +++ b/deploy/public/prepare-secrets.py @@ -70,7 +70,8 @@ realm = {'realm': 'item-atlas', 'displayName': '见物', 'enabled': True, 'sslRe 'accessTokenLifespan': 300, 'internationalizationEnabled': True, 'supportedLocales': ['en', 'zh-CN'], 'defaultLocale': 'zh-CN', 'roles': {'realm': [{'name': 'atlas-space-admin'}]}, 'clientScopes': [profile, {'name': 'atlas.deliver', 'protocol': 'openid-connect', 'attributes': {'include.in.token.scope': 'true'}}], - 'clients': [native | {'redirectUris': ['com.tutudog.itematlas:/oauth2/callback']}, admin, + 'clients': [native | {'redirectUris': ['com.tutudog.itematlas:/oauth2/callback'], + 'attributes': native['attributes'] | {'login_theme': 'jianwu'}}, admin, {'clientId': 'atlas-intake', 'enabled': True, 'protocol': 'openid-connect', 'publicClient': False, 'clientAuthenticatorType': 'client-secret', 'secret': values['delivery'], 'standardFlowEnabled': False, 'directAccessGrantsEnabled': False, 'serviceAccountsEnabled': True, diff --git a/docs/deployment/backend-release.md b/docs/deployment/backend-release.md index 289ae4a..acd1520 100644 --- a/docs/deployment/backend-release.md +++ b/docs/deployment/backend-release.md @@ -28,6 +28,18 @@ Git 发布标签使用 `vMAJOR.MINOR.PATCH`。示例 `v0.1.0-rc.6` 中,`v` 是 常规开发把功能分支推到 Gitea,合并到 `main` 后,准备一批候选时再给已确认的提交打标签。Drone 的标签事件按 `refs/tags/...` 匹配。 [Drone 触发条件](https://docs.drone.io/pipeline/triggers/) +## 在哪里点部署 + +在 Drone 打开成功的**标签构建**,例如 [#23](https://drone.tutudog.com/dongjf/item-atlas/23),在构建操作菜单选择 **Promote**,目标填 `staging`。Drone 会另开一个构建号,打开那次运行即可看到 `deploy-staging → helm-upgrade`。工作 Mac 的 ARM64 runner 调用 Helm,Kubernetes 根据结果更新 Pod。集群控制台用于检查镜像、事件和就绪结果。 [Drone Promotion](https://docs.drone.io/promote/) + +| 目标环境 | Kubernetes 命名空间 | 发布方式 | +| --- | --- | --- | +| 内网预发布 | `item-atlas-staging` | 成功的候选标签 → Drone Promote 到 `staging`。 | +| iOS 公网预览 | `item-atlas-public` | 首次使用 #23 的三个镜像,经 SSD VM 内 Helm 建立。后续手动升级沿用已发布镜像和同一套公网 values。 [公网预览命令](../../deploy/public/README.md#应用和数据) | +| 正式环境 | `item-atlas` | 正式标签 → Drone Promote 到 `production`。需先准备该环境及其发布身份。 | + +公网预览和 iOS 安装包各有交付路径。只改 iOS 界面时,签名构建并更新设备上的 App 即可。后端改动先过内网预发布和请求验收,再选择版本升级公网预览。 + ## 从验证到部署 1. **CI 验证。** `backend-ci` 在 Linux AMD64 上检出源码,启动临时 PostgreSQL,执行 Java 21、Maven `verify` 和业务 API 冒烟。`build-admin` 使用 npm 锁文件构建 Vue 管理端。CI 使用 PostgreSQL 15 做兼容验证,部署环境用 PostgreSQL 17。 diff --git a/docs/product/requirements.md b/docs/product/requirements.md index 67a99a3..3584f69 100644 --- a/docs/product/requirements.md +++ b/docs/product/requirements.md @@ -16,6 +16,7 @@ ## 质量要求 +- iOS 首次打开可浏览产品首页和使用说明。登录后才请求账号空间。系统认证取消后能回到首页,连接失败可重试。 - 不确定的提交结果可通过操作状态查询。确认失败时留下可恢复的草稿。 - 用带名称、别名、位置和数量的演示数据验证,有实际运行结果后再填写命中率、耗时和人工修正数。 - 备份恢复后核对物品、位置、历史和关系。演示使用独立数据。 diff --git a/docs/testing/cases.md b/docs/testing/cases.md index f48145f..3908077 100644 --- a/docs/testing/cases.md +++ b/docs/testing/cases.md @@ -23,5 +23,7 @@ R01–R09 对应[需求与验收](../product/requirements.md)。实现和当前 | TC-17 照片裁剪和图片限制 | R09 | 选一张长图裁剪上传,分别读取清晰大图和缩略图。尝试上传超限或伪装格式的文件。 | 列表显示小图、详情显示裁剪结果,超限或不合法的图片被拒绝。 | | TC-18 删除及 OSS 清理 | R09 | 分别删除照片、物品和空间,另用后台删除有图片的空间。暂停对象存储再恢复。 | 访问立即失效,原图和缩略图最终都被删掉。存储故障期间可观察到重试。 | | TC-19 iOS 收起键盘 | 质量 | 在搜索、物品备注和批量录入分别输入中文,使用「收起键盘」。 | 键盘收起,已输入文字保留。 | +| TC-20 iOS 登录前和取消 | R01 | 在未登录状态打开 App,查看并关闭使用说明。发起登录,再在系统认证窗口取消。 | 首页和说明可浏览。连接时按钮提示进度,取消后恢复登录入口,未显示其他账号的空间。 | +| TC-21 iOS 登录连接失败后重试 | R01 | 重启未登录的 App,断网后点「登录我的空间」。恢复网络后点「重试登录」。 | 首页显示网络提示,重试时打开认证窗口。成功回调后进入当前账号空间。 | [测试与演示计划](plan.md) diff --git a/docs/ui/README.md b/docs/ui/README.md index ef2b329..ee6e788 100644 --- a/docs/ui/README.md +++ b/docs/ui/README.md @@ -6,6 +6,7 @@ - [本地预览](concept.html),用浏览器打开即可。移动网页展示找物和草稿审核,PC 展示位置目录、物品列表和详情。 - [H5 预览图](mobile-concept.png) · [PC 预览图](desktop-concept.png) +- [iOS 首页与登录](ios-welcome.md) - [低保真原型](wireframes.md) · [产品需求](../product/requirements.md) · [测试用例](../testing/cases.md) 找物列表采用小图和完整位置路径,柜子、收纳盒等末级位置加重显示。PC 左侧保留位置树,查看和移位可以在当前物品的详情里开始。草稿把待处理的内容放到最前面,用户仍可展开原话核对。录入按钮靠近移动端底部,待确认、可录入和跳过都用文字标明。 diff --git a/docs/ui/ios-welcome.md b/docs/ui/ios-welcome.md new file mode 100644 index 0000000..941123e --- /dev/null +++ b/docs/ui/ios-welcome.md @@ -0,0 +1,38 @@ +# iOS 首页与登录 + +打开见物,先说明它能帮人找回家里的东西。首页从上到下放小号品牌标识、标题、收纳场景照片和三条用途。底部是「登录我的空间」和「看看怎么用」。首页和使用说明可以在离线时打开。 + +```text + 见物 + + 放在哪里, + 一找就知道。 + 记下家里的东西和位置,下次需要时,搜一下就能找到。 + + [ 家里拉开的抽屉 ] + + 搜名字就能找 显示物品放在哪一层 + 一次记几件 整理好草稿再确认 + 和家人一起找 用邀请码加入同一个空间 + + [ 登录我的空间 ] + 看看怎么用 +``` + +## 首次打开 + +- 点「看看怎么用」打开原生说明页,介绍记录位置、搜索别名和邀请家人。关掉后回到首页。 +- 登录前的场景照片和使用说明是产品介绍。用户确认账号后才加载空间。新账号可新建或通过邀请码加入,空空间按空状态显示。 +- 背景用浅暖灰,按钮和图标沿用见物的蓝色。图片裁切保留抽屉主体。深色模式使用系统背景,标题、说明和按钮随 Dynamic Type 调整。小屏和大字号允许向下滚动。 + +## 登录过程 + +| 状态 | 用户看到的内容 | +| --- | --- | +| 点登录 | 底部按钮显示「正在连接…」,连接期间避免重复发起。 | +| 系统窗口打开 | 见物主题展示账号和密码输入框。Keycloak 校验凭据,用户可用系统的取消操作返回首页。 | +| 系统窗口关闭并回调 | App 显示「正在完成登录…」,随后进入用户的空间。 | +| 连接或验证失败 | 首页显示能看懂的原因,并提供「重试登录」。 | +| 取消 | 回到原入口,可以重新登录或继续查看使用说明。 | + +[UI 设计入口](README.md) · [iOS 验收用例](../testing/cases.md)