Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Api Validation, Explicit API Mode & Linting #550

Merged
merged 17 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
root = true

[*.{kt,kts}]
ktlint_code_style = intellij_idea
ktlint_ignore_back_ticked_identifier = true

ktlint_standard = enabled
ktlint_standard_no-wildcard-imports = disabled
ktlint_standard_filename = disabled
ktlint_standard_import-ordering = disabled
ktlint_standard_function-naming = disabled

ktlint_experimental = disabled

4 changes: 4 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ jobs:
key: cocoapods-cache-v2
- name: Setup test environment
uses: ./.github/actions/setup_test_action
- name: ktLint
run: ./gradlew lintKotlin
- name: Run iOS Tests
run: ./gradlew cleanTest iosSimulatorArm64Test
- name: Upload iOS test artifact
Expand All @@ -118,6 +120,8 @@ jobs:
- name: Setup test environment
uses: ./.github/actions/setup_test_action
timeout-minutes: 10
- name: run apiCheck
run: ./gradlew apiCheck
- name: Run JVM Tests
run: ./gradlew cleanTest jvmTest
- name: Upload JVM test artifact
Expand Down
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,12 @@ To run the tests you can use the following gradle tasks:

`./gradlew connectedAndroidTest` (an emulator needs to be running)

`./gradlew iosSimulatorArm64Test`
`./gradlew iosSimulatorArm64Test` (On Apple Chip) `./gradlew iosX64Test` (On Intel Chip)

`./gradlew jsNodeTest`

`./gradlew jvmTest`

For some tests you need to have the firebase emulator suite running. After installing them you can run the following command inside the `test` directory:

`firebase emulators:start`
Expand All @@ -305,6 +307,17 @@ For some tests you need to have the firebase emulator suite running. After insta
For every publicly available class or function there needs to be documentation written in the [KDoc syntax](https://kotlinlang.org/docs/kotlin-doc.html).
We publish a new version of the documentation after every release and can be found [here](https://gitliveapp.github.io/firebase-kotlin-sdk/)

### Validation
To ensure changes to the public API are well documented, this library validates its binary API. If you make changes to the API, make sure to run

`./gradlew apiDump`

### Code style
This library uses the [Intellij Kotlin code style](https://www.jetbrains.com/help/idea/code-style-kotlin.html). Run the linter to make sure you follow these styles.

`./gradlew formatKotlin` to format to the proper style
`./gradlew lintKotlin` to validate the correct style is used

### Compatibility with the official [Firebase Android SDK](https://github.com/firebase/firebase-android-sdk)

When this project began, the official Firebase Android SDK was a pure java library and the separate Kotlin extensions (KTX) module consisted of only a few extensions providing some syntactic sugar, for example `Firebase.firestore` instead of `Firebase.getInstance(),` which we naturally copied for the Firebase Kotlin SDK.
Expand Down
3 changes: 3 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ plugins {
alias(libs.plugins.native.cocoapods) apply false
alias(libs.plugins.test.logger.plugin) apply false
alias(libs.plugins.ben.manes.versions) apply false
alias(libs.plugins.kotlinter) apply false
alias(libs.plugins.kotlinx.binarycompatibilityvalidator)
alias(libs.plugins.dokka)
id("base")
id("testOptionsConvention")
Expand Down Expand Up @@ -104,6 +106,7 @@ subprojects {
}

apply(plugin = "com.adarshr.test-logger")
apply(plugin = "org.jmailen.kotlinter")

repositories {
mavenLocal()
Expand Down
210 changes: 210 additions & 0 deletions firebase-analytics/api/android/firebase-analytics.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
public final class dev/gitlive/firebase/analytics/AnalyticEventConstantsKt {
public static final fun getEvent (Ldev/gitlive/firebase/analytics/FirebaseAnalytics;)Ldev/gitlive/firebase/analytics/FirebaseAnalyticsEvents;
public static final fun getParam (Ldev/gitlive/firebase/analytics/FirebaseAnalytics;)Ldev/gitlive/firebase/analytics/FirebaseAnalyticsParam;
public static final fun getUserProperty (Ldev/gitlive/firebase/analytics/FirebaseAnalytics;)Ldev/gitlive/firebase/analytics/FirebaseAnalyticsUserProperty;
}

public final class dev/gitlive/firebase/analytics/AnalyticsKt {
public static final fun logEvent (Ldev/gitlive/firebase/analytics/FirebaseAnalytics;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V
public static final fun setConsent (Ldev/gitlive/firebase/analytics/FirebaseAnalytics;Lkotlin/jvm/functions/Function1;)V
}

public final class dev/gitlive/firebase/analytics/FirebaseAnalytics {
public fun <init> (Lcom/google/firebase/analytics/FirebaseAnalytics;)V
public final fun getAndroid ()Lcom/google/firebase/analytics/FirebaseAnalytics;
public final fun getSessionId (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun logEvent (Ljava/lang/String;Ljava/util/Map;)V
public static synthetic fun logEvent$default (Ldev/gitlive/firebase/analytics/FirebaseAnalytics;Ljava/lang/String;Ljava/util/Map;ILjava/lang/Object;)V
public final fun resetAnalyticsData ()V
public final fun setAnalyticsCollectionEnabled (Z)V
public final fun setConsent (Ljava/util/Map;)V
public final fun setDefaultEventParameters (Ljava/util/Map;)V
public final fun setSessionTimeoutInterval (J)V
public final fun setUserId (Ljava/lang/String;)V
public final fun setUserProperty (Ljava/lang/String;Ljava/lang/String;)V
}

public final class dev/gitlive/firebase/analytics/FirebaseAnalytics$ConsentStatus : java/lang/Enum {
public static final field DENIED Ldev/gitlive/firebase/analytics/FirebaseAnalytics$ConsentStatus;
public static final field GRANTED Ldev/gitlive/firebase/analytics/FirebaseAnalytics$ConsentStatus;
public static fun getEntries ()Lkotlin/enums/EnumEntries;
public static fun valueOf (Ljava/lang/String;)Ldev/gitlive/firebase/analytics/FirebaseAnalytics$ConsentStatus;
public static fun values ()[Ldev/gitlive/firebase/analytics/FirebaseAnalytics$ConsentStatus;
}

public final class dev/gitlive/firebase/analytics/FirebaseAnalytics$ConsentType : java/lang/Enum {
public static final field AD_PERSONALIZATION Ldev/gitlive/firebase/analytics/FirebaseAnalytics$ConsentType;
public static final field AD_STORAGE Ldev/gitlive/firebase/analytics/FirebaseAnalytics$ConsentType;
public static final field AD_USER_DATA Ldev/gitlive/firebase/analytics/FirebaseAnalytics$ConsentType;
public static final field ANALYTICS_STORAGE Ldev/gitlive/firebase/analytics/FirebaseAnalytics$ConsentType;
public static fun getEntries ()Lkotlin/enums/EnumEntries;
public static fun valueOf (Ljava/lang/String;)Ldev/gitlive/firebase/analytics/FirebaseAnalytics$ConsentType;
public static fun values ()[Ldev/gitlive/firebase/analytics/FirebaseAnalytics$ConsentType;
}

public final class dev/gitlive/firebase/analytics/FirebaseAnalyticsConsentBuilder {
public fun <init> ()V
public fun <init> (Ljava/util/Map;)V
public synthetic fun <init> (Ljava/util/Map;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Ljava/util/Map;
public final fun copy (Ljava/util/Map;)Ldev/gitlive/firebase/analytics/FirebaseAnalyticsConsentBuilder;
public static synthetic fun copy$default (Ldev/gitlive/firebase/analytics/FirebaseAnalyticsConsentBuilder;Ljava/util/Map;ILjava/lang/Object;)Ldev/gitlive/firebase/analytics/FirebaseAnalyticsConsentBuilder;
public fun equals (Ljava/lang/Object;)Z
public final fun getAdPersonalization ()Ldev/gitlive/firebase/analytics/FirebaseAnalytics$ConsentStatus;
public final fun getAdStorage ()Ldev/gitlive/firebase/analytics/FirebaseAnalytics$ConsentStatus;
public final fun getAdUserData ()Ldev/gitlive/firebase/analytics/FirebaseAnalytics$ConsentStatus;
public final fun getAnalyticsStorage ()Ldev/gitlive/firebase/analytics/FirebaseAnalytics$ConsentStatus;
public final fun getConsentSettings ()Ljava/util/Map;
public fun hashCode ()I
public final fun setAdPersonalization (Ldev/gitlive/firebase/analytics/FirebaseAnalytics$ConsentStatus;)V
public final fun setAdStorage (Ldev/gitlive/firebase/analytics/FirebaseAnalytics$ConsentStatus;)V
public final fun setAdUserData (Ldev/gitlive/firebase/analytics/FirebaseAnalytics$ConsentStatus;)V
public final fun setAnalyticsStorage (Ldev/gitlive/firebase/analytics/FirebaseAnalytics$ConsentStatus;)V
public fun toString ()Ljava/lang/String;
}

public final class dev/gitlive/firebase/analytics/FirebaseAnalyticsEvents {
public static final field ADD_PAYMENT_INFO Ljava/lang/String;
public static final field ADD_SHIPPING_INFO Ljava/lang/String;
public static final field ADD_TO_CART Ljava/lang/String;
public static final field ADD_TO_WISHLIST Ljava/lang/String;
public static final field AD_IMPRESSION Ljava/lang/String;
public static final field APP_OPEN Ljava/lang/String;
public static final field BEGIN_CHECKOUT Ljava/lang/String;
public static final field CAMPAIGN_DETAILS Ljava/lang/String;
public static final field EARN_VIRTUAL_CURRENCY Ljava/lang/String;
public static final field GENERATE_LEAD Ljava/lang/String;
public static final field INSTANCE Ldev/gitlive/firebase/analytics/FirebaseAnalyticsEvents;
public static final field JOIN_GROUP Ljava/lang/String;
public static final field LEVEL_END Ljava/lang/String;
public static final field LEVEL_START Ljava/lang/String;
public static final field LEVEL_UP Ljava/lang/String;
public static final field LOGIN Ljava/lang/String;
public static final field POST_SCORE Ljava/lang/String;
public static final field PURCHASE Ljava/lang/String;
public static final field REFUND Ljava/lang/String;
public static final field REMOVE_FROM_CART Ljava/lang/String;
public static final field SCREEN_VIEW Ljava/lang/String;
public static final field SEARCH Ljava/lang/String;
public static final field SELECT_CONTENT Ljava/lang/String;
public static final field SELECT_ITEM Ljava/lang/String;
public static final field SELECT_PROMOTION Ljava/lang/String;
public static final field SHARE Ljava/lang/String;
public static final field SIGN_UP Ljava/lang/String;
public static final field SPEND_VIRTUAL_CURRENCY Ljava/lang/String;
public static final field TUTORIAL_BEGIN Ljava/lang/String;
public static final field TUTORIAL_COMPLETE Ljava/lang/String;
public static final field UNLOCK_ACHIEVEMENT Ljava/lang/String;
public static final field VIEW_CART Ljava/lang/String;
public static final field VIEW_ITEM Ljava/lang/String;
public static final field VIEW_ITEM_LIST Ljava/lang/String;
public static final field VIEW_PROMOTION Ljava/lang/String;
public static final field VIEW_SEARCH_RESULTS Ljava/lang/String;
}

public final class dev/gitlive/firebase/analytics/FirebaseAnalyticsException : java/lang/Exception {
public fun <init> (Ljava/lang/String;)V
}

public final class dev/gitlive/firebase/analytics/FirebaseAnalyticsParam {
public static final field ACHIEVEMENT_ID Ljava/lang/String;
public static final field ACLID Ljava/lang/String;
public static final field AD_FORMAT Ljava/lang/String;
public static final field AD_PLATFORM Ljava/lang/String;
public static final field AD_SOURCE Ljava/lang/String;
public static final field AD_UNIT_NAME Ljava/lang/String;
public static final field AFFILIATION Ljava/lang/String;
public static final field CAMPAIGN Ljava/lang/String;
public static final field CAMPAIGN_ID Ljava/lang/String;
public static final field CHARACTER Ljava/lang/String;
public static final field CONTENT Ljava/lang/String;
public static final field CONTENT_TYPE Ljava/lang/String;
public static final field COUPON Ljava/lang/String;
public static final field CP1 Ljava/lang/String;
public static final field CREATIVE_FORMAT Ljava/lang/String;
public static final field CREATIVE_NAME Ljava/lang/String;
public static final field CREATIVE_SLOT Ljava/lang/String;
public static final field CURRENCY Ljava/lang/String;
public static final field DESTINATION Ljava/lang/String;
public static final field DISCOUNT Ljava/lang/String;
public static final field END_DATE Ljava/lang/String;
public static final field EXTEND_SESSION Ljava/lang/String;
public static final field FLIGHT_NUMBER Ljava/lang/String;
public static final field GROUP_ID Ljava/lang/String;
public static final field INDEX Ljava/lang/String;
public static final field INSTANCE Ldev/gitlive/firebase/analytics/FirebaseAnalyticsParam;
public static final field ITEMS Ljava/lang/String;
public static final field ITEM_BRAND Ljava/lang/String;
public static final field ITEM_CATEGORY Ljava/lang/String;
public static final field ITEM_CATEGORY2 Ljava/lang/String;
public static final field ITEM_CATEGORY3 Ljava/lang/String;
public static final field ITEM_CATEGORY4 Ljava/lang/String;
public static final field ITEM_CATEGORY5 Ljava/lang/String;
public static final field ITEM_ID Ljava/lang/String;
public static final field ITEM_LIST_ID Ljava/lang/String;
public static final field ITEM_LIST_NAME Ljava/lang/String;
public static final field ITEM_NAME Ljava/lang/String;
public static final field ITEM_VARIANT Ljava/lang/String;
public static final field LEVEL Ljava/lang/String;
public static final field LEVEL_NAME Ljava/lang/String;
public static final field LOCATION Ljava/lang/String;
public static final field LOCATION_ID Ljava/lang/String;
public static final field MARKETING_TACTIC Ljava/lang/String;
public static final field MEDIUM Ljava/lang/String;
public static final field METHOD Ljava/lang/String;
public static final field NUMBER_OF_NIGHTS Ljava/lang/String;
public static final field NUMBER_OF_PASSENGERS Ljava/lang/String;
public static final field NUMBER_OF_ROOMS Ljava/lang/String;
public static final field ORIGIN Ljava/lang/String;
public static final field PAYMENT_TYPE Ljava/lang/String;
public static final field PRICE Ljava/lang/String;
public static final field PROMOTION_ID Ljava/lang/String;
public static final field PROMOTION_NAME Ljava/lang/String;
public static final field QUANTITY Ljava/lang/String;
public static final field SCORE Ljava/lang/String;
public static final field SCREEN_CLASS Ljava/lang/String;
public static final field SCREEN_NAME Ljava/lang/String;
public static final field SEARCH_TERM Ljava/lang/String;
public static final field SHIPPING Ljava/lang/String;
public static final field SHIPPING_TIER Ljava/lang/String;
public static final field SOURCE Ljava/lang/String;
public static final field SOURCE_PLATFORM Ljava/lang/String;
public static final field START_DATE Ljava/lang/String;
public static final field SUCCESS Ljava/lang/String;
public static final field TAX Ljava/lang/String;
public static final field TERM Ljava/lang/String;
public static final field TRANSACTION_ID Ljava/lang/String;
public static final field TRAVEL_CLASS Ljava/lang/String;
public static final field VALUE Ljava/lang/String;
public static final field VIRTUAL_CURRENCY_NAME Ljava/lang/String;
}

public final class dev/gitlive/firebase/analytics/FirebaseAnalyticsParameters {
public fun <init> ()V
public fun <init> (Ljava/util/Map;)V
public synthetic fun <init> (Ljava/util/Map;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Ljava/util/Map;
public final fun copy (Ljava/util/Map;)Ldev/gitlive/firebase/analytics/FirebaseAnalyticsParameters;
public static synthetic fun copy$default (Ldev/gitlive/firebase/analytics/FirebaseAnalyticsParameters;Ljava/util/Map;ILjava/lang/Object;)Ldev/gitlive/firebase/analytics/FirebaseAnalyticsParameters;
public fun equals (Ljava/lang/Object;)Z
public final fun getParameters ()Ljava/util/Map;
public fun hashCode ()I
public final fun param (Ljava/lang/String;D)V
public final fun param (Ljava/lang/String;I)V
public final fun param (Ljava/lang/String;J)V
public final fun param (Ljava/lang/String;Ljava/lang/String;)V
public final fun param (Ljava/lang/String;Z)V
public fun toString ()Ljava/lang/String;
}

public final class dev/gitlive/firebase/analytics/FirebaseAnalyticsUserProperty {
public static final field ALLOW_AD_PERSONALIZATION_SIGNALS Ljava/lang/String;
public static final field INSTANCE Ldev/gitlive/firebase/analytics/FirebaseAnalyticsUserProperty;
public static final field SIGN_UP_METHOD Ljava/lang/String;
}

public final class dev/gitlive/firebase/analytics/analyticsAndroid {
public static final fun analytics (Ldev/gitlive/firebase/Firebase;Ldev/gitlive/firebase/FirebaseApp;)Ldev/gitlive/firebase/analytics/FirebaseAnalytics;
public static final fun getAnalytics (Ldev/gitlive/firebase/Firebase;)Ldev/gitlive/firebase/analytics/FirebaseAnalytics;
}

Loading
Loading