Skip to content

docs: describe current module boundaries - #5

Merged
aozijx merged 144 commits into
mainfrom
dev
Aug 13, 2026
Merged

aozijx merged 144 commits into
mainfrom
dev

Conversation

@aozijx

@aozijx aozijx commented Aug 13, 2026

Copy link
Copy Markdown
Owner

merge branch “dev”

aozijx added 30 commits July 28, 2026 00:09
- **核心 UI 与架构调整**
    - 引入 `PasslyAdaptiveLayout` 适配器,集中处理窗口宽度级别(Compact, Medium, Expanded),并在 `MainViewModel` 和 `Scaffold` 中应用响应式布局决策。
    - 集成 `MaterialExpressiveTheme` (Material 3 Expressive),支持更鲜明的形状、排版与动效方案。
    - 将 `LazyColumn` 列表重构为 `LazyVerticalGrid` 网格布局,优化大屏(平板/折叠屏)下的内容展示。

- **外观与界面设置增强**
    - **主题增强**:新增 `expressive` 主题开关,允许用户启用或禁用 Material 3 Expressive 动效与形状。
    - **语言管理优化**:重构 `AppLanguage` 模型,支持 BCP-47 标签并实现 Locale 自带的本地化名称显示,移除 ViewModel 中硬编码的资源映射。
    - **动态动画**:应用 `MaterialTheme.motionScheme` 统一管理 FAB 旋转、页面切换及组件可见性的动画规范。

- **功能组件优化**
    - **Vault 模块**:FAB 菜单支持 Expressive 尺寸调整;Entry 列表在宽屏模式下自动切换为多列网格。
    - **设置模块**:重构设置主页布局,在宽屏下采用双列显示;统一二级页面的宽度限制与边距。
    - **细节优化**:`MetadataSection` 现在使用本地化日期格式及字符串资源;增强了 `RoundedGroup` 组件在不同主题模式下的圆角适配。

- **代码清理与测试**
    - 新增 `AppLanguageTest` 验证语言标签转换逻辑。
    - 更新 `ProtoAppSettingsRepository` 以持久化 Expressive 模式设置。
    - 修正 `BackupExportOptionsTest` 中的枚举引用。
- **UI 风格自定义**
    - 新增 `InterfaceStyleConstraints`,支持自定义外圈圆角、组内圆角、卡片间距及内容留白。
    - 在外观设置中增加“圆角与间距”配置项,使用 `Slider` 控件支持精细化调整。
    - 重构 `RoundedGroup` 组件,使其默认从 `PasslyTheme` 读取圆角和间距参数,支持全局样式联动。

- **主题系统升级**
    - 引入 `ThemePalette` 模型,将单一主题色扩展为包含 primary、secondary、tertiary 的配色方案。
    - 优化配色应用逻辑,通过 `lerp` 算法让背景、表面及容器颜色自动混入强调色,提升界面色彩的一致性。
    - 更新 `ThemePicker`,支持三色预览卡片。

- **架构与数据层**
    - 引入 `ThemeTokens` 和 `PasslyTheme` 统一管理自定义设计令牌。
    - 在 `app_settings.proto` 和 `InterfaceSettings` 中新增圆角与间距相关的持久化字段。
    - 更新 `InterfaceViewModel` 和 `MainViewModel` 以处理新增的界面样式动作与状态流。

- **其他调整**
    - 重构 `AppTheme` Composable 以注入新的圆角参数及配色方案。
    - 完善多语言字符串支持(中、英、日),涵盖新增的界面配置项。
    - 增加 `ThemeTokensTest` 确保参数范围限制(Clamping)逻辑正确。
- **国际化与字符串资源化**
    - 针对备份/恢复、认证中心、安全设置、日志管理及自动填充等模块,将硬编码的中文字符串批量迁移至 `strings.xml`(包含中、英、日三语适配)。
    - 引入 `%1$d`、`%1$s` 等占位符优化时长显示(秒/分钟)和动态文本的国际化表达。

