From 0c7020adced20e209a643baf24513847a6e9edc3 Mon Sep 17 00:00:00 2001 From: Young Liu Date: Tue, 6 Jan 2026 13:37:11 +0800 Subject: [PATCH 1/2] implement copy qrcode result Co-Authored-By: Claude --- Resources/en.lproj/Localizable.strings | 4 + Resources/zh-Hans.lproj/Localizable.strings | 4 + Views/QrCodeToolView.swift | 88 ++++++++++++++++++--- 3 files changed, 84 insertions(+), 12 deletions(-) diff --git a/Resources/en.lproj/Localizable.strings b/Resources/en.lproj/Localizable.strings index 7ba11b7..e50dac1 100644 --- a/Resources/en.lproj/Localizable.strings +++ b/Resources/en.lproj/Localizable.strings @@ -492,4 +492,8 @@ "about.app.label.message" = "Message"; "about.app.description" = "This app is designed to help elementary school students practice their arithmetic skills in a fun and engaging way."; +/* Copyable Info Row */ +"copy_button" = "Copy"; +"copied_status" = "Copied"; + diff --git a/Resources/zh-Hans.lproj/Localizable.strings b/Resources/zh-Hans.lproj/Localizable.strings index 8c112ec..1732640 100644 --- a/Resources/zh-Hans.lproj/Localizable.strings +++ b/Resources/zh-Hans.lproj/Localizable.strings @@ -485,4 +485,8 @@ "about.app.label.message" = "提交信息"; "about.app.description" = "本应用旨在帮助小学生以有趣和引人入胜的方式练习算术技能。"; +/* Copyable Info Row */ +"copy_button" = "复制"; +"copied_status" = "已复制"; + diff --git a/Views/QrCodeToolView.swift b/Views/QrCodeToolView.swift index f80d1b4..2d6f024 100644 --- a/Views/QrCodeToolView.swift +++ b/Views/QrCodeToolView.swift @@ -22,6 +22,7 @@ struct QrCodeToolView: View { @State private var shouldShowCamera = false @State private var shouldShowPhotoPicker = false @State private var selectedPhoto: PhotosPickerItem? + @State private var isScanResultCopied = false // Calculate adaptive QR code size var qrCodeSize: CGFloat { @@ -102,18 +103,11 @@ struct QrCodeToolView: View { .foregroundColor(.primary) } - Text(scanResult) - .font(.body) - .padding(12) - .frame(maxWidth: .infinity, alignment: .leading) - .background(Color.gray.opacity(0.08)) - .cornerRadius(10) - .overlay( - RoundedRectangle(cornerRadius: 10) - .stroke(Color.green.opacity(0.2), lineWidth: 1) - ) - .multilineTextAlignment(.leading) - .lineLimit(nil) + CopyableInfoRow( + label: "qr_code.scan_result".localized, + value: scanResult, + isCopied: $isScanResultCopied + ) } .padding(.horizontal, 20) .padding(.vertical, 4) @@ -361,6 +355,76 @@ struct QrCodeToolView: View { } } +// MARK: - Copyable Info Row Component +private struct CopyableInfoRow: View { + let label: String + let value: String + @Binding var isCopied: Bool + @State private var showToast = false + + var body: some View { + VStack(alignment: .leading, spacing: 8) { + HStack(spacing: 8) { + Text(label) + .font(.caption) + .foregroundColor(.secondary) + .fontWeight(.medium) + + Spacer() + + Button(action: copyToClipboard) { + HStack(spacing: 6) { + Image(systemName: isCopied ? "checkmark" : "doc.on.doc") + .font(.system(size: 12, weight: .semibold)) + Text(isCopied ? "copied_status".localized : "copy_button".localized) + .font(.caption2) + .fontWeight(.medium) + } + .foregroundColor(.white) + .padding(.horizontal, 10) + .padding(.vertical, 6) + .background(isCopied ? Color.green : Color.blue) + .cornerRadius(6) + } + .buttonStyle(PlainButtonStyle()) + } + + Text(value) + .font(.system(.body, design: .monospaced)) + .lineLimit(2) + .truncationMode(.middle) + .padding(12) + .frame(maxWidth: .infinity, alignment: .leading) + .background(Color.gray.opacity(0.08)) + .cornerRadius(.adaptiveCornerRadius) + .overlay( + RoundedRectangle(cornerRadius: .adaptiveCornerRadius) + .stroke(Color.gray.opacity(0.2), lineWidth: 1) + ) + } + .padding(14) + .background(Color(.systemBackground)) + .cornerRadius(.adaptiveCornerRadius * 1.5) + .overlay( + RoundedRectangle(cornerRadius: .adaptiveCornerRadius * 1.5) + .stroke(Color.gray.opacity(0.15), lineWidth: 1) + ) + .shadow(color: Color.black.opacity(0.05), radius: 8, x: 0, y: 4) + } + + private func copyToClipboard() { + UIPasteboard.general.string = value + isCopied = true + + let impactFeedback = UIImpactFeedbackGenerator(style: .medium) + impactFeedback.impactOccurred() + + DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) { + isCopied = false + } + } +} + struct QrCodeToolView_Previews: PreviewProvider { static var previews: some View { QrCodeToolView() From 8eee720b71a728292e44543b2c2cae72316bf577 Mon Sep 17 00:00:00 2001 From: Young Liu Date: Thu, 8 Jan 2026 22:40:01 +0800 Subject: [PATCH 2/2] update README Co-Authored-By: Claude --- ChangeLogs.md | 21 ++++++++++--- QWEN.md | 3 +- README.md | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 101 insertions(+), 7 deletions(-) diff --git a/ChangeLogs.md b/ChangeLogs.md index decbc74..c6f610f 100644 --- a/ChangeLogs.md +++ b/ChangeLogs.md @@ -1,13 +1,24 @@ # Change Log +### 🌟 2026-01-08 (Latest Updates) +- **PDF题库生成功能** - 新增数学题库PDF生成功能,支持题目页和答案页分离 (Added math problem bank PDF generation with separate question and answer pages) +- **系统信息监控** - 新增全面的系统信息监控功能,包括设备信息、性能数据、电池状态等 (Added comprehensive system information monitoring including device info, performance data, battery status, etc.) +- **QR码扫描工具** - 集成QR码扫描和生成功能 (Integrated QR code scanning and generation functionality) +- **小学数学公式大全** - 新增全面的小学数学公式指南 (Added comprehensive elementary math formula guide) +- **Firebase崩溃监控** - 集成Firebase Crashlytics进行崩溃监控 (Integrated Firebase Crashlytics for crash monitoring) +- **欢迎引导流程** - 新增首次启动引导界面 (Added first-launch onboarding interface) +- **UI界面优化** - 优化多个界面的用户体验 (Optimized user experience across multiple interfaces) +- **TTS功能增强** - 增强了题目朗读功能,支持数学符号智能转换 (Enhanced question read-aloud functionality with intelligent math symbol conversion) +- **测试与质量保证** - 添加了全面的验证系统和防无限循环机制 (Added comprehensive validation system and anti-infinite loop mechanisms) + ### 🌟 2026-01-05 (About App & UI Improvements) -- **新增“关于应用”页面 (Added "About App" Page)**: - - 在设置页面新增“关于 Arithmetic”按钮,点击后可查看应用版本、构建号、Git提交哈希和提交信息。 +- **新增"关于应用"页面 (Added "About App" Page)**: + - 在设置页面新增"关于 Arithmetic"按钮,点击后可查看应用版本、构建号、Git提交哈希和提交信息。 - 界面优化,采用更清晰的表单布局,并添加了致谢列表。 - - **Git信息嵌入**:通过Xcode构建脚本将最新的Git提交信息(哈希和消息)嵌入到应用中,解决了Git信息显示“N/A”的问题。 - - **国际化支持**:所有“关于应用”页面的文本都已进行完整的中英文本地化。 + - **Git信息嵌入**:通过Xcode构建脚本将最新的Git提交信息(哈希和消息)嵌入到应用中,解决了Git信息显示"N/A"的问题。 + - **国际化支持**:所有"关于应用"页面的文本都已进行完整的中英文本地化。 - **主界面按钮位置调整 (Main Screen Button Reordering)**: - - 将主页面的“设置”按钮移动到“其他选项”按钮下方,优化了界面布局。 + - 将主页面的"设置"按钮移动到"其他选项"按钮下方,优化了界面布局。 ## 🔄 最近更新 (Recent Updates) diff --git a/QWEN.md b/QWEN.md index c166b76..340da9b 100644 --- a/QWEN.md +++ b/QWEN.md @@ -185,4 +185,5 @@ Arithmetic/ - The project is well-documented with comprehensive README.md - Regular updates include new features and bug fixes - The app has been optimized for educational use in elementary arithmetic learning -- The project follows modern SwiftUI and iOS development best practices \ No newline at end of file +- The project follows modern SwiftUI and iOS development best practices +- **New Rule**: Always put Recent Updates content in ChangeLogs.md, not in README.md. The README.md should only contain a link to ChangeLogs.md for update history. \ No newline at end of file diff --git a/README.md b/README.md index aae22eb..5f6eadf 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ # 🧮 小学生算术学习应用 ## Elementary Arithmetic Learning App -*Version: 1.0.1* | *Updated: January 5, 2026* +*Version: 1.0.1* | *Updated: January 8, 2026* [![Demo](https://github.com/tobecrazy/Arithmetic/blob/main/Arithmetic.gif)](https://github.com/tobecrazy/Arithmetic) @@ -85,6 +85,88 @@ - **💻 系统信息 (System Information)** - 实时查看设备信息、性能数据和系统状态 (Real-time view of device info, performance data and system status) - **🛠️ 崩溃测试 (Crash Test)** - 提供崩溃测试功能,便于验证错误监控系统 (Provides crash testing functionality for verifying error monitoring system) +### 📷 QR码扫描工具 (QR Code Scanning Tool) +- **📱 扫描功能 (Scanning Functionality)** - 集成相机扫描和相册扫描功能,用于扫描二维码 + - 实时相机预览,带绿色扫描框指示 + - 支持从相册选择图片进行扫描 + - 自动识别QR码,立即显示扫描结果 + - 扫描成功时播放系统音效反馈 + (Integrated camera and photo library scanning functionality with real-time preview and green frame indication) + +- **🔐 权限管理 (Permission Management)** - 智能权限处理 + - 首次使用自动询问相机权限 + - 已授权时直接启动摄像头 + - 拒绝权限时提供设置引导链接 + (Intelligent permission handling with first-use request and settings navigation) + +- **🔄 生成功能 (Generation Functionality)** - 支持将文本内容生成二维码 + - 实时文本输入与占位符提示 + - 按需生成高质量二维码 + - 支持多行文本输入 + (Generate high-quality QR codes from text with support for multi-line input) + +- **🎨 UI/UX优化 (UI/UX Enhancement)** - 专业级用户界面设计 + - 清晰的操作按钮,配合icon指示 + - 卡片式结果展示,视觉层次感强 + - 成功状态指示图标(checkmarks) + - 响应式设计,适配各种屏幕尺寸 + (Professional interface with clear buttons, card-style results display, and success indicators) + +- **🎯 导航入口 (Navigation Entry)** - 从设置页面可直接访问QR码扫描工具 + (Directly accessible from the settings page) + +- **🔧 技术改进 (Technical Improvements)** - 修复摄像头初始化失败问题,优化后台处理和线程安全 + - 改进了AVCaptureSession配置,添加了canAddInput/canAddOutput的验证检查 + - 优化了后台任务处理:使用beginConfiguration/commitConfiguration确保线程安全 + - 添加了详细的错误日志和异常处理机制 + (Improved AVCaptureSession configuration, optimized background processing and thread safety) + +### 📐 小学数学公式大全 (Elementary Math Formula Guide) +- **📚 全面公式库 (Comprehensive Formula Library)** - 涵盖几何图形、单位换算、数量关系、运算定律等小学数学核心公式 (Covers core elementary math formulas including geometric shapes, unit conversions, quantity relations, arithmetic laws, etc.) +- **📐 几何公式 (Geometry Formulas)** - 包含平面图形(长方形、正方形、三角形等)和立体图形(长方体、正方体、圆柱等)的周长、面积、体积公式 (Includes perimeter, area, and volume formulas for plane figures like rectangle, square, triangle and solid figures like cuboid, cube, cylinder) +- **📏 单位换算 (Unit Conversions)** - 涵盖长度、面积、体积、质量、时间等常用单位换算 (Covers common unit conversions for length, area, volume, mass, time, etc.) +- **🔍 运算定律 (Arithmetic Laws)** - 包括加法、乘法交换律和结合律、乘法分配律等 (Includes commutative, associative laws of addition and multiplication, distributive law, etc.) +- **🧮 特殊问题 (Special Problems)** - 涵盖和差问题、和倍问题、植树问题、相遇问题、追及问题等解题公式 (Covers solution formulas for sum-difference problems, sum-multiple problems, tree planting problems, meeting problems, chase problems, etc.) +- **📍 便捷访问 (Convenient Access)** - 从"其他选项"页面可直接访问公式大全 (Directly accessible from the "Other Options" page) +- **🌐 双语支持 (Bilingual Support)** - 完整的中英文公式解释和说明 (Complete Chinese/English formula explanations and descriptions) + +### 🔋 电池监控与运行时长功能 (Battery Monitoring and Uptime Calculation) +- **实时电池状态 (Real-time Battery Status)** - 实时监控设备电池电量、充电状态和电源类型 (Real-time monitoring of device battery level, charging status, and power source type) +- **智能状态检测 (Smart Status Detection)** - 解决模拟器中电池状态显示"Unknown"的问题,提供智能状态推断 (Resolves the issue of battery status showing "Unknown" in simulator, provides intelligent status inference) +- **运行时长计算 (Uptime Calculation)** - 精确计算并实时更新系统自启动以来的运行时长 (Precisely calculates and updates the system uptime since boot in real-time) +- **智能格式化显示 (Smart Formatting Display)** - 根据运行时长自动选择合适的显示格式(天数、时:分:秒或分:秒) (Automatically selects appropriate display format based on uptime (days, HH:MM:SS, or MM:SS)) +- **多场景支持 (Multi-scenario Support)** - 支持iOS模拟器和真实设备的电池状态检测 (Supports battery status detection for both iOS simulator and real devices) +- **国际化支持 (Internationalization Support)** - 完整的中英文本地化支持 (Complete Chinese and English localization support) + +### 🌐 网络连接监控 (Network Connection Monitoring) +- **实时网络状态 (Real-time Network Status)** - 检测当前网络连接类型(Wi-Fi/蜂窝网络) (Detects current network connection type (Wi-Fi/cellular)) +- **Wi-Fi信息 (Wi-Fi Information)** - 显示Wi-Fi连接名称(SSID) (Displays Wi-Fi connection name (SSID)) +- **蜂窝网络信息 (Cellular Information)** - 显示运营商信息(如适用) (Displays carrier information (where applicable)) +- **连接状态指示 (Connection Status Indicator)** - 提供网络连接状态的实时反馈 (Provides real-time feedback on network connection status) + +### 💻 系统信息显示 (System Information Display) +- **设备信息 (Device Information)** - 显示当前设备名称和CPU信息 (Displays current device name and CPU information) +- **实时监控 (Real-time Monitoring)** - CPU占用率、内存使用情况和磁盘空间实时更新 (CPU usage, memory usage, and disk space update in real-time) +- **内存详情 (Memory Details)** - 显示已使用、总内存、可用内存和使用百分比 (Shows used, total, available memory and usage percentage) +- **磁盘空间 (Disk Space)** - 显示已使用、总磁盘空间、可用磁盘空间和使用百分比 (Shows used, total disk space, available disk space and usage percentage) +- **屏幕信息 (Screen Information)** - 显示屏幕分辨率、尺寸和刷新率 (Displays screen resolution, size, and refresh rate) +- **系统版本 (System Version)** - 显示当前iOS/iPadOS系统版本 (Displays current iOS/iPadOS system version) +- **当前时间 (Current Time)** - 实时显示当前时间,每秒更新 (Real-time display of current time, updated every second) +- **双语支持 (Bilingual Support)** - 完整的中英文本地化支持 (Complete Chinese and English localization support) +- **可视化展示 (Visual Display)** - 使用进度条和图标直观显示系统状态 (Uses progress bars and icons to intuitively show system status) + +### 🛠️ Firebase崩溃监控 (Firebase Crash Monitoring) +- **实时崩溃监控 (Real-time Crash Monitoring)** - 集成Firebase Crashlytics,实时监控和报告应用崩溃 (Integrated with Firebase Crashlytics for real-time monitoring and reporting of app crashes) +- **详细崩溃报告 (Detailed Crash Reports)** - 提供包含设备信息、系统版本、堆栈跟踪的详细崩溃报告 (Provides detailed crash reports with device information, system version, and stack traces) +- **错误分析 (Error Analysis)** - 帮助开发者快速识别和修复问题,提高应用稳定性 (Helps developers quickly identify and fix issues, improving app stability) +- **测试功能 (Testing Feature)** - 在设置页面提供崩溃测试功能,便于验证错误监控系统 (Provides crash testing functionality in settings for verifying error monitoring system) + +### ℹ️ 关于应用页面 (About App Page) +- **版本信息 (Version Information)** - 在设置中新增"关于应用"页面,显示应用版本、构建号。 (Adds an "About App" page in Settings to display app version and build number.) +- **自动Git信息 (Automatic Git Info)** - 通过构建脚本自动嵌入最新的Git提交哈希和信息。 (Automatically embeds the latest Git commit hash and message via a build script.) +- **致谢列表 (Acknowledgments)** - 包含致谢列表,感谢对项目有贡献的个人和工具。 (Includes an acknowledgments list, thanking individuals and tools that contributed to the project.) +- **国际化 (Internationalized)** - 页面内容完全支持中英文。 (The page content is fully localized in Chinese and English.) + ### 🎯 智能解题方法 (Intelligent Solution Methods) - **加法方法 (Addition Method)** - 凑十法 (Making Ten Method)