Skip to content

Commit

Permalink
Firebase: Add Crashlytics and Analytics for iOS and Android (#434)
Browse files Browse the repository at this point in the history
  • Loading branch information
ksharma-xyz authored Dec 6, 2024
1 parent c62a8a2 commit 852ee65
Show file tree
Hide file tree
Showing 16 changed files with 279 additions and 15 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ jobs:
- name: Make Gradle executable
run: chmod +x ./gradlew

- name: Firebase (Release) - Google Services.json file
- name: Firebase Android (Release) - Google Services.json file
env:
DATA: ${{ secrets.FIREBASE_GOOGLE_SERVICES_JSON_RELEASE }}
run: echo $DATA | base64 -di > composeApp/src/androidMain/google-services.json
run: echo $DATA | base64 -di > composeApp/src/release/google-services.json

- name: Firebase (Debug) - Google Services.json file
env:
DATA: ${{ secrets.FIREBASE_GOOGLE_SERVICES_JSON_DEBUG }}
run: echo $DATA | base64 -di > composeApp/src/androidDebug/google-services.json
run: echo $DATA | base64 -di > composeApp/src/debug/google-services.json

# - name: Detekt Checks
# run: ./gradlew detekt
Expand Down Expand Up @@ -90,6 +90,11 @@ jobs:
with:
cache-disabled: true

- name: Firebase iOS - GoogleService-Info.plist file
env:
DATA: ${{ secrets.FIREBASE_IOS_GOOGLE_INFO }}
run: echo $DATA | base64 -d > iosApp/iosApp/GoogleService-Info.plist

- name: Build iOS App - Debug (Without Code Signing)
env:
NSW_TRANSPORT_API_KEY: ${{ secrets.NSW_TRANSPORT_API_KEY }}
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ google-services.json

# XCode

# Ignore GoogleService-Info.plist
/iosApp/iosApp/GoogleService-Info.plist

## User settings
xcuserdata/



2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ plugins {
alias(libs.plugins.google.services) apply false
alias(libs.plugins.composeMultiplatform) apply false
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.firebase.crashlyticsPlugin) apply false
alias(libs.plugins.firebase.performancePlugin) apply false
}
10 changes: 8 additions & 2 deletions composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {

defaultConfig {
applicationId = "xyz.ksharma.krail"
versionCode = 25
versionName = "1.0-beta06"
versionCode = 26
versionName = "1.0-beta07"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down Expand Up @@ -56,6 +56,9 @@ plugins {
alias(libs.plugins.compose.compiler)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.ksp)
alias(libs.plugins.google.services)
alias(libs.plugins.firebase.crashlyticsPlugin)
alias(libs.plugins.firebase.performancePlugin)
}

kotlin {
Expand Down Expand Up @@ -116,6 +119,9 @@ kotlin {
implementation(libs.ktor.serialization.kotlinx.json)

api(libs.di.koinComposeViewmodel)
implementation(libs.firebase.gitLiveCrashlytics)
implementation(libs.firebase.gitLiveAnalytics)
implementation(libs.firebase.gitLivePerformance)
}
}
}
Expand Down
Empty file added composeApp/src/debug/.gitkeep
Empty file.
Empty file added composeApp/src/release/.gitkeep
Empty file.
Binary file removed feature/.DS_Store
Binary file not shown.
10 changes: 9 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ androidx-test = "1.6.1"
androidx-test-ext-junit = "1.2.1"
android-lifecycle = "2.8.7"
activity-compose = "1.9.3"
kotlinInject = "0.7.2"
kotlinxCollectionsImmutable = "0.3.8"
kotlinxDatetime = "0.6.1"
ktorClientAuth = "2.3.13"
Expand All @@ -27,11 +26,13 @@ kermit = "2.0.4"
sqlDelight = "2.0.2"
koin = "4.0.1-Beta1"
slf4jSimple = "2.0.16"
firebaseGitLive = "2.1.0"

[libraries]
buildkonfig-gradle-plugin = { module = "com.codingfeline.buildkonfig:buildkonfig-gradle-plugin", version.ref = "buildkonfigGradlePlugin" }
core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "core-ktx" }
activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activity-compose" }