- **扫码功能(VaultScanner)优化**
    - **职责解耦**:将条目构建逻辑从 `VaultScanner` 迁移至 `VaultViewModel.addScannedOtp`,扫码器仅负责解析 `OtpConfig`。
    - **生命周期管理**:在 `ScannerView` 中引入 `ScannerCameraSession` 手动管理相机绑定与释放,修复潜在的内存泄漏与视图持有问题。
    - **UI 增强**:支持扫码时动态显示权限等待状态,优化扫描结果卡片的操作逻辑(点击复制或跳转链接)。

- **外观与主题系统(Appearance)改进**
    - **调色板扩展**:新增 `FallbackPalette` 枚举,支持在关闭动态色彩时选择蓝、绿、红、紫等多种内置预设色调。
    - **逻辑调整**:更新 `SettingsCommand.SelectManualThemeColor`,确保选择手动颜色时自动禁用动态色彩同步。
    - **性能优化**:在 `AppTheme` 中使用 `remember` 缓存调色板解析结果。

- **备份与通知系统重构**
    - **通知驱动**:移除 `BackupViewModel` 中的一次性 `Effect` 渠道,改用全局 `AppNoticePublisher` 发布备份成功/失败或目录权限检查结果的消息。
    - **状态简化**:精简 `BackupOperationStatus` 枚举,移除冗余的 Success 类型,由通知系统承接用户反馈。

- **代码清理与安全性增强**
    - **生命周期控制**:在 `PasslyNavHost` 的 `DetailScreen` 路由中,使用 `DisposableEffect` 确保退出详情页时清除敏感状态及剪贴板。
    - **交互逻辑简化**:移除多个 UI 组件(如 `SettingsMainPage`、`VaultScreen`)中冗余的全局点击事件回调。
    - **工具类移除**:删除 `LockTimeoutUtils.kt`,将其格式化逻辑迁移为 `LockAuthSettingsSection` 内部的 Compose 函数。
- **Totp 逻辑优化**
    - 在 `TotpCoordinator` 中引入会话解锁状态管理(`sessionUnlocked`),在会话锁定期间禁止验证码生成。
    - 增加对 `SessionLockedException` 的异常捕获,确保数据库锁定导致解密失败时能平滑处理并清除敏感状态。
    - 引入 `activeEntryIds` 追踪待激活的条目,支持在会话重新解锁后自动恢复 TOTP 计算。
    - 增加 `onSessionStateChanged` 方法,用于在会话状态切换时立即清除或重新加载验证码配置。

- **领域层与核心逻辑调整**
    - 在 `SessionStateProvider` 接口中暴露 `lockStateFlow`,支持长生命周期组件订阅数据库锁定状态。
    - 在 `VaultViewModel` 中订阅 `lockStateFlow`,并将状态变更同步至 `TotpCoordinator`。

- **代码清理与测试**
    - 优化 `BackupRestoreSheets.kt` 中的 `OutlinedCard` 点击处理方式,使用组件原生 `onClick` 参数以符合最新 API 规范。
    - 为 `TotpCoordinator` 增加针对会话锁定场景的单元测试,验证锁定期间的状态清除及解锁后的自动恢复逻辑。
- **String Resource Restructuring**
    - Migrated settings-related strings from `strings.xml` to a dedicated `strings_settings.xml` file.
    - Standardized string keys with a `settings_` prefix (e.g., `settings_confirm`, `settings_follow_system`) to improve organization and prevent naming collisions.
    - Updated translations in English (`values-en`) and Japanese (`values-ja`) to match the new structure.
    - Removed redundant or obsolete string definitions from `strings.xml` and `strings_features.xml`.

- **UI & Feature Integration**
    - Updated references across multiple settings modules: Appearance, App Password, Data Management, Interaction, General, and Security.
    - Parametricized app name references in strings like `settings_recovery_code_save_hint` and `autofill_prompt_title` using `%1$s` for better consistency.
    - Updated `AndroidManifest.xml` to use `@string/app_name` for the Autofill service label.

- **Code Refactoring**
    - Updated `AppearanceLabels.kt`, `AppPasswordFlows.kt`, and various UI components (`PasswordFields.kt`, `BackupRestoreSheets.kt`, `LogSettingsSection.kt`, etc.) to use the newly namespaced string resources.
    - Refactored `InterfaceScreen.kt` and `AppearanceScreen.kt` to point to updated description and summary string keys.
