KOTLIN MULTIPLATFORM TOOLKIT · INSTALLATION

ADict Library

Selektywne moduły KMP z natywnymi adapterami i otwartymi kontraktami dostawców.

Selective KMP modules with native adapters and open provider contracts.

Stable 3.0.0 Next 3.0.1-SNAPSHOT

1. Dodaj repozytorium pakietów1. Add the package repository

Dodaj repozytorium do dependencyResolutionManagement w pliku settings.gradle.kts. Dane dostępowe są pobierane wyłącznie ze zmiennych środowiskowych — dokumentacja celowo nie zawiera żadnych wartości kluczy.

Add the repository to dependencyResolutionManagement in settings.gradle.kts. Credentials are read only from environment variables—this documentation intentionally contains no key values.

dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven {
            url = uri("https://maven.pkg.github.com/nerdrip/adictlibrary")
            credentials {
                username = providers.environmentVariable("GITHUB_ACTOR").orNull
                password = providers.environmentVariable("GITHUB_TOKEN").orNull
            }
        }
    }
}
Ustaw GITHUB_ACTOR i GITHUB_TOKEN w lokalnym środowisku lub magazynie sekretów CI. Token do pobierania pakietów wymaga uprawnienia read:packages. Nie zapisuj jego wartości w repozytorium. Set GITHUB_ACTOR and GITHUB_TOKEN in your local environment or CI secret store. Package downloads require read:packages. Never store the token value in the repository.

2. Wybierz kanał i dodaj zależność2. Choose a channel and add the dependency

Android 3.x aggregate

dependencies {
    implementation("rip.nerd.adictlibrary:adictlibrary:3.0.0")
}

Android 3.x selective artifacts

dependencies {
    implementation(platform("rip.nerd.adictlibrary:adict-bom:3.0.0"))
    implementation("rip.nerd.adictlibrary:adict-runtime")
    implementation("rip.nerd.adictlibrary:adict-ads-core")
    implementation("rip.nerd.adictlibrary:adict-ads-admob")
    implementation("rip.nerd.adictlibrary:adict-billing")
    // Optional: adict-engagement, adict-security, adict-session-recording,
    // adict-tts and adict-diagnostics
}

Android 3.0.1 development snapshot

dependencies {
    implementation(platform("rip.nerd.adictlibrary:adict-bom:3.0.1-SNAPSHOT"))
    implementation("rip.nerd.adictlibrary:adict-runtime")
    implementation("rip.nerd.adictlibrary:adict-foundation")
    implementation("rip.nerd.adictlibrary:adict-ads-core")
    implementation("rip.nerd.adictlibrary:adict-ads-admob") // optional provider
    implementation("rip.nerd.adictlibrary:adict-compose")   // optional UI adapter
}

Najpierw ustaw zgodę przez ADictPrivacy.update(...), potem wywołaj ADict.init(this, BuildConfig.DEBUG) bez mapy modułów. Biblioteka odczyta znaczniki ze scalonego manifestu i uruchomi tylko dodane artefakty.

Publish consent with ADictPrivacy.update(...), then call ADict.init(this, BuildConfig.DEBUG) without a module map. The library reads merged-manifest markers and starts only installed artifacts.

Kotlin Multiplatform 3.x: selektywne moduły

Zależności przenośne dodawaj w commonMain. Jedna logiczna współrzędna automatycznie wybiera wariant Android, JVM, Wasm albo iOS; nie dodawaj ręcznie artefaktów z sufiksem -android, -iosarm64, -iossimulatorarm64, -iosx64, -jvm ani -wasm-js.

Add portable dependencies to commonMain. A single logical coordinate selects the Android, JVM, Wasm or iOS variant automatically; never declare generated -android, -iosarm64, -iossimulatorarm64, -iosx64, -jvm or -wasm-js artifacts directly.

Żaden selektywny moduł KMP nie pobiera przechodnio całego adict-runtime. Dodaj runtime jawnie w androidMain tylko wtedy, gdy używasz starej fasady ADict.init() lub androidowych helperów. Czysty konsument KMP może pozostać wyłącznie przy wybranych modułach z commonMain.

No selective KMP module pulls the complete adict-runtime transitively. Add the runtime explicitly in androidMain only when using the legacy ADict.init() facade or Android helpers. A pure KMP consumer can keep only the selected commonMain modules.

