Skip to content

Commit

Permalink
Merge pull request #415 from mjaakko/remove_live_data
Browse files Browse the repository at this point in the history
Remove livedata dependencies
  • Loading branch information
mjaakko authored Jan 19, 2025
2 parents 31c85ef + a048dd9 commit 9ec795a
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 27 deletions.
2 changes: 0 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ dependencies {
def lifecycle_version = '2.8.7'

implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-runtime-compose:$lifecycle_version"
Expand All @@ -202,7 +201,6 @@ dependencies {
implementation 'androidx.compose.ui:ui-tooling-preview'

implementation 'androidx.compose.material3:material3'
implementation "androidx.compose.runtime:runtime-livedata"

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
Expand Down
22 changes: 0 additions & 22 deletions app/src/main/java/xyz/malkki/neostumbler/db/dao/StatisticsDao.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package xyz.malkki.neostumbler.db.dao

import androidx.lifecycle.LiveData
import androidx.room.Dao
import androidx.room.MapColumn
import androidx.room.Query
Expand Down Expand Up @@ -29,25 +28,4 @@ interface StatisticsDao {
"""
)
fun newCellsPerDay(): Flow<Map<@MapColumn("date") LocalDate, @MapColumn("count") Long>>

@Query(
"""
SELECT COUNT(DISTINCT macAddress) FROM WifiAccessPointEntity
"""
)
fun distinctWifisCount(): LiveData<Long>

@Query(
"""
SELECT COUNT(DISTINCT macAddress) FROM BluetoothBeaconEntity
"""
)
fun distinctBeaconsCount(): LiveData<Long>

@Query(
"""
SELECT COUNT(*) FROM (SELECT DISTINCT radioType, mobileCountryCode, mobileNetworkCode, locationAreaCode, cellId, primaryScramblingCode FROM CellTowerEntity)
"""
)
fun distinctCellsCount(): LiveData<Long>
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.core.content.ContextCompat
import androidx.lifecycle.asFlow
import androidx.work.BackoffPolicy
import androidx.work.Constraints
import androidx.work.ExistingWorkPolicy
Expand All @@ -47,8 +46,7 @@ import kotlin.time.toJavaDuration
/**
* Returns a flow which emits booleans indicating whether an upload can be started
*/
private fun WorkManager.getCanUploadFlow(): Flow<Boolean> = getWorkInfosForUniqueWorkLiveData(ReportSendWorker.ONE_TIME_WORK_NAME)
.asFlow()
private fun WorkManager.getCanUploadFlow(): Flow<Boolean> = getWorkInfosForUniqueWorkFlow(ReportSendWorker.ONE_TIME_WORK_NAME)
.map { workInfos ->
workInfos.none { workInfo ->
workInfo.state == WorkInfo.State.ENQUEUED
Expand Down

0 comments on commit 9ec795a

Please sign in to comment.