- **核心功能升级**
    - **Credential Manager (API 34+)**:新增 `ModernCredentialService` 及其配套处理链路(`BeginGetCredentialHandler`),支持原生凭据选择器。
    - **双系统并行**:重构 `FillRequestDispatcher` 统一调度传统 `AutofillService` 与新版 `CredentialProviderService`,支持同时启用两条入口。
    - **安全与验证**:引入 `CredentialScopeMatcher` 实现精确的包名/域名匹配校验;完善二阶段填充前的身份验证逻辑。

- **领域层与设置优化**
    - **精细化策略控制**:在 `AppSettings` 中新增 `AutofillSettings` 模型,支持配置填充开关、呈现模式(行内/底部弹窗)、凭据管理器开关、身份验证要求、OTP 填充及候选数量上限等。
    - **设置 UI 重构**:重写“自动填充”设置面板,支持滑动条调节候选上限,并动态展示系统服务状态。

- **数据访问层增强**
    - **盲索引预筛选**:重构 `CredentialServiceRepository`,利用 `LookupField`(包名、域名、URL)配合 `INTERSECT` 查询优化检索性能,减少非匹配项的解密开销。
    - **UUID 身份统一**:将自动填充全链路的条目 ID 从 `Int` 转换为 `String` (UUID),确保与核心领域模型一致。
    - **保存逻辑集成**:`SaveAutofillCredentialUseCase` 现在遵循用户设置策略,并对接 `EntryCommandRepository` 正式事务。

- **代码清理与健壮性**
    - 移除早期未完善的 Passkey 模拟实现,专注提升密码凭据稳定性。
    - 完善 `LegacyAutofillService` 的协程作用域管理与请求取消信号(`CancellationSignal`)处理。
    - 增加 `CandidateResolverTest`、`CredentialScopeMatcherTest` 等多个单元测试。
- **设置模块优化**
    - 简化 `handleAppPasswordEntryClick` 函数签名,移除了未使用的 `context`、`title` 和 `subtitle` 参数。
    - 同步更新 `SettingsCoreRoutes` 中的调用方代码,移除冗余的参数传递。

- **扫码组件优化 (ScannerView)**
    - 优化权限处理逻辑:将 `when` 表达式改为直接对 `cameraPermission` 进行状态匹配,并完善了 `else` 分支的处理。
    - 移除 `cameraProviderFuture` 回调中冗余的 `disposed` 检查。
    - 简化异常捕获逻辑,移除日志记录前的 `disposed` 状态判断。
- **核心功能实现**
    - 新增 `DeleteEntryPermanentlyExecutor` 和 `EmptyTrashExecutor`,负责原子化地执行单个条目的永久删除及清空回收站逻辑。
    - 引入 `EntryResourceCleaner`,用于在数据库记录删除后,异步清理关联的附件文件和自定义图标资源。
    - 扩展 `EntryCommandRepository` 和 `EntryListQueryRepository` 接口,支持回收站数据的持久化操作与流式查询。

- **数据层调整**
    - 在 `EntryCommandDao` 中新增 `deleteDeletedOptimistic` 和 `deleteAllDeleted` 方法,支持基于版本的乐观锁删除。
    - 在 `EntryQueryDao` 中新增 `observeDeleted` 逻辑,支持按删除时间倒序检索回收站条目。
    - 完善相关的单元测试(`TrashDaoTest`)以验证版本校验和清空逻辑。

- **UI 与交互优化**
    - **回收站界面**:新增 `TrashBottomSheet` 组件,提供已删除条目的列表展示、恢复、单条永久删除及一键清空功能,并集成了加载中和错误处理状态。
    - **设置模块集成**:在“数据管理”设置页中新增“本地数据”栏目及回收站入口;更新 `DataViewModel` 以管理回收站的 UI 状态和业务动作(`DataUiAction`)。
    - **国际化**:同步更新中、英、日三种语言的资源字符串。

- **代码清理**
    - 从 `EntryManager` 中移除旧有的图标清理逻辑,改由专用的资源清理类统一处理,确保数据库事务提交后的文件系统一致性。
