How vkcom/vkid-android-sdk works
Project type and purpose
• This is a multi-module Android SDK monorepo (an “open‑source tool”/library) for VK ID OAuth 2.1 authorization and auxiliary UI features (OneTap, multibranding).
• It publishes a suite of AAR artifacts (core vk‑id client, network, logging, analytics, tracking, OneTap widgets, multibranding widgets, XML variants) and accompanying build plugins, code quality tools (Detekt, Dokka), metrics, and sample apps.
High‑level module structure
• build-logic (custom Gradle convention and quality plugins)
• sdk/ (the heart of the library)
– core modules:
• vkid (OAuth flows, token storage, IPC via AIDL, DI, concurrency)
• network (HTTP client, API contract, SSL pinning)
• logger (LogEngine abstractions)
• analytics (event/stat tracking)
• tracking-core/tracer/noop (crash & performance reporter)
• vk-sdk-support (exceptions, WithVKIDToken)
– feature modules (depend on core):
• onetap-common/compose/xml (OneTap UI in Compose or XML)
• multibranding‑common/compose/xml (OAuth list widget)
• baseline-profile (profile generator)
– ui‑tests (instrumented tests covering all UI variants)
• sample/ (apps demonstrating integration: Kotlin Compose app, XML app, metrics app, old‑SDK example)
• docs/ (Dokka‑generated API documentation)
• scripts/ (CI/CD, release, Allure reporting, backups, renovate)
Relationships & data flows
• Build pipeline:
build-logic plugins → configure module conventions → Gradle compiles each sdk subproject → produce AARs → Dokka generates docs → Detekt applies static checks → metrics plugin gathers CI metrics → artifacts published to Artifactory & Maven repo.
• Runtime flow (in a consuming Android app):
App calls VKID.init(context) → VKID.instance orchestrates:
– UI modules (OneTap/composables or XML layouts) present auth widgets
– On user action → network module calls VK OAuth endpoints → responses → core vkid token storage → callback to app via VKIDAuthCallback
– Later refreshToken(), fetchUser(), logout flows all go back through network + core storage
• IPC / AIDL flow:
If a silent auth provider is present, core vkid uses AIDL interfaces (ISilentAuthInfoProvider) to query providers in other apps.
Architectural patterns & principles
• Modular decomposition: core vs. feature vs. sample
• Convention‑over‑configuration via Gradle plugin modules in build-logic
• Clean separation of concerns: network, storage, UI, analytics, logging, tracking
• Dependency inversion: feature modules depend on core abstractions (api contracts) only
• Plugin‑based quality gates: Detekt, Dokka skip plugin, metrics, binary compatibility validator
• Build system (Gradle + build-logic plugins)
• SDK modules (grouped by layer—core, network, logging, tracking, feature)
• External services: VK ID OAuth backend, Firestore (metrics), GitLab (CI/MR comments), Artifactory (artifact repo)
• Consumer apps: sample/app, sample/xml, and third‑party Android apps integrating the SDK
• IPC/AIDL boundary for silent auth providers