feat(ui): add configurable refresh interval and enhanced menu features

Major feature enhancement for the BTC price monitoring application:

### New Features
- **Configurable Refresh Intervals**: Users can now select from 5s, 10s, 30s, 60s options
- **Persistent Settings**: User preferences saved via UserDefaults
- **GitHub Integration**: Direct link to project repository via menu
- **Version Display**: Shows current app version in about dialog
- **Debug Logging**: Comprehensive debug output for development (Debug builds only)

### Implementation Details
- **AppSettings.swift**: New configuration management class
- **RefreshInterval.swift**: Enum defining refresh options with display text
- **Enhanced PriceManager**: Dynamic timer management with configurable intervals
- **Updated BTCMenuBarApp**: Added refresh settings submenu, GitHub link, and version info
- **Debug Infrastructure**: Conditional compilation logging throughout price update flow

### UI/UX Improvements
- **Refresh Settings Submenu**: Visual indicators (✓) for current selection
- **Enhanced About Dialog**: Shows current refresh interval and app version
- **Clean Menu Structure**: Organized with proper separators and SF Symbols
- **GitHub Button**: Quick access to project repository

### Code Quality
- **Removed Redundancy**: Deleted unused ContentView.swift template file
- **Comprehensive Comments**: Added detailed Chinese comments throughout
- **Error Handling**: Robust error handling with user-friendly messages
- **Architecture Clean**: Follows MVVM pattern with clear separation of concerns

### Files Changed
- Modified: BTCMenuBarApp.swift, PriceManager.swift, project.pbxproj
- Added: AppSettings.swift, RefreshInterval.swift
- Deleted: ContentView.swift (unused template)
- Updated: Entitlements, app entry point, and service files

BREAKING CHANGE: None - all changes are additive and backward compatible
This commit is contained in:
ZhangLei
2025-10-29 14:21:07 +08:00
parent 168ef505b9
commit a526deb79e
10 changed files with 298 additions and 52 deletions

View File

@@ -78,7 +78,7 @@
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1620;
LastUpgradeCheck = 1620;
LastUpgradeCheck = 2600;
TargetAttributes = {
4E94106F2EB09F90003658CB = {
CreatedOnToolsVersion = 16.2;
@@ -159,6 +159,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@@ -183,6 +184,7 @@
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
@@ -222,6 +224,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -239,6 +242,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
SWIFT_COMPILATION_MODE = wholemodule;
};
name = Release;
@@ -253,8 +257,12 @@
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"test1/Preview Content\"";
ENABLE_APP_SANDBOX = YES;
ENABLE_OUTGOING_NETWORK_CONNECTIONS = YES;
ENABLE_PREVIEWS = YES;
ENABLE_USER_SELECTED_FILES = readonly;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.finance";
INFOPLIST_KEY_NSHumanReadableCopyright = "";
@@ -263,7 +271,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.4;
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 1.0.1;
PRODUCT_BUNDLE_IDENTIFIER = com.mark.test1;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -281,8 +289,12 @@
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"test1/Preview Content\"";
ENABLE_APP_SANDBOX = YES;
ENABLE_OUTGOING_NETWORK_CONNECTIONS = YES;
ENABLE_PREVIEWS = YES;
ENABLE_USER_SELECTED_FILES = readonly;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.finance";
INFOPLIST_KEY_NSHumanReadableCopyright = "";
@@ -291,7 +303,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.4;
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 1.0.1;
PRODUCT_BUNDLE_IDENTIFIER = com.mark.test1;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;