- **Vault 模块重构**
    - **独立添加页面**:将原有的 `AddPasswordDialog` 弹窗重构为独立的 `AddPasswordScreen` 全屏页面,并新增 `AddPasswordViewModel` 进行状态管理。
    - **导航更新**:在 `AppRoute` 中新增 `AddPassword` 路由,并在 `PasslyNavHost` 中配置对应的页面跳转逻辑。
    - **UI 增强**:在密码添加表单中增加了网站地址和备注字段,并支持 IME Padding 以优化键盘弹出时的交互。
    - **逻辑迁移**:引入 `PasswordEntryFactory` 统一处理 `VaultEntry` 的模型构建,并将更多菜单的展开状态从 `VaultViewModel` 移至 `VaultTopBar` 组件内部维护。

- **身份认证系统优化**
    - **反馈机制增强**:在 `AuthenticationUiState` 中引入结构化的 `verificationFailure` 和 `setupFailure` 状态。`AuthenticationScreen` 现在能够根据错误码显示具体的本地化提示(如“应用密码不正确”或“密码长度不足”)。
    - **安全策略调整**:在 `changeAppPassword` 流程中增加了对当前密码的验证步骤;引入 `AppPasswordPolicy` 统一管理应用密码的最小长度要求(6位)。
    - **组件改进**:重构 `InputActionButton` 及其配套的 `ActionButton`,支持结果反馈动画及自动收起键盘逻辑;在生物识别认证中补充了错误信息展示。

- **Autofill 与详情页优化**
    - **自动填充标题策略**:在 `AutofillTitlePolicy` 中新增 `resolveSavedCredentialTitle` 逻辑,优先使用应用标签或域名作为标题,自动过滤时间戳、UUID 等无意义的窗口标题。
    - **详情页内容丰富**:在条目详情的域名与图标卡片中,新增展示关联的应用包名及其对应的 App 名称和图标。

- **代码清理与测试**
    - 删除了 `AddPasswordDialog` 和 `PasswordAddState` 等冗余类。
    - 新增 `AppPasswordPolicyTest`、`AutofillTitlePolicyTest` 和 `PasswordEntryFactoryTest` 等单元测试。
    - 强化了 `MigrationBoundaryTest` 架构约束测试,确保 UI 状态管理及安全边界符合设计规范。
- **引入视觉状态模型**
    - 定义私有数据类 `ActionButtonVisualState`,用于封装 `progress`、`result`、`icon` 及 `text` 等 UI 属性。
- **重构动画目标状态**
    - 将 `AnimatedContent` 的 `targetState` 从 `Pair` 替换为 `ActionButtonVisualState` 对象,确保动画过渡期间各视觉元素状态的一致性。
- **简化 UI 渲染逻辑**
    - 将结果文案的条件判断(`text` vs `resultText`)提前至状态对象创建阶段,使组件内部渲染逻辑更简洁。
- **认证逻辑重构**
    - 引入 `AutofillAuthenticationPayload` 统一管理响应级(`FillResponse`)与数据集级(`Dataset`)认证结果。
    - 针对 Android 12+ 引入 `EXTRA_AUTHENTICATION_RESULT_EPHEMERAL_DATASET` 标志,确保认证后的数据集仅用于本次立即填充,降低明文驻留风险。
    - 在 `AutofillFillActivity` 中支持根据请求上下文返回正确的结果类型。

- **安全与合规性调整**
    - 将认证 `PendingIntent` 的标志位从 `FLAG_IMMUTABLE` 修改为 `FLAG_MUTABLE`,以符合 Android 系统注入 `AssistStructure` 等认证参数的平台协议要求。
    - 强化“一次验证”作用域,确保认证状态不跨请求复用且随 Activity 结束而失效。

- **架构与文档更新**
    - 新增 `docs/security/autofill.md` 详细文档,定义自动填充的威胁边界、生命周期及故障诊断逻辑。
    - 在 `MigrationBoundaryTest` 中增加针对自动填充平台类型匹配及 `PendingIntent` 可变性的架构约束测试。

- **依赖项优化**
    - 在 `AutofillFillViewModel` 中根据 `returnsDataset` 标志动态构建响应负载,优化单条候选结果的处理流程。