kotlinx-collections-immutable = { module = "org.jetbrains.kotlinx:kotlinx-collections-immutable", version.ref = "kotlinxCollectionsImmutable" }
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinxDatetime" }
ktor-client-auth = { module = "io.ktor:ktor-client-auth", version.ref = "ktorClientAuth" }
Expand Down Expand Up @@ -85,6 +86,11 @@ db-sqlAndroidDriver = { module = "app.cash.sqldelight:android-driver", version.r
db-sqlNativeDriver = { module = "app.cash.sqldelight:native-driver", version.ref = "sqlDelight" }
db-sqlRuntime = { module = "app.cash.sqldelight:runtime", version.ref = "sqlDelight" }

# Firebase
firebase-gitLiveCrashlytics = { module = "dev.gitlive:firebase-crashlytics", version.ref = "firebaseGitLive" }
firebase-gitLiveAnalytics = { module = "dev.gitlive:firebase-analytics", version.ref = "firebaseGitLive" }
firebase-gitLivePerformance = { module = "dev.gitlive:firebase-perf", version.ref = "firebaseGitLive" }

[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
Expand All @@ -97,6 +103,8 @@ google-services = { id = "com.google.gms.google-services", version = "4.4.2" }
composeMultiplatform = { id = "org.jetbrains.compose", version.ref = "compose-multiplatform" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
sqldelight = { id = "app.cash.sqldelight", version.ref = "sqlDelight" }
firebase-crashlyticsPlugin = { id = "com.google.firebase.crashlytics", version = "3.0.2" }
firebase-performancePlugin = { id ="com.google.firebase.firebase-perf", version = "1.4.2" }

#Convention Plugins
krail-android-application = { id = "krail.android.application", version = "unspecified" }
Expand Down
92 changes: 92 additions & 0 deletions iosApp/iosApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,21 @@
058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557BA273AAA24004C7B11 /* Assets.xcassets */; };
058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */; };
2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2152FB032600AC8F00CF470E /* iOSApp.swift */; };
5DC775CE2D02D0500024A6DD /* FirebaseAnalyticsWithoutAdIdSupport in Frameworks */ = {isa = PBXBuildFile; productRef = 5DC775CD2D02D0500024A6DD /* FirebaseAnalyticsWithoutAdIdSupport */; };
5DC775D02D02D0500024A6DD /* FirebaseCrashlytics in Frameworks */ = {isa = PBXBuildFile; productRef = 5DC775CF2D02D0500024A6DD /* FirebaseCrashlytics */; };
5DC775D22D02D0500024A6DD /* FirebaseRemoteConfig in Frameworks */ = {isa = PBXBuildFile; productRef = 5DC775D12D02D0500024A6DD /* FirebaseRemoteConfig */; };
5DC775D82D0334EC0024A6DD /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 5DC775D72D0334EC0024A6DD /* GoogleService-Info.plist */; };
5DC775DB2D0366710024A6DD /* FirebasePerformance in Frameworks */ = {isa = PBXBuildFile; productRef = 5DC775DA2D0366710024A6DD /* FirebasePerformance */; };
5DC775DD2D036D670024A6DD /* FirebaseAuth in Frameworks */ = {isa = PBXBuildFile; productRef = 5DC775DC2D036D670024A6DD /* FirebaseAuth */; };
5DC775DF2D036D670024A6DD /* FirebaseFirestore in Frameworks */ = {isa = PBXBuildFile; productRef = 5DC775DE2D036D670024A6DD /* FirebaseFirestore */; };
7555FF83242A565900829871 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FF82242A565900829871 /* ContentView.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
058557BA273AAA24004C7B11 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.xcfilelist; };
5DC775D72D0334EC0024A6DD /* GoogleService-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
7555FF7B242A565900829871 /* Krail App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Krail App.app"; sourceTree = BUILT_PRODUCTS_DIR; };
7555FF82242A565900829871 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand All @@ -28,6 +36,12 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
5DC775D22D02D0500024A6DD /* FirebaseRemoteConfig in Frameworks */,
5DC775DD2D036D670024A6DD /* FirebaseAuth in Frameworks */,
5DC775CE2D02D0500024A6DD /* FirebaseAnalyticsWithoutAdIdSupport in Frameworks */,
5DC775DB2D0366710024A6DD /* FirebasePerformance in Frameworks */,
5DC775D02D02D0500024A6DD /* FirebaseCrashlytics in Frameworks */,
5DC775DF2D036D670024A6DD /* FirebaseFirestore in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -70,6 +84,7 @@
7555FF7D242A565900829871 /* iosApp */ = {
isa = PBXGroup;
children = (
5DC775D72D0334EC0024A6DD /* GoogleService-Info.plist */,
058557BA273AAA24004C7B11 /* Assets.xcassets */,
7555FF82242A565900829871 /* ContentView.swift */,
7555FF8C242A565B00829871 /* Info.plist */,
Expand Down Expand Up @@ -98,13 +113,20 @@
7555FF77242A565900829871 /* Sources */,
B92378962B6B1156000C7307 /* Frameworks */,
7555FF79242A565900829871 /* Resources */,
5DC775D92D03386F0024A6DD /* ShellScript */,
);
buildRules = (
);
dependencies = (
);
name = iosApp;
packageProductDependencies = (
5DC775CD2D02D0500024A6DD /* FirebaseAnalyticsWithoutAdIdSupport */,
5DC775CF2D02D0500024A6DD /* FirebaseCrashlytics */,
5DC775D12D02D0500024A6DD /* FirebaseRemoteConfig */,
5DC775DA2D0366710024A6DD /* FirebasePerformance */,
5DC775DC2D036D670024A6DD /* FirebaseAuth */,
5DC775DE2D036D670024A6DD /* FirebaseFirestore */,
);
productName = iosApp;
productReference = 7555FF7B242A565900829871 /* Krail App.app */;
Expand Down Expand Up @@ -136,6 +158,7 @@
);
mainGroup = 7555FF72242A565900829871;
packageReferences = (
5DC775CC2D02D0500024A6DD /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */,
);
productRefGroup = 7555FF7C242A565900829871 /* Products */;
projectDirPath = "";
Expand All @@ -152,13 +175,36 @@
buildActionMask = 2147483647;
files = (
058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */,
5DC775D82D0334EC0024A6DD /* GoogleService-Info.plist in Resources */,
058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
5DC775D92D03386F0024A6DD /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 12;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}",
"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}",
"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Info.plist",
"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Info.plist",
"$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)",
);
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n\"${SHARED_PRECOMPS_DIR%/Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run\"\n";
};
F36B1CEB2AD83DDC00CB74D5 /* Compile Kotlin Framework */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -341,6 +387,7 @@
"@executable_path/Frameworks",
);
MARKETING_VERSION = "1.0-alpha10";
"OTHER_LDFLAGS[arch=*]" = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = "${BUNDLE_ID}${TEAM_ID}";
PRODUCT_NAME = "${APP_NAME}";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -376,6 +423,7 @@
"@executable_path/Frameworks",
);
MARKETING_VERSION = "1.0-alpha10";
"OTHER_LDFLAGS[arch=*]" = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = "${BUNDLE_ID}${TEAM_ID}";
PRODUCT_NAME = "${APP_NAME}";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -410,6 +458,50 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
5DC775CC2D02D0500024A6DD /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/firebase/firebase-ios-sdk";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 11.6.0;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
5DC775CD2D02D0500024A6DD /* FirebaseAnalyticsWithoutAdIdSupport */ = {
isa = XCSwiftPackageProductDependency;
package = 5DC775CC2D02D0500024A6DD /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
productName = FirebaseAnalyticsWithoutAdIdSupport;
};
5DC775CF2D02D0500024A6DD /* FirebaseCrashlytics */ = {
isa = XCSwiftPackageProductDependency;
package = 5DC775CC2D02D0500024A6DD /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
productName = FirebaseCrashlytics;
};
5DC775D12D02D0500024A6DD /* FirebaseRemoteConfig */ = {
isa = XCSwiftPackageProductDependency;
package = 5DC775CC2D02D0500024A6DD /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
productName = FirebaseRemoteConfig;
};
5DC775DA2D0366710024A6DD /* FirebasePerformance */ = {
isa = XCSwiftPackageProductDependency;
package = 5DC775CC2D02D0500024A6DD /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
productName = FirebasePerformance;
};
5DC775DC2D036D670024A6DD /* FirebaseAuth */ = {
isa = XCSwiftPackageProductDependency;
package = 5DC775CC2D02D0500024A6DD /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
productName = FirebaseAuth;
};
5DC775DE2D036D670024A6DD /* FirebaseFirestore */ = {
isa = XCSwiftPackageProductDependency;
package = 5DC775CC2D02D0500024A6DD /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
productName = FirebaseFirestore;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 7555FF73242A565900829871 /* Project object */;
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 852ee65

Please sign in to comment.