# JanusSDK Android Porting Checklist

This document outlines the step-by-step process for porting the JanusSDK from iOS to Android, ensuring a consistent API and behavior while respecting platform-specific patterns.

## Initial Setup

- [x] Create basic Android project structure
- [x] Define project namespaces (`com.ethyca.janussdk.android`)
- [x] Create README.md and AndroidImplementationGuide.md
- [x] Convert app to library module for the SDK
- [x] Create separate example app module
- [x] Configure Gradle files for library development
- [x] Set up publishing configuration

## Architecture Foundation

- [x] Create package structure matching the README
- [x] Define core interfaces (JanusInterface, etc.)
- [x] Set up test infrastructure
- [x] Create placeholder classes for key components
- [x] Implement basic dependency injection pattern
- [x] Organize public and internal classes (public at root, internal in core)

## Core Components (Phase 1)

- [x] Port JanusError enum
- [x] Create JanusConfiguration class with Builder pattern
- [x] Implement JanusProvider (dependency injection container)
- [x] Create basic Janus facade class (renamed from JanusSDK and moved to core)
- [x] Implement JanusInterface interface (renamed from JanusProtocol)
- [x] Create skeleton JanusImplementation class

## Data Models (Phase 2)

- [x] Create data models for API responses
- [x] Implement serialization/deserialization
- [x] Create consent data structures
- [x] Create privacy experience models
- [x] Implement model validation

## Storage Layer (Phase 3)

- [x] Implement consent storage using SharedPreferences
- [ ] Create secure storage utilities
- [x] Implement persistence strategies

## Network Layer (Phase 4)

- [x] Create API interfaces
- [x] Implement network error handling
- [x] Add request/response interceptors
- [x] Implement region detection

## Events System (Phase 5)

- [x] Implement event types enum
- [x] Create event listener interface
- [x] Add event dispatcher mechanism
- [x] Implement event data structures

## UI Components (Phase 6)

- [x] Design native privacy experience UI
- [x] Implement traditional View-based UI
- [ ] Create Jetpack Compose UI components (optional)
- [ ] Add animation and transitions
- [ ] Implement accessibility features

## WebView Integration (Phase 7)

- [x] Create WebView factory method
- [x] Implement JavaScript bridge
- [x] Add event synchronization
- [x] Create WebView cleanup mechanism
- [x] Test bidirectional communication

## Testing & Validation (Ongoing)

- [ ] Create unit tests for each component
- [ ] Add integration tests
- [ ] Implement UI tests
- [ ] Create test fixtures and mocks
- [ ] Set up CI pipeline

## Example App (Phase 8)

- [x] Create basic example app
- [x] Demonstrate initialization
- [x] Show privacy experience UI
- [x] Demonstrate WebView integration
- [x] Add consent management examples

## Documentation & Delivery (Phase 9)

- [ ] Generate KDoc API documentation
- [x] Finalize AndroidImplementationGuide.md
- [ ] Create release notes
- [x] Set up artifact publishing
- [ ] Create sample code repository

## Platform-Specific Adaptations

When porting from iOS to Android, the following adaptations should be made:

1. **Language Patterns**:
   - Replace Swift protocols with Kotlin interfaces (e.g., JanusProtocol → JanusInterface)
   - Use Kotlin data classes instead of Swift structs
   - Implement Builder pattern instead of Swift initializers with default parameters
   - Replace Swift optionals with Kotlin nullables

2. **UI Components**:
   - Replace UIKit with Android Views or Jetpack Compose
   - Adapt view controllers to Activities/Fragments
   - Replace SwiftUI with Jetpack Compose where applicable

3. **Concurrency**:
   - Replace Swift's completion handlers with Kotlin callbacks or coroutines
   - Use suspend functions for asynchronous operations where appropriate

4. **Storage**:
   - Replace UserDefaults with SharedPreferences
   - Use Room instead of Core Data if needed

5. **Dependency Management**:
   - Replace Swift Package Manager with Gradle
   - Use Maven artifacts instead of CocoaPods

6. **WebView**:
   - Replace WKWebView with Android WebView
   - Adapt JavaScript interfaces for bidirectional communication

By following this checklist, we'll ensure a methodical approach to porting the SDK while maintaining consistent behavior across platforms. 