- **核心架构实现**
    - 新增 `ModernCredentialService`,作为 AndroidX `CredentialProviderService` 的实现类,支持 API 34+ 凭据提供者功能。
    - 引入两阶段处理机制:由 `CredentialBeginGetHandler` 处理查询阶段,`CredentialResponseActivity` 配合 `CredentialResponseViewModel` 处理用户点选后的完成阶段。
    - 实现 `CredentialBeginCreateHandler` 以支持原生 Android 应用的密码创建请求。

- **安全与身份校验**
    - 引入 `CredentialCallingAppResolver`:强制通过系统注入的 `ProviderRequest` 获取调用方包名,禁止信任 Intent Extras 传递的包名。
    - 完善作用域校验:在查询和完成阶段对 `allowedUserIds` 进行双重检查,确保凭据仅释放给授权账号。
    - 明确 Passkey 边界:在 XML 配置和逻辑中暂时禁用 `TYPE_PUBLIC_KEY_CREDENTIAL`,直至完整的 WebAuthn 签名流程实现。

- **逻辑优化与清理**
    - **PendingIntent 管理**:在 `CredentialPendingIntentFactory` 中使用显式 Identifier 区分条目,移除 Intent 中携带的冗余敏感信息。
    - **结果处理规范化**:根据 AndroidX 契约,将所有有效的凭据响应和标准异常(如取消、未找到)映射为 `RESULT_OK`。
    - **ViewModel 增强**:引入 `AtomicBoolean` 防止配置更改导致的流程重复触发;增加对解锁动作(`ACTION_UNLOCK`)和创建动作(`ACTION_CREATE_PASSWORD`)的编排支持。

- **文档与工程化**
    - 新增详细的 `credential-manager.md` 技术文档,涵盖两阶段模型、生命周期及升级检查清单。
    - 在 `MigrationBoundaryTest` 中增加架构回归测试,确保包名安全校验和功能开关符合预期。
    - 同步更新多语言字符串资源,支持密码创建相关的 UI 描述。
…entry editor architecture

- **Architecture Refactoring**
    - Introduced `CreateEntryViewModel` and `AddEntryScaffold` to centralize common logic for new entry creation, including state management for saving operations, IME handling, and shared UI components.
    - Migrated `AddPasswordViewModel` to extend the new base `CreateEntryViewModel`.
    - Implemented a shared transition mechanism for the Floating Action Button (FAB) across the vault and entry creation screens.

- **OTP Feature Evolution**
    - Removed the legacy `AddOtpDialog` in favor of a full-screen `AddOtpScreen`.
    - Created `AddOtpViewModel` and `OtpEntryFactory` to handle OTP-specific form logic, URI parsing, and domain model mapping.
    - Added comprehensive unit tests for `OtpEntryFactory` to ensure correct field mapping and type-specific defaults (TOTP, HOTP, Steam).

- **Navigation & UI Improvements**
    - Added `AddOtp` as a dedicated route in `AppRoute` and configured its destination in `PasslyNavHost` with shared element transitions.
    - Updated `VaultFab` and `VaultScreen` to navigate to the new OTP screen instead of showing a dialog.
    - Refined `OtpFormState` to focus on field data, moving transient UI state (like "isSaving") to the ViewModel.
    - Standardized string resources for OTP creation across English, Chinese, and Japanese locales.

- **Cleanup**
    - Removed redundant OTP-related builder methods and state management from the monolithic `VaultViewModel`.
    - Simplified `AddPasswordScreen` and `AddPasswordViewModel` by leveraging the new scaffold and base classes.
    - Updated `MigrationBoundaryTest` to enforce the new architectural boundaries.
…Trash management

- **SwipeToAction Component Refactoring**
    - Replaced custom drag logic with Material 3 `SwipeToDismissBox` for better native behavior.
    - Simplified state management using `rememberSwipeToDismissBoxState` and optimized haptic feedback triggers.
    - Updated background and icon scaling logic during swipe actions.

- **Vault List & Card UI Enhancements**
    - **Animations**: Integrated `AnimatedVisibility` with `motionScheme` for entry list items, adding staggered fade and slide-in effects. Added `animateItem` for smoother list reordering and placement.
    - **Styling**: Unified card corner shapes across `DefaultCardStyle`, `PasswordCardStyle`, and `TotpCardStyle` to use `MaterialTheme.shapes.extraLarge`.
    - **Cleanup**: Removed hardcoded corner dimensions and margins from `CardStyleTokens` in favor of theme-driven values.

