How jordond/connectivity works
• connectivity-core – the base/common library with shared logic and APIs;
• platform-specific modules such as connectivity-android, connectivity-apple, and connectivity-device that use native APIs;
• connectivity-http – an implementation that uses HTTP polling to determine connectivity status;
• connectivity-compose and its variants – composable integrations for Compose Multiplatform; and
• a demo application that shows how to use the library across multiple platforms.
The overall design shows a clear separation between the common core logic and platform-specific implementations (device vs. HTTP). There is also a well-organized build system (utilizing Gradle Kotlin DSL scripts, convention plugins, and a buildLogic folder for build configurations) along with CI/CD configuration inside the .github directory.
Main Components
• Connectivity Core: The central module that holds the shared connectivity logic and API definitions.
• Platform-Specific Modules: These include:
• connectivity-android
• connectivity-apple
• connectivity-device
• connectivity-http
• Compose Integrations: Composing connectivity state for UI with modules such as connectivity-compose, connectivity-compose-device, and connectivity-compose-http.
• Build & CI/CD Infrastructure: Represent the Gradle scripts, buildLogic conventions (to centralize configuration), and GitHub workflows that automate testing and publishing.
• Demo Applications: Demo/composeApp and demo/iosApp folders which show real usage and integration.
Relationships and Interactions
• How the compose modules extend the functionality of the basic connectivity modules to provide UI composable integrations.
• How the demo apps depend on one or more connectivity modules (for instance, the demo app on composeApp referencing both Android and common multiplatform connectivity modules).
Architectural Patterns and Design Principles
• Separation of Concerns: The design clearly separates core logic (connectivity-core) from specific implementations.
• Multiplatform Paradigm: Indicate how the commonMain source set is shared and how platform-specific source sets (such as androidMain, appleMain, etc.) extend the shared logic.
• Modularity: Each platform-specific implementation and the corresponding compose wrapper is modular, ensuring easy updates/isolation.
• Dependency Injection / Factory Pattern: The factory function Connectivity() that creates instances based on platform can be highlighted.
Technologies, Frameworks, and Tools
• Kotlin Multiplatform: The project relies on Kotlin’s multiplatform capabilities.
• Gradle Kotlin DSL: Used for builds (refer to build.gradle.kts in many modules) and centralized build logic in buildLogic.
• Compose Multiplatform: For UI integration in the compose modules.
• Testing Frameworks: The file structure includes androidUnitTest and commonTest directories.
• GitHub Actions: The .github/workflows indicates CI/CD usage for continuous integration and publishing.