kotlin {
    sourceSets {
        commonMain.dependencies {
            implementation("rip.nerd.adictlibrary:adict-foundation:3.0.0")
            implementation("rip.nerd.adictlibrary:adict-billing:3.0.0")
            implementation("rip.nerd.adictlibrary:adict-engagement:3.0.0")
            implementation("rip.nerd.adictlibrary:adict-security:3.0.0")
            implementation("rip.nerd.adictlibrary:adict-session-recording:3.0.0")
            implementation("rip.nerd.adictlibrary:adict-ads-homeads:3.0.0")
            // Provider boundary; Android gets Google SDK dependencies in its selected variant.
            implementation("rip.nerd.adictlibrary:adict-ads-admob:3.0.0")
            implementation("rip.nerd.adictlibrary:adict-compose:3.0.0")
        }
        androidMain.dependencies {
            // Optional legacy Android facade and manifest auto-discovery.
            implementation("rip.nerd.adictlibrary:adict-runtime:3.0.0")
        }
    }
}

W iosMain użyj fabryk appleBillingGateway(), appleSecurity(...) i appleTextToSpeech() albo kompletnego AppleADictServices. StoreKit, Keychain, LocalAuthentication, AVSpeechSynthesizer, StoreKit Review i UserNotifications są implementowane natywnie. Na Web/JVM zbuduj ProviderADictServices z publicznych interfejsów CheckoutLauncher, EntitlementSource, AdGateway, SessionSink i usług hosta. Brak providera oznacza wyłączoną capability, a nie fałszywy sukces.

In iosMain, use appleBillingGateway(), appleSecurity(...) and appleTextToSpeech(), or the complete AppleADictServices bundle. StoreKit, Keychain, LocalAuthentication, AVSpeechSynthesizer, StoreKit Review and UserNotifications use native implementations. On Web/JVM, build ProviderADictServices from the public CheckoutLauncher, EntitlementSource, AdGateway, SessionSink and host-service contracts. A missing provider disables its capability instead of reporting fake success.

val webServices = ProviderADictServices(
    platform = ADictPlatform.WEB,
    billing = HostedCheckoutBillingGateway(products, checkoutLauncher, entitlementSource),
    sharing = ShareGateway { request -> browserShare(request) }
)

val billing = ADictBilling(requireNotNull(webServices.billing))

OverlayADictServices nakłada adapter aplikacji na gotowy pakiet natywny. Użyj go, gdy tylko jedna usługa ma pochodzić od innego dostawcy, np. własne reklamy zamiast domyślnej integracji, bez utraty Keychain, haptyki i pozostałych usług Apple.

OverlayADictServices applies application adapters over a ready native bundle. Use it when only one service comes from another vendor, for example custom ads, without discarding Keychain, haptics and the remaining Apple services.

Kompletne przykłady dla commonMain, Androida, iOS, JVM/Desktop i Web/Wasm, w tym Google Play, StoreKit, hosted checkout, własne reklamy i brak providera: przykłady platformowe HTML.Complete commonMain, Android, iOS, JVM/Desktop and Web/Wasm examples, including Google Play, StoreKit, hosted checkout, custom ads and missing-provider behavior: HTML platform examples.

Co zrobić, gdy platforma nie ma odpowiednikaWhen a platform has no equivalent

ObszarAreaKontrakt aplikacjiApplication contractBezpieczny fallbackSafe fallback
BillingBillingGateway, CheckoutLauncher, EntitlementSource, PurchaseVerifierBrak oferty albo Pending; nigdy lokalne nadanie uprawnienia.
AdsAdGateway dla dowolnej sieciHouseAdsGateway lub Unavailable.
SecuritySecureStorageGateway, BiometricGatewayCapability wyłączona; zwykły storage nie udaje sejfu.
EngagementReviewGateway, HapticsGateway, LocalNotificationGatewayfalse albo brak capability.
SpeechTextToSpeechGatewayBrak capability do czasu wyboru silnika hosta.
Session recordingSessionSink i platformowy kolektor zdarzeńLokalny, ograniczony bufor; nie usuwa danych po nieudanym uploadzie.
DiagnosticsDiagnosticProbeRaport błędu konkretnej sondy bez przerwania całego audytu.

Katalog artefaktówArtifact catalog

