Files
Obtainium/docs
Imran Remtulla f7d9e9740a Refactor: improve readability, fix bugs, remove dead code, consolidate duplication
Critical bugs fixed:
- itchio: invalid ?cookies Dart syntax
- github: sourceConfigSettingValues type mismatch for checkRepoRename
- github: object vs string comparison in release repositioning
- source_provider: copy-paste bug in _migrateAdditionalDataToSettings
- html: hashCode for APKLinkHash preserved (user confirmed stable)

Medium bugs fixed:
- source_provider: URI parsed 3x in stripLastPathSegment (now cached)
- source_provider: HTTP 304 excluded from redirect range
- source_provider: unsafe type cast in migration guarded
- apps_provider_lifecycle: non-FormatException rethrow no longer kills all loading
- apps_provider_lifecycle: renameSync -> rename (non-blocking)
- add_app: null guard on downloadedArtifact type dispatch
- import_export: empty map guard on .first access
- github: double DateTime.now() race consolidated
- Empty catch blocks now log via debugPrint or LogsProvider

Dead code removed:
- intValidator (zero callers)
- Duplicate http import consolidated
- late -> final on constructor-initialized fields
- print() in fdroidrepo replaced with LogsProvider

Structural refactors:
- app.dart: build() ~395 -> ~116 lines (7 methods extracted)
- apps_provider_install: 4 closures lifted to private methods
- import_export: 7 widget builders extracted + dedup init logic
- generated_form: type-checking extracted to named helpers
- source_provider: _resolveAppId() extracted from 5-level ?? chain
- source_provider: _migrateHtmlSpecificMigrations readability
- apps_provider_lifecycle: standardVersionDetection/realVersion helpers

Duplicated code consolidated:
- ensureAbsoluteUrl moved to source_provider (shared utility)
- APK filename matching extracted to preferMatchingApk
- Lifecycle helpers for naiveStandardVersionDetection/realInstalledVersion

Magic numbers -> named constants:
- _foregroundServiceId (666), _fgTaskRepeatMs (900000)
- _maxChangeLogBytes (2048)
- _androidApiLevelR (30), _androidApiLevelS (31)
- _installingProgressSentinel (-1)
- _corruptFileSuffix (.corrupt)
- _defaultMatchGroup (0)

Comments: 37+ doc comments added to error classes, utility functions, providers
Documentation: DEVELOPER_GUIDE.md updated for accuracy
Lint: 20+ use_build_context_synchronously ignores replaced with mounted guards

hashListOfLists: SHA-256 truncated to 8 chars (was 64, too long for version display)
flutter analyze: clean (no issues found)
2026-06-30 19:35:05 +01:00
..