forked from GitHub-Mirror/riotX-android
Update some dependencies
This commit is contained in:
parent
14d807232f
commit
168814149b
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -25,7 +25,7 @@
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
@ -23,6 +23,12 @@ android {
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,6 +24,12 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
@ -10,7 +10,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath "io.realm:realm-gradle-plugin:5.7.0"
|
||||
classpath "io.realm:realm-gradle-plugin:5.8.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,6 +43,11 @@ android {
|
||||
installOptions "-g"
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@ -51,7 +56,6 @@ dependencies {
|
||||
def support_version = '28.0.0'
|
||||
def moshi_version = '1.8.0'
|
||||
def lifecycle_version = "1.1.1"
|
||||
def powermock_version = "2.0.0-RC.4"
|
||||
|
||||
implementation fileTree(dir: 'libs', include: ['*.aar'])
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
@ -69,7 +73,7 @@ dependencies {
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
|
||||
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
|
||||
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
|
||||
implementation 'com.squareup.okio:okio:1.15.0'
|
||||
implementation 'com.squareup.okio:okio:1.16.0'
|
||||
implementation 'com.novoda:merlin:1.1.6'
|
||||
implementation 'com.google.code.gson:gson:2.8.5'
|
||||
implementation "com.squareup.moshi:moshi-adapters:$moshi_version"
|
||||
@ -83,7 +87,7 @@ dependencies {
|
||||
implementation "android.arch.paging:runtime:1.0.1"
|
||||
|
||||
// Work
|
||||
implementation "android.arch.work:work-runtime-ktx:1.0.0-alpha10"
|
||||
implementation "android.arch.work:work-runtime-ktx:1.0.0-alpha13"
|
||||
|
||||
// FP
|
||||
implementation "io.arrow-kt:arrow-core:$arrow_version"
|
||||
|
@ -33,7 +33,7 @@ internal class PruneEventWorker(context: Context,
|
||||
|
||||
override fun doWork(): Result {
|
||||
val params = WorkerParamsFactory.fromData<Params>(inputData)
|
||||
?: return Result.FAILURE
|
||||
?: return Result.failure()
|
||||
|
||||
val result = monarchy.tryTransactionAsync { realm ->
|
||||
params.updateIndexes.forEach { index ->
|
||||
@ -41,7 +41,7 @@ internal class PruneEventWorker(context: Context,
|
||||
pruneEvent(realm, data)
|
||||
}
|
||||
}
|
||||
return result.fold({ Result.RETRY }, { Result.SUCCESS })
|
||||
return result.fold({ Result.retry() }, { Result.success() })
|
||||
}
|
||||
|
||||
private fun pruneEvent(realm: Realm, redactionEvent: Event?) {
|
||||
|
@ -15,7 +15,6 @@ import im.vector.matrix.android.internal.session.group.model.GroupSummaryRespons
|
||||
import im.vector.matrix.android.internal.session.group.model.GroupUsers
|
||||
import im.vector.matrix.android.internal.util.CancelableCoroutine
|
||||
import im.vector.matrix.android.internal.util.MatrixCoroutineDispatchers
|
||||
import im.vector.matrix.android.internal.util.retry
|
||||
import im.vector.matrix.android.internal.util.tryTransactionSync
|
||||
import io.realm.kotlin.createObject
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
@ -31,7 +30,7 @@ internal class GetGroupDataRequest(
|
||||
callback: MatrixCallback<Boolean>
|
||||
): Cancelable {
|
||||
val job = GlobalScope.launch(coroutineDispatchers.main) {
|
||||
val groupOrFailure = retry { getGroupData(groupId) }
|
||||
val groupOrFailure = getGroupData(groupId)
|
||||
groupOrFailure.fold({ callback.onFailure(it) }, { callback.onSuccess(true) })
|
||||
}
|
||||
return CancelableCoroutine(job)
|
||||
|
@ -24,14 +24,14 @@ internal class GetGroupDataWorker(context: Context,
|
||||
|
||||
override fun doWork(): Result {
|
||||
val params = WorkerParamsFactory.fromData<Params>(inputData)
|
||||
?: return Result.FAILURE
|
||||
?: return Result.failure()
|
||||
|
||||
val results = params.updateIndexes.map { index ->
|
||||
val groupId = params.groupIds[index]
|
||||
fetchGroupData(groupId)
|
||||
}
|
||||
val isSuccessful = results.none { it.isFailure() }
|
||||
return if (isSuccessful) Result.SUCCESS else Result.RETRY
|
||||
return if (isSuccessful) Result.success() else Result.retry()
|
||||
}
|
||||
|
||||
private fun fetchGroupData(groupId: String): Try<Unit> {
|
||||
|
@ -1,6 +1,11 @@
|
||||
package im.vector.matrix.android.internal.session.room.send
|
||||
|
||||
import androidx.work.*
|
||||
import androidx.work.BackoffPolicy
|
||||
import androidx.work.Constraints
|
||||
import androidx.work.ExistingWorkPolicy
|
||||
import androidx.work.NetworkType
|
||||
import androidx.work.OneTimeWorkRequestBuilder
|
||||
import androidx.work.WorkManager
|
||||
import com.zhuinden.monarchy.Monarchy
|
||||
import im.vector.matrix.android.api.MatrixCallback
|
||||
import im.vector.matrix.android.api.session.events.model.Event
|
||||
@ -32,7 +37,7 @@ internal class DefaultSendService(private val roomId: String,
|
||||
|
||||
monarchy.tryTransactionAsync { realm ->
|
||||
val chunkEntity = ChunkEntity.findLastLiveChunkFromRoom(realm, roomId)
|
||||
?: return@tryTransactionAsync
|
||||
?: return@tryTransactionAsync
|
||||
chunkEntity.add(event, PaginationDirection.FORWARDS)
|
||||
chunkEntity.updateDisplayIndexes()
|
||||
}
|
||||
@ -46,11 +51,11 @@ internal class DefaultSendService(private val roomId: String,
|
||||
.setBackoffCriteria(BackoffPolicy.LINEAR, 10_000, TimeUnit.MILLISECONDS)
|
||||
.build()
|
||||
|
||||
val work = WorkManager.getInstance()
|
||||
WorkManager.getInstance()
|
||||
.beginUniqueWork(SEND_WORK, ExistingWorkPolicy.APPEND, sendWork)
|
||||
.enqueue()
|
||||
|
||||
return CancelableWork(work)
|
||||
return CancelableWork(sendWork.id)
|
||||
|
||||
}
|
||||
|
||||
|
@ -31,10 +31,10 @@ internal class SendEventWorker(context: Context, params: WorkerParameters)
|
||||
override fun doWork(): Result {
|
||||
|
||||
val params = WorkerParamsFactory.fromData<Params>(inputData)
|
||||
?: return Result.FAILURE
|
||||
?: return Result.failure()
|
||||
|
||||
if (params.event.eventId == null) {
|
||||
return Result.FAILURE
|
||||
return Result.failure()
|
||||
}
|
||||
|
||||
val result = executeRequest<SendResponse> {
|
||||
@ -51,7 +51,7 @@ internal class SendEventWorker(context: Context, params: WorkerParameters)
|
||||
dummyEventEntity?.eventId = sendResponse.eventId
|
||||
}
|
||||
}
|
||||
return result.fold({ Result.RETRY }, { Result.SUCCESS })
|
||||
return result.fold({ Result.retry() }, { Result.success() })
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
package im.vector.matrix.android.internal.util
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture
|
||||
import androidx.work.WorkManager
|
||||
import im.vector.matrix.android.api.util.Cancelable
|
||||
import kotlinx.coroutines.Job
|
||||
import java.util.*
|
||||
|
||||
internal class CancelableWork(private val work: ListenableFuture<Void>) : Cancelable {
|
||||
internal class CancelableWork(private val workId: UUID) : Cancelable {
|
||||
|
||||
override fun cancel() {
|
||||
work.cancel(true)
|
||||
WorkManager.getInstance().cancelWorkById(workId)
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user