Skip to content

Commit

Permalink
Update deps, bump 1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pluscubed committed Dec 5, 2020
1 parent 7020800 commit c42cfe0
Show file tree
Hide file tree
Showing 40 changed files with 738 additions and 719 deletions.
69 changes: 30 additions & 39 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ buildscript {
}

dependencies {
classpath 'io.fabric.tools:gradle:1.31.0'
classpath 'com.google.android.gms:oss-licenses-plugin:0.9.5'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.2'
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.android.gms.oss-licenses-plugin'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.crashlytics'

android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
compileSdkVersion 30
buildToolsVersion "30.0.2"

if (project.hasProperty("RELEASE_STORE_FILE")) {
signingConfigs {
Expand All @@ -45,15 +45,10 @@ android {
applicationId "com.pluscubed.velociraptor"
minSdkVersion 21
targetSdkVersion 29
versionCode 56
versionName "1.6.19"
versionCode 57
versionName "1.7.0"
vectorDrawables.useSupportLibrary = true
manifestPlaceholders = [appName: "@string/app_name"]
if(project.hasProperty("FABRIC_API_KEY")){
manifestPlaceholders.put("FABRIC_API_KEY", FABRIC_API_KEY)
}else{
manifestPlaceholders.put("FABRIC_API_KEY", "")
}

lintOptions {
disable 'MissingTranslation'
Expand Down Expand Up @@ -118,51 +113,51 @@ repositories {
}

ext{
retrofit_version = '2.6.1'
okhttp_version = '3.14.2'
leakcanary_version = '1.6.3'
jackson_version = '2.9.9'
room_version = '2.2.0-beta01'
butterknife_version = '10.1.0'
retrofit_version = '2.9.0'
okhttp_version = '3.14.9'
jackson_version = '2.12.0'
room_version = '2.2.5'
butterknife_version = '10.2.3'
}

dependencies {
testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13.1'
testImplementation 'org.mockito:mockito-all:1.10.19'
testImplementation 'org.hamcrest:hamcrest-all:1.3'
testImplementation 'org.robolectric:robolectric:4.3'
testImplementation 'org.robolectric:robolectric:4.4'

//debugImplementation 'im.dino:dbinspector:3.4.1@aar'
//debugIapImplementation 'im.dino:dbinspector:3.4.1@aar'

implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"

implementation "androidx.appcompat:appcompat:1.0.2"
implementation "androidx.appcompat:appcompat:1.2.0"
implementation "androidx.annotation:annotation:1.1.0"
implementation "androidx.cardview:cardview:1.0.0"
implementation "com.google.android.material:material:1.1.0-alpha06"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation "com.google.android.material:material:1.2.1"

implementation "com.google.firebase:firebase-core:17.2.0"
implementation "com.google.firebase:firebase-messaging:20.0.0"
implementation "com.google.firebase:firebase-config:19.0.0"
implementation "com.google.firebase:firebase-core:18.0.0"
implementation "com.google.firebase:firebase-messaging:21.0.0"
implementation "com.google.firebase:firebase-config:20.0.2"

implementation "com.android.billingclient:billing:1.2.2"

implementation "com.google.android.gms:play-services-location:17.0.0"
implementation "com.google.android.gms:play-services-location:17.1.0"
implementation "com.google.android.gms:play-services-oss-licenses:17.0.0"
implementation "com.google.android.gms:play-services-maps:17.0.0"
implementation "com.google.maps.android:android-maps-utils:0.5"
implementation "com.google.maps.android:android-maps-utils:2.2.0"

implementation 'com.afollestad.material-dialogs:core:3.1.0'
implementation 'com.afollestad.material-dialogs:core:3.3.0'

implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:converter-jackson:$retrofit_version"
implementation "com.squareup.retrofit2:converter-scalars:$retrofit_version"
implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version"
implementation "com.squareup.okhttp3:okhttp:$okhttp_version"
implementation 'com.squareup.okio:okio:2.4.0'
implementation 'com.squareup.okio:okio:2.9.0'

implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
Expand All @@ -180,18 +175,14 @@ dependencies {
implementation 'com.jakewharton.timber:timber:4.7.1'

// LeakCanary temporarily disabled
debugImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakcanary_version"
debugIapImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakcanary_version"
testImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakcanary_version"
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakcanary_version"
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.5'

implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') {
transitive = true;
}
implementation 'com.google.firebase:firebase-crashlytics:17.3.0'
implementation 'com.google.firebase:firebase-analytics:18.0.0'

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'androidx.core:core-ktx:1.2.0-alpha03'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0'
implementation 'androidx.core:core-ktx:1.5.0-alpha05'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2'
}


Expand Down
8 changes: 0 additions & 8 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,5 @@
android:name="google_analytics_adid_collection_enabled"
android:value="false" />

<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="false" />

<meta-data
android:name="io.fabric.ApiKey"
android:value="${FABRIC_API_KEY}" />

</application>
</manifest>
32 changes: 9 additions & 23 deletions app/src/main/java/com/pluscubed/velociraptor/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@ package com.pluscubed.velociraptor

import android.app.Application
import com.bumptech.glide.Glide
import com.crashlytics.android.Crashlytics
import com.crashlytics.android.core.CrashlyticsCore
import com.google.firebase.FirebaseApp
import com.google.firebase.remoteconfig.FirebaseRemoteConfig
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings
import com.google.firebase.crashlytics.FirebaseCrashlytics
import com.pluscubed.velociraptor.settings.appselection.AppInfo
import com.pluscubed.velociraptor.settings.appselection.AppInfoIconLoader
import com.pluscubed.velociraptor.settings.appselection.SelectedAppDatabase
import com.pluscubed.velociraptor.utils.PrefUtils
import com.squareup.leakcanary.LeakCanary
import io.fabric.sdk.android.Fabric
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
Expand All @@ -25,40 +20,31 @@ class App : Application() {
override fun onCreate() {
super.onCreate()

val crashlyticsKit = Crashlytics.Builder()
.core(CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build())
.build()
Fabric.with(this, crashlyticsKit)
val crashlytics = FirebaseCrashlytics.getInstance()
crashlytics.setCrashlyticsCollectionEnabled(!BuildConfig.DEBUG)

FirebaseApp.initializeApp(this)
val configSettings = FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(BuildConfig.DEBUG)
.build()
FirebaseRemoteConfig.getInstance().setConfigSettings(configSettings)

if (BuildConfig.DEBUG) {
Timber.plant(Timber.DebugTree())
}

LeakCanary.install(this)

Glide.get(this)
.register(AppInfo::class.java, InputStream::class.java, AppInfoIconLoader.Factory())
.register(AppInfo::class.java, InputStream::class.java, AppInfoIconLoader.Factory())

if (PrefUtils.isAllMapApps(this)) {
GlobalScope.launch {
try {
val mapApps =
withContext(Dispatchers.IO) { SelectedAppDatabase.getMapApps(this@App) }
.filter { appInfoEntity ->
appInfoEntity.packageName != null && !appInfoEntity.packageName.isEmpty()
}.map { appInfo -> appInfo.packageName }
withContext(Dispatchers.IO) { SelectedAppDatabase.getMapApps(this@App) }
.filter { appInfoEntity ->
appInfoEntity.packageName != null && !appInfoEntity.packageName.isEmpty()
}.map { appInfo -> appInfo.packageName }

PrefUtils.setApps(this@App, mapApps.toHashSet())
} catch (e: Exception) {
e.printStackTrace()
if (!BuildConfig.DEBUG)
Crashlytics.logException(e)
FirebaseCrashlytics.getInstance().recordException(e)
}
}
}
Expand Down
36 changes: 18 additions & 18 deletions app/src/main/java/com/pluscubed/velociraptor/api/LimitFetcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ class LimitFetcher(private val context: Context) {

private fun buildOkHttpClient(): OkHttpClient {
val builder = OkHttpClient.Builder()
.connectTimeout(15, TimeUnit.SECONDS)
.writeTimeout(15, TimeUnit.SECONDS)
.readTimeout(15, TimeUnit.SECONDS)
.connectTimeout(15, TimeUnit.SECONDS)
.writeTimeout(15, TimeUnit.SECONDS)
.readTimeout(15, TimeUnit.SECONDS)
if (BuildConfig.DEBUG) {
val loggingInterceptor = HttpLoggingInterceptor()
loggingInterceptor.level = HttpLoggingInterceptor.Level.BODY
Expand Down Expand Up @@ -72,16 +72,16 @@ class LimitFetcher(private val context: Context) {
// 1. Always try raptor service if cache didn't hit / didn't contain a limit
if (limitResponses.last().speedLimit == -1 && networkConnected) {
val hereResponses =
raptorLimitProvider.getSpeedLimit(location, lastResponse, LimitResponse.ORIGIN_HERE)
raptorLimitProvider.getSpeedLimit(location, lastResponse, LimitResponse.ORIGIN_HERE)
if (hereResponses.isNotEmpty())
limitResponses += hereResponses[0]
}

if (limitResponses.last().speedLimit == -1 && networkConnected) {
val tomtomResponses = raptorLimitProvider.getSpeedLimit(
location,
lastResponse,
LimitResponse.ORIGIN_TOMTOM
location,
lastResponse,
LimitResponse.ORIGIN_TOMTOM
)
if (tomtomResponses.isNotEmpty())
limitResponses += tomtomResponses[0]
Expand All @@ -105,12 +105,12 @@ class LimitFetcher(private val context: Context) {

//Accumulate debug infos, based on the last response (the one with the speed limit or the last option)
var finalResponse =
if (PrefUtils.isDebuggingEnabled(context))
limitResponses.reduce { acc, next ->
next.copy(debugInfo = acc.debugInfo + "\n" + next.debugInfo)
}
else
limitResponses.last()
if (PrefUtils.isDebuggingEnabled(context))
limitResponses.reduce { acc, next ->
next.copy(debugInfo = acc.debugInfo + "\n" + next.debugInfo)
}
else
limitResponses.last()

//Record the last response's timestamp and network response
if (finalResponse.timestamp == 0L) {
Expand All @@ -129,11 +129,11 @@ class LimitFetcher(private val context: Context) {
companion object {
fun buildRetrofit(client: OkHttpClient, baseUrl: String): Retrofit {
return Retrofit.Builder()
.baseUrl(baseUrl)
.client(client)
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(JacksonConverterFactory.create())
.build()
.baseUrl(baseUrl)
.client(client)
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(JacksonConverterFactory.create())
.build()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ interface LimitProvider {
*/
@WorkerThread
fun getSpeedLimit(
location: Location,
lastResponse: LimitResponse?,
origin: Int = -1
location: Location,
lastResponse: LimitResponse?,
origin: Int = -1
): List<LimitResponse>
}
22 changes: 11 additions & 11 deletions app/src/main/java/com/pluscubed/velociraptor/api/LimitResponse.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ package com.pluscubed.velociraptor.api
import java.util.*

data class LimitResponse(
val fromCache: Boolean = false,
val debugInfo: String = "",
val origin: Int = ORIGIN_INVALID,
val error: Throwable? = null,
/**
* In km/h, -1 if limit does not exist
*/
val speedLimit: Int = -1,
val roadName: String = "",
val coords: List<Coord> = ArrayList(),
val timestamp: Long = 0
val fromCache: Boolean = false,
val debugInfo: String = "",
val origin: Int = ORIGIN_INVALID,
val error: Throwable? = null,
/**
* In km/h, -1 if limit does not exist
*/
val speedLimit: Int = -1,
val roadName: String = "",
val coords: List<Coord> = ArrayList(),
val timestamp: Long = 0
) {

val isEmpty: Boolean
Expand Down
Loading

0 comments on commit c42cfe0

Please sign in to comment.