- **Trash Management Improvements**
    - **Visual Overhaul**: Redesigned `TrashBottomSheet` using a card-based layout (`TrashEntryCard`) instead of simple list items.
    - **UI Details**: Added entry icons, type labels, and explicit "Restore" and "Delete" text buttons to trash items.
    - **Empty State**: Enhanced the empty trash view with a dedicated icon and descriptive text.
    - **Responsiveness**: Added dynamic height constraints for the trash list based on screen configuration.
    - **Localization**: Added `settings_trash_empty_description` string across multiple languages (en, ja, zh).

- **UX & Feedback**
    - Replaced small circular progress indicators with `LinearProgressIndicator` on cards during operations.
    - Improved error visibility in the trash sheet with a themed error container and icon.
- **架构重构与抽象**
    - 引入 `VaultCardStyleComponent` 接口,将卡片样式的渲染逻辑、支持检测(`supports`)和预览逻辑封装在独立组件中。
    - 废弃基于枚举的 `VaultCardStyle`,改为由 `CardStyleRegistry` 统一管理的组件注册机制。
    - 新增 `DefaultVaultCardStyle`、`PasswordVaultCardStyle` 和 `TotpVaultCardStyle` 三种具体的样式实现。

- **逻辑解耦与优化**
    - **样式解析**:重构 `CardStyleRegistry.resolveStyle`,根据 `variantKey` 动态匹配组件,并自动回退至不支持或未知样式的默认实现。
    - **渲染精简**:移除 `CardStyleRegistry` 中冗余的 `when` 分支判断,通过组件接口统一 `Render` 和 `Preview` 调用。
    - **数据模型**:将 `SwipeActionType` 拆分为独立文件;移除不再使用的 `VaultCardStyle` 枚举类及相关常量。

- **测试与稳定性**
    - 完善 `CardStyleRegistryTest`,增加样式回退逻辑、未知 Key 处理以及组件可发现性的单元测试。
    - 引入 `CardStylePreviewFixtures` 统一管理预览用的模拟数据。
- **核心架构调整**
    - 重构了 `AppTheme` 的颜色管理逻辑,引入 `AccentColorFamily` 和 `AccentColorRoles` 以支持更精细的 Material 3 颜色角色定义。
    - 将 `customSeedArgb` 重命名为 `manualThemeColorArgb`,并在 Proto 配置、Repository 及 ViewModel 中同步更新,使其命名更符合“手动选择主题色”的语义。
    - 废弃了 `fallbackPalette` 在 UI 层的直接使用,统一通过 `manualThemeColorArgb` 进行状态流转。

- **颜色与主题优化**
    - **预设主题升级**:为所有预设主题(蓝、绿、红、紫等)提供了完整的静态 `ThemePalette` 定义,包含 primary、secondary 和 tertiary 三个独立强调色族的明/暗模式配置。
    - **配色逻辑重构**:移除了基于插值(lerp)的动态颜色生成逻辑,改为使用预定义的静态 Token,确保主题色的准确性与对比度合规性。
    - **ColorScheme 完善**:补全了 `AppColor` 中的静态 `ColorScheme` 定义,增加了 surfaceContainer 系列、Fixed 系列及相关 Variant 角色。

- **UI 逻辑简化**
    - 在 `AppearanceScreen` 中简化了主题显示逻辑,通过 `manualThemeColorArgb` 统一处理手动选择和默认状态下的名称与颜色显示。
    - 移除了 `AppearanceUiAction.SetFallbackPalette`,简化了设置界面的交互 Action。

- **测试与稳定性**
    - 新增 `ThemeTokensTest` 单元测试,验证手动颜色选择的解析逻辑、色彩角色的独立性,并确保所有手动配色对均符合辅助功能(Accessibility)的对比度标准(>= 4.5:1)。
aozijx added 28 commits August 11, 2026 17:24
Repository owner deleted a comment from chatgpt-codex-connector Bot Aug 13, 2026
@aozijx
aozijx merged commit cf275a4 into main Aug 13, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant