keys-for-all/MIGRATION_CHECKLIST.md
2025-07-22 18:27:21 -07:00

2.9 KiB

VoiceUwu Keys-for-All Migration Checklist

Completed

  • Created KeysForAll Swift package
  • Added package dependency to VoiceUwu
  • Created VUKeysForAllIntegration.swift bridge
  • Updated VoiceUwuApp.swift to initialize KeysForAll
  • Updated VUKeysForAllView to use package UI
  • Updated VUCalculatorEditorView to check features via KeysForAll
  • Created VoiceUwuCompatibleStorage for UserDefaults compatibility
  • Added KeyValidator for proper key validation

⚠️ Remaining Issues

1. Purchase Integration

File: VUKeysForAllIntegration.swift Issue: VoiceUwuPurchaseHandler is just a stub Fix Needed: Implement StoreKit integration

class VoiceUwuPurchaseHandler: ObservableObject {
    func purchase(option: PurchaseOption) async throws {
        // TODO: Integrate with StoreKit
        // 1. Create StoreKit products matching PurchaseOption.productIdentifier
        // 2. Handle purchase flow
        // 3. Validate receipt
        // 4. Add keys on successful purchase
    }
}

2. Files Still Using Old System

These files still reference VUKeyGatedFeatureManager:

  • VUCalculatorEditorView.swift (wrapper section)
  • VUMainViewRefactored.swift
  • VUMetricToolbarIcon.swift
  • VUMenuSettingsView.swift
  • VUDeveloperSettingsView.swift
  • VUSettingsView.swift
  • VUVoiceProfileApplicator.swift

Fix: Replace VUKeyGatedFeatureManager.shared with @EnvironmentObject var keysForAll

3. Developer Settings Integration

File: VUDeveloperSettingsView.swift Issue: Still uses old @AppStorage keys directly Fix: Add debug controls that work with KeysForAll:

Button("Add Test Key") {
    keysForAll.addKeys(1)
}
Button("Remove Test Key") {
    keysForAll.removeKeys(1)
}
Toggle("Enable Key Gating", isOn: Binding(
    get: { keysForAll.isKeyGatingEnabled },
    set: { keysForAll.setKeyGatingEnabled($0) }
))

4. Missing Features in Package

  • No analytics/telemetry
  • No server-side key validation (currently accepts any formatted key)
  • No key history/audit trail
  • No bulk key generation for admins

5. Test Coverage

  • Need integration tests for VoiceUwu + KeysForAll
  • Need UI tests for purchase flow
  • Need tests for migration from old system

Migration Steps

  1. Phase 1: Parallel Running

    • Keep old system in place
    • Run new system alongside
    • Log differences for debugging
  2. Phase 2: Switch Over

    • Update all views to use KeysForAll
    • Remove VUKeyGatedFeatureManager references
    • Update developer tools
  3. Phase 3: Cleanup

    • Remove VUKeyGatedFeatureManager.swift
    • Remove old AppStorage keys
    • Update documentation

Testing Checklist

  • Keys persist across app launches
  • Features unlock at correct levels
  • Purchase flow works (when implemented)
  • Key sharing generates valid keys
  • Developer overrides work
  • No UI glitches in settings
  • Calculator editor shows correct lock states