Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
Chore/update gradle811 (#1622)
Browse files Browse the repository at this point in the history
* updated dependencies

build errors

* updated outdated implementations

* removed okio and updated gradle zip

* removed okio and updated gradle zip

* geofencing null check
  • Loading branch information
tobiasjungmann authored Oct 16, 2023
1 parent 95f9971 commit b151e84
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 72 deletions.
55 changes: 25 additions & 30 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ apply from: '../gradle/scripts/checkstyle.gradle'
apply from: '../gradle/scripts/testLogging.gradle'

android {
compileSdk 33
compileSdk 34
namespace "de.tum.in.tumcampusapp"
buildTypes {
all {
Expand All @@ -38,7 +38,7 @@ android {
defaultConfig {
applicationId "de.tum.in.tumcampus"
minSdkVersion 26
targetSdkVersion 33
targetSdkVersion 34
versionCode 588
versionName "4.3-dev"

Expand All @@ -57,11 +57,11 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
jvmTarget = JavaVersion.VERSION_17.toString()
}
testOptions {
unitTests {
Expand Down Expand Up @@ -96,34 +96,36 @@ dependencies {

// Support Libraries
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.5.0'
implementation 'com.google.android.material:material:1.10.0'
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

// Android arch components
implementation "androidx.room:room-rxjava2:$room_version"
implementation "androidx.room:room-runtime:$room_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.0'
implementation 'android.arch.lifecycle:reactivestreams:1.1.1'
implementation 'android.arch.work:work-runtime-ktx:1.0.1'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'androidx.lifecycle:lifecycle-common-java8:2.5.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.2'
implementation "androidx.lifecycle:lifecycle-reactivestreams-ktx:2.6.2"
implementation 'androidx.work:work-runtime-ktx:2.8.1'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.lifecycle:lifecycle-common-java8:2.6.2'
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"


// Play services
implementation 'com.google.android.gms:play-services-base:18.0.1'
implementation 'com.google.android.gms:play-services-location:19.0.1'
implementation 'com.google.android.gms:play-services-base:18.2.0'
implementation 'com.google.android.gms:play-services-location:21.0.1'

// Used for in-app reviews
implementation "com.google.android.play:core:$play_core_services"
implementation "com.google.android.play:core-ktx:$play_core_services_kotlin_extension"

// Firebase
implementation 'com.google.firebase:firebase-core:21.1.1'
implementation 'com.google.firebase:firebase-messaging:23.0.6'
implementation 'com.google.firebase:firebase-crashlytics-ktx:18.2.9'
implementation 'com.google.firebase:firebase-messaging:23.2.1'
implementation 'com.google.firebase:firebase-crashlytics-ktx:18.4.3'
implementation 'com.google.firebase:firebase-analytics-ktx:21.3.0'

// Helpers
Expand All @@ -137,11 +139,11 @@ dependencies {

// Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.fragment:fragment-ktx:1.4.1'
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.fragment:fragment-ktx:1.6.1'
// Note: fix for internal androidx libraries using outdated WorkManager causing a crash
implementation "androidx.work:work-runtime-ktx:2.7.1"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1'
implementation "androidx.work:work-runtime-ktx:2.8.1"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'

// RxJava
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
Expand All @@ -159,31 +161,25 @@ dependencies {
implementation 'com.squareup.picasso:picasso:2.8'
implementation "com.tickaroo.tikxml:retrofit-converter:$tikXmlVersion"
implementation 'com.github.franmontiel:PersistentCookieJar:1.0.1'
implementation 'com.squareup.okio:okio:2.10.0'

// UI
implementation 'com.github.mtotschnig:StickyListHeaders:2.8.0'
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
implementation 'me.dm7.barcodescanner:zxing:1.9.13' // unused, but removal leads to build errors
implementation 'com.journeyapps:zxing-android-embedded:3.6.0' // unused, but removal leads to build errors
implementation 'de.psdev.licensesdialog:licensesdialog:2.1.0'
implementation 'com.github.thellmund.Android-Week-View:core:4.1.6'
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'com.github.PhilJay:MPAndroidChart:3.1.0'
implementation 'com.makeramen:roundedimageview:2.3.0'

// Dagger
implementation 'com.google.dagger:dagger:2.28.3'
kapt 'com.google.dagger:dagger-compiler:2.28.3'
implementation 'com.google.dagger:dagger:2.38.1'
kapt 'com.google.dagger:dagger-compiler:2.38.1'

// LeakCanary
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.9.1'

// DebugDatabase
debugImplementation 'com.amitshekhar.android:debug-db:1.0.6'

// Testing
testImplementation 'androidx.test:core:1.4.0'
testImplementation 'androidx.test:core:1.5.0'
testImplementation "commons-io:commons-io:2.11.0"

testImplementation 'junit:junit:4.13.2'
Expand All @@ -198,7 +194,6 @@ dependencies {
testImplementation 'org.robolectric:robolectric:4.10.3'

// gRPC backend
implementation 'io.grpc:grpc-okhttp:1.58.0' // CURRENT_GRPC_VERSION
implementation 'io.grpc:grpc-protobuf-lite:1.58.0' // CURRENT_GRPC_VERSION
implementation 'io.grpc:grpc-stub:1.58.0' // CURRENT_GRPC_VERSION
implementation 'org.apache.tomcat:annotations-api:6.0.53'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.tum.`in`.tumcampusapp.component.other.generic.activity

import androidx.lifecycle.LiveDataReactiveStreams
import androidx.lifecycle.Observer
import androidx.lifecycle.toLiveData
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import de.tum.`in`.tumcampusapp.R
import de.tum.`in`.tumcampusapp.api.tumonline.CacheControl
Expand Down Expand Up @@ -33,7 +33,7 @@ abstract class ActivityForDownloadingExternal(layoutId: Int) : ProgressActivity<
/**
* Gets notifications from the DownloadWorker, if downloading was successful or not
*/
private val completionHandler = Observer<Unit> {
private val completionHandler = Observer<Unit?> {
// Calls onStart() to simulate a new start of the activity
// without downloading new data, since this receiver
// receives data from a new download
Expand All @@ -59,13 +59,11 @@ abstract class ActivityForDownloadingExternal(layoutId: Int) : ProgressActivity<
}

showLoadingStart()
LiveDataReactiveStreams
.fromPublisher<Unit>(
Flowable.fromCallable { method?.execute(forceDownload) }
.doOnError { errorHandler() }
.onErrorReturnItem(Unit)
.subscribeOn(Schedulers.io())
)
Flowable.fromCallable { method?.execute(forceDownload) }
.doOnError { errorHandler() }
.onErrorReturnItem(Unit)
.subscribeOn(Schedulers.io())
.toLiveData()
.observe(this, completionHandler)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package de.tum.`in`.tumcampusapp.component.other.generic.fragment

import androidx.annotation.LayoutRes
import androidx.annotation.StringRes
import androidx.lifecycle.LiveDataReactiveStreams
import androidx.lifecycle.Observer
import androidx.lifecycle.toLiveData
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import de.tum.`in`.tumcampusapp.R
import de.tum.`in`.tumcampusapp.api.tumonline.CacheControl
Expand Down Expand Up @@ -36,7 +36,7 @@ abstract class FragmentForDownloadingExternal(
/**
* Gets notifications from the DownloadWorker, if downloading was successful or not
*/
private val completionHandler = Observer<Unit> {
private val completionHandler = Observer<Unit?> {
// Calls onStart() to simulate a new start of the activity
// without downloading new data, since this receiver
// receives data from a new download
Expand All @@ -62,13 +62,11 @@ abstract class FragmentForDownloadingExternal(
}

showLoadingStart()
LiveDataReactiveStreams
.fromPublisher<Unit>(
Flowable.fromCallable { method?.execute(forceDownload) }
.doOnError { errorHandler() }
.onErrorReturnItem(Unit)
.subscribeOn(Schedulers.io())
)
Flowable.fromCallable { method?.execute(forceDownload) }
.doOnError { errorHandler() }
.onErrorReturnItem(Unit)
.subscribeOn(Schedulers.io())
.toLiveData()
.observe(this, completionHandler)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import android.os.Bundle
import androidx.core.app.ActivityCompat.checkSelfPermission
import androidx.core.app.ActivityCompat.requestPermissions
import androidx.core.app.ActivityCompat.shouldShowRequestPermissionRationale
import androidx.lifecycle.LiveDataReactiveStreams
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.toLiveData
import com.google.firebase.crashlytics.FirebaseCrashlytics
import de.tum.`in`.tumcampusapp.BuildConfig.DEBUG
import de.tum.`in`.tumcampusapp.BuildConfig.VERSION_CODE
Expand Down Expand Up @@ -121,9 +121,10 @@ class StartupActivity : BaseActivity(R.layout.activity_startup) {
.subscribeOn(Schedulers.io())

runOnUiThread {
LiveDataReactiveStreams
.fromPublisher(downloadActions)
.observe(this@StartupActivity) { openMainActivityIfInitializationFinished() }
downloadActions.toLiveData()
.observe(this@StartupActivity) {
openMainActivityIfInitializationFinished()
}
}

// Start background service and ensure cards are set
Expand Down Expand Up @@ -171,6 +172,7 @@ class StartupActivity : BaseActivity(R.layout.activity_startup) {
permissions: Array<String>,
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
openMainActivityIfInitializationFinished()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ViewModelFactory<T : ViewModel>(
) : ViewModelProvider.Factory {

@Suppress("UNCHECKED_CAST")
override fun <T : ViewModel?> create(modelClass: Class<T>): T {
override fun <T : ViewModel> create(modelClass: Class<T>): T {
return provider.get() as T
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,26 @@ class GeofencingUpdateReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
Utils.logWithTag(TAG, "Received event")
val geofencingEvent = GeofencingEvent.fromIntent(intent)
if (geofencingEvent.hasError()) {
Utils.logWithTag(TAG, "Geofencing event contained errors.")
return
}
if (geofencingEvent != null) {
if (geofencingEvent.hasError()) {
Utils.logWithTag(TAG, "Geofencing event contained errors.")
return
}

// Get the transition type.
val geofenceTransition = geofencingEvent.geofenceTransition
// Get the transition type.
val geofenceTransition = geofencingEvent.geofenceTransition

if (geofenceTransition == Geofence.GEOFENCE_TRANSITION_ENTER) {
Utils.setSetting(context, Const.BACKGROUND_MODE, true)
StartSyncReceiver.startBackground(context)
Utils.logWithTag(TAG, "Geofencing detected user entering munich, enabling Auto updates")
} else if (geofenceTransition == Geofence.GEOFENCE_TRANSITION_EXIT) {
Utils.setSetting(context, Const.BACKGROUND_MODE, false)
StartSyncReceiver.cancelBackground(context)
Utils.logWithTag(TAG, "Geofencing detected user leaving munich, disabling Auto updates")
if (geofenceTransition == Geofence.GEOFENCE_TRANSITION_ENTER) {
Utils.setSetting(context, Const.BACKGROUND_MODE, true)
StartSyncReceiver.startBackground(context)
Utils.logWithTag(TAG, "Geofencing detected user entering munich, enabling Auto updates")
} else if (geofenceTransition == Geofence.GEOFENCE_TRANSITION_EXIT) {
Utils.setSetting(context, Const.BACKGROUND_MODE, false)
StartSyncReceiver.cancelBackground(context)
Utils.logWithTag(TAG, "Geofencing detected user leaving munich, disabling Auto updates")
}
} else {
Utils.logWithTag(TAG, "Geofencing event was null. Modes are not changed")
}
}

Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

buildscript {
ext {
kotlin_version = '1.7.0'
kotlin_version = '1.8.22'
room_version = '2.5.2'
}
repositories {
Expand All @@ -12,13 +12,13 @@ buildscript {
maven { url "https://jitpack.io"}
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'com.android.tools.build:gradle:8.1.1'
classpath 'com.google.gms:google-services:4.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'org.jlleitschuh.gradle:ktlint-gradle:11.5.1'
classpath "com.github.ben-manes:gradle-versions-plugin:0.43.0"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.13.1"
classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.18"
classpath "com.google.protobuf:protobuf-gradle-plugin:0.9.0"
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9'
}
}
Expand All @@ -36,7 +36,7 @@ allprojects {

repositories {
google()
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
maven { url 'https://maven.google.com/' }
}
Expand Down
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ android.enableJetifier=true

# see https://kotlinlang.org/docs/whatsnew17.html#build-reports-for-kotlin-compiler-tasks
kotlin.incremental.useClasspathSnapshot=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip

0 comments on commit b151e84

Please sign in to comment.