Refactor: Modüler mimari, kritik hata düzeltmeleri ve dark theme tasarımı#1
Open
ecuware wants to merge 2 commits intosoftviser:mainfrom
Open
Refactor: Modüler mimari, kritik hata düzeltmeleri ve dark theme tasarımı#1ecuware wants to merge 2 commits intosoftviser:mainfrom
ecuware wants to merge 2 commits intosoftviser:mainfrom
Conversation
## Yapılan Değişiklikler
### 🔴 Kritik Hata Düzeltmeleri
1. **Log Race Condition (main.swift:387-400)**
- DispatchQueue serial queue eklendi
- Concurrent log yazımları dosya bozulmasını önlüyor
- defer kullanılarak FileHandle temizliği sağlandı
2. **AssertionID State Confusion (main.swift:605-678)**
- systemAssertionCreated ve displayAssertionCreated boolean flag'leri eklendi
- UInt32.max sentinel değeri kullanıldı
- preventSleep() ve allowSleep() arasındaki state tutarsızlığı giderildi
3. **Sürüm Uyuşmazlığı (main.swift:1458)**
- Hardcoded "1.1.0" yerine Bundle'dan dinamik okuma
- Info.plist CFBundleShortVersionString'e uyumlu hale getirildi
### 🟠 Yüksek Öncelikli Düzeltmeler
4. **withMemoryRebound Safety (main.swift:771)**
- inet_ntop() dönüş değeri kontrol ediliyor
- Nil guard eklendi
5. **Timer Memory Leak (main.swift:604)**
- SleepManager'a deinit eklendi
- allowSleep() çağrılarak timer cleanup sağlandı
### 🟡 Orta Öncelikli İyileştirmeler
6. **Singleton Thread Safety (main.swift:30-51)**
- LocalizationManager'a NSLock eklendi
- setLanguage() thread-safe hale getirildi
7. **Error Handling (main.swift:453-486)**
- try? yerine do-catch kullanımı
- Notification permission denied durumunda auto-disable
- Log hataları dışında recovery mekanizması eklendi
### ⚪ Düşük Öncelikli / Yapısal İyileştirmeler
8. **Hardcoded URLs (AppConstants.swift)**
- websiteURL, githubURL, websiteDisplayText, githubDisplayText
- AppConstants struct'ı oluşturuldu
- Tek merkezden yönetim
9. **Single File Architecture (1715 → 668 satır)**
- LocalizationManager + Language → Sources/Localization.swift
- SwiftUI Views → Sources/Views.swift
- FloatingPanel + AppDelegate → Sources/AppDelegate.swift
- Constants → Sources/AppConstants.swift
- main.swift artık sadece core logic içeriyor
10. **Build Script Güncellemesi**
- Tek dosya derleme → Sources/*.swift glob pattern
- Çoklu kaynak dosyası desteği
## Dosya Yapısı
- Sources/main.swift - 668 satır (core logic)
- Sources/Views.swift - 644 satır (SwiftUI views)
- Sources/AppDelegate.swift - 123 satır (AppDelegate + FloatingPanel)
- Sources/Localization.swift - 270 satır (LocalizationManager)
- Sources/AppConstants.swift - 13 satır (constants)
## Notlar
- Build başarıyla test edildi
- Tüm değişiklikler geriye dönük uyumlu
- Modüler yapı sayesinde test yazılabilirliği artırıldı
## Değişiklikler ### Renk Paleti - Midnight blue background (#0F172A) - Slate card background (#1E293B) - Emerald connected gradient (#10B981 → #34D399) - Red-Orange disconnected gradient (#EF4444 → #F97316) - Indigo-Purple primary gradient (#6366F1 → #8B5CF6) - New text hierarchy with near-white primary (#F8FAFC) ### Theme System - AppTheme struct with centralized color definitions - Color(hex:) extension for hex color support - ConnectionStatus enum for status color mapping - Reusable status badges with glow effects ### İkonography - Custom SF Symbols with gradient styling - Glow effects on status indicators - Card borders with subtle opacity ### Accessibility Fix - checkAccessibilityPermission() called in applicationDidFinishLaunching - Prevents false "permission required" warning on app launch - Permission check also added to startMonitoring() ## Dosyalar - Sources/Theme.swift (new) - Theme constants and color extensions - Sources/Views.swift - Updated with dark theme colors - Sources/AppDelegate.swift - Early permission check on launch - Sources/main.swift - Early permission check in startMonitoring()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Özet
VPNKeepAwake projesi için kapsamlı refactor ve UI tasarım güncellemesi. İki commit'lik bu PR şunları içeriyor:
Commit 1: Modüler Mimari ve Kritik Hata Düzeltmeleri
🔴 Kritik Hata Düzeltmeleri
Log Race Condition
DispatchQueueserial queue vedeferile dosya yazımı güvenli hale getirildiAssertionID State Confusion
IOPMAssertionIDdeğeri0olduğunda başarısız assertion mı yoksa geçerli bir assertion ID mi olduğu ayırt edilemiyordusystemAssertionCreatedvedisplayAssertionCreatedboolean flag'leri veUInt32.maxsentinel değeri eklendiSürüm Uyuşmazlığı
Bundle.main.infoDictionaryüzerinden dinamik version okuma🟠 Yüksek Öncelikli Düzeltmeler
withMemoryRebound Safety
inet_ntop()dönüş değeri kontrol edilmediği için crash riski vardıguard result != nilile nil kontrolü eklendiTimer Memory Leak
deinitolmadığı için timer invalidation yapılamıyordudeinit { allowSleep() }eklendi🟡 Orta Öncelikli İyileştirmeler
Singleton Thread Safety
LocalizationManager.sharedaynı anda birden fazla thread tarafından erişilebilirdiNSLockile thread-safe erişimError Handling
SettingsManager.shared.notificationsEnabled = falseile auto-disable⚪ Yapısal İyileştirmeler
Hardcoded URLs
AppConstantsstruct'ı oluşturulduSingle File Architecture
Sources/main.swift- 668 satır (core logic)Sources/Views.swift- 644 satır (SwiftUI views)Sources/AppDelegate.swift- 123 satır (AppDelegate + FloatingPanel)Sources/Localization.swift- 270 satır (LocalizationManager)Sources/AppConstants.swift- 13 satır (constants)Commit 2: UI Design - Dark Theme ve Accessibility Fix
Renk Paleti
Theme System
AppThemestruct'ı ile merkezi renk tanımlarıColor(hex:)extension ile hex renk desteğiConnectionStatusenum ile durum renkleri eşleştirmesiİkonography
Accessibility Fix
applicationDidFinishLaunching()içinde erken permission kontrolüstartMonitoring()içinde permission kontrolüDosya Yapısı
Sources/main.swiftSources/Views.swiftSources/AppDelegate.swiftSources/Localization.swiftSources/AppConstants.swiftSources/Theme.swiftbuild.shTest
Notlar