mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-21 12:35:30 +03:00
WIP running into 412 errors
Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
This commit is contained in:
parent
3908d0ce14
commit
36655ffac3
4 changed files with 32 additions and 1 deletions
|
@ -10,6 +10,7 @@ package com.nextcloud.talk.chat.data
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import com.nextcloud.talk.chat.data.io.LifecycleAwareManager
|
import com.nextcloud.talk.chat.data.io.LifecycleAwareManager
|
||||||
import com.nextcloud.talk.chat.data.model.ChatMessage
|
import com.nextcloud.talk.chat.data.model.ChatMessage
|
||||||
|
import com.nextcloud.talk.data.database.model.ChatMessageEntity
|
||||||
import com.nextcloud.talk.models.domain.ConversationModel
|
import com.nextcloud.talk.models.domain.ConversationModel
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
@ -65,6 +66,11 @@ interface ChatMessageRepository : LifecycleAwareManager {
|
||||||
*/
|
*/
|
||||||
suspend fun getMessage(messageId: Long, bundle: Bundle): Flow<ChatMessage>
|
suspend fun getMessage(messageId: Long, bundle: Bundle): Flow<ChatMessage>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO
|
||||||
|
*/
|
||||||
|
suspend fun updateDBAfterPushNotification(message: ChatMessageEntity)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys unused resources.
|
* Destroys unused resources.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -391,6 +391,10 @@ class OfflineFirstChatRepository @Inject constructor(
|
||||||
.map(ChatMessageEntity::asModel)
|
.map(ChatMessageEntity::asModel)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override suspend fun updateDBAfterPushNotification(message: ChatMessageEntity) {
|
||||||
|
// TODO Figure this out
|
||||||
|
}
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST", "MagicNumber")
|
@Suppress("UNCHECKED_CAST", "MagicNumber")
|
||||||
private fun getMessagesFromServer(bundle: Bundle): Pair<Int, List<ChatMessageJson>>? {
|
private fun getMessagesFromServer(bundle: Bundle): Pair<Int, List<ChatMessageJson>>? {
|
||||||
val fieldMap = bundle.getSerializable(BundleKeys.KEY_FIELD_MAP) as HashMap<String, Int>
|
val fieldMap = bundle.getSerializable(BundleKeys.KEY_FIELD_MAP) as HashMap<String, Int>
|
||||||
|
|
|
@ -108,7 +108,7 @@ abstract class TalkDatabase : RoomDatabase() {
|
||||||
return Room
|
return Room
|
||||||
.databaseBuilder(context.applicationContext, TalkDatabase::class.java, dbName)
|
.databaseBuilder(context.applicationContext, TalkDatabase::class.java, dbName)
|
||||||
// comment out openHelperFactory to view the database entries in Android Studio for debugging
|
// comment out openHelperFactory to view the database entries in Android Studio for debugging
|
||||||
.openHelperFactory(factory)
|
// .openHelperFactory(factory)
|
||||||
.addMigrations(
|
.addMigrations(
|
||||||
Migrations.MIGRATION_6_8,
|
Migrations.MIGRATION_6_8,
|
||||||
Migrations.MIGRATION_7_8,
|
Migrations.MIGRATION_7_8,
|
||||||
|
|
|
@ -49,7 +49,9 @@ import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
|
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
|
||||||
import com.nextcloud.talk.arbitrarystorage.ArbitraryStorageManager
|
import com.nextcloud.talk.arbitrarystorage.ArbitraryStorageManager
|
||||||
import com.nextcloud.talk.callnotification.CallNotificationActivity
|
import com.nextcloud.talk.callnotification.CallNotificationActivity
|
||||||
|
import com.nextcloud.talk.chat.data.ChatMessageRepository
|
||||||
import com.nextcloud.talk.chat.data.network.ChatNetworkDataSource
|
import com.nextcloud.talk.chat.data.network.ChatNetworkDataSource
|
||||||
|
import com.nextcloud.talk.conversationlist.data.network.OfflineFirstConversationsRepository
|
||||||
import com.nextcloud.talk.models.SignatureVerification
|
import com.nextcloud.talk.models.SignatureVerification
|
||||||
import com.nextcloud.talk.models.domain.ConversationModel
|
import com.nextcloud.talk.models.domain.ConversationModel
|
||||||
import com.nextcloud.talk.models.json.chat.ChatUtils.Companion.getParsedMessage
|
import com.nextcloud.talk.models.json.chat.ChatUtils.Companion.getParsedMessage
|
||||||
|
@ -96,6 +98,9 @@ import io.reactivex.Observer
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.disposables.Disposable
|
import io.reactivex.disposables.Disposable
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.schedulers.Schedulers
|
||||||
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
import okhttp3.JavaNetCookieJar
|
import okhttp3.JavaNetCookieJar
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import retrofit2.Retrofit
|
import retrofit2.Retrofit
|
||||||
|
@ -131,6 +136,12 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var userManager: UserManager
|
lateinit var userManager: UserManager
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
lateinit var chatMessageRepository: ChatMessageRepository
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
lateinit var conversationsRepository: OfflineFirstConversationsRepository
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
@Inject
|
@Inject
|
||||||
var okHttpClient: OkHttpClient? = null
|
var okHttpClient: OkHttpClient? = null
|
||||||
|
@ -203,6 +214,16 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor
|
||||||
} else {
|
} else {
|
||||||
showNotification(mainActivityIntent, null)
|
showNotification(mainActivityIntent, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadMessageToDB()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadMessageToDB() {
|
||||||
|
val token = pushMessage.id
|
||||||
|
|
||||||
|
CoroutineScope(Dispatchers.Default).launch {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleRemoteTalkSharePushMessage() {
|
private fun handleRemoteTalkSharePushMessage() {
|
||||||
|
|
Loading…
Reference in a new issue