Skip to content
This repository has been archived by the owner on Sep 3, 2023. It is now read-only.

Commit

Permalink
Switch to Firebase Crashlytics
Browse files Browse the repository at this point in the history
  • Loading branch information
afollestad committed Mar 14, 2019
1 parent 1259bc1 commit 062a408
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 54 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Expand Up @@ -180,4 +180,6 @@ gradle-app.setting
.gradletasknamecache

# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties
# gradle/wrapper/gradle-wrapper.properties

app/google-services.json
18 changes: 6 additions & 12 deletions app/build.gradle
Expand Up @@ -4,8 +4,6 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'

apply from: '../fabric.gradle'

android {
compileSdkVersion versions.compileSdk
buildToolsVersion versions.buildTools
Expand All @@ -17,15 +15,6 @@ android {
versionCode versions.publishVersionCode
versionName versions.publishVersion
}

buildTypes {
debug {
buildConfigField "String", "FABRIC_API_KEY", "\"\""
}
release {
buildConfigField "String", "FABRIC_API_KEY", "\"${getFabricApiKey()}\""
}
}
}

dependencies {
Expand All @@ -40,6 +29,7 @@ dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:' + versions.coroutines

// Google/AndroidX
implementation 'com.google.firebase:firebase-core:' + versions.firebaseCore
implementation 'androidx.preference:preference:' + versions.androidxPrefs
implementation 'androidx.lifecycle:lifecycle-extensions:' + versions.lifecycle
kapt 'androidx.lifecycle:lifecycle-compiler:' + versions.lifecycle
Expand Down Expand Up @@ -72,4 +62,8 @@ dependencies {
testImplementation project(':testutil')
}

apply from: '../spotless.gradle'
apply from: '../spotless.gradle'
apply from: '../mock/mock.gradle'

apply plugin: "io.fabric"
apply plugin: 'com.google.gms.google-services'
22 changes: 10 additions & 12 deletions app/src/main/java/com/afollestad/mnmlscreenrecord/MnmlApp.kt
Expand Up @@ -44,22 +44,20 @@ class MnmlApp : Application() {
Timber.plant(DebugTree())
}

if (BuildConfig.FABRIC_API_KEY.isNotEmpty()) {
Timber.plant(FabricTree())
Fabric.with(this, Crashlytics())
}
Timber.plant(FabricTree())
Fabric.with(this, Crashlytics())

val modules = listOf(
commonModule,
notificationsModule,
prefModule,
engineModule,
mainModule,
viewModelModule
commonModule,
notificationsModule,
prefModule,
engineModule,
mainModule,
viewModelModule
)
startKoin(
androidContext = this,
modules = modules
androidContext = this,
modules = modules
)

val notifications by inject<Notifications>()
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Expand Up @@ -14,6 +14,7 @@ buildscript {
classpath 'com.diffplug.spotless:spotless-plugin-gradle:' + versions.spotlessPlugin
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:' + versions.kotlin
classpath 'com.github.ben-manes:gradle-versions-plugin:' + versions.versionPlugin
classpath 'com.google.gms:google-services:' + versions.googleServices
classpath 'io.fabric.tools:gradle:' + versions.fabricPlugin
}
}
Expand Down
2 changes: 2 additions & 0 deletions dependencies.gradle
Expand Up @@ -10,6 +10,7 @@ ext.versions = [
gradlePlugin : '3.3.2',
spotlessPlugin : '3.19.0',
versionPlugin : '0.21.0',
googleServices : '4.2.0',
fabricPlugin : '1.+',

// Kotlin
Expand All @@ -25,6 +26,7 @@ ext.versions = [
androidxBrowser : '1.0.0',

// Other Google
firebaseCore : '16.0.7',
lifecycle : '2.0.0',

// Glide
Expand Down
29 changes: 0 additions & 29 deletions fabric.gradle

This file was deleted.

42 changes: 42 additions & 0 deletions mock/mock-google-services.json
@@ -0,0 +1,42 @@
{
"project_info": {
"project_number": "123456789000",
"firebase_url": "https://mockproject-1234.firebaseio.com",
"project_id": "mockproject-1234",
"storage_bucket": "mockproject-1234.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:123456789000:android:f1bf012572b04063",
"android_client_info": {
"package_name": "com.afollestad.mnmlscreenrecord"
}
},
"oauth_client": [
{
"client_id": "123456789000-hjugbg6ud799v4c49dim8ce2usclthar.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzbSzCn1N6LWIe6wthYyrgUUSAlUsdqMb-wvTo"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"ads_service": {
"status": 2
}
}
}
],
"configuration_version": "1"
}
13 changes: 13 additions & 0 deletions mock/mock.gradle
@@ -0,0 +1,13 @@
// This script must be applied in app/build.gradle for the paths here to work correctly

def copyMockFilesNeeded() {
def srcGoogleServicesFile = file("../mock/mock-google-services.json")
def destGoogleServicesFile = file("google-services.json")
if (!destGoogleServicesFile.exists()) {
destGoogleServicesFile.write(srcGoogleServicesFile.text)
}
}

afterEvaluate {
copyMockFilesNeeded()
}

0 comments on commit 062a408

Please sign in to comment.