ArtifactFunkcja i zakresFunction and scopePlatforms
adict-coreLightweight event bus, feature store, monetization and platform service contracts; no Compose UI dependency.Android, JVM, iOS, Wasm
adict-foundationPortable owner for services, flags and events; does not pull the legacy Android runtime.Android, JVM, iOS, Wasm
adict-ads-coreProvider-neutral ad requests, mediation and frequency caps.Android, JVM, iOS, Wasm
adict-ads-homeadsSDK-free house-ad campaigns used as the cross-platform fallback.Android, JVM, iOS, Wasm
adict-ads-admobPortable AdMob boundary; Google SDK dependencies exist only in the Android variant. Legacy Android rendering comes from explicit adict-runtime; Apple/Web use an app AdGateway bridge.Android, JVM, iOS, Wasm
adict-adsAggregate of ad core, AdMob boundary and house ads.Android, JVM, iOS, Wasm
adict-billingBilling facade, StoreKit factory, Google Play adapter and hosted-checkout fallback that remains pending until backend verification.Android, JVM, iOS, Wasm
adict-engagementReview, haptics and local-notification facade; native Apple services and Android Play integrations.Android, JVM, iOS, Wasm
adict-securitySecure storage and biometrics facade; Keychain/LocalAuthentication on Apple.Android, JVM, iOS, Wasm
adict-session-recordingPortable event model, redaction, bounded buffering and upload sink; platform UI collectors remain in platform source sets.Android, JVM, iOS, Wasm
adict-ttsPortable speech facade; AVSpeechSynthesizer on Apple and Sherpa ONNX/system adapters on Android.Android, JVM, iOS, Wasm
adict-composeCompose Multiplatform state adapters, ADictPaywall and Android initialization compatibility helpers.Android, JVM, iOS, Wasm
adict-diagnosticsProvider-neutral health probes and serializable reports.Android, JVM, iOS, Wasm
adict-runtimeLegacy Android implementation, manifest discovery and ADict facade.Android only
adictlibraryBackwards-compatible aggregate of every Android feature.Android only
adict-bomVersion alignment for Android/JVM Gradle consumers; KMP source sets may use explicit versions as above.Gradle platform

3. Zsynchronizuj i sprawdź projekt3. Sync and verify the project

Po zmianie zależności wykonaj synchronizację Gradle, a następnie zbuduj wariant debug aplikacji:

After changing the dependency, sync Gradle and build the app's debug variant:

./gradlew :app:assembleDebug

W systemie Windows użyj gradlew.bat zamiast ./gradlew.

On Windows, use gradlew.bat instead of ./gradlew.

Ręczna publikacja wersjiManual version publishing

Poniższe polecenia są przeznaczone dla opiekuna biblioteki. Wartości poświadczeń pozostają w środowisku lub magazynie sekretów i nie są częścią komendy.

The commands below are for library maintainers. Credential values remain in the environment or secret store and are never part of the command.

Snapshot z gałęzi developSnapshot from the develop branch

./gradlew publishAdictSuiteToGitHubPackages -Psnapshot=true --no-daemon

Buduje wariant deweloperski i publikuje wersję z sufiksem -SNAPSHOT.

Builds the development variant and publishes a version carrying the -SNAPSHOT suffix.

Wersja stabilna z main lub taga wydaniaStable version from main or a release tag

./gradlew publishAdictSuiteToGitHubPackages -Psnapshot=false --no-daemon

Buduje wariant release bez sufiksu. Uruchamiaj wyłącznie z czystego commita przeznaczonego do wydania.

Builds the release variant without a suffix. Run it only from a clean commit intended for release.

Lokalny snapshot do pracyLocal development snapshot

./gradlew publishAdictSuiteToMavenLocal -Psnapshot=true --no-daemon

Zadanie Maven Local publikuje linię 3.x z sufiksem -local-SNAPSHOT.

The Maven Local task publishes the 3.x line with the -local-SNAPSHOT suffix.

Lokalna wersja produkcyjnaLocal production build

./gradlew publishAdictSuiteToMavenLocal -Psnapshot=false --no-daemon

Publikuje wariant release jako rip.nerd.adictlibrary:adictlibrary:3.0.0-local. Wersja produkcyjna lokalna nie ma sufiksu -SNAPSHOT.

Publishes the release variant as rip.nerd.adictlibrary:adictlibrary:3.0.0-local. A local production build never carries the -SNAPSHOT suffix.

Projekt testowy musi mieć mavenLocal() i używać dokładnej wersji -local. Dzięki osobnym współrzędnym lokalny artefakt nie może zasłonić zdalnego Stable ani Snapshot.The test project must enable mavenLocal() and request the exact -local version. Separate coordinates prevent a local artifact from shadowing remote Stable or Snapshot builds.
repositories { mavenLocal() }

dependencies {
    implementation("rip.nerd.adictlibrary:adictlibrary:3.0.1-local-SNAPSHOT")
}

ZasadyRules

  • *MavenLocal* zawsze dodaje -local; opcja -Plocal=true służy tylko do podglądu wersji, np. przez printPublicationVersion.*MavenLocal* always adds -local; -Plocal=true is only needed to inspect the version, for example with printPublicationVersion.
  • Artefaktów -local nie wolno wysyłać do współdzielonego repozytorium; build zdalnej publikacji jest przed tym zabezpieczony.-local artifacts must never be uploaded to a shared repository; remote publishing fails fast if this is attempted.
  • -local-SNAPSHOT jest nadpisywalny. Przed opublikowaniem zmienionej wersji -local bez Snapshot należy podnieść baseVersion.-local-SNAPSHOT is replaceable. Bump baseVersion before publishing changed -local content without Snapshot.
  • Gałąź develop publikuje 3.0.1-SNAPSHOT; stabilne wydania powstają wyłącznie z tagów.develop publishes 3.0.1-SNAPSHOT; stable releases are created only from tags.