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

Commit

Permalink
Fix logic in topnewscard, update couple of deps.
Browse files Browse the repository at this point in the history
  • Loading branch information
kordianbruck committed Jan 22, 2021
1 parent e2aabf0 commit 31f5fdb
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
16 changes: 8 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -104,25 +104,25 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'

// Android arch components
implementation 'androidx.room:room-rxjava2:2.3.0-alpha03'
implementation 'androidx.room:room-runtime:2.3.0-alpha03'
implementation 'androidx.room:room-rxjava2:2.3.0-alpha04'
implementation 'androidx.room:room-runtime:2.3.0-alpha04'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.2.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'android.arch.lifecycle:reactivestreams:1.1.1'
implementation 'android.arch.work:work-runtime-ktx:1.0.1'
implementation 'androidx.appcompat:appcompat:1.2.0'
kapt 'androidx.lifecycle:lifecycle-compiler:2.2.0'
kapt 'androidx.room:room-compiler:2.3.0-alpha03'
kapt 'androidx.room:room-compiler:2.3.0-alpha04'

// Play services
implementation 'com.google.android.gms:play-services-base:17.5.0'
implementation 'com.google.android.gms:play-services-location:17.1.0'

// Firebase
implementation 'com.google.firebase:firebase-core:18.0.0'
implementation 'com.google.firebase:firebase-messaging:21.0.0'
implementation 'com.google.firebase:firebase-crashlytics-ktx:17.2.2'
implementation 'com.google.firebase:firebase-analytics-ktx:18.0.0'
implementation 'com.google.firebase:firebase-core:18.0.1'
implementation 'com.google.firebase:firebase-messaging:21.0.1'
implementation 'com.google.firebase:firebase-crashlytics-ktx:17.3.0'
implementation 'com.google.firebase:firebase-analytics-ktx:18.0.1'

// Helpers
implementation 'com.google.code.gson:gson:2.8.6'
Expand Down Expand Up @@ -182,7 +182,7 @@ dependencies {
testImplementation 'junit:junit:4.13'
testImplementation 'org.mockito:mockito-core:3.5.11'
testImplementation 'org.assertj:assertj-core:3.17.1'
testImplementation 'androidx.room:room-testing:2.3.0-alpha03'
testImplementation 'androidx.room:room-testing:2.3.0-alpha04'
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"

testImplementation 'com.android.support.test:rules:1.0.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ class TopNewsCard(context: Context) : Card(CardManager.CARD_TOP_NEWS, context, "
}

override fun shouldShow(prefs: SharedPreferences): Boolean {
return if (newsAlert == null) {
false
} else topNewsStore.isEnabled() && newsAlert.shouldDisplay
return newsAlert != null && topNewsStore.isEnabled() && newsAlert.shouldDisplay
}

public override fun discard(editor: SharedPreferences.Editor) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class RealTopNewsStore @Inject constructor(
}

val displayUntil = sharedPrefs.getString(Const.NEWS_ALERT_SHOW_UNTIL, "")!!
val until: DateTime = DateTimeUtils.parseIsoDateWithMillis(displayUntil)!!
val until: DateTime? = DateTimeUtils.parseIsoDateWithMillis(displayUntil)
if (until == null || until.isBeforeNow) {
return null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.Context
import android.content.SharedPreferences
import android.content.SharedPreferences.Editor
import android.preference.PreferenceManager
import android.util.Log
import androidx.recyclerview.widget.DiffUtil
import de.tum.`in`.tumcampusapp.R
import de.tum.`in`.tumcampusapp.component.other.navigation.NavDestination
Expand All @@ -18,9 +19,9 @@ import de.tum.`in`.tumcampusapp.utils.Utils
* @param settingsPrefix Preference key prefix used for all preferences belonging to that card
*/
abstract class Card(
val cardType: Int,
protected var context: Context,
val settingsPrefix: String = ""
val cardType: Int,
protected var context: Context,
val settingsPrefix: String = ""
) : Comparable<Card> {

// Settings for showing this card on start page or as notification
Expand Down Expand Up @@ -111,6 +112,7 @@ abstract class Card(
e.putBoolean(settingsPrefix + "_start", false)
e.putBoolean(settingsPrefix + "_phone", false)
e.apply()
Utils.log("Hiding card: $settingsPrefix")
}

override fun compareTo(other: Card): Int {
Expand All @@ -125,8 +127,8 @@ abstract class Card(
protected abstract fun discard(editor: Editor)

class DiffCallback(
private val oldList: List<Card>,
private val newList: List<Card>
private val oldList: List<Card>,
private val newList: List<Card>
) : DiffUtil.Callback() {

override fun getOldListSize() = oldList.size
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.4.10'
ext.kotlin_version = '1.4.21'
repositories {
google()
jcenter()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:4.1.1'
classpath 'com.google.gms:google-services:4.3.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'org.jlleitschuh.gradle:ktlint-gradle:8.2.0'
classpath "com.github.ben-manes:gradle-versions-plugin:0.33.0"
classpath "com.github.ben-manes:gradle-versions-plugin:0.36.0"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.13.1"
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
}
}

Expand Down

0 comments on commit 31f5fdb

Please sign in to comment.